diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2014-04-29 23:39:45 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-05-13 21:46:41 +0200 |
commit | 393099fb7caa2c128277e26ba3463aa7f95a0ebb (patch) | |
tree | 1f9785c0a4edec910e345d587be57ddfe20b2ec2 /src/sbus/sssd_dbus_connection.c | |
parent | 87729e3a6c56383642a8d3a86b2856487f2ee064 (diff) | |
download | sssd-393099fb7caa2c128277e26ba3463aa7f95a0ebb.tar.gz sssd-393099fb7caa2c128277e26ba3463aa7f95a0ebb.tar.xz sssd-393099fb7caa2c128277e26ba3463aa7f95a0ebb.zip |
SBUS: Split out dbus_conn_send
Split dbus_conn_send out of sbus_conn_send to be able to call DBus
messages without having a full sbus connection. This function is
available to the sbus code only, consumers of sbus (responders and
providers) should use sbus_conn_send.
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Reviewed-by: Stef Walter <stefw@redhat.com>
Diffstat (limited to 'src/sbus/sssd_dbus_connection.c')
-rw-r--r-- | src/sbus/sssd_dbus_connection.c | 56 |
1 files changed, 34 insertions, 22 deletions
diff --git a/src/sbus/sssd_dbus_connection.c b/src/sbus/sssd_dbus_connection.c index f27474745..7ea70efa5 100644 --- a/src/sbus/sssd_dbus_connection.c +++ b/src/sbus/sssd_dbus_connection.c @@ -701,32 +701,16 @@ bool sbus_conn_disconnecting(struct sbus_connection *conn) return false; } -/* - * Send a message across the SBUS - * If requested, the DBusPendingCall object will - * be returned to the caller. - * - * This function will return EAGAIN in the event - * that the connection is not open for - * communication. - */ -int sbus_conn_send(struct sbus_connection *conn, - DBusMessage *msg, - int timeout_ms, - DBusPendingCallNotifyFunction reply_handler, - void *pvt, - DBusPendingCall **pending) +int sss_dbus_conn_send(DBusConnection *dbus_conn, + DBusMessage *msg, + int timeout_ms, + DBusPendingCallNotifyFunction reply_handler, + void *pvt, + DBusPendingCall **pending) { DBusPendingCall *pending_reply; - DBusConnection *dbus_conn; dbus_bool_t dbret; - dbus_conn = sbus_get_connection(conn); - if (!dbus_conn) { - DEBUG(SSSDBG_CRIT_FAILURE, "D-BUS not connected\n"); - return ENOTCONN; - } - dbret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply, timeout_ms); @@ -770,6 +754,34 @@ int sbus_conn_send(struct sbus_connection *conn, return EAGAIN; } +/* + * Send a message across the SBUS + * If requested, the DBusPendingCall object will + * be returned to the caller. + * + * This function will return EAGAIN in the event + * that the connection is not open for + * communication. + */ +int sbus_conn_send(struct sbus_connection *conn, + DBusMessage *msg, + int timeout_ms, + DBusPendingCallNotifyFunction reply_handler, + void *pvt, + DBusPendingCall **pending) +{ + DBusConnection *dbus_conn; + + dbus_conn = sbus_get_connection(conn); + if (!dbus_conn) { + DEBUG(SSSDBG_CRIT_FAILURE, "D-BUS not connected\n"); + return ENOTCONN; + } + + return sss_dbus_conn_send(dbus_conn, msg, timeout_ms, + reply_handler, pvt, pending); +} + void sbus_conn_send_reply(struct sbus_connection *conn, DBusMessage *reply) { dbus_connection_send(conn->dbus.conn, reply, NULL); |