]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * IRC - Internet Relay Chat, include/msg.h | |
3 | * Copyright (C) 1990 Jarkko Oikarinen and | |
4 | * University of Oulu, Computing Center | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 1, or (at your option) | |
9 | * any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
19 | */ | |
20 | /** @file | |
21 | * @brief Command and token declarations and structures. | |
22 | * @version $Id: msg.h,v 1.18 2005/04/02 02:50:13 entrope Exp $ | |
23 | */ | |
24 | #ifndef INCLUDED_msg_h | |
25 | #define INCLUDED_msg_h | |
26 | #ifndef INCLUDED_ircd_handler_h | |
27 | #include "ircd_handler.h" | |
28 | #endif | |
29 | ||
30 | struct Client; | |
31 | ||
32 | /* | |
33 | * General defines | |
34 | */ | |
35 | ||
36 | #define MAXPARA 15 | |
37 | ||
38 | /*----------------------------------------------------------------------------- | |
39 | * Macros | |
40 | */ | |
41 | ||
42 | /* | |
43 | * Tokenization: | |
44 | * Each command must have a TOK_COMMAND and MSG_COMMAND definition. | |
45 | * If you don't want one or the other, make them the same. | |
46 | * Also each command has a "msgclass" used for debugging purposes. | |
47 | */ | |
48 | ||
49 | /* *INDENT-OFF* */ | |
50 | ||
51 | #define MSG_PRIVATE "PRIVMSG" /* PRIV */ | |
52 | #define TOK_PRIVATE "P" | |
53 | #define CMD_PRIVATE MSG_PRIVATE, TOK_PRIVATE | |
54 | ||
55 | #define MSG_WHO "WHO" /* WHO -> WHOC */ | |
56 | #define TOK_WHO "H" | |
57 | #define CMD_WHO MSG_WHO, TOK_WHO | |
58 | ||
59 | #define MSG_WHOIS "WHOIS" /* WHOI */ | |
60 | #define TOK_WHOIS "W" | |
61 | #define CMD_WHOIS MSG_WHOIS, TOK_WHOIS | |
62 | ||
63 | #define MSG_WHOWAS "WHOWAS" /* WHOW */ | |
64 | #define TOK_WHOWAS "X" | |
65 | #define CMD_WHOWAS MSG_WHOWAS, TOK_WHOWAS | |
66 | ||
67 | #define MSG_USER "USER" /* USER */ | |
68 | #define TOK_USER "USER" | |
69 | #define CMD_USER MSG_USER, TOK_USER | |
70 | ||
71 | #define MSG_NICK "NICK" /* NICK */ | |
72 | #define TOK_NICK "N" | |
73 | #define CMD_NICK MSG_NICK, TOK_NICK | |
74 | ||
75 | #define MSG_SERVER "SERVER" /* SERV */ | |
76 | #define TOK_SERVER "S" | |
77 | #define CMD_SERVER MSG_SERVER, TOK_SERVER | |
78 | ||
79 | #define MSG_LIST "LIST" /* LIST */ | |
80 | #define TOK_LIST "LIST" | |
81 | #define CMD_LIST MSG_LIST, TOK_LIST | |
82 | ||
83 | #define MSG_TOPIC "TOPIC" /* TOPI */ | |
84 | #define TOK_TOPIC "T" | |
85 | #define CMD_TOPIC MSG_TOPIC, TOK_TOPIC | |
86 | ||
87 | #define MSG_INVITE "INVITE" /* INVI */ | |
88 | #define TOK_INVITE "I" | |
89 | #define CMD_INVITE MSG_INVITE, TOK_INVITE | |
90 | ||
91 | #define MSG_VERSION "VERSION" /* VERS */ | |
92 | #define TOK_VERSION "V" | |
93 | #define CMD_VERSION MSG_VERSION, TOK_VERSION | |
94 | ||
95 | #define MSG_QUIT "QUIT" /* QUIT */ | |
96 | #define TOK_QUIT "Q" | |
97 | #define CMD_QUIT MSG_QUIT, TOK_QUIT | |
98 | ||
99 | #define MSG_SQUIT "SQUIT" /* SQUI */ | |
100 | #define TOK_SQUIT "SQ" | |
101 | #define CMD_SQUIT MSG_SQUIT, TOK_SQUIT | |
102 | ||
103 | #define MSG_KILL "KILL" /* KILL */ | |
104 | #define TOK_KILL "D" | |
105 | #define CMD_KILL MSG_KILL, TOK_KILL | |
106 | ||
107 | #define MSG_INFO "INFO" /* INFO */ | |
108 | #define TOK_INFO "F" | |
109 | #define CMD_INFO MSG_INFO, TOK_INFO | |
110 | ||
111 | #define MSG_LINKS "LINKS" /* LINK */ | |
112 | #define TOK_LINKS "LI" | |
113 | #define CMD_LINKS MSG_LINKS, TOK_LINKS | |
114 | ||
115 | #define MSG_STATS "STATS" /* STAT */ | |
116 | #define TOK_STATS "R" | |
117 | #define CMD_STATS MSG_STATS, TOK_STATS | |
118 | ||
119 | #define MSG_HELP "HELP" /* HELP */ | |
120 | #define TOK_HELP "HELP" | |
121 | #define CMD_HELP MSG_HELP, TOK_HELP | |
122 | ||
123 | #define MSG_ERROR "ERROR" /* ERRO */ | |
124 | #define TOK_ERROR "Y" | |
125 | #define CMD_ERROR MSG_ERROR, TOK_ERROR | |
126 | ||
127 | #define MSG_AWAY "AWAY" /* AWAY */ | |
128 | #define TOK_AWAY "A" | |
129 | #define CMD_AWAY MSG_AWAY, TOK_AWAY | |
130 | ||
131 | #define MSG_CONNECT "CONNECT" /* CONN */ | |
132 | #define TOK_CONNECT "CO" | |
133 | #define CMD_CONNECT MSG_CONNECT, TOK_CONNECT | |
134 | ||
135 | #define MSG_MAP "MAP" /* MAP */ | |
136 | #define TOK_MAP "MAP" | |
137 | #define CMD_MAP MSG_MAP, TOK_MAP | |
138 | ||
139 | #define MSG_PING "PING" /* PING */ | |
140 | #define TOK_PING "G" | |
141 | #define CMD_PING MSG_PING, TOK_PING | |
142 | ||
143 | #define MSG_PONG "PONG" /* PONG */ | |
144 | #define TOK_PONG "Z" | |
145 | #define CMD_PONG MSG_PONG, TOK_PONG | |
146 | ||
147 | #define MSG_OPER "OPER" /* OPER */ | |
148 | #define TOK_OPER "OPER" | |
149 | #define CMD_OPER MSG_OPER, TOK_OPER | |
150 | ||
151 | #define MSG_PASS "PASS" /* PASS */ | |
152 | #define TOK_PASS "PA" | |
153 | #define CMD_PASS MSG_PASS, TOK_PASS | |
154 | ||
155 | #define MSG_WALLOPS "WALLOPS" /* WALL */ | |
156 | #define TOK_WALLOPS "WA" | |
157 | #define CMD_WALLOPS MSG_WALLOPS, TOK_WALLOPS | |
158 | ||
159 | #define MSG_WALLUSERS "WALLUSERS" /* WALL */ | |
160 | #define TOK_WALLUSERS "WU" | |
161 | #define CMD_WALLUSERS MSG_WALLUSERS, TOK_WALLUSERS | |
162 | ||
163 | #define MSG_DESYNCH "DESYNCH" /* DESY */ | |
164 | #define TOK_DESYNCH "DS" | |
165 | #define CMD_DESYNCH MSG_DESYNCH, TOK_DESYNCH | |
166 | ||
167 | #define MSG_TIME "TIME" /* TIME */ | |
168 | #define TOK_TIME "TI" | |
169 | #define CMD_TIME MSG_TIME, TOK_TIME | |
170 | ||
171 | #define MSG_SETTIME "SETTIME" /* SETT */ | |
172 | #define TOK_SETTIME "SE" | |
173 | #define CMD_SETTIME MSG_SETTIME, TOK_SETTIME | |
174 | ||
175 | #define MSG_RPING "RPING" /* RPIN */ | |
176 | #define TOK_RPING "RI" | |
177 | #define CMD_RPING MSG_RPING, TOK_RPING | |
178 | ||
179 | #define MSG_RPONG "RPONG" /* RPON */ | |
180 | #define TOK_RPONG "RO" | |
181 | #define CMD_RPONG MSG_RPONG, TOK_RPONG | |
182 | ||
183 | #define MSG_NAMES "NAMES" /* NAME */ | |
184 | #define TOK_NAMES "E" | |
185 | #define CMD_NAMES MSG_NAMES, TOK_NAMES | |
186 | ||
187 | #define MSG_ADMIN "ADMIN" /* ADMI */ | |
188 | #define TOK_ADMIN "AD" | |
189 | #define CMD_ADMIN MSG_ADMIN, TOK_ADMIN | |
190 | ||
191 | #define MSG_TRACE "TRACE" /* TRAC */ | |
192 | #define TOK_TRACE "TR" | |
193 | #define CMD_TRACE MSG_TRACE, TOK_TRACE | |
194 | ||
195 | #define MSG_NOTICE "NOTICE" /* NOTI */ | |
196 | #define TOK_NOTICE "O" | |
197 | #define CMD_NOTICE MSG_NOTICE, TOK_NOTICE | |
198 | ||
199 | #define MSG_WALLCHOPS "WALLCHOPS" /* WC */ | |
200 | #define TOK_WALLCHOPS "WC" | |
201 | #define CMD_WALLCHOPS MSG_WALLCHOPS, TOK_WALLCHOPS | |
202 | ||
203 | #define MSG_WALLVOICES "WALLVOICES" /* WV */ | |
204 | #define TOK_WALLVOICES "WV" | |
205 | #define CMD_WALLVOICES MSG_WALLVOICES, TOK_WALLVOICES | |
206 | ||
207 | #define MSG_CPRIVMSG "CPRIVMSG" /* CPRI */ | |
208 | #define TOK_CPRIVMSG "CP" | |
209 | #define CMD_CPRIVMSG MSG_CPRIVMSG, TOK_CPRIVMSG | |
210 | ||
211 | #define MSG_CNOTICE "CNOTICE" /* CNOT */ | |
212 | #define TOK_CNOTICE "CN" | |
213 | #define CMD_CNOTICE MSG_CNOTICE, TOK_CNOTICE | |
214 | ||
215 | #define MSG_JOIN "JOIN" /* JOIN */ | |
216 | #define TOK_JOIN "J" | |
217 | #define CMD_JOIN MSG_JOIN, TOK_JOIN | |
218 | ||
219 | #define MSG_PART "PART" /* PART */ | |
220 | #define TOK_PART "L" | |
221 | #define CMD_PART MSG_PART, TOK_PART | |
222 | ||
223 | #define MSG_LUSERS "LUSERS" /* LUSE */ | |
224 | #define TOK_LUSERS "LU" | |
225 | #define CMD_LUSERS MSG_LUSERS, TOK_LUSERS | |
226 | ||
227 | #define MSG_MOTD "MOTD" /* MOTD */ | |
228 | #define TOK_MOTD "MO" | |
229 | #define CMD_MOTD MSG_MOTD, TOK_MOTD | |
230 | ||
231 | #define MSG_MODE "MODE" /* MODE */ | |
232 | #define TOK_MODE "M" | |
233 | #define CMD_MODE MSG_MODE, TOK_MODE | |
234 | ||
235 | #define MSG_KICK "KICK" /* KICK */ | |
236 | #define TOK_KICK "K" | |
237 | #define CMD_KICK MSG_KICK, TOK_KICK | |
238 | ||
239 | #define MSG_USERHOST "USERHOST" /* USER -> USRH */ | |
240 | #define TOK_USERHOST "USERHOST" | |
241 | #define CMD_USERHOST MSG_USERHOST, TOK_USERHOST | |
242 | ||
243 | #define MSG_USERIP "USERIP" /* USER -> USIP */ | |
244 | #define TOK_USERIP "USERIP" | |
245 | #define CMD_USERIP MSG_USERIP, TOK_USERIP | |
246 | ||
247 | #define MSG_ISON "ISON" /* ISON */ | |
248 | #define TOK_ISON "ISON" | |
249 | #define CMD_ISON MSG_ISON, TOK_ISON | |
250 | ||
251 | #define MSG_SQUERY "SQUERY" /* SQUE */ | |
252 | #define TOK_SQUERY "SQUERY" | |
253 | #define CMD_SQUERY MSG_SQUERY, TOK_SQUERY | |
254 | ||
255 | #define MSG_SERVLIST "SERVLIST" /* SERV -> SLIS */ | |
256 | #define TOK_SERVLIST "SERVSET" | |
257 | #define CMD_SERVLIST MSG_SERVLIST, TOK_SERVLIST | |
258 | ||
259 | #define MSG_SERVSET "SERVSET" /* SERV -> SSET */ | |
260 | #define TOK_SERVSET "SERVSET" | |
261 | #define CMD_SERVSET MSG_SERVSET, TOK_SERVSET | |
262 | ||
263 | #define MSG_CHECK "CHECK" | |
264 | #define TOK_CHECK "CC" | |
265 | ||
266 | #define MSG_REHASH "REHASH" /* REHA */ | |
267 | #define TOK_REHASH "REHASH" | |
268 | #define CMD_REHASH MSG_REHASH, TOK_REHASH | |
269 | ||
270 | #define MSG_RESTART "RESTART" /* REST */ | |
271 | #define TOK_RESTART "RESTART" | |
272 | #define CMD_RESTART MSG_RESTART, TOK_RESTART | |
273 | ||
274 | #define MSG_CLOSE "CLOSE" /* CLOS */ | |
275 | #define TOK_CLOSE "CLOSE" | |
276 | #define CMD_CLOSE MSG_CLOSE, TOK_CLOSE | |
277 | ||
278 | #define MSG_DIE "DIE" /* DIE */ | |
279 | #define TOK_DIE "DIE" | |
280 | #define CMD_DIE MSG_DIE, TOK_DIE | |
281 | ||
282 | #define MSG_HASH "HASH" /* HASH */ | |
283 | #define TOK_HASH "HASH" | |
284 | #define CMD_HASH MSG_HASH, TOK_HASH | |
285 | ||
286 | #define MSG_DNS "DNS" /* DNS -> DNSS */ | |
287 | #define TOK_DNS "DNS" | |
288 | #define CMD_DNS MSG_DNS, TOK_DNS | |
289 | ||
290 | #define MSG_SILENCE "SILENCE" /* SILE */ | |
291 | #define TOK_SILENCE "U" | |
292 | #define CMD_SILENCE MSG_SILENCE, TOK_SILENCE | |
293 | ||
294 | #define MSG_GLINE "GLINE" /* GLIN */ | |
295 | #define TOK_GLINE "GL" | |
296 | #define CMD_GLINE MSG_GLINE, TOK_GLINE | |
297 | ||
298 | #define MSG_BURST "BURST" /* BURS */ | |
299 | #define TOK_BURST "B" | |
300 | #define CMD_BURST MSG_BURST, TOK_BURST | |
301 | ||
302 | #define MSG_UPING "UPING" /* UPIN */ | |
303 | #define TOK_UPING "UP" | |
304 | #define CMD_UPING MSG_UPING, TOK_UPING | |
305 | ||
306 | #define MSG_CREATE "CREATE" /* CREA */ | |
307 | #define TOK_CREATE "C" | |
308 | #define CMD_CREATE MSG_CREATE, TOK_CREATE | |
309 | ||
310 | #define MSG_DESTRUCT "DESTRUCT" /* DEST */ | |
311 | #define TOK_DESTRUCT "DE" | |
312 | #define CMD_DESTRUCT MSG_DESTRUCT, TOK_DESTRUCT | |
313 | ||
314 | #define MSG_END_OF_BURST "END_OF_BURST" /* END_ */ | |
315 | #define TOK_END_OF_BURST "EB" | |
316 | #define CMD_END_OF_BURST MSG_END_OF_BURST, TOK_END_OF_BURST | |
317 | ||
318 | #define MSG_END_OF_BURST_ACK "EOB_ACK" /* EOB_ */ | |
319 | #define TOK_END_OF_BURST_ACK "EA" | |
320 | #define CMD_END_OF_BURST_ACK MSG_END_OF_BURST_ACK, TOK_END_OF_BURST_ACK | |
321 | ||
322 | #define MSG_PROTO "PROTO" /* PROTO */ | |
323 | #define TOK_PROTO "PROTO" /* PROTO */ | |
324 | #define CMD_PROTO MSG_PROTO, TOK_PROTO | |
325 | ||
326 | #define MSG_JUPE "JUPE" /* JUPE */ | |
327 | #define TOK_JUPE "JU" | |
328 | #define CMD_JUPE MSG_JUPE, TOK_JUPE | |
329 | ||
330 | #define MSG_OPMODE "OPMODE" /* OPMO */ | |
331 | #define TOK_OPMODE "OM" | |
332 | #define CMD_OPMODE MSG_OPMODE, TOK_OPMODE | |
333 | ||
334 | #define MSG_CLEARMODE "CLEARMODE" /* CLMO */ | |
335 | #define TOK_CLEARMODE "CM" | |
336 | #define CMD_CLEARMODE MSG_CLEARMODE, TOK_CLEARMODE | |
337 | ||
338 | #define MSG_ACCOUNT "ACCOUNT" /* ACCO */ | |
339 | #define TOK_ACCOUNT "AC" | |
340 | #define CMD_ACCOUNT MSG_ACCOUNT, TOK_ACCOUNT | |
341 | ||
342 | #define MSG_ASLL "ASLL" /* ASLL */ | |
343 | #define TOK_ASLL "LL" | |
344 | #define CMD_ASLL MSG_ASLL, TOK_ASLL | |
345 | ||
346 | #define MSG_POST "POST" /* POST */ | |
347 | #define TOK_POST "POST" | |
348 | ||
349 | #define MSG_SET "SET" /* SET */ | |
350 | #define TOK_SET "SET" | |
351 | ||
352 | #define MSG_RESET "RESET" /* RESE */ | |
353 | #define TOK_RESET "RESET" | |
354 | ||
355 | #define MSG_GET "GET" /* GET */ | |
356 | #define TOK_GET "GET" | |
357 | ||
358 | #define MSG_PRIVS "PRIVS" /* PRIV */ | |
359 | #define TOK_PRIVS "PR" | |
360 | #define CMD_PRIVS MSG_PRIVS, TOK_PRIVS | |
361 | ||
362 | #define MSG_SETHOST "SETHOST" /* SETHOST */ | |
363 | #define TOK_SETHOST "SH" | |
364 | #define CMD_SETHOST MSG_SETHOST, TOK_SETHOST | |
365 | ||
366 | #define MSG_CAP "CAP" | |
367 | #define TOK_CAP "CAP" | |
368 | #define CMD_CAP MSG_CAP, TOK_CAP | |
369 | ||
370 | /* | |
371 | * Constants | |
372 | */ | |
373 | #define MFLG_SLOW 0x01 /** Limit command usage to | |
374 | * once per 2 seconds (for | |
375 | * local users). */ | |
376 | #define MFLG_UNREG 0x02 /** Command available to | |
377 | * unregistered clients. */ | |
378 | #define MFLG_IGNORE 0x04 /** Silently ignore command from | |
379 | * unregistered clients. */ | |
380 | #define MFLG_EXTRA 0x08 /** Handler requests that | |
381 | * mptr->extra be passed in | |
382 | * parv[1]. */ | |
383 | ||
384 | /* | |
385 | * Structures | |
386 | */ | |
387 | ||
388 | /** Information on how to parse a message. */ | |
389 | struct Message { | |
390 | char *cmd; /**< command string */ | |
391 | char *tok; /**< token (shorter command string) */ | |
392 | unsigned int count; /**< number of times message used */ | |
393 | unsigned int parameters; /**< minimum number of parameters */ | |
394 | unsigned int flags; /**< MFLG_* flags for command */ | |
395 | unsigned int bytes; /**< bytes received for this message */ | |
396 | void *extra; /**< extra pointer to be passed in parv[1] */ | |
397 | /* | |
398 | * cptr = Connected client ptr | |
399 | * sptr = Source client ptr | |
400 | * parc = parameter count | |
401 | * parv = parameter variable array | |
402 | */ | |
403 | /* handlers: | |
404 | * UNREGISTERED, CLIENT, SERVER, OPER, SERVICE, LAST | |
405 | */ | |
406 | MessageHandler handlers[LAST_HANDLER_TYPE]; | |
407 | }; | |
408 | ||
409 | extern struct Message msgtab[]; | |
410 | ||
411 | #endif /* INCLUDED_msg_h */ |