From 6180d6954c41a2412c166e5a9e8a2851cf39c6d1 Mon Sep 17 00:00:00 2001 From: Mikael Hallendal Date: Wed, 19 Feb 2003 08:13:31 +0000 Subject: 2003-02-19 Mikael Hallendal * dbus/dbus-server.c (dbus_server_listen): Support tcp: addresses. * dbus/dbus-transport-unix.c (_dbus_transport_new_for_tcp_socket): Added to create a transport connecting using a tcp/ip socket. * dbus/dbus-sysdeps.c (_dbus_connect_tcp_socket): Added to connect to a tcp socket at given host and port. (_dbus_listen_tcp_socket): added to listen on tcp socket for given hostname and port. * dbus/dbus-server.c (dbus_server_listen): Support tcp: addresses. * dbus/dbus-server-unix.c (_dbus_server_new_for_tcp_socket): Added to create a server listening on a TCP/IP socket. --- dbus/dbus-transport.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'dbus/dbus-transport.c') diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c index 5a25a675..1f34b3bb 100644 --- a/dbus/dbus-transport.c +++ b/dbus/dbus-transport.c @@ -199,6 +199,35 @@ _dbus_transport_open (const char *address, transport = _dbus_transport_new_for_domain_socket (path, FALSE, result); } + else if (strcmp (method, "tcp") == 0) + { + const char *host = dbus_address_entry_get_value (entries[i], "host"); + const char *port = dbus_address_entry_get_value (entries[i], "port"); + DBusString str; + long lport; + dbus_bool_t sresult; + + if (port == NULL) + goto bad_address; + + _dbus_string_init_const (&str, port); + sresult = _dbus_string_parse_int (&str, 0, &lport, NULL); + _dbus_string_free (&str); + + if (sresult == FALSE || lport <= 0 || lport > 65535) + goto bad_address; + + transport = _dbus_transport_new_for_tcp_socket (host, lport, FALSE, result); + } + else if (strcmp (method, "tcp") == 0) + { + const char *path = dbus_address_entry_get_value (entries[i], "path"); + + if (path == NULL) + goto bad_address; + + transport = _dbus_transport_new_for_domain_socket (path, FALSE, result); + } #ifdef DBUS_BUILD_TESTS else if (strcmp (method, "debug") == 0) { -- cgit