From: Lennart Poettering Date: Sun, 25 Sep 2005 20:01:49 +0000 (+0000) Subject: * add new macros AVAHI_IF_VALID, AVAHI_PROTO_VALID X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=5867849876e19996fd05a0d4917cb739904519c1;p=catta * add new macros AVAHI_IF_VALID, AVAHI_PROTO_VALID * make AvahiProtocol an int git-svn-id: file:///home/lennart/svn/public/avahi/trunk@607 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- diff --git a/avahi-common/address.h b/avahi-common/address.h index cc7eaa2..5523a72 100644 --- a/avahi-common/address.h +++ b/avahi-common/address.h @@ -32,7 +32,7 @@ AVAHI_C_DECL_BEGIN /** Protocol family specification, takes the values AVAHI_PROTO_INET, AVAHI_PROTO_INET6, AVAHI_PROTO_UNSPEC */ -typedef char AvahiProtocol; +typedef int AvahiProtocol; /** Numeric network interface index. Takes OS dependent values and the special constant AVAHI_IF_UNSPEC */ typedef int AvahiIfIndex; @@ -46,14 +46,21 @@ enum { /** Special values for AvahiIfIndex */ enum { - AVAHI_IF_UNSPEC = -1 /**< Unspecifed/all interfaces */ + AVAHI_IF_UNSPEC = -1, /**< Unspecified/all interface(s) */ }; +/** Return TRUE if the specified interface index is valid */ +#define AVAHI_IF_VALID(ifindex) (((ifindex) >= 0) || ((ifindex) == AVAHI_PROTO_UNSPEC)) + +/** Return TRUE if the specified protocol is valid */ +#define AVAHI_PROTO_VALID(protocol) (((protocol) == AVAHI_PROTO_INET) || ((protocol) == AVAHI_PROTO_INET6) || ((protocol) == AVAHI_PROTO_UNSPEC)) + /** An IPv4 address */ typedef struct { uint32_t address; /**< Address data in network byte order. */ } AvahiIPv4Address; + /** An IPv6 address */ typedef struct { uint8_t address[16]; /**< Address data */