aboutsummaryrefslogtreecommitdiffstats
path: root/lib/includes
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2020-09-18 17:39:03 +0200
committerMauro Sardara <msardara@cisco.com>2020-09-18 17:41:14 +0200
commit20a773677230374ffa2d5d140f7d46032fb7bc9d (patch)
tree972ba743c7b1cfbbabd38024215af670d4dc2e3c /lib/includes
parent22738e6177e9e1348e5a9c23c5a71e1d1ef7246f (diff)
Revert to [HICN-638] Check if systemd is running before enabling hicn-light service
Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: I1810d96e001a4e6e097e1efa331b682af750925d
Diffstat (limited to 'lib/includes')
-rw-r--r--lib/includes/hicn/common.h1
-rw-r--r--lib/includes/hicn/name.h82
-rw-r--r--lib/includes/hicn/ops.h14
3 files changed, 71 insertions, 26 deletions
diff --git a/lib/includes/hicn/common.h b/lib/includes/hicn/common.h
index 3385b4d19..30f370241 100644
--- a/lib/includes/hicn/common.h
+++ b/lib/includes/hicn/common.h
@@ -154,7 +154,6 @@ struct iovec
typedef union
{
- u8 as_u8[4];
u32 as_u32;
struct in_addr as_inaddr;
} ip4_address_t;
diff --git a/lib/includes/hicn/name.h b/lib/includes/hicn/name.h
index 9cee0bc1d..d5202068b 100644
--- a/lib/includes/hicn/name.h
+++ b/lib/includes/hicn/name.h
@@ -62,18 +62,81 @@ typedef union
{
struct
{
- ip46_address_t prefix;
+ union
+ {
+ u32 prefix;
+ u8 prefix_as_u8[4];
+ ip4_address_t prefix_as_ip4;
+ };
+ hicn_name_suffix_t suffix;
+ };
+ u8 buffer[HICN_V4_NAME_LEN];
+} hicn_v4_name_t;
+
+typedef union
+{
+ struct
+ {
+ union
+ {
+ u64 prefix[2];
+ u8 prefix_as_u8[16];
+ ip6_address_t prefix_as_ip6;
+ };
hicn_name_suffix_t suffix;
};
u8 buffer[HICN_V6_NAME_LEN];
-} hicn_name_t;
+} hicn_v6_name_t;
+
+#ifndef HICN_VPP_PLUGIN
+#define HICN_NAME_COMPONENT_SIZE 2
+
+typedef struct
+{
+ struct iovec buffers[HICN_NAME_COMPONENT_SIZE];
+} hicn_iov_name_t;
+
+#define UNSPEC 1 << 0
+#define HNT_CONTIGUOUS 1 << 1
+#define HNT_IOV 1 << 2
+#define HNT_INET 1 << 3
+#define HNT_INET6 1 << 4
-always_inline
-int hicn_name_is_ip4 (const hicn_name_t * name)
+typedef enum
{
- const ip46_address_t *ip46 = &name->prefix;
- return (((ip46)->pad[0] | (ip46)->pad[1] | (ip46)->pad[2]) == 0);
-}
+ HNT_UNSPEC = UNSPEC,
+ HNT_CONTIGUOUS_V4 = HNT_CONTIGUOUS | HNT_INET,
+ HNT_CONTIGUOUS_V6 = HNT_CONTIGUOUS | HNT_INET6,
+ HNT_IOV_V4 = HNT_IOV | HNT_INET,
+ HNT_IOV_V6 = HNT_IOV | HNT_INET6,
+} hicn_name_type_t;
+#endif /* HICN_VPP_PLUGIN */
+
+typedef struct
+{
+#ifndef HICN_VPP_PLUGIN
+ hicn_name_type_t type;
+ u8 len;
+#endif /* HICN_VPP_PLUGIN */
+ union
+ {
+ hicn_v4_name_t ip4;
+ hicn_v6_name_t ip6;
+ ip46_address_t ip46;
+#ifndef HICN_VPP_PLUGIN
+ hicn_iov_name_t iov;
+ u8 buffer[HICN_V6_NAME_LEN];
+#endif /* HICN_VPP_PLUGIN */
+ };
+} hicn_name_t;
+
+#ifndef HICN_VPP_PLUGIN
+#define _is_unspec(name) ((name->type & UNSPEC))
+#define _is_contiguous(name) ((name->type & HNT_CONTIGUOUS) >> 1)
+#define _is_iov(name) ((name->type & HNT_IOV) >> 2)
+#define _is_inet4(name) ((name->type & HNT_INET) >> 3)
+#define _is_inet6(name) ((name->type & HNT_INET6) >> 4)
+#endif /* HICN_VPP_PLUGIN */
/**
* @brief Create an hICN name from IP address in presentation format
@@ -129,10 +192,7 @@ int hicn_name_hash (const hicn_name_t * name, u32 * hash, bool consider_suffix);
* @return 0 if the name is empty, any other value otherwise (implementation
* returns 1)
*/
-always_inline int hicn_name_empty (hicn_name_t * name)
-{
- return ((name->prefix.ip6.as_u64[0] | name->prefix.ip6.as_u64[1] | (u64)name->suffix) == 0);
-}
+int hicn_name_empty (hicn_name_t * name);
/**
* @brief Copy an hICN name
diff --git a/lib/includes/hicn/ops.h b/lib/includes/hicn/ops.h
index bcb73171e..e8feff92d 100644
--- a/lib/includes/hicn/ops.h
+++ b/lib/includes/hicn/ops.h
@@ -122,16 +122,6 @@ 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
@@ -466,7 +456,6 @@ 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), \
@@ -572,9 +561,6 @@ 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 ; }