ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/modules/m_stats.c
Revision: 3109
Committed: Thu Mar 6 19:25:12 2014 UTC (11 years, 5 months ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid/trunk/modules/m_stats.c
File size: 53086 byte(s)
Log Message:
- Applied Adam's sendto_one_numeric() changes

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

Properties

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