Haka
ipv4-addr.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_ADDR_H
11 #define HAKA_PROTO_IPV4_ADDR_H
12 
13 #include <haka/types.h>
14 #include <stddef.h>
15 
16 
20 #define IPV4_ADDR_STRING_MAXLEN 15
21 
25 typedef uint32 ipv4addr;
26 
28 #define SWAP_ipv4addr(x) SWAP_uint32(x)
29 
34 void ipv4_addr_to_string(ipv4addr addr, char *string, size_t size);
35 
39 ipv4addr ipv4_addr_from_string(const char *string);
40 
45 
47 #define TOSTR_ipv4addr_size IPV4_ADDR_STRING_MAXLEN
48 #define TOSTR_ipv4addr(obj, str) ipv4_addr_to_string((obj), (str), IPV4_ADDR_STRING_MAXLEN)
49 
51 #endif /* HAKA_PROTO_IPV4_ADDR_H */
uint32 ipv4addr
Definition: ipv4-addr.h:25
unsigned HAKA_32BIT_TYPE uint32
Definition: types.h:29
ipv4addr ipv4_addr_from_string(const char *string)
Definition: ipv4-addr.c:13
unsigned char uint8
Definition: types.h:27
ipv4addr ipv4_addr_from_bytes(uint8 a, uint8 b, uint8 c, uint8 d)
Definition: ipv4-addr.c:33
void ipv4_addr_to_string(ipv4addr addr, char *string, size_t size)
Definition: ipv4-addr.c:25