diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2009-03-18 12:05:14 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-03-20 11:14:56 -0400 |
commit | 6a3ca34ec2ff7ecaa3b2ddac041ab49dd6a1b17c (patch) | |
tree | 456109d23c1b1e7497054061f4f6122af83d1f14 /server/sbus/sssd_dbus.h | |
parent | 76c4a8cfaf29778423ac28d1088ca4e0a20e8b91 (diff) | |
download | sssd-6a3ca34ec2ff7ecaa3b2ddac041ab49dd6a1b17c.tar.gz sssd-6a3ca34ec2ff7ecaa3b2ddac041ab49dd6a1b17c.tar.bz2 sssd-6a3ca34ec2ff7ecaa3b2ddac041ab49dd6a1b17c.zip |
Add reconnection logic to the SBUS
Any client of the SBUS that wants to implement automatic
reconnection may now call sbus_reconnect_init to set it up.
The clients will need to set up a callback to handle the result
of the reconnection and (in the case of a successful reconnection)
readd the method handlers to the connection context.
Diffstat (limited to 'server/sbus/sssd_dbus.h')
-rw-r--r-- | server/sbus/sssd_dbus.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/server/sbus/sssd_dbus.h b/server/sbus/sssd_dbus.h index 2496ae89..b9c7a269 100644 --- a/server/sbus/sssd_dbus.h +++ b/server/sbus/sssd_dbus.h @@ -35,6 +35,8 @@ typedef int (*sbus_msg_handler_fn)(DBusMessage *, struct sbus_conn_ctx *); */ typedef int (*sbus_conn_destructor_fn)(void *); +typedef void (*sbus_conn_reconn_callback_fn)(struct sbus_conn_ctx *, int, void *); + /* * sbus_server_conn_init_fn * Set up function for connection-specific activities @@ -48,6 +50,12 @@ enum { SBUS_CONN_TYPE_SHARED }; +enum { + SBUS_RECONNECT_SUCCESS = 1, + SBUS_RECONNECT_EXCEEDED_RETRIES, + SBUS_RECONNECT_ERROR +}; + /* Special interface and method for D-BUS introspection */ #define DBUS_INTROSPECT_INTERFACE "org.freedesktop.DBus.Introspectable" #define DBUS_INTROSPECT_METHOD "Introspect" @@ -117,6 +125,15 @@ int sbus_conn_add_method_ctx(struct sbus_conn_ctx *conn_ctx, struct sbus_method_ctx *method_ctx); bool sbus_conn_disconnecting(struct sbus_conn_ctx *conn_ctx); +/* max_retries < 0: retry forever + * max_retries = 0: never retry (why are you calling this function?) + * max_retries > 0: obvious + */ +void sbus_reconnect_init(struct sbus_conn_ctx *conn_ctx, + int max_retries, + sbus_conn_reconn_callback_fn callback, + void *pvt); + /* Default message handler * Should be usable for most cases */ DBusHandlerResult sbus_message_handler(DBusConnection *conn, |