]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_oil.h
Merge pull request #27 from qlyoung/fix-derefs2
[mirror_frr.git] / pimd / pim_oil.h
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 */
20
21 #ifndef PIM_OIL_H
22 #define PIM_OIL_H
23
24 #include "pim_mroute.h"
25
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
32 */
33 #define PIM_OIF_FLAG_PROTO_IGMP (1 << 0)
34 #define PIM_OIF_FLAG_PROTO_PIM (1 << 1)
35 #define PIM_OIF_FLAG_PROTO_SOURCE (2 << 1)
36 #define PIM_OIF_FLAG_PROTO_ANY (PIM_OIF_FLAG_PROTO_IGMP | \
37 PIM_OIF_FLAG_PROTO_PIM | \
38 PIM_OIF_FLAG_PROTO_SOURCE)
39
40 /*
41 * We need a pimreg vif id from the kernel.
42 * Since ifindex == vif id for most cases and the number
43 * of expected interfaces is at most 100, using MAXVIFS -1
44 * is probably ok.
45 * Don't come running to me if this assumption is bad,
46 * fix it.
47 */
48 #define PIM_OIF_PIM_REGISTER_VIF (MAXVIFS - 1)
49 #define PIM_MAX_USABLE_VIFS (MAXVIFS - 2)
50
51
52 struct channel_counts
53 {
54 unsigned long pktcnt;
55 unsigned long oldpktcnt;
56 unsigned long bytecnt;
57 unsigned long oldbytecnt;
58 unsigned long wrong_if;
59 unsigned long oldwrong_if;
60 };
61
62 /*
63 qpim_channel_oil_list holds a list of struct channel_oil.
64
65 Each channel_oil.oil is used to control an (S,G) entry in the Kernel
66 Multicast Forwarding Cache.
67 */
68
69 struct channel_oil {
70 struct mfcctl oil;
71 int installed;
72 int oil_size;
73 int oil_ref_count;
74 time_t oif_creation[MAXVIFS];
75 uint32_t oif_flags[MAXVIFS];
76 struct channel_counts cc;
77 };
78
79 void pim_channel_oil_free(struct channel_oil *c_oil);
80 struct channel_oil *pim_channel_oil_add(struct in_addr group_addr,
81 struct in_addr source_addr,
82 int input_vif_index);
83 void pim_channel_oil_del(struct channel_oil *c_oil);
84
85 int pim_channel_add_oif(struct channel_oil *c_oil,
86 struct interface *oif,
87 uint32_t proto_mask);
88
89 #endif /* PIM_OIL_H */