universal address container
More...
universal address container
◆ UNIVERSAL_ADDRESS_EQUAL
#define UNIVERSAL_ADDRESS_EQUAL (0) |
return value indicating the compared addresses are equal
Definition at line 45 of file universal_address.h.
◆ UNIVERSAL_ADDRESS_IS_ALL_ZERO_ADDRESS
#define UNIVERSAL_ADDRESS_IS_ALL_ZERO_ADDRESS (2) |
return value indicating all address bits of the entry are 0
.
Its considered as default route address that matches any other prefix.
Definition at line 53 of file universal_address.h.
◆ UNIVERSAL_ADDRESS_MATCHING_PREFIX
#define UNIVERSAL_ADDRESS_MATCHING_PREFIX (1) |
return value indicating the compared addresses match up to a certain prefix
Definition at line 48 of file universal_address.h.
◆ UNIVERSAL_ADDRESS_SIZE
#define UNIVERSAL_ADDRESS_SIZE |
◆ universal_address_add()
Add a given address to the universal address entries.
If the entry already exists, the universal_address_container_t::use_count will be increased.
- Parameters
-
[in] | addr | pointer to the address |
[in] | addr_size | the number of bytes required for the address entry |
- Returns
- pointer to the universal_address_container_t containing the address on success
-
NULL if the address could not be inserted
◆ universal_address_compare()
Determine if the entry equals the provided address This function requires to be provided with the full size of the used address type behind addr
to be comparable with the address stored in entry
.
- Parameters
-
[in] | entry | pointer to the universal_address_container_t for compare |
[in] | addr | pointer to the address for compare |
[in,out] | addr_size_in_bits | the number of bits used for the address entry on successful return this value is overwritten with the number of matching bits till the first of trailing 0 s |
- Returns
- UNIVERSAL_ADDRESS_EQUAL if the entries are equal
-
UNIVERSAL_ADDRESS_MATCHING_PREFIX if the entry matches to a certain prefix (trailing '0's in
entry
)
-
UNIVERSAL_ADDRESS_IS_ALL_ZERO_ADDRESS if the entry address is all
0
s and considered as default route
-
-ENOENT if the given addresses do not match
◆ universal_address_compare_prefix()
Determine if the entry equals the provided prefix This function requires to be provided with the full size of the used address type behind prefix
to be comparable with the address stored in entry
.
- Parameters
-
[in] | entry | pointer to the universal_address_container_t for compare |
[in] | prefix | pointer to the address for compare |
[in] | prefix_size_in_bits | the number of bits used for the prefix entry. This size MUST be the full address size including trailing '0's, e.g. for an ipv6_addr_t it would be sizeof(ipv6_addr_t) regardless if the stored prefix is < ::/128 |
- Returns
- UNIVERSAL_ADDRESS_EQUAL if the entries are equal
-
UNIVERSAL_ADDRESS_MATCHING_PREFIX if the entry matches to a certain prefix (trailing '0's in
prefix
)
-
-ENOENT if the given addresses do not match
◆ universal_address_get_address()
Copy the address from the given container to the provided pointer.
- Parameters
-
[in] | entry | pointer to the universal_address_container_t |
[out] | addr | pointer to store the address entry |
[in,out] | addr_size | pointer providing the size of available memory on addr this value is overwritten with the actual size required |
- Returns
- addr if the address is copied to the addr destination
-
NULL if the size is insufficient for copy
◆ universal_address_print_entry()
Print the content of the given entry.
- Parameters
-
◆ universal_address_rem()