RTRlib
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ipv4.h
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_IPV4_H
11 #define LRTR_IPV4_H
12 
13 #include "rtrlib/lib/convert_byte_order.h"
14 
15 #include <inttypes.h>
16 #include <stdbool.h>
17 
23  uint32_t addr;
24 };
25 
38 struct lrtr_ipv4_addr lrtr_ipv4_get_bits(const struct lrtr_ipv4_addr *val,
39  const uint8_t from,
40  const uint8_t number);
41 
51 int lrtr_ipv4_str_to_addr(const char *str, struct lrtr_ipv4_addr *ip);
52 
63 int lrtr_ipv4_addr_to_str(const struct lrtr_ipv4_addr *ip,
64  char *str, const unsigned int len);
65 
75 bool lrtr_ipv4_addr_equal(const struct lrtr_ipv4_addr *a,
76  const struct lrtr_ipv4_addr *b);
77 
87 void lrtr_ipv4_addr_convert_byte_order(const uint32_t src, uint32_t *dest,
88  const enum target_byte_order tbo);
89 
90 #endif
void lrtr_ipv4_addr_convert_byte_order(const uint32_t src, uint32_t *dest, const enum target_byte_order tbo)
Converts the passed IPv4 address to given byte order.
Definition: ipv4.c:59
Struct storing an IPv4 address in host byte order.
Definition: ipv4.h:22