*
*/
+#include <config.h>
#include "dbus-internals.h"
#include "dbus-server-win.h"
#include "dbus-server-socket.h"
-#include "dbus-connection-internal.h"
-#include "dbus-sysdeps-win.h"
/**
* @defgroup DBusServerWin DBusServer implementations for Windows
DBusServer **server_p,
DBusError *error)
{
- /* don't handle any method yet, return NULL with the error unset,
- ** for a sample implementation see dbus-server-unix.c
- */
+ const char *method;
+
*server_p = NULL;
- _DBUS_ASSERT_ERROR_IS_CLEAR(error);
- return DBUS_SERVER_LISTEN_NOT_HANDLED;
+
+ method = dbus_address_entry_get_method (entry);
+
+ if (strcmp (method, "autolaunch") == 0)
+ {
+ const char *host = "localhost";
+ const char *bind = "localhost";
+ const char *port = "0";
+ const char *family = "ipv4";
+ const char *scope = dbus_address_entry_get_value (entry, "scope");
+
+ if (_dbus_daemon_is_session_bus_address_published (scope))
+ return DBUS_SERVER_LISTEN_ADDRESS_ALREADY_USED;
+
+ *server_p = _dbus_server_new_for_tcp_socket (host, bind, port,
+ family, error, FALSE);
+ if (*server_p)
+ {
+ _DBUS_ASSERT_ERROR_IS_CLEAR(error);
+ (*server_p)->published_address =
+ _dbus_daemon_publish_session_bus_address ((*server_p)->address, scope);
+ return DBUS_SERVER_LISTEN_OK;
+ }
+ else
+ {
+ // make sure no handle is open
+ _dbus_daemon_unpublish_session_bus_address ();
+ _DBUS_ASSERT_ERROR_IS_SET(error);
+ return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
+ }
+ }
+ else
+ {
+ _DBUS_ASSERT_ERROR_IS_CLEAR(error);
+ return DBUS_SERVER_LISTEN_NOT_HANDLED;
+ }
}
/** @} */