aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/libhicnctrl/src/api.c
diff options
context:
space:
mode:
authorLuca Muscariello <lumuscar@cisco.com>2022-06-09 21:34:09 +0200
committerLuca Muscariello <muscariello@ieee.org>2022-06-30 10:47:50 +0200
commit6b94663b2455e212009a544ae23bb6a8c55407f8 (patch)
tree0af780ce5eeb1009fd24b8af8af08e8368eda3bd /ctrl/libhicnctrl/src/api.c
parenta1ac96f497719b897793ac14b287cb8d840651c1 (diff)
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 Co-authored-by: Mauro Sardara <msardara@cisco.com> Co-authored-by: Jordan Augé <jordan.auge+fdio@cisco.com> Co-authored-by: Michele Papalini <micpapal@cisco.com> Co-authored-by: Olivier Roques <oroques+fdio@cisco.com> Co-authored-by: Enrico Loparco <eloparco@cisco.com> Change-Id: Iaddebfe6aa5279ea8553433b0f519578f6b9ccd9 Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Diffstat (limited to 'ctrl/libhicnctrl/src/api.c')
-rw-r--r--ctrl/libhicnctrl/src/api.c35
1 files changed, 34 insertions, 1 deletions
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
*----------------------------------------------------------------------------*/
@@ -1161,6 +1183,17 @@ hc_result_t *hc_subscription_delete_conf(hc_sock_t *s,
}
/*----------------------------------------------------------------------------*
+ * 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
*----------------------------------------------------------------------------*/