[PATCH 3/4] wsdapi: Add stub for Probe message parsing, prepare notification sink message.

Huw Davies huw at codeweavers.com
Thu Jun 7 02:45:28 CDT 2018


On Wed, Jun 06, 2018 at 09:58:49PM +0100, Owen Rudge wrote:
> Signed-off-by: Owen Rudge <orudge at codeweavers.com>
> ---
>  dlls/wsdapi/network.c         | 52
> ++++++++++++++++++++++++++++++++++++++++++-
>  dlls/wsdapi/soap.c            |  6 +++++
>  dlls/wsdapi/wsdapi_internal.h |  5 +++++
>  3 files changed, 62 insertions(+), 1 deletion(-)
> 
> 

> diff --git a/dlls/wsdapi/network.c b/dlls/wsdapi/network.c
> index 3e7509bfa3..7f6cee3ab0 100644
> --- a/dlls/wsdapi/network.c
> +++ b/dlls/wsdapi/network.c
> @@ -292,6 +292,56 @@ typedef struct listener_thread_params
>      BOOL ipv6;
>  } listener_thread_params;
>  
> +static void process_received_message(listener_thread_params *params, char *message, int message_len,
> +    SOCKADDR_STORAGE *source_addr)

This should return HRESULT.

> +{
> +    IWSDUdpMessageParameters *msg_params = NULL;
> +    IWSDUdpAddress *remote_addr = NULL;
> +    struct notificationSink *sink;
> +    WSD_SOAP_MESSAGE *msg = NULL;
> +    int msg_type;
> +
> +    msg_type = read_message(message, message_len, &msg);
> +
> +    switch (msg_type)
> +    {
> +        case MSGTYPE_PROBE:
> +            TRACE("Received probe message\n");
> +
> +            if (FAILED(WSDCreateUdpMessageParameters(&msg_params)))
> +            {
> +                ERR("Unable to create IWSDUdpMessageParameters, not processing message.\n");
> +                goto cleanup;
> +            }
> +
> +            if (FAILED(WSDCreateUdpAddress(&remote_addr)))
> +            {
> +                ERR("Unable to create IWSDUdpAddress, not processing message.\n");
> +                goto cleanup;
> +            }
> +
> +            IWSDUdpAddress_SetSockaddr(remote_addr, source_addr);
> +            IWSDUdpMessageParameters_SetRemoteAddress(msg_params, (IWSDAddress *)remote_addr);
> +
> +            EnterCriticalSection(&params->impl->notification_sink_critical_section);
> +
> +            LIST_FOR_EACH_ENTRY(sink, &params->impl->notificationSinks, struct notificationSink, entry)
> +            {
> +                IWSDiscoveryPublisherNotify_ProbeHandler(sink->notificationSink, msg, (IWSDMessageParameters *)msg_params);
> +            }
> +
> +            LeaveCriticalSection(&params->impl->notification_sink_critical_section);
> +
> +            break;
> +    }
> +
> +cleanup:
> +    WSDFreeLinkedMemory(msg);
> +
> +    if (remote_addr != NULL) IWSDUdpAddress_Release(remote_addr);
> +    if (msg_params != NULL) IWSDUdpMessageParameters_Release(msg_params);
> +}
> +
>  #define RECEIVE_BUFFER_SIZE        65536
>  
>  static DWORD WINAPI listening_thread(LPVOID params)
> @@ -321,7 +371,7 @@ static DWORD WINAPI listening_thread(LPVOID params)
>          }
>          else
>          {
> -            /* TODO: Process received message */
> +            process_received_message(parameter, buffer, bytes_received, &source_addr);
>          }
>      }
>  
> diff --git a/dlls/wsdapi/soap.c b/dlls/wsdapi/soap.c
> index d0fb0afb0c..4e191a5c82 100644
> --- a/dlls/wsdapi/soap.c
> +++ b/dlls/wsdapi/soap.c
> @@ -1080,3 +1080,9 @@ cleanup:
>  
>      return ret;
>  }
> +
> +int read_message(const char *xml, int xml_length, WSD_SOAP_MESSAGE **out_msg)
> +{
> +    /* TODO: Parse and read message */
> +    return MSGTYPE_UNKNOWN;
> +}
> diff --git a/dlls/wsdapi/wsdapi_internal.h b/dlls/wsdapi/wsdapi_internal.h
> index 3e5e163f3a..5c62627bba 100644
> --- a/dlls/wsdapi/wsdapi_internal.h
> +++ b/dlls/wsdapi/wsdapi_internal.h
> @@ -72,6 +72,11 @@ HRESULT send_bye_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id, ULONGLONG
>  
>  HRESULT register_namespaces(IWSDXMLContext *xml_context);
>  
> +int read_message(const char *xml, int xml_length, WSD_SOAP_MESSAGE **out_msg);
> +
> +#define MSGTYPE_UNKNOWN     0
> +#define MSGTYPE_PROBE       1
> +
>  /* xml.c */
>  
>  LPWSTR duplicate_string(void *parentMemoryBlock, LPCWSTR value);
> 

> 




More information about the wine-devel mailing list