RTRlib
Loading...
Searching...
No Matches
ip.h
Go to the documentation of this file.
1/*
2 * This file is part of RTRlib.
3 *
4 * This file is subject to the terms and conditions of the MIT license.
5 * See the file LICENSE in the top level directory for more details.
6 *
7 * Website: http://rtrlib.realmv6.org/
8 */
9
10#ifndef LRTR_IP_PUBLIC_H
11#define LRTR_IP_PUBLIC_H
12
13#include "rtrlib/lib/ipv4.h"
14#include "rtrlib/lib/ipv6.h"
15
16#include <stdbool.h>
32
40 union {
43 } u;
44};
45
56int lrtr_ip_addr_to_str(const struct lrtr_ip_addr *ip, char *str, const unsigned int len);
57
65int lrtr_ip_str_to_addr(const char *str, struct lrtr_ip_addr *ip);
66
75bool lrtr_ip_addr_equal(const struct lrtr_ip_addr a, const struct lrtr_ip_addr b);
76
84bool lrtr_ip_str_cmp(const struct lrtr_ip_addr *addr1, const char *addr2);
85
86#endif
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.
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.
lrtr_ip_version
Version of the IP protocol.
Definition ip.h:25
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.
@ LRTR_IPV6
LRTR_IPV6.
Definition ip.h:30
@ LRTR_IPV4
IPV4.
Definition ip.h:27
uint32_t len
Definition rtr_pdus.h:4
The lrtr_ip_addr struct stores a IPv4 or IPv6 address in host byte order.
Definition ip.h:38
enum lrtr_ip_version ver
Definition ip.h:39
struct lrtr_ipv4_addr addr4
Definition ip.h:41
union lrtr_ip_addr::@0 u
struct lrtr_ipv6_addr addr6
Definition ip.h:42
Struct storing an IPv4 address in host byte order.
Definition ipv4.h:19
Struct holding an IPv6 address in host byte order.
Definition ipv6.h:18