summaryrefslogtreecommitdiffstats
path: root/src/packet.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-03-19 03:44:27 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-03-19 03:44:27 +0100
commit5d068fa244f65c7df2cd6a8e5c6e04dc7e2c9f15 (patch)
treef909de7ea843bbc2eedd600bf1169e18c8b65b34 /src/packet.h
parent415606c73661aa9788a6a16dfc8a75b305246992 (diff)
downloadbabel-5d068fa244f65c7df2cd6a8e5c6e04dc7e2c9f15.tar
babel-5d068fa244f65c7df2cd6a8e5c6e04dc7e2c9f15.zip
Add gp_babel_packet_size() function
Diffstat (limited to 'src/packet.h')
-rw-r--r--src/packet.h6
1 files changed, 6 insertions, 0 deletions
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 <arpa/inet.h>
+
#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_ */