Author: Bleep <tomh@inxpress.net>
[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  * $Id$
21  */
22 #ifndef INCLUDED_msg_h
23 #define INCLUDED_msg_h
24 #ifndef INCLUDED_ircd_handler_h
25 #include "ircd_handler.h"
26 #endif
27
28 struct Client;
29
30 /*
31  * General defines
32  */
33
34 #define MAXPARA    15
35
36 /*-----------------------------------------------------------------------------
37  * Macros
38  */
39
40 /*
41  * Tokenization:
42  * Each command must have a TOK_COMMAND and MSG_COMMAND definition.
43  * If you don't want one or the other, make them the same.
44  * Also each command has a "msgclass" used for debugging purposes.
45  */
46
47 /* *INDENT-OFF* */
48
49 #define MSG_PRIVATE             "PRIVMSG"       /* PRIV */
50 #define TOK_PRIVATE             "P"
51
52 #define MSG_WHO                 "WHO"           /* WHO  -> WHOC */
53 #define TOK_WHO                 "H"
54
55 #define MSG_WHOIS               "WHOIS"         /* WHOI */
56 #define TOK_WHOIS               "W"
57
58 #define MSG_WHOWAS              "WHOWAS"        /* WHOW */
59 #define TOK_WHOWAS              "X"
60
61 #define MSG_USER                "USER"          /* USER */
62 #define TOK_USER                "USER"
63
64 #define MSG_NICK                "NICK"          /* NICK */
65 #define TOK_NICK                "N"
66
67 #define MSG_SERVER              "SERVER"        /* SERV */
68 #define TOK_SERVER              "S"
69
70 #define MSG_LIST                "LIST"          /* LIST */
71 #define TOK_LIST                "LIST"
72
73 #define MSG_TOPIC               "TOPIC"         /* TOPI */
74 #define TOK_TOPIC               "T"
75
76 #define MSG_INVITE              "INVITE"        /* INVI */
77 #define TOK_INVITE              "I"
78
79 #define MSG_VERSION             "VERSION"       /* VERS */
80 #define TOK_VERSION             "V"
81
82 #define MSG_QUIT                "QUIT"          /* QUIT */
83 #define TOK_QUIT                "Q"
84
85 #define MSG_SQUIT               "SQUIT"         /* SQUI */
86 #define TOK_SQUIT               "SQ"
87
88 #define MSG_KILL                "KILL"          /* KILL */
89 #define TOK_KILL                "D"
90
91 #define MSG_INFO                "INFO"          /* INFO */
92 #define TOK_INFO                "F"
93
94 #define MSG_LINKS               "LINKS"         /* LINK */
95 #define TOK_LINKS               "LI"
96
97 #define MSG_STATS               "STATS"         /* STAT */
98 #define TOK_STATS               "R"
99
100 #define MSG_HELP                "HELP"          /* HELP */
101 #define TOK_HELP                "HELP"
102
103 #define MSG_ERROR               "ERROR"         /* ERRO */
104 #define TOK_ERROR               "Y"
105
106 #define MSG_AWAY                "AWAY"          /* AWAY */
107 #define TOK_AWAY                "A"
108
109 #define MSG_CONNECT             "CONNECT"       /* CONN */
110 #define TOK_CONNECT             "CO"
111
112 #define MSG_MAP                 "MAP"           /* MAP  */
113 #define TOK_MAP                 "MAP"
114
115 #define MSG_PING                "PING"          /* PING */
116 #define TOK_PING                "G"
117
118 #define MSG_PONG                "PONG"          /* PONG */
119 #define TOK_PONG                "Z"
120
121 #define MSG_OPER                "OPER"          /* OPER */
122 #define TOK_OPER                "OPER"
123
124 #define MSG_PASS                "PASS"          /* PASS */
125 #define TOK_PASS                "PA"
126
127 #define MSG_WALLOPS             "WALLOPS"       /* WALL */
128 #define TOK_WALLOPS             "WA"
129
130 #define MSG_DESYNCH             "DESYNCH"       /* DESY */
131 #define TOK_DESYNCH             "DS"
132
133 #define MSG_TIME                "TIME"          /* TIME */
134 #define TOK_TIME                "TI"
135
136 #define MSG_SETTIME             "SETTIME"       /* SETT */
137 #define TOK_SETTIME             "SE"
138
139 #define MSG_RPING               "RPING"         /* RPIN */
140 #define TOK_RPING               "RI"
141
142 #define MSG_RPONG               "RPONG"         /* RPON */
143 #define TOK_RPONG               "RO"
144
145 #define MSG_NAMES               "NAMES"         /* NAME */
146 #define TOK_NAMES               "E"
147
148 #define MSG_ADMIN               "ADMIN"         /* ADMI */
149 #define TOK_ADMIN               "AD"
150
151 #define MSG_TRACE               "TRACE"         /* TRAC */
152 #define TOK_TRACE               "TR"
153
154 #define MSG_NOTICE              "NOTICE"        /* NOTI */
155 #define TOK_NOTICE              "O"
156
157 #define MSG_WALLCHOPS           "WALLCHOPS"     /* WC */
158 #define TOK_WALLCHOPS           "WC"
159
160 #define MSG_CPRIVMSG            "CPRIVMSG"      /* CPRI */
161 #define TOK_CPRIVMSG            "CP"
162
163 #define MSG_CNOTICE             "CNOTICE"       /* CNOT */
164 #define TOK_CNOTICE             "CN"
165
166 #define MSG_JOIN                "JOIN"          /* JOIN */
167 #define TOK_JOIN                "J"
168
169 #define MSG_PART                "PART"          /* PART */
170 #define TOK_PART                "L"
171
172 #define MSG_LUSERS              "LUSERS"        /* LUSE */
173 #define TOK_LUSERS              "LU"
174
175 #define MSG_MOTD                "MOTD"          /* MOTD */
176 #define TOK_MOTD                "MO"
177
178 #define MSG_MODE                "MODE"          /* MODE */
179 #define TOK_MODE                "M"
180
181 #define MSG_KICK                "KICK"          /* KICK */
182 #define TOK_KICK                "K"
183
184 #define MSG_USERHOST            "USERHOST"      /* USER -> USRH */
185 #define TOK_USERHOST            "USERHOST"
186
187 #define MSG_USERIP              "USERIP"        /* USER -> USIP */
188 #define TOK_USERIP              "USERIP"
189
190 #define MSG_ISON                "ISON"          /* ISON */
191 #define TOK_ISON                "ISON"
192
193 #define MSG_SQUERY              "SQUERY"        /* SQUE */
194 #define TOK_SQUERY              "SQUERY"
195
196 #define MSG_SERVLIST            "SERVLIST"      /* SERV -> SLIS */
197 #define TOK_SERVLIST            "SERVSET"
198
199 #define MSG_SERVSET             "SERVSET"       /* SERV -> SSET */
200 #define TOK_SERVSET             "SERVSET"
201
202 #define MSG_REHASH              "REHASH"        /* REHA */
203 #define TOK_REHASH              "REHASH"
204
205 #define MSG_RESTART             "RESTART"       /* REST */
206 #define TOK_RESTART             "RESTART"
207
208 #define MSG_CLOSE               "CLOSE"         /* CLOS */
209 #define TOK_CLOSE               "CLOSE"
210
211 #define MSG_DIE                 "DIE"           /* DIE  */
212 #define TOK_DIE                 "DIE"
213
214 #define MSG_HASH                "HASH"          /* HASH */
215 #define TOK_HASH                "HASH"
216
217 #define MSG_DNS                 "DNS"           /* DNS  -> DNSS */
218 #define TOK_DNS                 "DNS"
219
220 #define MSG_SILENCE             "SILENCE"       /* SILE */
221 #define TOK_SILENCE             "U"
222
223 #define MSG_GLINE               "GLINE"         /* GLIN */
224 #define TOK_GLINE               "GL"
225
226 #define MSG_BURST               "BURST"         /* BURS */
227 #define TOK_BURST               "B"
228
229 #define MSG_CREATE              "CREATE"        /* CREA */
230 #define TOK_CREATE              "C"
231
232 #define MSG_DESTRUCT            "DESTRUCT"      /* DEST */
233 #define TOK_DESTRUCT            "DE"
234
235 #define MSG_END_OF_BURST        "END_OF_BURST"  /* END_ */
236 #define TOK_END_OF_BURST        "EB"
237
238 #define MSG_END_OF_BURST_ACK    "EOB_ACK"       /* EOB_ */
239 #define TOK_END_OF_BURST_ACK    "EA"
240
241 #define MSG_PROTO               "PROTO"         /* PROTO */
242 #define TOK_PROTO               "PROTO"         /* PROTO */
243
244
245 /*
246  * Constants
247  */
248 #define   MFLG_SLOW              0x01   /* Command can be executed roughly    *
249                                          * once per 2 seconds.                */
250 #define   MFLG_UNREG             0x02   /* Command available to unregistered  *
251                                          * clients.                           */
252 #define   MFLG_IGNORE            0x04   /* silently ignore command from
253                                          * unregistered clients */
254
255 /*
256  * Structures
257  */
258 struct Message {
259   char *cmd;                  /* command string */
260   char *tok;                  /* token (shorter command string) */
261   unsigned int count;         /* number of times message used */
262   unsigned int parameters;
263   unsigned int flags;           /* bit 0 set means that this command is allowed
264                                    to be used only on the average of once per 2
265                                    seconds -SRB */
266   unsigned int bytes;         /* bytes received for this message */
267   /*
268    * cptr = Connected client ptr
269    * sptr = Source client ptr
270    * parc = parameter count
271    * parv = parameter variable array
272    */
273   /* handlers:
274    * UNREGISTERED, CLIENT, SERVER, OPER, SERVICE, LAST
275    */
276   MessageHandler handlers[LAST_HANDLER_TYPE];
277 };
278
279 extern struct Message msgtab[];
280
281 #endif /* INCLUDED_msg_h */