3 Copyright (C) 2008 Everton da Silva Marques
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.
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.
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,
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)
33 /* GMI: Group Membership Interval */
34 #define PIM_IGMP_GMI_MSEC(qrv,qqi,qri_dsec) ((qrv) * (1000 * (qqi)) + 100 * (qri_dsec))
36 /* OQPI: Other Querier Present Interval */
37 #define PIM_IGMP_OQPI_MSEC(qrv,qqi,qri_dsec) ((qrv) * (1000 * (qqi)) + 100 * ((qri_dsec) >> 1))
39 /* SQI: Startup Query Interval */
40 #define PIM_IGMP_SQI(qi) (((qi) < 4) ? 1 : ((qi) >> 2))
42 /* LMQT: Last Member Query Time */
43 #define PIM_IGMP_LMQT_MSEC(lmqi_dsec, lmqc) ((lmqc) * (100 * (lmqi_dsec)))
45 /* OHPI: Older Host Present Interval */
46 #define PIM_IGMP_OHPI_DSEC(qrv,qqi,qri_dsec) ((qrv) * (10 * (qqi)) + (qri_dsec))
48 void igmp_group_reset_gmi(struct igmp_group
*group
);
49 void igmp_source_reset_gmi(struct igmp_sock
*igmp
,
50 struct igmp_group
*group
,
51 struct igmp_source
*source
);
53 void igmp_source_free(struct igmp_source
*source
);
54 void igmp_source_delete(struct igmp_source
*source
);
55 void igmp_source_delete_expired(struct list
*source_list
);
57 int igmp_group_compat_mode(const struct igmp_sock
*igmp
,
58 const struct igmp_group
*group
);
60 void igmpv3_report_isin(struct igmp_sock
*igmp
, struct in_addr from
,
61 struct in_addr group_addr
,
62 int num_sources
, struct in_addr
*sources
);
63 void igmpv3_report_isex(struct igmp_sock
*igmp
, struct in_addr from
,
64 struct in_addr group_addr
,
65 int num_sources
, struct in_addr
*sources
);
66 void igmpv3_report_toin(struct igmp_sock
*igmp
, struct in_addr from
,
67 struct in_addr group_addr
,
68 int num_sources
, struct in_addr
*sources
);
69 void igmpv3_report_toex(struct igmp_sock
*igmp
, struct in_addr from
,
70 struct in_addr group_addr
,
71 int num_sources
, struct in_addr
*sources
);
72 void igmpv3_report_allow(struct igmp_sock
*igmp
, struct in_addr from
,
73 struct in_addr group_addr
,
74 int num_sources
, struct in_addr
*sources
);
75 void igmpv3_report_block(struct igmp_sock
*igmp
, struct in_addr from
,
76 struct in_addr group_addr
,
77 int num_sources
, struct in_addr
*sources
);
79 void igmp_group_timer_lower_to_lmqt(struct igmp_group
*group
);
80 void igmp_source_timer_lower_to_lmqt(struct igmp_source
*source
);
82 struct igmp_source
*igmp_find_source_by_addr(struct igmp_group
*group
,
83 struct in_addr src_addr
);
85 void pim_igmp_send_membership_query(struct igmp_group
*group
,
91 struct in_addr dst_addr
,
92 struct in_addr group_addr
,
93 int query_max_response_time_dsec
,
95 uint8_t querier_robustness_variable
,
96 uint16_t querier_query_interval
);
98 #endif /* PIM_IGMPV3_H */