summaryrefslogtreecommitdiffstats
path: root/lib/includes
diff options
context:
space:
mode:
Diffstat (limited to 'lib/includes')
-rw-r--r--lib/includes/hicn/compat.h5
-rw-r--r--lib/includes/hicn/ops.h622
-rw-r--r--lib/includes/hicn/protocol/ah.h17
3 files changed, 427 insertions, 217 deletions
diff --git a/lib/includes/hicn/compat.h b/lib/includes/hicn/compat.h
index 35b6e6fc5..486c82348 100644
--- a/lib/includes/hicn/compat.h
+++ b/lib/includes/hicn/compat.h
@@ -454,7 +454,10 @@ int hicn_data_get_payload_type (const hicn_header_t *data,
int hicn_data_set_payload_type (hicn_header_t *data,
hicn_payload_type_t payload_type);
int hicn_data_reset_for_hash (hicn_format_t format, hicn_header_t *packet);
-
+int hicn_packet_get_signature_gap (hicn_format_t format,
+ const hicn_header_t *h, uint8_t *bytes);
+int hicn_packet_set_signature_gap (hicn_format_t format, hicn_header_t *h,
+ uint8_t bytes);
#endif /* HICN_COMPAT_H */
/*
diff --git a/lib/includes/hicn/ops.h b/lib/includes/hicn/ops.h
index 7d4ae86d8..e5b1c088c 100644
--- a/lib/includes/hicn/ops.h
+++ b/lib/includes/hicn/ops.h
@@ -30,8 +30,8 @@
/*
* hICN operations on packets
*
- * All prototypes take an hicn_type_t parameter as their first argument, as this
- * decides the sequence of protocols that are being used by the different
+ * All prototypes take an hicn_type_t parameter as their first argument, as
+ * this decides the sequence of protocols that are being used by the different
* operations.
*/
@@ -42,7 +42,7 @@ typedef struct hicn_ops_s
* @param [in] type - hICN packet type
* @param [in,out] h - Buffer holding the packet
*/
- int (*init_packet_header) (hicn_type_t type, hicn_protocol_t * h);
+ int (*init_packet_header) (hicn_type_t type, hicn_protocol_t *h);
/**
* @brief Retrieves an Interest locator
@@ -51,8 +51,8 @@ typedef struct hicn_ops_s
* @param [out] ip_address - Retrieved locator
* @return hICN error code
*/
- int (*get_interest_locator) (hicn_type_t type, const hicn_protocol_t * h,
- ip46_address_t * ip_address);
+ int (*get_interest_locator) (hicn_type_t type, const hicn_protocol_t *h,
+ ip46_address_t *ip_address);
/**
* @brief Sets an Interest locator
@@ -61,8 +61,8 @@ typedef struct hicn_ops_s
* @param [in] ip_address - Locator to set
* @return hICN error code
*/
- int (*set_interest_locator) (hicn_type_t type, hicn_protocol_t * h,
- const ip46_address_t * ip_address);
+ int (*set_interest_locator) (hicn_type_t type, hicn_protocol_t *h,
+ const ip46_address_t *ip_address);
/**
* @brief Retrieves an Interest name
@@ -71,8 +71,8 @@ typedef struct hicn_ops_s
* @param [out] name - Retrieved name
* @return hICN error code
*/
- int (*get_interest_name) (hicn_type_t type, const hicn_protocol_t * h,
- hicn_name_t * name);
+ int (*get_interest_name) (hicn_type_t type, const hicn_protocol_t *h,
+ hicn_name_t *name);
/**
* @brief Sets an Interest name
@@ -81,8 +81,8 @@ typedef struct hicn_ops_s
* @param [in] name - Name to set
* @return hICN error code
*/
- int (*set_interest_name) (hicn_type_t type, hicn_protocol_t * h,
- const hicn_name_t * name);
+ int (*set_interest_name) (hicn_type_t type, hicn_protocol_t *h,
+ const hicn_name_t *name);
/**
* @brief Retrieves an Interest name suffix
@@ -91,9 +91,8 @@ typedef struct hicn_ops_s
* @param [out] suffix - Retrieved name suffix
* @return hICN error code
*/
- int (*get_interest_name_suffix) (hicn_type_t type,
- const hicn_protocol_t * h,
- hicn_name_suffix_t * suffix);
+ int (*get_interest_name_suffix) (hicn_type_t type, const hicn_protocol_t *h,
+ hicn_name_suffix_t *suffix);
/**
* @brief Sets an Interest name suffix
@@ -102,8 +101,8 @@ typedef struct hicn_ops_s
* @param [in] suffix - Name suffix to set
* @return hICN error code
*/
- int (*set_interest_name_suffix) (hicn_type_t type, hicn_protocol_t * h,
- const hicn_name_suffix_t * suffix);
+ int (*set_interest_name_suffix) (hicn_type_t type, hicn_protocol_t *h,
+ const hicn_name_suffix_t *suffix);
/**
* @brief Set flag to mark current packet as interest
@@ -111,7 +110,7 @@ typedef struct hicn_ops_s
* @param [in,out] h - Buffer holding the Interest packet
* @return hICN error code
*/
- int (*mark_packet_as_interest) (hicn_type_t type, hicn_protocol_t * h);
+ int (*mark_packet_as_interest) (hicn_type_t type, hicn_protocol_t *h);
/**
* @brief Set flag to mark current packet as data
@@ -119,7 +118,7 @@ typedef struct hicn_ops_s
* @param [in,out] h - Buffer holding the Interest packet
* @return hICN error code
*/
- int (*mark_packet_as_data) (hicn_type_t type, hicn_protocol_t * h);
+ int (*mark_packet_as_data) (hicn_type_t type, hicn_protocol_t *h);
/**
* @brief Clear the necessary Interest fields in order to hash it
@@ -127,7 +126,7 @@ typedef struct hicn_ops_s
* @param [in,out] h - Buffer holding the Interest packet
* @return hICN error code
*/
- int (*reset_interest_for_hash) (hicn_type_t type, hicn_protocol_t * h);
+ int (*reset_interest_for_hash) (hicn_type_t type, hicn_protocol_t *h);
/**
* @brief Retrieves a Data locator
@@ -136,8 +135,8 @@ typedef struct hicn_ops_s
* @param [out] ip_address - Retrieved locator
* @return hICN error code
*/
- int (*get_data_locator) (hicn_type_t type, const hicn_protocol_t * h,
- ip46_address_t * ip_address);
+ int (*get_data_locator) (hicn_type_t type, const hicn_protocol_t *h,
+ ip46_address_t *ip_address);
/**
* @brief Sets a Data locator
@@ -146,8 +145,8 @@ typedef struct hicn_ops_s
* @param [in] ip_address - Locator to set
* @return hICN error code
*/
- int (*set_data_locator) (hicn_type_t type, hicn_protocol_t * h,
- const ip46_address_t * ip_address);
+ int (*set_data_locator) (hicn_type_t type, hicn_protocol_t *h,
+ const ip46_address_t *ip_address);
/**
* @brief Retrieves a Data name
@@ -156,8 +155,8 @@ typedef struct hicn_ops_s
* @param [out] name - Retrieved name
* @return hICN error code
*/
- int (*get_data_name) (hicn_type_t type, const hicn_protocol_t * h,
- hicn_name_t * name);
+ int (*get_data_name) (hicn_type_t type, const hicn_protocol_t *h,
+ hicn_name_t *name);
/**
* @brief Sets a Data name
@@ -166,8 +165,8 @@ typedef struct hicn_ops_s
* @param [in] name - Name to set
* @return hICN error code
*/
- int (*set_data_name) (hicn_type_t type, hicn_protocol_t * h,
- const hicn_name_t * name);
+ int (*set_data_name) (hicn_type_t type, hicn_protocol_t *h,
+ const hicn_name_t *name);
/**
* @brief Retrieves a Data name suffix
@@ -176,8 +175,8 @@ typedef struct hicn_ops_s
* @param [out] suffix - Retrieved name suffix
* @return hICN error code
*/
- int (*get_data_name_suffix) (hicn_type_t type, const hicn_protocol_t * h,
- hicn_name_suffix_t * suffix);
+ int (*get_data_name_suffix) (hicn_type_t type, const hicn_protocol_t *h,
+ hicn_name_suffix_t *suffix);
/**
* @brief Sets a Data name suffix
@@ -186,8 +185,8 @@ typedef struct hicn_ops_s
* @param [in] suffix - Name suffix to set
* @return hICN error code
*/
- int (*set_data_name_suffix) (hicn_type_t type, hicn_protocol_t * h,
- const hicn_name_suffix_t * suffix);
+ int (*set_data_name_suffix) (hicn_type_t type, hicn_protocol_t *h,
+ const hicn_name_suffix_t *suffix);
/**
* @brief Retrieves a Data pathlabel
@@ -196,8 +195,8 @@ typedef struct hicn_ops_s
* @param [out] pathlabel - Retrieved pathlabel
* @return hICN error code
*/
- int (*get_data_pathlabel) (hicn_type_t type, const hicn_protocol_t * h,
- u32 * pathlabel);
+ int (*get_data_pathlabel) (hicn_type_t type, const hicn_protocol_t *h,
+ u32 *pathlabel);
/**
* @brief Sets a Data pathlabel
@@ -206,7 +205,7 @@ typedef struct hicn_ops_s
* @param [in] pathlabel - Pathlabel to set
* @return hICN error code
*/
- int (*set_data_pathlabel) (hicn_type_t type, hicn_protocol_t * h,
+ int (*set_data_pathlabel) (hicn_type_t type, hicn_protocol_t *h,
const u32 pathlabel);
/**
@@ -216,7 +215,7 @@ typedef struct hicn_ops_s
* @param [in] pathlabel - Face identifier used to update pathlabel
* @return hICN error code
*/
- int (*update_data_pathlabel) (hicn_type_t type, hicn_protocol_t * h,
+ int (*update_data_pathlabel) (hicn_type_t type, hicn_protocol_t *h,
const hicn_faceid_t face_id);
/**
@@ -225,7 +224,7 @@ typedef struct hicn_ops_s
* @param [in,out] h - Buffer holding the Data packet
* @return hICN error code
*/
- int (*reset_data_for_hash) (hicn_type_t type, hicn_protocol_t * h);
+ int (*reset_data_for_hash) (hicn_type_t type, hicn_protocol_t *h);
/**
* @brief Retrieves an Interest or Data lifetime
@@ -234,8 +233,8 @@ typedef struct hicn_ops_s
* @param [out] pathlabel - Retrieved lifetime
* @return hICN error code
*/
- int (*get_lifetime) (hicn_type_t type, const hicn_protocol_t * h,
- hicn_lifetime_t * lifetime);
+ int (*get_lifetime) (hicn_type_t type, const hicn_protocol_t *h,
+ hicn_lifetime_t *lifetime);
/**
* @brief Sets an Interest or Data lifetime
@@ -244,7 +243,7 @@ typedef struct hicn_ops_s
* @param [in] pathlabel - Lifetime to set
* @return hICN error code
*/
- int (*set_lifetime) (hicn_type_t type, hicn_protocol_t * h,
+ int (*set_lifetime) (hicn_type_t type, hicn_protocol_t *h,
const hicn_lifetime_t lifetime);
/**
@@ -257,19 +256,20 @@ typedef struct hicn_ops_s
* and used internally to carry payload length across protocol headers)
* @return hICN error code
*/
- int (*update_checksums) (hicn_type_t type, hicn_protocol_t * h,
+ int (*update_checksums) (hicn_type_t type, hicn_protocol_t *h,
u16 partial_csum, size_t payload_length);
/**
* @brief Validate all checksums in packet headers
* @param [in] type - hICN packet type
* @param [in] h - Buffer holding the packet
- * @param [in] partial_csum - Partial checksum, or zero if no partial checksum available
+ * @param [in] partial_csum - Partial checksum, or zero if no partial
+ * checksum available
* @param [in] payload_length - Payload length (can be set to ~0, retrieved
* and used internally to carry payload length across protocol headers)
* @return hICN error code
*/
- int (*verify_checksums) (hicn_type_t type, hicn_protocol_t * h,
+ int (*verify_checksums) (hicn_type_t type, hicn_protocol_t *h,
u16 partial_csum, size_t payload_length);
/**
@@ -281,9 +281,9 @@ typedef struct hicn_ops_s
* compute incremental checksums)
* @return hICN error code
*/
- int (*rewrite_interest) (hicn_type_t type, hicn_protocol_t * h,
- const ip46_address_t * addr_new,
- ip46_address_t * addr_old);
+ int (*rewrite_interest) (hicn_type_t type, hicn_protocol_t *h,
+ const ip46_address_t *addr_new,
+ ip46_address_t *addr_old);
/**
* @brief Rewrite a Data packet header (locator + pathlabel)
@@ -297,11 +297,10 @@ typedef struct hicn_ops_s
* before update it
* @return hICN error code
*/
- int (*rewrite_data) (hicn_type_t type, hicn_protocol_t * h,
- const ip46_address_t * addr_new,
- ip46_address_t * addr_old,
- const hicn_faceid_t face_id,
- u8 reset_pl);
+ int (*rewrite_data) (hicn_type_t type, hicn_protocol_t *h,
+ const ip46_address_t *addr_new,
+ ip46_address_t *addr_old, const hicn_faceid_t face_id,
+ u8 reset_pl);
/**
* @brief Return the packet length
@@ -310,8 +309,8 @@ typedef struct hicn_ops_s
* @parma [out] length - Returned packet length
* @return hICN error code
*/
- int (*get_length) (hicn_type_t type, const hicn_protocol_t * h,
- size_t * length);
+ int (*get_length) (hicn_type_t type, const hicn_protocol_t *h,
+ size_t *length);
/**
* @brief Return the current packet header length
@@ -320,9 +319,8 @@ typedef struct hicn_ops_s
* @parma [out] header_length - Returned packet current header length
* @return hICN error code
*/
- int (*get_current_header_length) (hicn_type_t type,
- const hicn_protocol_t * h,
- size_t * header_length);
+ int (*get_current_header_length) (hicn_type_t type, const hicn_protocol_t *h,
+ size_t *header_length);
/**
* @brief Return the packet header length
@@ -331,8 +329,8 @@ typedef struct hicn_ops_s
* @parma [out] header_length - Returned packet header length
* @return hICN error code
*/
- int (*get_header_length) (hicn_type_t type, const hicn_protocol_t * h,
- size_t * header_length);
+ int (*get_header_length) (hicn_type_t type, const hicn_protocol_t *h,
+ size_t *header_length);
/**
* @brief Return the packet payload length
@@ -341,8 +339,8 @@ typedef struct hicn_ops_s
* @parma [out] payload_length - Returned packet payload length
* @return hICN error code
*/
- int (*get_payload_length) (hicn_type_t type, const hicn_protocol_t * h,
- size_t * payload_length);
+ int (*get_payload_length) (hicn_type_t type, const hicn_protocol_t *h,
+ size_t *payload_length);
/**
* @brief Sets the packet paylaod length
@@ -351,7 +349,7 @@ typedef struct hicn_ops_s
* @parma [out] payload_length - Payload length to set
* @return hICN error code
*/
- int (*set_payload_length) (hicn_type_t type, hicn_protocol_t * h,
+ int (*set_payload_length) (hicn_type_t type, hicn_protocol_t *h,
size_t payload_length);
/**
@@ -361,8 +359,8 @@ typedef struct hicn_ops_s
* @param [out] signature_size - Retrieved signature size
* @return hICN error code
*/
- int (*get_signature_size) (hicn_type_t type, const hicn_protocol_t * h,
- size_t * signature_size);
+ int (*get_signature_size) (hicn_type_t type, const hicn_protocol_t *h,
+ size_t *signature_size);
/**
* @brief Sets an Interest or Data signature size
@@ -371,18 +369,41 @@ typedef struct hicn_ops_s
* @param [in] signature_size - Signature size to set
* @return hICN error code
*/
- int (*set_signature_size) (hicn_type_t type, hicn_protocol_t * h,
+ int (*set_signature_size) (hicn_type_t type, hicn_protocol_t *h,
size_t signature_size);
/**
+ * @brief Sets an Interest or Data signature gap between maximum size and
+ * real size
+ * @param [in] type - hICN packet type
+ * @param [in,out] h - Buffer holding the Interest or Data packet
+ * @param [in] signature_size - Signature size to set
+ * @return hICN error code
+ */
+ int (*set_signature_gap) (hicn_type_t type, hicn_protocol_t *h,
+ uint8_t signature_gap);
+
+ /**
+ * @brief gets an Interest or Data signature gap between maximum size and
+ * real size
+ * @param [in] type - hICN packet type
+ * @param [in,out] h - Buffer holding the Interest or Data packet
+ * @param [in] signature_size - retrieve the gap between maximum size and
+ * real size
+ * @return hICN error code
+ */
+ int (*get_signature_gap) (hicn_type_t type, const hicn_protocol_t *h,
+ uint8_t *signature_gap);
+
+ /**
* @brief Gets the signature timestamp
* @param [in] type - hICN packet type
* @param [in,out] h - Buffer holding the Interest or Data packet
* @param [out] signature_timestamp - Retrieved signature timestamp
* @return hICN error code
*/
- int (*get_signature_timestamp) (hicn_type_t type, const hicn_protocol_t * h,
- uint64_t *signature_timestamp);
+ int (*get_signature_timestamp) (hicn_type_t type, const hicn_protocol_t *h,
+ uint64_t *signature_timestamp);
/**
* @brief Sets the signature timestamp
@@ -391,9 +412,8 @@ typedef struct hicn_ops_s
* @param [in] signature_timestamp - Signature timestamp to set
* @return hICN error code
*/
- int (*set_signature_timestamp) (hicn_type_t type, hicn_protocol_t * h,
- uint64_t signature_timestamp);
-
+ int (*set_signature_timestamp) (hicn_type_t type, hicn_protocol_t *h,
+ uint64_t signature_timestamp);
/**
* @brief Gets the signature validation algorithm
@@ -402,8 +422,8 @@ typedef struct hicn_ops_s
* @param [out] validation_algorithm - Retrieved validation_algorithm
* @return hICN error code
*/
- int (*get_validation_algorithm) (hicn_type_t type, const hicn_protocol_t * h,
- uint8_t *validation_algorithm);
+ int (*get_validation_algorithm) (hicn_type_t type, const hicn_protocol_t *h,
+ uint8_t *validation_algorithm);
/**
* @brief Sets the signature validation algorithm
@@ -412,9 +432,8 @@ typedef struct hicn_ops_s
* @param [in] validation_algorithm - Validation algorithm enumeration
* @return hICN error code
*/
- int (*set_validation_algorithm) (hicn_type_t type, hicn_protocol_t * h,
- uint8_t validation_algorithm);
-
+ int (*set_validation_algorithm) (hicn_type_t type, hicn_protocol_t *h,
+ uint8_t validation_algorithm);
/**
* @brief Gets the key id
@@ -423,8 +442,8 @@ typedef struct hicn_ops_s
* @param [out] key_id - Retrieved key id first byte address
* @return hICN error code
*/
- int (*get_key_id) (hicn_type_t type, hicn_protocol_t * h,
- uint8_t **key_id, uint8_t *key_id_size);
+ int (*get_key_id) (hicn_type_t type, hicn_protocol_t *h, uint8_t **key_id,
+ uint8_t *key_id_size);
/**
* @brief Sets the key id
@@ -433,62 +452,69 @@ typedef struct hicn_ops_s
* @param [in] key_id - Key id first byte address
* @return hICN error code
*/
- int (*set_key_id) (hicn_type_t type, hicn_protocol_t * h,
- uint8_t *key_id);
+ int (*set_key_id) (hicn_type_t type, hicn_protocol_t *h, uint8_t *key_id);
- /**
+ /**
* @brief Get a pointer to the signature field in the packet
* @param [in] type - hICN packet type
* @param [in,out] h - Buffer holding the Interest or Data packet
- * @param [out] signature - Pointer to the memory region holding the signature
+ * @param [out] signature - Pointer to the memory region holding the
+ * signature
* @return hICN error code
*/
- int (*get_signature) (hicn_type_t type, hicn_protocol_t * h,
- uint8_t ** signature);
+ int (*get_signature) (hicn_type_t type, hicn_protocol_t *h,
+ uint8_t **signature);
} hicn_ops_t;
-#define DECLARE_HICN_OPS(protocol) \
- const hicn_ops_t hicn_ops_ ## protocol = { \
- ATTR_INIT(init_packet_header, protocol ## _init_packet_header), \
- ATTR_INIT(get_interest_locator, protocol ## _get_interest_locator), \
- ATTR_INIT(set_interest_locator, protocol ## _set_interest_locator), \
- ATTR_INIT(get_interest_name, protocol ## _get_interest_name), \
- ATTR_INIT(set_interest_name, protocol ## _set_interest_name), \
- ATTR_INIT(get_interest_name_suffix, protocol ## _get_interest_name_suffix), \
- 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(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), \
- ATTR_INIT(get_data_name, protocol ## _get_data_name), \
- ATTR_INIT(set_data_name, protocol ## _set_data_name), \
- ATTR_INIT(get_data_name_suffix, protocol ## _get_data_name_suffix), \
- ATTR_INIT(set_data_name_suffix, protocol ## _set_data_name_suffix), \
- ATTR_INIT(get_data_pathlabel, protocol ## _get_data_pathlabel), \
- ATTR_INIT(set_data_pathlabel, protocol ## _set_data_pathlabel), \
- ATTR_INIT(update_data_pathlabel, protocol ## _update_data_pathlabel), \
- ATTR_INIT(reset_data_for_hash, protocol ## _reset_data_for_hash), \
- ATTR_INIT(get_lifetime, protocol ## _get_lifetime), \
- ATTR_INIT(set_lifetime, protocol ## _set_lifetime), \
- ATTR_INIT(update_checksums, protocol ## _update_checksums), \
- ATTR_INIT(verify_checksums, protocol ## _verify_checksums), \
- ATTR_INIT(rewrite_interest, protocol ## _rewrite_interest), \
- ATTR_INIT(rewrite_data, protocol ## _rewrite_data), \
- ATTR_INIT(get_length, protocol ## _get_length), \
- ATTR_INIT(get_current_header_length,protocol ## _get_current_header_length),\
- ATTR_INIT(get_header_length, protocol ## _get_header_length), \
- ATTR_INIT(get_payload_length, protocol ## _get_payload_length), \
- ATTR_INIT(set_payload_length, protocol ## _set_payload_length), \
- ATTR_INIT(get_signature_size, protocol ## _get_signature_size), \
- ATTR_INIT(set_signature_size, protocol ## _set_signature_size), \
- ATTR_INIT(get_signature_timestamp, protocol ## _get_signature_timestamp), \
- ATTR_INIT(set_signature_timestamp, protocol ## _set_signature_timestamp), \
- ATTR_INIT(get_validation_algorithm, protocol ## _get_validation_algorithm), \
- ATTR_INIT(set_validation_algorithm, protocol ## _set_validation_algorithm), \
- ATTR_INIT(get_key_id, protocol ## _get_key_id), \
- ATTR_INIT(set_key_id, protocol ## _set_key_id), \
- ATTR_INIT(get_signature, protocol ## _get_signature), \
+#define DECLARE_HICN_OPS(protocol) \
+ const hicn_ops_t hicn_ops_##protocol = { \
+ ATTR_INIT (init_packet_header, protocol##_init_packet_header), \
+ ATTR_INIT (get_interest_locator, protocol##_get_interest_locator), \
+ ATTR_INIT (set_interest_locator, protocol##_set_interest_locator), \
+ ATTR_INIT (get_interest_name, protocol##_get_interest_name), \
+ ATTR_INIT (set_interest_name, protocol##_set_interest_name), \
+ ATTR_INIT (get_interest_name_suffix, \
+ protocol##_get_interest_name_suffix), \
+ 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 (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), \
+ ATTR_INIT (get_data_name, protocol##_get_data_name), \
+ ATTR_INIT (set_data_name, protocol##_set_data_name), \
+ ATTR_INIT (get_data_name_suffix, protocol##_get_data_name_suffix), \
+ ATTR_INIT (set_data_name_suffix, protocol##_set_data_name_suffix), \
+ ATTR_INIT (get_data_pathlabel, protocol##_get_data_pathlabel), \
+ ATTR_INIT (set_data_pathlabel, protocol##_set_data_pathlabel), \
+ ATTR_INIT (update_data_pathlabel, protocol##_update_data_pathlabel), \
+ ATTR_INIT (reset_data_for_hash, protocol##_reset_data_for_hash), \
+ ATTR_INIT (get_lifetime, protocol##_get_lifetime), \
+ ATTR_INIT (set_lifetime, protocol##_set_lifetime), \
+ ATTR_INIT (update_checksums, protocol##_update_checksums), \
+ ATTR_INIT (verify_checksums, protocol##_verify_checksums), \
+ ATTR_INIT (rewrite_interest, protocol##_rewrite_interest), \
+ ATTR_INIT (rewrite_data, protocol##_rewrite_data), \
+ ATTR_INIT (get_length, protocol##_get_length), \
+ ATTR_INIT (get_current_header_length, \
+ protocol##_get_current_header_length), \
+ ATTR_INIT (get_header_length, protocol##_get_header_length), \
+ ATTR_INIT (get_payload_length, protocol##_get_payload_length), \
+ ATTR_INIT (set_payload_length, protocol##_set_payload_length), \
+ ATTR_INIT (get_signature_size, protocol##_get_signature_size), \
+ ATTR_INIT (get_signature_timestamp, protocol##_get_signature_timestamp), \
+ ATTR_INIT (set_signature_timestamp, protocol##_set_signature_timestamp), \
+ ATTR_INIT (get_validation_algorithm, \
+ protocol##_get_validation_algorithm), \
+ ATTR_INIT (set_validation_algorithm, \
+ protocol##_set_validation_algorithm), \
+ ATTR_INIT (get_key_id, protocol##_get_key_id), \
+ ATTR_INIT (set_key_id, protocol##_set_key_id), \
+ ATTR_INIT (get_signature, protocol##_get_signature), \
+ ATTR_INIT (set_signature_gap, protocol##_set_signature_gap), \
+ ATTR_INIT (set_signature_size, protocol##_set_signature_size), \
+ ATTR_INIT (get_signature_gap, protocol##_get_signature_gap), \
}
/**
@@ -500,13 +526,14 @@ extern const hicn_ops_t *const hicn_ops_vft[];
/*
* Helpers for writing recursive protocol operations on packet headers
*
- * NOTE : we cannot use a shift operation as IPPROTO_NONE != 0 (and 0 is IPv4...)
+ * NOTE : we cannot use a shift operation as IPPROTO_NONE != 0 (and 0 is
+ * IPv4...)
*/
always_inline hicn_type_t
TYPE_POP (hicn_type_t type)
{
#ifndef _WIN32
- return HICN_TYPE(type.l2, type.l3, type.l4, IPPROTO_NONE);
+ return HICN_TYPE (type.l2, type.l3, type.l4, IPPROTO_NONE);
#else
hicn_type_t new_type;
new_type.l1 = type.l2;
@@ -518,17 +545,19 @@ TYPE_POP (hicn_type_t type)
}
always_inline hicn_protocol_t *
-PAYLOAD (hicn_type_t type, const hicn_protocol_t * h)
+PAYLOAD (hicn_type_t type, const hicn_protocol_t *h)
{
size_t header_length;
- int rc = hicn_ops_vft[type.l1]->get_current_header_length (type, h,
- &header_length);
+ int rc =
+ hicn_ops_vft[type.l1]->get_current_header_length (type, h, &header_length);
if (rc < 0)
return NULL;
return (hicn_protocol_t *) ((u8 *) h + header_length);
}
-#define CHILD_OPS(f, type, h, ...) (hicn_ops_vft[type.l2]->f(TYPE_POP(type), PAYLOAD(type, h), ## __VA_ARGS__))
+#define CHILD_OPS(f, type, h, ...) \
+ (hicn_ops_vft[type.l2]->f (TYPE_POP (type), PAYLOAD (type, h), \
+ ##__VA_ARGS__))
/** Shortcuts to entry points in VFT */
#define HICN_OPS4 hicn_ops_vft[IPPROTO_IP]
@@ -536,125 +565,300 @@ PAYLOAD (hicn_type_t type, const hicn_protocol_t * h)
/* Helpers for simple declarations */
-#define DECLARE_init_packet_header(protocol, error) \
- int protocol ## _init_packet_header(hicn_type_t type, hicn_protocol_t * h) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_init_packet_header(protocol, error) \
+ int protocol##_init_packet_header (hicn_type_t type, hicn_protocol_t *h) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_interest_locator(protocol, error) \
- int protocol ## _get_interest_locator(hicn_type_t type, const hicn_protocol_t * h, ip46_address_t * ip_address) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_interest_locator(protocol, error) \
+ int protocol##_get_interest_locator ( \
+ hicn_type_t type, const hicn_protocol_t *h, ip46_address_t *ip_address) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_set_interest_locator(protocol, error) \
- int protocol ## _set_interest_locator(hicn_type_t type, hicn_protocol_t * h, const ip46_address_t * ip_address) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_set_interest_locator(protocol, error) \
+ int protocol##_set_interest_locator (hicn_type_t type, hicn_protocol_t *h, \
+ const ip46_address_t *ip_address) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_interest_name(protocol, error) \
- int protocol ## _get_interest_name(hicn_type_t type, const hicn_protocol_t * h, hicn_name_t * name) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_interest_name(protocol, error) \
+ int protocol##_get_interest_name ( \
+ hicn_type_t type, const hicn_protocol_t *h, hicn_name_t *name) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_set_interest_name(protocol, error) \
- int protocol ## _set_interest_name(hicn_type_t type, hicn_protocol_t * h, const hicn_name_t * name) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_set_interest_name(protocol, error) \
+ int protocol##_set_interest_name (hicn_type_t type, hicn_protocol_t *h, \
+ const hicn_name_t *name) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_interest_name_suffix(protocol, error) \
- int protocol ## _get_interest_name_suffix(hicn_type_t type, const hicn_protocol_t * h, hicn_name_suffix_t * suffix) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_interest_name_suffix(protocol, error) \
+ int protocol##_get_interest_name_suffix ( \
+ hicn_type_t type, const hicn_protocol_t *h, hicn_name_suffix_t *suffix) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_set_interest_name_suffix(protocol, error) \
- int protocol ## _set_interest_name_suffix(hicn_type_t type, hicn_protocol_t * h, const hicn_name_suffix_t * suffix) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_set_interest_name_suffix(protocol, error) \
+ int protocol##_set_interest_name_suffix ( \
+ hicn_type_t type, hicn_protocol_t *h, const hicn_name_suffix_t *suffix) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_mark_packet_as_interest(protocol, error) \
- int protocol ## _mark_packet_as_interest(hicn_type_t type, hicn_protocol_t * h) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_mark_packet_as_interest(protocol, error) \
+ int protocol##_mark_packet_as_interest (hicn_type_t type, \
+ hicn_protocol_t *h) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
+
+#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_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_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; \
+ }
-#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 ; }
+#define DECLARE_get_data_locator(protocol, error) \
+ int protocol##_get_data_locator ( \
+ hicn_type_t type, const hicn_protocol_t *h, ip46_address_t *ip_address) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
+
+#define DECLARE_set_data_locator(protocol, error) \
+ int protocol##_set_data_locator (hicn_type_t type, hicn_protocol_t *h, \
+ const ip46_address_t *ip_address) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_data_locator(protocol, error) \
- int protocol ## _get_data_locator(hicn_type_t type, const hicn_protocol_t * h, ip46_address_t * ip_address) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_data_name(protocol, error) \
+ int protocol##_get_data_name (hicn_type_t type, const hicn_protocol_t *h, \
+ hicn_name_t *name) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_set_data_locator(protocol, error) \
- int protocol ## _set_data_locator(hicn_type_t type, hicn_protocol_t * h, const ip46_address_t * ip_address) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_set_data_name(protocol, error) \
+ int protocol##_set_data_name (hicn_type_t type, hicn_protocol_t *h, \
+ const hicn_name_t *name) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_data_name(protocol, error) \
- int protocol ## _get_data_name(hicn_type_t type, const hicn_protocol_t * h, hicn_name_t * name) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_data_name_suffix(protocol, error) \
+ int protocol##_get_data_name_suffix ( \
+ hicn_type_t type, const hicn_protocol_t *h, hicn_name_suffix_t *suffix) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_set_data_name(protocol, error) \
- int protocol ## _set_data_name(hicn_type_t type, hicn_protocol_t * h, const hicn_name_t * name) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_set_data_name_suffix(protocol, error) \
+ int protocol##_set_data_name_suffix (hicn_type_t type, hicn_protocol_t *h, \
+ const hicn_name_suffix_t *suffix) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_data_name_suffix(protocol, error) \
- int protocol ## _get_data_name_suffix(hicn_type_t type, const hicn_protocol_t * h, hicn_name_suffix_t * suffix) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_data_pathlabel(protocol, error) \
+ int protocol##_get_data_pathlabel ( \
+ hicn_type_t type, const hicn_protocol_t *h, u32 *pathlabel) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_set_data_name_suffix(protocol, error) \
- int protocol ## _set_data_name_suffix(hicn_type_t type, hicn_protocol_t * h, const hicn_name_suffix_t * suffix) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_set_data_pathlabel(protocol, error) \
+ int protocol##_set_data_pathlabel (hicn_type_t type, hicn_protocol_t *h, \
+ const u32 pathlabel) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_data_pathlabel(protocol, error) \
- int protocol ## _get_data_pathlabel(hicn_type_t type, const hicn_protocol_t * h, u32 * pathlabel) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_update_data_pathlabel(protocol, error) \
+ int protocol##_update_data_pathlabel (hicn_type_t type, hicn_protocol_t *h, \
+ const hicn_faceid_t face_id) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_set_data_pathlabel(protocol, error) \
- int protocol ## _set_data_pathlabel(hicn_type_t type, hicn_protocol_t * h, const u32 pathlabel) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_reset_data_for_hash(protocol, error) \
+ int protocol##_reset_data_for_hash (hicn_type_t type, hicn_protocol_t *h) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_update_data_pathlabel(protocol, error) \
- int protocol ## _update_data_pathlabel(hicn_type_t type, hicn_protocol_t * h, const hicn_faceid_t face_id) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_lifetime(protocol, error) \
+ int protocol##_get_lifetime (hicn_type_t type, const hicn_protocol_t *h, \
+ hicn_lifetime_t *lifetime) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_reset_data_for_hash(protocol, error) \
- int protocol ## _reset_data_for_hash(hicn_type_t type, hicn_protocol_t * h) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_set_lifetime(protocol, error) \
+ int protocol##_set_lifetime (hicn_type_t type, hicn_protocol_t *h, \
+ const hicn_lifetime_t lifetime) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_lifetime(protocol, error) \
- int protocol ## _get_lifetime(hicn_type_t type, const hicn_protocol_t * h, hicn_lifetime_t * lifetime) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_update_checksums(protocol, error) \
+ int protocol##_update_checksums (hicn_type_t type, hicn_protocol_t *h, \
+ u16 partial_csum, size_t payload_length) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_set_lifetime(protocol, error) \
- int protocol ## _set_lifetime(hicn_type_t type, hicn_protocol_t * h, const hicn_lifetime_t lifetime) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_verify_checksums(protocol, error) \
+ int protocol##_verify_checksums (hicn_type_t type, hicn_protocol_t *h, \
+ u16 partial_csum, size_t payload_length) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_update_checksums(protocol, error) \
- int protocol ## _update_checksums(hicn_type_t type, hicn_protocol_t * h, u16 partial_csum, size_t payload_length) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_rewrite_interest(protocol, error) \
+ int protocol##_rewrite_interest (hicn_type_t type, hicn_protocol_t *h, \
+ const ip46_address_t *addr_new, \
+ ip46_address_t *addr_old) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_verify_checksums(protocol, error) \
- int protocol ## _verify_checksums(hicn_type_t type, hicn_protocol_t * h, u16 partial_csum, size_t payload_length) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_rewrite_data(protocol, error) \
+ int protocol##_rewrite_data ( \
+ hicn_type_t type, hicn_protocol_t *h, const ip46_address_t *addr_new, \
+ ip46_address_t *addr_old, const hicn_faceid_t face_id, u8 reset_pl) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_rewrite_interest(protocol, error) \
- int protocol ## _rewrite_interest(hicn_type_t type, hicn_protocol_t * h, const ip46_address_t * addr_new, ip46_address_t * addr_old) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_length(protocol, error) \
+ int protocol##_get_length (hicn_type_t type, const hicn_protocol_t *h, \
+ size_t *length) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_rewrite_data(protocol, error) \
- int protocol ## _rewrite_data(hicn_type_t type, hicn_protocol_t * h, const ip46_address_t * addr_new, ip46_address_t * addr_old, const hicn_faceid_t face_id, u8 reset_pl) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_current_header_length(protocol, error) \
+ int protocol##_get_current_header_length ( \
+ hicn_type_t type, const hicn_protocol_t *h, size_t *header_length) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_length(protocol, error) \
- int protocol ## _get_length(hicn_type_t type, const hicn_protocol_t * h, size_t * length) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_header_length(protocol, error) \
+ int protocol##_get_header_length ( \
+ hicn_type_t type, const hicn_protocol_t *h, size_t *header_length) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_current_header_length(protocol, error) \
- int protocol ## _get_current_header_length(hicn_type_t type, const hicn_protocol_t * h, size_t * header_length) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_payload_length(protocol, error) \
+ int protocol##_get_payload_length ( \
+ hicn_type_t type, const hicn_protocol_t *h, size_t *payload_length) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_header_length(protocol, error) \
- int protocol ## _get_header_length(hicn_type_t type, const hicn_protocol_t * h, size_t * header_length) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_set_payload_length(protocol, error) \
+ int protocol##_set_payload_length (hicn_type_t type, hicn_protocol_t *h, \
+ size_t payload_length) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_payload_length(protocol, error) \
- int protocol ## _get_payload_length(hicn_type_t type, const hicn_protocol_t * h, size_t * payload_length) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_signature_size(protocol, error) \
+ int protocol##_get_signature_size ( \
+ hicn_type_t type, const hicn_protocol_t *h, size_t *signature_size) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_set_payload_length(protocol, error) \
- int protocol ## _set_payload_length(hicn_type_t type, hicn_protocol_t * h, size_t payload_length) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_set_signature_size(protocol, error) \
+ int protocol##_set_signature_size (hicn_type_t type, hicn_protocol_t *h, \
+ size_t signature_size) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_signature_size(protocol, error) \
- int protocol ## _get_signature_size(hicn_type_t type, const hicn_protocol_t * h, size_t * signature_size) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_set_signature_gap(protocol, error) \
+ int protocol##_set_signature_gap (hicn_type_t type, hicn_protocol_t *h, \
+ uint8_t signature_size) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_set_signature_size(protocol, error) \
- int protocol ## _set_signature_size(hicn_type_t type, hicn_protocol_t * h, size_t signature_size) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_signature_gap(protocol, error) \
+ int protocol##_get_signature_gap ( \
+ hicn_type_t type, const hicn_protocol_t *h, uint8_t *signature_size) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_set_signature_timestamp(protocol, error) \
- int protocol ## _set_signature_timestamp(hicn_type_t type, hicn_protocol_t * h, uint64_t signature_timestamp) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_set_signature_timestamp(protocol, error) \
+ int protocol##_set_signature_timestamp ( \
+ hicn_type_t type, hicn_protocol_t *h, uint64_t signature_timestamp) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_signature_timestamp(protocol, error) \
- int protocol ## _get_signature_timestamp(hicn_type_t type, const hicn_protocol_t * h, uint64_t * signature_timestamp) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_signature_timestamp(protocol, error) \
+ int protocol##_get_signature_timestamp (hicn_type_t type, \
+ const hicn_protocol_t *h, \
+ uint64_t *signature_timestamp) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_set_validation_algorithm(protocol, error) \
- int protocol ## _set_validation_algorithm(hicn_type_t type, hicn_protocol_t * h, uint8_t validation_algorithm) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_set_validation_algorithm(protocol, error) \
+ int protocol##_set_validation_algorithm ( \
+ hicn_type_t type, hicn_protocol_t *h, uint8_t validation_algorithm) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_validation_algorithm(protocol, error) \
- int protocol ## _get_validation_algorithm(hicn_type_t type, const hicn_protocol_t * h, uint8_t * validation_algorithm) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_validation_algorithm(protocol, error) \
+ int protocol##_get_validation_algorithm (hicn_type_t type, \
+ const hicn_protocol_t *h, \
+ uint8_t *validation_algorithm) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_set_key_id(protocol, error) \
- int protocol ## _set_key_id(hicn_type_t type, hicn_protocol_t * h, uint8_t * key_id) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_set_key_id(protocol, error) \
+ int protocol##_set_key_id (hicn_type_t type, hicn_protocol_t *h, \
+ uint8_t *key_id) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_key_id(protocol, error) \
- int protocol ## _get_key_id(hicn_type_t type, hicn_protocol_t * h, uint8_t ** key_id, uint8_t *key_id_size) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_key_id(protocol, error) \
+ int protocol##_get_key_id (hicn_type_t type, hicn_protocol_t *h, \
+ uint8_t **key_id, uint8_t *key_id_size) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
-#define DECLARE_get_signature(protocol, error) \
- int protocol ## _get_signature(hicn_type_t type, hicn_protocol_t * h, uint8_t ** signature) { return HICN_LIB_ERROR_ ## error ; }
+#define DECLARE_get_signature(protocol, error) \
+ int protocol##_get_signature (hicn_type_t type, hicn_protocol_t *h, \
+ uint8_t **signature) \
+ { \
+ return HICN_LIB_ERROR_##error; \
+ }
#endif /* HICN_OPS_H */
diff --git a/lib/includes/hicn/protocol/ah.h b/lib/includes/hicn/protocol/ah.h
index a59a5051a..575da80d7 100644
--- a/lib/includes/hicn/protocol/ah.h
+++ b/lib/includes/hicn/protocol/ah.h
@@ -35,16 +35,19 @@
typedef struct
{
- u8 nh; // (to match with reserved in IPSEC AH)
- u8 payloadlen; // Len of signature/HMAC in 4-bytes words
+ u8 nh; // (to match with reserved in IPSEC AH)
+ u8 payloadlen; // Len of signature/HMAC in 4-bytes words (maximum size)
union
{
u16 reserved;
struct
{
- u8 validationAlgorithm; // As defined in parc_SignerAlgorithm.h
- u8 unused; // Unused (to match with reserved in IPSEC AH)
+ u8 validationAlgorithm; // As defined in parc_SignerAlgorithm.h
+ u8 signatureGap; // used to match IPSEC specification and to
+ // have the real size of the signature(without
+ // padding). It is the result of Maximum
+ // signature size - real size
};
};
union
@@ -60,12 +63,12 @@ typedef struct
u32 timestamp_as_u32[2];
};
// ICV would follow
- u8 keyId[32]; // Hash of the pub key
+ u8 keyId[32]; // Hash of pub key
/* 44 B + validationPayload */
- u8 validationPayload[0]; // Holds the signature
+ u8 validationPayload[0]; // Holds the signature
} _ah_header_t;
-#define AH_HDRLEN sizeof(_ah_header_t)
+#define AH_HDRLEN sizeof (_ah_header_t)
static_assert (EXPECTED_AH_HDRLEN == AH_HDRLEN,
"Size of AH Struct does not match its expected size.");