#include <netinet/in.h>
#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
#include <avahi-common/simple-watch.h>
#include <avahi-common/malloc.h>
#include <avahi-common/error.h>
case AVAHI_ERR_INVALID_CONFIG:
case AVAHI_ERR_TIMEOUT:
case AVAHI_ERR_DBUS_ERROR:
- case AVAHI_ERR_NOT_CONNECTED:
+ case AVAHI_ERR_DISCONNECTED:
case AVAHI_ERR_NO_DAEMON:
break;
assert(sdref->n_ref >= 1);
switch (state) {
-
- case AVAHI_CLIENT_DISCONNECTED:
+
+ case AVAHI_CLIENT_FAILURE:
if (sdref->service_browser_callback)
sdref->service_browser_callback(sdref, 0, 0, error, NULL, NULL, NULL, sdref->context);
case AVAHI_CLIENT_S_RUNNING:
case AVAHI_CLIENT_S_COLLISION:
case AVAHI_CLIENT_S_REGISTERING:
+ case AVAHI_CLIENT_CONNECTING:
break;
}
}
ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
- if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), generic_client_callback, sdref, &error))) {
+ if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), 0, generic_client_callback, sdref, &error))) {
ret = map_error(error);
goto finish;
}
ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
- if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), generic_client_callback, sdref, &error))) {
+ if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), 0, generic_client_callback, sdref, &error))) {
ret = map_error(error);
goto finish;
}
ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
- if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), generic_client_callback, sdref, &error))) {
+ if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), 0, generic_client_callback, sdref, &error))) {
ret = map_error(error);
goto finish;
}
return;
switch (state) {
- case AVAHI_CLIENT_DISCONNECTED:
+ case AVAHI_CLIENT_FAILURE:
reg_report_error(sdref, kDNSServiceErr_Unknown);
break;
break;
+ case AVAHI_CLIENT_CONNECTING:
case AVAHI_CLIENT_S_REGISTERING:
/* Ignore */
break;
DNSServiceErrorType ret = kDNSServiceErr_Unknown;
int error;
DNSServiceRef sdref = NULL;
+ AvahiStringList *txt = NULL;
AVAHI_WARN_LINKAGE;
return kDNSServiceErr_Unsupported;
}
- if (!(sdref = sdref_new()))
+ if (txtRecord && txtLen > 0)
+ if (avahi_string_list_parse(txtRecord, txtLen, &txt) < 0)
+ return kDNSServiceErr_Invalid;
+
+ if (!(sdref = sdref_new())) {
+ avahi_string_list_free(txt);
return kDNSServiceErr_Unknown;
+ }
sdref->context = context;
sdref->service_register_callback = callback;
sdref->service_host = host ? avahi_normalize_name_strdup(host) : NULL;
sdref->service_interface = interface == kDNSServiceInterfaceIndexAny ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface;
sdref->service_port = ntohs(port);
- sdref->service_txt = txtRecord && txtLen > 0 ? avahi_string_list_parse(txtRecord, txtLen) : NULL;
+ sdref->service_txt = txt;
/* Some OOM checking would be cool here */
ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
- if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), reg_client_callback, sdref, &error))) {
+ if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), 0, reg_client_callback, sdref, &error))) {
ret = map_error(error);
goto finish;
}