diff options
author | 2019-02-11 23:50:45 +0100 | |
---|---|---|
committer | 2019-02-12 13:15:47 +0000 | |
commit | fbd4dd9c5eba6f8f10bcc0db30a72ea3378c149b (patch) | |
tree | e65187748120c945e39256084d5614ed127b8383 /lib/src/protocol/udp.h | |
parent | f126f86da5acf088f24e97ecb32f9ba5a1789aa4 (diff) |
[HICN-51] Add static assert for ensuring correct struct size in libhicn definitions.
Change-Id: Ib41e9cbdd2ea84a40eb4e7b01da131cbad9575c4
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'lib/src/protocol/udp.h')
-rw-r--r-- | lib/src/protocol/udp.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/src/protocol/udp.h b/lib/src/protocol/udp.h index 58cd65095..75d1ea98c 100644 --- a/lib/src/protocol/udp.h +++ b/lib/src/protocol/udp.h @@ -16,6 +16,11 @@ #ifndef HICN_PROTOCOL_UDP_H #define HICN_PROTOCOL_UDP_H +/* + * The length of the UDP header struct must be 8 bytes. + */ +#define EXPECTED_UDP_HDRLEN 8 + typedef struct { u16 src_port; @@ -25,6 +30,8 @@ typedef struct } _udp_header_t; #define UDP_HDRLEN sizeof(_udp_header_t) +static_assert (EXPECTED_UDP_HDRLEN == UDP_HDRLEN, + "Size of UDP struct does not match its expected size."); #endif /* HICN_PROTOCOL_UDP_H */ |