aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/includes/hicn/packet.h56
-rw-r--r--lib/src/packet.c2
2 files changed, 38 insertions, 20 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)
diff --git a/lib/src/packet.c b/lib/src/packet.c
index ccef568cd..ad86afb66 100644
--- a/lib/src/packet.c
+++ b/lib/src/packet.c
@@ -250,7 +250,7 @@ hicn_packet_analyze (hicn_packet_buffer_t *pkbuf)
}
pkbuf->payload = offset;
- rc = CALL (get_type, pkbuf, &pkbuf->type);
+ rc = CALL (get_type, pkbuf, (hicn_packet_type_t *) (&pkbuf->type));
if (rc < 0)
goto ERR;