]> git.meshlink.io Git - catta/commitdiff
* implement compat-howl core
authorLennart Poettering <lennart@poettering.net>
Sat, 15 Oct 2005 02:23:21 +0000 (02:23 +0000)
committerLennart Poettering <lennart@poettering.net>
Sat, 15 Oct 2005 02:23:21 +0000 (02:23 +0000)
* add HOWL examples to or build

git-svn-id: file:///home/lennart/svn/public/avahi/trunk@765 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-compat-howl/Makefile.am
avahi-compat-howl/address.c
avahi-compat-howl/compat.c [new file with mode: 0644]
avahi-compat-howl/funcs.txt
avahi-compat-howl/samples/browse.c [new file with mode: 0644]
avahi-compat-howl/samples/publish.c [new file with mode: 0644]
avahi-compat-howl/samples/query.c [new file with mode: 0644]
avahi-compat-howl/samples/resolve.c [new file with mode: 0644]
avahi-compat-howl/text.c
avahi-compat-howl/unsupported.c

index 398f02950416919532479cbeea3969d5b0786be6..d013752dedfa1ec819b96cfab09c24d52e990444 100644 (file)
@@ -49,14 +49,15 @@ avahi_compat_howl_HEADERS = \
 
 lib_LTLIBRARIES = libavahi-compat-howl.la 
 
-noinst_PROGRAMS = address-test text-test
+noinst_PROGRAMS = address-test text-test samples/browse samples/resolve samples/publish samples/query
 
 libavahi_compat_howl_la_SOURCES = \
        $(avahi_compat_howl_HEADERS) \
        warn.c warn.h \
        unsupported.c \
        address.c \
-       text.c
+       text.c \
+       compat.c
 libavahi_compat_howl_la_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
 libavahi_compat_howl_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_COMPAT_HOWL_VERSION_INFO) $(PTHREAD_LIBS) ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la
 
@@ -76,6 +77,31 @@ text_test_SOURCES = \
 text_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
 text_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
 
+samples_browse_SOURCES = \
+       $(avahi_compat_howl_HEADERS) \
+       samples/browse.c
+samples_browse_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
+samples_browse_LDADD = $(AM_LDADD) libavahi-compat-howl.la
+
+samples_resolve_SOURCES = \
+       $(avahi_compat_howl_HEADERS) \
+       samples/resolve.c
+samples_resolve_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
+samples_resolve_LDADD = $(AM_LDADD) libavahi-compat-howl.la
+
+samples_publish_SOURCES = \
+       $(avahi_compat_howl_HEADERS) \
+       samples/publish.c
+samples_publish_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
+samples_publish_LDADD = $(AM_LDADD) libavahi-compat-howl.la
+
+samples_query_SOURCES = \
+       $(avahi_compat_howl_HEADERS) \
+       samples/query.c
+samples_query_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
+samples_query_LDADD = $(AM_LDADD) libavahi-compat-howl.la
+
+
 
 # You can test the compatibility layer by sticking in mDNSResponder's
 # dns-sd.c source here, naming it "libdns_sd-test.c" and running "make
index 6f26d1aa9e02542ac12ee327ebe37c14e4870326..c79b34d1f6357520a388dc01fb8f1c5400b08720 100644 (file)
@@ -31,8 +31,7 @@
 #include <arpa/inet.h>
 #include <sys/types.h>
 
-#include <howl.h>
-
+#include "howl.h"
 #include "warn.h"
 
 sw_ipv4_address sw_ipv4_address_any(void) {
diff --git a/avahi-compat-howl/compat.c b/avahi-compat-howl/compat.c
new file mode 100644 (file)
index 0000000..fc50458
--- /dev/null
@@ -0,0 +1,661 @@
+/* $Id$ */
+
+/***
+  This file is part of avahi.
+  avahi is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as
+  published by the Free Software Foundation; either version 2.1 of the
+  License, or (at your option) any later version.
+  avahi is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+  Public License for more details.
+  You should have received a copy of the GNU Lesser General Public
+  License along with avahi; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+  USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <assert.h>
+
+#include <pthread.h>
+
+#include <avahi-common/strlst.h>
+#include <avahi-common/malloc.h>
+#include <avahi-common/domain.h>
+#include <avahi-common/simple-watch.h>
+#include <avahi-common/error.h>
+#include <avahi-client/client.h>
+
+#include "howl.h"
+#include "warn.h"
+
+#define OID_MAX 50
+
+enum {
+    COMMAND_POLL = 'p',
+    COMMAND_QUIT = 'q',
+    COMMAND_POLL_DONE = 'P'
+};
+
+typedef enum {
+    OID_UNUSED = 0,
+    OID_SERVICE_BROWSER,
+    OID_SERVICE_RESOLVER,
+    OID_DOMAIN_BROWSER,
+    OID_ENTRY_GROUP
+} oid_type;
+
+typedef struct oid_data {
+    oid_type type;
+    sw_opaque extra;
+    sw_discovery discovery;
+    void *object;
+    sw_result (*reply)(void);
+} oid_data;
+
+struct _sw_discovery {
+    int n_ref;
+    AvahiSimplePoll *simple_poll;
+    AvahiClient *client;
+
+    oid_data oid_table[OID_MAX];
+    sw_discovery_oid oid_index;
+
+    int thread_fd, main_fd;
+    
+    pthread_t thread;
+    int thread_running;
+
+    pthread_mutex_t mutex;
+
+};
+
+#define ASSERT_SUCCESS(r) { int __ret = (r); assert(__ret == 0); }
+
+static const char *add_trailing_dot(const char *s, char *buf, size_t buf_len) {
+    if (!s)
+        return NULL;
+
+    if (*s == 0)
+        return s;
+
+    if (s[strlen(s)-1] == '.')
+        return s;
+
+    snprintf(buf, buf_len, "%s.", s);
+    return buf;
+}
+
+static sw_result map_error(int error) {
+    switch (error) {
+        case AVAHI_OK:
+            return SW_OKAY;
+            
+        case AVAHI_ERR_NO_MEMORY:
+            return SW_E_MEM;
+    }
+
+    return SW_E_UNKNOWN;
+}
+
+static int read_command(int fd) {
+    ssize_t r;
+    char command;
+
+    assert(fd >= 0);
+    
+    if ((r = read(fd, &command, 1)) != 1) {
+        fprintf(stderr, __FILE__": read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
+        return -1;
+    }
+
+    return command;
+}
+
+static int write_command(int fd, char reply) {
+    assert(fd >= 0);
+
+    if (write(fd, &reply, 1) != 1) {
+        fprintf(stderr, __FILE__": write() failed: %s\n", strerror(errno));
+        return -1;
+    }
+
+    return 0;
+}
+
+static int poll_func(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata) {
+    sw_discovery self = userdata;
+    int ret;
+    
+    assert(self);
+    
+    ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
+    ret = poll(ufds, nfds, timeout);
+    ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
+
+    return ret;
+}
+
+static void * thread_func(void *data) {
+    sw_discovery self = data;
+    sigset_t mask;
+
+    sigfillset(&mask);
+    pthread_sigmask(SIG_BLOCK, &mask, NULL);
+    
+    self->thread = pthread_self();
+    self->thread_running = 1;
+
+    for (;;) {
+        char command;
+
+        if ((command = read_command(self->thread_fd)) < 0)
+            break;
+
+/*         fprintf(stderr, "Command: %c\n", command); */
+        
+        switch (command) {
+
+            case COMMAND_POLL:
+
+                ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
+                
+                if (avahi_simple_poll_run(self->simple_poll) < 0) {
+                    fprintf(stderr, __FILE__": avahi_simple_poll_run() failed.\n");
+                    ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
+                    break;
+                }
+
+                ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
+                
+                if (write_command(self->thread_fd, COMMAND_POLL_DONE) < 0)
+                    break;
+                
+                break;
+
+            case COMMAND_QUIT:
+                return NULL;
+        }
+        
+    }
+
+    return NULL;
+}
+
+static int oid_alloc(sw_discovery self, oid_type type) {
+    sw_discovery_oid i;
+    assert(self);
+
+    for (i = 0; i < OID_MAX; i++) {
+
+        while (self->oid_index >= OID_MAX)
+            self->oid_index -= OID_MAX;
+        
+        if (self->oid_table[self->oid_index].type == OID_UNUSED) {
+            self->oid_table[self->oid_index].type = type;
+            self->oid_table[self->oid_index].discovery = self;
+            return self->oid_index ++;
+        }
+
+        self->oid_index ++;
+    }
+
+    /* No free entry found */
+    
+    return (sw_discovery_oid) -1;
+}
+
+static void oid_release(sw_discovery self, sw_discovery_oid oid) {
+    assert(self);
+    assert(oid < OID_MAX);
+
+    assert(self->oid_table[oid].type != OID_UNUSED);
+
+    self->oid_table[oid].type = OID_UNUSED;
+    self->oid_table[oid].discovery = NULL;
+    self->oid_table[oid].reply = NULL;
+    self->oid_table[oid].object = NULL;
+    self->oid_table[oid].extra = NULL;
+}
+
+static oid_data* oid_get(sw_discovery self, sw_discovery_oid oid) {
+    assert(self);
+
+    if (oid >= OID_MAX)
+        return NULL;
+
+    if (self->oid_table[oid].type == OID_UNUSED)
+        return NULL;
+    
+    return &self->oid_table[oid];
+}
+
+sw_result sw_discovery_init(sw_discovery * self) {
+    int fd[2] = { -1, -1};
+    sw_result result = SW_E_UNKNOWN;
+    pthread_mutexattr_t mutex_attr;
+    int error;
+    
+    assert(self);
+    
+    AVAHI_WARN_LINKAGE;
+
+    *self = NULL;
+
+    if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0)
+        goto fail;
+    
+    if (!(*self = avahi_new(struct _sw_discovery, 1))) {
+        result = SW_E_MEM;
+        goto fail;
+    }
+
+    (*self)->n_ref = 1;
+    (*self)->thread_fd = fd[0];
+    (*self)->main_fd = fd[1];
+
+    (*self)->client = NULL;
+    (*self)->simple_poll = NULL;
+
+    memset((*self)->oid_table, 0, sizeof((*self)->oid_table));
+    (*self)->oid_index = 0;
+    
+    (*self)->thread_running = 0;
+
+    ASSERT_SUCCESS(pthread_mutexattr_init(&mutex_attr));
+    pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE);
+    ASSERT_SUCCESS(pthread_mutex_init(&(*self)->mutex, NULL));
+
+    if (!((*self)->simple_poll = avahi_simple_poll_new()))
+        goto fail;
+
+    avahi_simple_poll_set_func((*self)->simple_poll, poll_func, *self);
+
+    if (!((*self)->client = avahi_client_new(avahi_simple_poll_get((*self)->simple_poll), NULL, *self, &error))) {
+        result = map_error(error);
+        goto fail;
+    }
+    
+    /* Start simple poll */
+    if (avahi_simple_poll_prepare((*self)->simple_poll, -1) < 0)
+        goto fail;
+
+    /* Queue an initial POLL command for the thread */
+    if (write_command((*self)->main_fd, COMMAND_POLL) < 0)
+        goto fail;
+    
+    if (pthread_create(&(*self)->thread, NULL, thread_func, *self) != 0)
+        goto fail;
+
+    (*self)->thread_running = 1;
+    
+    return SW_OKAY;
+
+fail:
+
+    if (*self)
+        sw_discovery_fina(*self);
+
+    return result;
+}
+
+static int stop_thread(sw_discovery self) {
+    assert(self);
+
+    if (!self->thread_running)
+        return 0;
+
+    if (write_command(self->main_fd, COMMAND_QUIT) < 0)
+        return -1;
+    
+    avahi_simple_poll_wakeup(self->simple_poll);
+    
+    ASSERT_SUCCESS(pthread_join(self->thread, NULL));
+    self->thread_running = 0;
+    return 0;
+}
+
+static sw_discovery discover_ref(sw_discovery self) {
+    assert(self);
+    assert(self->n_ref >= 1);
+
+    self->n_ref++;
+
+    return self;
+}
+
+static void discover_unref(sw_discovery self) {
+    assert(self);
+    assert(self->n_ref >= 1);
+
+    if (--self->n_ref > 0)
+        return;
+
+    stop_thread(self);
+
+    if (self->client)
+        avahi_client_free(self->client);
+
+    if (self->simple_poll)
+        avahi_simple_poll_free(self->simple_poll);
+
+    if (self->thread_fd >= 0)
+        close(self->thread_fd);
+
+    if (self->main_fd >= 0)
+        close(self->main_fd);
+
+    ASSERT_SUCCESS(pthread_mutex_destroy(&self->mutex));
+    
+    avahi_free(self);
+}
+
+sw_result sw_discovery_fina(sw_discovery self) {
+    assert(self);
+    
+    AVAHI_WARN_LINKAGE;
+
+    stop_thread(self);
+    discover_unref(self);
+    
+    return SW_OKAY;
+}
+
+sw_result sw_discovery_run(sw_discovery self) {
+    assert(self);
+    
+    AVAHI_WARN_LINKAGE;
+
+    return sw_salt_run((sw_salt) self);
+}
+
+sw_result sw_discovery_stop_run(sw_discovery self) {
+    assert(self);
+    
+    AVAHI_WARN_LINKAGE;
+
+    return sw_salt_stop_run((sw_salt) self);
+}
+
+int sw_discovery_socket(sw_discovery self) {
+    assert(self);
+    
+    AVAHI_WARN_LINKAGE;
+
+    return self->main_fd;
+}
+
+sw_result sw_discovery_read_socket(sw_discovery self) {
+    sw_result result = SW_E_UNKNOWN;
+    
+    assert(self);
+
+    discover_ref(self);
+
+    ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
+    
+    /* Cleanup notification socket */
+    if (read_command(self->main_fd) != COMMAND_POLL_DONE)
+        goto finish;
+    
+    if (avahi_simple_poll_dispatch(self->simple_poll) < 0)
+        goto finish;
+
+    if (self->n_ref > 1) /* Perhaps we should die */
+
+        /* Dispatch events */
+        if (avahi_simple_poll_prepare(self->simple_poll, -1) < 0)
+            goto finish;
+
+    if (self->n_ref > 1)
+
+        /* Request the poll */
+        if (write_command(self->main_fd, COMMAND_POLL) < 0)
+            goto finish;
+    
+    result = SW_OKAY;
+    
+finish:
+
+    ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
+
+    discover_unref(self);
+    
+    return result;
+}
+
+sw_result sw_discovery_salt(sw_discovery self, sw_salt *salt) {
+    assert(self);
+    assert(salt);
+    
+    AVAHI_WARN_LINKAGE;
+
+    *salt = (sw_salt) self;
+    
+    return SW_OKAY;
+}
+
+sw_result sw_salt_step(sw_salt self, sw_uint32 * msec) {
+    struct pollfd p;
+    int r;
+    sw_result result;
+
+    AVAHI_WARN_LINKAGE;
+
+    if (!((sw_discovery) self)->thread_running)
+        return SW_E_UNKNOWN;
+    
+    memset(&p, 0, sizeof(p));
+    p.fd = ((sw_discovery) self)->main_fd;
+    p.events = POLLIN;
+
+    if ((r = poll(&p, 1, msec ? (int) *msec : -1)) < 0) {
+        
+        /* Don't treat EINTR as error */
+        if (errno == EINTR)
+            return SW_OKAY;
+        
+        return SW_E_UNKNOWN;
+        
+    } else if (r == 0) {
+        
+        /* Timeoout */
+        return SW_OKAY;
+
+    } else {
+        /* Success */
+    
+        if (p.revents != POLLIN)
+            return SW_E_UNKNOWN;
+
+        if ((result = sw_discovery_read_socket((sw_discovery) self)) != SW_OKAY)
+            return result;
+    }
+    
+    return SW_OKAY;
+}
+
+sw_result sw_salt_run(sw_salt self) {
+    sw_result ret;
+    
+    AVAHI_WARN_LINKAGE;
+    
+    for (;;)
+        if ((ret = sw_salt_step(self, NULL)) != SW_OKAY)
+            return ret;
+}
+
+sw_result sw_salt_stop_run(sw_salt self) {
+    AVAHI_WARN_LINKAGE;
+
+    if (stop_thread((sw_discovery) self) < 0)
+        return SW_E_UNKNOWN;
+
+    return SW_OKAY;
+}
+
+sw_result sw_discovery_publish(
+    sw_discovery self,
+    sw_uint32 interface_index,
+    sw_const_string name,
+    sw_const_string type,
+    sw_const_string domain,
+    sw_const_string host,
+    sw_port port,
+    sw_octets text_record,
+    sw_uint32 text_record_len,
+    sw_discovery_publish_reply reply,
+    sw_opaque extra,
+    sw_discovery_oid * oid) {
+    AVAHI_WARN_UNSUPPORTED;
+    return SW_E_NO_IMPL;
+}
+
+sw_result sw_discovery_browse_domains(
+    sw_discovery self,
+    sw_uint32 interface_index,
+    sw_discovery_browse_reply reply,
+    sw_opaque extra,
+    sw_discovery_oid * oid) {
+    AVAHI_WARN_UNSUPPORTED;
+    return SW_E_NO_IMPL;
+}
+
+sw_result sw_discovery_resolve(
+    sw_discovery self,
+    sw_uint32 interface_index,
+    sw_const_string name,
+    sw_const_string type,
+    sw_const_string domain,
+    sw_discovery_resolve_reply reply,
+    sw_opaque extra,
+    sw_discovery_oid * oid) {
+    AVAHI_WARN_UNSUPPORTED;
+    return SW_E_NO_IMPL;
+}
+
+#define OID_GET_INDEX(data) ((sw_discovery_oid) (((data) - ((data)->discovery->oid_table))/sizeof(oid_data)))
+
+static void service_browser_callback(
+    AvahiServiceBrowser *b,
+    AvahiIfIndex interface,
+    AvahiProtocol protocol,
+    AvahiBrowserEvent event,
+    const char *name,
+    const char *type,
+    const char *domain,
+    AvahiLookupResultFlags flags,
+    void *userdata) {
+
+    oid_data* data = userdata;
+    char type_fixed[AVAHI_DOMAIN_NAME_MAX], domain_fixed[AVAHI_DOMAIN_NAME_MAX];
+    sw_discovery_browse_reply reply;
+    
+    assert(b);
+    assert(data);
+
+    reply = (sw_discovery_browse_reply) data->reply;
+
+    type = add_trailing_dot(type, type_fixed, sizeof(type_fixed));
+    domain = add_trailing_dot(domain, domain_fixed, sizeof(domain_fixed));
+
+    switch (event) {
+        case AVAHI_BROWSER_NEW:
+            reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_ADD_SERVICE, interface, name, type, domain, data->extra);
+            break;
+
+        case AVAHI_BROWSER_REMOVE:
+            reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_REMOVE_SERVICE, interface, name, type, domain, data->extra);
+            break;
+
+        case AVAHI_BROWSER_FAILURE:
+            reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_INVALID, interface, name, type, domain, data->extra);
+            break;
+            
+        case AVAHI_BROWSER_CACHE_EXHAUSTED:
+        case AVAHI_BROWSER_ALL_FOR_NOW:
+            break;
+    }
+}
+
+
+sw_result sw_discovery_browse(
+    sw_discovery self,
+    sw_uint32 interface_index,
+    sw_const_string type,
+    sw_const_string domain,
+    sw_discovery_browse_reply reply,
+    sw_opaque extra,
+    sw_discovery_oid * oid) {
+
+    oid_data *data;
+    AvahiIfIndex ifindex;
+    sw_result result = SW_E_UNKNOWN;
+    
+    assert(self);
+    assert(type);
+    assert(reply);
+    assert(oid);
+    
+    AVAHI_WARN_LINKAGE;
+
+    if ((*oid = oid_alloc(self, OID_SERVICE_BROWSER)) == (sw_discovery_oid) -1)
+        return SW_E_UNKNOWN;
+
+    data = oid_get(self, *oid);
+    assert(data);
+    data->reply = (sw_result (*)(void)) reply;
+    data->extra = extra;
+    
+    ifindex = interface_index == 0 ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface_index;
+
+    ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
+    
+    if (!(data->object = avahi_service_browser_new(self->client, ifindex, AVAHI_PROTO_UNSPEC, type, domain, 0, service_browser_callback, data))) {
+        result = map_error(avahi_client_errno(self->client));
+        goto finish;
+    }
+
+    result = SW_OKAY;
+    
+finish:
+
+    ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
+    
+    if (result != SW_OKAY)
+        if (*oid != (sw_discovery_oid) -1)
+            oid_release(self, *oid);
+
+    return result;
+}
+
+sw_result sw_discovery_cancel(sw_discovery self, sw_discovery_oid oid) {
+    oid_data *data;
+    assert(self);                             
+
+    AVAHI_WARN_LINKAGE;
+
+    if (!(data = oid_get(self, oid)))
+        return SW_E_UNKNOWN;
+
+    switch (data->type) {
+        case OID_SERVICE_BROWSER:
+            avahi_service_browser_free(data->object);
+            break;
+
+        case OID_UNUSED:
+            ;
+    }
+
+    oid_release(self, oid);
+    
+    return SW_OKAY;
+}
index 70582170da4553fa598ddd8ae967582741ba1cf4..19cfef18b4b67f4068b9e44dcf397206c2b1886b 100644 (file)
@@ -2,22 +2,18 @@ Functions marked with "x" are already implemented.
 
 Supported:
 
-sw_discovery_init
-sw_discovery_init_with_flags
-sw_discovery_fina
-sw_discovery_publish_host
+x sw_discovery_init
+x sw_discovery_fina
 sw_discovery_publish
-sw_discovery_publish_update
 sw_discovery_browse_domains
-sw_discovery_browse
+sw_discovery_browse
 sw_discovery_resolve
-sw_discovery_query_record
-sw_discovery_cancel
-sw_discovery_run
-sw_discovery_stop_run
-sw_discovery_socket
-sw_discovery_read_socket
-sw_discovery_salt
+x sw_discovery_cancel
+x sw_discovery_run
+x sw_discovery_stop_run
+x sw_discovery_socket
+x sw_discovery_read_socket
+x sw_discovery_salt
 
 x sw_text_record_init
 x sw_text_record_fina
@@ -44,7 +40,7 @@ x sw_ipv4_address_name
 x sw_ipv4_address_decompose
 x sw_ipv4_address_equals
 
-sw_salt_step
+sw_salt_step
 
 Unsupported:
 
@@ -176,6 +172,10 @@ sw_corby_object_send
 sw_corby_object_recv
 sw_corby_object_channel
 sw_corby_object_set_channel
+sw_discovery_init_with_flags
+sw_discovery_publish_update
+sw_discovery_publish_host
+sw_discovery_query_record
 sw_text_record_string_iterator_init
 sw_text_record_string_iterator_fina
 sw_text_record_string_iterator_next
diff --git a/avahi-compat-howl/samples/browse.c b/avahi-compat-howl/samples/browse.c
new file mode 100644 (file)
index 0000000..b4a8cf3
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+ * Copyright 2003, 2004, 2004 Porchdog Software. All rights reserved.
+ *
+ *     Redistribution and use in source and binary forms, with or without modification,
+ *     are permitted provided that the following conditions are met:
+ *
+ *             1. Redistributions of source code must retain the above copyright notice,
+ *                this list of conditions and the following disclaimer.   
+ *             2. Redistributions in binary form must reproduce the above copyright notice,
+ *                this list of conditions and the following disclaimer in the documentation
+ *                and/or other materials provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
+ *     EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ *     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ *     IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ *     INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ *     OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ *     OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ *     OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *     The views and conclusions contained in the software and documentation are those
+ *     of the authors and should not be interpreted as representing official policies,
+ *     either expressed or implied, of Porchdog Software.
+ */
+
+#include <howl.h>
+#include <salt/debug.h>
+#include <stdio.h>
+
+
+static sw_result HOWL_API
+my_resolver(
+                               sw_discovery                    discovery,
+                               sw_discovery_oid                oid,
+                               sw_uint32                               interface_index,
+                               sw_const_string         name,
+                               sw_const_string         type,
+                               sw_const_string         domain,
+                               sw_ipv4_address         address,
+                               sw_port                                 port,
+                               sw_octets                               text_record,
+                               sw_uint32                               text_record_len,
+                               sw_opaque_t                             extra)
+{
+       sw_text_record_iterator                         it;
+       sw_int8                                                                 name_buf[16];
+       sw_int8                                                                 key[SW_TEXT_RECORD_MAX_LEN];
+       sw_int8                                                                 sval[SW_TEXT_RECORD_MAX_LEN];
+       sw_uint8                                                                        oval[SW_TEXT_RECORD_MAX_LEN];
+       sw_uint32                                                               oval_len;
+       sw_result                                                               err = SW_OKAY;
+
+       sw_discovery_cancel(discovery, oid);
+       
+       fprintf(stderr, "resolve reply: 0x%x %s %s %s %s %d\n", interface_index, name, type, domain, sw_ipv4_address_name(address, name_buf, 16), port);
+
+       if ((text_record_len > 0) && (text_record) && (*text_record != '\0'))
+       {
+               err = sw_text_record_iterator_init(&it, text_record, text_record_len);
+               sw_check_okay(err, exit);
+
+               while (sw_text_record_iterator_next(it, key, oval, &oval_len) == SW_OKAY)
+               {
+                       fprintf(stderr, "Txt: [%s]=[%s] - (%d bytes)\n", key, oval, oval_len);
+               }
+
+               err = sw_text_record_iterator_fina(it);
+               sw_check_okay(err, exit);
+       }
+
+exit:
+
+       return err;
+}
+
+
+static sw_result HOWL_API
+my_browser(
+                               sw_discovery                                            discovery,
+                               sw_discovery_oid                                        oid,
+                               sw_discovery_browse_status              status,
+                               sw_uint32                                                       interface_index,
+                               sw_const_string                                 name,
+                               sw_const_string                                 type,
+                               sw_const_string                                 domain,
+                               sw_opaque_t                                                     extra)
+{
+       sw_discovery_resolve_id rid;
+
+       switch (status)
+       {
+               case SW_DISCOVERY_BROWSE_INVALID:
+               {
+                       fprintf(stderr, "browse reply: Invalid\n");
+               }
+               break;
+
+               case SW_DISCOVERY_BROWSE_RELEASE:
+               {
+                       fprintf(stderr, "browse reply: Release\n");
+               }
+               break;
+
+               case SW_DISCOVERY_BROWSE_ADD_DOMAIN:
+               {
+                       fprintf(stderr, "browse reply: Add Domain\n");
+               }
+               break;
+
+               case SW_DISCOVERY_BROWSE_ADD_DEFAULT_DOMAIN:
+               {
+                       fprintf(stderr, "browse reply: Add Default Domain\n");
+               }
+               break;
+
+               case SW_DISCOVERY_BROWSE_REMOVE_DOMAIN:
+               {
+                       fprintf(stderr, "browse reply: Remove Domain\n");
+               }
+               break;
+
+               case SW_DISCOVERY_BROWSE_ADD_SERVICE:
+               {
+                       fprintf(stderr, "browse reply: Add Service 0x%x %s %s %s\n", interface_index, name, type, domain);
+                       if (sw_discovery_resolve(discovery, interface_index, name, type, domain, my_resolver, NULL, &rid) != SW_OKAY)
+                       {
+                               fprintf(stderr, "resolve failed\n");
+                       }
+               }
+               break;
+
+               case SW_DISCOVERY_BROWSE_REMOVE_SERVICE:
+               {
+                       fprintf(stderr, "browse reply: Remove Service\n");
+                       fprintf(stderr, "remove service: 0x%x %s %s %s\n", interface_index, name, type, domain);
+               }
+               break;
+
+               case SW_DISCOVERY_BROWSE_RESOLVED:
+               {
+                       fprintf(stderr, "browse reply: Resolved\n");
+               }
+               break;
+       }
+
+       return SW_OKAY;
+}
+
+
+#if defined(WIN32)
+int __cdecl
+#else
+int
+#endif
+main(
+       int             argc,
+       char    **      argv)
+{
+       sw_discovery            discovery;
+       sw_discovery_oid        oid;
+       sw_result                       err;
+
+       err = sw_discovery_init(&discovery);
+       sw_check_okay(err, exit);
+
+       if (argc != 2)
+       {
+               fprintf(stderr, "usage: mDNSBrowse <type>\n");
+               return -1;
+       }
+
+       err = sw_discovery_browse(discovery, 0, argv[1], NULL, my_browser, NULL, &oid);
+       sw_check_okay(err, exit);
+
+       err = sw_discovery_run(discovery);
+       sw_check_okay(err, exit);
+
+exit:
+
+       return err;
+}
diff --git a/avahi-compat-howl/samples/publish.c b/avahi-compat-howl/samples/publish.c
new file mode 100644 (file)
index 0000000..cca6040
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2003, 2004 Porchdog Software. All rights reserved.
+ *
+ *     Redistribution and use in source and binary forms, with or without modification,
+ *     are permitted provided that the following conditions are met:
+ *
+ *             1. Redistributions of source code must retain the above copyright notice,
+ *                this list of conditions and the following disclaimer.   
+ *             2. Redistributions in binary form must reproduce the above copyright notice,
+ *                this list of conditions and the following disclaimer in the documentation
+ *                and/or other materials provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
+ *     EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ *     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ *     IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ *     INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ *     OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ *     OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ *     OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *     The views and conclusions contained in the software and documentation are those
+ *     of the authors and should not be interpreted as representing official policies,
+ *     either expressed or implied, of Porchdog Software.
+ */
+
+#include <howl.h>
+#include <stdio.h>
+
+
+static sw_result HOWL_API
+my_service_reply(
+                               sw_discovery                                            discovery,
+                               sw_discovery_oid                                        oid,
+                               sw_discovery_publish_status     status,
+                               sw_opaque                                                       extra)
+{
+       static sw_string
+       status_text[] =
+       {
+               "Started",
+               "Stopped",
+               "Name Collision",
+               "Invalid"
+       };
+
+       fprintf(stderr, "publish reply: %s\n", status_text[status]);
+       return SW_OKAY;
+}
+
+
+#if defined(WIN32)
+int __cdecl
+#else
+int
+#endif
+main(
+       int             argc,
+       char    **      argv)
+{
+       sw_discovery                                    discovery;
+       sw_text_record                                  text_record;
+       sw_result                                               result;
+       sw_discovery_publish_id id;
+       int                                                             i;
+
+       if (sw_discovery_init(&discovery) != SW_OKAY)
+       {
+               fprintf(stderr, "sw_discovery_init() failed\n");
+               return -1;
+       }
+
+       if (argc < 4)
+       {
+               fprintf(stderr, "usage: mDNSPublish <name> <type> <port> [service text 1]...[service text n]\n");
+               return -1;
+       }
+
+       if (sw_text_record_init(&text_record) != SW_OKAY)
+       {
+               fprintf(stderr, "sw_text_record_init() failed\n");
+               return -1;
+       }
+
+       for (i = 4; i < argc; i++)
+       {
+               if (sw_text_record_add_string(text_record, argv[i]) != SW_OKAY)
+               {
+                       fprintf(stderr, "unable to add service text: %s\n", argv[i]);
+                       return -1;
+               }
+       }
+
+       printf("%s %s %d\n", argv[1], argv[2], atoi(argv[3]));
+
+       if ((result = sw_discovery_publish(discovery, 0, argv[1], argv[2], NULL, NULL, atoi(argv[3]), sw_text_record_bytes(text_record), sw_text_record_len(text_record), my_service_reply, NULL, &id)) != SW_OKAY)
+       {
+               fprintf(stderr, "publish failed: %d\n", result);
+               sw_text_record_fina(text_record);
+               return -1;
+       }
+
+       sw_text_record_fina(text_record);
+
+       sw_discovery_run(discovery);
+
+       return 0;
+}
diff --git a/avahi-compat-howl/samples/query.c b/avahi-compat-howl/samples/query.c
new file mode 100644 (file)
index 0000000..a74a81c
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2003, 2004, 2004 Porchdog Software. All rights reserved.
+ *
+ *     Redistribution and use in source and binary forms, with or without modification,
+ *     are permitted provided that the following conditions are met:
+ *
+ *             1. Redistributions of source code must retain the above copyright notice,
+ *                this list of conditions and the following disclaimer.   
+ *             2. Redistributions in binary form must reproduce the above copyright notice,
+ *                this list of conditions and the following disclaimer in the documentation
+ *                and/or other materials provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
+ *     EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ *     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ *     IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ *     INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ *     OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ *     OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ *     OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *     The views and conclusions contained in the software and documentation are those
+ *     of the authors and should not be interpreted as representing official policies,
+ *     either expressed or implied, of Porchdog Software.
+ */
+
+#include <howl.h>
+#include <salt/debug.h>
+#include <stdio.h>
+
+
+static sw_result HOWL_API
+query_record_reply(
+                               sw_discovery                                                            session,
+                               sw_discovery_oid                                                        oid,
+                               sw_discovery_query_record_status                status,
+                               sw_uint32                                                                       interface_index,
+                               sw_const_string                                                 fullname,
+                               sw_uint16                                                                       rrtype,
+                               sw_uint16                                                                       rrclass,
+                               sw_uint16                                                                       rrdatalen,      
+                               sw_const_octets                                                 rrdata,
+                               sw_uint32                                                                       ttl,
+                               sw_opaque                                                                       extra)
+{
+       sw_ipv4_address address;
+
+       fprintf(stderr, "interface index = 0x%x, fullname is %s\n", interface_index, fullname);
+
+       if ((rrtype == 1) && (rrclass == 1))
+       {
+               sw_ipv4_address address;
+               sw_char                         name[16];
+
+               sw_ipv4_address_init_from_saddr(&address, *(sw_saddr*) rrdata);
+
+               fprintf(stderr, "address is %s\n", sw_ipv4_address_name(address, name, sizeof(name)));
+       }
+
+       return SW_OKAY;
+}
+
+
+
+#if defined(WIN32)
+int __cdecl
+#else
+int
+#endif
+main(
+       int             argc,
+       char    **      argv)
+{
+       sw_discovery            discovery;
+       sw_discovery_oid        oid;
+       sw_result                       err;
+
+       err = sw_discovery_init(&discovery);
+       sw_check_okay(err, exit);
+
+       if (argc != 4)
+       {
+               fprintf(stderr, "usage: mDNSBrowse <name> <rrtype> <rrclass>\n");
+               return -1;
+       }
+
+       err = sw_discovery_query_record(discovery, 0, 0, argv[1], atoi(argv[2]), atoi(argv[3]), query_record_reply, NULL, &oid);
+       sw_check_okay(err, exit);
+
+       err = sw_discovery_run(discovery);
+       sw_check_okay(err, exit);
+
+exit:
+
+       return err;
+}
diff --git a/avahi-compat-howl/samples/resolve.c b/avahi-compat-howl/samples/resolve.c
new file mode 100644 (file)
index 0000000..b921c27
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2003, 2004, 2004 Porchdog Software. All rights reserved.
+ *
+ *     Redistribution and use in source and binary forms, with or without modification,
+ *     are permitted provided that the following conditions are met:
+ *
+ *             1. Redistributions of source code must retain the above copyright notice,
+ *                this list of conditions and the following disclaimer.   
+ *             2. Redistributions in binary form must reproduce the above copyright notice,
+ *                this list of conditions and the following disclaimer in the documentation
+ *                and/or other materials provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
+ *     EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ *     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ *     IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ *     INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ *     OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ *     OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ *     OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *     The views and conclusions contained in the software and documentation are those
+ *     of the authors and should not be interpreted as representing official policies,
+ *     either expressed or implied, of Porchdog Software.
+ */
+
+#include <howl.h>
+#include <salt/debug.h>
+#include <stdio.h>
+
+
+static sw_result HOWL_API
+my_resolver(
+                               sw_discovery                    discovery,
+                               sw_discovery_oid                oid,
+                               sw_uint32                               interface_index,
+                               sw_const_string         name,
+                               sw_const_string         type,
+                               sw_const_string         domain,
+                               sw_ipv4_address         address,
+                               sw_port                                 port,
+                               sw_octets                               text_record,
+                               sw_uint32                               text_record_len,
+                               sw_opaque_t                             extra)
+{
+       sw_text_record_iterator                         it;
+       sw_int8                                                                 name_buf[16];
+       sw_int8                                                                 key[SW_TEXT_RECORD_MAX_LEN];
+       sw_int8                                                                 sval[SW_TEXT_RECORD_MAX_LEN];
+       sw_uint8                                                                        oval[SW_TEXT_RECORD_MAX_LEN];
+       sw_uint32                                                               oval_len;
+       sw_result                                                               err = SW_OKAY;
+
+       sw_discovery_cancel(discovery, oid);
+       
+       fprintf(stderr, "resolve reply: 0x%x %s %s %s %s %d\n", interface_index, name, type, domain, sw_ipv4_address_name(address, name_buf, 16), port);
+
+       if ((text_record_len > 0) && (text_record) && (*text_record != '\0'))
+       {
+               err = sw_text_record_iterator_init(&it, text_record, text_record_len);
+               sw_check_okay(err, exit);
+
+               while (sw_text_record_iterator_next(it, key, oval, &oval_len) == SW_OKAY)
+               {
+                       fprintf(stderr, "key = %s, data is %d bytes\n", key, oval_len);
+               }
+
+               err = sw_text_record_iterator_fina(it);
+               sw_check_okay(err, exit);
+       }
+
+exit:
+
+       return err;
+}
+
+
+#if defined(WIN32)
+int __cdecl
+#else
+int
+#endif
+main(
+       int             argc,
+       char    **      argv)
+{
+       sw_discovery            discovery;
+       sw_discovery_oid        oid;
+       sw_result                       err;
+
+       err = sw_discovery_init(&discovery);
+       sw_check_okay(err, exit);
+
+       if (argc != 3)
+       {
+               fprintf(stderr, "usage: mDNSResolve <name> <type>\n");
+               return -1;
+       }
+
+       err = sw_discovery_resolve(discovery, 0, argv[1], argv[2], "local.", my_resolver, NULL, &oid);
+       sw_check_okay(err, exit);
+
+       err = sw_discovery_run(discovery);
+       sw_check_okay(err, exit);
+
+exit:
+
+       return err;
+}
index 25428d814ac8aec68ceb96f4f29ae8d115fe2031..cbf51c78a97e5969332b38bb7ace842beb8667db 100644 (file)
 
 #include <assert.h>
 
-#include <howl.h>
-
 #include <avahi-common/strlst.h>
 #include <avahi-common/malloc.h>
 #include <avahi-common/domain.h>
 
+#include "howl.h"
 #include "warn.h"
 
 struct _sw_text_record {
index dade02f39bb3ae0d61a15deaf2f5cc3f8426859d..b636480a0b168588f5258f22bc071c9f9770bef3 100644 (file)
@@ -23,8 +23,7 @@
 #include <config.h>
 #endif
 
-#include <howl.h>
-
+#include "howl.h"
 #include "warn.h"
 
 sw_string sw_strdup(sw_const_string str) {
@@ -201,20 +200,6 @@ sw_result sw_salt_unlock(sw_salt self) {
     return SW_E_NO_IMPL;
 }
 
-sw_result sw_salt_step(sw_salt self, sw_uint32 * msec) {
-    AVAHI_WARN_UNSUPPORTED;
-    return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_run(sw_salt self) {
-    AVAHI_WARN_UNSUPPORTED;
-    return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_stop_run(sw_salt self) {
-    AVAHI_WARN_UNSUPPORTED;
-    return SW_E_NO_IMPL;
-}
 
 void sw_print_assert(
     int code,
@@ -977,12 +962,6 @@ sw_result sw_corby_object_set_channel(
     return SW_E_NO_IMPL;
 }
 
-sw_result sw_discovery_init(
-    sw_discovery * self) {
-    AVAHI_WARN_UNSUPPORTED;
-    return SW_E_NO_IMPL;
-}
-
 sw_result sw_discovery_init_with_flags(
     sw_discovery * self,
     sw_discovery_init_flags flags) {
@@ -990,11 +969,6 @@ sw_result sw_discovery_init_with_flags(
     return SW_E_NO_IMPL;
 }
 
-sw_result sw_discovery_fina(sw_discovery self) {
-    AVAHI_WARN_UNSUPPORTED;
-    return SW_E_NO_IMPL;
-}
-
 sw_result sw_discovery_publish_host(
     sw_discovery self,
     sw_uint32 interface_index,
@@ -1008,23 +982,6 @@ sw_result sw_discovery_publish_host(
     return SW_E_NO_IMPL;
 }
 
-sw_result sw_discovery_publish(
-    sw_discovery self,
-    sw_uint32 interface_index,
-    sw_const_string name,
-    sw_const_string type,
-    sw_const_string domain,
-    sw_const_string host,
-    sw_port port,
-    sw_octets text_record,
-    sw_uint32 text_record_len,
-    sw_discovery_publish_reply reply,
-    sw_opaque extra,
-    sw_discovery_oid * oid) {
-    AVAHI_WARN_UNSUPPORTED;
-    return SW_E_NO_IMPL;
-}
-
 sw_result sw_discovery_publish_update(
     sw_discovery self,
     sw_discovery_oid oid,
@@ -1034,41 +991,6 @@ sw_result sw_discovery_publish_update(
     return SW_E_NO_IMPL;
 }
 
-sw_result sw_discovery_browse_domains(
-    sw_discovery self,
-    sw_uint32 interface_index,
-    sw_discovery_browse_reply reply,
-    sw_opaque extra,
-    sw_discovery_oid * oid) {
-    AVAHI_WARN_UNSUPPORTED;
-    return SW_E_NO_IMPL;
-}
-
-sw_result sw_discovery_browse(
-    sw_discovery self,
-    sw_uint32 interface_index,
-    sw_const_string type,
-    sw_const_string domain,
-    sw_discovery_browse_reply reply,
-    sw_opaque extra,
-    sw_discovery_oid * oid) {
-    AVAHI_WARN_UNSUPPORTED;
-    return SW_E_NO_IMPL;
-}
-
-sw_result sw_discovery_resolve(
-    sw_discovery self,
-    sw_uint32 interface_index,
-    sw_const_string name,
-    sw_const_string type,
-    sw_const_string domain,
-    sw_discovery_resolve_reply reply,
-    sw_opaque extra,
-    sw_discovery_oid * oid) {
-    AVAHI_WARN_UNSUPPORTED;
-    return SW_E_NO_IMPL;
-}
-
 sw_result sw_discovery_query_record(
     sw_discovery self,
     sw_uint32 interface_index,
@@ -1083,41 +1005,6 @@ sw_result sw_discovery_query_record(
     return SW_E_NO_IMPL;
 }
 
-sw_result sw_discovery_cancel(
-    sw_discovery self,
-    sw_discovery_oid oid) {
-    AVAHI_WARN_UNSUPPORTED;
-    return SW_E_NO_IMPL;
-}
-
-sw_result sw_discovery_run(
-    sw_discovery self) {
-    AVAHI_WARN_UNSUPPORTED;
-    return SW_E_NO_IMPL;
-}
-
-sw_result sw_discovery_stop_run(
-    sw_discovery self) {
-    AVAHI_WARN_UNSUPPORTED;
-    return SW_E_NO_IMPL;
-}
-
-int sw_discovery_socket(sw_discovery self) {
-    AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_discovery_read_socket(sw_discovery self) {
-    AVAHI_WARN_UNSUPPORTED;
-    return SW_E_NO_IMPL;
-}
-
-sw_result sw_discovery_salt(
-    sw_discovery self,
-    sw_salt * salt) {
-    AVAHI_WARN_UNSUPPORTED;
-    return SW_E_NO_IMPL;
-}
-
 sw_result sw_text_record_string_iterator_init(
     sw_text_record_string_iterator * self,
     sw_const_string text_record_string) {