wsdapi: Implement matching of names in MatchProbeEx.

Signed-off-by: Owen Rudge <orudge@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Owen Rudge 2018-09-19 21:29:07 +01:00 committed by Alexandre Julliard
parent 1a82fb88b2
commit 2d1371001e
3 changed files with 69 additions and 4 deletions

View File

@ -233,11 +233,13 @@ static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchProbe(IWSDiscoveryPublisher
const WSD_NAME_LIST *pTypesList, const WSD_URI_LIST *pScopesList, const WSD_NAME_LIST *pTypesList, const WSD_URI_LIST *pScopesList,
const WSD_URI_LIST *pXAddrsList) const WSD_URI_LIST *pXAddrsList)
{ {
FIXME("(%p, %p, %p, %s, %s, %s, %s, %s, %p, %p, %p)\n", This, pProbeMessage, pMessageParameters, debugstr_w(pszId), TRACE("(%p, %p, %p, %s, %s, %s, %s, %s, %p, %p, %p)\n", This, pProbeMessage, pMessageParameters, debugstr_w(pszId),
wine_dbgstr_longlong(ullMetadataVersion), wine_dbgstr_longlong(ullInstanceId), wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId), wine_dbgstr_longlong(ullMetadataVersion), wine_dbgstr_longlong(ullInstanceId), wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId),
pTypesList, pScopesList, pXAddrsList); pTypesList, pScopesList, pXAddrsList);
return E_NOTIMPL; return IWSDiscoveryPublisher_MatchProbeEx(This, pProbeMessage, pMessageParameters, pszId, ullMetadataVersion,
ullInstanceId, ullMessageNumber, pszSessionId, pTypesList, pScopesList, pXAddrsList, NULL, NULL, NULL, NULL,
NULL);
} }
static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchResolve(IWSDiscoveryPublisher *This, const WSD_SOAP_MESSAGE *pResolveMessage, static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchResolve(IWSDiscoveryPublisher *This, const WSD_SOAP_MESSAGE *pResolveMessage,
@ -276,6 +278,24 @@ static HRESULT WINAPI IWSDiscoveryPublisherImpl_PublishEx(IWSDiscoveryPublisher
pTypesList, pScopesList, pXAddrsList, pHeaderAny, pReferenceParameterAny, pEndpointReferenceAny, pAny); pTypesList, pScopesList, pXAddrsList, pHeaderAny, pReferenceParameterAny, pEndpointReferenceAny, pAny);
} }
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;
}
static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchProbeEx(IWSDiscoveryPublisher *This, const WSD_SOAP_MESSAGE *pProbeMessage, static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchProbeEx(IWSDiscoveryPublisher *This, const WSD_SOAP_MESSAGE *pProbeMessage,
IWSDMessageParameters *pMessageParameters, LPCWSTR pszId, ULONGLONG ullMetadataVersion, IWSDMessageParameters *pMessageParameters, LPCWSTR pszId, ULONGLONG ullMetadataVersion,
ULONGLONG ullInstanceId, ULONGLONG ullMessageNumber, LPCWSTR pszSessionId, ULONGLONG ullInstanceId, ULONGLONG ullMessageNumber, LPCWSTR pszSessionId,
@ -284,11 +304,41 @@ static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchProbeEx(IWSDiscoveryPublish
const WSDXML_ELEMENT *pReferenceParameterAny, const WSDXML_ELEMENT *pPolicyAny, const WSDXML_ELEMENT *pReferenceParameterAny, const WSDXML_ELEMENT *pPolicyAny,
const WSDXML_ELEMENT *pEndpointReferenceAny, const WSDXML_ELEMENT *pAny) 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, pProbeMessage, pMessageParameters, debugstr_w(pszId), 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),
wine_dbgstr_longlong(ullMetadataVersion), wine_dbgstr_longlong(ullInstanceId), wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId), wine_dbgstr_longlong(ullMetadataVersion), wine_dbgstr_longlong(ullInstanceId), wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId),
pTypesList, pScopesList, pXAddrsList, pHeaderAny, pReferenceParameterAny, pPolicyAny, pEndpointReferenceAny, pAny); pTypesList, pScopesList, pXAddrsList, pHeaderAny, pReferenceParameterAny, pPolicyAny, pEndpointReferenceAny, pAny);
return E_NOTIMPL; 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);
} }
static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchResolveEx(IWSDiscoveryPublisher *This, const WSD_SOAP_MESSAGE *pResolveMessage, static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchResolveEx(IWSDiscoveryPublisher *This, const WSD_SOAP_MESSAGE *pResolveMessage,

View File

@ -1110,6 +1110,15 @@ cleanup:
return ret; return ret;
} }
HRESULT send_probe_matches_message(IWSDiscoveryPublisherImpl *impl, const WSD_SOAP_MESSAGE *probe_msg,
IWSDMessageParameters *message_params, 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 *header_any, const WSDXML_ELEMENT *ref_param_any,
const WSDXML_ELEMENT *endpoint_ref_any, const WSDXML_ELEMENT *any)
{
return E_NOTIMPL;
}
static LPWSTR xml_text_to_wide_string(void *parent_memory, WS_XML_TEXT *text) static LPWSTR xml_text_to_wide_string(void *parent_memory, WS_XML_TEXT *text)
{ {
if (text->textType == WS_XML_TEXT_TYPE_UTF8) if (text->textType == WS_XML_TEXT_TYPE_UTF8)

View File

@ -78,6 +78,12 @@ HRESULT send_hello_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id, ULONGLON
HRESULT send_bye_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id, ULONGLONG instance_id, ULONGLONG msg_num, HRESULT send_bye_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id, ULONGLONG instance_id, ULONGLONG msg_num,
LPCWSTR session_id, const WSDXML_ELEMENT *any); LPCWSTR session_id, const WSDXML_ELEMENT *any);
HRESULT send_probe_matches_message(IWSDiscoveryPublisherImpl *impl, const WSD_SOAP_MESSAGE *probe_msg,
IWSDMessageParameters *message_params, 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 *header_any, const WSDXML_ELEMENT *ref_param_any,
const WSDXML_ELEMENT *endpoint_ref_any, const WSDXML_ELEMENT *any);
HRESULT register_namespaces(IWSDXMLContext *xml_context); HRESULT register_namespaces(IWSDXMLContext *xml_context);
HRESULT read_message(IWSDiscoveryPublisherImpl *impl, const char *xml, int xml_length, WSD_SOAP_MESSAGE **out_msg, HRESULT read_message(IWSDiscoveryPublisherImpl *impl, const char *xml, int xml_length, WSD_SOAP_MESSAGE **out_msg,