|
avahi 0.6.30
|
00001 #ifndef fooaddresshfoo 00002 #define fooaddresshfoo 00003 00004 /*** 00005 This file is part of avahi. 00006 00007 avahi is free software; you can redistribute it and/or modify it 00008 under the terms of the GNU Lesser General Public License as 00009 published by the Free Software Foundation; either version 2.1 of the 00010 License, or (at your option) any later version. 00011 00012 avahi is distributed in the hope that it will be useful, but WITHOUT 00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00014 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 00015 Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with avahi; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00020 USA. 00021 ***/ 00022 00025 #include <inttypes.h> 00026 #include <sys/types.h> 00027 00028 #include <avahi-common/cdecl.h> 00029 00030 AVAHI_C_DECL_BEGIN 00031 00033 typedef int AvahiProtocol; 00034 00036 typedef int AvahiIfIndex; 00037 00039 enum { 00040 AVAHI_PROTO_INET = 0, 00041 AVAHI_PROTO_INET6 = 1, 00042 AVAHI_PROTO_UNSPEC = -1 00043 }; 00044 00046 enum { 00047 AVAHI_IF_UNSPEC = -1 00048 }; 00049 00051 #define AVAHI_ADDRESS_STR_MAX 40 /* IPv6 Max = 4*8 + 7 + 1 for NUL */ 00052 00054 #define AVAHI_IF_VALID(ifindex) (((ifindex) >= 0) || ((ifindex) == AVAHI_IF_UNSPEC)) 00055 00057 #define AVAHI_PROTO_VALID(protocol) (((protocol) == AVAHI_PROTO_INET) || ((protocol) == AVAHI_PROTO_INET6) || ((protocol) == AVAHI_PROTO_UNSPEC)) 00058 00060 typedef struct AvahiIPv4Address { 00061 uint32_t address; 00062 } AvahiIPv4Address; 00063 00065 typedef struct AvahiIPv6Address { 00066 uint8_t address[16]; 00067 } AvahiIPv6Address; 00068 00070 typedef struct AvahiAddress { 00071 AvahiProtocol proto; 00073 union { 00074 AvahiIPv6Address ipv6; 00075 AvahiIPv4Address ipv4; 00076 uint8_t data[1]; 00077 } data; 00078 } AvahiAddress; 00079 00083 int avahi_address_cmp(const AvahiAddress *a, const AvahiAddress *b); 00084 00090 char *avahi_address_snprint(char *ret_s, size_t length, const AvahiAddress *a); 00091 00095 AvahiAddress *avahi_address_parse(const char *s, AvahiProtocol af, AvahiAddress *ret_addr); 00096 00101 char* avahi_reverse_lookup_name(const AvahiAddress *a, char *ret_s, size_t length); 00107 int avahi_proto_to_af(AvahiProtocol proto); 00108 00110 AvahiProtocol avahi_af_to_proto(int af); 00111 00113 const char* avahi_proto_to_string(AvahiProtocol proto); 00114 00117 AVAHI_C_DECL_END 00118 00119 #endif