]>
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 | |
12e41d03 DL |
19 | */ |
20 | ||
21 | #ifndef PIM_OIL_H | |
22 | #define PIM_OIL_H | |
23 | ||
24 | #include "pim_mroute.h" | |
25 | ||
0fba6e63 DS |
26 | /* |
27 | * Where did we get this (S,G) from? | |
28 | * | |
29 | * IGMP - Learned from IGMP | |
30 | * PIM - Learned from PIM | |
31 | * SOURCE - Learned from Source multicast packet received | |
781a1745 | 32 | * STAR - Inherited |
0fba6e63 DS |
33 | */ |
34 | #define PIM_OIF_FLAG_PROTO_IGMP (1 << 0) | |
35 | #define PIM_OIF_FLAG_PROTO_PIM (1 << 1) | |
781a1745 DS |
36 | #define PIM_OIF_FLAG_PROTO_SOURCE (1 << 2) |
37 | #define PIM_OIF_FLAG_PROTO_STAR (1 << 3) | |
0fba6e63 DS |
38 | #define PIM_OIF_FLAG_PROTO_ANY (PIM_OIF_FLAG_PROTO_IGMP | \ |
39 | PIM_OIF_FLAG_PROTO_PIM | \ | |
781a1745 DS |
40 | PIM_OIF_FLAG_PROTO_SOURCE | \ |
41 | PIM_OIF_FLAG_PROTO_STAR) | |
12e41d03 | 42 | |
1865a44a DS |
43 | /* |
44 | * We need a pimreg vif id from the kernel. | |
45 | * Since ifindex == vif id for most cases and the number | |
46 | * of expected interfaces is at most 100, using MAXVIFS -1 | |
47 | * is probably ok. | |
48 | * Don't come running to me if this assumption is bad, | |
49 | * fix it. | |
50 | */ | |
e34a317a DS |
51 | #define PIM_OIF_PIM_REGISTER_VIF 0 |
52 | #define PIM_MAX_USABLE_VIFS (MAXVIFS - 1) | |
1865a44a | 53 | |
3667e8a0 DS |
54 | |
55 | struct channel_counts | |
56 | { | |
e3be0432 | 57 | unsigned long long lastused; |
3667e8a0 DS |
58 | unsigned long pktcnt; |
59 | unsigned long oldpktcnt; | |
60 | unsigned long bytecnt; | |
61 | unsigned long oldbytecnt; | |
62 | unsigned long wrong_if; | |
63 | unsigned long oldwrong_if; | |
64 | }; | |
65 | ||
12e41d03 DL |
66 | /* |
67 | qpim_channel_oil_list holds a list of struct channel_oil. | |
68 | ||
69 | Each channel_oil.oil is used to control an (S,G) entry in the Kernel | |
70 | Multicast Forwarding Cache. | |
71 | */ | |
72 | ||
73 | struct channel_oil { | |
74 | struct mfcctl oil; | |
58302dc7 | 75 | int installed; |
b5183fd1 | 76 | int oil_inherited_rescan; |
12e41d03 DL |
77 | int oil_size; |
78 | int oil_ref_count; | |
79 | time_t oif_creation[MAXVIFS]; | |
80 | uint32_t oif_flags[MAXVIFS]; | |
3667e8a0 | 81 | struct channel_counts cc; |
815c33c9 | 82 | struct pim_upstream *up; |
12e41d03 DL |
83 | }; |
84 | ||
040d86ad DS |
85 | extern struct list *pim_channel_oil_list; |
86 | ||
87 | void pim_oil_init (void); | |
88 | void pim_oil_terminate (void); | |
89 | ||
12e41d03 | 90 | void pim_channel_oil_free(struct channel_oil *c_oil); |
4ed0af70 | 91 | struct channel_oil *pim_channel_oil_add(struct prefix_sg *sg, |
12e41d03 DL |
92 | int input_vif_index); |
93 | void pim_channel_oil_del(struct channel_oil *c_oil); | |
94 | ||
1865a44a DS |
95 | int pim_channel_add_oif(struct channel_oil *c_oil, |
96 | struct interface *oif, | |
97 | uint32_t proto_mask); | |
887fa014 DS |
98 | int pim_channel_del_oif (struct channel_oil *c_oil, |
99 | struct interface *oif, | |
100 | uint32_t proto_mask); | |
1865a44a | 101 | |
ce0ddb4e | 102 | int pim_channel_oil_empty (struct channel_oil *c_oil); |
781a1745 DS |
103 | |
104 | char *pim_channel_oil_dump (struct channel_oil *c_oil, char *buf, size_t size); | |
12e41d03 | 105 | #endif /* PIM_OIL_H */ |