summaryrefslogtreecommitdiffstats
path: root/lib/includes
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2022-08-25 15:19:33 +0000
committerMauro Sardara <msardara@cisco.com>2022-08-26 09:22:06 +0000
commit456a47ffcfb256beaae0b04d9021035c0e154ace (patch)
tree71ac9a44716c50e6381425b80f6ece15a1086e9b /lib/includes
parent020099fdb3b1a0fa482f8813c7a7147c1720fbc8 (diff)
feat: resize hicn_buffer_t to 24 byes
Ref: HICN-746 Change-Id: I70d526aa81c158a128408cff7e7a2d8e09ceb01a Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'lib/includes')
-rw-r--r--lib/includes/hicn/packet.h56
1 files changed, 37 insertions, 19 deletions
diff --git a/lib/includes/hicn/packet.h b/lib/includes/hicn/packet.h
index c64014fe6..85f76d21b 100644
--- a/lib/includes/hicn/packet.h
+++ b/lib/includes/hicn/packet.h
@@ -38,12 +38,6 @@
typedef struct __attribute__ ((packed))
{
- /* Packet format */
- hicn_packet_format_t format;
-
- /* Packet type */
- hicn_packet_type_t type;
-
/*
* We store an offset to the packet header.
*
@@ -56,7 +50,24 @@ typedef struct __attribute__ ((packed))
*/
int64_t header;
- /* Packet len */
+ /*
+ * Packet format [4]
+ */
+ hicn_packet_format_t format;
+
+ /*
+ * Packet type [2]
+ */
+ uint16_t type;
+
+ /*
+ * Buffer size [2]
+ */
+ uint16_t buffer_size;
+
+ /*
+ * Packet len [2]
+ */
uint16_t len;
#ifdef OPAQUE_IP
@@ -67,25 +78,32 @@ typedef struct __attribute__ ((packed))
uint16_t ipv6;
};
#endif /* OPAQUE_IP */
+ /*
+ * L4 offset [1]
+ */
union
{
- uint16_t tcp;
- uint16_t udp;
- uint16_t icmp;
+ uint8_t tcp;
+ uint8_t udp;
+ uint8_t icmp;
};
- uint16_t newhdr;
- uint16_t ah;
- uint16_t payload;
-
- uint16_t buffer_size;
- // uint16_t len;
+ /*
+ * New header offset [1]
+ */
+ uint8_t newhdr;
- /* Contiguous copy of the name */
- // hicn_name_t *name;
+ /*
+ * AH offset [2]
+ */
+ uint16_t ah;
+ /*
+ * Payload offset [2]
+ */
+ uint16_t payload;
} hicn_packet_buffer_t;
-static_assert (sizeof (hicn_packet_buffer_t) == 28, "");
+static_assert (sizeof (hicn_packet_buffer_t) == 24, "");
static inline uint8_t *
_pkbuf_get_ipv4 (const hicn_packet_buffer_t *pkbuf)