diff options
author | 2019-02-07 13:12:19 +0100 | |
---|---|---|
committer | 2019-02-07 13:15:40 +0000 | |
commit | db1afad8749fce983636456c16c9df9c24d73af4 (patch) | |
tree | d78492674a1fbc5b923941991542d8115e11493d /lib/src/ops.h | |
parent | 216e35ba535efa00af39b7624f363ca832836e3f (diff) |
[HICN-39] Added api that return a pointer to the signature hold in a packet
[HICN-40] Fixed signature calculation by allocating a contiguous portion of
memory that holds the entire hICN header (IP+TCP+AH)
Change-Id: I9d40bab0e3ecb82949b8b3a00e2cc1214457e4e3
Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'lib/src/ops.h')
-rw-r--r-- | lib/src/ops.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/src/ops.h b/lib/src/ops.h index b698a53fd..47795efd5 100644 --- a/lib/src/ops.h +++ b/lib/src/ops.h @@ -418,7 +418,15 @@ typedef struct hicn_ops_s 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 + * @return hICN error code + */ + int (*get_signature) (hicn_type_t type, hicn_protocol_t * h, + uint8_t ** signature); } hicn_ops_t; #define DECLARE_HICN_OPS(protocol) \ @@ -459,7 +467,8 @@ typedef struct hicn_ops_s 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(set_key_id, protocol ## _set_key_id), \ + ATTR_INIT(get_signature, protocol ## _get_signature), \ } /** @@ -618,6 +627,9 @@ PAYLOAD (hicn_type_t type, const hicn_protocol_t * h) #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 ; } + #endif /* HICN_OPS_H */ /* |