From 6b94663b2455e212009a544ae23bb6a8c55407f8 Mon Sep 17 00:00:00 2001 From: Luca Muscariello Date: Thu, 9 Jun 2022 21:34:09 +0200 Subject: refactor(lib, hicn-light, vpp, hiperf): HICN-723 - move infra data structure into the shared lib - new packet cache using double hashing and lookup on prefix suffix - testing updates - authenticated requests using interest manifests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mauro Sardara Co-authored-by: Jordan Augé Co-authored-by: Michele Papalini Co-authored-by: Olivier Roques Co-authored-by: Enrico Loparco Change-Id: Iaddebfe6aa5279ea8553433b0f519578f6b9ccd9 Signed-off-by: Luca Muscariello --- ctrl/libhicnctrl/src/api.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'ctrl/libhicnctrl/src/api.c') diff --git a/ctrl/libhicnctrl/src/api.c b/ctrl/libhicnctrl/src/api.c index 472e07bc4..d68dc830e 100644 --- a/ctrl/libhicnctrl/src/api.c +++ b/ctrl/libhicnctrl/src/api.c @@ -440,7 +440,7 @@ GENERATE_FIND(connection); /* CONNECTION VALIDATE */ int hc_connection_validate(const hc_connection_t *connection) { - if (!IS_VALID_NAME(connection->name)) { + if (connection->name[0] != '\0' && !IS_VALID_NAME(connection->name)) { ERROR("[hc_connection_validate] Invalid name specified"); return -1; } @@ -1060,6 +1060,28 @@ int hc_cache_snprintf(char *s, size_t size, const hc_cache_info_t *cache_info) { (unsigned long)cache_info->num_stale_entries); } +int hc_stats_snprintf(char *s, size_t size, const hicn_light_stats_t *stats) { + return snprintf( + s, size, + "pkts processed: %u\n\tinterests: %u\n\t" + "data: %u\npkts from cache count: %u\npkts no pit count: " + "%u\nexpired:\n\t interests: " + "%u\n\t data: %u\ninterests aggregated: " + "%u\nlru evictions: " + "%u\ndropped: " + "%u\ninterests retx: " + "%u\npit entries: %u\ncs entries: %u", + stats->forwarder.countReceived, stats->forwarder.countInterestsReceived, + stats->forwarder.countObjectsReceived, + stats->forwarder.countInterestsSatisfiedFromStore, + stats->forwarder.countDroppedNoReversePath, + stats->forwarder.countInterestsExpired, stats->forwarder.countDataExpired, + stats->pkt_cache.n_lru_evictions, stats->forwarder.countDropped, + stats->forwarder.countInterestsAggregated, + stats->forwarder.countInterestsRetransmitted, + stats->pkt_cache.n_pit_entries, stats->pkt_cache.n_cs_entries); +} + /*----------------------------------------------------------------------------* * Strategy *----------------------------------------------------------------------------*/ @@ -1160,6 +1182,17 @@ hc_result_t *hc_subscription_delete_conf(hc_sock_t *s, return s->hc_subscription_delete_conf(s, subscription); } +/*----------------------------------------------------------------------------* + * STATISTICS + *----------------------------------------------------------------------------*/ +int hc_stats_get(hc_sock_t *s, hc_data_t **pdata) { + return s->hc_stats_get(s, pdata); +} + +int hc_stats_list(hc_sock_t *s, hc_data_t **pdata) { + return s->hc_stats_list(s, pdata); +} + /*----------------------------------------------------------------------------* * Result *----------------------------------------------------------------------------*/ -- cgit 1.2.3-korg