]> git.meshlink.io Git - catta/blob - libavahi-core/address.h
update todo
[catta] / libavahi-core / address.h
1 #ifndef fooaddresshfoo
2 #define fooaddresshfoo
3
4 /* $Id$ */
5
6 /***
7   This file is part of avahi.
8  
9   avahi is free software; you can redistribute it and/or modify it
10   under the terms of the GNU Lesser General Public License as
11   published by the Free Software Foundation; either version 2.1 of the
12   License, or (at your option) any later version.
13  
14   avahi is distributed in the hope that it will be useful, but WITHOUT
15   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
17   Public License for more details.
18  
19   You should have received a copy of the GNU Lesser General Public
20   License along with avahi; if not, write to the Free Software
21   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22   USA.
23 ***/
24
25 #include <sys/socket.h>
26 #include <glib.h>
27
28 typedef struct {
29     guint32 address;
30 } AvahiIPv4Address;
31
32 typedef struct {
33     guint8 address[16];
34 } AvahiIPv6Address;
35
36 typedef struct {
37     guchar family;
38
39     union {
40         AvahiIPv6Address ipv6;
41         AvahiIPv4Address ipv4;
42         guint8 data[1];
43     } data;
44 } AvahiAddress;
45
46 guint avahi_address_get_size(const AvahiAddress *a);
47 gint avahi_address_cmp(const AvahiAddress *a, const AvahiAddress *b);
48
49 gchar *avahi_address_snprint(char *ret_s, guint length, const AvahiAddress *a);
50
51 AvahiAddress *avahi_address_parse(const char *s, guchar family, AvahiAddress *ret_addr);
52
53 AvahiAddress *avahi_address_from_sockaddr(const struct sockaddr* sa, AvahiAddress *ret_addr);
54 guint16 avahi_port_from_sockaddr(const struct sockaddr* sa);
55
56 gchar* avahi_reverse_lookup_name_ipv4(const AvahiIPv4Address *a);
57 gchar* avahi_reverse_lookup_name_ipv6_arpa(const AvahiIPv6Address *a);
58 gchar* avahi_reverse_lookup_name_ipv6_int(const AvahiIPv6Address *a);
59
60 #endif