mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-18 02:53:52 +01:00
net/ipv4/addr.h: add ipv4_addr_is_multicast
This commit is contained in:
parent
a98a706112
commit
e77aa7b65e
@ -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);
|
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
|
* @brief Converts an IPv4 address to its string representation
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user