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 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.
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
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
char buf[AVAHI_DOMAIN_NAME_MAX*3], *e, *t, *p;
assert(b);
char buf[AVAHI_DOMAIN_NAME_MAX*3], *e, *t, *p;
assert(b);
while (fgets(buf, sizeof(buf)-1, f)) {
char domain[AVAHI_DOMAIN_NAME_MAX];
buf[strcspn(buf, "\n\r")] = 0;
while (fgets(buf, sizeof(buf)-1, f)) {
char domain[AVAHI_DOMAIN_NAME_MAX];
buf[strcspn(buf, "\n\r")] = 0;
if (avahi_normalize_name(buf, domain, sizeof(domain)))
b->static_browse_domains = avahi_string_list_add(b->static_browse_domains, domain);
}
if (avahi_normalize_name(buf, domain, sizeof(domain)))
b->static_browse_domains = avahi_string_list_add(b->static_browse_domains, domain);
}
AvahiDomainBrowser *db = NULL;
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
AvahiDomainBrowser *db = NULL;
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "DomainBrowserNew"))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "DomainBrowserNew"))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
struct timeval tv = { 0, 0 };
if (!(db->defer_timeout = client->poll_api->timeout_new(client->poll_api, &tv, defer_timeout_callback, db))) {
struct timeval tv = { 0, 0 };
if (!(db->defer_timeout = client->poll_api->timeout_new(client->poll_api, &tv, defer_timeout_callback, db))) {
if (!dbus_message_get_args(
message, &error,
DBUS_TYPE_INT32, &interface,
if (!dbus_message_get_args(
message, &error,
DBUS_TYPE_INT32, &interface,
case AVAHI_BROWSER_CACHE_EXHAUSTED:
case AVAHI_BROWSER_ALL_FOR_NOW:
break;
case AVAHI_BROWSER_FAILURE: {
char *etxt;
case AVAHI_BROWSER_CACHE_EXHAUSTED:
case AVAHI_BROWSER_ALL_FOR_NOW:
break;
case AVAHI_BROWSER_FAILURE: {
char *etxt;
db->callback(db, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, domain, (AvahiLookupResultFlags) flags, db->userdata);
return DBUS_HANDLER_RESULT_HANDLED;
db->callback(db, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, domain, (AvahiLookupResultFlags) flags, db->userdata);
return DBUS_HANDLER_RESULT_HANDLED;
AvahiServiceTypeBrowser *b = NULL;
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
AvahiServiceTypeBrowser *b = NULL;
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "ServiceTypeBrowserNew"))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
}
if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "ServiceTypeBrowserNew"))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
}
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
u_flags = (uint32_t) flags;
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
u_flags = (uint32_t) flags;
if (dbus_error_is_set(&error)) {
avahi_client_set_dbus_error(client, &error);
dbus_error_free(&error);
if (dbus_error_is_set(&error)) {
avahi_client_set_dbus_error(client, &error);
dbus_error_free(&error);
case AVAHI_BROWSER_CACHE_EXHAUSTED:
case AVAHI_BROWSER_ALL_FOR_NOW:
break;
case AVAHI_BROWSER_FAILURE: {
char *etxt;
case AVAHI_BROWSER_CACHE_EXHAUSTED:
case AVAHI_BROWSER_ALL_FOR_NOW:
break;
case AVAHI_BROWSER_FAILURE: {
char *etxt;
AvahiServiceBrowser *b = NULL;
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
AvahiServiceBrowser *b = NULL;
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
if (domain && domain[0])
if (!(b->domain = avahi_strdup(domain))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
}
if (domain && domain[0])
if (!(b->domain = avahi_strdup(domain))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
}
if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "ServiceBrowserNew"))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "ServiceBrowserNew"))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
if (!dbus_message_get_args (
message, &error,
DBUS_TYPE_INT32, &interface,
if (!dbus_message_get_args (
message, &error,
DBUS_TYPE_INT32, &interface,
AvahiRecordBrowser *b = NULL;
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
AvahiRecordBrowser *b = NULL;
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "RecordBrowserNew"))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "RecordBrowserNew"))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_BYTE)
goto fail;
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_BYTE)
goto fail;
dbus_message_iter_get_fixed_array(&sub, &rdata, &rdata_size);
dbus_message_iter_next(&iter);
dbus_message_iter_get_fixed_array(&sub, &rdata, &rdata_size);
dbus_message_iter_next(&iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32)
goto fail;
dbus_message_iter_get_basic(&iter, &flags);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32)
goto fail;
dbus_message_iter_get_basic(&iter, &flags);