summaryrefslogtreecommitdiffstats
path: root/server/sbus/sssd_dbus_connection.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-02-25 16:40:17 -0500
committerSimo Sorce <ssorce@redhat.com>2009-02-26 09:13:20 -0500
commitc9f6d2795fde2f9bf80277d425df2b44bc860226 (patch)
tree301e1217eb5fda73351e9c7fb2f73048853942df /server/sbus/sssd_dbus_connection.c
parent03fa4034a6a74a326e5340dae42d85eea4516b3c (diff)
downloadsssd-c9f6d2795fde2f9bf80277d425df2b44bc860226.tar.gz
sssd-c9f6d2795fde2f9bf80277d425df2b44bc860226.tar.xz
sssd-c9f6d2795fde2f9bf80277d425df2b44bc860226.zip
Rebase the code to use talloc, tdb, tevent, ldb as external
dependencies based on the latest samba code. Convert all references to the old events library to use the renamed tevent library.
Diffstat (limited to 'server/sbus/sssd_dbus_connection.c')
-rw-r--r--server/sbus/sssd_dbus_connection.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/server/sbus/sssd_dbus_connection.c b/server/sbus/sssd_dbus_connection.c
index 9b3da9cc1..51a1f75c6 100644
--- a/server/sbus/sssd_dbus_connection.c
+++ b/server/sbus/sssd_dbus_connection.c
@@ -1,5 +1,4 @@
#include <sys/time.h>
-#include "tevent.h"
#include "util/util.h"
#include "dbus/dbus.h"
#include "sbus/sssd_dbus.h"
@@ -10,7 +9,7 @@ struct dbus_ctx_list;
struct sbus_conn_ctx {
DBusConnection *conn;
- struct event_context *ev;
+ struct tevent_context *ev;
int connection_type;
int disconnect;
struct sbus_method_ctx *method_ctx_list;
@@ -26,13 +25,13 @@ struct sbus_message_handler_ctx {
struct sbus_conn_watch_ctx {
DBusWatch *watch;
int fd;
- struct fd_event *fde;
+ struct tevent_fd *fde;
struct sbus_conn_ctx *top;
};
struct sbus_conn_timeout_ctx {
DBusTimeout *timeout;
- struct timed_event *te;
+ struct tevent_timer *te;
struct sbus_conn_ctx *top;
};
@@ -40,11 +39,11 @@ static int _method_list_contains_path(struct sbus_method_ctx *list,
struct sbus_method_ctx *method);
static void sbus_unreg_object_paths(struct sbus_conn_ctx *dct_ctx);
-static void sbus_dispatch(struct event_context *ev,
- struct timed_event *te,
+static void sbus_dispatch(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval tv, void *data)
{
- struct timed_event *new_event;
+ struct tevent_timer *new_event;
struct sbus_conn_ctx *dct_ctx;
DBusConnection *conn;
int ret;
@@ -81,7 +80,7 @@ static void sbus_dispatch(struct event_context *ev,
*/
ret = dbus_connection_get_dispatch_status(conn);
if (ret != DBUS_DISPATCH_COMPLETE) {
- new_event = event_add_timed(ev, dct_ctx, tv, sbus_dispatch, dct_ctx);
+ new_event = tevent_add_timer(ev, dct_ctx, tv, sbus_dispatch, dct_ctx);
if (new_event == NULL) {
DEBUG(2,("Could not add dispatch event!\n"));
@@ -95,19 +94,19 @@ static void sbus_dispatch(struct event_context *ev,
* dbus_connection_read_write_handler
* Callback for D-BUS to handle messages on a file-descriptor
*/
-static void sbus_conn_read_write_handler(struct event_context *ev,
- struct fd_event *fde,
- uint16_t flags, void *data)
+static void sbus_conn_read_write_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
+ uint16_t flags, void *data)
{
struct sbus_conn_watch_ctx *conn_w_ctx;
conn_w_ctx = talloc_get_type(data, struct sbus_conn_watch_ctx);
DEBUG(6,("Connection is open for read/write.\n"));
dbus_connection_ref(conn_w_ctx->top->conn);
- if (flags & EVENT_FD_READ) {
+ if (flags & TEVENT_FD_READ) {
dbus_watch_handle(conn_w_ctx->watch, DBUS_WATCH_READABLE);
}
- if (flags & EVENT_FD_WRITE) {
+ if (flags & TEVENT_FD_WRITE) {
dbus_watch_handle(conn_w_ctx->watch, DBUS_WATCH_WRITABLE);
}
dbus_connection_unref(conn_w_ctx->top->conn);
@@ -141,20 +140,20 @@ static dbus_bool_t sbus_add_conn_watch(DBusWatch *watch, void *data)
event_flags = 0;
if (flags & DBUS_WATCH_READABLE)
- event_flags |= EVENT_FD_READ;
+ event_flags |= TEVENT_FD_READ;
if (flags & DBUS_WATCH_WRITABLE)
- event_flags |= EVENT_FD_WRITE;
+ event_flags |= TEVENT_FD_WRITE;
if (event_flags == 0)
return FALSE;
DEBUG(5,("%lX: %d, %d=%s\n",
watch, conn_w_ctx->fd, event_flags,
- event_flags==EVENT_FD_READ?"READ":"WRITE"));
+ event_flags==TEVENT_FD_READ?"READ":"WRITE"));
/* Add the file descriptor to the event loop */
- conn_w_ctx->fde = event_add_fd(conn_w_ctx->top->ev, conn_w_ctx,
+ conn_w_ctx->fde = tevent_add_fd(conn_w_ctx->top->ev, conn_w_ctx,
conn_w_ctx->fd, event_flags,
sbus_conn_read_write_handler,
conn_w_ctx);
@@ -183,8 +182,8 @@ static void sbus_toggle_conn_watch(DBusWatch *watch, void *data)
* dbus_connection_timeout_handler
* Callback for D-BUS to handle timed events
*/
-static void sbus_conn_timeout_handler(struct event_context *ev,
- struct timed_event *te,
+static void sbus_conn_timeout_handler(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *data)
{
struct sbus_conn_timeout_ctx *conn_t_ctx;
@@ -218,7 +217,7 @@ static dbus_bool_t sbus_add_conn_timeout(DBusTimeout *timeout, void *data)
struct timeval rightnow;
gettimeofday(&rightnow, NULL);
- conn_t_ctx->te = event_add_timed(conn_t_ctx->top->ev, conn_t_ctx, tv,
+ conn_t_ctx->te = tevent_add_timer(conn_t_ctx->top->ev, conn_t_ctx, tv,
sbus_conn_timeout_handler, conn_t_ctx);
/* Save the event to the watch object so it can be removed later */
@@ -252,13 +251,13 @@ static void sbus_conn_wakeup_main(void *data)
{
struct sbus_conn_ctx *dct_ctx;
struct timeval tv;
- struct timed_event *te;
+ struct tevent_timer *te;
dct_ctx = talloc_get_type(data, struct sbus_conn_ctx);
gettimeofday(&tv, NULL);
/* D-BUS calls this function when it is time to do a dispatch */
- te = event_add_timed(dct_ctx->ev, dct_ctx,
+ te = tevent_add_timer(dct_ctx->ev, dct_ctx,
tv, sbus_dispatch, dct_ctx);
if (te == NULL) {
DEBUG(2,("Could not add dispatch event!\n"));
@@ -273,7 +272,7 @@ static void sbus_conn_wakeup_main(void *data)
* for handling file descriptor and timed events
*/
int sbus_add_connection(TALLOC_CTX *ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
DBusConnection *dbus_conn,
struct sbus_conn_ctx **dct_ctx,
int connection_type)
@@ -343,7 +342,7 @@ int sbus_add_connection(TALLOC_CTX *ctx,
/*int sbus_new_connection(struct sbus_method_ctx *ctx, const char *address,
DBusConnection **connection,
sbus_conn_destructor_fn destructor)*/
-int sbus_new_connection(TALLOC_CTX *ctx, struct event_context *ev,
+int sbus_new_connection(TALLOC_CTX *ctx, struct tevent_context *ev,
const char *address,
struct sbus_conn_ctx **dct_ctx,
sbus_conn_destructor_fn destructor)