drdynvc: add missing messages definitions

This commit is contained in:
David Fort
2022-03-07 13:40:09 +01:00
committed by akallabeth
parent fa3cf9417f
commit 6a3b5573ad
2 changed files with 82 additions and 34 deletions

View File

@@ -27,13 +27,32 @@
#define DRDYNVC_SVC_CHANNEL_NAME "drdynvc"
/* defined in MS-RDPEDYC 2.2.5.1 Soft-Sync Request PDU (DYNVC_SOFT_SYNC_REQUEST) */
enum
{
SOFT_SYNC_TCP_FLUSHED = 0x01,
SOFT_SYNC_CHANNEL_LIST_PRESENT = 0x02
};
/* define in MS-RDPEDYC 2.2.5.1.1 Soft-Sync Channel List (DYNVC_SOFT_SYNC_CHANNEL_LIST) */
enum
{
TUNNELTYPE_UDPFECR = 0x00000001,
TUNNELTYPE_UDPFECL = 0x00000003
};
/* @brief dynamic channel commands */
typedef enum
{
CREATE_REQUEST_PDU = 0x01,
DATA_FIRST_PDU = 0x02,
DATA_PDU = 0x03,
CLOSE_REQUEST_PDU = 0x04,
CAPABILITY_REQUEST_PDU = 0x05
CAPABILITY_REQUEST_PDU = 0x05,
DATA_FIRST_COMPRESSED_PDU = 0x06,
DATA_COMPRESSED_PDU = 0x07,
SOFT_SYNC_REQUEST_PDU = 0x08,
SOFT_SYNC_RESPONSE_PDU = 0x09
} DynamicChannelPDU;
#endif /* FREERDP_CHANNEL_DRDYNVC_H */

View File

@@ -139,12 +139,16 @@ static int wts_read_variable_uint(wStream* s, int cbLen, UINT32* val)
Stream_Read_UINT16(s, *val);
return 2;
default:
case 2:
if (Stream_GetRemainingLength(s) < 4)
return 0;
Stream_Read_UINT32(s, *val);
return 4;
default:
WLog_ERR(TAG, "invalid wts variable uint len %d", cbLen);
return 0;
}
}
@@ -283,45 +287,70 @@ static BOOL wts_read_drdynvc_pdu(rdpPeerChannel* channel)
cbChId = (value & 0x03) >> 0;
if (Cmd == CAPABILITY_REQUEST_PDU)
{
return wts_read_drdynvc_capabilities_response(channel, length);
}
else if (channel->vcm->drdynvc_state == DRDYNVC_STATE_READY)
if (channel->vcm->drdynvc_state == DRDYNVC_STATE_READY)
{
value = wts_read_variable_uint(channel->receiveData, cbChId, &ChannelId);
if (value == 0)
return FALSE;
length -= value;
DEBUG_DVC("Cmd %d ChannelId %" PRIu32 " length %" PRIu32 "", Cmd, ChannelId, length);
dvc = wts_get_dvc_channel_by_id(channel->vcm, ChannelId);
if (dvc)
BOOL haveChannelId;
switch (Cmd)
{
switch (Cmd)
case SOFT_SYNC_REQUEST_PDU:
case SOFT_SYNC_RESPONSE_PDU:
haveChannelId = FALSE;
break;
default:
haveChannelId = TRUE;
break;
}
if (haveChannelId)
{
value = wts_read_variable_uint(channel->receiveData, cbChId, &ChannelId);
if (value == 0)
return FALSE;
length -= value;
DEBUG_DVC("Cmd %d ChannelId %" PRIu32 " length %" PRIu32 "", Cmd, ChannelId, length);
dvc = wts_get_dvc_channel_by_id(channel->vcm, ChannelId);
if (!dvc)
{
case CREATE_REQUEST_PDU:
return wts_read_drdynvc_create_response(dvc, channel->receiveData, length);
case DATA_FIRST_PDU:
return wts_read_drdynvc_data_first(dvc, channel->receiveData, Sp, length);
case DATA_PDU:
return wts_read_drdynvc_data(dvc, channel->receiveData, length);
case CLOSE_REQUEST_PDU:
wts_read_drdynvc_close_response(dvc);
break;
default:
WLog_ERR(TAG, "Cmd %d not recognized.", Cmd);
break;
DEBUG_DVC("ChannelId %" PRIu32 " not exists.", ChannelId);
return TRUE;
}
}
else
switch (Cmd)
{
DEBUG_DVC("ChannelId %" PRIu32 " not exists.", ChannelId);
case CREATE_REQUEST_PDU:
return wts_read_drdynvc_create_response(dvc, channel->receiveData, length);
case DATA_FIRST_PDU:
return wts_read_drdynvc_data_first(dvc, channel->receiveData, Sp, length);
case DATA_PDU:
return wts_read_drdynvc_data(dvc, channel->receiveData, length);
case CLOSE_REQUEST_PDU:
wts_read_drdynvc_close_response(dvc);
break;
case DATA_FIRST_COMPRESSED_PDU:
case DATA_COMPRESSED_PDU:
WLog_ERR(TAG, "Compressed data not handled");
break;
case SOFT_SYNC_RESPONSE_PDU:
WLog_ERR(TAG, "SoftSync response not handled yet(and rather strange to receive that packet as our code doesn't send SoftSync requests");
break;
case SOFT_SYNC_REQUEST_PDU:
WLog_ERR(TAG, "Not expecting a SoftSyncRequest on the server");
return FALSE;
default:
WLog_ERR(TAG, "Cmd %d not recognized.", Cmd);
break;
}
}
else