m_stats: use macros to clean up generating the stats table
This commit is contained in:
parent
999c42bad8
commit
95b0324658
1 changed files with 51 additions and 48 deletions
|
@ -131,6 +131,9 @@ static void stats_ziplinks(struct Client *);
|
||||||
static void stats_comm(struct Client *);
|
static void stats_comm(struct Client *);
|
||||||
static void stats_capability(struct Client *);
|
static void stats_capability(struct Client *);
|
||||||
|
|
||||||
|
#define HANDLER_NORM(fn, oper, admin) { { .handler = fn }, false, oper, admin }
|
||||||
|
#define HANDLER_PARV(fn, oper, admin) { { .handler_parv = fn }, true, oper, admin }
|
||||||
|
|
||||||
/* This table contains the possible stats items, in order:
|
/* This table contains the possible stats items, in order:
|
||||||
* stats letter, function to call, operonly? adminonly? --fl_
|
* stats letter, function to call, operonly? adminonly? --fl_
|
||||||
*
|
*
|
||||||
|
@ -139,54 +142,54 @@ static void stats_capability(struct Client *);
|
||||||
* --Elizafox
|
* --Elizafox
|
||||||
*/
|
*/
|
||||||
static struct stats_cmd stats_cmd_table[256] = {
|
static struct stats_cmd stats_cmd_table[256] = {
|
||||||
/* letter handler/handler_parv parv oper admin */
|
/* letter handler oper admin */
|
||||||
['a'] = { { stats_dns_servers }, false, true, true, },
|
['a'] = HANDLER_NORM(stats_dns_servers, true, true),
|
||||||
['A'] = { { stats_dns_servers }, false, true, true, },
|
['A'] = HANDLER_NORM(stats_dns_servers, true, true),
|
||||||
['b'] = { { stats_delay }, false, true, true, },
|
['b'] = HANDLER_NORM(stats_delay, true, true),
|
||||||
['B'] = { { stats_hash }, false, true, true, },
|
['B'] = HANDLER_NORM(stats_hash, true, true),
|
||||||
['c'] = { { stats_connect }, false, false, false, },
|
['c'] = HANDLER_NORM(stats_connect, false, false),
|
||||||
['C'] = { { stats_capability }, false, true, false, },
|
['C'] = HANDLER_NORM(stats_capability, true, false),
|
||||||
['d'] = { { stats_tdeny }, false, true, false, },
|
['d'] = HANDLER_NORM(stats_tdeny, true, false),
|
||||||
['D'] = { { stats_deny }, false, true, false, },
|
['D'] = HANDLER_NORM(stats_deny, true, false),
|
||||||
['e'] = { { stats_exempt }, false, true, false, },
|
['e'] = HANDLER_NORM(stats_exempt, true, false),
|
||||||
['E'] = { { stats_events }, false, true, true, },
|
['E'] = HANDLER_NORM(stats_events, true, true),
|
||||||
['f'] = { { stats_comm }, false, true, true, },
|
['f'] = HANDLER_NORM(stats_comm, true, true),
|
||||||
['F'] = { { stats_comm }, false, true, true, },
|
['F'] = HANDLER_NORM(stats_comm, true, true),
|
||||||
['g'] = { { stats_prop_klines }, false, true, false, },
|
['g'] = HANDLER_NORM(stats_prop_klines, true, false),
|
||||||
['h'] = { { stats_hubleaf }, false, false, false, },
|
['h'] = HANDLER_NORM(stats_hubleaf, false, false),
|
||||||
['H'] = { { stats_hubleaf }, false, false, false, },
|
['H'] = HANDLER_NORM(stats_hubleaf, false, false),
|
||||||
['i'] = { { stats_auth }, false, false, false, },
|
['i'] = HANDLER_NORM(stats_auth, false, false),
|
||||||
['I'] = { { stats_auth }, false, false, false, },
|
['I'] = HANDLER_NORM(stats_auth, false, false),
|
||||||
['k'] = { { stats_tklines }, false, false, false, },
|
['k'] = HANDLER_NORM(stats_tklines, false, false),
|
||||||
['K'] = { { stats_klines }, false, false, false, },
|
['K'] = HANDLER_NORM(stats_klines, false, false),
|
||||||
['l'] = { { .handler_parv = stats_ltrace }, true, false, false, },
|
['l'] = HANDLER_PARV(stats_ltrace, false, false),
|
||||||
['L'] = { { .handler_parv = stats_ltrace }, true, false, false, },
|
['L'] = HANDLER_PARV(stats_ltrace, false, false),
|
||||||
['m'] = { { stats_messages }, false, false, false, },
|
['m'] = HANDLER_NORM(stats_messages, false, false),
|
||||||
['M'] = { { stats_messages }, false, false, false, },
|
['M'] = HANDLER_NORM(stats_messages, false, false),
|
||||||
['n'] = { { stats_dnsbl }, false, false, false, },
|
['n'] = HANDLER_NORM(stats_dnsbl, false, false),
|
||||||
['o'] = { { stats_oper }, false, false, false, },
|
['o'] = HANDLER_NORM(stats_oper, false, false),
|
||||||
['O'] = { { stats_privset }, false, true, false, },
|
['O'] = HANDLER_NORM(stats_privset, true, false),
|
||||||
['p'] = { { stats_operedup }, false, false, false, },
|
['p'] = HANDLER_NORM(stats_operedup, false, false),
|
||||||
['P'] = { { stats_ports }, false, false, false, },
|
['P'] = HANDLER_NORM(stats_ports, false, false),
|
||||||
['q'] = { { stats_tresv }, false, true, false, },
|
['q'] = HANDLER_NORM(stats_tresv, true, false),
|
||||||
['Q'] = { { stats_resv }, false, true, false, },
|
['Q'] = HANDLER_NORM(stats_resv, true, false),
|
||||||
['r'] = { { stats_usage }, false, true, false, },
|
['r'] = HANDLER_NORM(stats_usage, true, false),
|
||||||
['R'] = { { stats_usage }, false, true, false, },
|
['R'] = HANDLER_NORM(stats_usage, true, false),
|
||||||
['s'] = { { stats_ssld }, false, true, true, },
|
['s'] = HANDLER_NORM(stats_ssld, true, true),
|
||||||
['S'] = { { stats_ssld }, false, true, true, },
|
['S'] = HANDLER_NORM(stats_ssld, true, true),
|
||||||
['t'] = { { stats_tstats }, false, true, false, },
|
['t'] = HANDLER_NORM(stats_tstats, true, false),
|
||||||
['T'] = { { stats_tstats }, false, true, false, },
|
['T'] = HANDLER_NORM(stats_tstats, true, false),
|
||||||
['u'] = { { stats_uptime }, false, false, false, },
|
['u'] = HANDLER_NORM(stats_uptime, false, false),
|
||||||
['U'] = { { stats_shared }, false, true, false, },
|
['U'] = HANDLER_NORM(stats_shared, true, false),
|
||||||
['v'] = { { stats_servers }, false, false, false, },
|
['v'] = HANDLER_NORM(stats_servers, false, false),
|
||||||
['V'] = { { stats_servers }, false, false, false, },
|
['V'] = HANDLER_NORM(stats_servers, false, false),
|
||||||
['x'] = { { stats_tgecos }, false, true, false, },
|
['x'] = HANDLER_NORM(stats_tgecos, true, false),
|
||||||
['X'] = { { stats_gecos }, false, true, false, },
|
['X'] = HANDLER_NORM(stats_gecos, true, false),
|
||||||
['y'] = { { stats_class }, false, false, false, },
|
['y'] = HANDLER_NORM(stats_class, false, false),
|
||||||
['Y'] = { { stats_class }, false, false, false, },
|
['Y'] = HANDLER_NORM(stats_class, false, false),
|
||||||
['z'] = { { stats_memory }, false, true, false, },
|
['z'] = HANDLER_NORM(stats_memory, true, false),
|
||||||
['Z'] = { { stats_ziplinks }, false, true, false, },
|
['Z'] = HANDLER_NORM(stats_ziplinks, true, false),
|
||||||
['?'] = { { stats_servlinks }, false, false, false, },
|
['?'] = HANDLER_NORM(stats_servlinks, false, false),
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue