diff options
author | Havoc Pennington <hp@redhat.com> | 2006-09-16 19:24:08 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2006-09-16 19:24:08 +0000 |
commit | fe4715b656237b89767b5dc0cba4c107541b6e0d (patch) | |
tree | 8defca3126803c37043110e7edb81dfa5476fceb /dbus/dbus-transport-unix.c | |
parent | e001455a0300cc1df17684a028049c8c33e4f575 (diff) |
2006-09-16 Havoc Pennington <hp@redhat.com>
* dbus/dbus-transport.c (_dbus_transport_open): modify to delegate
to _dbus_transport_open_platform_specific,
_dbus_transport_open_socket,
and _dbus_transport_open_debug_pipe
* dbus/dbus-transport-protected.h: add _dbus_transport_open_platform_specific
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; + } +} + /** @} */ |