summaryrefslogtreecommitdiff
path: root/pimd/pim_msg.h
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-02-10 14:05:42 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-02-24 10:03:40 -0500
commit74ac496fcbf976bebaa76728090c68c74865a66d (patch)
treeb83351d5cdadac1cfef1f693b5d17441f88fb0a1 /pimd/pim_msg.h
parentf8e7d7992fe201052e3969bdd4aab217ffd4d505 (diff)
pimd: Add packed data structures for building j/p messages
Switch pim over to using packed data structures for building Join/Prune messages to be sent. This is a pre-cursor to the ability to handle the ability to aggregate Join/Prune messages together. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_msg.h')
-rw-r--r--pimd/pim_msg.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/pimd/pim_msg.h b/pimd/pim_msg.h
index 3be37ac368..3af8486d5d 100644
--- a/pimd/pim_msg.h
+++ b/pimd/pim_msg.h
@@ -45,6 +45,44 @@ struct pim_msg_header {
uint16_t checksum;
} __attribute__ ((packed));
+struct pim_encoded_ipv4_unicast {
+ uint8_t family;
+ uint8_t reserved;
+ struct in_addr addr;
+} __attribute__ ((packed));
+
+struct pim_encoded_group_ipv4 {
+ uint8_t ne;
+ uint8_t family;
+ uint8_t reserved;
+ uint8_t mask;
+ struct in_addr addr;
+} __attribute__ ((packed));
+
+struct pim_encoded_source_ipv4 {
+ uint8_t ne;
+ uint8_t family;
+ uint8_t bits;
+ uint8_t mask;
+ struct in_addr addr;
+} __attribute__ ((packed));
+
+struct pim_jp_groups {
+ struct pim_encoded_group_ipv4 g;
+ uint16_t joins;
+ uint16_t prunes;
+ struct pim_encoded_source_ipv4 s[1];
+} __attribute__ ((packed));
+
+struct pim_jp {
+ struct pim_msg_header header;
+ struct pim_encoded_ipv4_unicast addr;
+ uint8_t reserved;
+ uint8_t num_groups;
+ uint16_t holdtime;
+ struct pim_jp_groups groups[1];
+} __attribute__ ((packed));
+
void pim_msg_build_header(uint8_t *pim_msg, size_t pim_msg_size, uint8_t pim_msg_type);
uint8_t *pim_msg_addr_encode_ipv4_ucast(uint8_t *buf, struct in_addr addr);
uint8_t *pim_msg_addr_encode_ipv4_group(uint8_t *buf, struct in_addr addr);