From: Alan T. DeKok Date: Thu, 8 Mar 2018 14:51:09 +0000 (-0500) Subject: add API to get size of the tracking table X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df7dc4eaea29e83208051a036087f4d21ee6900e;p=thirdparty%2Ffreeradius-server.git add API to get size of the tracking table --- diff --git a/src/modules/proto_radius/track.c b/src/modules/proto_radius/track.c index 4f758e16e8d..08c683e8bda 100644 --- a/src/modules/proto_radius/track.c +++ b/src/modules/proto_radius/track.c @@ -316,3 +316,18 @@ int fr_radius_tracking_entry_reply(fr_tracking_t *ft, fr_tracking_entry_t *entry return 0; } + + +/** Return number of used entries in the tracking table. + * + * @param[in] ft the tracking table. + * @return + * - <0 on error + * - >=0 number of entries in the tracking table + */ +int fr_radius_tracking_num(fr_tracking_t *ft) +{ + (void) talloc_get_type_abort(ft, fr_tracking_t); + + return ft->num_entries; +} diff --git a/src/modules/proto_radius/track.h b/src/modules/proto_radius/track.h index 0349d927e9c..35710490318 100644 --- a/src/modules/proto_radius/track.h +++ b/src/modules/proto_radius/track.h @@ -80,6 +80,8 @@ fr_tracking_status_t fr_radius_tracking_entry_insert(fr_tracking_entry_t **p_en int fr_radius_tracking_entry_reply(fr_tracking_t *ft, fr_tracking_entry_t *entry, fr_time_t reply_time, uint8_t const *reply, size_t reply_len); +int fr_radius_tracking_num(fr_tracking_t *ft); + #ifdef __cplusplus } #endif