sssd_dbus_common.c revision 83bf46f4066e3d5e838a32357c201de9bd6ecdfd
/*
Authors:
Simo Sorce <ssorce@redhat.com>
Stephen Gallagher <sgallagh@redhat.com>
Copyright (C) 2009 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <tevent.h>
#include "sbus/sssd_dbus.h"
#include "sbus/sssd_dbus_private.h"
/* =Watches=============================================================== */
/* DBUS may ask us to add a watch to a file descriptor that already had a watch
* associated. Need to check if that's the case */
{
struct sbus_watch_ctx *watch_iter;
watch_iter = list;
while (watch_iter != NULL) {
return watch_iter;
}
}
return NULL;
}
static int watch_destructor(void *mem)
{
struct sbus_watch_ctx *watch;
return 0;
}
/*
* watch_handler
* Callback for D-BUS to handle messages on a file-descriptor
*/
{
struct sbus_watch_ctx);
enum dbus_conn_type type;
union dbus_conn_pointer dbus_p;
/* conn may get freed inside a handle, save the data we need for later */
/* Take a reference while handling watch */
if (type == SBUS_SERVER) {
} else {
}
/* Fire if readable */
if (flags & TEVENT_FD_READ) {
if (watch->dbus_read_watch) {
}
}
/* Fire if writeable */
if (flags & TEVENT_FD_WRITE) {
if (watch->dbus_write_watch) {
}
}
/* Release reference once done */
if (type == SBUS_SERVER) {
} else {
}
}
/*
* add_watch
* Set up hooks into the libevents mainloop for
* D-BUS to add file descriptor-based events
*/
{
unsigned int flags;
struct sbus_connection *conn;
struct sbus_watch_ctx *watch;
int fd;
#ifdef HAVE_DBUS_WATCH_GET_UNIX_FD
#else
#endif
if (!watch) {
/* does not exist, allocate new one */
if (!watch) {
return FALSE;
}
}
/* Save the event to the watch object so it can be found later */
if (flags & DBUS_WATCH_READABLE) {
}
if (flags & DBUS_WATCH_WRITABLE) {
}
/* pre-existing event, just toggle flags */
return TRUE;
}
event_flags = 0;
if (enabled) {
if (flags & DBUS_WATCH_READABLE) {
}
if (flags & DBUS_WATCH_WRITABLE) {
}
}
/* Add the file descriptor to the event loop */
return FALSE;
}
return TRUE;
}
/*
* toggle_watch
* an event in the mainloop
*/
{
struct sbus_watch_ctx *watch;
unsigned int flags;
void *watch_data;
int fd = -1;
if (!watch) {
"[%p] does not carry watch context?!\n", dbus_watch);
/* abort ? */
return;
}
if (enabled) {
if (flags & DBUS_WATCH_READABLE) {
}
if (flags & DBUS_WATCH_WRITABLE) {
}
} else {
if (flags & DBUS_WATCH_READABLE) {
}
if (flags & DBUS_WATCH_WRITABLE) {
}
}
if (DEBUG_IS_SET(SSSDBG_TRACE_ALL)) {
#ifdef HAVE_DBUS_WATCH_GET_UNIX_FD
#else
#endif
}
"%p/%p (%d), %s/%s (%s)\n",
}
/*
* sbus_remove_watch
* Hook for D-BUS to remove file descriptor-based events
* from the libevents mainloop
*/
{
struct sbus_watch_ctx *watch;
void *watch_data;
if (!watch) {
return;
}
/* remove dbus watch data */
/* check which watch to remove, or free if none left */
}
}
}
}
/* =Timeouts============================================================== */
return tv;
}
/*
* timeout_handler
* Callback for D-BUS to handle timed events
*/
struct tevent_timer *te,
{
struct sbus_timeout_ctx *timeout;
}
/*
* add_timeout
* Hook for D-BUS to add time-based events to the mainloop
*/
{
struct sbus_connection *conn;
struct sbus_timeout_ctx *timeout;
if (!dbus_timeout_get_enabled(dbus_timeout)) {
return TRUE;
}
if (!timeout) {
return FALSE;
}
return FALSE;
}
/* Save the event to the watch object so it can be removed later */
return TRUE;
}
/*
* sbus_toggle_timeout
* event
*/
{
if (dbus_timeout_get_enabled(dbus_timeout)) {
} else {
}
}
/*
* sbus_remove_timeout
* Hook for D-BUS to remove time-based events from the mainloop
*/
{
void *timeout;
/* remove dbus timeout data */
/* Freeing the event object will remove it from the event loop */
}