net: if: Add IPv4 multicast address join/leave functions

Allows caller to mark IPv4 multicast address to be used or not.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2021-04-26 19:59:05 +03:00 committed by Jukka Rissanen
commit e5043f5a7f
2 changed files with 50 additions and 0 deletions

View file

@ -1645,6 +1645,34 @@ bool net_if_ipv4_maddr_rm(struct net_if *iface, const struct in_addr *addr);
struct net_if_mcast_addr *net_if_ipv4_maddr_lookup(const struct in_addr *addr,
struct net_if **iface);
/**
* @brief Mark a given multicast address to be joined.
*
* @param addr IPv4 multicast address
*/
void net_if_ipv4_maddr_join(struct net_if_mcast_addr *addr);
/**
* @brief Check if given multicast address is joined or not.
*
* @param addr IPv4 multicast address
*
* @return True if address is joined, False otherwise.
*/
static inline bool net_if_ipv4_maddr_is_joined(struct net_if_mcast_addr *addr)
{
NET_ASSERT(addr);
return addr->is_joined;
}
/**
* @brief Mark a given multicast address to be left.
*
* @param addr IPv4 multicast address
*/
void net_if_ipv4_maddr_leave(struct net_if_mcast_addr *addr);
/**
* @brief Get the IPv4 address of the given router
* @param router a network router