driver.h \
expirelist.c \
expirelist.h \
- kdbus-d.c \
- kdbus-d.h \
policy.c \
policy.h \
selinux.h \
utils.h \
$(XML_SOURCES)
+if ENABLE_KDBUS_TRANSPORT
+BUS_SOURCES+= \
+ kdbus-d.c \
+ kdbus-d.h
+endif
+
+
dbus_daemon_SOURCES= \
$(BUS_SOURCES) \
main.c
{
DBusConnection *addressed_recipient;
+#ifdef ENABLE_KDBUS_TRANSPORT
/* kdbus change - we can not send anything using phantom connections
* (DBusConnection structures for services other than daemon)
* so we have to use daemon connection
if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
addressed_recipient = entry->connection;
else
+#endif
addressed_recipient = bus_service_get_primary_owners_connection (service);
/* Resume dispatching where we left off in bus_dispatch() */
#include <dbus/dbus-hash.h>
#include <dbus/dbus-credentials.h>
#include <dbus/dbus-internals.h>
+
+#ifdef ENABLE_KDBUS_TRANSPORT
#include "kdbus-d.h"
#include <stdlib.h>
+#endif
#ifdef DBUS_CYGWIN
#include <signal.h>
unsigned int keep_umask : 1;
unsigned int allow_anonymous : 1;
unsigned int systemd_activation : 1;
+#ifdef ENABLE_KDBUS_TRANSPORT
DBusConnection *myKdbusConnection; //todo maybe can be rafctored and removed
+#endif
};
static dbus_int32_t server_data_slot = -1;
if (address)
{
- if(!strcmp(_dbus_string_get_const_data(address), "kdbus:"))
+#ifdef ENABLE_KDBUS_TRANSPORT
+ if(!strcmp(_dbus_string_get_const_data(address), "kdbus"))
{
DBusBusType type;
DBusServer* server;
goto failed;
}
else
- {
+#endif
+ {
DBusServer *server;
server = dbus_server_listen (_dbus_string_get_const_data(address), error);
goto failed;
}
context->refcount = 1;
+
+#ifdef ENABLE_KDBUS_TRANSPORT
context->myKdbusConnection = NULL;
+#endif
_dbus_generate_uuid (&context->uuid);
dbus_server_free_data_slot (&server_data_slot);
+#ifdef ENABLE_KDBUS_TRANSPORT
if(context->myKdbusConnection)
{
DBusString unique_name;
goto failed;
}
}
+#endif
return context;
goto failed;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
if(context->myKdbusConnection)
{
if(!update_kdbus_starters(context->myKdbusConnection))
goto failed;
}
}
+#endif
+
ret = TRUE;
bus_context_log (context, DBUS_SYSTEM_LOG_INFO, "Reloaded configuration");
return context->loop;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
DBusConnection* bus_context_get_myConnection(BusContext *context)
{
return context->myKdbusConnection;
}
+#endif
dbus_bool_t
bus_context_allow_unix_user (BusContext *context,
return context->limits.reply_timeout;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
dbus_bool_t bus_context_is_kdbus(BusContext* context)
{
return context->myKdbusConnection != NULL;
}
+#endif
void
bus_context_log (BusContext *context, DBusSystemLogSeverity severity, const char *msg, ...) _DBUS_GNUC_PRINTF (3, 4);
BusActivation* bus_context_get_activation (BusContext *context);
BusMatchmaker* bus_context_get_matchmaker (BusContext *context);
DBusLoop* bus_context_get_loop (BusContext *context);
+#ifdef ENABLE_KDBUS_TRANSPORT
DBusConnection* bus_context_get_myConnection (BusContext *context);
+#endif
dbus_bool_t bus_context_allow_unix_user (BusContext *context,
unsigned long uid);
dbus_bool_t bus_context_allow_windows_user (BusContext *context,
int bus_context_get_max_match_rules_per_connection (BusContext *context);
int bus_context_get_max_replies_per_connection (BusContext *context);
int bus_context_get_reply_timeout (BusContext *context);
+
+#ifdef ENABLE_KDBUS_TRANSPORT
dbus_bool_t bus_context_is_kdbus (BusContext *context);
+#endif
+
void bus_context_log (BusContext *context,
DBusSystemLogSeverity severity,
const char *msg,
BusConnectionData *d;
BusService *service;
BusMatchmaker *matchmaker;
+#ifdef ENABLE_KDBUS_TRANSPORT
dbus_bool_t is_phantom = FALSE;
+#endif
d = BUS_CONNECTION_DATA (connection);
_dbus_assert (d != NULL);
_dbus_verbose ("%s disconnected, dropping all service ownership and releasing\n",
d->name ? d->name : "(inactive)");
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(d->connections->context) && (strcmp(bus_connection_get_name(connection), ":1.1")))
is_phantom = TRUE;
+#endif
/* Delete our match rules */
if (d->n_match_rules > 0)
dbus_connection_set_data (connection,
connection_data_slot,
NULL, NULL);
+
+#ifdef ENABLE_KDBUS_TRANSPORT
if(is_phantom)
dbus_connection_unref_phantom(connection);
else
+#endif
dbus_connection_unref (connection);
}
foreach_inactive (connections, function, data);
}
+#ifdef ENABLE_KDBUS_TRANSPORT
DBusConnection*
bus_connections_find_conn_by_name(BusConnections *connections, const char* name)
{
return NULL;
}
+#endif
BusContext*
bus_connections_get_context (BusConnections *connections)
return d->n_services_owned;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
DBusList**
bus_connection_get_services_owned (DBusConnection *connection)
{
return &d->services_owned;
}
+#endif
dbus_bool_t
bus_connection_complete (DBusConnection *connection,
if (!dbus_message_set_sender (message, DBUS_SERVICE_DBUS))
return FALSE;
+#ifdef ENABLE_KDBUS_TRANSPORT
if(!bus_context_is_kdbus(bus_transaction_get_context (transaction))) /* we can't set destination on the basis of connection when on kdbus*/
+#endif
if (bus_connection_is_active (connection))
{
if (!dbus_message_set_destination (message,
dbus_free (transaction);
}
+#ifdef ENABLE_KDBUS_TRANSPORT
void
bus_transaction_free (BusTransaction *transaction)
{
free_cancel_hooks (transaction);
dbus_free (transaction);
}
+#endif
static void
bus_connection_remove_transactions (DBusConnection *connection)
void bus_connections_foreach_active (BusConnections *connections,
BusConnectionForeachFunction function,
void *data);
+#ifdef ENABLE_KDBUS_TRANSPORT
DBusConnection* bus_connections_find_conn_by_name (BusConnections *connections,
const char* name);
+#endif
BusContext* bus_connections_get_context (BusConnections *connections);
void bus_connections_increment_stamp (BusConnections *connections);
BusContext* bus_connection_get_context (DBusConnection *connection);
void bus_connection_send_oom_error (DBusConnection *connection,
DBusMessage *in_reply_to);
+#ifdef ENABLE_KDBUS_TRANSPORT
DBusList** bus_connection_get_services_owned (DBusConnection *connection);
+#endif
/* called by signals.c */
dbus_bool_t bus_connection_add_match_rule (DBusConnection *connection,
DBusMessage *in_reply_to);
void bus_transaction_cancel_and_free (BusTransaction *transaction);
void bus_transaction_execute_and_free (BusTransaction *transaction);
+#ifdef ENABLE_KDBUS_TRANSPORT
void bus_transaction_free (BusTransaction *transaction);
+#endif
dbus_bool_t bus_transaction_add_cancel_hook (BusTransaction *transaction,
BusTransactionCancelFunction cancel_function,
void *data,
#include <dbus/dbus-internals.h>
#include <dbus/dbus-misc.h>
#include <string.h>
+#ifdef ENABLE_KDBUS_TRANSPORT
#include "kdbus-d.h"
+#endif
#ifdef HAVE_UNIX_FD_PASSING
#include <dbus/dbus-sysdeps-unix.h>
goto out;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(context))
{
if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
goto out;
}
}
+#endif
}
+#ifdef ENABLE_KDBUS_TRANSPORT
/* Assign a sender to the message */
if(bus_context_is_kdbus(context) == FALSE) //if using kdbus, sender must be set on library side
+#endif
+ {
if (bus_connection_is_active (connection))
{
sender = bus_connection_get_name (connection);
*/
service_name = dbus_message_get_destination (message);
}
+ }
if (service_name &&
strcmp (service_name, DBUS_SERVICE_DBUS) == 0) /* to bus driver */
_dbus_string_init_const (&service_string, service_name);
service = bus_registry_lookup (registry, &service_string);
+#ifdef ENABLE_KDBUS_TRANSPORT
if (dbus_message_get_auto_start (message) && (service == NULL || bus_service_get_is_kdbus_starter(service)))
+#else
+ if (service == NULL && dbus_message_get_auto_start (message))
+#endif
{
BusActivation *activation;
/* We can't do the security policy check here, since the addressed
#include <dbus/dbus-marshal-recursive.h>
#include <string.h>
+#ifdef ENABLE_KDBUS_TRANSPORT
#include "kdbus-d.h"
#include <stdio.h>
#include <errno.h>
#include <limits.h>
+#endif
static DBusConnection *
bus_driver_get_conn_helper (DBusConnection *connection,
dbus_bool_t retval;
const char *null_service;
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
return TRUE;
+#endif
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
{
DBusMessage *message;
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
return TRUE;
+#endif
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
{
DBusMessage *message;
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
return TRUE;
+#endif
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
return FALSE;
}
-
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
{
if(!kdbus_list_services (connection, &services, &len))
}
}
else
- if (!bus_registry_list_services (registry, &services, &len))
- {
- dbus_message_unref (reply);
- BUS_SET_OOM (error);
- return FALSE;
- }
+#endif
+ {
+
+ if (!bus_registry_list_services (registry, &services, &len))
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
+ }
dbus_message_iter_init_append (reply, &iter);
return FALSE;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
if(!bus_context_is_kdbus(bus_transaction_get_context (transaction))) //not needed for kdbus, we got it from kdbus_list_services
+#endif
{
+
/* Include the bus driver in the list */
const char *v_STRING = DBUS_SERVICE_DBUS;
if (!dbus_message_iter_append_basic (&sub, DBUS_TYPE_STRING,
retval = FALSE;
reply = NULL;
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
{
if (!bus_registry_acquire_kdbus_service (registry, connection,
goto out;
}
else
+#endif
{
+
_dbus_string_init_const (&service_name, name);
if (!bus_registry_acquire_service (registry, connection,
&service_reply, transaction,
error))
goto out;
-
}
reply = dbus_message_new_method_return (message);
_dbus_string_init_const (&service_name, name);
registry = bus_connection_get_registry (connection);
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
{
if (!bus_registry_release_service_kdbus (dbus_message_get_sender(message), connection,
transaction, error))
goto out;
}
- else if (!bus_registry_release_service (registry, connection,
+ else
+#endif
+ if (!bus_registry_release_service (registry, connection,
&service_name, &service_reply,
transaction, error))
goto out;
}
else
{
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
{
int inter_ret;
}
}
else
+#endif
{
_dbus_string_init_const (&service_name, name);
service = bus_registry_lookup (registry, &service_name);
if (rule == NULL)
goto failed;
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
{
goto failed;
}
else
+#endif
{
+
matchmaker = bus_connection_get_matchmaker (connection);
if (!bus_matchmaker_add_rule (matchmaker, rule))
if (rule == NULL)
goto failed;
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
{
if(!kdbus_remove_match(connection, message, error))
goto failed;
}
+#endif
/* Send the ack before we remove the rule, since the ack is undone
* on transaction cancel, but rule removal isn't.
message, error))
goto failed;
+#ifdef ENABLE_KDBUS_TRANSPORT
if(!bus_context_is_kdbus(bus_transaction_get_context (transaction)))
+#endif
{
matchmaker = bus_connection_get_matchmaker (connection);
BusRegistry *registry;
BusService *service;
DBusMessage *reply;
- char unique_name[(unsigned int)(snprintf((char*)base_name, 0, "%llu", ULLONG_MAX) + sizeof(":1."))];
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
DBUS_TYPE_INVALID))
goto failed;
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
{
int ret;
struct nameInfo info;
+ char unique_name[(unsigned int)(snprintf((char*)base_name, 0, "%llu", ULLONG_MAX) + sizeof(":1."))];
ret = kdbus_NameQuery(text, dbus_connection_get_transport(connection), &info);
if(ret == 0) //unique id of the name
}
}
else
- {
+#endif
+ {
_dbus_string_init_const (&str, text);
service = bus_registry_lookup (registry, &str);
if (service == NULL &&
if (reply == NULL)
goto oom;
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
{
if(!kdbus_get_connection_unix_user(connection, message, &uid, error))
goto failed;
}
else
+#endif
{
conn = bus_driver_get_conn_helper (connection, message, "UID", &service,
error);
if (reply == NULL)
goto oom;
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
{
if(!kdbus_get_connection_unix_process_id(connection, message, &pid, error))
goto failed;
}
else
+#endif
{
conn = bus_driver_get_conn_helper (connection, message, "PID", &service,
error);
if (reply == NULL)
goto oom;
+#ifdef ENABLE_KDBUS_TRANSPORT
if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
{
if(!kdbus_get_connection_unix_selinux_security_context(connection, message, reply, error))
goto failed;
}
else
+#endif
{
conn = bus_driver_get_conn_helper (connection, message, "security context",
&service, error);
if (reply == NULL)
goto oom;
+#ifdef ENABLE_KDBUS_TRANSPORT
if(!bus_context_is_kdbus(bus_transaction_get_context (transaction)))
{
+#endif
conn = bus_driver_get_conn_helper (connection, message, "credentials",
&service, error);
if (!_dbus_asv_add_uint32 (&array_iter, "UnixUserID", ulong_val))
goto oom;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
}
else
{
else
goto failed;
}
+#endif
if (!_dbus_asv_close (&reply_iter, &array_iter))
goto oom;
#include <dbus/dbus-list.h>
#include <dbus/dbus-mempool.h>
#include <dbus/dbus-marshal-validate.h>
+#ifdef ENABLE_KDBUS_TRANSPORT
#include <linux/types.h>
#include <errno.h>
#include <stdlib.h>
-
+#endif
#include "driver.h"
#include "services.h"
#include "policy.h"
#include "bus.h"
#include "selinux.h"
+#ifdef ENABLE_KDBUS_TRANSPORT
#include "kdbus-d.h"
#include "dbus/kdbus.h"
+#endif
struct BusService
{
unsigned int allow_replacement : 1;
unsigned int do_not_queue : 1;
+#ifdef ENABLE_KDBUS_TRANSPORT
unsigned int is_kdbus_starter : 1;
+#endif
};
struct BusRegistry
return link;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
static DBusConnection *
_bus_service_find_owner_connection (BusService *service,
const char* unique_name)
return NULL;
}
+#endif
static void
bus_owner_set_flags (BusOwner *owner,
owner->do_not_queue =
(flags & DBUS_NAME_FLAG_DO_NOT_QUEUE) != FALSE;
+#ifdef ENABLE_KDBUS_TRANSPORT
owner->is_kdbus_starter =
(flags & KDBUS_NAME_STARTER) != FALSE;
+#endif
}
static BusOwner *
return retval;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
dbus_bool_t
bus_registry_acquire_kdbus_service (BusRegistry *registry,
DBusConnection *connection,
dbus_bool_t retval;
BusService *service;
BusActivation *activation;
+
DBusString service_name_real;
const DBusString *service_name = &service_name_real;
char* name;
transaction, error))
goto failed2;
}*/
- /* if((link = _bus_service_find_owner_link (service, connection))) //if daemon is a starter
+ /*if((link = _bus_service_find_owner_link (service, connection))) //if daemon is a starter
{
_dbus_list_unlink (&service->owners, link);
_dbus_list_append_link (&service->owners, link); //it must be moved at the end of the queue
return FALSE;
}
+#endif
dbus_bool_t
bus_registry_release_service (BusRegistry *registry,
return retval;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
dbus_bool_t
bus_registry_release_service_kdbus (const char* sender_name,
DBusConnection *connection,
out:
return retval;
}
+#endif
dbus_bool_t
bus_registry_set_service_context_table (BusRegistry *registry,
return owner->allow_replacement;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
dbus_bool_t
bus_service_get_is_kdbus_starter (BusService *service)
{
return owner->is_kdbus_starter;
}
+#endif
dbus_bool_t
bus_service_has_owner (BusService *service,
owner = (BusOwner *) link->data;
uname = bus_connection_get_name (owner->conn);
+#ifdef ENABLE_KDBUS_TRANSPORT
if(!owner->is_kdbus_starter)
+#endif
if (!_dbus_list_append (return_list, (char *)uname))
goto oom;
dbus_uint32_t *result,
BusTransaction *transaction,
DBusError *error);
-dbus_bool_t bus_registry_acquire_kdbus_service (BusRegistry *registry,
- DBusConnection *connection,
- DBusMessage *message,
- dbus_uint32_t *result,
- BusTransaction *transaction,
- DBusError *error);
dbus_bool_t bus_registry_release_service (BusRegistry *registry,
DBusConnection *connection,
const DBusString *service_name,
dbus_uint32_t *result,
BusTransaction *transaction,
DBusError *error);
+#ifdef ENABLE_KDBUS_TRANSPORT
+dbus_bool_t bus_registry_acquire_kdbus_service (BusRegistry *registry,
+ DBusConnection *connection,
+ DBusMessage *message,
+ dbus_uint32_t *result,
+ BusTransaction *transaction,
+ DBusError *error);
+
+
dbus_bool_t bus_registry_release_service_kdbus (const char* sender_name,
DBusConnection *connection,
const DBusString *service_name,
dbus_uint32_t *result,
BusTransaction *transaction,
DBusError *error);
+#endif
dbus_bool_t bus_registry_set_service_context_table (BusRegistry *registry,
DBusHashTable *table);
DBusConnection *connection);
BusOwner* bus_service_get_primary_owner (BusService *service);
dbus_bool_t bus_service_get_allow_replacement (BusService *service);
+#ifdef ENABLE_KDBUS_TRANSPORT
dbus_bool_t bus_service_get_is_kdbus_starter (BusService *service);
+#endif
const char* bus_service_get_name (BusService *service);
dbus_bool_t bus_service_list_queued_owners (BusService *service,
DBusList **return_list,
AC_ARG_ENABLE(userdb-cache, AS_HELP_STRING([--enable-userdb-cache],[build with userdb-cache support]),enable_userdb_cache=$enableval,enable_userdb_cache=yes)
AC_ARG_ENABLE(launchd, AS_HELP_STRING([--enable-launchd],[build with launchd auto-launch support]),enable_launchd=$enableval,enable_launchd=auto)
AC_ARG_ENABLE(systemd, AS_HELP_STRING([--enable-systemd],[build with systemd at_console support]),enable_systemd=$enableval,enable_systemd=auto)
+AC_ARG_ENABLE(kdbus-transport, AS_HELP_STRING([--enable-kdbus-transport],[build with kdbus transport support]),enable_kdbus_transport=$enableval,enable_kdbus_transport=no)
AC_ARG_WITH(init-scripts, AS_HELP_STRING([--with-init-scripts=[redhat]],[Style of init scripts to install]))
AC_ARG_WITH(session-socket-dir, AS_HELP_STRING([--with-session-socket-dir=[dirname]],[Where to put sockets for the per-login-session message bus]))
[Default for dbus_connection_get_max_message_unix_fds()])
AC_SUBST([DEFAULT_MESSAGE_UNIX_FDS])
-### kdbus related libs
+### kdbus support
+if test x$enable_kdbus_transport = xyes; then
+ KDBUS_LIBS=
+ #"-lcrypto"
+ #AC_SUBST([KDBUS_LIBS])
+ AC_DEFINE(ENABLE_KDBUS_TRANSPORT,1,[Enable kdbus transport support])
+else
+ KDBUS_LIBS=
+fi
-KDBUS_LIBS=
-#"-lcrypto"
-#AC_SUBST([KDBUS_LIBS])
+AM_CONDITIONAL([ENABLE_KDBUS_TRANSPORT], [test x$enable_kdbus_transport = xyes])
#### Set up final flags
LIBDBUS_LIBS="$THREAD_LIBS $NETWORK_libs $KDBUS_LIBS"
dbus-sysdeps-pthread.c \
dbus-transport-unix.c \
dbus-transport-unix.h \
- dbus-transport-kdbus.c \
- dbus-transport-kdbus.h \
- kdbus-common.c \
- kdbus-common.h \
dbus-userdb.c \
dbus-userdb.h \
sd-daemon.c \
sd-daemon.h
+if ENABLE_KDBUS_TRANSPORT
+DBUS_SHARED_arch_sources += \
+ dbus-transport-kdbus.c \
+ dbus-transport-kdbus.h \
+ kdbus-common.c \
+ kdbus-common.h
+endif
+
DBUS_UTIL_arch_sources = \
dbus-sysdeps-util-unix.c \
dbus-userdb-util.c \
return auth;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
/**
* Creates a new auth conversation object for the client side of kdbus.
* In fact it only initialize structures and sets authenticated state
return auth;
}
+#endif
/**
* Increments the refcount of an auth object.
DBusAuth* _dbus_auth_server_new (const DBusString *guid);
DBusAuth* _dbus_auth_client_new (void);
+#ifdef ENABLE_KDBUS_TRANSPORT
DBusAuth* _dbus_auth_client_new_kdbus (void);
+#endif
DBusAuth* _dbus_auth_ref (DBusAuth *auth);
void _dbus_auth_unref (DBusAuth *auth);
dbus_bool_t _dbus_auth_set_mechanisms (DBusAuth *auth,
#include "dbus-threads-internal.h"
#include "dbus-connection-internal.h"
#include "dbus-string.h"
+#ifdef ENABLE_KDBUS_TRANSPORT
#include "dbus-transport-kdbus.h"
#include <stdlib.h>
#include <limits.h>
#include <stdio.h>
+#endif
/**
* @defgroup DBusBus Message bus APIs
}
}
+#ifdef ENABLE_KDBUS_TRANSPORT
void dbus_bus_set_bus_connection_address(DBusBusType address_type, char* address)
{
if(bus_connection_addresses[address_type] != NULL)
free(bus_connection_addresses[address_type]);
bus_connection_addresses[address_type] = address;
}
+#endif
static dbus_bool_t
init_session_address (void)
_DBUS_SET_OOM (error);
goto out;
}
- //_dbus_verbose("-- Our uniqe name is: %s\n", bd->unique_name);
+
retval = TRUE;
out:
if (message)
dbus_message_unref (message);
- else if (name)
- free(name);
if (reply)
dbus_message_unref (reply);
#define DBUS_BUS_H
#include <dbus/dbus-connection.h>
+#ifdef ENABLE_KDBUS_TRANSPORT
#include "dbus-address.h"
+#endif
DBUS_BEGIN_DECLS
* @{
*/
+#ifdef ENABLE_KDBUS_TRANSPORT
DBUS_EXPORT
void dbus_bus_set_bus_connection_address(DBusBusType address_type, char* address);
+#endif
DBUS_EXPORT
DBusConnection *dbus_bus_get (DBusBusType type,
DBusTimeout *timeout,
dbus_bool_t enabled);
DBusConnection* _dbus_connection_new_for_transport (DBusTransport *transport);
+#ifdef ENABLE_KDBUS_TRANSPORT
DBusConnection* _dbus_connection_new_for_used_transport (DBusTransport *transport);
+#endif
void _dbus_connection_do_iteration_unlocked (DBusConnection *connection,
DBusPendingCall *pending,
unsigned int flags,
#include "dbus-threads-internal.h"
#include "dbus-bus.h"
#include "dbus-marshal-basic.h"
+#ifdef ENABLE_KDBUS_TRANSPORT
#include "dbus-transport-kdbus.h"
#include <stdlib.h>
+#endif
#ifdef DBUS_DISABLE_CHECKS
#define TOOK_LOCK_CHECK(connection)
* @param transport the transport.
* @returns the new connection, or #NULL on failure.
*/
+#ifdef ENABLE_KDBUS_TRANSPORT
static DBusConnection*
_dbus_connection_new_for_transport_internal (DBusTransport *transport, dbus_bool_t exists)
+#else
+DBusConnection*
+_dbus_connection_new_for_transport (DBusTransport *transport)
+#endif
{
DBusConnection *connection;
DBusWatchList *watch_list;
connection->disconnect_message_link = disconnect_link;
+#ifdef ENABLE_KDBUS_TRANSPORT
if(!exists)
+#endif
{
CONNECTION_LOCK (connection);
return NULL;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
/**
* Creates a new connection for the given transport. A transport
* represents a message stream that uses some concrete mechanism, such
{
return _dbus_connection_new_for_transport_internal(transport, TRUE);
}
+#endif
/**
* Increments the reference count of a DBusConnection.
dbus_message_unref (message);
}
+#ifdef ENABLE_KDBUS_TRANSPORT
static void
_dbus_connection_last_unref_internal (DBusConnection *connection, dbus_bool_t unref_transport)
+#else
+static void
+_dbus_connection_last_unref (DBusConnection *connection)
+#endif
{
DBusList *link;
/* You have to disconnect the connection before unref:ing it. Otherwise
* you won't get the disconnected message.
*/
+#ifdef ENABLE_KDBUS_TRANSPORT
if(unref_transport)
+#endif
_dbus_assert (!_dbus_transport_get_is_connected (connection->transport));
_dbus_assert (connection->server_guid == NULL);
_dbus_counter_unref (connection->outgoing_counter);
+#ifdef ENABLE_KDBUS_TRANSPORT
if(unref_transport)
+#endif
_dbus_transport_unref (connection->transport);
if (connection->disconnect_message_link)
dbus_free (connection);
}
+#ifdef ENABLE_KDBUS_TRANSPORT
/* This is run without the mutex held, but after the last reference
* to the connection has been dropped we should have no thread-related
* problems
{
_dbus_connection_last_unref_internal(connection, TRUE);
}
+#endif
/**
* Decrements the reference count of a DBusConnection, and finalizes
}
}
+#ifdef ENABLE_KDBUS_TRANSPORT
void
dbus_connection_unref_phantom (DBusConnection *connection)
{
if (old_refcount == 1)
_dbus_connection_last_unref_internal(connection, FALSE);
}
+#endif
/*
* Note that the transport can disconnect itself (other end drops us)
return res;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
/**
* Sets authenticated status for connection. Needed for kdbus, where authentication is
* made in different manner.
return TRUE;
}
+#endif
/**
* Gets whether the connection is not authenticated as a specific
return _dbus_transport_get_address (connection->transport);
}
+#ifdef ENABLE_KDBUS_TRANSPORT
DBusTransport*
dbus_connection_get_transport(DBusConnection *connection)
{
return connection->transport;
}
+#endif
/** @} */
DBusConnection* dbus_connection_ref (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_unref (DBusConnection *connection);
+#ifdef ENABLE_KDBUS_TRANSPORT
DBUS_EXPORT
void dbus_connection_unref_phantom (DBusConnection *connection);
+#endif
DBUS_EXPORT
void dbus_connection_close (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_is_connected (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_is_authenticated (DBusConnection *connection);
+#ifdef ENABLE_KDBUS_TRANSPORT
DBUS_EXPORT
dbus_bool_t dbus_connection_set_is_authenticated (DBusConnection *connection);
+#endif
DBUS_EXPORT
dbus_bool_t dbus_connection_get_is_anonymous (DBusConnection *connection);
DBUS_EXPORT
}
}
+#ifdef ENABLE_KDBUS_TRANSPORT
void
dbus_message_unlock (DBusMessage *message)
{
message->locked = FALSE;
}
+#endif
static dbus_bool_t
set_or_delete_string_field (DBusMessage *message,
DBUS_EXPORT
void dbus_message_lock (DBusMessage *message);
+#ifdef ENABLE_KDBUS_TRANSPORT
DBUS_EXPORT
void dbus_message_unlock (DBusMessage *message);
+#endif
DBUS_EXPORT
dbus_bool_t dbus_set_error_from_message (DBusError *error,
return FALSE;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
static void mini_vtable_dummy_func(DBusServer *server)
{
// Used to prevent assert errors. Pointer to function is passed to
dbus_free(server);
return NULL;
}
+#endif
/**
typedef void (* DBusNewConnectionFunction) (DBusServer *server,
DBusConnection *new_connection,
void *data);
+
+#ifdef ENABLE_KDBUS_TRANSPORT
DBUS_EXPORT
DBusServer* dbus_server_init_mini (char* address);
+#endif
DBUS_EXPORT
DBusServer* dbus_server_listen (const char *address,
*
*/
+
#include <../config.h>
#include "dbus-transport-protected.h"
#include "dbus-transport-unix.h"
#include "dbus-credentials.h"
#include "dbus-mainloop.h"
#include "dbus-message.h"
+#ifdef ENABLE_KDBUS_TRANSPORT
#include "dbus-transport-kdbus.h"
+#endif
#ifdef DBUS_ENABLE_EMBEDDED_TESTS
#include "dbus-server-debug-pipe.h"
#endif
_dbus_message_loader_unref (loader);
return FALSE;
}
+#ifdef ENABLE_KDBUS_TRANSPORT
if(address_copy == strstr(address_copy, "kdbus:path="))
auth = _dbus_auth_client_new_kdbus();
else
+#endif
auth = _dbus_auth_client_new ();
}
DBusTransport **transport_p,
DBusError *error);
} open_funcs[] = {
+#ifdef ENABLE_KDBUS_TRANSPORT
{ _dbus_transport_open_kdbus },
+#endif
{ _dbus_transport_open_socket },
{ _dbus_transport_open_platform_specific },
{ _dbus_transport_open_autolaunch }
const char **mechanisms);
void _dbus_transport_set_allow_anonymous (DBusTransport *transport,
dbus_bool_t value);
+
+#ifdef ENABLE_KDBUS_TRANSPORT
DBUS_EXPORT
DBusTransport* dbus_connection_get_transport (DBusConnection *connection);
+#endif
/* if DBUS_ENABLE_STATS */
void _dbus_transport_get_stats (DBusTransport *transport,