aboutsummaryrefslogtreecommitdiffstats
path: root/lib/src/protocol/icmp.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/src/protocol/icmp.h')
-rw-r--r--lib/src/protocol/icmp.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/src/protocol/icmp.h b/lib/src/protocol/icmp.h
index 5a84995b6..36954bb6d 100644
--- a/lib/src/protocol/icmp.h
+++ b/lib/src/protocol/icmp.h
@@ -22,6 +22,11 @@
#include "../common.h"
+/*
+ * The length of the ICMP header struct must be 4 bytes.
+ */
+#define EXPECTED_ICMP_HDRLEN 4
+
typedef struct
{
u8 type;
@@ -29,6 +34,15 @@ typedef struct
u16 csum;
} _icmp_header_t;
+#define ICMP_HDRLEN sizeof(_icmp_header_t)
+static_assert (EXPECTED_ICMP_HDRLEN == ICMP_HDRLEN,
+ "Size of ICMP struct does not match its expected size.");
+
+/*
+ * The length of the ICMPWLDR header struct must be 4 bytes.
+ */
+#define EXPECTED_ICMPWLDR_HDRLEN 8
+
typedef struct
{
u8 type;
@@ -55,7 +69,9 @@ typedef struct
};
} _icmp_wldr_header_t;
-#define ICMP_HDRLEN sizeof(_icmp_header_t)
+#define ICMPWLDR_HDRLEN sizeof(_icmp_wldr_header_t)
+static_assert (EXPECTED_ICMPWLDR_HDRLEN == ICMPWLDR_HDRLEN,
+ "Size of ICMPWLDR struct does not match its expected size.");
#endif /* HICN_PROTOCOL_ICMP_H */