AvahiProtocol protocol,
const char *domain,
AvahiDomainBrowserType btype,
+ AvahiLookupFlags flags,
AvahiDomainBrowserCallback callback,
void *userdata) {
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
char *path;
- int32_t i_interface, i_protocol, bt;
+ int32_t i_interface, i_protocol, i_flags, bt;
assert(client);
assert(callback);
goto fail;
}
- i_interface = interface;
- i_protocol = protocol;
+ i_interface = (int32_t) interface;
+ i_protocol = (int32_t) protocol;
+ i_flags = (int32_t) flags;
bt = btype;
if (!(dbus_message_append_args(
DBUS_TYPE_INT32, &i_protocol,
DBUS_TYPE_STRING, &domain,
DBUS_TYPE_INT32, &bt,
+ DBUS_TYPE_INT32, &flags,
DBUS_TYPE_INVALID))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
AvahiDomainBrowser *db = NULL;
DBusError error;
const char *path;
- char *domain;
- int32_t interface, protocol;
+ char *domain = NULL;
+ int32_t interface = AVAHI_IF_UNSPEC, protocol = AVAHI_PROTO_UNSPEC, flags = 0;
assert(client);
assert(message);
if (!db)
goto fail;
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
+ if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) {
+ if (!dbus_message_get_args(
+ message, &error,
+ DBUS_TYPE_INT32, &interface,
+ DBUS_TYPE_INT32, &protocol,
+ DBUS_TYPE_STRING, &domain,
+ DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_INVALID) ||
+ dbus_error_is_set (&error)) {
+ fprintf(stderr, "Failed to parse browser event.\n");
+ goto fail;
+ }
}
- db->callback(db, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, domain, db->userdata);
+ db->callback(db, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, domain, (AvahiLookupResultFlags) flags, db->userdata);
return DBUS_HANDLER_RESULT_HANDLED;
AvahiIfIndex interface,
AvahiProtocol protocol,
const char *domain,
+ AvahiLookupFlags flags,
AvahiServiceTypeBrowserCallback callback,
void *userdata) {
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
char *path;
- int32_t i_interface, i_protocol;
+ int32_t i_interface, i_protocol, i_flags;
assert(client);
assert(callback);
goto fail;
}
- i_interface = interface;
- i_protocol = protocol;
+ i_interface = (int32_t) interface;
+ i_protocol = (int32_t) protocol;
+ i_flags = (int32_t) flags;
if (!dbus_message_append_args(
message,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
+ DBUS_TYPE_INT32, &i_interface,
+ DBUS_TYPE_INT32, &i_protocol,
DBUS_TYPE_STRING, &domain,
+ DBUS_TYPE_INT32, &i_flags,
DBUS_TYPE_INVALID)) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
AvahiServiceTypeBrowser *b = NULL;
DBusError error;
const char *path;
- char *domain, *type;
- int32_t interface, protocol;
+ char *domain = NULL, *type = NULL;
+ int32_t interface = AVAHI_IF_UNSPEC, protocol = AVAHI_PROTO_UNSPEC, flags = 0;
assert(client);
assert(message);
if (!b)
goto fail;
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
+ if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) {
+ if (!dbus_message_get_args(
+ message, &error,
+ DBUS_TYPE_INT32, &interface,
+ DBUS_TYPE_INT32, &protocol,
+ DBUS_TYPE_STRING, &type,
+ DBUS_TYPE_STRING, &domain,
+ DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_INVALID) ||
+ dbus_error_is_set(&error)) {
+ fprintf(stderr, "Failed to parse browser event.\n");
+ goto fail;
+ }
}
- b->callback(b, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, type, domain, b->userdata);
+ b->callback(b, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, type, domain, (AvahiLookupResultFlags) flags, b->userdata);
return DBUS_HANDLER_RESULT_HANDLED;
AvahiProtocol protocol,
const char *type,
const char *domain,
+ AvahiLookupFlags flags,
AvahiServiceBrowserCallback callback,
void *userdata) {
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
char *path;
- int32_t i_protocol, i_interface;
+ int32_t i_protocol, i_interface, i_flags;
assert(client);
assert(type);
goto fail;
}
- i_interface = interface;
- i_protocol = protocol;
-
+ i_interface = (int32_t) interface;
+ i_protocol = (int32_t) protocol;
+ i_flags = (int32_t) flags;
if (!dbus_message_append_args(
message,
DBUS_TYPE_INT32, &i_protocol,
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
+ DBUS_TYPE_INT32, &i_flags,
DBUS_TYPE_INVALID)) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
AvahiServiceBrowser *b = NULL;
DBusError error;
const char *path;
- char *name, *type, *domain;
- int32_t interface, protocol;
+ char *name = NULL, *type = NULL, *domain = NULL;
+ int32_t interface = AVAHI_IF_UNSPEC, protocol = AVAHI_PROTO_UNSPEC, flags = 0;
dbus_error_init (&error);
if (!b)
goto fail;
- if (!dbus_message_get_args (
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
+ if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) {
+ if (!dbus_message_get_args (
+ message, &error,
+ DBUS_TYPE_INT32, &interface,
+ DBUS_TYPE_INT32, &protocol,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_STRING, &type,
+ DBUS_TYPE_STRING, &domain,
+ DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_INVALID) ||
+ dbus_error_is_set(&error)) {
+ fprintf(stderr, "Failed to parse browser event.\n");
+ goto fail;
+ }
}
- b->callback(b, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, name, type, domain, b->userdata);
+ b->callback(b, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, name, type, domain, (AvahiLookupResultFlags) flags, b->userdata);
return DBUS_HANDLER_RESULT_HANDLED;