IPv6 support (hopefully with fewer future transition pains)
[ircu2.10.12-pk.git] / ircd / s_stats.c
index 34eb34a16e23e442784d8a9f4bfb5b1224e1dc79..89ef883446b68bb879f4bd579d8bb7a8f5c0a21c 100644 (file)
@@ -30,6 +30,7 @@
 #include "ircd_chattr.h"
 #include "ircd_events.h"
 #include "ircd_features.h"
+#include "ircd_crypt.h"
 #include "ircd_log.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
@@ -41,6 +42,7 @@
 #include "msgq.h"
 #include "numeric.h"
 #include "numnicks.h"
+#include "res.h"
 #include "s_bsd.h"
 #include "s_conf.h"
 #include "s_debug.h"
@@ -74,7 +76,6 @@ static unsigned int report_array[17][3] = {
   {CONF_LEAF, RPL_STATSLLINE, 'L'},
   {CONF_OPERATOR, RPL_STATSOLINE, 'O'},
   {CONF_HUB, RPL_STATSHLINE, 'H'},
-  {CONF_LOCOP, RPL_STATSOLINE, 'o'},
   {CONF_UWORLD, RPL_STATSULINE, 'U'},
   {0, 0}
 };
@@ -105,7 +106,7 @@ stats_configured_links(struct Client *sptr, struct StatDesc* sd, int stat,
       host = BadPtr(tmp->host) ? null : tmp->host;
       pass = BadPtr(tmp->passwd) ? null : tmp->passwd;
       name = BadPtr(tmp->name) ? null : tmp->name;
-      port = tmp->port;
+      port = tmp->address.port;
       /*
        * On K line the passwd contents can be
        * displayed on STATS reply.    -Vesa
@@ -180,7 +181,7 @@ stats_access(struct Client *to, struct StatDesc *sd, int stat, char *param)
                    !mmatch(param, aconf->name))))
     {
       send_reply(to, RPL_STATSILINE, 'I', aconf->host, aconf->name,
-                 aconf->port, get_conf_class(aconf));
+                 aconf->address.port, get_conf_class(aconf));
       if (--count == 0)
         break;
     }
@@ -298,6 +299,39 @@ stats_links(struct Client* sptr, struct StatDesc* sd, int stat, char* name)
     }
 }
 
+/* hopefuly this will be where we'll spit out info about loaded modules */
+static void
+stats_modules(struct Client* to, struct StatDesc* sd, int stat, char* param)
+{
+crypt_mechs_t* mechs;
+
+  send_reply(to, SND_EXPLICIT | RPL_STATSLLINE, 
+   "Module  Description      Entry Point");
+
+ /* atm the only "modules" we have are the crypto mechanisms,
+    eventualy they'll be part of a global dl module list, for now
+    i'll just output data about them -- hikari */
+
+ if(crypt_mechs_root == NULL)
+  return;
+
+ mechs = crypt_mechs_root->next;
+
+ for(;;)
+ {
+  if(mechs == NULL)
+   return;
+
+  send_reply(to, SND_EXPLICIT | RPL_STATSLLINE, 
+   "%s  %s     0x%X", 
+   mechs->mech->shortname, mechs->mech->description, 
+   mechs->mech->crypt_function);
+
+  mechs = mechs->next;
+ }
+
+}
+
 static void
 stats_commands(struct Client* to, struct StatDesc* sd, int stat, char* param)
 {
@@ -421,6 +455,9 @@ stats_help(struct Client* to, struct StatDesc* sd, int stat, char* param)
  * stats.  Struct StatDesc is defined in s_stats.h.
  */
 struct StatDesc statsinfo[] = {
+  { 'a', STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_a,
+    report_dns_servers, 0,
+    "DNS servers." },
   { 'c', STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_c,
     stats_configured_links, CONF_SERVER,
     "Remote server connection lines." },
@@ -448,9 +485,14 @@ struct StatDesc statsinfo[] = {
   { 'k', (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_k,
     stats_klines, 0,
     "Local bans (K-Lines)." },
-  { 'l', (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_l,
+  { 'l', (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM | STAT_FLAG_CASESENS), 
+    FEAT_HIS_STATS_l,
     stats_links, 0,
     "Current connections information." },
+  { 'L', (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM | STAT_FLAG_CASESENS), 
+    FEAT_HIS_STATS_L,
+    stats_modules, 0,
+    "Dynamicly loaded modules." },
 #if 0
   { 'M', (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_M,
     stats_memtotal, 0,
@@ -460,7 +502,7 @@ struct StatDesc statsinfo[] = {
     stats_commands, 0,
     "Message usage information." },
   { 'o', STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_o,
-    stats_configured_links, CONF_OPS,
+    stats_configured_links, CONF_OPERATOR,
     "Operator information." },
   { 'p', (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_p,
     show_ports, 0,