]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_oil.h
lib, pimd: Fix borked up prefix code
[mirror_frr.git] / pimd / pim_oil.h
CommitLineData
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 PIM_OIL_H
23#define PIM_OIL_H
24
25#include "pim_mroute.h"
26
0fba6e63
DS
27/*
28 * Where did we get this (S,G) from?
29 *
30 * IGMP - Learned from IGMP
31 * PIM - Learned from PIM
32 * SOURCE - Learned from Source multicast packet received
33 */
34#define PIM_OIF_FLAG_PROTO_IGMP (1 << 0)
35#define PIM_OIF_FLAG_PROTO_PIM (1 << 1)
36#define PIM_OIF_FLAG_PROTO_SOURCE (2 << 1)
37#define PIM_OIF_FLAG_PROTO_ANY (PIM_OIF_FLAG_PROTO_IGMP | \
38 PIM_OIF_FLAG_PROTO_PIM | \
39 PIM_OIF_FLAG_PROTO_SOURCE)
12e41d03 40
1865a44a
DS
41/*
42 * We need a pimreg vif id from the kernel.
43 * Since ifindex == vif id for most cases and the number
44 * of expected interfaces is at most 100, using MAXVIFS -1
45 * is probably ok.
46 * Don't come running to me if this assumption is bad,
47 * fix it.
48 */
49#define PIM_OIF_PIM_REGISTER_VIF (MAXVIFS - 1)
50#define PIM_MAX_USABLE_VIFS (MAXVIFS - 2)
51
3667e8a0
DS
52
53struct channel_counts
54{
55 unsigned long pktcnt;
56 unsigned long oldpktcnt;
57 unsigned long bytecnt;
58 unsigned long oldbytecnt;
59 unsigned long wrong_if;
60 unsigned long oldwrong_if;
61};
62
12e41d03
DL
63/*
64 qpim_channel_oil_list holds a list of struct channel_oil.
65
66 Each channel_oil.oil is used to control an (S,G) entry in the Kernel
67 Multicast Forwarding Cache.
68*/
69
70struct channel_oil {
71 struct mfcctl oil;
58302dc7 72 int installed;
12e41d03
DL
73 int oil_size;
74 int oil_ref_count;
75 time_t oif_creation[MAXVIFS];
76 uint32_t oif_flags[MAXVIFS];
3667e8a0 77 struct channel_counts cc;
12e41d03
DL
78};
79
80void pim_channel_oil_free(struct channel_oil *c_oil);
4ed0af70 81struct channel_oil *pim_channel_oil_add(struct prefix_sg *sg,
12e41d03
DL
82 int input_vif_index);
83void pim_channel_oil_del(struct channel_oil *c_oil);
84
1865a44a
DS
85int pim_channel_add_oif(struct channel_oil *c_oil,
86 struct interface *oif,
87 uint32_t proto_mask);
887fa014
DS
88int pim_channel_del_oif (struct channel_oil *c_oil,
89 struct interface *oif,
90 uint32_t proto_mask);
1865a44a 91
12e41d03 92#endif /* PIM_OIL_H */