#include "reject.h"
#include "whowas.h"
#include "irc_radixtree.h"
+#include "sslproc.h"
-static int m_stats (struct Client *, struct Client *, int, const char **);
+static int m_stats (struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message stats_msgtab = {
"STATS", 0, 0, 0, MFLG_SLOW,
static void stats_l_client(struct Client *source_p, struct Client *target_p,
char statchar);
-static void stats_spy(struct Client *, char, const char *);
+static int stats_spy(struct Client *, char, const char *);
static void stats_p_spy(struct Client *);
/* Heres our struct for the stats table */
static void stats_ports(struct Client *);
static void stats_tresv(struct Client *);
static void stats_resv(struct Client *);
+static void stats_ssld(struct Client *);
static void stats_usage(struct Client *);
static void stats_tstats(struct Client *);
static void stats_uptime(struct Client *);
{'Q', stats_resv, 1, 0, },
{'r', stats_usage, 1, 0, },
{'R', stats_usage, 1, 0, },
+ {'s', stats_ssld, 1, 1, },
+ {'S', stats_ssld, 1, 1, },
{'t', stats_tstats, 1, 0, },
{'T', stats_tstats, 1, 0, },
{'u', stats_uptime, 0, 0, },
* if found execute it.
*/
static int
-m_stats(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+m_stats(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
static time_t last_used = 0;
int i;
char statchar;
+ int did_stats = 0;
statchar = parv[1][0];
return 0;
if((statchar != 'L') && (statchar != 'l'))
- stats_spy(source_p, statchar, NULL);
+ did_stats = stats_spy(source_p, statchar, NULL);
+
+ /* if did_stats is true, a module grabbed this STATS request */
+ if (did_stats)
+ goto stats_out;
for (i = 0; stats_cmd_table[i].letter; i++)
{
}
}
+stats_out:
/* Send the end of stats notice, and the stats_spy */
sendto_one_numeric(source_p, RPL_ENDOFSTATS,
form_str(RPL_ENDOFSTATS), statchar);
static void
stats_hash(struct Client *source_p)
{
- hash_stats(source_p);
+ sendto_one_numeric(source_p, RPL_STATSDEBUG, "B :%-30s %-15s %-10s %-10s %-10s %-10s",
+ "NAME", "TYPE", "OBJECTS", "DEPTH SUM", "AVG DEPTH", "MAX DEPTH");
- sendto_one_numeric(source_p, RPL_STATSDEBUG, "B :Dictionary stats:");
irc_dictionary_stats_walk(stats_hash_cb, source_p);
-
- sendto_one_numeric(source_p, RPL_STATSDEBUG, "B :Radix tree stats:");
irc_radixtree_stats_walk(stats_hash_cb, source_p);
}
}
}
+static void
+stats_ssld_foreach(void *data, pid_t pid, int cli_count, enum ssld_status status)
+{
+ struct Client *source_p = data;
+
+ sendto_one_numeric(source_p, RPL_STATSDEBUG,
+ "S :%u %c %u",
+ pid,
+ status == SSLD_DEAD ? 'D' : (status == SSLD_SHUTDOWN ? 'S' : 'A'),
+ cli_count);
+}
+
+static void
+stats_ssld(struct Client *source_p)
+{
+#if 0
+ ssld_foreach_info(stats_ssld_foreach, source_p);
+#endif
+}
+
static void
stats_usage (struct Client *source_p)
{
{ SHARED_TDLINE, 'd' },
{ SHARED_PDLINE, 'D' },
{ SHARED_UNDLINE, 'E' },
+ { SHARED_GRANT, 'G' },
+ { SHARED_DIE, 'I' },
{ 0, '\0'}
};
size_t total_memory = 0;
- count_whowas_memory(&ww, &wwm);
+ whowas_memory_usage(&ww, &wwm);
RB_DLINK_FOREACH(ptr, global_client_list.head)
{
* any damage with stats requests now anyway. So, why show them?
* -Dianora
*/
-static void
+static int
stats_spy(struct Client *source_p, char statchar, const char *name)
{
hook_data_int data;
data.client = source_p;
data.arg1 = name;
data.arg2 = (int) statchar;
+ data.result = 0;
call_hook(doing_stats_hook, &data);
+
+ return data.result;
}
/* stats_p_spy()