From 5d068fa244f65c7df2cd6a8e5c6e04dc7e2c9f15 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 19 Mar 2013 03:44:27 +0100 Subject: Add gp_babel_packet_size() function --- src/packet.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/packet.h') diff --git a/src/packet.h b/src/packet.h index a27b644..286192e 100644 --- a/src/packet.h +++ b/src/packet.h @@ -29,6 +29,8 @@ #include "types.h" +#include + #define GP_BABEL_VERSION 0 @@ -39,5 +41,9 @@ struct __attribute__((packed)) gp_babel_packet { uint8_t tlv[]; }; +static inline size_t gp_babel_packet_size(const gp_babel_packet_t *packet) { + return sizeof(gp_babel_packet_t)+ntohs(packet->len); +} + #endif /* _GMRF_PROTO_BABEL_PACKET_H_ */ -- cgit v1.2.3