Commit a6318e25 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

webservices: Add support for outgoing TCP connections.

parent 1d79fc45
......@@ -20,13 +20,13 @@
#include "windef.h"
#include "winbase.h"
#include "ws2tcpip.h"
#include "webservices.h"
#include "wine/debug.h"
#include "wine/list.h"
#include "wine/unicode.h"
#include "webservices_private.h"
#include "sock.h"
WINE_DEFAULT_DEBUG_CHANNEL(webservices);
......@@ -41,7 +41,7 @@ static BOOL WINAPI winsock_startup( INIT_ONCE *once, void *param, void **ctx )
return TRUE;
}
static void winsock_init(void)
void winsock_init(void)
{
static INIT_ONCE once = INIT_ONCE_STATIC_INIT;
InitOnceExecuteOnce( &once, winsock_startup, NULL, NULL );
......@@ -201,7 +201,7 @@ void WINAPI WsFreeListener( WS_LISTENER *handle )
free_listener( listener );
}
static HRESULT resolve_hostname( const WCHAR *host, USHORT port, struct sockaddr *addr, int *addr_len )
HRESULT resolve_hostname( const WCHAR *host, USHORT port, struct sockaddr *addr, int *addr_len )
{
static const WCHAR fmtW[] = {'%','u',0};
WCHAR service[6];
......@@ -225,7 +225,7 @@ static HRESULT resolve_hostname( const WCHAR *host, USHORT port, struct sockaddr
return hr;
}
static HRESULT parse_url( const WS_STRING *str, WCHAR **host, USHORT *port )
HRESULT parse_url( const WS_STRING *str, WS_URL_SCHEME_TYPE *scheme, WCHAR **host, USHORT *port )
{
WS_HEAP *heap;
WS_NETTCP_URL *url;
......@@ -249,6 +249,7 @@ static HRESULT parse_url( const WS_STRING *str, WCHAR **host, USHORT *port )
memcpy( *host, url->host.chars, url->host.length * sizeof(WCHAR) );
(*host)[url->host.length] = 0;
}
*scheme = url->url.scheme;
*port = url->port;
WsFreeHeap( heap );
......@@ -260,11 +261,17 @@ static HRESULT open_listener( struct listener *listener, const WS_STRING *url )
struct sockaddr_storage storage;
struct sockaddr *addr = (struct sockaddr *)&storage;
int addr_len;
WS_URL_SCHEME_TYPE scheme;
WCHAR *host;
USHORT port;
HRESULT hr;
if ((hr = parse_url( url, &host, &port )) != S_OK) return hr;
if ((hr = parse_url( url, &scheme, &host, &port )) != S_OK) return hr;
if (scheme != WS_URL_NETTCP_SCHEME_TYPE)
{
heap_free( host );
return WS_E_INVALID_ENDPOINT_URL;
}
winsock_init();
......
......@@ -16,7 +16,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdio.h>
#include <stdarg.h>
#include "windef.h"
......
/*
* Copyright 2017 Hans Leidekker for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "ws2tcpip.h"
void winsock_init(void) DECLSPEC_HIDDEN;
HRESULT resolve_hostname( const WCHAR *, USHORT, struct sockaddr *, int * ) DECLSPEC_HIDDEN;
......@@ -121,6 +121,8 @@ HRESULT channel_send_message( WS_CHANNEL *, WS_MESSAGE * ) DECLSPEC_HIDDEN;
HRESULT channel_receive_message( WS_CHANNEL * ) DECLSPEC_HIDDEN;
HRESULT channel_get_reader( WS_CHANNEL *, WS_XML_READER ** ) DECLSPEC_HIDDEN;
HRESULT parse_url( const WS_STRING *, WS_URL_SCHEME_TYPE *, WCHAR **, USHORT * ) DECLSPEC_HIDDEN;
#define TICKS_PER_SEC 10000000
#define TICKS_PER_MIN (60 * (ULONGLONG)TICKS_PER_SEC)
#define TICKS_PER_HOUR (3600 * (ULONGLONG)TICKS_PER_SEC)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment