diff options
Diffstat (limited to 'dbus/dbus-transport-unix.c')
| -rw-r--r-- | dbus/dbus-transport-unix.c | 63 | 
1 files changed, 63 insertions, 0 deletions
diff --git a/dbus/dbus-transport-unix.c b/dbus/dbus-transport-unix.c index 7874fd1b..40b27eae 100644 --- a/dbus/dbus-transport-unix.c +++ b/dbus/dbus-transport-unix.c @@ -24,6 +24,7 @@  #include "dbus-internals.h"  #include "dbus-connection-internal.h"  #include "dbus-transport-unix.h" +#include "dbus-transport-socket.h"  #include "dbus-transport-protected.h"  #include "dbus-watch.h"  #include "dbus-sysdeps-unix.h" @@ -107,4 +108,66 @@ _dbus_transport_new_for_domain_socket (const char     *path,    return NULL;  } +DBusTransportOpenResult +_dbus_transport_open_platform_specific (DBusAddressEntry  *entry, +                                        DBusTransport    **transport_p, +                                        DBusError         *error) +{ +  const char *method; +   +  method = dbus_address_entry_get_method (entry); +  _dbus_assert (method != NULL); + +  if (strcmp (method, "unix") == 0) +    { +      const char *path = dbus_address_entry_get_value (entry, "path"); +      const char *tmpdir = dbus_address_entry_get_value (entry, "tmpdir"); +      const char *abstract = dbus_address_entry_get_value (entry, "abstract"); +           +      if (tmpdir != NULL) +        { +          _dbus_set_bad_address (error, NULL, NULL, +                                 "cannot use the \"tmpdir\" option for an address to connect to, only in an address to listen on"); +          return DBUS_TRANSPORT_OPEN_BAD_ADDRESS; +        } +           +      if (path == NULL && abstract == NULL) +        { +          _dbus_set_bad_address (error, "unix", +                                 "path or abstract", +                                 NULL); +          return DBUS_TRANSPORT_OPEN_BAD_ADDRESS; +        } + +      if (path != NULL && abstract != NULL) +        { +          _dbus_set_bad_address (error, NULL, NULL, +                                 "can't specify both \"path\" and \"abstract\" options in an address"); +          return DBUS_TRANSPORT_OPEN_BAD_ADDRESS; +        } + +      if (path) +        *transport_p = _dbus_transport_new_for_domain_socket (path, FALSE, +                                                           error); +      else +        *transport_p = _dbus_transport_new_for_domain_socket (abstract, TRUE, +                                                           error); +      if (*transport_p == NULL) +        { +          _DBUS_ASSERT_ERROR_IS_SET (error); +          return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT; +        } +      else +        { +          _DBUS_ASSERT_ERROR_IS_CLEAR (error); +          return DBUS_TRANSPORT_OPEN_OK; +        }       +    } +  else +    { +      _DBUS_ASSERT_ERROR_IS_CLEAR (error); +      return DBUS_TRANSPORT_OPEN_NOT_HANDLED; +    } +} +  /** @} */  | 
