libfreerdp-core: support continuous auto-detection.

This commit is contained in:
Vic Lee 2014-11-07 16:18:49 +08:00
parent 3e90412923
commit 8eaeeebecc
3 changed files with 24 additions and 1 deletions

View File

@ -43,7 +43,8 @@ struct rdp_autodetect
ALIGN64 UINT32 netCharBandwidth; /* 5 */
ALIGN64 UINT32 netCharBaseRTT; /* 6 */
ALIGN64 UINT32 netCharAverageRTT; /* 7 */
UINT64 paddingA[16 - 8]; /* 8 */
ALIGN64 BOOL bandwidthMeasureStarted; /* 8 */
UINT64 paddingA[16 - 9]; /* 9 */
ALIGN64 pRTTMeasureRequest RTTMeasureRequest; /* 16 */
ALIGN64 pRTTMeasureResponse RTTMeasureResponse; /* 17 */

View File

@ -322,6 +322,12 @@ static BOOL autodetect_recv_bandwidth_measure_start(rdpRdp* rdp, wStream* s, AUT
rdp->autodetect->bandwidthMeasureStartTime = GetTickCount();
rdp->autodetect->bandwidthMeasureByteCount = 0;
/* Continuous Auto-Detection: mark the start of the measurement */
if (autodetectReqPdu->requestType == 0x0014)
{
rdp->autodetect->bandwidthMeasureStarted = TRUE;
}
return TRUE;
}
@ -373,6 +379,12 @@ static BOOL autodetect_recv_bandwidth_measure_stop(rdpRdp* rdp, wStream* s, AUTO
/* Add the payload length to the bandwidth measurement parameters */
rdp->autodetect->bandwidthMeasureByteCount += payloadLength;
/* Continuous Auto-Detection: mark the stop of the measurement */
if (autodetectReqPdu->requestType == 0x0429)
{
rdp->autodetect->bandwidthMeasureStarted = FALSE;
}
/* Send a response the server */
responseType = autodetectReqPdu->requestType == 0x002B ? 0x0003 : 0x000B;

View File

@ -1001,6 +1001,11 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
if (rdp->disconnect)
return 0;
if (rdp->autodetect->bandwidthMeasureStarted)
{
rdp->autodetect->bandwidthMeasureByteCount += length;
}
if (rdp->settings->DisableEncryption)
{
if (!rdp_read_security_header(s, &securityFlags))
@ -1096,6 +1101,11 @@ static int rdp_recv_fastpath_pdu(rdpRdp* rdp, wStream* s)
return -1;
}
if (rdp->autodetect->bandwidthMeasureStarted)
{
rdp->autodetect->bandwidthMeasureByteCount += length;
}
if (fastpath->encryptionFlags & FASTPATH_OUTPUT_ENCRYPTED)
{
UINT16 flags = (fastpath->encryptionFlags & FASTPATH_OUTPUT_SECURE_CHECKSUM) ? SEC_SECURE_CHECKSUM : 0;