1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

net/ipv4/addr.h: add ipv4_addr_is_multicast

This commit is contained in:
Hendrik van Essen 2022-10-05 16:28:13 +02:00
parent a98a706112
commit e77aa7b65e

View File

@ -57,6 +57,23 @@ static inline bool ipv4_addr_equal(const ipv4_addr_t *a, const ipv4_addr_t *b)
return (a->u32.u32 == b->u32.u32);
}
/**
* @brief Check if @p addr is a multicast address.
*
* @see <a href="https://www.rfc-editor.org/rfc/rfc1112.html#section-4">
* RFC 1112, section 4
* </a>
*
* @param[in] addr An IPv4 address.
*
* @return true, if @p addr is multicast address,
* @return false, otherwise.
*/
static inline bool ipv4_addr_is_multicast(const ipv4_addr_t *addr)
{
return (addr->u8[0] >= 0xE0 && addr->u8[0] <= 0xEF);
}
/**
* @brief Converts an IPv4 address to its string representation
*