28 #include "dbus-internals.h"    29 #include "dbus-connection-internal.h"    30 #include "dbus-transport-unix.h"    31 #include "dbus-transport-socket.h"    32 #include "dbus-transport-protected.h"    33 #include "dbus-watch.h"    34 #include "dbus-sysdeps-unix.h"    35 #include "dbus-test.h"    66   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
    87       _DBUS_ASSERT_ERROR_IS_SET (error);
    91   _dbus_verbose (
"Successfully connected to unix socket %s\n",
    95   if (transport == 
NULL)
   124 _dbus_transport_new_for_exec (
const char     *path,
   134   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   161       for (i = 0; argv[i]; i++)
   186       _DBUS_ASSERT_ERROR_IS_SET (error);
   190   _dbus_verbose (
"Successfully connected to process %s\n",
   194   if (transport == 
NULL)
   220 DBusTransportOpenResult
   230   if (strcmp (method, 
"unix") == 0)
   239                                  "cannot use the \"tmpdir\" option for an address to connect to, only in an address to listen on");
   240           return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
   243       if (path == 
NULL && 
abstract == 
NULL)
   248           return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
   251       if (path != 
NULL && 
abstract != 
NULL)
   254                                  "can't specify both \"path\" and \"abstract\" options in an address");
   255           return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
   264       if (*transport_p == 
NULL)
   266           _DBUS_ASSERT_ERROR_IS_SET (error);
   267           return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
   271           _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   272           return DBUS_TRANSPORT_OPEN_OK;
   275   else if (strcmp (method, 
"unixexec") == 0)
   285                                  "No process path specified");
   286           return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
   294           snprintf (t, 
sizeof(t), 
"argv%u", i);
   305           return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
   314           snprintf (t, 
sizeof(t), 
"argv%u", i);
   331               return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
   335       *transport_p = _dbus_transport_new_for_exec (path, argv, error);
   338       if (*transport_p == 
NULL)
   340           _DBUS_ASSERT_ERROR_IS_SET (error);
   341           return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
   345           _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   346           return DBUS_TRANSPORT_OPEN_OK;
   349 #ifdef DBUS_ENABLE_LAUNCHD   350   else if (strcmp (method, 
"launchd") == 0)
   354       const char *launchd_socket;
   360           _DBUS_SET_OOM (error);
   364       if (launchd_env_var == 
NULL)
   367           return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
   375           return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
   381                          "launchd's env var %s does not exist", launchd_env_var);
   384           return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
   387       launchd_socket = _dbus_string_get_const_data(&socket_path);
   390       if (*transport_p == 
NULL)
   392           _DBUS_ASSERT_ERROR_IS_SET (error);
   393           return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
   397           _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   398           return DBUS_TRANSPORT_OPEN_OK;
   404       _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   405       return DBUS_TRANSPORT_OPEN_NOT_HANDLED;
   411 #ifdef DBUS_ENABLE_EMBEDDED_TESTS   414 _dbus_transport_unix_test (
void)
   427   address = _dbus_connection_get_address (c);
   431   ret = strcmp (address, 
"unixexec:path=/bin/false,argv0=false,argv1=foobar") == 0;
 dbus_bool_t _dbus_string_append(DBusString *str, const char *buffer)
Appends a nul-terminated C-style string to a DBusString. 
#define NULL
A null pointer, defined appropriately for C or C++. 
DBusTransportOpenResult _dbus_transport_open_platform_specific(DBusAddressEntry *entry, DBusTransport **transport_p, DBusError *error)
Opens platform specific transport types. 
void dbus_free(void *memory)
Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0(). 
#define _dbus_assert(condition)
Aborts with an error message if the condition is false. 
#define DBUS_ERROR_INIT
Expands to a suitable initializer for a DBusError on the stack. 
const char * dbus_address_entry_get_method(DBusAddressEntry *entry)
Returns the method string of an address entry. 
void dbus_error_free(DBusError *error)
Frees an error that's been set (or just initialized), then reinitializes the error as in dbus_error_i...
Implementation details of DBusConnection. 
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a string. 
dbus_bool_t _dbus_close_socket(DBusSocket fd, DBusError *error)
Closes a socket. 
DBusTransport * _dbus_transport_new_for_domain_socket(const char *path, dbus_bool_t abstract, DBusError *error)
Creates a new transport for the given Unix domain socket path. 
const char * dbus_address_entry_get_value(DBusAddressEntry *entry, const char *key)
Returns a value from a key of an entry. 
dbus_bool_t _dbus_lookup_launchd_socket(DBusString *socket_path, const char *launchd_env_var, DBusError *error)
quries launchd for a specific env var which holds the socket path. 
DBusTransport * _dbus_transport_new_for_socket(DBusSocket fd, const DBusString *server_guid, const DBusString *address)
Creates a new transport for the given socket file descriptor. 
#define dbus_new0(type, count)
Safe macro for using dbus_malloc0(). 
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE. 
Internals of DBusAddressEntry. 
dbus_bool_t _dbus_string_append_printf(DBusString *str, const char *format,...)
Appends a printf-style formatted string to the DBusString. 
void _dbus_set_bad_address(DBusError *error, const char *address_problem_type, const char *address_problem_field, const char *address_problem_other)
Sets DBUS_ERROR_BAD_ADDRESS. 
DBusConnection * dbus_connection_open(const char *address, DBusError *error)
Gets a connection to a remote address. 
Object representing an exception. 
#define DBUS_ERROR_BAD_ADDRESS
A D-Bus bus address was malformed. 
void dbus_set_error(DBusError *error, const char *name, const char *format,...)
Assigns an error name and message to a DBusError. 
int _dbus_connect_exec(const char *path, char *const argv[], DBusError *error)
Creates a UNIX domain socket and connects it to the specified process to execute. ...
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init(). 
#define TRUE
Expands to "1". 
void dbus_move_error(DBusError *src, DBusError *dest)
Moves an error src into dest, freeing src and overwriting dest. 
char * dbus_address_escape_value(const char *value)
Escapes the given string as a value in a key=value pair for a D-Bus address. 
Object representing a transport such as a socket. 
void dbus_error_init(DBusError *error)
Initializes a DBusError structure. 
void dbus_free_string_array(char **str_array)
Frees a NULL-terminated array of strings. 
#define DBUS_ERROR_NO_MEMORY
There was not enough memory to complete an operation. 
#define FALSE
Expands to "0". 
void dbus_connection_unref(DBusConnection *connection)
Decrements the reference count of a DBusConnection, and finalizes it if the count reaches zero...
char * _dbus_strdup(const char *str)
Duplicates a string. 
int _dbus_connect_unix_socket(const char *path, dbus_bool_t abstract, DBusError *error)
Creates a socket and connects it to the UNIX domain socket at the given path. 
dbus_bool_t dbus_error_is_set(const DBusError *error)
Checks whether an error occurred (the error is set).