1 |
|
/* |
2 |
|
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
|
* |
4 |
< |
* Copyright (c) 1997-2014 ircd-hybrid development team |
4 |
> |
* Copyright (c) 1997-2016 ircd-hybrid development team |
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 |
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
18 |
> |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 |
19 |
|
* USA |
20 |
|
*/ |
21 |
|
|
62 |
|
SERVER_HANDLER, |
63 |
|
ENCAP_HANDLER, |
64 |
|
OPER_HANDLER, |
65 |
– |
DUMMY_HANDLER, |
65 |
|
LAST_HANDLER_TYPE |
66 |
|
} HandlerType; |
67 |
|
|
69 |
– |
typedef int (*MessageHandler)(struct Client *, int, char *[]); |
70 |
– |
|
68 |
|
/* |
69 |
|
* Message table structure |
70 |
|
*/ |
71 |
|
struct Message |
72 |
|
{ |
73 |
|
const char *cmd; |
74 |
+ |
void *extra; |
75 |
|
unsigned int count; /* number of times command used */ |
76 |
|
unsigned int rcount; /* number of times command used by server */ |
77 |
|
unsigned int args_min; /* at least this many args must be passed |
79 |
|
* before the m_func is even called |
80 |
|
*/ |
81 |
|
unsigned int args_max; /* maximum permitted parameters */ |
82 |
< |
unsigned int flags; /* bit 0 set means that this command is allowed |
83 |
< |
* to be used only on the average of once per 2 |
86 |
< |
* seconds -SRB |
87 |
< |
*/ |
88 |
< |
uint64_t bytes; /* bytes received for this message */ |
82 |
> |
unsigned int flags; |
83 |
> |
uintmax_t bytes; /* bytes received for this message */ |
84 |
|
|
85 |
|
/* handlers: |
86 |
< |
* UNREGISTERED, CLIENT, SERVER, ENCAP, OPER, DUMMY, LAST |
86 |
> |
* UNREGISTERED, CLIENT, SERVER, ENCAP, OPER, LAST |
87 |
|
*/ |
88 |
< |
MessageHandler handlers[LAST_HANDLER_TYPE]; |
94 |
< |
void *extra; |
88 |
> |
int (*handlers[LAST_HANDLER_TYPE])(struct Client *, int, char *[]); |
89 |
|
}; |
90 |
|
|
91 |
|
/* |
92 |
|
* Constants |
93 |
|
*/ |
94 |
< |
#define MFLG_SLOW 0x001 /* Command can be executed roughly |
101 |
< |
* once per 2 seconds. |
102 |
< |
*/ |
103 |
< |
#define MFLG_EXTRA 0x002 |
94 |
> |
#define MFLG_EXTRA 0x00000001U |
95 |
|
#define MAXPARA 15 |
96 |
|
|
97 |
|
extern void parse(struct Client *, char *, char *); |