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

sys/net/ipv4: add IPV4_ADDR_INIT() macro

This patch adds a macro to statically initialize an IPv4 address.
This commit is contained in:
Joshua DeWeese 2024-02-07 10:08:16 -05:00
parent 4df530663b
commit bcc0d01c08

View File

@ -35,6 +35,18 @@ extern "C" {
*/
#define IPV4_ADDR_MAX_STR_LEN (sizeof("255.255.255.255"))
/**
* @brief Static initializer for an IPv4 address.
* @param[in] a 1st octet
* @param[in] b 2nd octet
* @param[in] c 3rd octet
* @param[in] d 4th octet
*
* @return initialized IPv4 address
*/
#define IPV4_ADDR_INIT(a, b, c, d) { .u8 = {a, b, c, d} }
/**
* @brief Data type to represent an IPv4 address.
*/