wsdapi: Add stub implementation of IWSDiscoveryPublisher_PublishEx.

Signed-off-by: Owen Rudge <orudge@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Owen Rudge 2018-03-19 21:46:08 +00:00 committed by Alexandre Julliard
parent 597130d829
commit 81e4dbcdac
4 changed files with 105 additions and 26 deletions

View File

@ -8,4 +8,5 @@ C_SRCS = \
main.c \
memory.c \
msgparams.c \
soap.c \
xml.c

View File

@ -23,30 +23,12 @@
#define COBJMACROS
#define INITGUID
#include "windef.h"
#include "winbase.h"
#include "wsdapi_internal.h"
#include "wine/debug.h"
#include "wine/list.h"
#include "objbase.h"
#include "guiddef.h"
#include "wsdapi.h"
WINE_DEFAULT_DEBUG_CHANNEL(wsdapi);
struct notificationSink
{
struct list entry;
IWSDiscoveryPublisherNotify *notificationSink;
};
typedef struct IWSDiscoveryPublisherImpl {
IWSDiscoveryPublisher IWSDiscoveryPublisher_iface;
LONG ref;
IWSDXMLContext *xmlContext;
DWORD addressFamily;
struct list notificationSinks;
} IWSDiscoveryPublisherImpl;
static inline IWSDiscoveryPublisherImpl *impl_from_IWSDiscoveryPublisher(IWSDiscoveryPublisher *iface)
{
return CONTAINING_RECORD(iface, IWSDiscoveryPublisherImpl, IWSDiscoveryPublisher_iface);
@ -200,10 +182,8 @@ static HRESULT WINAPI IWSDiscoveryPublisherImpl_Publish(IWSDiscoveryPublisher *T
ULONGLONG ullMessageNumber, LPCWSTR pszSessionId, const WSD_NAME_LIST *pTypesList,
const WSD_URI_LIST *pScopesList, const WSD_URI_LIST *pXAddrsList)
{
FIXME("(%p, %s, %s, %s, %s, %s, %p, %p, %p)\n", This, debugstr_w(pszId), wine_dbgstr_longlong(ullMetadataVersion), wine_dbgstr_longlong(ullInstanceId),
wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId), pTypesList, pScopesList, pXAddrsList);
return E_NOTIMPL;
return IWSDiscoveryPublisher_PublishEx(This, pszId, ullMetadataVersion, ullInstanceId, ullMessageNumber,
pszSessionId, pTypesList, pScopesList, pXAddrsList, NULL, NULL, NULL, NULL, NULL);
}
static HRESULT WINAPI IWSDiscoveryPublisherImpl_UnPublish(IWSDiscoveryPublisher *This, LPCWSTR pszId, ULONGLONG ullInstanceId, ULONGLONG ullMessageNumber,
@ -248,13 +228,21 @@ static HRESULT WINAPI IWSDiscoveryPublisherImpl_PublishEx(IWSDiscoveryPublisher
const WSDXML_ELEMENT *pReferenceParameterAny, const WSDXML_ELEMENT *pPolicyAny,
const WSDXML_ELEMENT *pEndpointReferenceAny, const WSDXML_ELEMENT *pAny)
{
FIXME("(%p, %s, %s, %s, %s, %s, %p, %p, %p, %p, %p, %p, %p, %p)\n", This, debugstr_w(pszId), wine_dbgstr_longlong(ullMetadataVersion),
IWSDiscoveryPublisherImpl *impl = impl_from_IWSDiscoveryPublisher(This);
TRACE("(%p, %s, %s, %s, %s, %s, %p, %p, %p, %p, %p, %p, %p, %p)\n", This, debugstr_w(pszId), wine_dbgstr_longlong(ullMetadataVersion),
wine_dbgstr_longlong(ullInstanceId), wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId), pTypesList, pScopesList, pXAddrsList,
pHeaderAny, pReferenceParameterAny, pPolicyAny, pEndpointReferenceAny, pAny);
return E_NOTIMPL;
}
if ((!impl->publisherStarted) || (pszId == NULL) || (lstrlenW(pszId) > WSD_MAX_TEXT_LENGTH) ||
((pszSessionId != NULL) && (lstrlenW(pszSessionId) > WSD_MAX_TEXT_LENGTH)))
{
return E_INVALIDARG;
}
return send_hello_message(impl, pszId, ullMetadataVersion, ullInstanceId, ullMessageNumber, pszSessionId,
pTypesList, pScopesList, pXAddrsList, pHeaderAny, pReferenceParameterAny, pEndpointReferenceAny, pAny);
}
static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchProbeEx(IWSDiscoveryPublisher *This, const WSD_SOAP_MESSAGE *pProbeMessage,
IWSDMessageParameters *pMessageParameters, LPCWSTR pszId, ULONGLONG ullMetadataVersion,

66
dlls/wsdapi/soap.c 100644
View File

@ -0,0 +1,66 @@
/*
* Web Services on Devices
*
* Copyright 2017-2018 Owen Rudge 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 <stdarg.h>
#include <limits.h>
#define COBJMACROS
#include "wsdapi_internal.h"
#include "wine/debug.h"
#include "wine/heap.h"
#define APP_MAX_DELAY 500
static HRESULT write_and_send_message(IWSDiscoveryPublisherImpl *impl, WSD_SOAP_HEADER *header, WSDXML_ELEMENT *body_element,
struct list *discovered_namespaces, IWSDUdpAddress *remote_address, int max_initial_delay)
{
static const char xml_header[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
ULONG xml_header_len = sizeof(xml_header) - 1;
char *full_xml;
/* TODO: Create SOAP envelope */
/* Prefix the XML header */
full_xml = heap_alloc(xml_header_len + 1);
if (full_xml == NULL)
return E_OUTOFMEMORY;
memcpy(full_xml, xml_header, xml_header_len);
full_xml[xml_header_len] = 0;
/* TODO: Send the message */
heap_free(full_xml);
return S_OK;
}
HRESULT send_hello_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id, ULONGLONG metadata_ver, ULONGLONG instance_id,
ULONGLONG msg_num, LPCWSTR session_id, const WSD_NAME_LIST *types_list, const WSD_URI_LIST *scopes_list,
const WSD_URI_LIST *xaddrs_list, const WSDXML_ELEMENT *hdr_any, const WSDXML_ELEMENT *ref_param_any,
const WSDXML_ELEMENT *endpoint_ref_any, const WSDXML_ELEMENT *any)
{
/* TODO: Populate message body */
/* Write and send the message */
return write_and_send_message(impl, NULL, NULL, NULL, NULL, APP_MAX_DELAY);
}

View File

@ -32,4 +32,28 @@
#define WSD_MAX_TEXT_LENGTH 8192
/* discovery.c */
struct notificationSink
{
struct list entry;
IWSDiscoveryPublisherNotify *notificationSink;
};
typedef struct IWSDiscoveryPublisherImpl {
IWSDiscoveryPublisher IWSDiscoveryPublisher_iface;
LONG ref;
IWSDXMLContext *xmlContext;
DWORD addressFamily;
struct list notificationSinks;
BOOL publisherStarted;
} IWSDiscoveryPublisherImpl;
/* soap.c */
HRESULT send_hello_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id, ULONGLONG metadata_ver, ULONGLONG instance_id,
ULONGLONG msg_num, LPCWSTR session_id, const WSD_NAME_LIST *types_list, const WSD_URI_LIST *scopes_list,
const WSD_URI_LIST *xaddrs_list, const WSDXML_ELEMENT *hdr_any, const WSDXML_ELEMENT *ref_param_any,
const WSDXML_ELEMENT *endpoint_ref_any, const WSDXML_ELEMENT *any);
#endif