mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[core,utils] add drdynvc stringification functions
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
#include <winpr/interlocked.h>
|
#include <winpr/interlocked.h>
|
||||||
|
|
||||||
#include <freerdp/channels/drdynvc.h>
|
#include <freerdp/channels/drdynvc.h>
|
||||||
|
#include <freerdp/utils/drdynvc.h>
|
||||||
|
|
||||||
#include "drdynvc_main.h"
|
#include "drdynvc_main.h"
|
||||||
|
|
||||||
@@ -1398,8 +1399,8 @@ static UINT drdynvc_order_recv(drdynvcPlugin* drdynvc, wStream* s, UINT32 Thread
|
|||||||
Cmd = (value & 0xf0) >> 4;
|
Cmd = (value & 0xf0) >> 4;
|
||||||
Sp = (value & 0x0c) >> 2;
|
Sp = (value & 0x0c) >> 2;
|
||||||
cbChId = (value & 0x03) >> 0;
|
cbChId = (value & 0x03) >> 0;
|
||||||
WLog_Print(drdynvc->log, WLOG_TRACE,
|
WLog_Print(drdynvc->log, WLOG_TRACE, "order_recv: Cmd=%s, Sp=%" PRIu8 " cbChId=%" PRIu8,
|
||||||
"order_recv: Cmd=0x02" PRIx8 ", Sp=%" PRIu8 " cbChId=%" PRIu8, Cmd, Sp, cbChId);
|
drdynvc_get_packet_type(Cmd), Sp, cbChId);
|
||||||
|
|
||||||
switch (Cmd)
|
switch (Cmd)
|
||||||
{
|
{
|
||||||
|
|||||||
39
include/freerdp/utils/drdynvc.h
Normal file
39
include/freerdp/utils/drdynvc.h
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||||
|
*
|
||||||
|
* GFX Utils - Helper functions converting something to string
|
||||||
|
*
|
||||||
|
* Copyright 2023 Armin Novak <armin.novak@thincast.com>
|
||||||
|
* Copyright 2023 Thincast Technologies GmbH
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FREERDP_UTILS_DRDYNVC_H
|
||||||
|
#define FREERDP_UTILS_DRDYNVC_H
|
||||||
|
|
||||||
|
#include <winpr/wtypes.h>
|
||||||
|
#include <freerdp/api.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FREERDP_API const char* drdynvc_get_packet_type(BYTE cmd);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <freerdp/constants.h>
|
#include <freerdp/constants.h>
|
||||||
#include <freerdp/server/channels.h>
|
#include <freerdp/server/channels.h>
|
||||||
#include <freerdp/channels/drdynvc.h>
|
#include <freerdp/channels/drdynvc.h>
|
||||||
|
#include <freerdp/utils/drdynvc.h>
|
||||||
|
|
||||||
#include "rdp.h"
|
#include "rdp.h"
|
||||||
|
|
||||||
@@ -318,7 +319,8 @@ static BOOL wts_read_drdynvc_pdu(rdpPeerChannel* channel)
|
|||||||
|
|
||||||
length -= value;
|
length -= value;
|
||||||
|
|
||||||
DEBUG_DVC("Cmd %d ChannelId %" PRIu32 " length %" PRIu32 "", Cmd, ChannelId, length);
|
DEBUG_DVC("Cmd %s ChannelId %" PRIu32 " length %" PRIu32 "",
|
||||||
|
drdynvc_get_packet_type(Cmd), ChannelId, length);
|
||||||
dvc = wts_get_dvc_channel_by_id(channel->vcm, ChannelId);
|
dvc = wts_get_dvc_channel_by_id(channel->vcm, ChannelId);
|
||||||
if (!dvc)
|
if (!dvc)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ set(${MODULE_PREFIX}_SRCS
|
|||||||
signal.c
|
signal.c
|
||||||
string.c
|
string.c
|
||||||
gfx.c
|
gfx.c
|
||||||
|
drdynvc.c
|
||||||
smartcard_operations.c
|
smartcard_operations.c
|
||||||
smartcard_pack.c
|
smartcard_pack.c
|
||||||
smartcard_call.c
|
smartcard_call.c
|
||||||
|
|||||||
50
libfreerdp/utils/drdynvc.c
Normal file
50
libfreerdp/utils/drdynvc.c
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/**
|
||||||
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||||
|
*
|
||||||
|
* drdynvc Utils - Helper functions converting something to string
|
||||||
|
*
|
||||||
|
* Copyright 2023 Armin Novak <armin.novak@thincast.com>
|
||||||
|
* Copyright 2023 Thincast Technologies GmbH
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <freerdp/utils/drdynvc.h>
|
||||||
|
#include <freerdp/channels/drdynvc.h>
|
||||||
|
|
||||||
|
const char* drdynvc_get_packet_type(BYTE cmd)
|
||||||
|
{
|
||||||
|
switch (cmd)
|
||||||
|
{
|
||||||
|
case CREATE_REQUEST_PDU:
|
||||||
|
return "CREATE_REQUEST_PDU";
|
||||||
|
case DATA_FIRST_PDU:
|
||||||
|
return "DATA_FIRST_PDU";
|
||||||
|
case DATA_PDU:
|
||||||
|
return "DATA_PDU";
|
||||||
|
case CLOSE_REQUEST_PDU:
|
||||||
|
return "CLOSE_REQUEST_PDU";
|
||||||
|
case CAPABILITY_REQUEST_PDU:
|
||||||
|
return "CAPABILITY_REQUEST_PDU";
|
||||||
|
case DATA_FIRST_COMPRESSED_PDU:
|
||||||
|
return "DATA_FIRST_COMPRESSED_PDU";
|
||||||
|
case DATA_COMPRESSED_PDU:
|
||||||
|
return "DATA_COMPRESSED_PDU";
|
||||||
|
case SOFT_SYNC_REQUEST_PDU:
|
||||||
|
return "SOFT_SYNC_REQUEST_PDU";
|
||||||
|
case SOFT_SYNC_RESPONSE_PDU:
|
||||||
|
return "SOFT_SYNC_RESPONSE_PDU";
|
||||||
|
default:
|
||||||
|
return "UNKNOWN";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <winpr/assert.h>
|
#include <winpr/assert.h>
|
||||||
|
|
||||||
#include <freerdp/channels/drdynvc.h>
|
#include <freerdp/channels/drdynvc.h>
|
||||||
|
#include <freerdp/utils/drdynvc.h>
|
||||||
#include <freerdp/server/proxy/proxy_log.h>
|
#include <freerdp/server/proxy/proxy_log.h>
|
||||||
|
|
||||||
#include "pf_channel_drdynvc.h"
|
#include "pf_channel_drdynvc.h"
|
||||||
@@ -169,33 +170,6 @@ static DynvcReadResult dynvc_read_varInt(wStream* s, size_t len, UINT64* varInt,
|
|||||||
return DYNCVC_READ_OK;
|
return DYNCVC_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* get_packet_type(BYTE cmd)
|
|
||||||
{
|
|
||||||
switch (cmd)
|
|
||||||
{
|
|
||||||
case CREATE_REQUEST_PDU:
|
|
||||||
return "CREATE_REQUEST_PDU";
|
|
||||||
case DATA_FIRST_PDU:
|
|
||||||
return "DATA_FIRST_PDU";
|
|
||||||
case DATA_PDU:
|
|
||||||
return "DATA_PDU";
|
|
||||||
case CLOSE_REQUEST_PDU:
|
|
||||||
return "CLOSE_REQUEST_PDU";
|
|
||||||
case CAPABILITY_REQUEST_PDU:
|
|
||||||
return "CAPABILITY_REQUEST_PDU";
|
|
||||||
case DATA_FIRST_COMPRESSED_PDU:
|
|
||||||
return "DATA_FIRST_COMPRESSED_PDU";
|
|
||||||
case DATA_COMPRESSED_PDU:
|
|
||||||
return "DATA_COMPRESSED_PDU";
|
|
||||||
case SOFT_SYNC_REQUEST_PDU:
|
|
||||||
return "SOFT_SYNC_REQUEST_PDU";
|
|
||||||
case SOFT_SYNC_RESPONSE_PDU:
|
|
||||||
return "SOFT_SYNC_RESPONSE_PDU";
|
|
||||||
default:
|
|
||||||
return "UNKNOWN";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static PfChannelResult DynvcTrackerPeekFn(ChannelStateTracker* tracker, BOOL firstPacket,
|
static PfChannelResult DynvcTrackerPeekFn(ChannelStateTracker* tracker, BOOL firstPacket,
|
||||||
BOOL lastPacket)
|
BOOL lastPacket)
|
||||||
{
|
{
|
||||||
@@ -427,14 +401,14 @@ static PfChannelResult DynvcTrackerPeekFn(ChannelStateTracker* tracker, BOOL fir
|
|||||||
if (dynChannel->openStatus != CHANNEL_OPENSTATE_OPENED)
|
if (dynChannel->openStatus != CHANNEL_OPENSTATE_OPENED)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "DynvcTracker(%s [%s]): channel is not opened", dynChannel->channelName,
|
WLog_ERR(TAG, "DynvcTracker(%s [%s]): channel is not opened", dynChannel->channelName,
|
||||||
get_packet_type(cmd));
|
drdynvc_get_packet_type(cmd));
|
||||||
return PF_CHANNEL_RESULT_ERROR;
|
return PF_CHANNEL_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((cmd == DATA_FIRST_PDU) || (cmd == DATA_FIRST_COMPRESSED_PDU))
|
if ((cmd == DATA_FIRST_PDU) || (cmd == DATA_FIRST_COMPRESSED_PDU))
|
||||||
{
|
{
|
||||||
WLog_DBG(TAG, "DynvcTracker(%s [%s]): %s DATA_FIRST currentPacketLength=%" PRIu64 "",
|
WLog_DBG(TAG, "DynvcTracker(%s [%s]): %s DATA_FIRST currentPacketLength=%" PRIu64 "",
|
||||||
dynChannel->channelName, get_packet_type(cmd), direction, Length);
|
dynChannel->channelName, drdynvc_get_packet_type(cmd), direction, Length);
|
||||||
trackerState->currentDataLength = Length;
|
trackerState->currentDataLength = Length;
|
||||||
trackerState->CurrentDataReceived = 0;
|
trackerState->CurrentDataReceived = 0;
|
||||||
trackerState->CurrentDataFragments = 0;
|
trackerState->CurrentDataFragments = 0;
|
||||||
@@ -475,7 +449,7 @@ static PfChannelResult DynvcTrackerPeekFn(ChannelStateTracker* tracker, BOOL fir
|
|||||||
}
|
}
|
||||||
WLog_DBG(TAG,
|
WLog_DBG(TAG,
|
||||||
"DynvcTracker(%s [%s]): %s frags=%" PRIu32 " received=%" PRIu32 "(%" PRIu32 ")",
|
"DynvcTracker(%s [%s]): %s frags=%" PRIu32 " received=%" PRIu32 "(%" PRIu32 ")",
|
||||||
dynChannel->channelName, get_packet_type(cmd), direction,
|
dynChannel->channelName, drdynvc_get_packet_type(cmd), direction,
|
||||||
trackerState->CurrentDataFragments, trackerState->CurrentDataReceived,
|
trackerState->CurrentDataFragments, trackerState->CurrentDataReceived,
|
||||||
trackerState->currentDataLength);
|
trackerState->currentDataLength);
|
||||||
}
|
}
|
||||||
@@ -489,7 +463,7 @@ static PfChannelResult DynvcTrackerPeekFn(ChannelStateTracker* tracker, BOOL fir
|
|||||||
WLog_ERR(TAG,
|
WLog_ERR(TAG,
|
||||||
"DynvcTracker (%s [%s]): reassembled packet (%" PRIu32
|
"DynvcTracker (%s [%s]): reassembled packet (%" PRIu32
|
||||||
") is bigger than announced length (%" PRIu32 ")",
|
") is bigger than announced length (%" PRIu32 ")",
|
||||||
dynChannel->channelName, get_packet_type(cmd),
|
dynChannel->channelName, drdynvc_get_packet_type(cmd),
|
||||||
trackerState->CurrentDataReceived, trackerState->currentDataLength);
|
trackerState->CurrentDataReceived, trackerState->currentDataLength);
|
||||||
return PF_CHANNEL_RESULT_ERROR;
|
return PF_CHANNEL_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user