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