webservices: Implement WsOpenChannel and WsCloseChannel.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a04361f9bd
commit
be767562ae
|
@ -162,3 +162,47 @@ HRESULT WINAPI WsSetChannelProperty( WS_CHANNEL *handle, WS_CHANNEL_PROPERTY_ID
|
||||||
|
|
||||||
return prop_set( channel->prop, channel->prop_count, id, value, size );
|
return prop_set( channel->prop, channel->prop_count, id, value, size );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT open_channel( struct channel *channel, const WS_ENDPOINT_ADDRESS *endpoint )
|
||||||
|
{
|
||||||
|
channel->state = WS_CHANNEL_STATE_OPEN;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* WsOpenChannel [webservices.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI WsOpenChannel( WS_CHANNEL *handle, const WS_ENDPOINT_ADDRESS *endpoint,
|
||||||
|
const WS_ASYNC_CONTEXT *ctx, WS_ERROR *error )
|
||||||
|
{
|
||||||
|
struct channel *channel = (struct channel *)handle;
|
||||||
|
|
||||||
|
TRACE( "%p %p %p %p\n", handle, endpoint, ctx, error );
|
||||||
|
if (error) FIXME( "ignoring error parameter\n" );
|
||||||
|
if (ctx) FIXME( "ignoring ctx parameter\n" );
|
||||||
|
|
||||||
|
if (!endpoint) return E_INVALIDARG;
|
||||||
|
if (channel->state != WS_CHANNEL_STATE_CREATED) return WS_E_INVALID_OPERATION;
|
||||||
|
|
||||||
|
return open_channel( channel, endpoint );
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT close_channel( struct channel *channel )
|
||||||
|
{
|
||||||
|
channel->state = WS_CHANNEL_STATE_CLOSED;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* WsCloseChannel [webservices.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI WsCloseChannel( WS_CHANNEL *handle, const WS_ASYNC_CONTEXT *ctx, WS_ERROR *error )
|
||||||
|
{
|
||||||
|
struct channel *channel = (struct channel *)handle;
|
||||||
|
|
||||||
|
TRACE( "%p %p %p\n", handle, ctx, error );
|
||||||
|
if (error) FIXME( "ignoring error parameter\n" );
|
||||||
|
if (ctx) FIXME( "ignoring ctx parameter\n" );
|
||||||
|
|
||||||
|
return close_channel( channel );
|
||||||
|
}
|
||||||
|
|
|
@ -57,7 +57,47 @@ static void test_WsCreateChannel(void)
|
||||||
WsFreeChannel( channel );
|
WsFreeChannel( channel );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_WsOpenChannel(void)
|
||||||
|
{
|
||||||
|
WCHAR url[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t'};
|
||||||
|
HRESULT hr;
|
||||||
|
WS_CHANNEL *channel;
|
||||||
|
WS_ENDPOINT_ADDRESS addr;
|
||||||
|
|
||||||
|
hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, 0, NULL, &channel, NULL ) ;
|
||||||
|
ok( hr == S_OK, "got %08x\n", hr );
|
||||||
|
|
||||||
|
hr = WsCloseChannel( channel, NULL, NULL );
|
||||||
|
ok( hr == S_OK, "got %08x\n", hr );
|
||||||
|
WsFreeChannel( channel );
|
||||||
|
|
||||||
|
hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, 0, NULL, &channel, NULL ) ;
|
||||||
|
ok( hr == S_OK, "got %08x\n", hr );
|
||||||
|
|
||||||
|
hr = WsOpenChannel( channel, NULL, NULL, NULL );
|
||||||
|
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||||
|
|
||||||
|
addr.url.length = sizeof(url)/sizeof(url[0]);
|
||||||
|
addr.url.chars = url;
|
||||||
|
addr.headers = NULL;
|
||||||
|
addr.extensions = NULL;
|
||||||
|
addr.identity = NULL;
|
||||||
|
hr = WsOpenChannel( channel, &addr, NULL, NULL );
|
||||||
|
ok( hr == S_OK, "got %08x\n", hr );
|
||||||
|
|
||||||
|
hr = WsOpenChannel( channel, &addr, NULL, NULL );
|
||||||
|
ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
|
||||||
|
|
||||||
|
hr = WsCloseChannel( channel, NULL, NULL );
|
||||||
|
ok( hr == S_OK, "got %08x\n", hr );
|
||||||
|
|
||||||
|
hr = WsCloseChannel( channel, NULL, NULL );
|
||||||
|
ok( hr == S_OK, "got %08x\n", hr );
|
||||||
|
WsFreeChannel( channel );
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(channel)
|
START_TEST(channel)
|
||||||
{
|
{
|
||||||
test_WsCreateChannel();
|
test_WsCreateChannel();
|
||||||
|
test_WsOpenChannel();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
@ stub WsAsyncExecute
|
@ stub WsAsyncExecute
|
||||||
@ stub WsCall
|
@ stub WsCall
|
||||||
@ stub WsCheckMustUnderstandHeaders
|
@ stub WsCheckMustUnderstandHeaders
|
||||||
@ stub WsCloseChannel
|
@ stdcall WsCloseChannel(ptr ptr ptr)
|
||||||
@ stub WsCloseListener
|
@ stub WsCloseListener
|
||||||
@ stub WsCloseServiceHost
|
@ stub WsCloseServiceHost
|
||||||
@ stub WsCloseServiceProxy
|
@ stub WsCloseServiceProxy
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
@ stub WsMatchPolicyAlternative
|
@ stub WsMatchPolicyAlternative
|
||||||
@ stdcall WsMoveReader(ptr long ptr ptr)
|
@ stdcall WsMoveReader(ptr long ptr ptr)
|
||||||
@ stub WsMoveWriter
|
@ stub WsMoveWriter
|
||||||
@ stub WsOpenChannel
|
@ stdcall WsOpenChannel(ptr ptr ptr ptr)
|
||||||
@ stub WsOpenListener
|
@ stub WsOpenListener
|
||||||
@ stub WsOpenServiceHost
|
@ stub WsOpenServiceHost
|
||||||
@ stub WsOpenServiceProxy
|
@ stub WsOpenServiceProxy
|
||||||
|
|
|
@ -74,6 +74,7 @@ struct channel
|
||||||
{
|
{
|
||||||
WS_CHANNEL_TYPE type;
|
WS_CHANNEL_TYPE type;
|
||||||
WS_CHANNEL_BINDING binding;
|
WS_CHANNEL_BINDING binding;
|
||||||
|
WS_CHANNEL_STATE state;
|
||||||
ULONG prop_count;
|
ULONG prop_count;
|
||||||
struct prop prop[9];
|
struct prop prop[9];
|
||||||
};
|
};
|
||||||
|
@ -81,6 +82,8 @@ struct channel
|
||||||
HRESULT create_channel( WS_CHANNEL_TYPE, WS_CHANNEL_BINDING, const WS_CHANNEL_PROPERTY *,
|
HRESULT create_channel( WS_CHANNEL_TYPE, WS_CHANNEL_BINDING, const WS_CHANNEL_PROPERTY *,
|
||||||
ULONG, struct channel ** ) DECLSPEC_HIDDEN;
|
ULONG, struct channel ** ) DECLSPEC_HIDDEN;
|
||||||
void free_channel( struct channel * ) DECLSPEC_HIDDEN;
|
void free_channel( struct channel * ) DECLSPEC_HIDDEN;
|
||||||
|
HRESULT open_channel( struct channel *, const WS_ENDPOINT_ADDRESS * ) DECLSPEC_HIDDEN;
|
||||||
|
HRESULT close_channel( struct channel * ) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
static inline void *heap_alloc( SIZE_T size )
|
static inline void *heap_alloc( SIZE_T size )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue