mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
sys/net/sock: add sock_udp_ep_is_v6()
This commit is contained in:
parent
6a59642a1e
commit
3e3f18eeda
@ -822,6 +822,26 @@ static inline bool sock_udp_ep_is_multicast(const sock_udp_ep_t *ep)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks if the IP address of an endpoint is an IPv6 address
|
||||
*
|
||||
* @param[in] ep end point to check
|
||||
*
|
||||
* @returns true if end point is IPv6
|
||||
*/
|
||||
static inline bool sock_udp_ep_is_v6(const sock_udp_ep_t *ep)
|
||||
{
|
||||
#if !defined(SOCK_HAS_IPV6)
|
||||
(void)ep;
|
||||
return false;
|
||||
#elif !defined(SOCK_HAS_IPV4)
|
||||
(void)ep;
|
||||
return true;
|
||||
#else
|
||||
return ep->family == AF_INET6;
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "sock_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
Reference in New Issue
Block a user