Commit 4373eb30 authored by Owen Rudge's avatar Owen Rudge Committed by Alexandre Julliard

wsdapi: Implement Get/SetRetransmitParams.

parent 7b3024a2
......@@ -38,6 +38,7 @@ typedef struct IWSDMessageParametersImpl {
typedef struct IWSDUdpMessageParametersImpl {
IWSDMessageParametersImpl base;
WSDUdpRetransmitParams retransmitParams;
} IWSDUdpMessageParametersImpl;
static inline IWSDMessageParametersImpl *impl_from_IWSDMessageParameters(IWSDMessageParameters *iface)
......@@ -248,14 +249,32 @@ static HRESULT WINAPI IWSDUdpMessageParametersImpl_GetLowerParameters(IWSDUdpMes
static HRESULT WINAPI IWSDUdpMessageParametersImpl_SetRetransmitParams(IWSDUdpMessageParameters *This, const WSDUdpRetransmitParams *pParams)
{
FIXME("(%p, %p)\n", This, pParams);
return E_NOTIMPL;
IWSDUdpMessageParametersImpl *impl = impl_from_IWSDUdpMessageParameters(This);
TRACE("(%p, %p)\n", impl, pParams);
if (pParams == NULL)
{
return E_INVALIDARG;
}
impl->retransmitParams = *pParams;
return S_OK;
}
static HRESULT WINAPI IWSDUdpMessageParametersImpl_GetRetransmitParams(IWSDUdpMessageParameters *This, WSDUdpRetransmitParams *pParams)
{
FIXME("(%p, %p)\n", This, pParams);
return E_NOTIMPL;
IWSDUdpMessageParametersImpl *impl = impl_from_IWSDUdpMessageParameters(This);
TRACE("(%p, %p)\n", impl, pParams);
if (pParams == NULL)
{
return E_POINTER;
}
* pParams = impl->retransmitParams;
return S_OK;
}
static const IWSDUdpMessageParametersVtbl udpMsgParamsVtbl =
......@@ -297,6 +316,13 @@ HRESULT WINAPI WSDCreateUdpMessageParameters(IWSDUdpMessageParameters **ppTxPara
obj->base.IWSDMessageParameters_iface.lpVtbl = (IWSDMessageParametersVtbl *)&udpMsgParamsVtbl;
obj->base.ref = 1;
/* Populate default retransmit parameters */
obj->retransmitParams.ulSendDelay = 0;
obj->retransmitParams.ulRepeat = 1;
obj->retransmitParams.ulRepeatMinDelay = 50;
obj->retransmitParams.ulRepeatMaxDelay = 250;
obj->retransmitParams.ulRepeatUpperDelay = 450;
*ppTxParams = (IWSDUdpMessageParameters *)&obj->base.IWSDMessageParameters_iface;
TRACE("Returning iface %p\n", *ppTxParams);
......
......@@ -197,17 +197,17 @@ static void RetransmitParams_tests(void)
ok(udpMessageParams != NULL, "WSDCreateUdpMessageParameters(NULL, &udpMessageParams) failed: udpMessageParams == NULL\n");
rc = IWSDUdpMessageParameters_GetRetransmitParams(udpMessageParams, NULL);
todo_wine ok(rc == E_POINTER, "GetRetransmitParams returned unexpected result: %08x\n", rc);
ok(rc == E_POINTER, "GetRetransmitParams returned unexpected result: %08x\n", rc);
/* Check if the default values are returned */
rc = IWSDUdpMessageParameters_GetRetransmitParams(udpMessageParams, &returnedParams);
todo_wine ok(rc == S_OK, "GetRetransmitParams failed: %08x\n", rc);
ok(rc == S_OK, "GetRetransmitParams failed: %08x\n", rc);
ok(returnedParams.ulSendDelay == 0, "ulSendDelay = %d\n", returnedParams.ulSendDelay);
todo_wine ok(returnedParams.ulRepeat == 1, "ulRepeat = %d\n", returnedParams.ulRepeat);
todo_wine ok(returnedParams.ulRepeatMinDelay == 50, "ulRepeatMinDelay = %d\n", returnedParams.ulRepeatMinDelay);
todo_wine ok(returnedParams.ulRepeatMaxDelay == 250, "ulRepeatMaxDelay = %d\n", returnedParams.ulRepeatMaxDelay);
todo_wine ok(returnedParams.ulRepeatUpperDelay == 450, "ulRepeatUpperDelay = %d\n", returnedParams.ulRepeatUpperDelay);
ok(returnedParams.ulRepeat == 1, "ulRepeat = %d\n", returnedParams.ulRepeat);
ok(returnedParams.ulRepeatMinDelay == 50, "ulRepeatMinDelay = %d\n", returnedParams.ulRepeatMinDelay);
ok(returnedParams.ulRepeatMaxDelay == 250, "ulRepeatMaxDelay = %d\n", returnedParams.ulRepeatMaxDelay);
ok(returnedParams.ulRepeatUpperDelay == 450, "ulRepeatUpperDelay = %d\n", returnedParams.ulRepeatUpperDelay);
/* Now try setting some custom parameters */
origParams.ulSendDelay = 100;
......@@ -217,18 +217,22 @@ static void RetransmitParams_tests(void)
origParams.ulRepeatUpperDelay = 500;
rc = IWSDUdpMessageParameters_SetRetransmitParams(udpMessageParams, &origParams);
todo_wine ok(rc == S_OK, "SetRetransmitParams failed: %08x\n", rc);
ok(rc == S_OK, "SetRetransmitParams failed: %08x\n", rc);
ZeroMemory(&returnedParams, sizeof(WSDUdpRetransmitParams));
rc = IWSDUdpMessageParameters_GetRetransmitParams(udpMessageParams, &returnedParams);
todo_wine ok(rc == S_OK, "GetRetransmitParams failed: %08x\n", rc);
ok(rc == S_OK, "GetRetransmitParams failed: %08x\n", rc);
todo_wine ok(origParams.ulSendDelay == returnedParams.ulSendDelay, "ulSendDelay = %d\n", returnedParams.ulSendDelay);
todo_wine ok(origParams.ulRepeat == returnedParams.ulRepeat, "ulRepeat = %d\n", returnedParams.ulRepeat);
todo_wine ok(origParams.ulRepeatMinDelay == returnedParams.ulRepeatMinDelay, "ulRepeatMinDelay = %d\n", returnedParams.ulRepeatMinDelay);
todo_wine ok(origParams.ulRepeatMaxDelay == returnedParams.ulRepeatMaxDelay, "ulRepeatMaxDelay = %d\n", returnedParams.ulRepeatMaxDelay);
todo_wine ok(origParams.ulRepeatUpperDelay == returnedParams.ulRepeatUpperDelay, "ulRepeatUpperDelay = %d\n", returnedParams.ulRepeatUpperDelay);
ok(origParams.ulSendDelay == returnedParams.ulSendDelay, "ulSendDelay = %d\n", returnedParams.ulSendDelay);
ok(origParams.ulRepeat == returnedParams.ulRepeat, "ulRepeat = %d\n", returnedParams.ulRepeat);
ok(origParams.ulRepeatMinDelay == returnedParams.ulRepeatMinDelay, "ulRepeatMinDelay = %d\n", returnedParams.ulRepeatMinDelay);
ok(origParams.ulRepeatMaxDelay == returnedParams.ulRepeatMaxDelay, "ulRepeatMaxDelay = %d\n", returnedParams.ulRepeatMaxDelay);
ok(origParams.ulRepeatUpperDelay == returnedParams.ulRepeatUpperDelay, "ulRepeatUpperDelay = %d\n", returnedParams.ulRepeatUpperDelay);
/* Try setting a null parameter */
rc = IWSDUdpMessageParameters_SetRetransmitParams(udpMessageParams, NULL);
ok(rc == E_INVALIDARG, "SetRetransmitParams returned unexpected result: %08x\n", rc);
/* Now attempt to set some invalid parameters - these appear to be accepted */
origParams.ulSendDelay = INFINITE;
......@@ -238,18 +242,18 @@ static void RetransmitParams_tests(void)
origParams.ulRepeatUpperDelay = 100;
rc = IWSDUdpMessageParameters_SetRetransmitParams(udpMessageParams, &origParams);
todo_wine ok(rc == S_OK, "SetRetransmitParams failed: %08x\n", rc);
ok(rc == S_OK, "SetRetransmitParams failed: %08x\n", rc);
ZeroMemory(&returnedParams, sizeof(WSDUdpRetransmitParams));
rc = IWSDUdpMessageParameters_GetRetransmitParams(udpMessageParams, &returnedParams);
todo_wine ok(rc == S_OK, "GetRetransmitParams failed: %08x\n", rc);
ok(rc == S_OK, "GetRetransmitParams failed: %08x\n", rc);
todo_wine ok(origParams.ulSendDelay == returnedParams.ulSendDelay, "ulSendDelay = %d\n", returnedParams.ulSendDelay);
todo_wine ok(origParams.ulRepeat == returnedParams.ulRepeat, "ulRepeat = %d\n", returnedParams.ulRepeat);
todo_wine ok(origParams.ulRepeatMinDelay == returnedParams.ulRepeatMinDelay, "ulRepeatMinDelay = %d\n", returnedParams.ulRepeatMinDelay);
todo_wine ok(origParams.ulRepeatMaxDelay == returnedParams.ulRepeatMaxDelay, "ulRepeatMaxDelay = %d\n", returnedParams.ulRepeatMaxDelay);
todo_wine ok(origParams.ulRepeatUpperDelay == returnedParams.ulRepeatUpperDelay, "ulRepeatUpperDelay = %d\n", returnedParams.ulRepeatUpperDelay);
ok(origParams.ulSendDelay == returnedParams.ulSendDelay, "ulSendDelay = %d\n", returnedParams.ulSendDelay);
ok(origParams.ulRepeat == returnedParams.ulRepeat, "ulRepeat = %d\n", returnedParams.ulRepeat);
ok(origParams.ulRepeatMinDelay == returnedParams.ulRepeatMinDelay, "ulRepeatMinDelay = %d\n", returnedParams.ulRepeatMinDelay);
ok(origParams.ulRepeatMaxDelay == returnedParams.ulRepeatMaxDelay, "ulRepeatMaxDelay = %d\n", returnedParams.ulRepeatMaxDelay);
ok(origParams.ulRepeatUpperDelay == returnedParams.ulRepeatUpperDelay, "ulRepeatUpperDelay = %d\n", returnedParams.ulRepeatUpperDelay);
ret = IWSDUdpMessageParameters_Release(udpMessageParams);
ok(ret == 0, "IWSDUdpMessageParameters_Release() has %d references, should have 0\n", ret);
......
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