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