]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_msg.h
pimd: Assume buffer size passed in is of sufficient size
[mirror_frr.git] / pimd / pim_msg.h
CommitLineData
12e41d03
DL
1/*
2 PIM for Quagga
3 Copyright (C) 2008 Everton da Silva Marques
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING; if not, write to the
17 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
18 MA 02110-1301 USA
12e41d03
DL
19*/
20
21#ifndef PIM_MSG_H
22#define PIM_MSG_H
23
24#include <netinet/in.h>
25
26/*
27 Number Description
28 ---------- ------------------
29 0 Reserved
30 1 IP (IP version 4)
31 2 IP6 (IP version 6)
32
33 From:
34 http://www.iana.org/assignments/address-family-numbers
35*/
36#define PIM_MSG_ADDRESS_FAMILY_IPV4 (1)
37
70ce34ae
DS
38/*
39 * Network Order pim_msg_hdr
40 */
41struct pim_msg_header {
42 uint8_t type:4;
43 uint8_t ver:4;
44 uint8_t reserved;
45 uint16_t checksum;
46} __attribute__ ((packed));
47
f8e7d799
DS
48void pim_msg_build_header(uint8_t *pim_msg, size_t pim_msg_size, uint8_t pim_msg_type);
49uint8_t *pim_msg_addr_encode_ipv4_ucast(uint8_t *buf, struct in_addr addr);
50uint8_t *pim_msg_addr_encode_ipv4_group(uint8_t *buf, struct in_addr addr);
984c84f4
DS
51
52#define PIM_ENCODE_SPARSE_BIT 0x04
53#define PIM_ENCODE_WC_BIT 0x02
54#define PIM_ENCODE_RPT_BIT 0x01
12e41d03 55uint8_t *pim_msg_addr_encode_ipv4_source(uint8_t *buf,
f8e7d799 56 struct in_addr addr, uint8_t bits);
12e41d03 57
346cffe3 58
f8e7d799
DS
59int pim_msg_join_prune_encode (uint8_t *buf, size_t buf_size, int is_join,
60 struct pim_upstream *up,
61 struct in_addr upstream, int holdtime);
12e41d03 62#endif /* PIM_MSG_H */