]>
Commit | Line | Data |
---|---|---|
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 | |
19 | ||
12e41d03 DL |
20 | */ |
21 | ||
22 | #ifndef PIMD_H | |
23 | #define PIMD_H | |
24 | ||
25 | #include <stdint.h> | |
26 | ||
4a1ab8e4 | 27 | #include "pim_memory.h" |
12e41d03 DL |
28 | #include "pim_assert.h" |
29 | ||
30 | #define PIMD_PROGNAME "pimd" | |
31 | #define PIMD_DEFAULT_CONFIG "pimd.conf" | |
32 | #define PIMD_VTY_PORT 2611 | |
12e41d03 DL |
33 | |
34 | #define PIM_IP_HEADER_MIN_LEN (20) | |
35 | #define PIM_IP_HEADER_MAX_LEN (60) | |
36 | #define PIM_IP_PROTO_IGMP (2) | |
37 | #define PIM_IP_PROTO_PIM (103) | |
38 | #define PIM_IGMP_MIN_LEN (8) | |
39 | #define PIM_MSG_HEADER_LEN (4) | |
40 | #define PIM_PIM_MIN_LEN PIM_MSG_HEADER_LEN | |
41 | #define PIM_PROTO_VERSION (2) | |
42 | ||
43 | #define MCAST_ALL_SYSTEMS "224.0.0.1" | |
44 | #define MCAST_ALL_ROUTERS "224.0.0.2" | |
45 | #define MCAST_ALL_PIM_ROUTERS "224.0.0.13" | |
46 | #define MCAST_ALL_IGMP_ROUTERS "224.0.0.22" | |
47 | ||
48 | #define PIM_FORCE_BOOLEAN(expr) ((expr) != 0) | |
49 | ||
50 | #define PIM_NET_INADDR_ANY (htonl(INADDR_ANY)) | |
df696e3f | 51 | #define PIM_INADDR_IS_ANY(addr) (addr).s_addr == PIM_NET_INADDR_ANY |
12e41d03 DL |
52 | #define PIM_INADDR_ISNOT_ANY(addr) ((addr).s_addr != PIM_NET_INADDR_ANY) /* struct in_addr addr */ |
53 | ||
54 | #define PIM_MASK_PIM_EVENTS (1 << 0) | |
3010e99a DS |
55 | #define PIM_MASK_PIM_EVENTS_DETAIL (1 << 1) |
56 | #define PIM_MASK_PIM_PACKETS (1 << 2) | |
57 | #define PIM_MASK_PIM_PACKETDUMP_SEND (1 << 3) | |
58 | #define PIM_MASK_PIM_PACKETDUMP_RECV (1 << 4) | |
59 | #define PIM_MASK_PIM_TRACE (1 << 5) | |
60 | #define PIM_MASK_PIM_TRACE_DETAIL (1 << 6) | |
61 | #define PIM_MASK_IGMP_EVENTS (1 << 7) | |
62 | #define PIM_MASK_IGMP_PACKETS (1 << 8) | |
63 | #define PIM_MASK_IGMP_TRACE (1 << 9) | |
d3a8a0f5 DS |
64 | #define PIM_MASK_IGMP_TRACE_DETAIL (1 << 10) |
65 | #define PIM_MASK_ZEBRA (1 << 11) | |
66 | #define PIM_MASK_SSMPINGD (1 << 12) | |
67 | #define PIM_MASK_MROUTE (1 << 13) | |
6c7197b1 DS |
68 | #define PIM_MASK_MROUTE_DETAIL (1 << 14) |
69 | #define PIM_MASK_PIM_HELLO (1 << 15) | |
70 | #define PIM_MASK_PIM_J_P (1 << 16) | |
71 | #define PIM_MASK_STATIC (1 << 17) | |
72 | #define PIM_MASK_PIM_REG (1 << 18) | |
2a333e0f | 73 | #define PIM_MASK_MSDP_EVENTS (1 << 19) |
74 | #define PIM_MASK_MSDP_PACKETS (1 << 20) | |
75 | #define PIM_MASK_MSDP_INTERNAL (1 << 21) | |
12e41d03 | 76 | |
dfe43e25 DW |
77 | |
78 | /* PIM error codes */ | |
79 | #define PIM_SUCCESS 0 | |
80 | #define PIM_MALLOC_FAIL -1 | |
81 | #define PIM_GROUP_BAD_ADDRESS -2 | |
82 | #define PIM_GROUP_OVERLAP -3 | |
83 | #define PIM_GROUP_PFXLIST_OVERLAP -4 | |
84 | #define PIM_RP_BAD_ADDRESS -5 | |
85 | #define PIM_RP_NO_PATH -6 | |
86 | #define PIM_RP_NOT_FOUND -7 | |
87 | #define PIM_RP_PFXLIST_IN_USE -8 | |
88 | ||
12e41d03 DL |
89 | const char *const PIM_ALL_SYSTEMS; |
90 | const char *const PIM_ALL_ROUTERS; | |
91 | const char *const PIM_ALL_PIM_ROUTERS; | |
92 | const char *const PIM_ALL_IGMP_ROUTERS; | |
93 | ||
469351b3 | 94 | extern struct thread_master *master; |
12e41d03 DL |
95 | uint32_t qpim_debugs; |
96 | int qpim_mroute_socket_fd; | |
97 | int64_t qpim_mroute_socket_creation; /* timestamp of creation */ | |
12e41d03 | 98 | int qpim_mroute_oif_highest_vif_index; |
12e41d03 DL |
99 | struct in_addr qpim_all_pim_routers_addr; |
100 | int qpim_t_periodic; /* Period between Join/Prune Messages */ | |
12e41d03 | 101 | struct zclient *qpim_zclient_update; |
12e41d03 DL |
102 | struct pim_assert_metric qpim_infinite_assert_metric; |
103 | long qpim_rpf_cache_refresh_delay_msec; | |
104 | struct thread *qpim_rpf_cache_refresher; | |
105 | int64_t qpim_rpf_cache_refresh_requests; | |
106 | int64_t qpim_rpf_cache_refresh_events; | |
107 | int64_t qpim_rpf_cache_refresh_last; | |
108 | struct in_addr qpim_inaddr_any; | |
109 | struct list *qpim_ssmpingd_list; /* list of struct ssmpingd_sock */ | |
110 | struct in_addr qpim_ssmpingd_group_addr; | |
111 | int64_t qpim_scan_oil_events; | |
112 | int64_t qpim_scan_oil_last; | |
113 | int64_t qpim_mroute_add_events; | |
114 | int64_t qpim_mroute_add_last; | |
115 | int64_t qpim_mroute_del_events; | |
116 | int64_t qpim_mroute_del_last; | |
284b4301 | 117 | int64_t qpim_nexthop_lookups; |
6250610a | 118 | struct list *qpim_static_route_list; /* list of routes added statically */ |
4304f95c | 119 | extern unsigned int qpim_keep_alive_time; |
01408ede | 120 | extern signed int qpim_rp_keep_alive_time; |
12e41d03 DL |
121 | |
122 | #define PIM_JP_HOLDTIME (qpim_t_periodic * 7 / 2) | |
123 | ||
124 | #define PIM_MROUTE_IS_ENABLED (qpim_mroute_socket_fd >= 0) | |
125 | #define PIM_MROUTE_IS_DISABLED (qpim_mroute_socket_fd < 0) | |
126 | ||
4a4c4a07 DS |
127 | /* |
128 | * Register-Stop Timer (RST(S,G)) | |
129 | * Default values | |
130 | */ | |
131 | extern int32_t qpim_register_suppress_time; | |
132 | extern int32_t qpim_register_probe_time; | |
133 | #define PIM_REGISTER_SUPPRESSION_TIME_DEFAULT (60) | |
134 | #define PIM_REGISTER_PROBE_TIME_DEFAULT (5) | |
135 | ||
12e41d03 | 136 | #define PIM_DEBUG_PIM_EVENTS (qpim_debugs & PIM_MASK_PIM_EVENTS) |
3010e99a | 137 | #define PIM_DEBUG_PIM_EVENTS_DETAIL (qpim_debugs & PIM_MASK_PIM_EVENTS_DETAIL) |
12e41d03 DL |
138 | #define PIM_DEBUG_PIM_PACKETS (qpim_debugs & PIM_MASK_PIM_PACKETS) |
139 | #define PIM_DEBUG_PIM_PACKETDUMP_SEND (qpim_debugs & PIM_MASK_PIM_PACKETDUMP_SEND) | |
140 | #define PIM_DEBUG_PIM_PACKETDUMP_RECV (qpim_debugs & PIM_MASK_PIM_PACKETDUMP_RECV) | |
141 | #define PIM_DEBUG_PIM_TRACE (qpim_debugs & PIM_MASK_PIM_TRACE) | |
3010e99a | 142 | #define PIM_DEBUG_PIM_TRACE_DETAIL (qpim_debugs & PIM_MASK_PIM_TRACE_DETAIL) |
12e41d03 DL |
143 | #define PIM_DEBUG_IGMP_EVENTS (qpim_debugs & PIM_MASK_IGMP_EVENTS) |
144 | #define PIM_DEBUG_IGMP_PACKETS (qpim_debugs & PIM_MASK_IGMP_PACKETS) | |
145 | #define PIM_DEBUG_IGMP_TRACE (qpim_debugs & PIM_MASK_IGMP_TRACE) | |
d3a8a0f5 | 146 | #define PIM_DEBUG_IGMP_TRACE_DETAIL (qpim_debugs & PIM_MASK_IGMP_TRACE_DETAIL) |
12e41d03 DL |
147 | #define PIM_DEBUG_ZEBRA (qpim_debugs & PIM_MASK_ZEBRA) |
148 | #define PIM_DEBUG_SSMPINGD (qpim_debugs & PIM_MASK_SSMPINGD) | |
149 | #define PIM_DEBUG_MROUTE (qpim_debugs & PIM_MASK_MROUTE) | |
6c7197b1 | 150 | #define PIM_DEBUG_MROUTE_DETAIL (qpim_debugs & PIM_MASK_MROUTE_DETAIL) |
6250610a JAG |
151 | #define PIM_DEBUG_PIM_HELLO (qpim_debugs & PIM_MASK_PIM_HELLO) |
152 | #define PIM_DEBUG_PIM_J_P (qpim_debugs & PIM_MASK_PIM_J_P) | |
9add3b88 | 153 | #define PIM_DEBUG_PIM_REG (qpim_debugs & PIM_MASK_PIM_REG) |
6250610a | 154 | #define PIM_DEBUG_STATIC (qpim_debugs & PIM_MASK_STATIC) |
2a333e0f | 155 | #define PIM_DEBUG_MSDP_EVENTS (qpim_debugs & PIM_MASK_MSDP_EVENTS) |
156 | #define PIM_DEBUG_MSDP_PACKETS (qpim_debugs & PIM_MASK_MSDP_PACKETS) | |
157 | #define PIM_DEBUG_MSDP_INTERNAL (qpim_debugs & PIM_MASK_MSDP_INTERNAL) | |
12e41d03 | 158 | |
2a333e0f | 159 | #define PIM_DEBUG_EVENTS (qpim_debugs & (PIM_MASK_PIM_EVENTS | PIM_MASK_IGMP_EVENTS | PIM_MASK_MSDP_EVENTS)) |
160 | #define PIM_DEBUG_PACKETS (qpim_debugs & (PIM_MASK_PIM_PACKETS | PIM_MASK_IGMP_PACKETS | PIM_MASK_MSDP_PACKETS)) | |
12e41d03 DL |
161 | #define PIM_DEBUG_TRACE (qpim_debugs & (PIM_MASK_PIM_TRACE | PIM_MASK_IGMP_TRACE)) |
162 | ||
163 | #define PIM_DO_DEBUG_PIM_EVENTS (qpim_debugs |= PIM_MASK_PIM_EVENTS) | |
164 | #define PIM_DO_DEBUG_PIM_PACKETS (qpim_debugs |= PIM_MASK_PIM_PACKETS) | |
165 | #define PIM_DO_DEBUG_PIM_PACKETDUMP_SEND (qpim_debugs |= PIM_MASK_PIM_PACKETDUMP_SEND) | |
166 | #define PIM_DO_DEBUG_PIM_PACKETDUMP_RECV (qpim_debugs |= PIM_MASK_PIM_PACKETDUMP_RECV) | |
167 | #define PIM_DO_DEBUG_PIM_TRACE (qpim_debugs |= PIM_MASK_PIM_TRACE) | |
168 | #define PIM_DO_DEBUG_IGMP_EVENTS (qpim_debugs |= PIM_MASK_IGMP_EVENTS) | |
169 | #define PIM_DO_DEBUG_IGMP_PACKETS (qpim_debugs |= PIM_MASK_IGMP_PACKETS) | |
170 | #define PIM_DO_DEBUG_IGMP_TRACE (qpim_debugs |= PIM_MASK_IGMP_TRACE) | |
d3a8a0f5 | 171 | #define PIM_DO_DEBUG_IGMP_TRACE_DETAIL (qpim_debugs |= PIM_MASK_IGMP_TRACE_DETAIL) |
12e41d03 DL |
172 | #define PIM_DO_DEBUG_ZEBRA (qpim_debugs |= PIM_MASK_ZEBRA) |
173 | #define PIM_DO_DEBUG_SSMPINGD (qpim_debugs |= PIM_MASK_SSMPINGD) | |
174 | #define PIM_DO_DEBUG_MROUTE (qpim_debugs |= PIM_MASK_MROUTE) | |
6c7197b1 | 175 | #define PIM_DO_DEBUG_MROUTE_DETAIL (qpim_debugs |= PIM_MASK_MROUTE_DETAIL) |
12e41d03 DL |
176 | #define PIM_DO_DEBUG_PIM_HELLO (qpim_debugs |= PIM_MASK_PIM_HELLO) |
177 | #define PIM_DO_DEBUG_PIM_J_P (qpim_debugs |= PIM_MASK_PIM_J_P) | |
9add3b88 | 178 | #define PIM_DO_DEBUG_PIM_REG (qpim_debugs |= PIM_MASK_PIM_REG) |
6250610a | 179 | #define PIM_DO_DEBUG_STATIC (qpim_debugs |= PIM_MASK_STATIC) |
2a333e0f | 180 | #define PIM_DO_DEBUG_MSDP_EVENTS (qpim_debugs |= PIM_MASK_MSDP_EVENTS) |
181 | #define PIM_DO_DEBUG_MSDP_PACKETS (qpim_debugs |= PIM_MASK_MSDP_PACKETS) | |
182 | #define PIM_DO_DEBUG_MSDP_INTERNAL (qpim_debugs |= PIM_MASK_MSDP_INTERNAL) | |
12e41d03 DL |
183 | |
184 | #define PIM_DONT_DEBUG_PIM_EVENTS (qpim_debugs &= ~PIM_MASK_PIM_EVENTS) | |
185 | #define PIM_DONT_DEBUG_PIM_PACKETS (qpim_debugs &= ~PIM_MASK_PIM_PACKETS) | |
186 | #define PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND (qpim_debugs &= ~PIM_MASK_PIM_PACKETDUMP_SEND) | |
187 | #define PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV (qpim_debugs &= ~PIM_MASK_PIM_PACKETDUMP_RECV) | |
188 | #define PIM_DONT_DEBUG_PIM_TRACE (qpim_debugs &= ~PIM_MASK_PIM_TRACE) | |
189 | #define PIM_DONT_DEBUG_IGMP_EVENTS (qpim_debugs &= ~PIM_MASK_IGMP_EVENTS) | |
190 | #define PIM_DONT_DEBUG_IGMP_PACKETS (qpim_debugs &= ~PIM_MASK_IGMP_PACKETS) | |
191 | #define PIM_DONT_DEBUG_IGMP_TRACE (qpim_debugs &= ~PIM_MASK_IGMP_TRACE) | |
d3a8a0f5 | 192 | #define PIM_DONT_DEBUG_IGMP_TRACE_DETAIL (qpim_debugs &= ~PIM_MASK_IGMP_TRACE_DETAIL) |
12e41d03 DL |
193 | #define PIM_DONT_DEBUG_ZEBRA (qpim_debugs &= ~PIM_MASK_ZEBRA) |
194 | #define PIM_DONT_DEBUG_SSMPINGD (qpim_debugs &= ~PIM_MASK_SSMPINGD) | |
195 | #define PIM_DONT_DEBUG_MROUTE (qpim_debugs &= ~PIM_MASK_MROUTE) | |
6c7197b1 | 196 | #define PIM_DONT_DEBUG_MROUTE_DETAIL (qpim_debugs &= ~PIM_MASK_MROUTE_DETAIL) |
12e41d03 DL |
197 | #define PIM_DONT_DEBUG_PIM_HELLO (qpim_debugs &= ~PIM_MASK_PIM_HELLO) |
198 | #define PIM_DONT_DEBUG_PIM_J_P (qpim_debugs &= ~PIM_MASK_PIM_J_P) | |
9add3b88 | 199 | #define PIM_DONT_DEBUG_PIM_REG (qpim_debugs &= ~PIM_MASK_PIM_REG) |
6250610a | 200 | #define PIM_DONT_DEBUG_STATIC (qpim_debugs &= ~PIM_MASK_STATIC) |
2a333e0f | 201 | #define PIM_DONT_DEBUG_MSDP_EVENTS (qpim_debugs &= ~PIM_MASK_MSDP_EVENTS) |
202 | #define PIM_DONT_DEBUG_MSDP_PACKETS (qpim_debugs &= ~PIM_MASK_MSDP_PACKETS) | |
203 | #define PIM_DONT_DEBUG_MSDP_INTERNAL (qpim_debugs &= ~PIM_MASK_MSDP_INTERNAL) | |
12e41d03 DL |
204 | |
205 | void pim_init(void); | |
206 | void pim_terminate(void); | |
207 | ||
0e8ce7e6 | 208 | extern void pim_route_map_init (void); |
28b0c6b3 | 209 | extern void pim_route_map_terminate(void); |
0e8ce7e6 | 210 | |
12e41d03 | 211 | #endif /* PIMD_H */ |