]> jfr.im git - irc/quakenet/snircd.git/blob - include/msg.h
Initial import of 2.10.12.01
[irc/quakenet/snircd.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,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_REHASH "REHASH" /* REHA */
264 #define TOK_REHASH "REHASH"
265 #define CMD_REHASH MSG_REHASH, TOK_REHASH
266
267 #define MSG_RESTART "RESTART" /* REST */
268 #define TOK_RESTART "RESTART"
269 #define CMD_RESTART MSG_RESTART, TOK_RESTART
270
271 #define MSG_CLOSE "CLOSE" /* CLOS */
272 #define TOK_CLOSE "CLOSE"
273 #define CMD_CLOSE MSG_CLOSE, TOK_CLOSE
274
275 #define MSG_DIE "DIE" /* DIE */
276 #define TOK_DIE "DIE"
277 #define CMD_DIE MSG_DIE, TOK_DIE
278
279 #define MSG_HASH "HASH" /* HASH */
280 #define TOK_HASH "HASH"
281 #define CMD_HASH MSG_HASH, TOK_HASH
282
283 #define MSG_DNS "DNS" /* DNS -> DNSS */
284 #define TOK_DNS "DNS"
285 #define CMD_DNS MSG_DNS, TOK_DNS
286
287 #define MSG_SILENCE "SILENCE" /* SILE */
288 #define TOK_SILENCE "U"
289 #define CMD_SILENCE MSG_SILENCE, TOK_SILENCE
290
291 #define MSG_GLINE "GLINE" /* GLIN */
292 #define TOK_GLINE "GL"
293 #define CMD_GLINE MSG_GLINE, TOK_GLINE
294
295 #define MSG_BURST "BURST" /* BURS */
296 #define TOK_BURST "B"
297 #define CMD_BURST MSG_BURST, TOK_BURST
298
299 #define MSG_UPING "UPING" /* UPIN */
300 #define TOK_UPING "UP"
301 #define CMD_UPING MSG_UPING, TOK_UPING
302
303 #define MSG_CREATE "CREATE" /* CREA */
304 #define TOK_CREATE "C"
305 #define CMD_CREATE MSG_CREATE, TOK_CREATE
306
307 #define MSG_DESTRUCT "DESTRUCT" /* DEST */
308 #define TOK_DESTRUCT "DE"
309 #define CMD_DESTRUCT MSG_DESTRUCT, TOK_DESTRUCT
310
311 #define MSG_END_OF_BURST "END_OF_BURST" /* END_ */
312 #define TOK_END_OF_BURST "EB"
313 #define CMD_END_OF_BURST MSG_END_OF_BURST, TOK_END_OF_BURST
314
315 #define MSG_END_OF_BURST_ACK "EOB_ACK" /* EOB_ */
316 #define TOK_END_OF_BURST_ACK "EA"
317 #define CMD_END_OF_BURST_ACK MSG_END_OF_BURST_ACK, TOK_END_OF_BURST_ACK
318
319 #define MSG_PROTO "PROTO" /* PROTO */
320 #define TOK_PROTO "PROTO" /* PROTO */
321 #define CMD_PROTO MSG_PROTO, TOK_PROTO
322
323 #define MSG_JUPE "JUPE" /* JUPE */
324 #define TOK_JUPE "JU"
325 #define CMD_JUPE MSG_JUPE, TOK_JUPE
326
327 #define MSG_OPMODE "OPMODE" /* OPMO */
328 #define TOK_OPMODE "OM"
329 #define CMD_OPMODE MSG_OPMODE, TOK_OPMODE
330
331 #define MSG_CLEARMODE "CLEARMODE" /* CLMO */
332 #define TOK_CLEARMODE "CM"
333 #define CMD_CLEARMODE MSG_CLEARMODE, TOK_CLEARMODE
334
335 #define MSG_ACCOUNT "ACCOUNT" /* ACCO */
336 #define TOK_ACCOUNT "AC"
337 #define CMD_ACCOUNT MSG_ACCOUNT, TOK_ACCOUNT
338
339 #define MSG_ASLL "ASLL" /* ASLL */
340 #define TOK_ASLL "LL"
341 #define CMD_ASLL MSG_ASLL, TOK_ASLL
342
343 #define MSG_POST "POST" /* POST */
344 #define TOK_POST "POST"
345
346 #define MSG_SET "SET" /* SET */
347 #define TOK_SET "SET"
348
349 #define MSG_RESET "RESET" /* RESE */
350 #define TOK_RESET "RESET"
351
352 #define MSG_GET "GET" /* GET */
353 #define TOK_GET "GET"
354
355 #define MSG_PRIVS "PRIVS" /* PRIV */
356 #define TOK_PRIVS "PR"
357 #define CMD_PRIVS MSG_PRIVS, TOK_PRIVS
358
359 #define MSG_CAP "CAP"
360 #define TOK_CAP "CAP"
361 #define CMD_CAP MSG_CAP, TOK_CAP
362
363 /*
364 * Constants
365 */
366 #define MFLG_SLOW 0x01 /** Limit command usage to
367 * once per 2 seconds (for
368 * local users). */
369 #define MFLG_UNREG 0x02 /** Command available to
370 * unregistered clients. */
371 #define MFLG_IGNORE 0x04 /** Silently ignore command from
372 * unregistered clients. */
373 #define MFLG_EXTRA 0x08 /** Handler requests that
374 * mptr->extra be passed in
375 * parv[1]. */
376
377 /*
378 * Structures
379 */
380
381 /** Information on how to parse a message. */
382 struct Message {
383 char *cmd; /**< command string */
384 char *tok; /**< token (shorter command string) */
385 unsigned int count; /**< number of times message used */
386 unsigned int parameters; /**< minimum number of parameters */
387 unsigned int flags; /**< MFLG_* flags for command */
388 unsigned int bytes; /**< bytes received for this message */
389 void *extra; /**< extra pointer to be passed in parv[1] */
390 /*
391 * cptr = Connected client ptr
392 * sptr = Source client ptr
393 * parc = parameter count
394 * parv = parameter variable array
395 */
396 /* handlers:
397 * UNREGISTERED, CLIENT, SERVER, OPER, SERVICE, LAST
398 */
399 MessageHandler handlers[LAST_HANDLER_TYPE];
400 };
401
402 extern struct Message msgtab[];
403
404 #endif /* INCLUDED_msg_h */