summaryrefslogtreecommitdiffstats
path: root/hicn-light
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-light')
-rw-r--r--hicn-light/src/hicn/CMakeLists.txt2
-rw-r--r--hicn-light/src/hicn/core/message.c3
-rw-r--r--hicn-light/src/hicn/core/messageHandler.h36
3 files changed, 15 insertions, 26 deletions
diff --git a/hicn-light/src/hicn/CMakeLists.txt b/hicn-light/src/hicn/CMakeLists.txt
index 82de74ac7..639bfa179 100644
--- a/hicn-light/src/hicn/CMakeLists.txt
+++ b/hicn-light/src/hicn/CMakeLists.txt
@@ -56,7 +56,7 @@ build_library(${LIBHICN_LIGHT}
DEPENDS ${DEPENDENCIES}
COMPONENT ${HICN_LIGHT}
INCLUDE_DIRS ${HICN_LIGHT_INCLUDE_DIRS}
- INSTALL_ROOT_DIR hicn
+ HEADER_ROOT_DIR hicn
DEFINITIONS ${COMPILER_DEFINITIONS}
)
diff --git a/hicn-light/src/hicn/core/message.c b/hicn-light/src/hicn/core/message.c
index 5d0d04ae4..c28938320 100644
--- a/hicn-light/src/hicn/core/message.c
+++ b/hicn-light/src/hicn/core/message.c
@@ -245,7 +245,8 @@ uint32_t message_GetPathLabel(const Message *message) {
void message_SetPathLabel(Message *message, uint32_t label) {
parcAssertNotNull(message, "Parameter must be non-null");
- messageHandler_SetPathLabel(message->messageHead, label);
+ messageHandler_SetPathLabel(message->messageHead,
+ messageHandler_GetPathLabel(message->messageHead), label);
}
void message_UpdatePathLabel(Message *message, uint8_t outFace) {
diff --git a/hicn-light/src/hicn/core/messageHandler.h b/hicn-light/src/hicn/core/messageHandler.h
index f6b3e4e36..b41c9a7f0 100644
--- a/hicn-light/src/hicn/core/messageHandler.h
+++ b/hicn-light/src/hicn/core/messageHandler.h
@@ -334,7 +334,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;
@@ -344,7 +344,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;
@@ -505,13 +505,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,
@@ -527,20 +524,11 @@ 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);
+ 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(
@@ -703,7 +691,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;
@@ -721,10 +709,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);
@@ -746,8 +734,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