Haka
ipv4-network.h
Go to the documentation of this file.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
10 #ifndef HAKA_PROTO_IPV4_NETWORK_H
11 #define HAKA_PROTO_IPV4_NETWORK_H
12 
13 #include <haka/types.h>
14 
15 
19 #define IPV4_NETWORK_STRING_MAXLEN 18
20 
22 #define IPV4_MASK_MAXVAL 32
23 
29 typedef struct {
30  ipv4addr net;
31  uint8 mask;
32 } ipv4network;
33 
37 extern const ipv4network ipv4_network_zero;
38 
42 void ipv4_network_to_string(ipv4network net, char *string, size_t size);
43 
47 ipv4network ipv4_network_from_string(const char *string);
48 
55 
56 #endif /* HAKA_PROTO_IPV4_NETWORK_H */
uint32 ipv4addr
Definition: ipv4-addr.h:25
void ipv4_network_to_string(ipv4network net, char *string, size_t size)
Definition: ipv4-network.c:26
uint8 ipv4_network_contains(ipv4network network, ipv4addr addr)
Definition: ipv4-network.c:77
Definition: ipv4-network.h:29
unsigned char uint8
Definition: types.h:27
ipv4network ipv4_network_from_string(const char *string)
Definition: ipv4-network.c:35
const ipv4network ipv4_network_zero
Definition: ipv4-network.c:21