RTRlib
Loading...
Searching...
No Matches
ip_private.h File Reference
#include "ip.h"
#include "rtrlib/lib/ipv4_private.h"
#include "rtrlib/lib/ipv6_private.h"

Go to the source code of this file.

Functions

bool lrtr_ip_addr_is_zero (const struct lrtr_ip_addr)
 Detects if the lrtr_ip_addr only contains 0 bits.
 
struct lrtr_ip_addr lrtr_ip_addr_get_bits (const struct lrtr_ip_addr *val, const uint8_t from, const uint8_t number)
 Extracts number bits from the passed lrtr_ip_addr, starting at bit number from.
 
bool lrtr_ip_addr_equal (const struct lrtr_ip_addr a, const struct lrtr_ip_addr b)
 Checks if two lrtr_ip_addr structs are equal.
 
bool lrtr_ip_str_cmp (const struct lrtr_ip_addr *addr1, const char *addr2)
 Compares addr1 in the lrtr_ip_addr struct with addr2 in string representation.
 

Function Documentation

◆ lrtr_ip_addr_get_bits()

struct lrtr_ip_addr lrtr_ip_addr_get_bits ( const struct lrtr_ip_addr val,
const uint8_t  from,
const uint8_t  number 
)

Extracts number bits from the passed lrtr_ip_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]vallrtr_ip_addr
[in]fromPosition of the first bit that is extracted.
[in]numberHow many bits will be extracted.
Returns
An lrtr_ipv_addr, where all bits that aren't in the specified range are set to 0.

◆ lrtr_ip_addr_is_zero()

bool lrtr_ip_addr_is_zero ( const struct lrtr_ip_addr  )

Detects if the lrtr_ip_addr only contains 0 bits.

Parameters
[in]lrtr_ip_addr
Returns
true If the saved lrtr_ip_addr is 0.
false If the saved lrtr_ip_addr isn't 0.