#include "ipv4.h"
#include "rtrlib/lib/convert_byte_order_private.h"
#include <inttypes.h>
#include <stdbool.h>
Go to the source code of this file.
◆ lrtr_ipv4_addr_equal()
Compares two ipv4_addr structs.
- Parameters
-
[in] | a | ipv4_addr |
[in] | b | ipv4_addr |
- Returns
- true if a == b
-
false if a != b
◆ lrtr_ipv4_addr_to_str()
int lrtr_ipv4_addr_to_str |
( |
const struct lrtr_ipv4_addr * |
ip, |
|
|
char * |
str, |
|
|
const unsigned int |
len |
|
) |
| |
Converts an ipv4_addr struct to its string representation.
- Parameters
-
[in] | ip | ipv4_addr |
[out] | str | Pointer to a string buffer, of at least INET_ADDRSTRLEN. |
[in] | length | of *str |
- Returns
- 0 on success
-
-1 on error
◆ lrtr_ipv4_get_bits()
Extracts number bits from the passed ipv4_addr,.
Starting at bit number from. The bit with the highest significance is bit 0. All bits that aren't in the specified range will be 0.
- Parameters
-
[in] | val | ipv4_addr |
[in] | from | Position of the first bit that is extracted. |
[in] | number | How many bits will be extracted. |
- Returns
- An ipv4_addr, with all bits not in the specified range set to 0.
◆ lrtr_ipv4_str_to_addr()
int lrtr_ipv4_str_to_addr |
( |
const char * |
str, |
|
|
struct lrtr_ipv4_addr * |
ip |
|
) |
| |
Converts ab IPv4 address from string to ipv4_addr struct.
- Parameters
-
[in] | str | Pointer to a string buffer. |
[out] | ip | ipv4_addr |
- Returns
- 0 on success
-
-1 on error