]>
Commit | Line | Data |
---|---|---|
12e41d03 | 1 | /* |
896014f4 DL |
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 along | |
16 | * with this program; see the file COPYING; if not, write to the Free Software | |
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | */ | |
12e41d03 DL |
19 | |
20 | #ifndef PIM_IGMPV3_H | |
21 | #define PIM_IGMPV3_H | |
22 | ||
23 | #include <zebra.h> | |
24 | #include "if.h" | |
25 | ||
e34e07e6 DL |
26 | #include "pim_igmp.h" |
27 | ||
12e41d03 DL |
28 | #define IGMP_V3_CHECKSUM_OFFSET (2) |
29 | #define IGMP_V3_REPORT_NUMGROUPS_OFFSET (6) | |
30 | #define IGMP_V3_REPORT_GROUPPRECORD_OFFSET (8) | |
31 | #define IGMP_V3_NUMSOURCES_OFFSET (10) | |
32 | #define IGMP_V3_SOURCES_OFFSET (12) | |
33 | ||
b05b72e8 DW |
34 | #define IGMP_GRP_REC_TYPE_MODE_IS_INCLUDE (1) |
35 | #define IGMP_GRP_REC_TYPE_MODE_IS_EXCLUDE (2) | |
36 | #define IGMP_GRP_REC_TYPE_CHANGE_TO_INCLUDE_MODE (3) | |
37 | #define IGMP_GRP_REC_TYPE_CHANGE_TO_EXCLUDE_MODE (4) | |
38 | #define IGMP_GRP_REC_TYPE_ALLOW_NEW_SOURCES (5) | |
39 | #define IGMP_GRP_REC_TYPE_BLOCK_OLD_SOURCES (6) | |
40 | ||
12e41d03 DL |
41 | /* GMI: Group Membership Interval */ |
42 | #define PIM_IGMP_GMI_MSEC(qrv,qqi,qri_dsec) ((qrv) * (1000 * (qqi)) + 100 * (qri_dsec)) | |
43 | ||
44 | /* OQPI: Other Querier Present Interval */ | |
45 | #define PIM_IGMP_OQPI_MSEC(qrv,qqi,qri_dsec) ((qrv) * (1000 * (qqi)) + 100 * ((qri_dsec) >> 1)) | |
46 | ||
47 | /* SQI: Startup Query Interval */ | |
48 | #define PIM_IGMP_SQI(qi) (((qi) < 4) ? 1 : ((qi) >> 2)) | |
49 | ||
50 | /* LMQT: Last Member Query Time */ | |
51 | #define PIM_IGMP_LMQT_MSEC(lmqi_dsec, lmqc) ((lmqc) * (100 * (lmqi_dsec))) | |
52 | ||
53 | /* OHPI: Older Host Present Interval */ | |
54 | #define PIM_IGMP_OHPI_DSEC(qrv,qqi,qri_dsec) ((qrv) * (10 * (qqi)) + (qri_dsec)) | |
55 | ||
5a46a3de | 56 | #if PIM_IPV == 4 |
a16db099 SG |
57 | void igmp_group_reset_gmi(struct gm_group *group); |
58 | void igmp_source_reset_gmi(struct gm_group *group, struct gm_source *source); | |
12e41d03 | 59 | |
51700107 SG |
60 | void igmp_source_free(struct gm_source *source); |
61 | void igmp_source_delete(struct gm_source *source); | |
12e41d03 DL |
62 | void igmp_source_delete_expired(struct list *source_list); |
63 | ||
c5f76fad | 64 | void igmpv3_report_isin(struct gm_sock *igmp, struct in_addr from, |
d62a17ae | 65 | struct in_addr group_addr, int num_sources, |
66 | struct in_addr *sources); | |
c5f76fad | 67 | void igmpv3_report_isex(struct gm_sock *igmp, struct in_addr from, |
d62a17ae | 68 | struct in_addr group_addr, int num_sources, |
69 | struct in_addr *sources, int from_igmp_v2_report); | |
c5f76fad | 70 | void igmpv3_report_toin(struct gm_sock *igmp, struct in_addr from, |
d62a17ae | 71 | struct in_addr group_addr, int num_sources, |
72 | struct in_addr *sources); | |
c5f76fad | 73 | void igmpv3_report_toex(struct gm_sock *igmp, struct in_addr from, |
d62a17ae | 74 | struct in_addr group_addr, int num_sources, |
75 | struct in_addr *sources); | |
c5f76fad | 76 | void igmpv3_report_allow(struct gm_sock *igmp, struct in_addr from, |
d62a17ae | 77 | struct in_addr group_addr, int num_sources, |
78 | struct in_addr *sources); | |
c5f76fad | 79 | void igmpv3_report_block(struct gm_sock *igmp, struct in_addr from, |
d62a17ae | 80 | struct in_addr group_addr, int num_sources, |
81 | struct in_addr *sources); | |
12e41d03 | 82 | |
a16db099 | 83 | void igmp_group_timer_lower_to_lmqt(struct gm_group *group); |
51700107 | 84 | void igmp_source_timer_lower_to_lmqt(struct gm_source *source); |
12e41d03 | 85 | |
a16db099 SG |
86 | struct gm_source *igmp_find_source_by_addr(struct gm_group *group, |
87 | struct in_addr src_addr); | |
12e41d03 | 88 | |
a16db099 | 89 | void igmp_v3_send_query(struct gm_group *group, int fd, const char *ifname, |
d62a17ae | 90 | char *query_buf, int query_buf_size, int num_sources, |
91 | struct in_addr dst_addr, struct in_addr group_addr, | |
92 | int query_max_response_time_dsec, uint8_t s_flag, | |
93 | uint8_t querier_robustness_variable, | |
94 | uint16_t querier_query_interval); | |
95 | ||
c5f76fad | 96 | void igmp_v3_recv_query(struct gm_sock *igmp, const char *from_str, |
d62a17ae | 97 | char *igmp_msg); |
98 | ||
c5f76fad | 99 | int igmp_v3_recv_report(struct gm_sock *igmp, struct in_addr from, |
d62a17ae | 100 | const char *from_str, char *igmp_msg, int igmp_msg_len); |
12e41d03 | 101 | |
5a46a3de DL |
102 | #else /* PIM_IPV != 4 */ |
103 | static inline void igmp_group_reset_gmi(struct gm_group *group) | |
104 | { | |
105 | } | |
106 | ||
107 | ||
108 | static inline void igmp_source_reset_gmi(struct gm_group *group, | |
109 | struct gm_source *source) | |
110 | { | |
111 | } | |
112 | #endif | |
113 | ||
12e41d03 | 114 | #endif /* PIM_IGMPV3_H */ |