41 |
|
#include "s_conf.h" /* AccessItem, report_configured_links */ |
42 |
|
#include "s_misc.h" /* serv_info */ |
43 |
|
#include "s_serv.h" /* hunt_server */ |
44 |
– |
#include "s_stats.h" /* tstats */ |
44 |
|
#include "s_user.h" /* show_opers */ |
45 |
|
#include "event.h" /* events */ |
46 |
|
#include "dbuf.h" |
1125 |
|
static void |
1126 |
|
stats_tstats(struct Client *source_p) |
1127 |
|
{ |
1128 |
< |
tstats(source_p); |
1128 |
> |
const struct Client *target_p = NULL; |
1129 |
> |
const dlink_node *ptr = NULL; |
1130 |
> |
struct ServerStatistics *sp; |
1131 |
> |
struct ServerStatistics tmp; |
1132 |
> |
|
1133 |
> |
sp = &tmp; |
1134 |
> |
memcpy(sp, &ServerStats, sizeof(struct ServerStatistics)); |
1135 |
> |
|
1136 |
> |
/* |
1137 |
> |
* must use the += operator. is_sv is not the number of currently |
1138 |
> |
* active server connections. Note the incrementation in |
1139 |
> |
* s_bsd.c:close_connection. |
1140 |
> |
*/ |
1141 |
> |
sp->is_sv += dlink_list_length(&serv_list); |
1142 |
> |
|
1143 |
> |
DLINK_FOREACH(ptr, serv_list.head) |
1144 |
> |
{ |
1145 |
> |
target_p = ptr->data; |
1146 |
> |
|
1147 |
> |
sp->is_sbs += target_p->localClient->send.bytes; |
1148 |
> |
sp->is_sbr += target_p->localClient->recv.bytes; |
1149 |
> |
sp->is_sti += CurrentTime - target_p->firsttime; |
1150 |
> |
} |
1151 |
> |
|
1152 |
> |
sp->is_cl += dlink_list_length(&local_client_list); |
1153 |
> |
|
1154 |
> |
DLINK_FOREACH(ptr, local_client_list.head) |
1155 |
> |
{ |
1156 |
> |
target_p = ptr->data; |
1157 |
> |
|
1158 |
> |
sp->is_cbs += target_p->localClient->send.bytes; |
1159 |
> |
sp->is_cbr += target_p->localClient->recv.bytes; |
1160 |
> |
sp->is_cti += CurrentTime - target_p->firsttime; |
1161 |
> |
} |
1162 |
> |
|
1163 |
> |
sp->is_ni += dlink_list_length(&unknown_list); |
1164 |
> |
|
1165 |
> |
sendto_one(source_p, ":%s %d %s T :accepts %u refused %u", |
1166 |
> |
me.name, RPL_STATSDEBUG, source_p->name, sp->is_ac, sp->is_ref); |
1167 |
> |
sendto_one(source_p, ":%s %d %s T :unknown commands %u prefixes %u", |
1168 |
> |
me.name, RPL_STATSDEBUG, source_p->name, sp->is_unco, sp->is_unpf); |
1169 |
> |
sendto_one(source_p, ":%s %d %s T :nick collisions %u unknown closes %u", |
1170 |
> |
me.name, RPL_STATSDEBUG, source_p->name, sp->is_kill, sp->is_ni); |
1171 |
> |
sendto_one(source_p, ":%s %d %s T :wrong direction %u empty %u", |
1172 |
> |
me.name, RPL_STATSDEBUG, source_p->name, sp->is_wrdi, sp->is_empt); |
1173 |
> |
sendto_one(source_p, ":%s %d %s T :numerics seen %u", |
1174 |
> |
me.name, RPL_STATSDEBUG, source_p->name, sp->is_num); |
1175 |
> |
sendto_one(source_p, ":%s %d %s T :auth successes %u fails %u", |
1176 |
> |
me.name, RPL_STATSDEBUG, source_p->name, sp->is_asuc, sp->is_abad); |
1177 |
> |
sendto_one(source_p, ":%s %d %s T :Client Server", |
1178 |
> |
me.name, RPL_STATSDEBUG, source_p->name); |
1179 |
> |
|
1180 |
> |
sendto_one(source_p, ":%s %d %s T :connected %u %u", |
1181 |
> |
me.name, RPL_STATSDEBUG, source_p->name, |
1182 |
> |
(unsigned int)sp->is_cl, |
1183 |
> |
(unsigned int)sp->is_sv); |
1184 |
> |
sendto_one(source_p, ":%s %d %s T :bytes sent %llu %llu", |
1185 |
> |
me.name, RPL_STATSDEBUG, source_p->name, |
1186 |
> |
sp->is_cbs, sp->is_sbs); |
1187 |
> |
sendto_one(source_p, ":%s %d %s T :bytes recv %llu %llu", |
1188 |
> |
me.name, RPL_STATSDEBUG, source_p->name, |
1189 |
> |
sp->is_cbr, sp->is_sbr); |
1190 |
> |
sendto_one(source_p, ":%s %d %s T :time connected %u %u", |
1191 |
> |
me.name, RPL_STATSDEBUG, source_p->name, |
1192 |
> |
(unsigned int)sp->is_cti, |
1193 |
> |
(unsigned int)sp->is_sti); |
1194 |
|
} |
1195 |
|
|
1196 |
|
static void |