Doxyfy s_misc.h and s_misc.c.
[ircu2.10.12-pk.git] / ircd / s_misc.c
1 /*
2  * IRC - Internet Relay Chat, ircd/s_misc.c (formerly ircd/date.c)
3  * Copyright (C) 1990 Jarkko Oikarinen and
4  *                    University of Oulu, Computing Center
5  *
6  * See file AUTHORS in IRC package for additional names of
7  * the programmers.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 1, or (at your option)
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  * $Id$
24  */
25 #include "config.h"
26
27 #include "s_misc.h"
28 #include "IPcheck.h"
29 #include "channel.h"
30 #include "client.h"
31 #include "hash.h"
32 #include "ircd.h"
33 #include "ircd_alloc.h"
34 #include "ircd_auth.h"
35 #include "ircd_features.h"
36 #include "ircd_log.h"
37 #include "ircd_reply.h"
38 #include "ircd_snprintf.h"
39 #include "ircd_string.h"
40 #include "list.h"
41 #include "match.h"
42 #include "msg.h"
43 #include "numeric.h"
44 #include "numnicks.h"
45 #include "parse.h"
46 #include "querycmds.h"
47 #include "res.h"
48 #include "s_bsd.h"
49 #include "s_conf.h"
50 #include "s_debug.h"
51 #include "s_stats.h"
52 #include "s_user.h"
53 #include "send.h"
54 #include "struct.h"
55 #include "support.h"
56 #include "sys.h"
57 #include "uping.h"
58 #include "userload.h"
59
60 #include <assert.h>
61 #include <fcntl.h>
62 #include <netdb.h>
63 #include <stdio.h>
64 #include <string.h>
65 #include <sys/stat.h>
66 #include <unistd.h>
67
68 /** Array of English month names (0 = January). */
69 static char *months[] = {
70   "January", "February", "March", "April",
71   "May", "June", "July", "August",
72   "September", "October", "November", "December"
73 };
74
75 /** Array of English day names (0 = Sunday). */
76 static char *weekdays[] = {
77   "Sunday", "Monday", "Tuesday", "Wednesday",
78   "Thursday", "Friday", "Saturday"
79 };
80
81 /*
82  * stats stuff
83  */
84 /** Global statistics structure. */
85 static struct ServerStatistics ircst;
86 /** Public pointer to global statistics structure. */
87 struct ServerStatistics* ServerStats = &ircst;
88
89 /** Formats a Unix time as a readable string.
90  * @param clock Unix time to format (0 means #CurrentTime).
91  * @return Pointer to a static buffer containing something like
92  * "Sunday January 1 2000 -- 09:30 +01:00"
93  */
94 char *date(time_t clock)
95 {
96   static char buf[80], plus;
97   struct tm *lt, *gm;
98   struct tm gmbuf;
99   int minswest;
100
101   if (!clock)
102     clock = CurrentTime;
103   gm = gmtime(&clock);
104   memcpy(&gmbuf, gm, sizeof(gmbuf));
105   gm = &gmbuf;
106   lt = localtime(&clock);
107
108   /* There is unfortunately no clean portable way to extract time zone
109    * offset information, so do ugly things.
110    */
111   minswest = (gm->tm_hour - lt->tm_hour) * 60 + (gm->tm_min - lt->tm_min);
112   if (lt->tm_yday != gm->tm_yday)
113   {
114     if ((lt->tm_yday > gm->tm_yday && lt->tm_year == gm->tm_year) ||
115         (lt->tm_yday < gm->tm_yday && lt->tm_year != gm->tm_year))
116       minswest -= 24 * 60;
117     else
118       minswest += 24 * 60;
119   }
120
121   plus = (minswest > 0) ? '-' : '+';
122   if (minswest < 0)
123     minswest = -minswest;
124
125   sprintf(buf, "%s %s %d %d -- %02d:%02d %c%02d:%02d",
126       weekdays[lt->tm_wday], months[lt->tm_mon], lt->tm_mday,
127       1900 + lt->tm_year, lt->tm_hour, lt->tm_min,
128       plus, minswest / 60, minswest % 60);
129
130   return buf;
131 }
132
133 /** Like ctime() but with no trailing newline. Also, it takes
134  * the time value as parameter, instead of pointer to it.
135  * @param value Unix time to format.
136  * @return Pointer to a static buffer containing formatted time.
137  */
138 char *myctime(time_t value)
139 {
140   /* Use a secondary buffer in case ctime() would not replace an
141    * overwritten newline.
142    */
143   static char buf[28];
144   char *p;
145
146   strcpy(buf, ctime(&value));
147   if ((p = strchr(buf, '\n')) != NULL)
148     *p = '\0';
149
150   return buf;
151 }
152
153 /** Return the name of the client for various tracking and admin
154  * purposes. The main purpose of this function is to return the
155  * "socket host" name of the client, if that differs from the
156  * advertised name (other than case).  But, this can be used on any
157  * client structure.
158  * @param sptr Client to operate on.
159  * @param showip If non-zero, append [username\@text-ip] to name.
160  * @return Either cli_name(\a sptr) or a static buffer.
161  */
162 const char* get_client_name(const struct Client* sptr, int showip)
163 {
164   static char nbuf[HOSTLEN * 2 + USERLEN + 5];
165
166   if (MyConnect(sptr)) {
167     if (showip)
168       ircd_snprintf(0, nbuf, sizeof(nbuf), "%s[%s@%s]", cli_name(sptr),
169                     IsIdented(sptr) ? cli_username(sptr) : "unknown",
170                     cli_sock_ip(sptr));
171     else
172         return cli_name(sptr);
173     return nbuf;
174   }
175   return cli_name(sptr);
176 }
177
178 /** Set cli_sockhost(cptr) from \a host.
179  * If \a host contains an '@', copy starting after that byte.
180  * Otherwise copy all of \a host.
181  * @param cptr Client to operate on.
182  * @param host hostname or user\@hostname string.
183  */
184 void get_sockhost(struct Client *cptr, char *host)
185 {
186   char *s;
187   if ((s = strchr(host, '@')))
188     s++;
189   else
190     s = host;
191   ircd_strncpy(cli_sockhost(cptr), s, HOSTLEN);
192 }
193
194 /**
195  * Exit one client, local or remote. Assuming for local client that
196  * all dependants already have been removed, and socket is closed.
197  * @param bcptr Client being (s)quitted.
198  * @param comment The QUIT comment to send.
199  */
200 /* Rewritten by Run - 24 sept 94 */
201 static void exit_one_client(struct Client* bcptr, const char* comment)
202 {
203   struct SLink *lp;
204
205   if (cli_serv(bcptr) && cli_serv(bcptr)->client_list)  /* Was SetServerYXX called ? */
206     ClearServerYXX(bcptr);      /* Removes server from server_list[] */
207   if (IsUser(bcptr)) {
208     /*
209      * clear out uping requests
210      */
211     if (IsUPing(bcptr))
212       uping_cancel(bcptr, 0);
213     /*
214      * Stop a running /LIST clean
215      */
216     if (MyUser(bcptr) && cli_listing(bcptr)) {
217       cli_listing(bcptr)->chptr->mode.mode &= ~MODE_LISTED;
218       MyFree(cli_listing(bcptr));
219       cli_listing(bcptr) = NULL;
220     }
221     /*
222      * If a person is on a channel, send a QUIT notice
223      * to every client (person) on the same channel (so
224      * that the client can show the "**signoff" message).
225      * (Note: The notice is to the local clients *only*)
226      */
227     sendcmdto_common_channels_butone(bcptr, CMD_QUIT, NULL, ":%s", comment);
228
229     remove_user_from_all_channels(bcptr);
230
231     /* Clean up invitefield */
232     while ((lp = cli_user(bcptr)->invited))
233       del_invite(bcptr, lp->value.chptr);
234
235     /* Clean up silencefield */
236     while ((lp = cli_user(bcptr)->silence))
237       del_silence(bcptr, lp->value.cp);
238
239     /* Clean up snotice lists */
240     if (MyUser(bcptr))
241       set_snomask(bcptr, ~0, SNO_DEL);
242
243     if (IsInvisible(bcptr))
244       --UserStats.inv_clients;
245     if (IsOper(bcptr))
246       --UserStats.opers;
247     if (MyConnect(bcptr))
248       Count_clientdisconnects(bcptr, UserStats);
249     else {
250       Count_remoteclientquits(UserStats, bcptr);
251     }
252   }
253   else if (IsServer(bcptr))
254   {
255     /* Remove downlink list node of uplink */
256     remove_dlink(&(cli_serv(cli_serv(bcptr)->up))->down, cli_serv(bcptr)->updown);
257     cli_serv(bcptr)->updown = 0;
258
259     if (MyConnect(bcptr))
260       Count_serverdisconnects(UserStats);
261     else
262       Count_remoteserverquits(UserStats);
263   }
264   else if (IsMe(bcptr))
265   {
266     sendto_opmask_butone(0, SNO_OLDSNO, "ERROR: tried to exit me! : %s",
267                          comment);
268     return;                     /* ...must *never* exit self! */
269   }
270   else if (IsUnknown(bcptr) || IsConnecting(bcptr) || IsHandshake(bcptr))
271     Count_unknowndisconnects(UserStats);
272
273   /*
274    * Update IPregistry
275    */
276   if (IsIPChecked(bcptr))
277     IPcheck_disconnect(bcptr);
278
279   /* 
280    * Remove from serv->client_list
281    * NOTE: user is *always* NULL if this is a server
282    */
283   if (cli_user(bcptr)) {
284     assert(!IsServer(bcptr));
285     /* bcptr->user->server->serv->client_list[IndexYXX(bcptr)] = NULL; */
286     RemoveYXXClient(cli_user(bcptr)->server, cli_yxx(bcptr));
287     if (IsIAuthed(bcptr) || cli_iauth(bcptr))
288         iauth_exit_client(bcptr);
289   }
290
291   /* Remove bcptr from the client list */
292 #ifdef DEBUGMODE
293   if (hRemClient(bcptr) != 0)
294     Debug((DEBUG_ERROR, "%p !in tab %s[%s] %p %p %p %d %d %p",
295           bcptr, cli_name(bcptr), cli_from(bcptr) ? cli_sockhost(cli_from(bcptr)) : "??host",
296           cli_from(bcptr), cli_next(bcptr), cli_prev(bcptr), cli_fd(bcptr),
297           cli_status(bcptr), cli_user(bcptr)));
298 #else
299   hRemClient(bcptr);
300 #endif
301   remove_client_from_list(bcptr);
302 }
303
304 /* exit_downlinks - added by Run 25-9-94 */
305 /**
306  * Removes all clients and downlinks (+clients) of any server
307  * QUITs are generated and sent to local users.
308  * @param cptr server that must have all dependents removed
309  * @param sptr source who thought that this was a good idea
310  * @param comment comment sent as sign off message to local clients
311  */
312 static void exit_downlinks(struct Client *cptr, struct Client *sptr, char *comment)
313 {
314   struct Client *acptr;
315   struct DLink *next;
316   struct DLink *lp;
317   struct Client **acptrp;
318   int i;
319
320   /* Run over all its downlinks */
321   for (lp = cli_serv(cptr)->down; lp; lp = next)
322   {
323     next = lp->next;
324     acptr = lp->value.cptr;
325     /* Remove the downlinks and client of the downlink */
326     exit_downlinks(acptr, sptr, comment);
327     /* Remove the downlink itself */
328     exit_one_client(acptr, cli_name(&me));
329   }
330   /* Remove all clients of this server */
331   acptrp = cli_serv(cptr)->client_list;
332   for (i = 0; i <= cli_serv(cptr)->nn_mask; ++acptrp, ++i) {
333     if (*acptrp)
334       exit_one_client(*acptrp, comment);
335   }
336 }
337
338 /* exit_client, rewritten 25-9-94 by Run */
339 /**
340  * Eexits a client of *any* type (user, server, etc)
341  * from this server. Also, this generates all necessary prototol
342  * messages that this exit may cause.
343  *
344  * This function implicitly exits all other clients depending on
345  * this connection.
346  *
347  * For convenience, this function returns a suitable value for
348  * m_funtion return value:
349  *
350  *   CPTR_KILLED     if (cptr == bcptr)
351  *   0                if (cptr != bcptr)
352  *
353  * This function can be called in two ways:
354  * 1) From before or in parse(), exitting the 'cptr', in which case it was
355  *    invoked as exit_client(cptr, cptr, &me,...), causing it to always
356  *    return CPTR_KILLED.
357  * 2) Via parse from a m_function call, in which case it was invoked as
358  *    exit_client(cptr, acptr, sptr, ...). Here 'sptr' is known; the client
359  *    that generated the message in a way that we can assume he already
360  *    did remove acptr from memory himself (or in other cases we don't mind
361  *    because he will be delinked.) Or invoked as:
362  *    exit_client(cptr, acptr/sptr, &me, ...) when WE decide this one should
363  *    be removed.
364  * In general: No generated SQUIT or QUIT should be sent to source link
365  * sptr->from. And CPTR_KILLED should be returned if cptr got removed (too).
366  *
367  * --Run
368  * @param cptr Connection currently being handled by read_message.
369  * @param victim Client being killed.
370  * @param killer Client that made the decision to remove \a victim.
371  * @param comment Reason for the exit.
372  * @return CPTR_KILLED if cptr == bcptr, else 0.
373  */
374 int exit_client(struct Client *cptr,
375     struct Client* victim,
376     struct Client* killer,
377     const char* comment)
378 {
379   struct Client* acptr = 0;
380   struct DLink *dlp;
381   time_t on_for;
382
383   char comment1[HOSTLEN + HOSTLEN + 2];
384   assert(killer);
385   if (MyConnect(victim))
386   {
387     SetFlag(victim, FLAG_CLOSING);
388
389     if (feature_bool(FEAT_CONNEXIT_NOTICES) && IsUser(victim))
390       sendto_opmask_butone(0, SNO_CONNEXIT,
391                            "Client exiting: %s (%s@%s) [%s] [%s] <%s%s>",
392                            cli_name(victim), cli_user(victim)->username,
393                            cli_user(victim)->host, comment,
394                            ircd_ntoa(&cli_ip(victim)),
395                            NumNick(victim) /* two %s's */);
396     update_load();
397
398     on_for = CurrentTime - cli_firsttime(victim);
399
400     if (IsUser(victim))
401       log_write(LS_USER, L_TRACE, 0, "%Tu %i %s@%s %s %s %s%s %s :%s",
402                 cli_firsttime(victim), on_for,
403                 cli_user(victim)->username, cli_sockhost(victim),
404                 ircd_ntoa(&cli_ip(victim)),
405                 IsAccount(victim) ? cli_username(victim) : "0",
406                 NumNick(victim), /* two %s's */
407                 cli_name(victim), cli_info(victim));
408
409     if (victim != cli_from(killer)  /* The source knows already */
410         && IsClient(victim))    /* Not a Ping struct or Log file */
411     {
412       if (IsServer(victim) || IsHandshake(victim))
413         sendcmdto_one(killer, CMD_SQUIT, victim, "%s 0 :%s", cli_name(&me), comment);
414       else if (!IsConnecting(victim)) {
415         if (!IsDead(victim)) {
416           if (IsServer(victim))
417             sendcmdto_one(killer, CMD_ERROR, victim,
418                           ":Closing Link: %s by %s (%s)", cli_name(victim),
419                           cli_name(killer), comment);
420           else
421             sendrawto_one(victim, MSG_ERROR " :Closing Link: %s by %s (%s)",
422                           cli_name(victim), IsServer(killer) ? cli_name(&me) :
423                           cli_name(killer), comment);
424         }
425       }
426       if ((IsServer(victim) || IsHandshake(victim) || IsConnecting(victim)) &&
427           (killer == &me || (IsServer(killer) &&
428           (strncmp(comment, "Leaf-only link", 14) ||
429           strncmp(comment, "Non-Hub link", 12)))))
430       {
431         /*
432          * Note: check user == user needed to make sure we have the same
433          * client
434          */
435         if (cli_serv(victim)->user && *(cli_serv(victim))->by &&
436             (acptr = findNUser(cli_serv(victim)->by))) {
437           if (cli_user(acptr) == cli_serv(victim)->user) {
438             sendcmdto_one(&me, CMD_NOTICE, acptr,
439                           "%C :Link with %s cancelled: %s", acptr,
440                           cli_name(victim), comment);
441           }
442           else {
443             /*
444              * not right client, set by to empty string
445              */
446             acptr = 0;
447             *(cli_serv(victim))->by = '\0';
448           }
449         }
450         if (killer == &me)
451           sendto_opmask_butone(acptr, SNO_OLDSNO, "Link with %s cancelled: %s",
452                                cli_name(victim), comment);
453       }
454     }
455     /*
456      *  Close the Client connection first.
457      */
458     close_connection(victim);
459   }
460
461   if (IsServer(victim))
462   {
463     if (feature_bool(FEAT_HIS_NETSPLIT))
464       strcpy(comment1, "*.net *.split");
465     else
466     {
467       strcpy(comment1, cli_name(cli_serv(victim)->up));
468       strcat(comment1, " ");
469       strcat(comment1, cli_name(victim));
470     }
471
472     if (IsUser(killer))
473       sendto_opmask_butone(killer, SNO_OLDSNO, "%s SQUIT by %s [%s]:",
474                            (cli_user(killer)->server == victim ||
475                             cli_user(killer)->server == cli_serv(victim)->up) ?
476                            "Local" : "Remote",
477                            get_client_name(killer, HIDE_IP),
478                            cli_name(cli_user(killer)->server));
479     else if (killer != &me && cli_serv(victim)->up != killer)
480       sendto_opmask_butone(0, SNO_OLDSNO, "Received SQUIT %s from %s :",
481                            cli_name(victim), IsServer(killer) ? cli_name(killer) :
482                            get_client_name(killer, HIDE_IP));
483     sendto_opmask_butone(0, SNO_NETWORK, "Net break: %C %C (%s)",
484                          cli_serv(victim)->up, victim, comment);
485   }
486
487   /*
488    * First generate the needed protocol for the other server links
489    * except the source:
490    */
491   for (dlp = cli_serv(&me)->down; dlp; dlp = dlp->next) {
492     if (dlp->value.cptr != cli_from(killer) && dlp->value.cptr != victim)
493     {
494       if (IsServer(victim))
495         sendcmdto_one(killer, CMD_SQUIT, dlp->value.cptr, "%s %Tu :%s",
496                       cli_name(victim), cli_serv(victim)->timestamp, comment);
497       else if (IsUser(victim) && !HasFlag(victim, FLAG_KILLED))
498         sendcmdto_one(victim, CMD_QUIT, dlp->value.cptr, ":%s", comment);
499     }
500   }
501   /* Then remove the client structures */
502   if (IsServer(victim))
503     exit_downlinks(victim, killer, comment1);
504   exit_one_client(victim, comment);
505
506   /*
507    *  cptr can only have been killed if it was cptr itself that got killed here,
508    *  because cptr can never have been a dependant of victim    --Run
509    */
510   return (cptr == victim) ? CPTR_KILLED : 0;
511 }
512
513 /**
514  * Exit client with formatted va_list message.
515  * Thin wrapper around exit_client().
516  * @param cptr Connection being processed.
517  * @param bcptr Connection being closed.
518  * @param sptr Connection who asked to close the victim.
519  * @param pattern Format string for message.
520  * @param vl Stdargs argument list.
521  * @return Has a tail call to exit_client().
522  */
523 /* added 25-9-94 by Run */
524 int vexit_client_msg(struct Client *cptr, struct Client *bcptr, struct Client *sptr,
525     const char *pattern, va_list vl)
526 {
527   char msgbuf[1024];
528   ircd_vsnprintf(0, msgbuf, sizeof(msgbuf), pattern, vl);
529   return exit_client(cptr, bcptr, sptr, msgbuf);
530 }
531
532 /**
533  * Exit client with formatted message using a variable-length argument list.
534  * Thin wrapper around exit_client().
535  * @param cptr Connection being processed.
536  * @param bcptr Connection being closed.
537  * @param sptr Connection who asked to close the victim.
538  * @param pattern Format string for message.
539  * @return Has a tail call to exit_client().
540  */
541 int exit_client_msg(struct Client *cptr, struct Client *bcptr,
542     struct Client *sptr, const char *pattern, ...)
543 {
544   va_list vl;
545   char msgbuf[1024];
546
547   va_start(vl, pattern);
548   ircd_vsnprintf(0, msgbuf, sizeof(msgbuf), pattern, vl);
549   va_end(vl);
550
551   return exit_client(cptr, bcptr, sptr, msgbuf);
552 }
553
554 /** Initialize global server statistics. */
555 /* (Kind of pointless since C guarantees it's already zero'ed, but... */
556 void initstats(void)
557 {
558   memset(&ircst, 0, sizeof(ircst));
559 }
560
561 /** Report server statistics to a client.
562  * @param cptr Client who wants statistics.
563  * @param sd StatDesc structure being looked up (unused).
564  * @param param Extra parameter passed by user (unused).
565  */
566 void tstats(struct Client *cptr, const struct StatDesc *sd, char *param)
567 {
568   struct Client *acptr;
569   int i;
570   struct ServerStatistics *sp;
571   struct ServerStatistics tmp;
572
573   sp = &tmp;
574   memcpy(sp, ServerStats, sizeof(struct ServerStatistics));
575   for (i = 0; i < MAXCONNECTIONS; i++)
576   {
577     if (!(acptr = LocalClientArray[i]))
578       continue;
579     if (IsServer(acptr))
580     {
581       sp->is_sbs += cli_sendB(acptr);
582       sp->is_sbr += cli_receiveB(acptr);
583       sp->is_sks += cli_sendK(acptr);
584       sp->is_skr += cli_receiveK(acptr);
585       sp->is_sti += CurrentTime - cli_firsttime(acptr);
586       sp->is_sv++;
587       if (sp->is_sbs > 1023)
588       {
589         sp->is_sks += (sp->is_sbs >> 10);
590         sp->is_sbs &= 0x3ff;
591       }
592       if (sp->is_sbr > 1023)
593       {
594         sp->is_skr += (sp->is_sbr >> 10);
595         sp->is_sbr &= 0x3ff;
596       }
597     }
598     else if (IsUser(acptr))
599     {
600       sp->is_cbs += cli_sendB(acptr);
601       sp->is_cbr += cli_receiveB(acptr);
602       sp->is_cks += cli_sendK(acptr);
603       sp->is_ckr += cli_receiveK(acptr);
604       sp->is_cti += CurrentTime - cli_firsttime(acptr);
605       sp->is_cl++;
606       if (sp->is_cbs > 1023)
607       {
608         sp->is_cks += (sp->is_cbs >> 10);
609         sp->is_cbs &= 0x3ff;
610       }
611       if (sp->is_cbr > 1023)
612       {
613         sp->is_ckr += (sp->is_cbr >> 10);
614         sp->is_cbr &= 0x3ff;
615       }
616     }
617     else if (IsUnknown(acptr))
618       sp->is_ni++;
619   }
620
621   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":accepts %u refused %u",
622              sp->is_ac, sp->is_ref);
623   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
624              ":unknown commands %u prefixes %u", sp->is_unco, sp->is_unpf);
625   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
626              ":nick collisions %u unknown closes %u", sp->is_kill, sp->is_ni);
627   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
628              ":wrong direction %u empty %u", sp->is_wrdi, sp->is_empt);
629   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
630              ":numerics seen %u mode fakes %u", sp->is_num, sp->is_fake);
631   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
632              ":auth successes %u fails %u", sp->is_asuc, sp->is_abad);
633   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":local connections %u",
634              sp->is_loc);
635   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":Client server");
636   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":connected %u %u",
637              sp->is_cl, sp->is_sv);
638   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":bytes sent %u.%uK %u.%uK",
639              sp->is_cks, sp->is_cbs, sp->is_sks, sp->is_sbs);
640   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":bytes recv %u.%uK %u.%uK",
641              sp->is_ckr, sp->is_cbr, sp->is_skr, sp->is_sbr);
642   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":time connected %Tu %Tu",
643              sp->is_cti, sp->is_sti);
644 }