diff options
author | Enrico Loparco (eloparco) <eloparco@cisco.com> | 2021-06-24 09:15:41 +0200 |
---|---|---|
committer | Enrico Loparco (eloparco) <eloparco@cisco.com> | 2021-06-24 09:15:41 +0200 |
commit | 229385955109b866a23c4ac2aa03d4d11044c39d (patch) | |
tree | 0591f9c2fc4144d62330337cc2b94c63dfeded54 /hicn-light/src/hicn/core | |
parent | 6ffbb5ed61733b8dbef39b1a9d437e899e9359d7 (diff) |
[HICN-708] Rebase with master
Signed-off-by: Enrico Loparco (eloparco) <eloparco@cisco.com>
Change-Id: I2122e1d61dd3b2e039972624ffbdbcb3c5610159
Diffstat (limited to 'hicn-light/src/hicn/core')
-rw-r--r-- | hicn-light/src/hicn/core/CMakeLists.txt | 2 | ||||
-rw-r--r-- | hicn-light/src/hicn/core/fib_entry.c | 9 | ||||
-rw-r--r-- | hicn-light/src/hicn/core/fib_entry.h | 7 | ||||
-rw-r--r-- | hicn-light/src/hicn/core/forwarder.c | 4 | ||||
-rw-r--r-- | hicn-light/src/hicn/core/forwarder.h | 2 | ||||
-rw-r--r-- | hicn-light/src/hicn/core/mapme.h | 2 | ||||
-rw-r--r-- | hicn-light/src/hicn/core/messageHandler.h | 39 | ||||
-rw-r--r-- | hicn-light/src/hicn/core/msgbuf.h | 6 | ||||
-rw-r--r-- | hicn-light/src/hicn/core/nameBitvector.c | 2 | ||||
-rw-r--r-- | hicn-light/src/hicn/core/strategy.h | 11 |
10 files changed, 31 insertions, 53 deletions
diff --git a/hicn-light/src/hicn/core/CMakeLists.txt b/hicn-light/src/hicn/core/CMakeLists.txt index 32b546400..277bcedb2 100644 --- a/hicn-light/src/hicn/core/CMakeLists.txt +++ b/hicn-light/src/hicn/core/CMakeLists.txt @@ -78,4 +78,4 @@ set(TO_INSTALL_HEADER_FILES if (BUILD_TESTS) add_subdirectory(test) -endif()
\ No newline at end of file +endif() diff --git a/hicn-light/src/hicn/core/fib_entry.c b/hicn-light/src/hicn/core/fib_entry.c index 5c6e28d5b..59e5f7e7c 100644 --- a/hicn-light/src/hicn/core/fib_entry.c +++ b/hicn-light/src/hicn/core/fib_entry.c @@ -20,7 +20,6 @@ //#include <hicn/core/connectionState.h> #include <hicn/core/strategy_vft.h> #include <hicn/core/nameBitvector.h> -#include <hicn/utils/commands.h> #ifdef WITH_MAPME #include <hicn/core/ticks.h> @@ -122,7 +121,7 @@ fib_entry_filter_nexthops(fib_entry_t * entry, nexthops_t * nexthops, unsigned nexthop, i; uint_fast32_t flags; - policy_t policy = fib_entry_get_policy(entry); + hicn_policy_t policy = fib_entry_get_policy(entry); nexthops_enumerate(nexthops, i, nexthop, { conn = connection_table_at(table, nexthop); @@ -325,14 +324,14 @@ fib_entry_get_available_nexthops(fib_entry_t * entry, unsigned ingress_id, nexth return fib_entry_filter_nexthops(entry, fib_entry_get_nexthops(entry), ingress_id, true); } -policy_t +hicn_policy_t fib_entry_get_policy(const fib_entry_t * entry) { return entry->policy; } void -fib_entry_set_policy(fib_entry_t * entry, policy_t policy) +fib_entry_set_policy(fib_entry_t * entry, hicn_policy_t policy) { entry->policy = policy; @@ -406,7 +405,7 @@ fib_entry_get_nexthops_from_strategy(fib_entry_t * entry, * If multipath is disabled, we don't offer much choice to the forwarding * strategy, but still go through it for accounting purposes. */ - policy_t policy = fib_entry_get_policy(entry); + hicn_policy_t policy = fib_entry_get_policy(entry); if ((policy.tags[POLICY_TAG_MULTIPATH].state == POLICY_STATE_PROHIBIT) || (policy.tags[POLICY_TAG_MULTIPATH].state != POLICY_STATE_AVOID)) { nexthops_select_one(nexthops); diff --git a/hicn-light/src/hicn/core/fib_entry.h b/hicn-light/src/hicn/core/fib_entry.h index 5ec0f29de..3b249a8fe 100644 --- a/hicn-light/src/hicn/core/fib_entry.h +++ b/hicn-light/src/hicn/core/fib_entry.h @@ -42,7 +42,6 @@ #include "msgbuf.h" #include "nexthops.h" #include "prefix_stats.h" -//#include "../utils/commands.h" // strategy type typedef struct { Name *name; @@ -53,7 +52,7 @@ typedef struct { const void * forwarder; #ifdef WITH_POLICY - policy_t policy; + hicn_policy_t policy; #endif /* WITH_POLICY */ prefix_counters_t prefix_counters; @@ -114,9 +113,9 @@ void fib_entry_on_data(fib_entry_t * fib_entry, const nexthops_t * nexthops, Ticks data_reception); #ifdef WITH_POLICY -policy_t fib_entry_get_policy(const fib_entry_t *fib_entry); +hicn_policy_t fib_entry_get_policy(const fib_entry_t *fib_entry); void fib_entry_reconsider_policy(fib_entry_t *fib_entry); -void fib_entry_set_policy(fib_entry_t *fib_entry, policy_t policy); +void fib_entry_set_policy(fib_entry_t *fib_entry, hicn_policy_t policy); void fib_entry_update_stats(fib_entry_t *fib_entry, uint64_t now); #endif /* WITH_POLICY */ diff --git a/hicn-light/src/hicn/core/forwarder.c b/hicn-light/src/hicn/core/forwarder.c index 9954ecd0a..e1a7243ca 100644 --- a/hicn-light/src/hicn/core/forwarder.c +++ b/hicn-light/src/hicn/core/forwarder.c @@ -941,7 +941,7 @@ forwarder_remove_route(forwarder_t * forwarder, ip_prefix_t * prefix, bool forwarder_add_or_update_policy(forwarder_t * forwarder, ip_prefix_t * prefix, - policy_t * policy) + hicn_policy_t * policy) { assert(forwarder); assert(prefix); @@ -1188,7 +1188,7 @@ forwarder_receive(forwarder_t * forwarder, listener_t * listener, msgbuf->connection_id = listener_create_connection(listener, pair); msg_header_t * msg = (msg_header_t*) packet; - msgbuf->command.type = msg->header.commandID; + msgbuf->command.type = msg->header.command_id; if (msgbuf->command.type >= COMMAND_TYPE_N || msgbuf->command.type == COMMAND_TYPE_UNDEFINED) { ERROR("Invalid command"); return -msgbuf_get_len(msgbuf); diff --git a/hicn-light/src/hicn/core/forwarder.h b/hicn-light/src/hicn/core/forwarder.h index f5ac375da..17d8a1994 100644 --- a/hicn-light/src/hicn/core/forwarder.h +++ b/hicn-light/src/hicn/core/forwarder.h @@ -162,7 +162,7 @@ bool forwarder_remove_route(forwarder_t * forwarder, ip_prefix_t * prefix, * @brief Adds or updates a policy on the message processor */ bool forwarder_add_or_update_policy(forwarder_t * forwarder, - ip_prefix_t * prefix, policy_t * policy); + ip_prefix_t * prefix, hicn_policy_t * policy); /** * @brief Removes a policy from the message processor diff --git a/hicn-light/src/hicn/core/mapme.h b/hicn-light/src/hicn/core/mapme.h index d1d21079f..29b59faf5 100644 --- a/hicn-light/src/hicn/core/mapme.h +++ b/hicn-light/src/hicn/core/mapme.h @@ -26,12 +26,12 @@ #include <stdbool.h> #include <stdint.h> +#include <hicn/ctrl/commands.h> #include <hicn/hicn.h> #include "connection.h" #include "fib_entry.h" #include "msgbuf.h" -#include "../utils/commands.h" typedef struct mapme_s mapme_t; diff --git a/hicn-light/src/hicn/core/messageHandler.h b/hicn-light/src/hicn/core/messageHandler.h index 1df511a5c..c6a03eee4 100644 --- a/hicn-light/src/hicn/core/messageHandler.h +++ b/hicn-light/src/hicn/core/messageHandler.h @@ -50,6 +50,8 @@ #define CONTROL_PORT 9695 #define HTTP_PORT 8080 +// XXX Hardcoded packet format HF_INET6_TCP + #define IPV6_DEFAULT_VERSION 6 #define IPV6_DEFAULT_TRAFFIC_CLASS 0 #define IPV6_DEFAULT_FLOW_LABEL 0 @@ -183,7 +185,7 @@ static inline bool messageHandler_IsInterest(const uint8_t *message) { if (!messageHandler_IsTCP(message)) return false; bool flag; - hicn_packet_test_ece((hicn_header_t *)message, + hicn_packet_test_ece(HF_INET6_TCP, (hicn_header_t *)message, &flag); // ECE flag is set to 0 in interest packets if (flag == false) return true; return false; @@ -193,7 +195,7 @@ static inline bool messageHandler_IsData(const uint8_t *message) { if (!messageHandler_IsTCP(message)) return false; bool flag; - hicn_packet_test_ece((hicn_header_t *)message, + hicn_packet_test_ece(HF_INET6_TCP, (hicn_header_t *)message, &flag); // ECE flag is set to 1 in data packets if (flag == true) return true; return false; @@ -354,13 +356,10 @@ static inline uint32_t messageHandler_GetPathLabel(const uint8_t *message) { } static inline void messageHandler_SetPathLabel(uint8_t *message, + uint32_t old_path_label, uint32_t new_path_label) { if (!messageHandler_IsTCP(message)) return; - uint32_t old_path_label; - int res = hicn_data_get_path_label((hicn_header_t *)message, &old_path_label); - if (res < 0) return; - hicn_data_set_path_label((hicn_header_t *)message, new_path_label); messageHandler_UpdateTCPCheckSum(message, (uint16_t *)&old_path_label, @@ -376,20 +375,12 @@ static inline void messageHandler_UpdatePathLabel(uint8_t *message, uint32_t pl_new_32bit = (uint32_t)((((pl_old_8bit << 1) | (pl_old_8bit >> 7)) ^ outFace) << 24UL); - hicn_data_set_path_label((hicn_header_t *)message, pl_new_32bit); - - messageHandler_UpdateTCPCheckSum(message, (uint16_t *)&pl_old_32bit, - (uint16_t *)&pl_new_32bit, 2); + // XXX path label should be 8 bits now ? + messageHandler_SetPathLabel(message, pl_old_32bit, pl_new_32bit); } static inline void messageHandler_ResetPathLabel(uint8_t *message) { - if (!messageHandler_IsTCP(message)) return; - - uint32_t pl_old_32bit = messageHandler_GetPathLabel(message); - uint32_t pl_new_32bit = 0; - hicn_data_set_path_label((hicn_header_t *)message, pl_new_32bit); - messageHandler_UpdateTCPCheckSum(message, (uint16_t *)&pl_old_32bit, - (uint16_t *)&pl_new_32bit, 2); + messageHandler_SetPathLabel(message, messageHandler_GetPathLabel(message), 0); } static inline uint16_t messageHandler_GetInterestLifetime( @@ -555,7 +546,7 @@ static inline uint8_t * messageHandler_CreateProbePacket(hicn_format_t format, hicn_packet_init_header(format, (hicn_header_t *) pkt); - hicn_packet_set_dst_port((hicn_header_t *) pkt, BFD_PORT); + hicn_packet_set_dst_port(format, (hicn_header_t *) pkt, BFD_PORT); hicn_interest_set_lifetime ((hicn_header_t *) pkt, probe_lifetime); return pkt; @@ -573,10 +564,10 @@ static inline void messageHandler_CreateProbeReply(uint8_t * probe, uint16_t src_prt; uint16_t dst_prt; - hicn_packet_get_src_port((const hicn_header_t *) probe, &src_prt); - hicn_packet_get_dst_port((const hicn_header_t *) probe, &dst_prt); - hicn_packet_set_src_port((hicn_header_t *) probe, dst_prt); - hicn_packet_set_dst_port((hicn_header_t *) probe, src_prt); + hicn_packet_get_src_port(format, (const hicn_header_t *) probe, &src_prt); + hicn_packet_get_dst_port(format, (const hicn_header_t *) probe, &dst_prt); + hicn_packet_set_src_port(format, (hicn_header_t *) probe, dst_prt); + hicn_packet_set_dst_port(format, (hicn_header_t *) probe, src_prt); hicn_data_set_name (format, (hicn_header_t *) probe, &probe_name); hicn_data_set_locator (format, (hicn_header_t *) probe, &probe_locator); @@ -598,8 +589,8 @@ static inline void messageHandler_SetProbeName(uint8_t * probe, hicn_format_t fo static inline bool messageHandler_IsAProbe(const uint8_t *packet){ uint16_t src_prt; uint16_t dst_prt; - hicn_packet_get_src_port ((const hicn_header_t *) packet, &src_prt); - hicn_packet_get_dst_port ((const hicn_header_t *) packet, &dst_prt); + hicn_packet_get_src_port (HF_INET6_TCP, (const hicn_header_t *) packet, &src_prt); + hicn_packet_get_dst_port (HF_INET6_TCP, (const hicn_header_t *) packet, &dst_prt); if(dst_prt == BFD_PORT){ //interest probe diff --git a/hicn-light/src/hicn/core/msgbuf.h b/hicn-light/src/hicn/core/msgbuf.h index a52e6b298..f3125a2e7 100644 --- a/hicn-light/src/hicn/core/msgbuf.h +++ b/hicn-light/src/hicn/core/msgbuf.h @@ -24,7 +24,7 @@ #include "name.h" #include "ticks.h" #include "messageHandler.h" -#include "../utils/commands.h" +#include <hicn/ctrl/commands.h> struct name_s; @@ -84,8 +84,8 @@ typedef struct { /* Path label */ #define msgbuf_get_pathlabel(M) (messageHandler_GetPathLabel((M)->packet)) -#define msgbuf_set_pathlabel(M, label) (messageHandler_SetPathLabel((M)->packet, label)) -#define msgbuf_update_pathlabel(M, outface) (messageHandler_SetPathLabel((M)->packet, outface)) +#define msgbuf_set_pathlabel(M, label) (messageHandler_SetPathLabel((M)->packet, msgbuf_get_pathlabel(M), label)) +#define msgbuf_update_pathlabel(M, outface) (messageHandler_UpdatePathLabel((M)->packet, outface)) #define msgbuf_reset_pathlabel(M) (messageHandler_ResetPathLabel((M)->packet)) /* WLDR */ diff --git a/hicn-light/src/hicn/core/nameBitvector.c b/hicn-light/src/hicn/core/nameBitvector.c index d3dc8c0ee..999f7a928 100644 --- a/hicn-light/src/hicn/core/nameBitvector.c +++ b/hicn-light/src/hicn/core/nameBitvector.c @@ -21,7 +21,7 @@ #include <hicn/core/nameBitvector.h> #include <hicn/common.h> // hash32 -#include <hicn/utils/commands.h> +#include <hicn/ctrl/commands.h> #define DEFAULT_PORT 1234 #define NAME_LEN 2 diff --git a/hicn-light/src/hicn/core/strategy.h b/hicn-light/src/hicn/core/strategy.h index 67630bbab..c684750f1 100644 --- a/hicn-light/src/hicn/core/strategy.h +++ b/hicn-light/src/hicn/core/strategy.h @@ -24,17 +24,6 @@ #include "../strategies/low_latency.h" #include "../strategies/random.h" -typedef enum { - STRATEGY_TYPE_UNDEFINED, - STRATEGY_TYPE_LOADBALANCER, - STRATEGY_TYPE_LOW_LATENCY, - STRATEGY_TYPE_RANDOM, - STRATEGY_TYPE_N -} strategy_type_t; - -#define STRATEGY_TYPE_VALID(type) \ - ((type != STRATEGY_TYPE_UNDEFINED) && (type != STRATEGY_TYPE_N)) - typedef union { strategy_load_balancer_options_t load_balancer; strategy_low_latency_options_t low_latency; |