2017-04-06 21:19:39 +00:00
|
|
|
/*
|
|
|
|
* Web Services on Devices
|
|
|
|
*
|
|
|
|
* Copyright 2017 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>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
#define INITGUID
|
|
|
|
|
2018-03-19 21:46:08 +00:00
|
|
|
#include "wsdapi_internal.h"
|
2017-04-06 21:19:39 +00:00
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "guiddef.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(wsdapi);
|
|
|
|
|
|
|
|
static inline IWSDiscoveryPublisherImpl *impl_from_IWSDiscoveryPublisher(IWSDiscoveryPublisher *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IWSDiscoveryPublisherImpl, IWSDiscoveryPublisher_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IWSDiscoveryPublisherImpl_QueryInterface(IWSDiscoveryPublisher *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
IWSDiscoveryPublisherImpl *This = impl_from_IWSDiscoveryPublisher(iface);
|
|
|
|
|
|
|
|
TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
if (!ppv)
|
|
|
|
{
|
|
|
|
WARN("Invalid parameter\n");
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualIID(riid, &IID_IWSDiscoveryPublisher))
|
|
|
|
{
|
|
|
|
*ppv = &This->IWSDiscoveryPublisher_iface;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WARN("Unknown IID %s\n", debugstr_guid(riid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IWSDiscoveryPublisherImpl_AddRef(IWSDiscoveryPublisher *iface)
|
|
|
|
{
|
|
|
|
IWSDiscoveryPublisherImpl *This = impl_from_IWSDiscoveryPublisher(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
2022-02-23 08:10:15 +00:00
|
|
|
TRACE("(%p) ref=%ld\n", This, ref);
|
2017-04-06 21:19:39 +00:00
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IWSDiscoveryPublisherImpl_Release(IWSDiscoveryPublisher *iface)
|
|
|
|
{
|
|
|
|
IWSDiscoveryPublisherImpl *This = impl_from_IWSDiscoveryPublisher(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
2017-04-18 19:40:38 +00:00
|
|
|
struct notificationSink *sink, *cursor;
|
2018-09-19 20:29:05 +00:00
|
|
|
struct message_id *msg_id, *msg_id_cursor;
|
2017-04-06 21:19:39 +00:00
|
|
|
|
2022-02-23 08:10:15 +00:00
|
|
|
TRACE("(%p) ref=%ld\n", This, ref);
|
2017-04-06 21:19:39 +00:00
|
|
|
|
|
|
|
if (ref == 0)
|
|
|
|
{
|
2018-03-19 21:46:13 +00:00
|
|
|
terminate_networking(This);
|
|
|
|
|
2017-04-06 21:19:39 +00:00
|
|
|
if (This->xmlContext != NULL)
|
|
|
|
{
|
|
|
|
IWSDXMLContext_Release(This->xmlContext);
|
|
|
|
}
|
2017-04-18 19:40:38 +00:00
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY_SAFE(sink, cursor, &This->notificationSinks, struct notificationSink, entry)
|
|
|
|
{
|
|
|
|
IWSDiscoveryPublisherNotify_Release(sink->notificationSink);
|
|
|
|
list_remove(&sink->entry);
|
2023-09-05 08:37:04 +00:00
|
|
|
free(sink);
|
2017-04-18 19:40:38 +00:00
|
|
|
}
|
|
|
|
|
2018-06-13 18:11:20 +00:00
|
|
|
DeleteCriticalSection(&This->notification_sink_critical_section);
|
2018-09-19 20:29:05 +00:00
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY_SAFE(msg_id, msg_id_cursor, &This->message_ids, struct message_id, entry)
|
|
|
|
{
|
2023-09-05 08:37:04 +00:00
|
|
|
free(msg_id->id);
|
2018-09-19 20:29:05 +00:00
|
|
|
list_remove(&msg_id->entry);
|
2023-09-05 08:37:04 +00:00
|
|
|
free(msg_id);
|
2018-09-19 20:29:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DeleteCriticalSection(&This->message_ids_critical_section);
|
2023-09-05 08:37:04 +00:00
|
|
|
free(This);
|
2017-04-06 21:19:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IWSDiscoveryPublisherImpl_SetAddressFamily(IWSDiscoveryPublisher *This, DWORD dwAddressFamily)
|
|
|
|
{
|
2017-04-06 21:19:46 +00:00
|
|
|
IWSDiscoveryPublisherImpl *impl = impl_from_IWSDiscoveryPublisher(This);
|
|
|
|
|
2022-02-23 08:10:15 +00:00
|
|
|
TRACE("(%p, %ld)\n", This, dwAddressFamily);
|
2017-04-06 21:19:46 +00:00
|
|
|
|
|
|
|
/* Has the address family already been set? */
|
|
|
|
if (impl->addressFamily != 0)
|
|
|
|
{
|
|
|
|
return STG_E_INVALIDFUNCTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((dwAddressFamily == WSDAPI_ADDRESSFAMILY_IPV4) || (dwAddressFamily == WSDAPI_ADDRESSFAMILY_IPV6) ||
|
|
|
|
(dwAddressFamily == (WSDAPI_ADDRESSFAMILY_IPV4 | WSDAPI_ADDRESSFAMILY_IPV6)))
|
|
|
|
{
|
|
|
|
/* TODO: Check that the address family is supported by the system */
|
|
|
|
impl->addressFamily = dwAddressFamily;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return E_INVALIDARG;
|
2017-04-06 21:19:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IWSDiscoveryPublisherImpl_RegisterNotificationSink(IWSDiscoveryPublisher *This, IWSDiscoveryPublisherNotify *pSink)
|
|
|
|
{
|
2017-04-18 19:40:38 +00:00
|
|
|
IWSDiscoveryPublisherImpl *impl = impl_from_IWSDiscoveryPublisher(This);
|
|
|
|
struct notificationSink *sink;
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", This, pSink);
|
|
|
|
|
|
|
|
if (pSink == NULL)
|
|
|
|
{
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
2023-09-05 08:37:04 +00:00
|
|
|
sink = calloc(1, sizeof(*sink));
|
2017-04-18 19:40:38 +00:00
|
|
|
|
|
|
|
if (!sink)
|
|
|
|
{
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
sink->notificationSink = pSink;
|
|
|
|
IWSDiscoveryPublisherNotify_AddRef(pSink);
|
|
|
|
|
2018-06-13 18:11:20 +00:00
|
|
|
EnterCriticalSection(&impl->notification_sink_critical_section);
|
2017-04-18 19:40:38 +00:00
|
|
|
list_add_tail(&impl->notificationSinks, &sink->entry);
|
2018-06-13 18:11:20 +00:00
|
|
|
LeaveCriticalSection(&impl->notification_sink_critical_section);
|
2017-04-18 19:40:38 +00:00
|
|
|
|
2018-03-19 21:46:13 +00:00
|
|
|
if ((!impl->publisherStarted) && (!init_networking(impl)))
|
|
|
|
return E_FAIL;
|
|
|
|
|
2017-04-18 19:40:38 +00:00
|
|
|
return S_OK;
|
2017-04-06 21:19:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IWSDiscoveryPublisherImpl_UnRegisterNotificationSink(IWSDiscoveryPublisher *This, IWSDiscoveryPublisherNotify *pSink)
|
|
|
|
{
|
2017-04-18 19:40:38 +00:00
|
|
|
IWSDiscoveryPublisherImpl *impl = impl_from_IWSDiscoveryPublisher(This);
|
|
|
|
struct notificationSink *sink;
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", This, pSink);
|
|
|
|
|
|
|
|
if (pSink == NULL)
|
|
|
|
{
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
2018-06-13 18:11:20 +00:00
|
|
|
EnterCriticalSection(&impl->notification_sink_critical_section);
|
|
|
|
|
2017-04-18 19:40:38 +00:00
|
|
|
LIST_FOR_EACH_ENTRY(sink, &impl->notificationSinks, struct notificationSink, entry)
|
|
|
|
{
|
|
|
|
if (sink->notificationSink == pSink)
|
|
|
|
{
|
|
|
|
IWSDiscoveryPublisherNotify_Release(pSink);
|
|
|
|
list_remove(&sink->entry);
|
2023-09-05 08:37:04 +00:00
|
|
|
free(sink);
|
2017-04-18 19:40:38 +00:00
|
|
|
|
2018-06-13 18:11:20 +00:00
|
|
|
LeaveCriticalSection(&impl->notification_sink_critical_section);
|
2017-04-18 19:40:38 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-13 18:11:20 +00:00
|
|
|
LeaveCriticalSection(&impl->notification_sink_critical_section);
|
|
|
|
|
2017-04-18 19:40:38 +00:00
|
|
|
/* Notification sink is not registered */
|
|
|
|
return E_FAIL;
|
2017-04-06 21:19:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IWSDiscoveryPublisherImpl_Publish(IWSDiscoveryPublisher *This, LPCWSTR pszId, ULONGLONG ullMetadataVersion, ULONGLONG ullInstanceId,
|
|
|
|
ULONGLONG ullMessageNumber, LPCWSTR pszSessionId, const WSD_NAME_LIST *pTypesList,
|
|
|
|
const WSD_URI_LIST *pScopesList, const WSD_URI_LIST *pXAddrsList)
|
|
|
|
{
|
2018-03-19 21:46:08 +00:00
|
|
|
return IWSDiscoveryPublisher_PublishEx(This, pszId, ullMetadataVersion, ullInstanceId, ullMessageNumber,
|
|
|
|
pszSessionId, pTypesList, pScopesList, pXAddrsList, NULL, NULL, NULL, NULL, NULL);
|
2017-04-06 21:19:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IWSDiscoveryPublisherImpl_UnPublish(IWSDiscoveryPublisher *This, LPCWSTR pszId, ULONGLONG ullInstanceId, ULONGLONG ullMessageNumber,
|
|
|
|
LPCWSTR pszSessionId, const WSDXML_ELEMENT *pAny)
|
|
|
|
{
|
2018-04-26 22:35:59 +00:00
|
|
|
IWSDiscoveryPublisherImpl *impl = impl_from_IWSDiscoveryPublisher(This);
|
|
|
|
|
|
|
|
TRACE("(%p, %s, %s, %s, %s, %p)\n", This, debugstr_w(pszId), wine_dbgstr_longlong(ullInstanceId),
|
|
|
|
wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId), pAny);
|
|
|
|
|
|
|
|
if ((!impl->publisherStarted) || (pszId == NULL) || (lstrlenW(pszId) > WSD_MAX_TEXT_LENGTH) ||
|
|
|
|
((pszSessionId != NULL) && (lstrlenW(pszSessionId) > WSD_MAX_TEXT_LENGTH)))
|
|
|
|
{
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
2017-04-06 21:19:39 +00:00
|
|
|
|
2018-04-26 22:35:59 +00:00
|
|
|
return send_bye_message(impl, pszId, ullInstanceId, ullMessageNumber, pszSessionId, pAny);
|
2017-04-06 21:19:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchProbe(IWSDiscoveryPublisher *This, const WSD_SOAP_MESSAGE *pProbeMessage,
|
|
|
|
IWSDMessageParameters *pMessageParameters, LPCWSTR pszId, ULONGLONG ullMetadataVersion,
|
|
|
|
ULONGLONG ullInstanceId, ULONGLONG ullMessageNumber, LPCWSTR pszSessionId,
|
|
|
|
const WSD_NAME_LIST *pTypesList, const WSD_URI_LIST *pScopesList,
|
|
|
|
const WSD_URI_LIST *pXAddrsList)
|
|
|
|
{
|
2018-09-19 20:29:07 +00:00
|
|
|
TRACE("(%p, %p, %p, %s, %s, %s, %s, %s, %p, %p, %p)\n", This, pProbeMessage, pMessageParameters, debugstr_w(pszId),
|
2017-04-06 21:19:39 +00:00
|
|
|
wine_dbgstr_longlong(ullMetadataVersion), wine_dbgstr_longlong(ullInstanceId), wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId),
|
|
|
|
pTypesList, pScopesList, pXAddrsList);
|
|
|
|
|
2018-09-19 20:29:07 +00:00
|
|
|
return IWSDiscoveryPublisher_MatchProbeEx(This, pProbeMessage, pMessageParameters, pszId, ullMetadataVersion,
|
|
|
|
ullInstanceId, ullMessageNumber, pszSessionId, pTypesList, pScopesList, pXAddrsList, NULL, NULL, NULL, NULL,
|
|
|
|
NULL);
|
2017-04-06 21:19:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchResolve(IWSDiscoveryPublisher *This, const WSD_SOAP_MESSAGE *pResolveMessage,
|
|
|
|
IWSDMessageParameters *pMessageParameters, LPCWSTR pszId, ULONGLONG ullMetadataVersion,
|
|
|
|
ULONGLONG ullInstanceId, ULONGLONG ullMessageNumber, LPCWSTR pszSessionId,
|
|
|
|
const WSD_NAME_LIST *pTypesList, const WSD_URI_LIST *pScopesList,
|
|
|
|
const WSD_URI_LIST *pXAddrsList)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p, %p, %s, %s, %s, %s, %s, %p, %p, %p)\n", This, pResolveMessage, pMessageParameters, debugstr_w(pszId),
|
|
|
|
wine_dbgstr_longlong(ullMetadataVersion), wine_dbgstr_longlong(ullInstanceId), wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId),
|
|
|
|
pTypesList, pScopesList, pXAddrsList);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IWSDiscoveryPublisherImpl_PublishEx(IWSDiscoveryPublisher *This, LPCWSTR pszId, ULONGLONG ullMetadataVersion,
|
|
|
|
ULONGLONG ullInstanceId, ULONGLONG ullMessageNumber, LPCWSTR pszSessionId,
|
|
|
|
const WSD_NAME_LIST *pTypesList, const WSD_URI_LIST *pScopesList,
|
|
|
|
const WSD_URI_LIST *pXAddrsList, const WSDXML_ELEMENT *pHeaderAny,
|
|
|
|
const WSDXML_ELEMENT *pReferenceParameterAny, const WSDXML_ELEMENT *pPolicyAny,
|
|
|
|
const WSDXML_ELEMENT *pEndpointReferenceAny, const WSDXML_ELEMENT *pAny)
|
|
|
|
{
|
2018-03-19 21:46:08 +00:00
|
|
|
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),
|
2017-04-06 21:19:39 +00:00
|
|
|
wine_dbgstr_longlong(ullInstanceId), wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId), pTypesList, pScopesList, pXAddrsList,
|
|
|
|
pHeaderAny, pReferenceParameterAny, pPolicyAny, pEndpointReferenceAny, pAny);
|
|
|
|
|
2018-03-19 21:46:08 +00:00
|
|
|
if ((!impl->publisherStarted) || (pszId == NULL) || (lstrlenW(pszId) > WSD_MAX_TEXT_LENGTH) ||
|
|
|
|
((pszSessionId != NULL) && (lstrlenW(pszSessionId) > WSD_MAX_TEXT_LENGTH)))
|
|
|
|
{
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
2017-04-06 21:19:39 +00:00
|
|
|
|
2018-03-19 21:46:08 +00:00
|
|
|
return send_hello_message(impl, pszId, ullMetadataVersion, ullInstanceId, ullMessageNumber, pszSessionId,
|
|
|
|
pTypesList, pScopesList, pXAddrsList, pHeaderAny, pReferenceParameterAny, pEndpointReferenceAny, pAny);
|
|
|
|
}
|
2017-04-06 21:19:39 +00:00
|
|
|
|
2018-09-19 20:29:07 +00:00
|
|
|
static BOOL is_name_in_list(WSDXML_NAME *name, const WSD_NAME_LIST *list)
|
|
|
|
{
|
|
|
|
const WSD_NAME_LIST *next = list;
|
|
|
|
|
|
|
|
while (next != NULL)
|
|
|
|
{
|
|
|
|
if ((lstrcmpW(next->Element->LocalName, name->LocalName) == 0) &&
|
|
|
|
(lstrcmpW(next->Element->Space->PreferredPrefix, name->Space->PreferredPrefix) == 0))
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
next = next->Next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-04-06 21:19:39 +00:00
|
|
|
static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchProbeEx(IWSDiscoveryPublisher *This, const WSD_SOAP_MESSAGE *pProbeMessage,
|
|
|
|
IWSDMessageParameters *pMessageParameters, LPCWSTR pszId, ULONGLONG ullMetadataVersion,
|
|
|
|
ULONGLONG ullInstanceId, ULONGLONG ullMessageNumber, LPCWSTR pszSessionId,
|
|
|
|
const WSD_NAME_LIST *pTypesList, const WSD_URI_LIST *pScopesList,
|
|
|
|
const WSD_URI_LIST *pXAddrsList, const WSDXML_ELEMENT *pHeaderAny,
|
|
|
|
const WSDXML_ELEMENT *pReferenceParameterAny, const WSDXML_ELEMENT *pPolicyAny,
|
|
|
|
const WSDXML_ELEMENT *pEndpointReferenceAny, const WSDXML_ELEMENT *pAny)
|
|
|
|
{
|
2018-09-19 20:29:07 +00:00
|
|
|
IWSDiscoveryPublisherImpl *impl = impl_from_IWSDiscoveryPublisher(This);
|
|
|
|
WSD_NAME_LIST *next_name;
|
|
|
|
WSD_PROBE *probe_msg;
|
|
|
|
|
|
|
|
TRACE("(%p, %p, %p, %s, %s, %s, %s, %s, %p, %p, %p, %p, %p, %p, %p, %p)\n", This, pProbeMessage, pMessageParameters, debugstr_w(pszId),
|
2017-04-06 21:19:39 +00:00
|
|
|
wine_dbgstr_longlong(ullMetadataVersion), wine_dbgstr_longlong(ullInstanceId), wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId),
|
|
|
|
pTypesList, pScopesList, pXAddrsList, pHeaderAny, pReferenceParameterAny, pPolicyAny, pEndpointReferenceAny, pAny);
|
|
|
|
|
2018-09-19 20:29:07 +00:00
|
|
|
if (!impl->publisherStarted) return E_ABORT;
|
|
|
|
|
|
|
|
if ((pszId == NULL) || (lstrlenW(pszId) > WSD_MAX_TEXT_LENGTH) ||
|
|
|
|
((pszSessionId != NULL) && (lstrlenW(pszSessionId) > WSD_MAX_TEXT_LENGTH)) || (pProbeMessage == NULL) ||
|
|
|
|
(pProbeMessage->Body == NULL))
|
|
|
|
{
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
probe_msg = (WSD_PROBE *) pProbeMessage->Body;
|
|
|
|
next_name = probe_msg->Types;
|
|
|
|
|
|
|
|
/* Verify that all names in the probe message are present in the types list */
|
|
|
|
while (next_name != NULL)
|
|
|
|
{
|
|
|
|
/* If a name isn't present, return success; we simply don't send a Probe Match message */
|
|
|
|
if (!is_name_in_list(next_name->Element, pTypesList)) return S_OK;
|
|
|
|
|
|
|
|
next_name = next_name->Next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((probe_msg->Scopes != NULL) && (probe_msg->Scopes->Scopes != NULL))
|
|
|
|
FIXME("Scopes matching currently unimplemented\n");
|
|
|
|
|
|
|
|
return send_probe_matches_message(impl, pProbeMessage, pMessageParameters, pszId, ullMetadataVersion, ullInstanceId,
|
|
|
|
ullMessageNumber, pszSessionId, pTypesList, pScopesList, pXAddrsList, pHeaderAny, pReferenceParameterAny,
|
|
|
|
pEndpointReferenceAny, pAny);
|
2017-04-06 21:19:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchResolveEx(IWSDiscoveryPublisher *This, const WSD_SOAP_MESSAGE *pResolveMessage,
|
|
|
|
IWSDMessageParameters *pMessageParameters, LPCWSTR pszId, ULONGLONG ullMetadataVersion,
|
|
|
|
ULONGLONG ullInstanceId, ULONGLONG ullMessageNumber, LPCWSTR pszSessionId,
|
|
|
|
const WSD_NAME_LIST *pTypesList, const WSD_URI_LIST *pScopesList,
|
|
|
|
const WSD_URI_LIST *pXAddrsList, const WSDXML_ELEMENT *pHeaderAny,
|
|
|
|
const WSDXML_ELEMENT *pReferenceParameterAny, const WSDXML_ELEMENT *pPolicyAny,
|
|
|
|
const WSDXML_ELEMENT *pEndpointReferenceAny, const WSDXML_ELEMENT *pAny)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p, %p, %s, %s, %s, %s, %s, %p, %p, %p, %p, %p, %p, %p, %p)\n", This, pResolveMessage, pMessageParameters, 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IWSDiscoveryPublisherImpl_RegisterScopeMatchingRule(IWSDiscoveryPublisher *This, IWSDScopeMatchingRule *pScopeMatchingRule)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p)\n", This, pScopeMatchingRule);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IWSDiscoveryPublisherImpl_UnRegisterScopeMatchingRule(IWSDiscoveryPublisher *This, IWSDScopeMatchingRule *pScopeMatchingRule)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p)\n", This, pScopeMatchingRule);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IWSDiscoveryPublisherImpl_GetXMLContext(IWSDiscoveryPublisher *This, IWSDXMLContext **ppContext)
|
|
|
|
{
|
|
|
|
IWSDiscoveryPublisherImpl *impl = impl_from_IWSDiscoveryPublisher(This);
|
|
|
|
|
|
|
|
TRACE("%p, %p)\n", This, ppContext);
|
|
|
|
|
|
|
|
if (ppContext == NULL)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (impl->xmlContext != NULL)
|
|
|
|
{
|
|
|
|
IWSDXMLContext_AddRef(impl->xmlContext);
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppContext = impl->xmlContext;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IWSDiscoveryPublisherVtbl publisher_vtbl =
|
|
|
|
{
|
|
|
|
IWSDiscoveryPublisherImpl_QueryInterface,
|
|
|
|
IWSDiscoveryPublisherImpl_AddRef,
|
|
|
|
IWSDiscoveryPublisherImpl_Release,
|
|
|
|
IWSDiscoveryPublisherImpl_SetAddressFamily,
|
|
|
|
IWSDiscoveryPublisherImpl_RegisterNotificationSink,
|
|
|
|
IWSDiscoveryPublisherImpl_UnRegisterNotificationSink,
|
|
|
|
IWSDiscoveryPublisherImpl_Publish,
|
|
|
|
IWSDiscoveryPublisherImpl_UnPublish,
|
|
|
|
IWSDiscoveryPublisherImpl_MatchProbe,
|
|
|
|
IWSDiscoveryPublisherImpl_MatchResolve,
|
|
|
|
IWSDiscoveryPublisherImpl_PublishEx,
|
|
|
|
IWSDiscoveryPublisherImpl_MatchProbeEx,
|
|
|
|
IWSDiscoveryPublisherImpl_MatchResolveEx,
|
|
|
|
IWSDiscoveryPublisherImpl_RegisterScopeMatchingRule,
|
|
|
|
IWSDiscoveryPublisherImpl_UnRegisterScopeMatchingRule,
|
|
|
|
IWSDiscoveryPublisherImpl_GetXMLContext
|
|
|
|
};
|
|
|
|
|
|
|
|
HRESULT WINAPI WSDCreateDiscoveryPublisher(IWSDXMLContext *pContext, IWSDiscoveryPublisher **ppPublisher)
|
|
|
|
{
|
|
|
|
IWSDiscoveryPublisherImpl *obj;
|
2018-04-17 22:04:40 +00:00
|
|
|
HRESULT ret;
|
2017-04-06 21:19:39 +00:00
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", pContext, ppPublisher);
|
|
|
|
|
|
|
|
if (ppPublisher == NULL)
|
|
|
|
{
|
|
|
|
WARN("Invalid parameter: ppPublisher == NULL\n");
|
|
|
|
return E_POINTER;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppPublisher = NULL;
|
|
|
|
|
2023-09-05 08:37:04 +00:00
|
|
|
obj = calloc(1, sizeof(*obj));
|
2017-04-06 21:19:39 +00:00
|
|
|
|
|
|
|
if (!obj)
|
|
|
|
{
|
|
|
|
WARN("Out of memory\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
obj->IWSDiscoveryPublisher_iface.lpVtbl = &publisher_vtbl;
|
|
|
|
obj->ref = 1;
|
|
|
|
|
2017-05-30 22:05:56 +00:00
|
|
|
if (pContext == NULL)
|
2017-04-06 21:19:39 +00:00
|
|
|
{
|
2018-04-17 22:04:40 +00:00
|
|
|
ret = WSDXMLCreateContext(&obj->xmlContext);
|
|
|
|
|
|
|
|
if (FAILED(ret))
|
2017-05-30 22:05:56 +00:00
|
|
|
{
|
|
|
|
WARN("Unable to create XML context\n");
|
2023-09-05 08:37:04 +00:00
|
|
|
free(obj);
|
2018-04-17 22:04:40 +00:00
|
|
|
return ret;
|
2017-05-30 22:05:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
obj->xmlContext = pContext;
|
2017-04-06 21:19:39 +00:00
|
|
|
IWSDXMLContext_AddRef(pContext);
|
|
|
|
}
|
|
|
|
|
2018-04-17 22:04:40 +00:00
|
|
|
ret = register_namespaces(obj->xmlContext);
|
|
|
|
|
|
|
|
if (FAILED(ret))
|
|
|
|
{
|
|
|
|
WARN("Unable to register default namespaces\n");
|
2023-09-05 08:37:04 +00:00
|
|
|
free(obj);
|
2018-04-17 22:04:40 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-06-13 18:11:20 +00:00
|
|
|
InitializeCriticalSection(&obj->notification_sink_critical_section);
|
2017-04-18 19:40:38 +00:00
|
|
|
list_init(&obj->notificationSinks);
|
|
|
|
|
2018-09-19 20:29:05 +00:00
|
|
|
InitializeCriticalSection(&obj->message_ids_critical_section);
|
|
|
|
list_init(&obj->message_ids);
|
|
|
|
|
2017-04-06 21:19:39 +00:00
|
|
|
*ppPublisher = &obj->IWSDiscoveryPublisher_iface;
|
|
|
|
TRACE("Returning iface %p\n", *ppPublisher);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2021-12-07 18:22:03 +00:00
|
|
|
|
|
|
|
HRESULT WINAPI WSDCreateDiscoveryProvider(IWSDXMLContext *context, IWSDiscoveryProvider **provider)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p) stub\n", context, provider);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|