summaryrefslogtreecommitdiffstats
path: root/server/sbus
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
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')
-rw-r--r--server/sbus/sbus_client.c2
-rw-r--r--server/sbus/sbus_client.h4
-rw-r--r--server/sbus/sssd_dbus.h6
-rw-r--r--server/sbus/sssd_dbus_common.c8
-rw-r--r--server/sbus/sssd_dbus_connection.c47
-rw-r--r--server/sbus/sssd_dbus_server.c34
6 files changed, 50 insertions, 51 deletions
diff --git a/server/sbus/sbus_client.c b/server/sbus/sbus_client.c
index 9b05b22a7..25c56d853 100644
--- a/server/sbus/sbus_client.c
+++ b/server/sbus/sbus_client.c
@@ -24,7 +24,7 @@
#include "sbus_client.h"
int sbus_client_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
const char *server_address,
struct sbus_method_ctx *sm_ctx,
void *conn_pvt_data,
diff --git a/server/sbus/sbus_client.h b/server/sbus/sbus_client.h
index ec61cb0f1..12c70401d 100644
--- a/server/sbus/sbus_client.h
+++ b/server/sbus/sbus_client.h
@@ -26,13 +26,13 @@
#include "sbus/sssd_dbus.h"
struct service_sbus_ctx {
- struct event_context *ev;
+ struct tevent_context *ev;
struct sbus_conn_ctx *scon_ctx;
struct sbus_method_ctx *sm_ctx;
};
int sbus_client_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
const char *server_address,
struct sbus_method_ctx *sm_ctx,
void *conn_pvt_data,
diff --git a/server/sbus/sssd_dbus.h b/server/sbus/sssd_dbus.h
index a05d229a1..43519b3e1 100644
--- a/server/sbus/sssd_dbus.h
+++ b/server/sbus/sssd_dbus.h
@@ -68,7 +68,7 @@ struct sbus_method_ctx {
/* Server Functions */
int sbus_new_server(TALLOC_CTX *mem_ctx,
- struct event_context *ev, struct sbus_method_ctx *ctx,
+ struct tevent_context *ev, struct sbus_method_ctx *ctx,
struct sbus_srv_ctx **server_ctx, const char *address,
sbus_server_conn_init_fn init_fn, void *init_pvt_data);
@@ -81,7 +81,7 @@ int sbus_new_server(TALLOC_CTX *mem_ctx,
* call sbus_add_connection to integrate with the main
* loop.
*/
-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 **conn_ctx,
sbus_conn_destructor_fn destructor);
@@ -99,7 +99,7 @@ int sbus_new_connection(TALLOC_CTX *ctx, struct event_context *ev,
* dbus_bus_get
*/
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);
diff --git a/server/sbus/sssd_dbus_common.c b/server/sbus/sssd_dbus_common.c
index 465e920f2..a9e0d816f 100644
--- a/server/sbus/sssd_dbus_common.c
+++ b/server/sbus/sssd_dbus_common.c
@@ -20,10 +20,10 @@ struct timeval _dbus_timeout_get_interval_tv(int interval) {
* from the libevents mainloop
*/
void sbus_remove_watch(DBusWatch *watch, void *data) {
- struct fd_event *fde;
+ struct tevent_fd *fde;
DEBUG(5, ("%lX\n", watch));
- fde = talloc_get_type(dbus_watch_get_data(watch), struct fd_event);
+ fde = talloc_get_type(dbus_watch_get_data(watch), struct tevent_fd);
/* Freeing the event object will remove it from the event loop */
talloc_free(fde);
@@ -36,8 +36,8 @@ void sbus_remove_watch(DBusWatch *watch, void *data) {
* 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);
+ struct tevent_timer *te;
+ te = talloc_get_type(dbus_timeout_get_data(timeout), struct tevent_timer);
/* Freeing the event object will remove it from the event loop */
talloc_free(te);
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)
diff --git a/server/sbus/sssd_dbus_server.c b/server/sbus/sssd_dbus_server.c
index eae1ce67c..e30f9abfb 100644
--- a/server/sbus/sssd_dbus_server.c
+++ b/server/sbus/sssd_dbus_server.c
@@ -37,7 +37,7 @@ struct sbus_srv_ctx {
* There should only be one global object path (for
* simplicity's sake)
*/
- struct event_context *ev;
+ struct tevent_context *ev;
struct sbus_method_ctx *sd_ctx;
sbus_server_conn_init_fn init_fn;
void *init_pvt_data;
@@ -46,13 +46,13 @@ struct sbus_srv_ctx {
struct sbus_srv_watch_ctx {
DBusWatch *watch;
int fd;
- struct fd_event *fde;
+ struct tevent_fd *fde;
struct sbus_srv_ctx *top;
};
struct dbus_srv_timeout_ctx {
DBusTimeout *timeout;
- struct timed_event *te;
+ struct tevent_timer *te;
struct sbus_srv_ctx *top;
};
@@ -62,18 +62,18 @@ static int sbus_server_destructor(void *ctx);
* dbus_server_read_write_handler
* Callback for D-BUS to handle messages on a file-descriptor
*/
-static void sbus_srv_read_write_handler(struct event_context *ev,
- struct fd_event *fde,
- uint16_t flags, void *data)
+static void sbus_srv_read_write_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
+ uint16_t flags, void *data)
{
struct sbus_srv_watch_ctx *svw_ctx;
svw_ctx = talloc_get_type(data, struct sbus_srv_watch_ctx);
dbus_server_ref(svw_ctx->top->server);
- if (flags & EVENT_FD_READ) {
+ if (flags & TEVENT_FD_READ) {
dbus_watch_handle(svw_ctx->watch, DBUS_WATCH_READABLE);
}
- if (flags & EVENT_FD_WRITE) {
+ if (flags & TEVENT_FD_WRITE) {
dbus_watch_handle(svw_ctx->watch, DBUS_WATCH_WRITABLE);
}
dbus_server_unref(svw_ctx->top->server);
@@ -107,15 +107,15 @@ static dbus_bool_t sbus_add_srv_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;
}
- DEBUG(5,("%lX: %d, %d=%s\n", watch, svw_ctx->fd, event_flags, event_flags==EVENT_FD_READ?"READ":"WRITE"));
+ DEBUG(5,("%lX: %d, %d=%s\n", watch, svw_ctx->fd, event_flags, event_flags==TEVENT_FD_READ?"READ":"WRITE"));
- svw_ctx->fde = event_add_fd(dt_ctx->ev, svw_ctx, svw_ctx->fd,
+ svw_ctx->fde = tevent_add_fd(dt_ctx->ev, svw_ctx, svw_ctx->fd,
event_flags, sbus_srv_read_write_handler,
svw_ctx);
@@ -139,9 +139,9 @@ static void sbus_toggle_srv_watch(DBusWatch *watch, void *data)
}
}
-static void sbus_srv_timeout_handler(struct event_context *ev,
- struct timed_event *te,
- struct timeval t, void *data)
+static void sbus_srv_timeout_handler(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *data)
{
struct dbus_srv_timeout_ctx *svt_ctx;
svt_ctx = talloc_get_type(data, struct dbus_srv_timeout_ctx);
@@ -169,7 +169,7 @@ static dbus_bool_t sbus_add_srv_timeout(DBusTimeout *timeout, void *data)
tv = _dbus_timeout_get_interval_tv(dbus_timeout_get_interval(timeout));
- svt_ctx->te = event_add_timed(dt_ctx->ev, svt_ctx, tv,
+ svt_ctx->te = tevent_add_timer(dt_ctx->ev, svt_ctx, tv,
sbus_srv_timeout_handler, svt_ctx);
/* Save the event to the watch object so it can be removed later */
@@ -254,7 +254,7 @@ static void sbus_server_init_new_connection(DBusServer *server,
* for handling file descriptor and timed events
*/
int sbus_new_server(TALLOC_CTX *mem_ctx,
- struct event_context *ev, struct sbus_method_ctx *ctx,
+ struct tevent_context *ev, struct sbus_method_ctx *ctx,
struct sbus_srv_ctx **server_ctx, const char *address,
sbus_server_conn_init_fn init_fn, void *init_pvt_data)
{