]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_assert.h
*: auto-convert to SPDX License IDs
[mirror_frr.git] / pimd / pim_assert.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * PIM for Quagga
4 * Copyright (C) 2008 Everton da Silva Marques
5 */
6
7 #ifndef PIM_ASSERT_H
8 #define PIM_ASSERT_H
9
10 #include <zebra.h>
11
12 #include "if.h"
13
14 struct pim_ifchannel;
15 struct pim_neighbor;
16
17 enum pim_ifassert_state {
18 PIM_IFASSERT_NOINFO,
19 PIM_IFASSERT_I_AM_WINNER,
20 PIM_IFASSERT_I_AM_LOSER
21 };
22
23 struct pim_assert_metric {
24 uint32_t rpt_bit_flag;
25 uint32_t metric_preference;
26 uint32_t route_metric;
27 pim_addr ip_address; /* neighbor router that sourced the Assert
28 message */
29 };
30
31 /*
32 RFC 4601: 4.11. Timer Values
33
34 Note that for historical reasons, the Assert message lacks a
35 Holdtime field. Thus, changing the Assert Time from the default
36 value is not recommended.
37 */
38 #define PIM_ASSERT_OVERRIDE_INTERVAL (3) /* seconds */
39 #define PIM_ASSERT_TIME (180) /* seconds */
40
41 #define PIM_ASSERT_METRIC_PREFERENCE_MAX (0xFFFFFFFF)
42 #define PIM_ASSERT_ROUTE_METRIC_MAX (0xFFFFFFFF)
43
44 void pim_ifassert_winner_set(struct pim_ifchannel *ch,
45 enum pim_ifassert_state new_state, pim_addr winner,
46 struct pim_assert_metric winner_metric);
47
48 int pim_assert_recv(struct interface *ifp, struct pim_neighbor *neigh,
49 pim_addr src_addr, uint8_t *buf, int buf_size);
50
51 int pim_assert_metric_better(const struct pim_assert_metric *m1,
52 const struct pim_assert_metric *m2);
53 int pim_assert_metric_match(const struct pim_assert_metric *m1,
54 const struct pim_assert_metric *m2);
55
56 int pim_assert_build_msg(uint8_t *pim_msg, int buf_size, struct interface *ifp,
57 pim_addr group_addr, pim_addr source_addr,
58 uint32_t metric_preference, uint32_t route_metric,
59 uint32_t rpt_bit_flag);
60
61 int pim_assert_send(struct pim_ifchannel *ch);
62
63 int assert_action_a1(struct pim_ifchannel *ch);
64 void assert_action_a4(struct pim_ifchannel *ch);
65 void assert_action_a5(struct pim_ifchannel *ch);
66
67 #endif /* PIM_ASSERT_H */