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 * @ingroup networking 18 * @{ 19 */ 20 21 #include <zephyr/types.h> 22 23 #include <zephyr/net/net_if.h> 24 #include <zephyr/net/net_ip.h> 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 /** 31 * @brief Join a given multicast group. 32 * 33 * @param iface Network interface where join message is sent 34 * @param addr Multicast group to join 35 * 36 * @return Return 0 if joining was done, <0 otherwise. 37 */ 38 #if defined(CONFIG_NET_IPV4_IGMP) 39 int net_ipv4_igmp_join(struct net_if *iface, const struct in_addr *addr); 40 #else 41 static inline int net_ipv4_igmp_join(struct net_if *iface, 42 const struct in_addr *addr) 43 { 44 ARG_UNUSED(iface); 45 ARG_UNUSED(addr); 46 47 return -ENOSYS; 48 } 49 #endif 50 51 /** 52 * @brief Leave a given multicast group. 53 * 54 * @param iface Network interface where leave message is sent 55 * @param addr Multicast group to leave 56 * 57 * @return Return 0 if leaving is done, <0 otherwise. 58 */ 59 #if defined(CONFIG_NET_IPV4_IGMP) 60 int net_ipv4_igmp_leave(struct net_if *iface, const struct in_addr *addr); 61 #else net_ipv4_igmp_leave(struct net_if * iface,const struct in_addr * addr)62static inline int net_ipv4_igmp_leave(struct net_if *iface, 63 const struct in_addr *addr) 64 { 65 ARG_UNUSED(iface); 66 ARG_UNUSED(addr); 67 68 return -ENOSYS; 69 } 70 #endif 71 72 #ifdef __cplusplus 73 } 74 #endif 75 76 /** 77 * @} 78 */ 79 80 #endif /* ZEPHYR_INCLUDE_NET_IGMP_H_ */ 81