sssd_dbus.h revision 9fbf00c7802719becd633ecbc45879d5d0ddb985
/*
SSSD
SSSD - D-BUS interface
Copyright (C) Stephen Gallagher 2008
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SSSD_DBUS_H_
#define _SSSD_DBUS_H_
struct sbus_connection;
/*
* sbus_conn_destructor_fn
* Function to be called when a connection is finalized
*/
typedef int (*sbus_conn_destructor_fn)(void *);
typedef void (*sbus_conn_reconn_callback_fn)(struct sbus_connection *, int, void *);
/*
* sbus_server_conn_init_fn
* Set up function for connection-specific activities
* This function should define the sbus_conn_destructor_fn
* for this connection at a minimum
*/
typedef int (*sbus_server_conn_init_fn)(struct sbus_connection *, void *);
enum {
};
enum {
};
/* Special interface and method for D-BUS introspection */
#define DBUS_INTROSPECT_INTERFACE "org.freedesktop.DBus.Introspectable"
#define DBUS_INTROSPECT_METHOD "Introspect"
struct sbus_method {
const char *method;
};
struct sbus_interface {
const char *interface;
const char *path;
struct sbus_method *methods;
};
/* Server Functions */
struct tevent_context *ev,
const char *address,
struct sbus_interface *intf,
struct sbus_connection **server,
/* Connection Functions */
/* sbus_new_connection
* Use this function when connecting a new process to
* the standard SSSD interface.
* This will connect to the address specified and then
* call sbus_add_connection to integrate with the main
* loop.
*/
struct tevent_context *ev,
const char *address,
struct sbus_interface *intf,
struct sbus_connection **conn);
/* sbus_add_connection
* Integrates a D-BUS connection with the TEvent main
* loop. Use this function when you already have a
* DBusConnection object (for example from dbus_bus_get)
* Connection type can be either:
* SBUS_CONN_TYPE_PRIVATE: Used only from within a D-BUS
* server such as the Monitor in the
* new_connection_callback
* SBUS_CONN_TYPE_SHARED: Used for all D-BUS client
* connections, including those retrieved from
* dbus_bus_get
*/
struct tevent_context *ev,
struct sbus_interface *intf,
int connection_type,
struct sbus_connection **_conn);
int sbus_default_connection_destructor(void *ctx);
struct sbus_interface *intf);
/* max_retries < 0: retry forever
* max_retries = 0: never retry (why are you calling this function?)
* max_retries > 0: obvious
*/
int max_retries,
void *pvt);
/* Default message handler
* Should be usable for most cases */
void *user_data);
/*
* 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 timeout_ms,
void *pvt,
DBusMessage *reply);
int sbus_is_dbus_fixed_type(int dbus_type);
int sbus_is_dbus_string_type(int dbus_type);
#endif /* _SSSD_DBUS_H_*/