ipv4/addr.h¶
IPv6 address type and helper functions definitions.
-
IPV4_ADDR_MAX_STR_LEN
¶ Maximum length of an IPv4 address as string.
1
(sizeof("255.255.255.255"))
-
bool
ipv4_addr_equal
(ipv4_addr_t * a, ipv4_addr_t * b)¶ Checks if two IPv4 addresses are equal.
Parameters
a: An IPv4 address. b: Another IPv4 address. Return values
- true, if
a
andb
are equal - false, otherwise.
- true, if
-
char *
ipv4_addr_to_str
(char * result, const ipv4_addr_t * addr, uint8_t result_len)¶ Converts an IPv4 address to its string representation.
Parameters
result: The resulting string representation of at least ipv4/addr.h::IPV4_ADDR_MAX_STR_LEN
.addr: An IPv4 address result_len: Length of result
Return values
result
, on success- NULL, if
result_len
was lesser than IPV4_ADDR_MAX_STR_LEN - NULL, if
result
oraddr
was NULL
-
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.
Parameters
result: The resulting byte representation addr: An IPv4 address string representation Return values
result
, on success- NULL, if
addr
was malformed - NULL, if
result
oraddr
was NULL
-
union
ipv4_addr_t
¶ Data type to represent an IPv4 address.