1 /*
2 * Copyright (c) 2021 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 /** @file
8 * @brief IGMP API
9 */
10
11 #ifndef ZEPHYR_INCLUDE_NET_IGMP_H_
12 #define ZEPHYR_INCLUDE_NET_IGMP_H_
13
14 /**
15 * @brief IGMP (Internet Group Management Protocol)
16 * @defgroup igmp IGMP API
17 * @since 2.6
18 * @version 0.8.0
19 * @ingroup networking
20 * @{
21 */
22
23 #include <zephyr/types.h>
24
25 #include <zephyr/net/net_if.h>
26 #include <zephyr/net/net_ip.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /** IGMP parameters */
33 struct igmp_param {
34 struct in_addr *source_list; /**< List of sources to include or exclude */
35 size_t sources_len; /**< Length of source list */
36 bool include; /**< Source list filter type */
37 };
38
39 /**
40 * @brief Join a given multicast group.
41 *
42 * @param iface Network interface where join message is sent
43 * @param addr Multicast group to join
44 * @param param Optional parameters
45 *
46 * @return Return 0 if joining was done, <0 otherwise.
47 */
48 #if defined(CONFIG_NET_IPV4_IGMP)
49 int net_ipv4_igmp_join(struct net_if *iface, const struct in_addr *addr,
50 const struct igmp_param *param);
51 #else
net_ipv4_igmp_join(struct net_if * iface,const struct in_addr * addr,const struct igmp_param * param)52 static inline int net_ipv4_igmp_join(struct net_if *iface, const struct in_addr *addr,
53 const struct igmp_param *param)
54 {
55 ARG_UNUSED(iface);
56 ARG_UNUSED(addr);
57 ARG_UNUSED(param);
58
59 return -ENOSYS;
60 }
61 #endif
62
63 /**
64 * @brief Leave a given multicast group.
65 *
66 * @param iface Network interface where leave message is sent
67 * @param addr Multicast group to leave
68 *
69 * @return Return 0 if leaving is done, <0 otherwise.
70 */
71 #if defined(CONFIG_NET_IPV4_IGMP)
72 int net_ipv4_igmp_leave(struct net_if *iface, const struct in_addr *addr);
73 #else
net_ipv4_igmp_leave(struct net_if * iface,const struct in_addr * addr)74 static inline int net_ipv4_igmp_leave(struct net_if *iface,
75 const struct in_addr *addr)
76 {
77 ARG_UNUSED(iface);
78 ARG_UNUSED(addr);
79
80 return -ENOSYS;
81 }
82 #endif
83
84 #ifdef __cplusplus
85 }
86 #endif
87
88 /**
89 * @}
90 */
91
92 #endif /* ZEPHYR_INCLUDE_NET_IGMP_H_ */
93