summaryrefslogtreecommitdiffstats
path: root/address.h
blob: 33dcc279826e3dfb4f92e3b609a8642279cd0d1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef fooaddresshfoo
#define fooaddresshfoo

#include <glib.h>

typedef struct {
    guint32 address;
} flxIPv4Address;

typedef struct {
    guint8 address[16];
} flxIPv6Address;

typedef struct {
    guint family;

    union {
        flxIPv6Address ipv6;
        flxIPv4Address ipv4;
        guint8 data[0];
    };
} flxAddress;

guint flx_address_get_size(const flxAddress *a);
gint flx_address_cmp(const flxAddress *a, const flxAddress *b);

gchar *flx_address_snprint(char *ret_s, guint length, const flxAddress *a);

flxAddress *flx_address_parse(const char *s, int family, flxAddress *ret_addr);

gchar* flx_reverse_lookup_name_ipv4(const flxIPv4Address *a);
gchar* flx_reverse_lookup_name_ipv6_arpa(const flxIPv6Address *a);
gchar* flx_reverse_lookup_name_ipv6_int(const flxIPv6Address *a);

#endif