Line data Source code
1 1 : /*
2 : * Copyright (c) 2016 Intel Corporation
3 : * Copyright (c) 2024 Nordic Semiconductor ASA
4 : *
5 : * SPDX-License-Identifier: Apache-2.0
6 : */
7 :
8 : /** @file
9 : * @brief Multicast Listener Discovery API
10 : */
11 :
12 : #ifndef ZEPHYR_INCLUDE_NET_MLD_H_
13 : #define ZEPHYR_INCLUDE_NET_MLD_H_
14 :
15 : /**
16 : * @brief MLD (Multicast Listener Discovery)
17 : * @defgroup mld Multicast Listener Discovery API
18 : * @since 1.8
19 : * @version 0.8.0
20 : * @ingroup networking
21 : * @{
22 : */
23 :
24 : #include <errno.h>
25 :
26 : #include <zephyr/net/net_if.h>
27 : #include <zephyr/net/net_ip.h>
28 : #include <zephyr/toolchain.h>
29 :
30 : #ifdef __cplusplus
31 : extern "C" {
32 : #endif
33 :
34 : /**
35 : * @brief Join a given multicast group.
36 : *
37 : * @param iface Network interface where join message is sent
38 : * @param addr Multicast group to join
39 : *
40 : * @return 0 if joining was done, <0 otherwise.
41 : */
42 : #if defined(CONFIG_NET_IPV6_MLD)
43 : int net_ipv6_mld_join(struct net_if *iface, const struct in6_addr *addr);
44 : #else
45 : static inline int
46 1 : net_ipv6_mld_join(struct net_if *iface, const struct in6_addr *addr)
47 : {
48 : ARG_UNUSED(addr);
49 : ARG_UNUSED(iface);
50 :
51 : return -ENOTSUP;
52 : }
53 : #endif /* CONFIG_NET_IPV6_MLD */
54 :
55 : /**
56 : * @brief Leave a given multicast group.
57 : *
58 : * @param iface Network interface where leave message is sent
59 : * @param addr Multicast group to leave
60 : *
61 : * @return 0 if leaving is done, <0 otherwise.
62 : */
63 : #if defined(CONFIG_NET_IPV6_MLD)
64 : int net_ipv6_mld_leave(struct net_if *iface, const struct in6_addr *addr);
65 : #else
66 : static inline int
67 1 : net_ipv6_mld_leave(struct net_if *iface, const struct in6_addr *addr)
68 : {
69 : ARG_UNUSED(iface);
70 : ARG_UNUSED(addr);
71 :
72 : return -ENOTSUP;
73 : }
74 : #endif /* CONFIG_NET_IPV6_MLD */
75 :
76 : #ifdef __cplusplus
77 : }
78 : #endif
79 :
80 : /**
81 : * @}
82 : */
83 :
84 : #endif /* ZEPHYR_INCLUDE_NET_MLD_H_ */
|