summaryrefslogtreecommitdiffstats
path: root/avahi-common/address.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-09-25 20:01:49 +0000
committerLennart Poettering <lennart@poettering.net>2005-09-25 20:01:49 +0000
commit5867849876e19996fd05a0d4917cb739904519c1 (patch)
treed870a5df68daa74992fd0bea3924261e3c00cc30 /avahi-common/address.h
parent1b8b3c22a69f5d0cf8f6ff6bcb8a4cc770faa113 (diff)
* 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
Diffstat (limited to 'avahi-common/address.h')
-rw-r--r--avahi-common/address.h11
1 files changed, 9 insertions, 2 deletions
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 */