u_int64_t sent, received;
entry_t *entry;
- child_sa->get_usestats(child_sa, FALSE, NULL, &sent);
- child_sa->get_usestats(child_sa, TRUE, NULL, &received);
+ child_sa->get_usestats(child_sa, FALSE, NULL, &sent, NULL);
+ child_sa->get_usestats(child_sa, TRUE, NULL, &received, NULL);
this->mutex->lock(this->mutex);
entry = this->sessions->get(this->sessions,
}
}
- child_sa->get_usestats(child_sa, TRUE, &use_in, &bytes_in);
+ child_sa->get_usestats(child_sa, TRUE, &use_in, &bytes_in, NULL);
fprintf(out, ", %" PRIu64 " bytes_i", bytes_in);
if (use_in)
{
fprintf(out, " (%" PRIu64 "s ago)", (u_int64_t)(now - use_in));
}
- child_sa->get_usestats(child_sa, FALSE, &use_out, &bytes_out);
+ child_sa->get_usestats(child_sa, FALSE, &use_out, &bytes_out, NULL);
fprintf(out, ", %" PRIu64 " bytes_o", bytes_out);
if (use_out)
{
return &this->public;
}
-
enumerator = ike_sa->create_child_sa_enumerator(ike_sa);
while (enumerator->enumerate(enumerator, &child_sa))
{
- child_sa->get_usestats(child_sa, TRUE, ¤t, NULL);
+ child_sa->get_usestats(child_sa, TRUE, ¤t, NULL, NULL);
use_time = max(use_time, current);
}
enumerator->destroy(enumerator);
{
time_t in, out, diff;
- child_sa->get_usestats(child_sa, TRUE, &in, NULL);
- child_sa->get_usestats(child_sa, FALSE, &out, NULL);
+ child_sa->get_usestats(child_sa, TRUE, &in, NULL, NULL);
+ child_sa->get_usestats(child_sa, FALSE, &out, NULL, NULL);
diff = time_monotonic(NULL) - max(in, out);
return &this->public;
}
-
}
METHOD(child_sa_t, get_usestats, void,
- private_child_sa_t *this, bool inbound, time_t *time, u_int64_t *bytes)
+ private_child_sa_t *this, bool inbound,
+ time_t *time, u_int64_t *bytes, u_int64_t *packets)
{
if (update_usebytes(this, inbound) != FAILED)
{
{
*bytes = inbound ? this->my_usebytes : this->other_usebytes;
}
+ if (packets)
+ {
+ *packets = inbound ? this->my_usepackets : this->other_usepackets;
+ }
}
METHOD(child_sa_t, get_mark, mark_t,
* @param inbound TRUE for inbound traffic, FALSE for outbound
* @param[out] time time of last use in seconds (NULL to ignore)
* @param[out] bytes number of processed bytes (NULL to ignore)
+ * @param[out] packets number of processed packets (NULL to ignore)
*/
void (*get_usestats)(child_sa_t *this, bool inbound, time_t *time,
- u_int64_t *bytes);
+ u_int64_t *bytes, u_int64_t *packets);
/**
* Get the mark used with this CHILD_SA.
enumerator = this->child_sas->create_enumerator(this->child_sas);
while (enumerator->enumerate(enumerator, &child_sa))
{
- child_sa->get_usestats(child_sa, inbound, ¤t, NULL);
+ child_sa->get_usestats(child_sa, inbound, ¤t, NULL, NULL);
use_time = max(use_time, current);
}
enumerator->destroy(enumerator);
}
else
{
- child_sa->get_usestats(child_sa, TRUE, NULL, &bytes_in);
- child_sa->get_usestats(child_sa, FALSE, NULL, &bytes_out);
+ child_sa->get_usestats(child_sa, TRUE, NULL, &bytes_in, NULL);
+ child_sa->get_usestats(child_sa, FALSE, NULL, &bytes_out, NULL);
DBG0(DBG_IKE, "closing CHILD_SA %s{%d} with SPIs "
"%.8x_i (%llu bytes) %.8x_o (%llu bytes) and TS %#R=== %#R",
}
else
{
- child_sa->get_usestats(child_sa, TRUE, NULL, &bytes_in);
- child_sa->get_usestats(child_sa, FALSE, NULL, &bytes_out);
+ child_sa->get_usestats(child_sa, TRUE, NULL, &bytes_in, NULL);
+ child_sa->get_usestats(child_sa, FALSE, NULL, &bytes_out, NULL);
DBG0(DBG_IKE, "closing CHILD_SA %s{%d} with SPIs %.8x_i "
"(%llu bytes) %.8x_o (%llu bytes) and TS %#R=== %#R",