Author: Alex Badea <vampire@p16.pub.ro>
authorAlex Badea <vampire@p16.pub.ro>
Mon, 15 Apr 2002 20:35:49 +0000 (20:35 +0000)
committerAlex Badea <vampire@p16.pub.ro>
Mon, 15 Apr 2002 20:35:49 +0000 (20:35 +0000)
Log message:

Added verbose server reporting (/stats v or /stats V for
machine-readable format) (bugzilla bug 52)

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@739 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
include/numeric.h
ircd/m_stats.c
ircd/s_err.c
ircd/s_stats.c

index b9bbf99a38180c1bb0b268020f6c49d840f4646c..4efa31ab74e1d503a5aa049e7650bdbd7e99d32f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-04-15  Alex Badea  <vampire@p16.pub.ro>
+
+       * ircd/m_stats.c: added verbose server reporting (/stats v
+       or /stats V for machine-readable format) (bugzilla bug 52)
+
+       * include/numeric.h: added RPL_STATSVERBOSE 236
+
+       * ircd/s_err.c: added RPL_STATSVERBOSE
+
+       * ircd/s_stats.c: added help for stats 'v'
+
 2002-04-15  Alex Badea  <vampire@p16.pub.ro>
 
        * ircd/class.c (get_client_class): fixed typo which caused
index f4c2f484024402485d1895a09817e6a8b9077579..ebbb45fab57a1507c728dd2fa8f1867dc9aed2c5 100644 (file)
@@ -120,6 +120,7 @@ extern const struct Numeric* get_error_numeric(int err);
 #define RPL_SERVLIST         234       /* unused */
 #define RPL_SERVLISTEND      235       /* unused */
 
+#define RPL_STATSVERBOSE     236        /* Undernet verbose server list */
 #define RPL_STATSENGINE      237       /* Undernet engine name */
 #define RPL_STATSFLINE       238       /* Undernet feature lines */
 /*      RPL_STATSIAUTH       239           IRCnet extension */
index cad559a6fbd4046d7dc2c14cd1c1dfe113df6017..4622b12da026e4aa68828bc64247179750b3a3ac 100644 (file)
@@ -169,6 +169,39 @@ int report_klines(struct Client* sptr, char* mask, int limit_query)
   return 1;
 }
 
+static int report_servers_verbose(struct Client *sptr, char stat)
+{
+  struct Client *acptr;
+  int i;
+
+  /* lowercase 'v' is for human-readable,
+   * uppercase 'V' is for machine-readable */
+  if (stat == 'v')
+    send_reply(sptr, SND_EXPLICIT | RPL_STATSVERBOSE,
+              "%-20s Burst Hops Numeric   Lag Clients/Max Proto "
+              "%-10s :Info", "Servername", "LinkTS");
+  for (i = 0; i <= HighestFd; i++) {
+    if (!(acptr = LocalClientArray[i]) || !IsServer(acptr))
+      continue;
+    send_reply(sptr, SND_EXPLICIT | RPL_STATSVERBOSE, stat == 'v' ?
+              "%-20s %c%c    %4i %s %-4i %5i %5i %5i P%-2i   %Tu :%s" :
+              "%s %c%c %i %s %i %i %i %i P%i %Tu :%s",
+              cli_name(acptr),
+              IsBurst(acptr) ? 'B' : '-',
+              IsBurstAck(acptr) ? 'A' : '-',
+              cli_hopcount(acptr),
+              NumServ(acptr),
+              base64toint(cli_yxx(acptr)),
+              cli_serv(acptr)->lag,
+              cli_serv(acptr)->clients,
+              cli_serv(acptr)->nn_mask,
+              cli_serv(acptr)->prot,
+              cli_serv(acptr)->timestamp,
+              cli_info(acptr));
+  }
+  return 0;
+}
+
 
 /*
  * m_stats - generic message handler
@@ -731,6 +764,10 @@ int ms_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       send_reply(sptr, RPL_STATSCONN, max_connection_count, max_client_count);
       break;
     }
+    case 'V':
+    case 'v':
+      report_servers_verbose(sptr, stat);
+      break;
     case 'W':
     case 'w':
       calc_load(sptr);
@@ -959,6 +996,10 @@ int mo_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       send_reply(sptr, RPL_STATSCONN, max_connection_count, max_client_count);
       break;
     }
+    case 'V':
+    case 'v':
+      report_servers_verbose(sptr, stat);
+      break;
     case 'W':
     case 'w':
       calc_load(sptr);
@@ -978,6 +1019,7 @@ int mo_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     case 'z':
       count_memory(sptr, parv[0]);
       break;
+
     default:
       stat = '*';
       while (*infotext)
index 0d91dc659ac3c9ec05bda96c010716b69c78d570..585cdfef3b63dafb8f9c31484732f66506d08e54 100644 (file)
@@ -504,7 +504,7 @@ static Numeric replyTable[] = {
 /* 235 */
   { RPL_SERVLISTEND, 0, "235" },
 /* 236 */
-  { 0 },
+  { RPL_STATSVERBOSE, "V :Sent as explicit", "236" },
 /* 237 */
   { RPL_STATSENGINE, "%s :Event loop engine", "237" },
 /* 238 */
index 4b07c81dffe18d0dbf93d855560437c2be331254..4ea5094b627c2803589d27e06a33025d59b634c5 100644 (file)
@@ -77,6 +77,7 @@ const char *statsinfo[] = {
     "f - Feature settings.",
     "m - Message usage information.",
     "t - Local connection statistics (Total SND/RCV, etc).", 
+    "v - Server list with verbose information.",
     "w - Userload statistics.",
     "M - Memory allocation & leak monitoring.", 
     "z - Memory/Structure allocation information.",