20#ifndef NET_IPV4_ADDR_H
21#define NET_IPV4_ADDR_H
36#define IPV4_ADDR_MAX_STR_LEN (sizeof("255.255.255.255"))
48#define IPV4_ADDR_INIT(a, b, c, d) { .u8 = {a, b, c, d} }
86 return (addr->
u8[0] >= 0xE0 && addr->
u8[0] <= 0xEF);
Functions to work with different byte orders.
ipv4_addr_t * ipv4_addr_from_str(ipv4_addr_t *result, const char *addr)
Converts an IPv4 address string representation to a byte-represented IPv4 address.
void ipv4_addr_print(const ipv4_addr_t *addr)
Print IPv4 address to stdout.
static bool ipv4_addr_is_multicast(const ipv4_addr_t *addr)
Check if addr is a multicast address.
static bool ipv4_addr_equal(const ipv4_addr_t *a, const ipv4_addr_t *b)
Checks if two IPv4 addresses are equal.
char * ipv4_addr_to_str(char *result, const ipv4_addr_t *addr, uint8_t result_len)
Converts an IPv4 address to its string representation.
ipv4_addr_t * ipv4_addr_from_buf(ipv4_addr_t *result, const char *addr, size_t addr_len)
Converts an IPv4 address from a buffer of characters to a byte-represented IPv4 address.
A 32 bit integer in big endian aka network byte order.
uint32_t u32
32 bit representation
Data type to represent an IPv4 address.
uint8_t u8[4]
as 4 8-bit unsigned integer
network_uint32_t u32
as 32-bit unsigned integer