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
USA.
***/
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.
***/
static void watch_callback(AvahiWatch *avahi_watch, AVAHI_GCC_UNUSED int fd, AvahiWatchEvent events, void *userdata) {
DBusWatch *dbus_watch = userdata;
static void watch_callback(AvahiWatch *avahi_watch, AVAHI_GCC_UNUSED int fd, AvahiWatchEvent events, void *userdata) {
DBusWatch *dbus_watch = userdata;
translate_dbus_to_avahi(dbus_watch_get_flags(dbus_watch)),
watch_callback,
dbus_watch)))
return FALSE;
dbus_watch_set_data(dbus_watch, avahi_watch, NULL);
translate_dbus_to_avahi(dbus_watch_get_flags(dbus_watch)),
watch_callback,
dbus_watch)))
return FALSE;
dbus_watch_set_data(dbus_watch, avahi_watch, NULL);
poll_api->watch_free(avahi_watch);
dbus_watch_set_data(dbus_watch, NULL, NULL);
} else if (avahi_watch) {
poll_api->watch_free(avahi_watch);
dbus_watch_set_data(dbus_watch, NULL, NULL);
} else if (avahi_watch) {
static dbus_bool_t add_watch(DBusWatch *dbus_watch, void *userdata) {
ConnectionData *d = userdata;
static dbus_bool_t add_watch(DBusWatch *dbus_watch, void *userdata) {
ConnectionData *d = userdata;
static void remove_watch(DBusWatch *dbus_watch, void *userdata) {
ConnectionData *d = userdata;
AvahiWatch *avahi_watch;
static void remove_watch(DBusWatch *dbus_watch, void *userdata) {
ConnectionData *d = userdata;
AvahiWatch *avahi_watch;
static void watch_toggled(DBusWatch *dbus_watch, void *userdata) {
ConnectionData *d = userdata;
static void watch_toggled(DBusWatch *dbus_watch, void *userdata) {
ConnectionData *d = userdata;
if (dbus_timeout_get_enabled(timeout->dbus_timeout)) {
struct timeval tv;
avahi_elapse_time(&tv, dbus_timeout_get_interval(timeout->dbus_timeout), 0);
if (dbus_timeout_get_enabled(timeout->dbus_timeout)) {
struct timeval tv;
avahi_elapse_time(&tv, dbus_timeout_get_interval(timeout->dbus_timeout), 0);
static void timeout_callback(AvahiTimeout *avahi_timeout, void *userdata) {
TimeoutData *timeout = userdata;
static void timeout_callback(AvahiTimeout *avahi_timeout, void *userdata) {
TimeoutData *timeout = userdata;
if ((b = dbus_timeout_get_enabled(dbus_timeout)))
avahi_elapse_time(&tv, dbus_timeout_get_interval(dbus_timeout), 0);
if ((b = dbus_timeout_get_enabled(dbus_timeout)))
avahi_elapse_time(&tv, dbus_timeout_get_interval(dbus_timeout), 0);
static void dispatch_status(AVAHI_GCC_UNUSED DBusConnection *connection, DBusDispatchStatus new_status, void *userdata) {
ConnectionData *d = userdata;
static void dispatch_status(AVAHI_GCC_UNUSED DBusConnection *connection, DBusDispatchStatus new_status, void *userdata) {
ConnectionData *d = userdata;
if (new_status == DBUS_DISPATCH_DATA_REMAINS)
request_dispatch(d, 1);
}
int avahi_dbus_connection_glue(DBusConnection *c, const AvahiPoll *poll_api) {
ConnectionData *d = NULL;
if (new_status == DBUS_DISPATCH_DATA_REMAINS)
request_dispatch(d, 1);
}
int avahi_dbus_connection_glue(DBusConnection *c, const AvahiPoll *poll_api) {
ConnectionData *d = NULL;
if (!(d->dispatch_timeout = poll_api->timeout_new(poll_api, NULL, dispatch_timeout_callback, d)))
goto fail;
if (!(d->dispatch_timeout = poll_api->timeout_new(poll_api, NULL, dispatch_timeout_callback, d)))
goto fail;
if (!(dbus_connection_set_watch_functions(c, add_watch, remove_watch, watch_toggled, connection_data_ref(d), (DBusFreeFunction)connection_data_unref)))
goto fail;
if (!(dbus_connection_set_watch_functions(c, add_watch, remove_watch, watch_toggled, connection_data_ref(d), (DBusFreeFunction)connection_data_unref)))
goto fail;