1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (C) 2008 Everton da Silva Marques
15 #define IGMP_V3_CHECKSUM_OFFSET (2)
16 #define IGMP_V3_REPORT_NUMGROUPS_OFFSET (6)
17 #define IGMP_V3_REPORT_GROUPPRECORD_OFFSET (8)
18 #define IGMP_V3_NUMSOURCES_OFFSET (10)
19 #define IGMP_V3_SOURCES_OFFSET (12)
21 #define IGMP_GRP_REC_TYPE_MODE_IS_INCLUDE (1)
22 #define IGMP_GRP_REC_TYPE_MODE_IS_EXCLUDE (2)
23 #define IGMP_GRP_REC_TYPE_CHANGE_TO_INCLUDE_MODE (3)
24 #define IGMP_GRP_REC_TYPE_CHANGE_TO_EXCLUDE_MODE (4)
25 #define IGMP_GRP_REC_TYPE_ALLOW_NEW_SOURCES (5)
26 #define IGMP_GRP_REC_TYPE_BLOCK_OLD_SOURCES (6)
28 /* GMI: Group Membership Interval */
29 #define PIM_IGMP_GMI_MSEC(qrv,qqi,qri_dsec) ((qrv) * (1000 * (qqi)) + 100 * (qri_dsec))
31 /* OQPI: Other Querier Present Interval */
32 #define PIM_IGMP_OQPI_MSEC(qrv,qqi,qri_dsec) ((qrv) * (1000 * (qqi)) + 100 * ((qri_dsec) >> 1))
34 /* SQI: Startup Query Interval */
35 #define PIM_IGMP_SQI(qi) (((qi) < 4) ? 1 : ((qi) >> 2))
37 /* LMQT: Last Member Query Time */
38 #define PIM_IGMP_LMQT_MSEC(lmqi_dsec, lmqc) ((lmqc) * (100 * (lmqi_dsec)))
40 /* OHPI: Older Host Present Interval */
41 #define PIM_IGMP_OHPI_DSEC(qrv,qqi,qri_dsec) ((qrv) * (10 * (qqi)) + (qri_dsec))
44 void igmp_group_reset_gmi(struct gm_group
*group
);
45 void igmp_source_reset_gmi(struct gm_group
*group
, struct gm_source
*source
);
47 void igmp_source_free(struct gm_source
*source
);
48 void igmp_source_delete(struct gm_source
*source
);
49 void igmp_source_delete_expired(struct list
*source_list
);
51 void igmpv3_report_isin(struct gm_sock
*igmp
, struct in_addr from
,
52 struct in_addr group_addr
, int num_sources
,
53 struct in_addr
*sources
);
54 void igmpv3_report_isex(struct gm_sock
*igmp
, struct in_addr from
,
55 struct in_addr group_addr
, int num_sources
,
56 struct in_addr
*sources
, int from_igmp_v2_report
);
57 void igmpv3_report_toin(struct gm_sock
*igmp
, struct in_addr from
,
58 struct in_addr group_addr
, int num_sources
,
59 struct in_addr
*sources
);
60 void igmpv3_report_toex(struct gm_sock
*igmp
, struct in_addr from
,
61 struct in_addr group_addr
, int num_sources
,
62 struct in_addr
*sources
);
63 void igmpv3_report_allow(struct gm_sock
*igmp
, struct in_addr from
,
64 struct in_addr group_addr
, int num_sources
,
65 struct in_addr
*sources
);
66 void igmpv3_report_block(struct gm_sock
*igmp
, struct in_addr from
,
67 struct in_addr group_addr
, int num_sources
,
68 struct in_addr
*sources
);
70 void igmp_group_timer_lower_to_lmqt(struct gm_group
*group
);
71 void igmp_source_timer_lower_to_lmqt(struct gm_source
*source
);
73 struct gm_source
*igmp_find_source_by_addr(struct gm_group
*group
,
74 struct in_addr src_addr
);
76 void igmp_v3_send_query(struct gm_group
*group
, int fd
, const char *ifname
,
77 char *query_buf
, int query_buf_size
, int num_sources
,
78 struct in_addr dst_addr
, struct in_addr group_addr
,
79 int query_max_response_time_dsec
, uint8_t s_flag
,
80 uint8_t querier_robustness_variable
,
81 uint16_t querier_query_interval
);
83 void igmp_v3_recv_query(struct gm_sock
*igmp
, const char *from_str
,
86 int igmp_v3_recv_report(struct gm_sock
*igmp
, struct in_addr from
,
87 const char *from_str
, char *igmp_msg
, int igmp_msg_len
);
89 #else /* PIM_IPV != 4 */
90 static inline void igmp_group_reset_gmi(struct gm_group
*group
)
95 static inline void igmp_source_reset_gmi(struct gm_group
*group
,
96 struct gm_source
*source
)
101 #endif /* PIM_IGMPV3_H */