*/
#include "stdinc.h"
-#include "tools.h" /* rb_dlink_node/rb_dlink_list */
#include "class.h" /* report_classes */
#include "client.h" /* Client */
#include "common.h" /* TRUE/FALSE */
#include "numeric.h" /* ERR_xxx */
#include "scache.h" /* list_scache */
#include "send.h" /* sendto_one */
-#include "commio.h" /* highest_fd */
#include "s_conf.h" /* ConfItem */
#include "s_serv.h" /* hunt_server */
#include "s_stats.h" /* tstats */
#include "s_user.h" /* show_opers */
-#include "event.h" /* events */
#include "blacklist.h" /* dnsbl stuff */
-#include "linebuf.h"
#include "parse.h"
#include "modules.h"
#include "hook.h"
static void stats_servlinks(struct Client *);
static void stats_ltrace(struct Client *, int, const char **);
static void stats_ziplinks(struct Client *);
-
+static void stats_comm(struct Client *);
/* This table contains the possible stats items, in order:
* stats letter, function to call, operonly? adminonly?
* case only matters in the stats letter column.. -- fl_
{'D', stats_deny, 1, 0, },
{'e', stats_exempt, 1, 0, },
{'E', stats_events, 1, 1, },
- {'f', rb_dump, 1, 1, },
- {'F', rb_dump, 1, 1, },
+ {'f', stats_comm, 1, 1, },
+ {'F', stats_comm, 1, 1, },
{'g', stats_pending_glines, 1, 0, },
{'G', stats_glines, 1, 0, },
{'h', stats_hubleaf, 0, 0, },
if(MyClient(source_p) && !IsOper(source_p))
{
/* Check the user is actually allowed to do /stats, and isnt flooding */
- if((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
+ if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
{
/* safe enough to give this on a local connect only */
sendto_one(source_p, form_str(RPL_LOAD2HI),
return 0;
}
else
- last_used = CurrentTime;
+ last_used = rb_current_time();
}
if(hunt_server (client_p, source_p, ":%s STATS %s :%s", 2, parc, parv) != HUNTED_ISME)
}}
+static void
+stats_events_cb(char *str, void *ptr)
+{
+ sendto_one_numeric(ptr, RPL_STATSDEBUG, "E :%s", str);
+}
+
static void
stats_events (struct Client *source_p)
{
- show_events (source_p);
+ rb_dump_events(stats_events_cb, source_p);
+ send_pop_queue(source_p);
}
/* stats_pending_glines()
if(0 == secs)
secs = 1;
- rup = (CurrentTime - startup_time) * hzz;
+ rup = (rb_current_time() - startup_time) * hzz;
if(0 == rup)
rup = 1;
{
time_t now;
- now = CurrentTime - startup_time;
+ now = rb_current_time() - startup_time;
sendto_one_numeric(source_p, RPL_STATSUPTIME,
form_str (RPL_STATSUPTIME),
now / 86400, (now / 3600) % 24,
target_p = ptr->data;
j++;
- seconds = CurrentTime - target_p->localClient->firsttime;
+ seconds = rb_current_time() - target_p->localClient->firsttime;
days = (int) (seconds / 86400);
seconds %= 86400;
"Connected: %d day%s, %d:%02d:%02d",
target_p->name,
(target_p->serv->by[0] ? target_p->serv->by : "Remote."),
- (int) (CurrentTime - target_p->localClient->lasttime),
- (int) linebuf_len (&target_p->localClient->buf_sendq),
+ (int) (rb_current_time() - target_p->localClient->lasttime),
+ (int) rb_linebuf_len (&target_p->localClient->buf_sendq),
days, (days == 1) ? "" : "s", hours, minutes,
(int) seconds);
}
sendto_one(source_p, Sformat,
get_id(&me, source_p), RPL_STATSLINKINFO, get_id(source_p, source_p),
get_server_name(target_p, SHOW_IP),
- (int) linebuf_len (&target_p->localClient->buf_sendq),
+ (int) rb_linebuf_len (&target_p->localClient->buf_sendq),
(int) target_p->localClient->sendM,
(int) target_p->localClient->sendK,
(int) target_p->localClient->receiveM,
(int) target_p->localClient->receiveK,
- CurrentTime - target_p->localClient->firsttime,
- (CurrentTime > target_p->localClient->lasttime) ?
- (CurrentTime - target_p->localClient->lasttime) : 0,
+ rb_current_time() - target_p->localClient->firsttime,
+ (rb_current_time() > target_p->localClient->lasttime) ?
+ (rb_current_time() - target_p->localClient->lasttime) : 0,
IsOper (source_p) ? show_capabilities (target_p) : "TS");
}
"? :Recv total : %7.2f %s",
_GMKv (receiveK), _GMKs (receiveK));
- uptime = (CurrentTime - startup_time);
+ uptime = (rb_current_time() - startup_time);
sendto_one_numeric(source_p, RPL_STATSDEBUG,
"? :Server send: %7.2f %s (%4.1f K/s)",
{
sendto_one_numeric(source_p, RPL_STATSLINKINFO, Lformat,
get_server_name(target_p, SHOW_IP),
- (int) linebuf_len(&target_p->localClient->buf_sendq),
+ (int) rb_linebuf_len(&target_p->localClient->buf_sendq),
(int) target_p->localClient->sendM,
(int) target_p->localClient->sendK,
(int) target_p->localClient->receiveM,
(int) target_p->localClient->receiveK,
- CurrentTime - target_p->localClient->firsttime,
- (CurrentTime > target_p->localClient->lasttime) ?
- (CurrentTime - target_p->localClient->lasttime) : 0,
+ rb_current_time() - target_p->localClient->firsttime,
+ (rb_current_time() > target_p->localClient->lasttime) ?
+ (rb_current_time() - target_p->localClient->lasttime) : 0,
IsOper(source_p) ? show_capabilities(target_p) : "-");
}
get_client_name(target_p, SHOW_IP) :
get_client_name(target_p, HIDE_IP)) :
get_client_name(target_p, MASK_IP),
- (int) linebuf_len(&target_p->localClient->buf_sendq),
+ (int) rb_linebuf_len(&target_p->localClient->buf_sendq),
(int) target_p->localClient->sendM,
(int) target_p->localClient->sendK,
(int) target_p->localClient->receiveM,
(int) target_p->localClient->receiveK,
- CurrentTime - target_p->localClient->firsttime,
- (CurrentTime > target_p->localClient->lasttime) ?
- (CurrentTime - target_p->localClient->lasttime) : 0,
+ rb_current_time() - target_p->localClient->firsttime,
+ (rb_current_time() > target_p->localClient->lasttime) ?
+ (rb_current_time() - target_p->localClient->lasttime) : 0,
"-");
}
}
+static void
+rb_dump_fd_callback(int fd, const char *desc, void *data)
+{
+ struct Client *source_p = data;
+ sendto_one_numeric(source_p, RPL_STATSDEBUG, "F :fd %-3d desc '%s'", fd, desc);
+}
+
+static void
+stats_comm(struct Client *source_p)
+{
+ rb_dump_fd(rb_dump_fd_callback, source_p);
+ send_pop_queue(source_p);
+}
+
/*
* stats_spy
*