sssd_dbus_client.c revision 054a931b01f98cf94b42f1ff1f48fbcb4928c869
#include "dbus/sssd_dbus_common.h"
#include "dbus/sssd_dbus_client.h"
#include "events.h"
const char* print_status(int status) {
switch (status){
return "DBUS_DISPATCH_DATA_REMAINS";
case DBUS_DISPATCH_COMPLETE:
return "DBUS_DISPATCH_COMPLETE";
return "DBUS_DISPATCH_NEED_MEMORY";
default:
return "ERROR";
}
}
struct timed_event *te,
struct timed_event *new_event;
/* Dispatch only once each time through the mainloop to avoid
* starving other features
*/
}
/* If other dispatches are waiting, queue up the do_dispatch function
* for the next loop.
*/
DEBUG(0,("Could not add dispatch event!\n"));
exit(1);
}
}
}
/*
* integrate_connection_with_event_loop
* Set up a D-BUS connection to use the libevents mainloop
* for handling file descriptor and timed events
*/
struct dbus_connection_toplevel_context *dt_ctx;
/* Set up DBusWatch functions */
DEBUG(0,("Error setting up D-BUS connection watch functions\n"));
return -1;
}
/* Set up DBusTimeout functions */
DEBUG(0,("Error setting up D-BUS server timeout functions\n"));
return -1;
}
/* Set up dispatch handler */
/* Attempt to dispatch immediately in case of opportunistic
* services connecting before the handlers were all up.
* If there are no messages to be dispatched, this will do
* nothing.
*/
return 0;
}
/*
* add_connection_watch
* Set up hooks into the libevents mainloop for
* D-BUS to add file descriptor-based events
*/
unsigned int flags;
unsigned int event_flags;
struct dbus_connection_toplevel_context *dt_ctx;
struct dbus_connection_watch_context *conn_w_ctx;
if (!dbus_watch_get_enabled(watch)) {
return TRUE;
}
event_flags = 0;
if (flags & DBUS_WATCH_READABLE)
if (flags & DBUS_WATCH_WRITABLE)
if (event_flags == 0)
return FALSE;
/* Add the file descriptor to the event loop */
/* Save the event to the watch object so it can be removed later */
return TRUE;
}
/*
* toggle_connection_watch
* an event in the mainloop
*/
if (dbus_watch_get_enabled(watch))
else
}
/*
* add_connection_timeout
* Hook for D-BUS to add time-based events to the mainloop
*/
struct dbus_connection_toplevel_context *dt_ctx;
if (!dbus_timeout_get_enabled(timeout))
return TRUE;
/* Save the event to the watch object so it can be removed later */
return TRUE;
}
/*
* toggle_connection_timeout
* event
*/
else
}
/*
* dbus_connection_read_write_handler
* Callback for D-BUS to handle messages on a file-descriptor
*/
struct dbus_connection_watch_context *conn_w_ctx;
if (flags & EVENT_FD_READ) {
}
if (flags & EVENT_FD_WRITE) {
}
}
/*
* dbus_connection_timeout_handler
* Callback for D-BUS to handle timed events
*/
}
/* dbus_connection_wakeup_main
* D-BUS makes a callback to the wakeup_main function when
* it has data available for dispatching.
* In order to avoid blocking, this function will create a now()
* timed event to perform the dispatch during the next iteration
* through the mainloop
*/
void dbus_connection_wakeup_main(void *data) {
struct dbus_connection_toplevel_context *dct_ctx;
struct timed_event *te;
/* D-BUS calls this function when it is time to do a dispatch */
DEBUG(0,("Could not add dispatch event!\n"));
exit(1);
}
}