ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/parse.h
(Generate patch)

Comparing:
ircd-hybrid/include/parse.h (file contents), Revision 30 by adx, Sun Oct 2 20:03:27 2005 UTC vs.
ircd-hybrid/trunk/include/parse.h (file contents), Revision 1592 by michael, Sat Oct 27 21:02:32 2012 UTC

# Line 19 | Line 19
19   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
20   *  USA
21   *
22 < *  $Id: parse.h,v 7.20 2004/02/03 03:59:54 michael Exp $
22 > *  $Id$
23   */
24  
25   #ifndef INCLUDED_parse_h
26   #define INCLUDED_parse_h
27  
28 – struct Message;
28   struct Client;
29  
30 +
31 + /*
32 + * m_functions execute protocol messages on this server:
33 + * int m_func(struct Client* client_p, struct Client* source_p, int parc, char* parv[]);
34 + *
35 + *    client_p    is always NON-NULL, pointing to a *LOCAL* client
36 + *            structure (with an open socket connected!). This
37 + *            identifies the physical socket where the message
38 + *            originated (or which caused the m_function to be
39 + *            executed--some m_functions may call others...).
40 + *
41 + *    source_p    is the source of the message, defined by the
42 + *            prefix part of the message if present. If not
43 + *            or prefix not found, then source_p==client_p.
44 + *
45 + *            (!IsServer(client_p)) => (client_p == source_p), because
46 + *            prefixes are taken *only* from servers...
47 + *
48 + *            (IsServer(client_p))
49 + *                    (source_p == client_p) => the message didn't
50 + *                    have the prefix.
51 + *
52 + *                    (source_p != client_p && IsServer(source_p) means
53 + *                    the prefix specified servername. (?)
54 + *
55 + *                    (source_p != client_p && !IsServer(source_p) means
56 + *                    that message originated from a remote
57 + *                    user (not local).
58 + *
59 + *
60 + *            combining
61 + *
62 + *            (!IsServer(source_p)) means that, source_p can safely
63 + *            taken as defining the target structure of the
64 + *            message in this server.
65 + *
66 + *    *Always* true (if 'parse' and others are working correct):
67 + *
68 + *    1)      source_p->from == client_p  (note: client_p->from == client_p)
69 + *
70 + *    2)      MyConnect(source_p) <=> source_p == client_p (e.g. source_p
71 + *            *cannot* be a local connection, unless it's
72 + *            actually client_p!). [MyConnect(x) should probably
73 + *            be defined as (x == x->from) --msa ]
74 + *
75 + *    parc    number of variable parameter strings (if zero,
76 + *            parv is allowed to be NULL)
77 + *
78 + *    parv    a NULL terminated list of parameter pointers,
79 + *
80 + *                    parv[0], sender (prefix string), if not present
81 + *                            this points to an empty string.
82 + *                    parv[1]...parv[parc-1]
83 + *                            pointers to additional parameters
84 + *                    parv[parc] == NULL, *always*
85 + *
86 + *            note:   it is guaranteed that parv[0]..parv[parc-1] are all
87 + *                    non-NULL pointers.
88 + */
89 +
90 + /*
91 + * MessageHandler
92 + */
93 + typedef enum HandlerType {
94 +  UNREGISTERED_HANDLER,
95 +  CLIENT_HANDLER,
96 +  SERVER_HANDLER,
97 +  ENCAP_HANDLER,
98 +  OPER_HANDLER,
99 +  DUMMY_HANDLER,
100 +  LAST_HANDLER_TYPE
101 + } HandlerType;
102 +
103 + /*
104 + * MessageHandler function
105 + * Params:
106 + * struct Client* client_p   - connection message originated from
107 + * struct Client* source_p   - source of message, may be different from client_p
108 + * int            parc   - parameter count
109 + * char*          parv[] - parameter vector
110 + */
111 + typedef void (*MessageHandler)(struct Client *, struct Client *, int, char *[]);
112 +
113 + /*
114 + * Message table structure
115 + */
116 + struct Message
117 + {
118 +  const char *cmd;
119 +  unsigned int count;      /* number of times command used */
120 +  unsigned int rcount;     /* number of times command used by server */
121 +  unsigned int args_min; /* at least this many args must be passed
122 +                             * or an error will be sent to the user
123 +                             * before the m_func is even called
124 +                             */
125 +  unsigned int args_max;    /* maximum permitted parameters */
126 +  unsigned int flags;      /* bit 0 set means that this command is allowed
127 +                             * to be used only on the average of once per 2
128 +                             * seconds -SRB
129 +                             */
130 +  uint64_t bytes;  /* bytes received for this message */
131 +
132 +  /*
133 +   * client_p = Connected client ptr
134 +   * source_p = Source client ptr
135 +   * parc = parameter count
136 +   * parv = parameter variable array
137 +   */
138 +  /* handlers:
139 +   * UNREGISTERED, CLIENT, SERVER, ENCAP, OPER, DUMMY, LAST
140 +   */
141 +  MessageHandler handlers[LAST_HANDLER_TYPE];
142 + };
143 +
144 + /*
145 + * Constants
146 + */
147 + #define   MFLG_SLOW             0x001   /* Command can be executed roughly
148 +                                         * once per 2 seconds.                
149 +                                         */
150 + #define MAXPARA    15
151 +
152   extern void parse(struct Client *, char *, char *);
32 – extern void clear_tree_parse(void);
153   extern void mod_add_cmd(struct Message *);
154   extern void mod_del_cmd(struct Message *);
155   extern struct Message *find_command(const char *);
156   extern void report_messages(struct Client *);
157  
158 + /* generic handlers */
159 + extern void rfc1459_command_send_error(struct Client *, struct Client *,int, char *[]);
160 + extern void m_ignore(struct Client *, struct Client *, int, char *[]);
161 + extern void m_not_oper(struct Client *, struct Client *, int, char *[]);
162 + extern void m_registered(struct Client *, struct Client *, int, char *[]);
163 + extern void m_unregistered(struct Client *, struct Client *, int, char *[]);
164 +
165   #endif /* INCLUDED_parse_h */

Comparing:
ircd-hybrid/include/parse.h (property svn:keywords), Revision 30 by adx, Sun Oct 2 20:03:27 2005 UTC vs.
ircd-hybrid/trunk/include/parse.h (property svn:keywords), Revision 1592 by michael, Sat Oct 27 21:02:32 2012 UTC

# Line 1 | Line 1
1 < "Id Revision"
1 > Id Revision

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)