summaryrefslogtreecommitdiffstats
path: root/server/sbus/sssd_dbus_common.c
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2008-11-03 09:50:19 -0500
committerSimo Sorce <idra@samba.org>2008-11-03 10:12:29 -0500
commit73f7183c9d244e7cdbe5c7ec91677b64a5f08e8e (patch)
tree5c54276a07dd0e15f6438d9019d9e03619aa7a0f /server/sbus/sssd_dbus_common.c
parent8b8210c79b297b87e56d068e8839f7fe6755ab15 (diff)
downloadsssd-73f7183c9d244e7cdbe5c7ec91677b64a5f08e8e.tar.gz
sssd-73f7183c9d244e7cdbe5c7ec91677b64a5f08e8e.tar.xz
sssd-73f7183c9d244e7cdbe5c7ec91677b64a5f08e8e.zip
Renaming sssd/server/dbus to sssd/server/sbus. Making necessary changes to header includes and makefiles.
Diffstat (limited to 'server/sbus/sssd_dbus_common.c')
-rw-r--r--server/sbus/sssd_dbus_common.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/server/sbus/sssd_dbus_common.c b/server/sbus/sssd_dbus_common.c
new file mode 100644
index 000000000..0ea66ccb3
--- /dev/null
+++ b/server/sbus/sssd_dbus_common.c
@@ -0,0 +1,45 @@
+#include <sys/time.h>
+#include "events.h"
+#include "dbus/dbus.h"
+#include "util/util.h"
+
+struct timeval _dbus_timeout_get_interval_tv(int interval) {
+ struct timeval tv;
+ struct timeval rightnow;
+
+ gettimeofday(&rightnow,NULL);
+
+ tv.tv_sec = interval / 1000 + rightnow.tv_sec;
+ tv.tv_usec = (interval % 1000) * 1000 + rightnow.tv_usec;
+ return tv;
+}
+
+/*
+ * sbus_remove_watch
+ * Hook for D-BUS to remove file descriptor-based events
+ * from the libevents mainloop
+ */
+void sbus_remove_watch(DBusWatch *watch, void *data) {
+ struct fd_event *fde;
+
+ DEBUG(2, ("%lX\n", watch));
+ fde = talloc_get_type(dbus_watch_get_data(watch), struct fd_event);
+
+ /* Freeing the event object will remove it from the event loop */
+ talloc_free(fde);
+ dbus_watch_set_data(watch, NULL, NULL);
+}
+
+
+/*
+ * sbus_remove_timeout
+ * Hook for D-BUS to remove time-based events from the mainloop
+ */
+void sbus_remove_timeout(DBusTimeout *timeout, void *data) {
+ struct timed_event *te;
+ te = talloc_get_type(dbus_timeout_get_data(timeout), struct timed_event);
+
+ /* Freeing the event object will remove it from the event loop */
+ talloc_free(te);
+ dbus_timeout_set_data(timeout, NULL, NULL);
+}