aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/libhicnctrl/src/api.c
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2022-09-20 13:27:12 +0200
committerJordan Augé <jordan.auge+fdio@cisco.com>2022-09-22 12:20:58 +0200
commitbd26d18978861b24c5707dbaa24dac76133425e2 (patch)
tree7ff84df44d440254b48f800c368005eb27d4680d /ctrl/libhicnctrl/src/api.c
parent45da502db58f712b78e59c214f05c44aa01ea8d0 (diff)
fix(libhicnctrl): fix new listener validation during face or connection creation
Change-Id: I5f532320fcb3fc01cd3a027af7ea5fc6425e4097 Ref: HICN-790 Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'ctrl/libhicnctrl/src/api.c')
-rw-r--r--ctrl/libhicnctrl/src/api.c269
1 files changed, 0 insertions, 269 deletions
diff --git a/ctrl/libhicnctrl/src/api.c b/ctrl/libhicnctrl/src/api.c
index c93853dd1..c133b9123 100644
--- a/ctrl/libhicnctrl/src/api.c
+++ b/ctrl/libhicnctrl/src/api.c
@@ -34,47 +34,6 @@
#define ENOIMPL 42
-#if 0
-/* /!\ Please update constants in public header file upon changes */
-const char * connection_state_str[] = {
-#define _(x) [HC_CONNECTION_STATE_##x] = STRINGIZE(x),
-foreach_connection_state
-#undef _
-};
-
-/* /!\ Please update constants in public header file upon changes */
-const char * connection_type_str[] = {
-#define _(x) [CONNECTION_TYPE_##x] = STRINGIZE(x),
-foreach_connection_type
-#undef _
-};
-
-hc_connection_type_t
-connection_type_from_str(const char * str)
-{
- if (strcasecmp(str, "TCP") == 0)
- return CONNECTION_TYPE_TCP;
- else if (strcasecmp(str, "UDP") == 0)
- return CONNECTION_TYPE_UDP;
- else if (strcasecmp(str, "HICN") == 0)
- return CONNECTION_TYPE_HICN;
- else
- return CONNECTION_TYPE_UNDEFINED;
-}
-#endif
-
-/******************************************************************************
- * Control Data
- ******************************************************************************/
-
-/*----------------------------------------------------------------------------*
- * Object model
- *----------------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------------*
- * Entry point
- *----------------------------------------------------------------------------*/
-
int hc_sock_on_init(hc_sock_t *s, hc_request_t *request) {
int rc;
ssize_t size;
@@ -114,19 +73,6 @@ int hc_sock_on_receive(hc_sock_t *s, size_t count) {
* time... either the state machine reaches the end, or in case of generic
* requests, we mark it as such.
*/
-#if 0
- if (hc_request_is_complete(current_request)) {
- if (!hc_request_pop(request)) {
- /* Free request context */
- /* In case of error, data is NULL */
- // XXX bug if we free request XXX
- // hc_sock_free_request(s, request);
- if (!hc_request_is_subscription(request))
- hc_request_set_complete(request);
- return 1; /* Done */
- }
- } else {
-#endif
ON_INIT:
rc = hc_sock_on_init(s, request);
if (rc < 0) goto ERR_INIT;
@@ -264,9 +210,6 @@ int _hc_execute(hc_sock_t *s, hc_action_t action, hc_object_type_t object_type,
if (hc_sock_is_async(s)) return 0;
- /* Case in which no reply is expected */
- if (!pdata) return 0;
-
if (hc_sock_receive_all(s, pdata) < 0) goto ERR_RECV;
} else if (s->ops.prepare) {
// hc_data_t *data = hc_data_create(OBJECT_TYPE_LISTENER);
@@ -309,218 +252,6 @@ int hc_execute_async(hc_sock_t *s, hc_action_t action,
NULL);
}
-/* This function has to be called after the first execute until data and
- * request are complete */
-// execute is just setting things up so that we can keep on calling this
-// function repeatedly until completion.
-//
-// in the caller, we don't know how much we will receive in advance... so in
-// asio for instance, we will use async_receive rather than async_read.
-// XXX the question remains about the buffers...
-
-/*
- * request -> write command
- *
- * SYNC : hc_data_t
- * ASYNC : provide socket-level callback
- *
- * socket available -> read -> parse -> populate data
- * data complete ->
- */
-
-/******************************************************************************
- * OBJECT-SPECIFIC FUNCTIONS (backwards compatibility)
- ******************************************************************************/
-
-/*----------------------------------------------------------------------------*
- * FACE
- *
- * This is an abstraction provided for when the module does not implement
- *it. Alternative is to move it to hicn light
- *----------------------------------------------------------------------------*/
-
-#if 0
-
-/* FACE -> LISTENER */
-
-
-/* LISTENER -> FACE */
-
-int hc_listener_to_face(const hc_listener_t *listener, hc_face_t *face) {
- return -1; /* XXX Not implemented */
-}
-
-/* FACE -> CONNECTION */
-
-
-/* CONNECTION -> FACE */
-/* CONNECTION -> LISTENER */
-
-
-/*----------------------------------------------------------------------------*
- * Punting
- *----------------------------------------------------------------------------*/
-
-int hc_punting_create(hc_sock_t *s, hc_punting_t *punting) {
- return s->hc_punting_create(s, punting);
-}
-
-int hc_punting_get(hc_sock_t *s, hc_punting_t *punting,
- hc_punting_t **punting_found) {
- return s->hc_punting_get(s, punting, punting_found);
-}
-
-int hc_punting_delete(hc_sock_t *s, hc_punting_t *punting) {
- return s->hc_punting_delete(s, punting);
-}
-
-int hc_punting_list(hc_sock_t *s, hc_data_t **pdata) {
- return s->hc_punting_list(s, pdata);
-}
-
-int hc_punting_validate(const hc_punting_t *punting) {
- if (!IS_VALID_FAMILY(punting->family)) return -1;
-
- /*
- * We might use the zero value to add punting on all faces but this is not
- * (yet) implemented
- */
- if (punting->face_id == 0) {
- ERROR("Punting on all faces is not (yet) implemented.");
- return -1;
- }
-
- return 0;
-}
-
-int hc_punting_cmp(const hc_punting_t *p1, const hc_punting_t *p2) {
- int rc;
-
- rc = INT_CMP(p1->face_id, p2->face_id);
- if (rc != 0) return rc;
-
- rc = INT_CMP(p1->family, p2->family);
- if (rc != 0) return rc;
-
- rc = ip_address_cmp(&p1->prefix, &p2->prefix);
- if (rc != 0) return rc;
-
- rc = INT_CMP(p1->prefix_len, p2->prefix_len);
- if (rc != 0) return rc;
-
- return rc;
-}
-
-#if 0
-int hc_punting_parse(void *in, hc_punting_t *punting) {
- ERROR("hc_punting_parse not (yet) implemented.");
- return -1;
-}
-#endif
-
-int hc_punting_snprintf(char *s, size_t size, hc_punting_t *punting) {
- ERROR("hc_punting_snprintf not (yet) implemented.");
- return -1;
-}
-
-/*----------------------------------------------------------------------------*
- * Cache
- *----------------------------------------------------------------------------*/
-
-int hc_cache_set_store(hc_sock_t *s, hc_cache_t *cache) {
- return s->hc_cache_set_store(s, cache);
-}
-
-int hc_cache_set_serve(hc_sock_t *s, hc_cache_t *cache) {
- return s->hc_cache_set_serve(s, cache);
-}
-
-int hc_cache_clear(hc_sock_t *s, hc_cache_t *cache) {
- return s->hc_cache_clear(s, cache);
-}
-
-int hc_cache_list(hc_sock_t *s, hc_data_t **pdata) {
- return s->hc_cache_list(s, pdata);
-}
-
-int hc_cache_snprintf(char *s, size_t size, const hc_cache_info_t *cache_info) {
- return snprintf(
- s, size, "Cache set_store=%s set_serve=%s size=%lu stale_entries=%lu",
- cache_info->store ? "true" : "false",
- cache_info->serve ? "true" : "false", (unsigned long)cache_info->cs_size,
- (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);
-}
-
-/*----------------------------------------------------------------------------*
- * WLDR
- *----------------------------------------------------------------------------*/
-
-int hc_wldr_set(hc_sock_t *s /* XXX */) { return s->hc_wldr_set(s); }
-
-/*----------------------------------------------------------------------------*
- * MAP-Me
- *----------------------------------------------------------------------------*/
-
-int hc_mapme_set(hc_sock_t *s, hc_mapme_t *mapme) {
- return s->hc_mapme_set(s, mapme->enabled);
-}
-
-int hc_mapme_set_discovery(hc_sock_t *s, hc_mapme_t *mapme) {
- return s->hc_mapme_set_discovery(s, mapme->enabled);
-}
-
-int hc_mapme_set_timescale(hc_sock_t *s, hc_mapme_t *mapme) {
- return s->hc_mapme_set_timescale(s, mapme->timescale);
-}
-
-int hc_mapme_set_retx(hc_sock_t *s, hc_mapme_t *mapme) {
- return s->hc_mapme_set_retx(s, mapme->timescale);
-}
-
-int hc_mapme_send_update(hc_sock_t *s, hc_mapme_t *mapme) {
- return s->hc_mapme_send_update(s, mapme);
-}
-
-/*----------------------------------------------------------------------------*
- * Policy
- *----------------------------------------------------------------------------*/
-
-
-/* POLICY SNPRINTF */
-
-/* /!\ Please update constants in header file upon changes */
-int hc_policy_snprintf(char *s, size_t size, hc_policy_t *policy) { return 0; }
-
-int hc_policy_validate(const hc_policy_t *policy, bool allow_partial) {
- if (!IS_VALID_FAMILY(policy->family)) return -1;
-
- return 0;
-}
-
-#endif
-
/*----------------------------------------------------------------------------*
* VFT
*----------------------------------------------------------------------------*/