#ifndef GNUNET_DBUS_LIB_SERVICE_H #define GNUNET_DBUS_LIB_SERVICE_H #include #include #include /** * Represents a DBus service that we are running. */ struct GNUNET_DBUS_Service; #include "gnunet_dbus_lib_object.h" #include "gnunet_dbus_lib_client.h" /** * The type of callbacks used to handle newly-connecting clients. */ typedef void (*GNUNET_DBUS_ClientConnectsHandler)( struct GNUNET_DBUS_Service *service, struct GNUNET_DBUS_Client *client); /** * The type of callbacks used to handle clients disconnecting. */ typedef void (*GNUNET_DBUS_ClientDisconnectsHandler)( struct GNUNET_DBUS_Service *service, struct GNUNET_DBUS_Client *client); /** * Create a service with the given name and configuration. The service will * start running immediately in GNUnet's scheduler. */ struct GNUNET_DBUS_Service * GNUNET_DBUS_service_create ( const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name); /** * Increase the reference count of this GNUNET_DBUS_Service by one. */ void GNUNET_DBUS_service_ref ( struct GNUNET_DBUS_Service *service); /** * Decrease the reference count of this GNUNET_DBUS_Service by one. Will free * the service if the reference count reaches zero. */ void GNUNET_DBUS_service_unref ( struct GNUNET_DBUS_Service *service); /** * Get a reference to this GNUNET_DBUS_Service's configuration. */ const struct GNUNET_CONFIGURATION_Handle * GNUNET_DBUS_service_get_config ( struct GNUNET_DBUS_Service *service); /** * Send an arbitrary message from this service. */ void GNUNET_DBUS_service_send ( struct GNUNET_DBUS_Service *service, DBusMessage *dbus_message); /** * Set the callbacks used by this service to handle clients connecting and * disconnecting. */ void GNUNET_DBUS_service_set_client_handlers ( struct GNUNET_DBUS_Service *service, GNUNET_DBUS_ClientConnectsHandler client_connects, GNUNET_DBUS_ClientDisconnectsHandler client_disconnects); /** * Get this GNUNET_DBUS_Service's root object (a.k.a. '/') */ struct GNUNET_DBUS_Object * GNUNET_DBUS_service_get_root_object ( struct GNUNET_DBUS_Service *service); #endif