]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_msdp_packet.h
pimd: Do not allow deletion of output interface.
[mirror_frr.git] / pimd / pim_msdp_packet.h
CommitLineData
2a333e0f 1/*
2 * IP MSDP packet helpers
3 * Copyright (C) 2016 Cumulus Networks, Inc.
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
19 */
20#ifndef PIM_MSDP_PACKET_H
21#define PIM_MSDP_PACKET_H
22
23/* type and length of a single tlv can be consider packet header */
24#define PIM_MSDP_HEADER_SIZE 3
3c72d654 25
26/* Keepalive TLV
27 0 1 2 3
28 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
29+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
30| 4 | 3 |
31+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32*/
2a333e0f 33#define PIM_MSDP_KA_TLV_MAX_SIZE PIM_MSDP_HEADER_SIZE
3c72d654 34
35/* Source-Active TLV (x=8, y=12xEntryCount)
36 0 1 2 3
37 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
38+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
39| 1 | x + y | Entry Count |
40+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41| RP Address |
42+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43| Reserved | Sprefix Len | \
44+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \
45| Group Address | ) z
46+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ /
47| Source Address | /
48+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
49*/
50#define PIM_MSDP_SA_TLV_MAX_SIZE 9192
51#define PIM_MSDP_SA_X_SIZE 8
52#define PIM_MSDP_SA_ONE_ENTRY_SIZE 12
53#define PIM_MSDP_SA_Y_SIZE(entry_cnt) (PIM_MSDP_SA_ONE_ENTRY_SIZE * entry_cnt)
54#define PIM_MSDP_SA_ENTRY_CNT2SIZE(entry_cnt) (PIM_MSDP_SA_X_SIZE +\
55 PIM_MSDP_SA_Y_SIZE(entry_cnt))
56/* SA TLV has to have atleast only one entry in it so x=8 + y=12 */
57#define PIM_MSDP_SA_TLV_MIN_SIZE PIM_MSDP_SA_ENTRY_CNT2SIZE(1)
58#define PIM_MSDP_SA_MAX_ENTRY_CNT ((PIM_MSDP_SA_TLV_MAX_SIZE - PIM_MSDP_SA_X_SIZE)/PIM_MSDP_SA_ONE_ENTRY_SIZE)
59
15ad0c71 60#define PIM_MSDP_MAX_PACKET_SIZE max(PIM_MSDP_SA_TLV_MAX_SIZE, PIM_MSDP_KA_TLV_MAX_SIZE)
2a333e0f 61
62#define PIM_MSDP_PKT_TYPE_STRLEN 16
63
64void pim_msdp_pkt_ka_tx(struct pim_msdp_peer *mp);
65int pim_msdp_read(struct thread *thread);
3c72d654 66void pim_msdp_pkt_sa_tx(void);
67void pim_msdp_pkt_sa_tx_one(struct pim_msdp_sa *sa);
68void pim_msdp_pkt_sa_tx_to_one_peer(struct pim_msdp_peer *mp);
69
2a333e0f 70#endif