aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/includes/hicn/ops.h14
-rw-r--r--lib/src/CMakeLists.txt4
-rw-r--r--lib/src/ops.c1
-rw-r--r--lib/src/protocol/ah.c3
-rw-r--r--lib/src/protocol/icmp.c1
-rw-r--r--lib/src/protocol/ipv4.c6
-rw-r--r--lib/src/protocol/ipv6.c6
-rw-r--r--lib/src/protocol/tcp.c7
8 files changed, 39 insertions, 3 deletions
diff --git a/lib/includes/hicn/ops.h b/lib/includes/hicn/ops.h
index e8feff92d..bcb73171e 100644
--- a/lib/includes/hicn/ops.h
+++ b/lib/includes/hicn/ops.h
@@ -122,6 +122,16 @@ typedef struct hicn_ops_s
int (*mark_packet_as_data) (hicn_type_t type, hicn_protocol_t * h);
/**
+ * @brief Check if currentpacket is interest
+ * @param [in] type - hICN packet type
+ * @param [in,out] h - Buffer holding the Interest packet
+ * @param [out] ret - Return 1 if interest
+ * @return hICN error code
+ */
+ int (*test_packet_is_interest) (hicn_type_t type, hicn_protocol_t * h,
+ u8 *ret);
+
+ /**
* @brief Clear the necessary Interest fields in order to hash it
* @param [in] type - hICN packet type
* @param [in,out] h - Buffer holding the Interest packet
@@ -456,6 +466,7 @@ typedef struct hicn_ops_s
ATTR_INIT(set_interest_name_suffix, protocol ## _set_interest_name_suffix), \
ATTR_INIT(mark_packet_as_interest, protocol ## _mark_packet_as_interest), \
ATTR_INIT(mark_packet_as_data, protocol ## _mark_packet_as_data), \
+ ATTR_INIT(test_packet_is_interest, protocol ## _test_packet_is_interest), \
ATTR_INIT(reset_interest_for_hash, protocol ## _reset_interest_for_hash), \
ATTR_INIT(get_data_locator, protocol ## _get_data_locator), \
ATTR_INIT(set_data_locator, protocol ## _set_data_locator), \
@@ -561,6 +572,9 @@ PAYLOAD (hicn_type_t type, const hicn_protocol_t * h)
#define DECLARE_mark_packet_as_data(protocol, error) \
int protocol ## _mark_packet_as_data(hicn_type_t type, hicn_protocol_t * h) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_test_packet_is_interest(protocol, error) \
+ int protocol ## _test_packet_is_interest(hicn_type_t type, hicn_protocol_t * h, u8 *ret) { return HICN_LIB_ERROR_ ## error ; }
+
#define DECLARE_reset_interest_for_hash(protocol, error) \
int protocol ## _reset_interest_for_hash(hicn_type_t type, hicn_protocol_t * h) { return HICN_LIB_ERROR_ ## error ; }
diff --git a/lib/src/CMakeLists.txt b/lib/src/CMakeLists.txt
index 7eecaf775..49b735f51 100644
--- a/lib/src/CMakeLists.txt
+++ b/lib/src/CMakeLists.txt
@@ -42,7 +42,7 @@ if (DISABLE_SHARED_LIBRARIES)
COMPONENT lib${LIBHICN}
INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../includes
DEFINITIONS ${COMPILER_DEFINITIONS}
- INSTALL_ROOT_DIR hicn
+ HEADER_ROOT_DIR hicn
INSTALL_HEADERS ${LIBHICN_HEADER_FILES} ${LIBHICN_HEADER_FILES_PROTOCOL} ${LIBHICN_HEADER_FILES_UTIL}
LINK_LIBRARIES ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY}
)
@@ -53,7 +53,7 @@ else ()
COMPONENT lib${LIBHICN}
INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../includes
DEFINITIONS ${COMPILER_DEFINITIONS}
- INSTALL_ROOT_DIR hicn
+ HEADER_ROOT_DIR hicn
INSTALL_HEADERS ${LIBHICN_HEADER_FILES} ${LIBHICN_HEADER_FILES_PROTOCOL} ${LIBHICN_HEADER_FILES_UTIL}
LINK_LIBRARIES ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY}
)
diff --git a/lib/src/ops.c b/lib/src/ops.c
index d49138398..919567721 100644
--- a/lib/src/ops.c
+++ b/lib/src/ops.c
@@ -42,6 +42,7 @@ DECLARE_get_interest_name_suffix (none, NONE);
DECLARE_set_interest_name_suffix (none, NONE);
DECLARE_mark_packet_as_interest (none, NONE);
DECLARE_mark_packet_as_data (none, NONE);
+DECLARE_test_packet_is_interest (none, NONE);
DECLARE_reset_interest_for_hash (none, NONE);
DECLARE_get_data_locator (none, NONE);
DECLARE_set_data_locator (none, NONE);
diff --git a/lib/src/protocol/ah.c b/lib/src/protocol/ah.c
index da08d1ee8..6f143238a 100644
--- a/lib/src/protocol/ah.c
+++ b/lib/src/protocol/ah.c
@@ -32,7 +32,8 @@ DECLARE_set_interest_name (ah, UNEXPECTED);
DECLARE_get_interest_name_suffix (ah, UNEXPECTED);
DECLARE_set_interest_name_suffix (ah, UNEXPECTED);
DECLARE_mark_packet_as_interest (ah, UNEXPECTED)
-DECLARE_mark_packet_as_data (ah, UNEXPECTED)
+DECLARE_mark_packet_as_data (ah, UNEXPECTED);
+DECLARE_test_packet_is_interest (ah, UNEXPECTED);
DECLARE_get_data_locator (ah, UNEXPECTED);
DECLARE_set_data_locator (ah, UNEXPECTED);
DECLARE_get_data_name (ah, UNEXPECTED);
diff --git a/lib/src/protocol/icmp.c b/lib/src/protocol/icmp.c
index b24c0f11e..40a93b099 100644
--- a/lib/src/protocol/icmp.c
+++ b/lib/src/protocol/icmp.c
@@ -27,6 +27,7 @@ DECLARE_get_interest_name_suffix (icmp, UNEXPECTED)
DECLARE_set_interest_name_suffix (icmp, UNEXPECTED)
DECLARE_mark_packet_as_interest (icmp, UNEXPECTED)
DECLARE_mark_packet_as_data (icmp, UNEXPECTED)
+DECLARE_test_packet_is_interest (icmp, UNEXPECTED)
DECLARE_get_data_locator (icmp, UNEXPECTED)
DECLARE_set_data_locator (icmp, UNEXPECTED)
DECLARE_get_data_name (icmp, UNEXPECTED)
diff --git a/lib/src/protocol/ipv4.c b/lib/src/protocol/ipv4.c
index 5ad4ddbfa..4bab9980b 100644
--- a/lib/src/protocol/ipv4.c
+++ b/lib/src/protocol/ipv4.c
@@ -117,6 +117,12 @@ ipv4_mark_packet_as_data (hicn_type_t type, hicn_protocol_t * h)
}
int
+ipv4_test_packet_is_interest (hicn_type_t type, hicn_protocol_t * h, u8 *ret)
+{
+ return CHILD_OPS (test_packet_is_interest, type, h, ret);
+}
+
+int
ipv4_reset_interest_for_hash (hicn_type_t type, hicn_protocol_t * h)
{
/* Sets everything to 0 up to IP destination address */
diff --git a/lib/src/protocol/ipv6.c b/lib/src/protocol/ipv6.c
index 9db3e3a17..b0ba3117d 100644
--- a/lib/src/protocol/ipv6.c
+++ b/lib/src/protocol/ipv6.c
@@ -107,6 +107,12 @@ ipv6_mark_packet_as_data (hicn_type_t type, hicn_protocol_t * h)
}
int
+ipv6_test_packet_is_interest (hicn_type_t type, hicn_protocol_t * h, u8 *ret)
+{
+ return CHILD_OPS (test_packet_is_interest, type, h, ret);
+}
+
+int
ipv6_reset_interest_for_hash (hicn_type_t type, hicn_protocol_t * h)
{
/* Sets everything to 0 up to IP destination address */
diff --git a/lib/src/protocol/tcp.c b/lib/src/protocol/tcp.c
index 31c495ff4..ec1eb27dc 100644
--- a/lib/src/protocol/tcp.c
+++ b/lib/src/protocol/tcp.c
@@ -97,6 +97,13 @@ tcp_mark_packet_as_data (hicn_type_t type, hicn_protocol_t * h)
}
int
+tcp_test_packet_is_interest (hicn_type_t type, hicn_protocol_t * h, u8 *ret)
+{
+ *ret = !(h->tcp.flags & HICN_TCP_FLAG_ECE);
+ return HICN_LIB_ERROR_NONE;
+}
+
+int
tcp_reset_interest_for_hash (hicn_type_t type, hicn_protocol_t * h)
{
memset (&(h->tcp), 0, 4);