fixed ssl.c bug when ssl backend returns IO_BLOCKED but IO engine doesn't get informe...
[ircu2.10.12-pk.git] / include / msg.h
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 1347 2005-04-02 02:50:15Z entrope $
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_UNINVITE            "UNINVITE"        /* INVI */
92 #define TOK_UNINVITE            "UI"
93 #define CMD_UNINVITE    MSG_UNINVITE, TOK_UNINVITE
94
95 #define MSG_VERSION             "VERSION"       /* VERS */
96 #define TOK_VERSION             "V"
97 #define CMD_VERSION             MSG_VERSION, TOK_VERSION
98
99 #define MSG_QUIT                "QUIT"          /* QUIT */
100 #define TOK_QUIT                "Q"
101 #define CMD_QUIT                MSG_QUIT, TOK_QUIT
102
103 #define MSG_SQUIT               "SQUIT"         /* SQUI */
104 #define TOK_SQUIT               "SQ"
105 #define CMD_SQUIT               MSG_SQUIT, TOK_SQUIT
106
107 #define MSG_KILL                "KILL"          /* KILL */
108 #define TOK_KILL                "D"
109 #define CMD_KILL                MSG_KILL, TOK_KILL
110
111 #define MSG_INFO                "INFO"          /* INFO */
112 #define TOK_INFO                "F"
113 #define CMD_INFO                MSG_INFO, TOK_INFO
114
115 #define MSG_LINKS               "LINKS"         /* LINK */
116 #define TOK_LINKS               "LI"
117 #define CMD_LINKS               MSG_LINKS, TOK_LINKS
118
119 #define MSG_STATS               "STATS"         /* STAT */
120 #define TOK_STATS               "R"
121 #define CMD_STATS               MSG_STATS, TOK_STATS
122
123 #define MSG_HELP                "HELP"          /* HELP */
124 #define TOK_HELP                "HELP"
125 #define CMD_HELP                MSG_HELP, TOK_HELP
126
127 #define MSG_ERROR               "ERROR"         /* ERRO */
128 #define TOK_ERROR               "Y"
129 #define CMD_ERROR               MSG_ERROR, TOK_ERROR
130
131 #define MSG_AWAY                "AWAY"          /* AWAY */
132 #define TOK_AWAY                "A"
133 #define CMD_AWAY                MSG_AWAY, TOK_AWAY
134
135 #define MSG_CONNECT             "CONNECT"       /* CONN */
136 #define TOK_CONNECT             "CO"
137 #define CMD_CONNECT             MSG_CONNECT, TOK_CONNECT
138
139 #define MSG_MAP                 "MAP"           /* MAP  */
140 #define TOK_MAP                 "MAP"
141 #define CMD_MAP                 MSG_MAP, TOK_MAP
142
143 #define MSG_PING                "PING"          /* PING */
144 #define TOK_PING                "G"
145 #define CMD_PING                MSG_PING, TOK_PING
146
147 #define MSG_PONG                "PONG"          /* PONG */
148 #define TOK_PONG                "Z"
149 #define CMD_PONG                MSG_PONG, TOK_PONG
150
151 #define MSG_OPER                "OPER"          /* OPER */
152 #define TOK_OPER                "OPER"
153 #define CMD_OPER                MSG_OPER, TOK_OPER
154
155 #define MSG_PASS                "PASS"          /* PASS */
156 #define TOK_PASS                "PA"
157 #define CMD_PASS                MSG_PASS, TOK_PASS
158
159 #define MSG_WALLOPS             "WALLOPS"       /* WALL */
160 #define TOK_WALLOPS             "WA"
161 #define CMD_WALLOPS             MSG_WALLOPS, TOK_WALLOPS
162
163 #define MSG_WALLUSERS           "WALLUSERS"     /* WALL */
164 #define TOK_WALLUSERS           "WU"
165 #define CMD_WALLUSERS           MSG_WALLUSERS, TOK_WALLUSERS
166
167 #define MSG_DESYNCH             "DESYNCH"       /* DESY */
168 #define TOK_DESYNCH             "DS"
169 #define CMD_DESYNCH             MSG_DESYNCH, TOK_DESYNCH
170
171 #define MSG_TIME                "TIME"          /* TIME */
172 #define TOK_TIME                "TI"
173 #define CMD_TIME                MSG_TIME, TOK_TIME
174
175 #define MSG_SETTIME             "SETTIME"       /* SETT */
176 #define TOK_SETTIME             "SE"
177 #define CMD_SETTIME             MSG_SETTIME, TOK_SETTIME
178
179 #define MSG_RPING               "RPING"         /* RPIN */
180 #define TOK_RPING               "RI"
181 #define CMD_RPING               MSG_RPING, TOK_RPING
182
183 #define MSG_RPONG               "RPONG"         /* RPON */
184 #define TOK_RPONG               "RO"
185 #define CMD_RPONG               MSG_RPONG, TOK_RPONG
186
187 #define MSG_NAMES               "NAMES"         /* NAME */
188 #define TOK_NAMES               "E"
189 #define CMD_NAMES               MSG_NAMES, TOK_NAMES
190
191 #define MSG_ADMIN               "ADMIN"         /* ADMI */
192 #define TOK_ADMIN               "AD"
193 #define CMD_ADMIN               MSG_ADMIN, TOK_ADMIN
194
195 #define MSG_TRACE               "TRACE"         /* TRAC */
196 #define TOK_TRACE               "TR"
197 #define CMD_TRACE               MSG_TRACE, TOK_TRACE
198
199 #define MSG_NOTICE              "NOTICE"        /* NOTI */
200 #define TOK_NOTICE              "O"
201 #define CMD_NOTICE              MSG_NOTICE, TOK_NOTICE
202
203 #define MSG_WALLCHOPS           "WALLCHOPS"     /* WC */
204 #define TOK_WALLCHOPS           "WC"
205 #define CMD_WALLCHOPS           MSG_WALLCHOPS, TOK_WALLCHOPS
206
207 #define MSG_WALLVOICES           "WALLVOICES"     /* WV */
208 #define TOK_WALLVOICES           "WV"
209 #define CMD_WALLVOICES          MSG_WALLVOICES, TOK_WALLVOICES
210
211 #define MSG_CPRIVMSG            "CPRIVMSG"      /* CPRI */
212 #define TOK_CPRIVMSG            "CP"
213 #define CMD_CPRIVMSG            MSG_CPRIVMSG, TOK_CPRIVMSG
214
215 #define MSG_CNOTICE             "CNOTICE"       /* CNOT */
216 #define TOK_CNOTICE             "CN"
217 #define CMD_CNOTICE             MSG_CNOTICE, TOK_CNOTICE
218
219 #define MSG_JOIN                "JOIN"          /* JOIN */
220 #define TOK_JOIN                "J"
221 #define CMD_JOIN                MSG_JOIN, TOK_JOIN
222
223 #define MSG_PART                "PART"          /* PART */
224 #define TOK_PART                "L"
225 #define CMD_PART                MSG_PART, TOK_PART
226
227 #define MSG_LUSERS              "LUSERS"        /* LUSE */
228 #define TOK_LUSERS              "LU"
229 #define CMD_LUSERS              MSG_LUSERS, TOK_LUSERS
230
231 #define MSG_MOTD                "MOTD"          /* MOTD */
232 #define TOK_MOTD                "MO"
233 #define CMD_MOTD                MSG_MOTD, TOK_MOTD
234
235 #define MSG_MODE                "MODE"          /* MODE */
236 #define TOK_MODE                "M"
237 #define CMD_MODE                MSG_MODE, TOK_MODE
238
239 #define MSG_KICK                "KICK"          /* KICK */
240 #define TOK_KICK                "K"
241 #define CMD_KICK                MSG_KICK, TOK_KICK
242
243 #define MSG_USERHOST            "USERHOST"      /* USER -> USRH */
244 #define TOK_USERHOST            "USERHOST"
245 #define CMD_USERHOST            MSG_USERHOST, TOK_USERHOST
246
247 #define MSG_USERIP              "USERIP"        /* USER -> USIP */
248 #define TOK_USERIP              "USERIP"
249 #define CMD_USERIP              MSG_USERIP, TOK_USERIP
250
251 #define MSG_ISON                "ISON"          /* ISON */
252 #define TOK_ISON                "ISON"
253 #define CMD_ISON                MSG_ISON, TOK_ISON
254
255 #define MSG_SQUERY              "SQUERY"        /* SQUE */
256 #define TOK_SQUERY              "SQUERY"
257 #define CMD_SQUERY              MSG_SQUERY, TOK_SQUERY
258
259 #define MSG_SERVLIST            "SERVLIST"      /* SERV -> SLIS */
260 #define TOK_SERVLIST            "SERVSET"
261 #define CMD_SERVLIST            MSG_SERVLIST, TOK_SERVLIST
262
263 #define MSG_SERVSET             "SERVSET"       /* SERV -> SSET */
264 #define TOK_SERVSET             "SERVSET"
265 #define CMD_SERVSET             MSG_SERVSET, TOK_SERVSET
266
267 #define MSG_REHASH              "REHASH"        /* REHA */
268 #define TOK_REHASH              "RE"
269 #define CMD_REHASH              MSG_REHASH, TOK_REHASH
270
271 #define MSG_RESTART             "RESTART"       /* REST */
272 #define TOK_RESTART             "RESTART"
273 #define CMD_RESTART             MSG_RESTART, TOK_RESTART
274
275 #define MSG_CLOSE               "CLOSE"         /* CLOS */
276 #define TOK_CLOSE               "CLOSE"
277 #define CMD_CLOSE               MSG_CLOSE, TOK_CLOSE
278
279 #define MSG_DIE                 "DIE"           /* DIE  */
280 #define TOK_DIE                 "DIE"
281 #define CMD_DIE                 MSG_DIE, TOK_DIE
282
283 #define MSG_HASH                "HASH"          /* HASH */
284 #define TOK_HASH                "HASH"
285 #define CMD_HASH                MSG_HASH, TOK_HASH
286
287 #define MSG_DNS                 "DNS"           /* DNS  -> DNSS */
288 #define TOK_DNS                 "DNS"
289 #define CMD_DNS                 MSG_DNS, TOK_DNS
290
291 #define MSG_SILENCE             "SILENCE"       /* SILE */
292 #define TOK_SILENCE             "U"
293 #define CMD_SILENCE             MSG_SILENCE, TOK_SILENCE
294
295 #define MSG_GLINE               "GLINE"         /* GLIN */
296 #define TOK_GLINE               "GL"
297 #define CMD_GLINE               MSG_GLINE, TOK_GLINE
298
299 #define MSG_BURST               "BURST"         /* BURS */
300 #define TOK_BURST               "B"
301 #define CMD_BURST               MSG_BURST, TOK_BURST
302
303 #define MSG_UPING               "UPING"         /* UPIN */
304 #define TOK_UPING               "UP"
305 #define CMD_UPING               MSG_UPING, TOK_UPING
306
307 #define MSG_CREATE              "CREATE"        /* CREA */
308 #define TOK_CREATE              "C"
309 #define CMD_CREATE              MSG_CREATE, TOK_CREATE
310
311 #define MSG_DESTRUCT            "DESTRUCT"      /* DEST */
312 #define TOK_DESTRUCT            "DE"
313 #define CMD_DESTRUCT            MSG_DESTRUCT, TOK_DESTRUCT
314
315 #define MSG_END_OF_BURST        "END_OF_BURST"  /* END_ */
316 #define TOK_END_OF_BURST        "EB"
317 #define CMD_END_OF_BURST        MSG_END_OF_BURST, TOK_END_OF_BURST
318
319 #define MSG_END_OF_BURST_ACK    "EOB_ACK"       /* EOB_ */
320 #define TOK_END_OF_BURST_ACK    "EA"
321 #define CMD_END_OF_BURST_ACK    MSG_END_OF_BURST_ACK, TOK_END_OF_BURST_ACK
322
323 #define MSG_PROTO               "PROTO"         /* PROTO */
324 #define TOK_PROTO               "PROTO"         /* PROTO */
325 #define CMD_PROTO               MSG_PROTO, TOK_PROTO
326
327 #define MSG_JUPE                "JUPE"          /* JUPE */
328 #define TOK_JUPE                "JU"
329 #define CMD_JUPE                MSG_JUPE, TOK_JUPE
330
331 #define MSG_OPMODE              "OPMODE"        /* OPMO */
332 #define TOK_OPMODE              "OM"
333 #define CMD_OPMODE              MSG_OPMODE, TOK_OPMODE
334
335 #define MSG_CLEARMODE           "CLEARMODE"     /* CLMO */
336 #define TOK_CLEARMODE           "CM"
337 #define CMD_CLEARMODE           MSG_CLEARMODE, TOK_CLEARMODE
338
339 #define MSG_ACCOUNT             "ACCOUNT"       /* ACCO */
340 #define TOK_ACCOUNT             "AC"
341 #define CMD_ACCOUNT             MSG_ACCOUNT, TOK_ACCOUNT
342
343 #define MSG_ASLL               "ASLL"          /* ASLL */
344 #define TOK_ASLL               "LL"
345 #define CMD_ASLL               MSG_ASLL, TOK_ASLL
346
347 #define MSG_POST                "POST"          /* POST */
348 #define TOK_POST                "POST"
349
350 #define MSG_SET                 "SET"           /* SET */
351 #define TOK_SET                 "SET"
352
353 #define MSG_RESET               "RESET"         /* RESE */
354 #define TOK_RESET               "RESET"
355
356 #define MSG_GET                 "GET"           /* GET */
357 #define TOK_GET                 "GET"
358
359 #define MSG_PRIVS               "PRIVS"         /* PRIV */
360 #define TOK_PRIVS               "PR"
361 #define CMD_PRIVS               MSG_PRIVS, TOK_PRIVS
362
363 #define MSG_CAP                 "CAP"
364 #define TOK_CAP                 "CAP"
365 #define CMD_CAP                 MSG_CAP, TOK_CAP
366
367 #define MSG_FAKEHOST        "FAKEHOST"
368 #define TOK_FAKEHOST        "FH"
369 #define CMD_FAKEHOST        MSG_FAKEHOST, TOK_FAKEHOST
370
371 #define MSG_FAKEHOST2        "NEWFAKEHOST"
372 #define TOK_FAKEHOST2        "NFH"
373 #define CMD_FAKEHOST2        MSG_FAKEHOST2, TOK_FAKEHOST2
374
375 #define MSG_FAKEHOST_OLD    "FAKE"
376 #define TOK_FAKEHOST_OLD    "FA"
377 #define CMD_FAKEHOST_OLD    MSG_FAKEHOST_OLD, TOK_FAKEHOST_OLD
378
379 #define MSG_HIDEHOST        "HIDEHOST"
380 #define TOK_HIDEHOST        "HH"
381 #define CMD_HIDEHOST        MSG_HIDEHOST, TOK_HIDEHOST
382
383 #define MSG_SVSMODE        "SVSMODE"
384 #define TOK_SVSMODE        "SM"
385 #define CMD_SVSMODE        MSG_SVSMODE, TOK_SVSMODE
386
387 #define MSG_SVSNICK        "SVSNICK2"
388 #define TOK_SVSNICK        "SN"
389 #define CMD_SVSNICK        MSG_SVSNICK, TOK_SVSNICK
390
391 #define MSG_SVSNICK_OLD    "SVSNICK"
392 #define TOK_SVSNICK_OLD    "SVN"
393 #define CMD_SVSNICK_OLD    MSG_SVSNICK_OLD, TOK_SVSNICK_OLD
394
395 #define MSG_SVSJOIN        "SVSJOIN"
396 #define TOK_SVSJOIN        "SJ"
397 #define CMD_SVSJOIN        MSG_SVSJOIN, TOK_SVSJOIN
398
399 #define MSG_SVSPART        "SVSPART"
400 #define TOK_SVSPART        "SP"
401 #define CMD_SVSPART        MSG_SVSPART, TOK_SVSPART
402
403 #define MSG_WEBIRC          "WEBIRC"
404 #define TOK_WEBIRC          "WEBIRC"
405 #define CMD_WEBIRC          MSG_WEBIRC, TOK_WEBIRC
406
407 #define MSG_RELAY           "RELAY"
408 #define TOK_RELAY           "RL"
409 #define CMD_RELAY           MSG_RELAY, TOK_RELAY
410
411 #define MSG_CHECK           "CHECK"
412 #define TOK_CHECK           "CHECK"
413
414 /*
415  * Constants
416  */
417 #define   MFLG_SLOW              0x01   /** Limit command usage to
418                                          * once per 2 seconds (for
419                                          * local users). */
420 #define   MFLG_UNREG             0x02   /** Command available to
421                                          * unregistered clients. */
422 #define   MFLG_IGNORE            0x04   /** Silently ignore command from
423                                          * unregistered clients. */
424 #define   MFLG_EXTRA             0x08   /** Handler requests that
425                                          * mptr->extra be passed in
426                                          * parv[1]. */
427
428 /*
429  * Structures
430  */
431
432 /** Information on how to parse a message. */
433 struct Message {
434   char *cmd;                  /**< command string */
435   char *tok;                  /**< token (shorter command string) */
436   unsigned int count;         /**< number of times message used */
437   unsigned int parameters;    /**< minimum number of parameters */
438   unsigned int flags;         /**< MFLG_* flags for command */
439   unsigned int bytes;         /**< bytes received for this message */
440   void *extra;                /**< extra pointer to be passed in parv[1] */
441   /*
442    * cptr = Connected client ptr
443    * sptr = Source client ptr
444    * parc = parameter count
445    * parv = parameter variable array
446    */
447   /* handlers:
448    * UNREGISTERED, CLIENT, SERVER, OPER, SERVICE, LAST
449    */
450   MessageHandler handlers[LAST_HANDLER_TYPE];
451 };
452
453 extern struct Message msgtab[];
454
455 #endif /* INCLUDED_msg_h */