Commit ed3670ee authored by Owen Rudge's avatar Owen Rudge Committed by Alexandre Julliard

wsdapi: Send Probe Matches message via UDP unicast.

parent 0ed2af4f
......@@ -558,6 +558,38 @@ cleanup:
return (ret == ERROR_SUCCESS) && (valid_listeners > 0);
}
HRESULT send_udp_unicast(char *data, int length, IWSDUdpAddress *remote_addr, int max_initial_delay)
{
SOCKADDR_STORAGE address;
HRESULT ret;
SOCKET s;
ZeroMemory(&address, sizeof(SOCKADDR_STORAGE));
ret = IWSDUdpAddress_GetSockaddr(remote_addr, &address);
if (FAILED(ret))
{
WARN("No sockaddr specified in send_udp_unicast\n");
return ret;
}
/* Create a socket and bind to the adapter address */
s = socket(address.ss_family, SOCK_DGRAM, IPPROTO_UDP);
if (s == INVALID_SOCKET)
{
int error = WSAGetLastError();
WARN("Unable to create socket: %d\n", error);
return HRESULT_FROM_WIN32(error);
}
send_message(s, data, length, &address, max_initial_delay, UNICAST_UDP_REPEAT);
closesocket(s);
return S_OK;
}
void terminate_networking(IWSDiscoveryPublisherImpl *impl)
{
BOOL needsCleanup = impl->publisherStarted;
......
......@@ -923,8 +923,8 @@ static HRESULT write_and_send_message(IWSDiscoveryPublisherImpl *impl, WSD_SOAP_
}
else
{
/* TODO: Send the message via UDP unicast */
FIXME("TODO: Send the message via UDP unicast\n");
/* Send the message via UDP unicast */
ret = send_udp_unicast(full_xml, xml_length + xml_header_len + 1, remote_address, max_initial_delay);
}
heap_free(full_xml);
......
......@@ -729,7 +729,7 @@ static HRESULT WINAPI IWSDiscoveryPublisherNotifyImpl_ProbeHandler(IWSDiscoveryP
DeleteCriticalSection(&msg_storage->criticalSection);
/* Verify we've received a message */
todo_wine ok(msg_storage->messageCount >= 1, "No messages received\n");
ok(msg_storage->messageCount >= 1, "No messages received\n");
sprintf(endpoint_reference_string, "<wsa:EndpointReference><wsa:Address>%s</wsa:Address>"
"<wsa:ReferenceParameters><wine:Beer>RefPTest</wine:Beer></wsa:ReferenceParameters>"
......@@ -767,16 +767,16 @@ static HRESULT WINAPI IWSDiscoveryPublisherNotifyImpl_ProbeHandler(IWSDiscoveryP
heap_free(msg_storage->messages[i]);
}
todo_wine ok(probe_matches_message_seen == TRUE, "Probe matches message not received\n");
todo_wine ok(endpoint_reference_seen == TRUE, "EndpointReference not received\n");
todo_wine ok(app_sequence_seen == TRUE, "AppSequence not received\n");
todo_wine ok(metadata_version_seen == TRUE, "MetadataVersion not received\n");
todo_wine ok(message_ok == TRUE, "ProbeMatches message metadata not received\n");
todo_wine ok(any_header_seen == TRUE, "Custom header not received\n");
todo_wine ok(wine_ns_seen == TRUE, "Wine namespace not received\n");
todo_wine ok(body_probe_matches_seen == TRUE, "Body and Probe Matches elements not received\n");
todo_wine ok(any_body_seen == TRUE, "Custom body element not received\n");
todo_wine ok(types_seen == TRUE, "Types not received\n");
ok(probe_matches_message_seen == TRUE, "Probe matches message not received\n");
ok(endpoint_reference_seen == TRUE, "EndpointReference not received\n");
ok(app_sequence_seen == TRUE, "AppSequence not received\n");
ok(metadata_version_seen == TRUE, "MetadataVersion not received\n");
ok(message_ok == TRUE, "ProbeMatches message metadata not received\n");
ok(any_header_seen == TRUE, "Custom header not received\n");
ok(wine_ns_seen == TRUE, "Wine namespace not received\n");
ok(body_probe_matches_seen == TRUE, "Body and Probe Matches elements not received\n");
ok(any_body_seen == TRUE, "Custom body element not received\n");
ok(types_seen == TRUE, "Types not received\n");
after_matchprobe_test:
heap_free(publisherIdW);
......
......@@ -67,6 +67,7 @@ typedef struct IWSDiscoveryPublisherImpl {
BOOL init_networking(IWSDiscoveryPublisherImpl *impl);
void terminate_networking(IWSDiscoveryPublisherImpl *impl);
BOOL send_udp_multicast(IWSDiscoveryPublisherImpl *impl, char *data, int length, int max_initial_delay);
HRESULT send_udp_unicast(char *data, int length, IWSDUdpAddress *remote_addr, int max_initial_delay);
/* soap.c */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment