]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_igmpv3.h
893fba60f2137272948c26e127ce399ab6d8ba06
[mirror_frr.git] / pimd / pim_igmpv3.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 <<<<<<< HEAD
20
21 =======
22 >>>>>>> origin/master
23 */
24
25 #ifndef PIM_IGMPV3_H
26 #define PIM_IGMPV3_H
27
28 #include <zebra.h>
29 #include "if.h"
30
31 #define IGMP_V3_CHECKSUM_OFFSET (2)
32 #define IGMP_V3_REPORT_NUMGROUPS_OFFSET (6)
33 #define IGMP_V3_REPORT_GROUPPRECORD_OFFSET (8)
34 #define IGMP_V3_NUMSOURCES_OFFSET (10)
35 #define IGMP_V3_SOURCES_OFFSET (12)
36
37 #define IGMP_GRP_REC_TYPE_MODE_IS_INCLUDE (1)
38 #define IGMP_GRP_REC_TYPE_MODE_IS_EXCLUDE (2)
39 #define IGMP_GRP_REC_TYPE_CHANGE_TO_INCLUDE_MODE (3)
40 #define IGMP_GRP_REC_TYPE_CHANGE_TO_EXCLUDE_MODE (4)
41 #define IGMP_GRP_REC_TYPE_ALLOW_NEW_SOURCES (5)
42 #define IGMP_GRP_REC_TYPE_BLOCK_OLD_SOURCES (6)
43
44 /* GMI: Group Membership Interval */
45 #define PIM_IGMP_GMI_MSEC(qrv,qqi,qri_dsec) ((qrv) * (1000 * (qqi)) + 100 * (qri_dsec))
46
47 /* OQPI: Other Querier Present Interval */
48 #define PIM_IGMP_OQPI_MSEC(qrv,qqi,qri_dsec) ((qrv) * (1000 * (qqi)) + 100 * ((qri_dsec) >> 1))
49
50 /* SQI: Startup Query Interval */
51 #define PIM_IGMP_SQI(qi) (((qi) < 4) ? 1 : ((qi) >> 2))
52
53 /* LMQT: Last Member Query Time */
54 #define PIM_IGMP_LMQT_MSEC(lmqi_dsec, lmqc) ((lmqc) * (100 * (lmqi_dsec)))
55
56 /* OHPI: Older Host Present Interval */
57 #define PIM_IGMP_OHPI_DSEC(qrv,qqi,qri_dsec) ((qrv) * (10 * (qqi)) + (qri_dsec))
58
59 void igmp_group_reset_gmi(struct igmp_group *group);
60 void igmp_source_reset_gmi(struct igmp_sock *igmp,
61 struct igmp_group *group,
62 struct igmp_source *source);
63
64 void igmp_source_free(struct igmp_source *source);
65 void igmp_source_delete(struct igmp_source *source);
66 void igmp_source_delete_expired(struct list *source_list);
67
68 void igmpv3_report_isin(struct igmp_sock *igmp, struct in_addr from,
69 struct in_addr group_addr,
70 int num_sources, struct in_addr *sources);
71 void igmpv3_report_isex(struct igmp_sock *igmp, struct in_addr from,
72 struct in_addr group_addr,
73 int num_sources, struct in_addr *sources,
74 int from_igmp_v2_report);
75 void igmpv3_report_toin(struct igmp_sock *igmp, struct in_addr from,
76 struct in_addr group_addr,
77 int num_sources, struct in_addr *sources);
78 void igmpv3_report_toex(struct igmp_sock *igmp, struct in_addr from,
79 struct in_addr group_addr,
80 int num_sources, struct in_addr *sources);
81 void igmpv3_report_allow(struct igmp_sock *igmp, struct in_addr from,
82 struct in_addr group_addr,
83 int num_sources, struct in_addr *sources);
84 void igmpv3_report_block(struct igmp_sock *igmp, struct in_addr from,
85 struct in_addr group_addr,
86 int num_sources, struct in_addr *sources);
87
88 void igmp_group_timer_lower_to_lmqt(struct igmp_group *group);
89 void igmp_source_timer_lower_to_lmqt(struct igmp_source *source);
90
91 struct igmp_source *igmp_find_source_by_addr(struct igmp_group *group,
92 struct in_addr src_addr);
93
94 void igmp_v3_send_query (struct igmp_group *group,
95 int fd,
96 const char *ifname,
97 char *query_buf,
98 int query_buf_size,
99 int num_sources,
100 struct in_addr dst_addr,
101 struct in_addr group_addr,
102 int query_max_response_time_dsec,
103 uint8_t s_flag,
104 uint8_t querier_robustness_variable,
105 uint16_t querier_query_interval);
106
107 void igmp_v3_recv_query (struct igmp_sock *igmp, const char *from_str,
108 char *igmp_msg);
109
110 int igmp_v3_recv_report (struct igmp_sock *igmp,
111 struct in_addr from, const char *from_str,
112 char *igmp_msg, int igmp_msg_len);
113
114 #endif /* PIM_IGMPV3_H */