Loading...
Searching...
No Matches
Utility functions

## Data Structures

struct | lrtr_ip_addr

## Enumerations

enum | lrtr_ip_version { LRTR_IPV4 , LRTR_IPV6 }

## Functions

bool | lrtr_ip_addr_equal (const struct lrtr_ip_addr a, const struct lrtr_ip_addr b)
int | lrtr_ip_addr_to_str (const struct lrtr_ip_addr *ip, char *str, const unsigned int len)
bool | lrtr_ip_str_cmp (const struct lrtr_ip_addr *addr1, const char *addr2)
int | lrtr_ip_str_to_addr (const char *str, struct lrtr_ip_addr *ip)

## Detailed Description

## Enumeration Type Documentation

## lrtr_ip_version

enum lrtr_ip_version

Version of the IP protocol.

Enumerator
LRTR_IPV4 | IPV4
LRTR_IPV6 | LRTR_IPV6

## Function Documentation

## lrtr_ip_addr_equal()

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.

Parameters

  [in] | a | lrtr_ip_addr
  [in] | b | lrtr_ip_addr

Returns
  true If a == b.
  false If a != b.

## lrtr_ip_addr_to_str()

int lrtr_ip_addr_to_str | ( | const struct lrtr_ip_addr * | ip,
|  | char * | str,
|  | const unsigned int | len )

Converts the passed lrtr_ip_addr struct to string representation.

Parameters

  [in] | ip | lrtr_ip_addr
  [out] | str | Pointer to a char array. The array must be at least INET_ADDRSTRLEN bytes long if the passed lrtr_ip_addr stores an IPv4 address. If lrtr_ip_addr stores an IPv6 address, str must be at least INET6_ADDRSTRLEN bytes long.
  [in] | len | Length of the str array.

Returns
  0 On success.
  -1 On error.

Examples
  rtr_mgr.c.

## lrtr_ip_str_cmp()

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.

Parameters

  [in] | addr1 | lrtr_ip_addr
  [in] | addr2 | IP-address as string

Returns
  true If a == b
  false If a != b

## lrtr_ip_str_to_addr()

int lrtr_ip_str_to_addr | ( | const char * | str,
|  | struct lrtr_ip_addr * | ip )

Converts the passed IP address in string representation to an lrtr_ip_addr.

Parameters

  [in] | str | Pointer to a Null terminated char array.
  [out] | ip | Pointer to a lrtr_ip_addr struct.

Returns
  0 On success.
  -1 On error.

Examples
  rtr_mgr.c.