ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_stats.c
Revision: 3227
Committed: Fri Mar 28 20:40:50 2014 UTC (10 years ago) by michael
Content type: text/x-csrc
File size: 53049 byte(s)
Log Message:
- m_stats.c:stats_servlinks(): removed extranous spaces

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2820 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 2820 * Copyright (c) 1997-2014 ircd-hybrid development team
5 adx 30 *
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 2 of the License, or
9     * (at your option) 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19     * USA
20     */
21    
22 michael 2820 /*! \file m_stats.c
23     * \brief Includes required functions for processing the STATS command.
24     * \version $Id$
25     */
26    
27 adx 30 #include "stdinc.h"
28 michael 2820 #include "list.h"
29     #include "client.h"
30     #include "irc_string.h"
31     #include "ircd.h"
32     #include "listener.h"
33 adx 30 #include "s_gline.h"
34 michael 1632 #include "conf.h"
35 michael 1644 #include "conf_class.h"
36 adx 30 #include "hostmask.h"
37 michael 2820 #include "numeric.h"
38     #include "send.h"
39     #include "fdlist.h"
40     #include "s_bsd.h"
41     #include "s_misc.h"
42     #include "s_serv.h"
43     #include "s_user.h"
44     #include "event.h"
45 adx 30 #include "dbuf.h"
46 michael 1144 #include "hook.h"
47 adx 30 #include "parse.h"
48     #include "modules.h"
49 michael 2820 #include "resv.h"
50 adx 30 #include "whowas.h"
51 michael 884 #include "watch.h"
52 michael 1312 #include "irc_res.h"
53 michael 2150 #include "motd.h"
54 adx 30
55    
56 michael 1922 static const struct shared_flags
57     {
58     const unsigned int type;
59     const unsigned char letter;
60     } flag_table[] = {
61     { SHARED_KLINE, 'K' },
62     { SHARED_UNKLINE, 'U' },
63     { SHARED_XLINE, 'X' },
64     { SHARED_UNXLINE, 'Y' },
65     { SHARED_RESV, 'Q' },
66     { SHARED_UNRESV, 'R' },
67     { SHARED_LOCOPS, 'L' },
68     { SHARED_DLINE, 'D' },
69     { SHARED_UNDLINE, 'E' },
70     { 0, '\0' }
71     };
72    
73 adx 30 /*
74 michael 1922 * inputs - pointer to client requesting confitem report
75     * - ConfType to report
76     * output - none
77     * side effects -
78     */
79     static void
80     report_confitem_types(struct Client *source_p, enum maskitem_type type)
81     {
82 michael 2160 dlink_node *ptr = NULL;
83 michael 1922 struct MaskItem *conf = NULL;
84     const struct shared_flags *shared = NULL;
85 michael 2691 char buf[IRCD_BUFSIZE];
86 michael 1922 char *p = NULL;
87    
88     switch (type)
89     {
90     case CONF_XLINE:
91     DLINK_FOREACH(ptr, xconf_items.head)
92     {
93     conf = ptr->data;
94    
95 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSXLINE,
96 michael 2820 conf->until ? 'x': 'X', conf->count,
97     conf->name, conf->reason);
98 michael 1922 }
99     break;
100    
101     case CONF_ULINE:
102     shared = flag_table;
103     DLINK_FOREACH(ptr, uconf_items.head)
104     {
105     conf = ptr->data;
106    
107     p = buf;
108    
109     *p++ = 'c';
110     for (; shared->type; ++shared)
111     if (shared->type & conf->flags)
112     *p++ = shared->letter;
113     else
114     *p++ = ToLower(shared->letter);
115    
116 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSULINE, conf->name,
117 michael 1922 conf->user?conf->user: "*",
118 michael 2820 conf->host?conf->host: "*", buf);
119 michael 1922 }
120    
121     shared = flag_table;
122     DLINK_FOREACH(ptr, cluster_items.head)
123     {
124     conf = ptr->data;
125    
126     p = buf;
127    
128     *p++ = 'C';
129     for (; shared->type; ++shared)
130     if (shared->type & conf->flags)
131     *p++ = shared->letter;
132     else
133     *p++ = ToLower(shared->letter);
134    
135 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSULINE, conf->name,
136 michael 1922 "*", "*", buf);
137     }
138    
139     break;
140    
141     case CONF_OPER:
142     DLINK_FOREACH(ptr, oconf_items.head)
143     {
144     conf = ptr->data;
145    
146     /* Don't allow non opers to see oper privs */
147     if (HasUMode(source_p, UMODE_OPER))
148 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSOLINE, 'O', conf->user, conf->host,
149 michael 2820 conf->name, oper_privs_as_string(conf->port),
150     conf->class ? conf->class->name : "<default>");
151 michael 1922 else
152 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSOLINE, 'O', conf->user, conf->host,
153 michael 1922 conf->name, "0",
154 michael 2820 conf->class ? conf->class->name : "<default>");
155 michael 1922 }
156     break;
157    
158     case CONF_SERVICE:
159     DLINK_FOREACH(ptr, service_items.head)
160     {
161     conf = ptr->data;
162 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSSERVICE, 'S', "*", conf->name, 0, 0);
163 michael 1922 }
164     break;
165    
166     case CONF_SERVER:
167     DLINK_FOREACH(ptr, server_items.head)
168     {
169     p = buf;
170     conf = ptr->data;
171    
172     buf[0] = '\0';
173    
174     if (IsConfAllowAutoConn(conf))
175 michael 2820 *p++ = 'A';
176 michael 1922 if (IsConfSSL(conf))
177     *p++ = 'S';
178     if (buf[0] == '\0')
179 michael 2820 *p++ = '*';
180 michael 1922
181     *p = '\0';
182    
183     /*
184     * Allow admins to see actual ips unless hide_server_ips is enabled
185     */
186     if (!ConfigServerHide.hide_server_ips && HasUMode(source_p, UMODE_ADMIN))
187 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSCLINE, 'C', conf->host,
188 michael 2820 buf, conf->name, conf->port,
189     conf->class ? conf->class->name : "<default>");
190 michael 1922 else
191 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSCLINE, 'C',
192 michael 2820 "*@127.0.0.1", buf, conf->name, conf->port,
193     conf->class ? conf->class->name : "<default>");
194 michael 1922 }
195     break;
196    
197     default:
198     break;
199     }
200     }
201    
202 michael 1927 /* report_resv()
203     *
204     * inputs - pointer to client pointer to report to.
205     * output - NONE
206     * side effects - report all resvs to client.
207     */
208     static void
209     report_resv(struct Client *source_p)
210     {
211     dlink_node *ptr = NULL;
212    
213 michael 2174 DLINK_FOREACH(ptr, cresv_items.head)
214 michael 1927 {
215 michael 3109 struct MaskItem *conf = ptr->data;
216    
217     sendto_one_numeric(source_p, &me, RPL_STATSQLINE,
218     conf->until ? 'q' : 'Q', conf->count,
219     conf->name, conf->reason);
220 michael 1927 }
221    
222     DLINK_FOREACH(ptr, nresv_items.head)
223     {
224 michael 3109 struct MaskItem *conf = ptr->data;
225    
226     sendto_one_numeric(source_p, &me, RPL_STATSQLINE,
227     conf->until ? 'q' : 'Q', conf->count,
228     conf->name, conf->reason);
229 michael 1927 }
230     }
231    
232 michael 1922 /*
233 adx 30 * This is part of the STATS replies. There is no offical numeric for this
234     * since this isnt an official command, in much the same way as HASH isnt.
235     * It is also possible that some systems wont support this call or have
236     * different field names for "struct rusage".
237     * -avalon
238     */
239     static void
240 michael 1457 stats_usage(struct Client *source_p, int parc, char *parv[])
241 adx 30 {
242     struct rusage rus;
243     time_t secs;
244     time_t rup;
245     #ifdef hz
246     # define hzz hz
247     #else
248     # ifdef HZ
249     # define hzz HZ
250     # else
251     int hzz = 1;
252     # endif
253     #endif
254    
255     if (getrusage(RUSAGE_SELF, &rus) == -1)
256     {
257 michael 3110 sendto_one_notice(source_p, &me, ":Getruseage error: %s",
258     strerror(errno));
259 adx 30 return;
260     }
261    
262     secs = rus.ru_utime.tv_sec + rus.ru_stime.tv_sec;
263    
264     if (secs == 0)
265     secs = 1;
266    
267 michael 1241 rup = (CurrentTime - me.localClient->since) * hzz;
268 adx 30
269     if (rup == 0)
270     rup = 1;
271    
272     sendto_one(source_p,
273 michael 1968 ":%s %d %s R :CPU Secs %d:%02d User %d:%02d System %d:%02d",
274 adx 30 me.name, RPL_STATSDEBUG, source_p->name, (int)(secs/60), (int)(secs%60),
275     (int)(rus.ru_utime.tv_sec/60), (int)(rus.ru_utime.tv_sec%60),
276     (int)(rus.ru_stime.tv_sec/60), (int)(rus.ru_stime.tv_sec%60));
277     sendto_one(source_p, ":%s %d %s R :RSS %ld ShMem %ld Data %ld Stack %ld",
278     me.name, RPL_STATSDEBUG, source_p->name, rus.ru_maxrss,
279     (rus.ru_ixrss / rup), (rus.ru_idrss / rup),
280     (rus.ru_isrss / rup));
281     sendto_one(source_p, ":%s %d %s R :Swaps %d Reclaims %d Faults %d",
282     me.name, RPL_STATSDEBUG, source_p->name, (int)rus.ru_nswap,
283     (int)rus.ru_minflt, (int)rus.ru_majflt);
284     sendto_one(source_p, ":%s %d %s R :Block in %d out %d",
285     me.name, RPL_STATSDEBUG, source_p->name, (int)rus.ru_inblock,
286     (int)rus.ru_oublock);
287     sendto_one(source_p, ":%s %d %s R :Msg Rcv %d Send %d",
288     me.name, RPL_STATSDEBUG, source_p->name, (int)rus.ru_msgrcv,
289     (int)rus.ru_msgsnd);
290     sendto_one(source_p, ":%s %d %s R :Signals %d Context Vol. %d Invol %d",
291     me.name, RPL_STATSDEBUG, source_p->name, (int)rus.ru_nsignals,
292     (int)rus.ru_nvcsw, (int)rus.ru_nivcsw);
293     }
294    
295     static void
296 michael 1457 stats_memory(struct Client *source_p, int parc, char *parv[])
297 adx 30 {
298     const dlink_node *gptr = NULL;
299     const dlink_node *dlink = NULL;
300    
301 michael 948 unsigned int local_client_conf_count = 0; /* local client conf links */
302     unsigned int users_counted = 0; /* user structs */
303 adx 30
304 michael 1017 unsigned int channel_members = 0;
305 michael 948 unsigned int channel_invites = 0;
306     unsigned int channel_bans = 0;
307     unsigned int channel_except = 0;
308     unsigned int channel_invex = 0;
309 adx 30
310 michael 948 unsigned int wwu = 0; /* whowas users */
311     unsigned int class_count = 0; /* classes */
312     unsigned int aways_counted = 0;
313     unsigned int number_ips_stored; /* number of ip addresses hashed */
314 adx 30
315 michael 948 uint64_t channel_memory = 0;
316     uint64_t channel_ban_memory = 0;
317     uint64_t channel_except_memory = 0;
318     uint64_t channel_invex_memory = 0;
319 adx 30
320     unsigned int safelist_count = 0;
321 michael 948 uint64_t safelist_memory = 0;
322 adx 30
323 michael 948 uint64_t wwm = 0; /* whowas array memory used */
324     uint64_t conf_memory = 0; /* memory used by conf lines */
325     uint64_t mem_ips_stored; /* memory used by ip address hash */
326 adx 30
327 michael 948 uint64_t total_channel_memory = 0;
328     uint64_t totww = 0;
329 adx 30
330     unsigned int local_client_count = 0;
331     unsigned int remote_client_count = 0;
332    
333 michael 948 uint64_t local_client_memory_used = 0;
334     uint64_t remote_client_memory_used = 0;
335 adx 30
336 michael 948 uint64_t total_memory = 0;
337 adx 30 unsigned int topic_count = 0;
338    
339 michael 1017 unsigned int watch_list_headers = 0; /* watchlist headers */
340     unsigned int watch_list_entries = 0; /* watchlist entries */
341     uint64_t watch_list_memory = 0; /* watchlist memory used */
342 michael 884
343 adx 30
344     DLINK_FOREACH(gptr, global_client_list.head)
345     {
346     struct Client *target_p = gptr->data;
347    
348     if (MyConnect(target_p))
349     {
350     ++local_client_count;
351     local_client_conf_count += dlink_list_length(&target_p->localClient->confs);
352 michael 1017 watch_list_entries += dlink_list_length(&target_p->localClient->watches);
353 adx 30 }
354     else
355     ++remote_client_count;
356    
357     if (IsClient(target_p))
358     {
359     ++users_counted;
360    
361 michael 1483 if (target_p->away[0])
362 adx 30 ++aways_counted;
363     }
364     }
365    
366     /* Count up all channels, ban lists, except lists, Invex lists */
367     channel_memory = dlink_list_length(&global_channel_list) *
368     sizeof(struct Channel);
369     DLINK_FOREACH(gptr, global_channel_list.head)
370     {
371 michael 948 const struct Ban *actualBan;
372     const struct Channel *chptr = gptr->data;
373 adx 30
374 michael 1017 channel_members += dlink_list_length(&chptr->members);
375 adx 30 channel_invites += dlink_list_length(&chptr->invites);
376    
377 michael 1203 if (chptr->topic[0])
378 adx 30 ++topic_count;
379    
380 michael 1017 channel_bans += dlink_list_length(&chptr->banlist);
381     channel_ban_memory += dlink_list_length(&chptr->banlist) * sizeof(struct Ban);
382    
383     DLINK_FOREACH(dlink, chptr->banlist.head)
384 adx 30 {
385 michael 1017 actualBan = dlink->data;
386     assert(actualBan->who);
387 adx 30
388 michael 1017 channel_ban_memory += actualBan->len + 1;
389     channel_ban_memory += strlen(actualBan->who) + 1;
390 adx 30 }
391    
392 michael 1017 channel_except += dlink_list_length(&chptr->exceptlist);
393     channel_except_memory += dlink_list_length(&chptr->exceptlist) * sizeof(struct Ban);
394    
395     DLINK_FOREACH(dlink, chptr->exceptlist.head)
396 adx 30 {
397 michael 1017 actualBan = dlink->data;
398     assert(actualBan->who);
399 adx 30
400 michael 1017 channel_except_memory += actualBan->len + 1;
401     channel_except_memory += strlen(actualBan->who) + 1;
402 adx 30 }
403    
404 michael 1017 channel_invex += dlink_list_length(&chptr->invexlist);
405     channel_invex_memory += dlink_list_length(&chptr->invexlist) * sizeof(struct Ban);
406    
407     DLINK_FOREACH(dlink, chptr->invexlist.head)
408 adx 30 {
409 michael 1017 actualBan = dlink->data;
410     assert(actualBan->who);
411 adx 30
412 michael 1017 channel_invex_memory += actualBan->len + 1;
413     channel_invex_memory += strlen(actualBan->who) + 1;
414 adx 30 }
415     }
416    
417     if ((safelist_count = dlink_list_length(&listing_client_list)))
418     {
419     safelist_memory = safelist_count * sizeof(struct ListTask);
420     DLINK_FOREACH(gptr, listing_client_list.head)
421     {
422 michael 948 const struct Client *acptr = gptr->data;
423 adx 30
424     DLINK_FOREACH(dlink, acptr->localClient->list_task->show_mask.head)
425     safelist_memory += strlen(dlink->data);
426    
427     DLINK_FOREACH(dlink, acptr->localClient->list_task->hide_mask.head)
428     safelist_memory += strlen(dlink->data);
429     }
430     }
431    
432     #if 0
433     /* XXX THIS has to be fixed !!!! -db */
434     /* count up all config items */
435     DLINK_FOREACH(dlink, ConfigItemList.head)
436     {
437     aconf = dlink->data;
438     conf_memory += aconf->host ? strlen(aconf->host)+1 : 0;
439     conf_memory += aconf->passwd ? strlen(aconf->passwd)+1 : 0;
440     conf_memory += aconf->name ? strlen(aconf->name)+1 : 0;
441     conf_memory += sizeof(struct AccessItem);
442     }
443     #endif
444     /* count up all classes */
445 michael 1644 class_count = dlink_list_length(class_get_list());
446 adx 30
447 michael 2297 whowas_count_memory(&wwu, &wwm);
448 michael 1017 watch_count_memory(&watch_list_headers, &watch_list_memory);
449 michael 884
450 michael 1761 sendto_one(source_p, ":%s %d %s z :WATCH headers %u(%llu) entries %d(%u)",
451 michael 1017 me.name, RPL_STATSDEBUG, source_p->name, watch_list_headers,
452     watch_list_memory, watch_list_entries,
453     watch_list_entries * sizeof(dlink_node) * 2);
454 michael 884
455     sendto_one(source_p, ":%s %d %s z :Clients %u(%u)",
456 adx 30 me.name, RPL_STATSDEBUG, source_p->name, users_counted,
457 michael 884 (users_counted * sizeof(struct Client)));
458 adx 30
459 michael 1483 sendto_one(source_p, ":%s %d %s z :User aways %u",
460 adx 30 me.name, RPL_STATSDEBUG, source_p->name,
461 michael 1483 aways_counted);
462 adx 30
463 michael 948 sendto_one(source_p, ":%s %d %s z :Attached confs %u(%llu)",
464 adx 30 me.name, RPL_STATSDEBUG, source_p->name,
465     local_client_conf_count,
466 michael 948 (unsigned long long)(local_client_conf_count * sizeof(dlink_node)));
467 adx 30
468 michael 1127 sendto_one(source_p, ":%s %d %s z :Resv channels %u(%lu) nicks %u(%lu)",
469 adx 30 me.name, RPL_STATSDEBUG, source_p->name,
470 michael 2174 dlink_list_length(&cresv_items),
471     dlink_list_length(&cresv_items) * sizeof(struct MaskItem),
472 adx 30 dlink_list_length(&nresv_items),
473 michael 1632 dlink_list_length(&nresv_items) * sizeof(struct MaskItem));
474 adx 30
475 michael 948 sendto_one(source_p, ":%s %d %s z :Classes %u(%llu)",
476 adx 30 me.name, RPL_STATSDEBUG, source_p->name,
477 michael 948 class_count, (unsigned long long)(class_count * sizeof(struct ClassItem)));
478 adx 30
479 michael 1761 sendto_one(source_p, ":%s %d %s z :Channels %u(%llu) Topics %u(%u)",
480 adx 30 me.name, RPL_STATSDEBUG, source_p->name,
481     dlink_list_length(&global_channel_list),
482     channel_memory, topic_count, topic_count *
483     (TOPICLEN + 1 + USERHOST_REPLYLEN));
484    
485 michael 948 sendto_one(source_p, ":%s %d %s z :Bans %u(%llu)",
486 adx 30 me.name, RPL_STATSDEBUG, source_p->name,
487     channel_bans, channel_ban_memory);
488    
489 michael 948 sendto_one(source_p, ":%s %d %s z :Exceptions %u(%llu)",
490 adx 30 me.name, RPL_STATSDEBUG, source_p->name,
491     channel_except, channel_except_memory);
492    
493 michael 948 sendto_one(source_p, ":%s %d %s z :Invex %u(%llu)",
494 adx 30 me.name, RPL_STATSDEBUG, source_p->name,
495     channel_invex, channel_invex_memory);
496    
497 michael 948 sendto_one(source_p, ":%s %d %s z :Channel members %u(%llu) invites %u(%llu)",
498 michael 1017 me.name, RPL_STATSDEBUG, source_p->name, channel_members,
499     (unsigned long long)(channel_members * sizeof(struct Membership)),
500 michael 948 channel_invites, (unsigned long long)channel_invites *
501 michael 884 sizeof(dlink_node) * 2);
502 adx 30
503     total_channel_memory = channel_memory + channel_ban_memory +
504 michael 1017 channel_members * sizeof(struct Membership) +
505 michael 884 (channel_invites * sizeof(dlink_node)*2);
506 adx 30
507 michael 948 sendto_one(source_p, ":%s %d %s z :Safelist %u(%llu)",
508 adx 30 me.name, RPL_STATSDEBUG, source_p->name,
509     safelist_count, safelist_memory);
510    
511 michael 948 sendto_one(source_p, ":%s %d %s z :Whowas users %u(%llu)",
512 adx 30 me.name, RPL_STATSDEBUG, source_p->name,
513 michael 948 wwu, (unsigned long long)(wwu * sizeof(struct Client)));
514 adx 30
515 michael 948 sendto_one(source_p, ":%s %d %s z :Whowas array %u(%llu)",
516 adx 30 me.name, RPL_STATSDEBUG, source_p->name,
517 michael 948 NICKNAMEHISTORYLENGTH, wwm);
518 adx 30
519     totww = wwu * sizeof(struct Client) + wwm;
520    
521 michael 2150 motd_memory_count(source_p);
522 adx 30 count_ip_hash(&number_ips_stored,&mem_ips_stored);
523 michael 948 sendto_one(source_p, ":%s %d %s z :iphash %u(%llu)",
524 adx 30 me.name, RPL_STATSDEBUG, source_p->name,
525 michael 948 number_ips_stored, mem_ips_stored);
526 adx 30
527     total_memory = totww + total_channel_memory + conf_memory + class_count *
528     sizeof(struct ClassItem);
529 michael 948 sendto_one(source_p, ":%s %d %s z :Total: whowas %llu channel %llu conf %llu",
530     me.name, RPL_STATSDEBUG, source_p->name, totww,
531     total_channel_memory, conf_memory);
532 adx 30
533     local_client_memory_used = local_client_count*(sizeof(struct Client) + sizeof(struct LocalUser));
534     total_memory += local_client_memory_used;
535 michael 1127 sendto_one(source_p, ":%s %d %s z :Local client Memory in use: %u(%llu)",
536 adx 30 me.name, RPL_STATSDEBUG, source_p->name, local_client_count,
537     local_client_memory_used);
538    
539     remote_client_memory_used = remote_client_count * sizeof(struct Client);
540     total_memory += remote_client_memory_used;
541 michael 1127 sendto_one(source_p, ":%s %d %s z :Remote client Memory in use: %u(%llu)",
542 adx 30 me.name, RPL_STATSDEBUG, source_p->name, remote_client_count,
543     remote_client_memory_used);
544    
545     sendto_one(source_p,
546 michael 948 ":%s %d %s z :TOTAL: %llu",
547 adx 30 me.name, RPL_STATSDEBUG, source_p->name,
548 michael 948 total_memory);
549 adx 30 }
550    
551     static void
552     stats_dns_servers(struct Client *source_p)
553     {
554     report_dns_servers(source_p);
555     }
556    
557     static void
558 michael 1457 stats_connect(struct Client *source_p, int parc, char *parv[])
559 adx 30 {
560 michael 1632 report_confitem_types(source_p, CONF_SERVER);
561 adx 30 }
562    
563     /* stats_deny()
564     *
565     * input - client to report to
566     * output - none
567     * side effects - client is given dline list.
568     */
569     static void
570 michael 1457 stats_deny(struct Client *source_p, int parc, char *parv[])
571 adx 30 {
572 michael 1632 struct MaskItem *conf;
573 michael 1367 dlink_node *ptr = NULL;
574     unsigned int i = 0;
575 adx 30
576 michael 1367
577     for (i = 0; i < ATABLE_SIZE; ++i)
578 adx 30 {
579 michael 1367 DLINK_FOREACH(ptr, atable[i].head)
580 adx 30 {
581 michael 1367 struct AddressRec *arec = ptr->data;
582    
583 michael 1632 if (arec->type != CONF_DLINE)
584     continue;
585 adx 30
586 michael 1632 conf = arec->conf;
587 adx 30
588 michael 1632 /* dont report a tdline as a dline */
589 michael 1649 if (conf->until)
590 michael 1632 continue;
591 adx 30
592 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSDLINE, 'D', conf->host, conf->reason);
593 adx 30 }
594     }
595     }
596    
597     /* stats_tdeny()
598     *
599     * input - client to report to
600     * output - none
601     * side effects - client is given dline list.
602     */
603     static void
604 michael 1457 stats_tdeny(struct Client *source_p, int parc, char *parv[])
605 adx 30 {
606 michael 1632 struct MaskItem *conf = NULL;
607 michael 1367 dlink_node *ptr = NULL;
608     unsigned int i = 0;
609 adx 30
610 michael 1367
611     for (i = 0; i < ATABLE_SIZE; ++i)
612 adx 30 {
613 michael 1367 DLINK_FOREACH(ptr, atable[i].head)
614 adx 30 {
615 michael 1367 struct AddressRec *arec = ptr->data;
616    
617 michael 1632 if (arec->type != CONF_DLINE)
618     continue;
619 adx 30
620 michael 1632 conf = arec->conf;
621 adx 30
622 michael 1632 /* dont report a permanent dline as a tdline */
623 michael 1649 if (!conf->until)
624 michael 1632 continue;
625 adx 30
626 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSDLINE, 'd', conf->host, conf->reason);
627 adx 30 }
628     }
629     }
630    
631     /* stats_exempt()
632     *
633     * input - client to report to
634     * output - none
635     * side effects - client is given list of exempt blocks
636     */
637     static void
638 michael 1457 stats_exempt(struct Client *source_p, int parc, char *parv[])
639 adx 30 {
640 michael 1632 struct MaskItem *conf;
641 michael 1367 dlink_node *ptr = NULL;
642     unsigned int i = 0;
643 adx 30
644 michael 584 if (ConfigFileEntry.stats_e_disabled)
645     {
646 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
647 michael 584 return;
648     }
649    
650 michael 1834
651 michael 1367 for (i = 0; i < ATABLE_SIZE; ++i)
652 adx 30 {
653 michael 1367 DLINK_FOREACH(ptr, atable[i].head)
654 adx 30 {
655 michael 1367 struct AddressRec *arec = ptr->data;
656    
657 michael 1632 if (arec->type != CONF_EXEMPT)
658     continue;
659 adx 30
660 michael 1632 conf = arec->conf;
661 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSDLINE, 'e', conf->host, "");
662 adx 30 }
663     }
664     }
665    
666     static void
667 michael 1457 stats_events(struct Client *source_p, int parc, char *parv[])
668 adx 30 {
669     show_events(source_p);
670     }
671    
672     /* stats_pending_glines()
673     *
674     * input - client pointer
675     * output - none
676     * side effects - client is shown list of pending glines
677     */
678     static void
679 michael 1457 stats_pending_glines(struct Client *source_p, int parc, char *parv[])
680 adx 30 {
681 michael 958 const dlink_node *dn_ptr = NULL;
682 michael 988 const struct gline_pending *glp_ptr = NULL;
683 michael 958 char timebuffer[MAX_DATE_STRING] = { '\0' };
684     struct tm *tmptr = NULL;
685 adx 30
686     if (!ConfigFileEntry.glines)
687     {
688 michael 3110 sendto_one_notice(source_p, &me, ":This server does not support G-Lines");
689 adx 30 return;
690     }
691    
692 michael 958 if (dlink_list_length(&pending_glines[GLINE_PENDING_ADD_TYPE]) > 0)
693 michael 3110 sendto_one_notice(source_p, &me, ":Pending G-lines");
694 adx 30
695 michael 958 DLINK_FOREACH(dn_ptr, pending_glines[GLINE_PENDING_ADD_TYPE].head)
696 adx 30 {
697 michael 958 glp_ptr = dn_ptr->data;
698     tmptr = localtime(&glp_ptr->vote_1.time_request);
699 adx 30 strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr);
700    
701 michael 3110 sendto_one_notice(source_p, &me, ":1) %s!%s@%s on %s requested gline at %s for %s@%s [%s]",
702     glp_ptr->vote_1.oper_nick,
703     glp_ptr->vote_1.oper_user, glp_ptr->vote_1.oper_host,
704     glp_ptr->vote_1.oper_server, timebuffer,
705     glp_ptr->user, glp_ptr->host, glp_ptr->vote_1.reason);
706 adx 30
707 michael 988 if (glp_ptr->vote_2.oper_nick[0] != '\0')
708 adx 30 {
709 michael 958 tmptr = localtime(&glp_ptr->vote_2.time_request);
710 adx 30 strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr);
711 michael 3110
712     sendto_one_notice(source_p, &me, ":2) %s!%s@%s on %s requested gline at %s for %s@%s [%s]",
713     glp_ptr->vote_2.oper_nick,
714     glp_ptr->vote_2.oper_user, glp_ptr->vote_2.oper_host,
715     glp_ptr->vote_2.oper_server, timebuffer,
716     glp_ptr->user, glp_ptr->host, glp_ptr->vote_2.reason);
717 adx 30 }
718     }
719    
720 michael 3110 sendto_one_notice(source_p, &me, ":End of Pending G-lines");
721 michael 958
722     if (dlink_list_length(&pending_glines[GLINE_PENDING_DEL_TYPE]) > 0)
723 michael 3110 sendto_one_notice(source_p, &me, ":Pending UNG-lines");
724 michael 958
725     DLINK_FOREACH(dn_ptr, pending_glines[GLINE_PENDING_DEL_TYPE].head)
726     {
727     glp_ptr = dn_ptr->data;
728     tmptr = localtime(&glp_ptr->vote_1.time_request);
729     strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr);
730    
731 michael 3110 sendto_one_notice(source_p, &me, ":1) %s!%s@%s on %s requested ungline at %s for %s@%s [%s]",
732     glp_ptr->vote_1.oper_nick,
733     glp_ptr->vote_1.oper_user, glp_ptr->vote_1.oper_host,
734     glp_ptr->vote_1.oper_server, timebuffer,
735     glp_ptr->user, glp_ptr->host, glp_ptr->vote_1.reason);
736 michael 958
737 michael 988 if (glp_ptr->vote_2.oper_nick[0] != '\0')
738 michael 958 {
739     tmptr = localtime(&glp_ptr->vote_2.time_request);
740     strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr);
741    
742 michael 3110 sendto_one_notice(source_p, &me, ":2) %s!%s@%s on %s requested ungline at %s for %s@%s [%s]",
743     glp_ptr->vote_2.oper_nick,
744     glp_ptr->vote_2.oper_user, glp_ptr->vote_2.oper_host,
745     glp_ptr->vote_2.oper_server, timebuffer,
746     glp_ptr->user, glp_ptr->host, glp_ptr->vote_2.reason);
747    
748 michael 958 }
749     }
750    
751 michael 3110 sendto_one_notice(source_p, &me, ":End of Pending UNG-lines");
752 adx 30 }
753    
754     /* stats_glines()
755     *
756     * input - client pointer
757     * output - none
758     * side effects - client is shown list of glines
759     */
760     static void
761 michael 1457 stats_glines(struct Client *source_p, int parc, char *parv[])
762 adx 30 {
763 michael 1367 dlink_node *ptr = NULL;
764     unsigned int i = 0;
765 adx 30
766     if (!ConfigFileEntry.glines)
767     {
768 michael 3110 sendto_one_notice(source_p, &me, ":This server does not support G-Lines");
769 adx 30 return;
770     }
771    
772 michael 1367 for (i = 0; i < ATABLE_SIZE; ++i)
773 adx 30 {
774 michael 1367 DLINK_FOREACH(ptr, atable[i].head)
775 adx 30 {
776 michael 1376 const struct AddressRec *arec = ptr->data;
777 michael 1367
778 adx 30 if (arec->type == CONF_GLINE)
779     {
780 michael 1632 const struct MaskItem *conf = arec->conf;
781 adx 30
782 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSKLINE, 'G',
783     conf->host ? conf->host : "*",
784     conf->user ? conf->user : "*",
785     conf->reason ? conf->reason : CONF_NOREASON);
786    
787 adx 30 }
788     }
789     }
790     }
791    
792     static void
793 michael 1457 stats_hubleaf(struct Client *source_p, int parc, char *parv[])
794 adx 30 {
795 michael 2118 const dlink_node *ptr = NULL, *dptr = NULL;
796    
797     DLINK_FOREACH(ptr, server_items.head)
798     {
799     const struct MaskItem *conf = ptr->data;
800    
801     DLINK_FOREACH(dptr, conf->hub_list.head)
802 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSHLINE, 'H', dptr->data, conf->name, 0, "*");
803 michael 2118 }
804    
805     DLINK_FOREACH(ptr, server_items.head)
806     {
807     const struct MaskItem *conf = ptr->data;
808    
809     DLINK_FOREACH(dptr, conf->leaf_list.head)
810 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSLLINE, 'L', dptr->data, conf->name, 0, "*");
811 michael 2118 }
812 adx 30 }
813    
814 michael 1372 /*
815     * show_iline_prefix()
816     *
817     * inputs - pointer to struct Client requesting output
818 michael 2820 * - pointer to struct MaskItem
819 michael 1372 * - name to which iline prefix will be prefixed to
820     * output - pointer to static string with prefixes listed in ascii form
821     * side effects - NONE
822     */
823     static const char *
824 michael 1632 show_iline_prefix(const struct Client *sptr, const struct MaskItem *conf)
825 michael 1372 {
826 michael 1715 static char prefix_of_host[USERLEN + 15];
827 michael 1372 char *prefix_ptr = prefix_of_host;
828    
829 michael 1715 if (IsConfWebIRC(conf))
830     *prefix_ptr++ = '<';
831 michael 1632 if (IsNoTilde(conf))
832 michael 1372 *prefix_ptr++ = '-';
833 michael 1632 if (IsNeedIdentd(conf))
834 michael 1372 *prefix_ptr++ = '+';
835 michael 1632 if (!IsNeedPassword(conf))
836 michael 1372 *prefix_ptr++ = '&';
837 michael 1632 if (IsConfExemptResv(conf))
838 michael 1372 *prefix_ptr++ = '$';
839 michael 1632 if (IsConfDoSpoofIp(conf))
840 michael 1372 *prefix_ptr++ = '=';
841 michael 1632 if (MyOper(sptr) && IsConfExemptKline(conf))
842 michael 1372 *prefix_ptr++ = '^';
843 michael 1632 if (MyOper(sptr) && IsConfExemptGline(conf))
844 michael 1372 *prefix_ptr++ = '_';
845 michael 1632 if (MyOper(sptr) && IsConfExemptLimits(conf))
846 michael 1372 *prefix_ptr++ = '>';
847 michael 1632 if (IsConfCanFlood(conf))
848 michael 1372 *prefix_ptr++ = '|';
849    
850 michael 1632 strlcpy(prefix_ptr, conf->user, USERLEN+1);
851 michael 1372
852     return prefix_of_host;
853     }
854    
855 adx 30 static void
856 michael 3156 report_auth(struct Client *source_p, int parc, char *parv[])
857 michael 1372 {
858 michael 1632 struct MaskItem *conf = NULL;
859 michael 1372 dlink_node *ptr = NULL;
860     unsigned int i;
861    
862    
863     for (i = 0; i < ATABLE_SIZE; ++i)
864     {
865     DLINK_FOREACH(ptr, atable[i].head)
866     {
867     struct AddressRec *arec = ptr->data;
868    
869 michael 1632 if (arec->type != CONF_CLIENT)
870     continue;
871 michael 1372
872 michael 1632 conf = arec->conf;
873 michael 1372
874 michael 3156 if (!MyOper(source_p) && IsConfDoSpoofIp(conf))
875 michael 1632 continue;
876 michael 1372
877 michael 1632 /* We are doing a partial list, based on what matches the u@h of the
878     * sender, so prepare the strings for comparing --fl_
879     */
880     if (ConfigFileEntry.hide_spoof_ips)
881 michael 3156 sendto_one_numeric(source_p, &me, RPL_STATSILINE, 'I',
882 michael 3109 conf->name == NULL ? "*" : conf->name,
883 michael 3156 show_iline_prefix(source_p, conf),
884 michael 3109 IsConfDoSpoofIp(conf) ? "255.255.255.255" :
885     conf->host, conf->port,
886     conf->class ? conf->class->name : "<default>");
887 michael 1372
888 michael 1632 else
889 michael 3156 sendto_one_numeric(source_p, &me, RPL_STATSILINE, 'I',
890 michael 3109 conf->name == NULL ? "*" : conf->name,
891 michael 3156 show_iline_prefix(source_p, conf),
892 michael 3109 conf->host, conf->port,
893     conf->class ? conf->class->name : "<default>");
894 michael 1372 }
895     }
896     }
897    
898     static void
899 michael 1457 stats_auth(struct Client *source_p, int parc, char *parv[])
900 adx 30 {
901     /* Oper only, if unopered, return ERR_NOPRIVILEGES */
902 michael 1219 if ((ConfigFileEntry.stats_i_oper_only == 2) && !HasUMode(source_p, UMODE_OPER))
903 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
904 adx 30
905     /* If unopered, Only return matching auth blocks */
906 michael 1219 else if ((ConfigFileEntry.stats_i_oper_only == 1) && !HasUMode(source_p, UMODE_OPER))
907 adx 30 {
908 michael 1632 struct MaskItem *conf;
909 adx 30
910     if (MyConnect(source_p))
911 michael 1632 conf = find_conf_by_address(source_p->host,
912 michael 2820 &source_p->localClient->ip, CONF_CLIENT,
913     source_p->localClient->aftype,
914     source_p->username,
915     source_p->localClient->passwd, 1);
916 adx 30 else
917 michael 1632 conf = find_conf_by_address(source_p->host, NULL, CONF_CLIENT,
918 michael 1371 0, source_p->username, NULL, 1);
919 adx 30
920 michael 1632 if (conf == NULL)
921 adx 30 return;
922    
923 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSILINE,
924     'I', "*", show_iline_prefix(source_p, conf),
925     conf->host, conf->port,
926     conf->class ? conf->class->name : "<default>");
927 adx 30 }
928     /* They are opered, or allowed to see all auth blocks */
929     else
930 michael 1457 report_auth(source_p, 0, NULL);
931 adx 30 }
932    
933 michael 1372 /* report_Klines()
934     * Inputs: Client to report to,
935     * type(==0 for perm, !=0 for temporary)
936 michael 2820 * mask
937 michael 1372 * Output: None
938 michael 3156 * Side effects: Reports configured K(or k)-lines to source_p.
939 michael 1372 */
940 adx 30 static void
941 michael 3156 report_Klines(struct Client *source_p, int tkline)
942 michael 1372 {
943 michael 1632 struct MaskItem *conf = NULL;
944 michael 1372 unsigned int i = 0;
945 michael 1921 char c = '\0';
946 michael 1372 dlink_node *ptr = NULL;
947    
948     if (tkline)
949 michael 1921 c = 'k';
950 michael 1372 else
951 michael 1921 c = 'K';
952 michael 1372
953     for (i = 0; i < ATABLE_SIZE; ++i)
954     {
955     DLINK_FOREACH(ptr, atable[i].head)
956     {
957     struct AddressRec *arec = ptr->data;
958    
959 michael 1632 if (arec->type != CONF_KLINE)
960     continue;
961 michael 1628
962 michael 1632 conf = arec->conf;
963 michael 1372
964 michael 1650 if ((!tkline && conf->until) ||
965     (tkline && !conf->until))
966 michael 1632 continue;
967    
968 michael 3156 if (HasUMode(source_p, UMODE_OPER))
969     sendto_one_numeric(source_p, &me, RPL_STATSKLINE, c, conf->host, conf->user,
970 michael 3109 conf->reason);
971 michael 1632 else
972 michael 3156 sendto_one_numeric(source_p, &me, RPL_STATSKLINE, c, conf->host, conf->user,
973 michael 3109 conf->reason);
974 michael 1372 }
975     }
976     }
977    
978     static void
979 michael 1457 stats_tklines(struct Client *source_p, int parc, char *parv[])
980 adx 30 {
981     /* Oper only, if unopered, return ERR_NOPRIVILEGES */
982 michael 1219 if ((ConfigFileEntry.stats_k_oper_only == 2) && !HasUMode(source_p, UMODE_OPER))
983 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
984 adx 30
985     /* If unopered, Only return matching klines */
986 michael 1219 else if ((ConfigFileEntry.stats_k_oper_only == 1) && !HasUMode(source_p, UMODE_OPER))
987 adx 30 {
988 michael 1632 struct MaskItem *conf = NULL;
989 adx 30
990     if (MyConnect(source_p))
991 michael 1632 conf = find_conf_by_address(source_p->host,
992 michael 2820 &source_p->localClient->ip, CONF_KLINE,
993     source_p->localClient->aftype,
994     source_p->username, NULL, 1);
995 adx 30 else
996 michael 1632 conf = find_conf_by_address(source_p->host, NULL, CONF_KLINE,
997 michael 1371 0, source_p->username, NULL, 1);
998 adx 30
999 michael 1632 if (!conf)
1000 adx 30 return;
1001    
1002     /* dont report a permanent kline as a tkline */
1003 michael 1649 if (!conf->until)
1004 adx 30 return;
1005    
1006 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSKLINE, 'k',
1007     conf->host, conf->user, conf->reason);
1008 adx 30 }
1009     /* Theyre opered, or allowed to see all klines */
1010     else {
1011     report_Klines(source_p, 1);
1012     }
1013     }
1014    
1015     static void
1016 michael 1457 stats_klines(struct Client *source_p, int parc, char *parv[])
1017 adx 30 {
1018     /* Oper only, if unopered, return ERR_NOPRIVILEGES */
1019 michael 1219 if ((ConfigFileEntry.stats_k_oper_only == 2) && !HasUMode(source_p, UMODE_OPER))
1020 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
1021 adx 30
1022     /* If unopered, Only return matching klines */
1023 michael 1219 else if ((ConfigFileEntry.stats_k_oper_only == 1) && !HasUMode(source_p, UMODE_OPER))
1024 adx 30 {
1025 michael 1632 struct MaskItem *conf = NULL;
1026 adx 30
1027     /* search for a kline */
1028 michael 560 if (MyConnect(source_p))
1029 michael 1632 conf = find_conf_by_address(source_p->host,
1030 michael 2820 &source_p->localClient->ip, CONF_KLINE,
1031     source_p->localClient->aftype,
1032     source_p->username, NULL, 0);
1033 adx 30 else
1034 michael 1632 conf = find_conf_by_address(source_p->host, NULL, CONF_KLINE,
1035 michael 1371 0, source_p->username, NULL, 0);
1036 adx 30
1037 michael 1632 if (!conf)
1038 adx 30 return;
1039    
1040     /* dont report a tkline as a kline */
1041 michael 1649 if (conf->until)
1042 adx 30 return;
1043 michael 2820
1044 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSKLINE, 'K',
1045     conf->host, conf->user, conf->reason);
1046 adx 30 }
1047     /* Theyre opered, or allowed to see all klines */
1048 michael 1921 else
1049 adx 30 report_Klines(source_p, 0);
1050     }
1051    
1052     static void
1053 michael 1457 stats_messages(struct Client *source_p, int parc, char *parv[])
1054 adx 30 {
1055     report_messages(source_p);
1056     }
1057    
1058     static void
1059 michael 1457 stats_oper(struct Client *source_p, int parc, char *parv[])
1060 adx 30 {
1061 michael 1219 if (!HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.stats_o_oper_only)
1062 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
1063 adx 30 else
1064 michael 1632 report_confitem_types(source_p, CONF_OPER);
1065 adx 30 }
1066    
1067     /* stats_operedup()
1068     *
1069     * input - client pointer
1070     * output - none
1071     * side effects - client is shown a list of active opers
1072     */
1073     static void
1074 michael 1457 stats_operedup(struct Client *source_p, int parc, char *parv[])
1075 adx 30 {
1076 michael 3114 dlink_node *ptr = NULL;
1077 adx 30
1078     DLINK_FOREACH(ptr, oper_list.head)
1079     {
1080     const struct Client *target_p = ptr->data;
1081    
1082 michael 1294 if (HasUMode(target_p, UMODE_HIDDEN) && !HasUMode(source_p, UMODE_OPER))
1083 adx 30 continue;
1084    
1085 michael 1219 if (MyClient(source_p) && HasUMode(source_p, UMODE_OPER))
1086 michael 1783 sendto_one(source_p, ":%s %d %s p :[%c][%s] %s (%s@%s) Idle: %u",
1087 michael 3114 ID_or_name(&me, source_p), RPL_STATSDEBUG, ID_or_name(source_p, source_p),
1088 michael 1294 HasUMode(target_p, UMODE_ADMIN) ? 'A' : 'O',
1089 michael 2820 oper_privs_as_string(target_p->localClient->operflags),
1090     target_p->name, target_p->username, target_p->host,
1091 michael 1783 idle_time_get(source_p, target_p));
1092 adx 30 else
1093 michael 1783 sendto_one(source_p, ":%s %d %s p :[%c] %s (%s@%s) Idle: %u",
1094 michael 3114 ID_or_name(&me, source_p), RPL_STATSDEBUG, ID_or_name(source_p, source_p),
1095 michael 1294 HasUMode(target_p, UMODE_ADMIN) ? 'A' : 'O',
1096 michael 2820 target_p->name, target_p->username, target_p->host,
1097 michael 1783 idle_time_get(source_p, target_p));
1098 adx 30 }
1099    
1100 michael 1759 sendto_one(source_p, ":%s %d %s p :%u OPER(s)",
1101 michael 3114 ID_or_name(&me, source_p), RPL_STATSDEBUG, ID_or_name(source_p, source_p), dlink_list_length(&oper_list));
1102 adx 30 }
1103    
1104     static void
1105 michael 1457 stats_ports(struct Client *source_p, int parc, char *parv[])
1106 adx 30 {
1107 michael 1219 if (!HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.stats_P_oper_only)
1108 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
1109 adx 30 else
1110     show_ports(source_p);
1111     }
1112    
1113     static void
1114 michael 1457 stats_resv(struct Client *source_p, int parc, char *parv[])
1115 adx 30 {
1116     report_resv(source_p);
1117     }
1118    
1119     static void
1120 michael 1457 stats_service(struct Client *source_p, int parc, char *parv[])
1121 adx 30 {
1122 michael 1632 report_confitem_types(source_p, CONF_SERVICE);
1123 michael 1175 }
1124    
1125     static void
1126 michael 1457 stats_tstats(struct Client *source_p, int parc, char *parv[])
1127 adx 30 {
1128 michael 896 const struct Client *target_p = NULL;
1129     const dlink_node *ptr = NULL;
1130     struct ServerStatistics tmp;
1131 michael 1842 struct ServerStatistics *sp = &tmp;
1132 michael 896
1133     memcpy(sp, &ServerStats, sizeof(struct ServerStatistics));
1134    
1135     /*
1136     * must use the += operator. is_sv is not the number of currently
1137     * active server connections. Note the incrementation in
1138     * s_bsd.c:close_connection.
1139     */
1140     sp->is_sv += dlink_list_length(&serv_list);
1141    
1142     DLINK_FOREACH(ptr, serv_list.head)
1143     {
1144     target_p = ptr->data;
1145    
1146     sp->is_sbs += target_p->localClient->send.bytes;
1147     sp->is_sbr += target_p->localClient->recv.bytes;
1148 michael 1241 sp->is_sti += CurrentTime - target_p->localClient->firsttime;
1149 michael 896 }
1150    
1151     sp->is_cl += dlink_list_length(&local_client_list);
1152    
1153     DLINK_FOREACH(ptr, local_client_list.head)
1154     {
1155     target_p = ptr->data;
1156    
1157     sp->is_cbs += target_p->localClient->send.bytes;
1158     sp->is_cbr += target_p->localClient->recv.bytes;
1159 michael 1241 sp->is_cti += CurrentTime - target_p->localClient->firsttime;
1160 michael 896 }
1161    
1162     sp->is_ni += dlink_list_length(&unknown_list);
1163    
1164     sendto_one(source_p, ":%s %d %s T :accepts %u refused %u",
1165     me.name, RPL_STATSDEBUG, source_p->name, sp->is_ac, sp->is_ref);
1166     sendto_one(source_p, ":%s %d %s T :unknown commands %u prefixes %u",
1167     me.name, RPL_STATSDEBUG, source_p->name, sp->is_unco, sp->is_unpf);
1168     sendto_one(source_p, ":%s %d %s T :nick collisions %u unknown closes %u",
1169     me.name, RPL_STATSDEBUG, source_p->name, sp->is_kill, sp->is_ni);
1170     sendto_one(source_p, ":%s %d %s T :wrong direction %u empty %u",
1171     me.name, RPL_STATSDEBUG, source_p->name, sp->is_wrdi, sp->is_empt);
1172     sendto_one(source_p, ":%s %d %s T :numerics seen %u",
1173     me.name, RPL_STATSDEBUG, source_p->name, sp->is_num);
1174     sendto_one(source_p, ":%s %d %s T :auth successes %u fails %u",
1175     me.name, RPL_STATSDEBUG, source_p->name, sp->is_asuc, sp->is_abad);
1176     sendto_one(source_p, ":%s %d %s T :Client Server",
1177     me.name, RPL_STATSDEBUG, source_p->name);
1178    
1179     sendto_one(source_p, ":%s %d %s T :connected %u %u",
1180     me.name, RPL_STATSDEBUG, source_p->name,
1181     (unsigned int)sp->is_cl,
1182     (unsigned int)sp->is_sv);
1183     sendto_one(source_p, ":%s %d %s T :bytes sent %llu %llu",
1184     me.name, RPL_STATSDEBUG, source_p->name,
1185     sp->is_cbs, sp->is_sbs);
1186     sendto_one(source_p, ":%s %d %s T :bytes recv %llu %llu",
1187     me.name, RPL_STATSDEBUG, source_p->name,
1188     sp->is_cbr, sp->is_sbr);
1189     sendto_one(source_p, ":%s %d %s T :time connected %u %u",
1190     me.name, RPL_STATSDEBUG, source_p->name,
1191     (unsigned int)sp->is_cti,
1192     (unsigned int)sp->is_sti);
1193 adx 30 }
1194    
1195     static void
1196 michael 1457 stats_uptime(struct Client *source_p, int parc, char *parv[])
1197 adx 30 {
1198 michael 2270 if (!HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.stats_u_oper_only)
1199 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
1200 michael 2269 else
1201     {
1202     time_t now = CurrentTime - me.localClient->since;
1203 michael 1148
1204 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSUPTIME, now / 86400,
1205     (now / 3600) % 24, (now / 60) % 60, now % 60);
1206 michael 1148
1207 michael 2269 if (!ConfigServerHide.disable_remote_commands || HasUMode(source_p, UMODE_OPER))
1208 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSCONN, Count.max_loc_con,
1209     Count.max_loc_cli, Count.totalrestartcount);
1210 michael 2269 }
1211 adx 30 }
1212    
1213     static void
1214 michael 1457 stats_shared(struct Client *source_p, int parc, char *parv[])
1215 adx 30 {
1216 michael 1632 report_confitem_types(source_p, CONF_ULINE);
1217 adx 30 }
1218    
1219     /* stats_servers()
1220     *
1221     * input - client pointer
1222     * output - none
1223     * side effects - client is shown lists of who connected servers
1224     */
1225     static void
1226 michael 1457 stats_servers(struct Client *source_p, int parc, char *parv[])
1227 adx 30 {
1228 michael 1127 dlink_node *ptr = NULL;
1229 adx 30
1230     DLINK_FOREACH(ptr, serv_list.head)
1231     {
1232 michael 1127 const struct Client *target_p = ptr->data;
1233 adx 30
1234     sendto_one(source_p, ":%s %d %s v :%s (%s!%s@%s) Idle: %d",
1235 michael 3114 ID_or_name(&me, source_p), RPL_STATSDEBUG,
1236     ID_or_name(source_p, source_p), target_p->name,
1237 michael 1127 (target_p->serv->by[0] ? target_p->serv->by : "Remote."),
1238 michael 1241 "*", "*", (int)(CurrentTime - target_p->localClient->lasttime));
1239 adx 30 }
1240    
1241 michael 3114 sendto_one(source_p, ":%s %d %s v :%u Server(s)", ID_or_name(&me, source_p),
1242     RPL_STATSDEBUG, ID_or_name(source_p, source_p),
1243     dlink_list_length(&serv_list));
1244 adx 30 }
1245    
1246     static void
1247 michael 1457 stats_gecos(struct Client *source_p, int parc, char *parv[])
1248 adx 30 {
1249 michael 1632 report_confitem_types(source_p, CONF_XLINE);
1250 adx 30 }
1251    
1252     static void
1253 michael 1457 stats_class(struct Client *source_p, int parc, char *parv[])
1254 adx 30 {
1255 michael 2116 const dlink_node *ptr = NULL;
1256    
1257     DLINK_FOREACH(ptr, class_get_list()->head)
1258     {
1259     const struct ClassItem *class = ptr->data;
1260    
1261 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSYLINE, 'Y',
1262     class->name, class->ping_freq,
1263     class->con_freq,
1264     class->max_total, class->max_sendq,
1265     class->max_recvq,
1266     class->ref_count,
1267     class->number_per_cidr, class->cidr_bitlen_ipv4,
1268     class->number_per_cidr, class->cidr_bitlen_ipv6,
1269     class->active ? "active" : "disabled");
1270 michael 2116 }
1271 adx 30 }
1272    
1273     static void
1274 michael 1457 stats_servlinks(struct Client *source_p, int parc, char *parv[])
1275 adx 30 {
1276     uint64_t sendB = 0, recvB = 0;
1277     time_t uptime = 0;
1278 michael 560 dlink_node *ptr = NULL;
1279 adx 30
1280 michael 1219 if (ConfigServerHide.flatten_links && !HasUMode(source_p, UMODE_OPER))
1281 adx 30 {
1282 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
1283 adx 30 return;
1284     }
1285    
1286     DLINK_FOREACH(ptr, serv_list.head)
1287     {
1288 michael 560 struct Client *target_p = ptr->data;
1289 adx 30
1290 michael 1851 if (HasFlag(target_p, FLAGS_SERVICE) && ConfigServerHide.hide_services)
1291     if (!HasUMode(source_p, UMODE_OPER))
1292     continue;
1293    
1294 adx 30 sendB += target_p->localClient->send.bytes;
1295     recvB += target_p->localClient->recv.bytes;
1296    
1297     /* ":%s 211 %s %s %u %u %llu %u %llu :%u %u %s" */
1298 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSLINKINFO,
1299 michael 1219 get_client_name(target_p, HasUMode(source_p, UMODE_ADMIN) ? SHOW_IP : MASK_IP),
1300 adx 30 dbuf_length(&target_p->localClient->buf_sendq),
1301     target_p->localClient->send.messages,
1302     target_p->localClient->send.bytes >> 10,
1303     target_p->localClient->recv.messages,
1304     target_p->localClient->recv.bytes >> 10,
1305 michael 1241 (unsigned)(CurrentTime - target_p->localClient->firsttime),
1306     (CurrentTime > target_p->localClient->since) ? (unsigned)(CurrentTime - target_p->localClient->since): 0,
1307 michael 1219 HasUMode(source_p, UMODE_OPER) ? show_capabilities(target_p) : "TS");
1308 adx 30 }
1309    
1310     sendB >>= 10;
1311     recvB >>= 10;
1312    
1313     sendto_one(source_p, ":%s %d %s ? :%u total server(s)",
1314 michael 3114 ID_or_name(&me, source_p), RPL_STATSDEBUG, ID_or_name(source_p, source_p), dlink_list_length(&serv_list));
1315 michael 3227 sendto_one(source_p, ":%s %d %s ? :Sent total: %7.2f %s",
1316 michael 3114 ID_or_name(&me, source_p), RPL_STATSDEBUG, ID_or_name(source_p, source_p),
1317 michael 560 _GMKv(sendB), _GMKs(sendB));
1318 michael 3227 sendto_one(source_p, ":%s %d %s ? :Recv total: %7.2f %s",
1319 michael 3114 ID_or_name(&me, source_p), RPL_STATSDEBUG, ID_or_name(source_p, source_p),
1320 michael 560 _GMKv(recvB), _GMKs(recvB));
1321 adx 30
1322 michael 1241 uptime = (CurrentTime - me.localClient->since);
1323 adx 30
1324     sendto_one(source_p, ":%s %d %s ? :Server send: %7.2f %s (%4.1f K/s)",
1325 michael 3114 ID_or_name(&me, source_p), RPL_STATSDEBUG, ID_or_name(source_p, source_p),
1326 michael 560 _GMKv((me.localClient->send.bytes>>10)),
1327     _GMKs((me.localClient->send.bytes>>10)),
1328     (float)((float)((me.localClient->send.bytes) >> 10) /
1329     (float)uptime));
1330 adx 30 sendto_one(source_p, ":%s %d %s ? :Server recv: %7.2f %s (%4.1f K/s)",
1331 michael 3114 ID_or_name(&me, source_p), RPL_STATSDEBUG, ID_or_name(source_p, source_p),
1332 michael 560 _GMKv((me.localClient->recv.bytes>>10)),
1333     _GMKs((me.localClient->recv.bytes>>10)),
1334     (float)((float)((me.localClient->recv.bytes) >> 10) /
1335     (float)uptime));
1336 adx 30 }
1337    
1338 michael 1457 /* parse_stats_args()
1339     *
1340     * inputs - arg count
1341     * - args
1342     * - doall flag
1343     * - wild card or not
1344     * output - pointer to name to use
1345     * side effects -
1346     * common parse routine for m_stats args
1347 michael 2820 *
1348 michael 1457 */
1349     static char *
1350 michael 3114 parse_stats_args(struct Client *source_p, int parc, char *parv[], int *doall, int *wilds)
1351 adx 30 {
1352 michael 1457 char *name;
1353 adx 30
1354 michael 1457 if (parc > 2)
1355 adx 30 {
1356 michael 1457 name = parv[2];
1357 adx 30
1358 michael 3114 if (!irccmp(name, ID_or_name(&me, source_p)))
1359 michael 1457 *doall = 2;
1360 michael 3114 else if (!match(name, ID_or_name(&me, source_p)))
1361 michael 1457 *doall = 1;
1362    
1363     *wilds = has_wildcards(name);
1364    
1365     return name;
1366 adx 30 }
1367    
1368 michael 1457 return NULL;
1369 adx 30 }
1370    
1371     static void
1372 michael 3079 stats_L_list(struct Client *source_p, char *name, int doall, int wilds,
1373     dlink_list *list, char statchar)
1374 adx 30 {
1375     dlink_node *ptr;
1376     struct Client *target_p;
1377    
1378     /*
1379     * send info about connections which match, or all if the
1380     * mask matches from. Only restrictions are on those who
1381     * are invisible not being visible to 'foreigners' who use
1382     * a wild card based search to list it.
1383     */
1384     DLINK_FOREACH(ptr, list->head)
1385     {
1386     target_p = ptr->data;
1387    
1388 michael 1219 if (HasUMode(target_p, UMODE_INVISIBLE) && (doall || wilds) &&
1389 michael 1457 !(MyConnect(source_p) && HasUMode(source_p, UMODE_OPER)) &&
1390     !HasUMode(target_p, UMODE_OPER) && (target_p != source_p))
1391 adx 30 continue;
1392 michael 1652 if (!doall && wilds && match(name, target_p->name))
1393 adx 30 continue;
1394     if (!(doall || wilds) && irccmp(name, target_p->name))
1395     continue;
1396    
1397     /* This basically shows ips for our opers if its not a server/admin, or
1398     * its one of our admins. */
1399 michael 1457 if(MyClient(source_p) && HasUMode(source_p, UMODE_OPER) &&
1400 michael 1219 (HasUMode(source_p, UMODE_ADMIN) ||
1401 michael 1457 (!IsServer(target_p) && !HasUMode(target_p, UMODE_ADMIN) &&
1402 adx 30 !IsHandshake(target_p) && !IsConnecting(target_p))))
1403     {
1404 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSLINKINFO,
1405 adx 30 (IsUpper(statchar)) ?
1406     get_client_name(target_p, SHOW_IP) :
1407     get_client_name(target_p, HIDE_IP),
1408     dbuf_length(&target_p->localClient->buf_sendq),
1409     target_p->localClient->send.messages,
1410     target_p->localClient->send.bytes>>10,
1411     target_p->localClient->recv.messages,
1412     target_p->localClient->recv.bytes>>10,
1413 michael 1241 (unsigned)(CurrentTime - target_p->localClient->firsttime),
1414     (CurrentTime > target_p->localClient->since) ? (unsigned)(CurrentTime - target_p->localClient->since):0,
1415 adx 30 IsServer(target_p) ? show_capabilities(target_p) : "-");
1416     }
1417     else
1418     {
1419     /* If its a hidden ip, an admin, or a server, mask the real IP */
1420 michael 1219 if(IsIPSpoof(target_p) || IsServer(target_p) || HasUMode(target_p, UMODE_ADMIN)
1421 adx 30 || IsHandshake(target_p) || IsConnecting(target_p))
1422 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSLINKINFO,
1423 michael 1457 get_client_name(target_p, MASK_IP),
1424     dbuf_length(&target_p->localClient->buf_sendq),
1425     target_p->localClient->send.messages,
1426     target_p->localClient->send.bytes>>10,
1427     target_p->localClient->recv.messages,
1428     target_p->localClient->recv.bytes>>10,
1429     (unsigned)(CurrentTime - target_p->localClient->firsttime),
1430     (CurrentTime > target_p->localClient->since) ? (unsigned)(CurrentTime - target_p->localClient->since):0,
1431     IsServer(target_p) ? show_capabilities(target_p) : "-");
1432 adx 30 else /* show the real IP */
1433 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSLINKINFO,
1434 michael 1457 (IsUpper(statchar)) ?
1435     get_client_name(target_p, SHOW_IP) :
1436     get_client_name(target_p, HIDE_IP),
1437     dbuf_length(&target_p->localClient->buf_sendq),
1438     target_p->localClient->send.messages,
1439     target_p->localClient->send.bytes>>10,
1440     target_p->localClient->recv.messages,
1441     target_p->localClient->recv.bytes>>10,
1442     (unsigned)(CurrentTime - target_p->localClient->firsttime),
1443     (CurrentTime > target_p->localClient->since) ? (unsigned)(CurrentTime - target_p->localClient->since):0,
1444     IsServer(target_p) ? show_capabilities(target_p) : "-");
1445 adx 30 }
1446     }
1447     }
1448    
1449 michael 1457 /*
1450     * stats_L
1451 adx 30 *
1452 michael 1457 * inputs - pointer to client to report to
1453     * - doall flag
1454     * - wild card or not
1455     * output - NONE
1456     * side effects -
1457     */
1458     static void
1459 michael 3079 stats_L(struct Client *source_p, char *name,int doall,
1460     int wilds, char statchar)
1461 michael 1457 {
1462     stats_L_list(source_p, name, doall, wilds, &unknown_list, statchar);
1463     stats_L_list(source_p, name, doall, wilds, &local_client_list, statchar);
1464     stats_L_list(source_p, name, doall, wilds, &serv_list, statchar);
1465     }
1466    
1467     static void
1468     stats_ltrace(struct Client *source_p, int parc, char *parv[])
1469     {
1470     int doall = 0;
1471     int wilds = 0;
1472     char *name = NULL;
1473     char statchar;
1474    
1475 michael 3114 if ((name = parse_stats_args(source_p, parc, parv, &doall, &wilds)) != NULL)
1476 michael 1457 {
1477     statchar = parv[1][0];
1478    
1479     stats_L(source_p, name, doall, wilds, statchar);
1480     }
1481     else
1482 michael 3109 sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, "STATS");
1483 michael 1457 }
1484    
1485     static const struct StatsStruct
1486     {
1487     const unsigned char letter;
1488     void (*handler)();
1489     const unsigned int need_oper;
1490     const unsigned int need_admin;
1491     } stats_cmd_table[] = {
1492     /* letter function need_oper need_admin */
1493     { 'a', stats_dns_servers, 1, 1 },
1494     { 'A', stats_dns_servers, 1, 1 },
1495     { 'c', stats_connect, 1, 0 },
1496     { 'C', stats_connect, 1, 0 },
1497     { 'd', stats_tdeny, 1, 0 },
1498     { 'D', stats_deny, 1, 0 },
1499     { 'e', stats_exempt, 1, 0 },
1500     { 'E', stats_events, 1, 1 },
1501     { 'f', fd_dump, 1, 1 },
1502     { 'F', fd_dump, 1, 1 },
1503     { 'g', stats_pending_glines, 1, 0 },
1504     { 'G', stats_glines, 1, 0 },
1505     { 'h', stats_hooks, 1, 1 },
1506     { 'H', stats_hubleaf, 1, 0 },
1507     { 'i', stats_auth, 0, 0 },
1508     { 'I', stats_auth, 0, 0 },
1509     { 'k', stats_tklines, 0, 0 },
1510     { 'K', stats_klines, 0, 0 },
1511     { 'l', stats_ltrace, 1, 0 },
1512     { 'L', stats_ltrace, 1, 0 },
1513     { 'm', stats_messages, 0, 0 },
1514     { 'M', stats_messages, 0, 0 },
1515     { 'o', stats_oper, 0, 0 },
1516     { 'O', stats_oper, 0, 0 },
1517     { 'p', stats_operedup, 0, 0 },
1518     { 'P', stats_ports, 0, 0 },
1519     { 'q', stats_resv, 1, 0 },
1520     { 'Q', stats_resv, 1, 0 },
1521     { 'r', stats_usage, 1, 0 },
1522     { 'R', stats_usage, 1, 0 },
1523 michael 1875 { 's', stats_service, 1, 0 },
1524 michael 1457 { 'S', stats_service, 1, 0 },
1525     { 't', stats_tstats, 1, 0 },
1526 michael 2150 { 'T', motd_report, 1, 0 },
1527 michael 1457 { 'u', stats_uptime, 0, 0 },
1528     { 'U', stats_shared, 1, 0 },
1529     { 'v', stats_servers, 1, 0 },
1530     { 'x', stats_gecos, 1, 0 },
1531     { 'X', stats_gecos, 1, 0 },
1532     { 'y', stats_class, 1, 0 },
1533     { 'Y', stats_class, 1, 0 },
1534     { 'z', stats_memory, 1, 0 },
1535     { '?', stats_servlinks, 0, 0 },
1536     { '\0', NULL, 0, 0 }
1537     };
1538    
1539     static void
1540     do_stats(struct Client *source_p, int parc, char *parv[])
1541     {
1542     const struct StatsStruct *tab = stats_cmd_table;
1543     const char statchar = *parv[1];
1544    
1545     if (statchar == '\0')
1546     {
1547 michael 3109 sendto_one_numeric(source_p, &me, RPL_ENDOFSTATS, '*');
1548 michael 1457 return;
1549     }
1550    
1551     for (; tab->handler; ++tab)
1552     {
1553     if (tab->letter == statchar)
1554     {
1555     /* The stats table says what privs are needed, so check --fl_ */
1556     if ((tab->need_admin && !HasUMode(source_p, UMODE_ADMIN)) ||
1557     (tab->need_oper && !HasUMode(source_p, UMODE_OPER)))
1558     {
1559 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
1560 michael 1457 break;
1561     }
1562    
1563 michael 1618 sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
1564 michael 1532 "STATS %c requested by %s (%s@%s) [%s]",
1565 michael 1457 statchar, source_p->name, source_p->username,
1566     source_p->host, source_p->servptr->name);
1567     tab->handler(source_p, parc, parv);
1568     break;
1569     }
1570     }
1571    
1572 michael 3109 sendto_one_numeric(source_p, &me, RPL_ENDOFSTATS, statchar);
1573 michael 1457 }
1574    
1575     /*
1576     * m_stats()
1577 michael 3096 * parv[0] = command
1578 michael 1457 * parv[1] = stat letter/command
1579     * parv[2] = (if present) server/mask in stats L
1580 michael 2820 *
1581 michael 1457 * This will search the tables for the appropriate stats letter/command,
1582 michael 2820 * if found execute it.
1583 adx 30 */
1584 michael 2820 static int
1585 michael 3156 m_stats(struct Client *source_p, int parc, char *parv[])
1586 adx 30 {
1587 michael 1457 static time_t last_used = 0;
1588 adx 30
1589 michael 1457 /* Check the user is actually allowed to do /stats, and isnt flooding */
1590     if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
1591     {
1592 michael 3109 sendto_one_numeric(source_p, &me, RPL_LOAD2HI);
1593 michael 2820 return 0;
1594 michael 1457 }
1595 adx 30
1596 michael 1457 last_used = CurrentTime;
1597 adx 30
1598 michael 2341 /* Is the stats meant for us? */
1599     if (!ConfigServerHide.disable_remote_commands)
1600 michael 3156 if (hunt_server(source_p, ":%s STATS %s :%s", 2,
1601 michael 2341 parc, parv) != HUNTED_ISME)
1602 michael 2820 return 0;
1603 michael 2341
1604 michael 1457 do_stats(source_p, parc, parv);
1605 michael 2820 return 0;
1606 michael 1457 }
1607    
1608     /*
1609 michael 3219 * ms_stats()
1610 michael 3096 * parv[0] = command
1611 michael 1457 * parv[1] = stat letter/command
1612     * parv[2] = (if present) server/mask in stats L, or target
1613     *
1614     * This will search the tables for the appropriate stats letter,
1615 michael 2820 * if found execute it.
1616 michael 1457 */
1617 michael 2820 static int
1618 michael 3219 ms_stats(struct Client *source_p, int parc, char *parv[])
1619 michael 1457 {
1620 michael 3156 if (hunt_server(source_p, ":%s STATS %s :%s", 2,
1621 michael 1457 parc, parv) != HUNTED_ISME)
1622 michael 2820 return 0;
1623 michael 1457
1624     do_stats(source_p, parc, parv);
1625 michael 2820 return 0;
1626 adx 30 }
1627 michael 1230
1628 michael 2820 static struct Message stats_msgtab =
1629     {
1630 michael 1230 "STATS", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
1631 michael 3219 { m_unregistered, m_stats, ms_stats, m_ignore, ms_stats, m_ignore }
1632 michael 1230 };
1633    
1634     static void
1635     module_init(void)
1636     {
1637     mod_add_cmd(&stats_msgtab);
1638     }
1639    
1640     static void
1641     module_exit(void)
1642     {
1643     mod_del_cmd(&stats_msgtab);
1644     }
1645    
1646 michael 2820 struct module module_entry =
1647     {
1648 michael 1230 .node = { NULL, NULL, NULL },
1649     .name = NULL,
1650     .version = "$Revision$",
1651     .handle = NULL,
1652     .modinit = module_init,
1653     .modexit = module_exit,
1654     .flags = 0
1655     };

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision