Hans Leidekker : webservices: Implement WsCreateChannelForListener.
Alexandre Julliard
julliard at winehq.org
Thu Apr 20 16:41:33 CDT 2017
Module: wine
Branch: master
Commit: 9cacff8e077e01cbf2d325abf54bc8bda9f1a13f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9cacff8e077e01cbf2d325abf54bc8bda9f1a13f
Author: Hans Leidekker <hans at codeweavers.com>
Date: Thu Apr 20 10:45:45 2017 +0200
webservices: Implement WsCreateChannelForListener.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/webservices/channel.c | 39 ++++++++++++++++++++++++++++++++-------
dlls/webservices/tests/listener.c | 37 +++++++++++++++++++++++++++++++++++++
dlls/webservices/webservices.spec | 2 +-
3 files changed, 70 insertions(+), 8 deletions(-)
diff --git a/dlls/webservices/channel.c b/dlls/webservices/channel.c
index 89070f6..e777e8c 100644
--- a/dlls/webservices/channel.c
+++ b/dlls/webservices/channel.c
@@ -213,8 +213,35 @@ HRESULT WINAPI WsCreateChannel( WS_CHANNEL_TYPE type, WS_CHANNEL_BINDING binding
return E_NOTIMPL;
}
- if ((hr = create_channel( type, binding, properties, count, &channel )) != S_OK)
- return hr;
+ if ((hr = create_channel( type, binding, properties, count, &channel )) != S_OK) return hr;
+
+ *handle = (WS_CHANNEL *)channel;
+ return S_OK;
+}
+
+/**************************************************************************
+ * WsCreateChannelForListener [webservices.@]
+ */
+HRESULT WINAPI WsCreateChannelForListener( WS_LISTENER *listener_handle, const WS_CHANNEL_PROPERTY *properties,
+ ULONG count, WS_CHANNEL **handle, WS_ERROR *error )
+{
+ struct channel *channel;
+ WS_CHANNEL_TYPE type;
+ WS_CHANNEL_BINDING binding;
+ HRESULT hr;
+
+ TRACE( "%p %p %u %p %p\n", listener_handle, properties, count, handle, error );
+ if (error) FIXME( "ignoring error parameter\n" );
+
+ if (!listener_handle || !handle) return E_INVALIDARG;
+
+ if ((hr = WsGetListenerProperty( listener_handle, WS_LISTENER_PROPERTY_CHANNEL_TYPE, &type,
+ sizeof(type), NULL )) != S_OK) return hr;
+
+ if ((hr = WsGetListenerProperty( listener_handle, WS_LISTENER_PROPERTY_CHANNEL_BINDING, &binding,
+ sizeof(binding), NULL )) != S_OK) return hr;
+
+ if ((hr = create_channel( type, binding, properties, count, &channel )) != S_OK) return hr;
*handle = (WS_CHANNEL *)channel;
return S_OK;
@@ -393,11 +420,10 @@ HRESULT WINAPI WsOpenChannel( WS_CHANNEL *handle, const WS_ENDPOINT_ADDRESS *end
return hr;
}
-static HRESULT close_channel( struct channel *channel )
+static void close_channel( struct channel *channel )
{
reset_channel( channel );
channel->state = WS_CHANNEL_STATE_CLOSED;
- return S_OK;
}
/**************************************************************************
@@ -406,7 +432,6 @@ static HRESULT close_channel( struct channel *channel )
HRESULT WINAPI WsCloseChannel( WS_CHANNEL *handle, const WS_ASYNC_CONTEXT *ctx, WS_ERROR *error )
{
struct channel *channel = (struct channel *)handle;
- HRESULT hr;
TRACE( "%p %p %p\n", handle, ctx, error );
if (error) FIXME( "ignoring error parameter\n" );
@@ -422,10 +447,10 @@ HRESULT WINAPI WsCloseChannel( WS_CHANNEL *handle, const WS_ASYNC_CONTEXT *ctx,
return E_INVALIDARG;
}
- hr = close_channel( channel );
+ close_channel( channel );
LeaveCriticalSection( &channel->cs );
- return hr;
+ return S_OK;
}
static HRESULT parse_url( const WCHAR *url, ULONG len, URL_COMPONENTS *uc )
diff --git a/dlls/webservices/tests/listener.c b/dlls/webservices/tests/listener.c
index ab2fba9..c4a2747 100644
--- a/dlls/webservices/tests/listener.c
+++ b/dlls/webservices/tests/listener.c
@@ -154,8 +154,45 @@ static void test_WsOpenListener(void)
WsFreeListener( listener );
}
+static void test_WsCreateChannelForListener(void)
+{
+ WS_LISTENER *listener;
+ WS_CHANNEL *channel;
+ WS_CHANNEL_TYPE type;
+ WS_CHANNEL_STATE state;
+ HRESULT hr;
+
+ hr = WsCreateChannelForListener( NULL, NULL, 0, NULL, NULL );
+ ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+ hr = WsCreateChannelForListener( NULL, NULL, 0, &channel, NULL );
+ ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+ hr = WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION, WS_TCP_CHANNEL_BINDING, NULL, 0, NULL, &listener, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ channel = NULL;
+ hr = WsCreateChannelForListener( listener, NULL, 0, &channel, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( channel != NULL, "channel not set\n" );
+
+ type = 0xdeadbeef;
+ hr = WsGetChannelProperty( channel, WS_CHANNEL_PROPERTY_CHANNEL_TYPE, &type, sizeof(type), NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( type == WS_CHANNEL_TYPE_DUPLEX_SESSION, "got %u\n", type );
+
+ state = 0xdeadbeef;
+ hr = WsGetChannelProperty( channel, WS_CHANNEL_PROPERTY_STATE, &state, sizeof(state), NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( state == WS_CHANNEL_STATE_CREATED, "got %u\n", state );
+
+ WsFreeChannel( channel );
+ WsFreeListener( listener );
+}
+
START_TEST(listener)
{
test_WsCreateListener();
test_WsOpenListener();
+ test_WsCreateChannelForListener();
}
diff --git a/dlls/webservices/webservices.spec b/dlls/webservices/webservices.spec
index ff35777..522cc56 100644
--- a/dlls/webservices/webservices.spec
+++ b/dlls/webservices/webservices.spec
@@ -21,7 +21,7 @@
@ stub WsCopyError
@ stdcall WsCopyNode(ptr ptr ptr)
@ stdcall WsCreateChannel(long long ptr long ptr ptr ptr)
-@ stub WsCreateChannelForListener
+@ stdcall WsCreateChannelForListener(ptr ptr long ptr ptr)
@ stdcall WsCreateError(ptr long ptr)
@ stub WsCreateFaultFromError
@ stdcall WsCreateHeap(long long ptr long ptr ptr)
More information about the wine-cvs
mailing list