[channels,cliprdr] stringify logged values
This commit is contained in:
parent
71760d6d9a
commit
1b2533674b
@ -41,37 +41,6 @@
|
||||
const char* type_FileGroupDescriptorW = "FileGroupDescriptorW";
|
||||
const char* type_FileContents = "FileContents";
|
||||
|
||||
static const char* CB_MSG_TYPE_STRINGS(UINT32 type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CB_MONITOR_READY:
|
||||
return "CB_MONITOR_READY";
|
||||
case CB_FORMAT_LIST:
|
||||
return "CB_FORMAT_LIST";
|
||||
case CB_FORMAT_LIST_RESPONSE:
|
||||
return "CB_FORMAT_LIST_RESPONSE";
|
||||
case CB_FORMAT_DATA_REQUEST:
|
||||
return "CB_FORMAT_DATA_REQUEST";
|
||||
case CB_FORMAT_DATA_RESPONSE:
|
||||
return "CB_FORMAT_DATA_RESPONSE";
|
||||
case CB_TEMP_DIRECTORY:
|
||||
return "CB_TEMP_DIRECTORY";
|
||||
case CB_CLIP_CAPS:
|
||||
return "CB_CLIP_CAPS";
|
||||
case CB_FILECONTENTS_REQUEST:
|
||||
return "CB_FILECONTENTS_REQUEST";
|
||||
case CB_FILECONTENTS_RESPONSE:
|
||||
return "CB_FILECONTENTS_RESPONSE";
|
||||
case CB_LOCK_CLIPDATA:
|
||||
return "CB_LOCK_CLIPDATA";
|
||||
case CB_UNLOCK_CLIPDATA:
|
||||
return "CB_UNLOCK_CLIPDATA";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
CliprdrClientContext* cliprdr_get_client_interface(cliprdrPlugin* cliprdr)
|
||||
{
|
||||
CliprdrClientContext* pInterface = NULL;
|
||||
@ -475,8 +444,11 @@ static UINT cliprdr_order_recv(LPVOID userdata, wStream* s)
|
||||
if (!Stream_CheckAndLogRequiredLength(TAG, s, dataLen))
|
||||
return ERROR_INVALID_DATA;
|
||||
|
||||
WLog_DBG(TAG, "msgType: %s (%" PRIu16 "), msgFlags: %" PRIu16 " dataLen: %" PRIu32 "",
|
||||
CB_MSG_TYPE_STRINGS(msgType), msgType, msgFlags, dataLen);
|
||||
char buffer1[64] = { 0 };
|
||||
char buffer2[64] = { 0 };
|
||||
WLog_DBG(TAG, "msgType: %s (%" PRIu16 "), msgFlags: %s dataLen: %" PRIu32 "",
|
||||
CB_MSG_TYPE_STRING(msgType, buffer1, sizeof(buffer1)), msgType,
|
||||
CB_MSG_FLAGS_STRING(msgFlags, buffer2, sizeof(buffer2)), dataLen);
|
||||
|
||||
switch (msgType)
|
||||
{
|
||||
|
@ -28,6 +28,67 @@
|
||||
|
||||
#include "cliprdr_common.h"
|
||||
|
||||
static const char* CB_MSG_TYPE_STR(UINT32 type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CB_MONITOR_READY:
|
||||
return "CB_MONITOR_READY";
|
||||
case CB_FORMAT_LIST:
|
||||
return "CB_FORMAT_LIST";
|
||||
case CB_FORMAT_LIST_RESPONSE:
|
||||
return "CB_FORMAT_LIST_RESPONSE";
|
||||
case CB_FORMAT_DATA_REQUEST:
|
||||
return "CB_FORMAT_DATA_REQUEST";
|
||||
case CB_FORMAT_DATA_RESPONSE:
|
||||
return "CB_FORMAT_DATA_RESPONSE";
|
||||
case CB_TEMP_DIRECTORY:
|
||||
return "CB_TEMP_DIRECTORY";
|
||||
case CB_CLIP_CAPS:
|
||||
return "CB_CLIP_CAPS";
|
||||
case CB_FILECONTENTS_REQUEST:
|
||||
return "CB_FILECONTENTS_REQUEST";
|
||||
case CB_FILECONTENTS_RESPONSE:
|
||||
return "CB_FILECONTENTS_RESPONSE";
|
||||
case CB_LOCK_CLIPDATA:
|
||||
return "CB_LOCK_CLIPDATA";
|
||||
case CB_UNLOCK_CLIPDATA:
|
||||
return "CB_UNLOCK_CLIPDATA";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
const char* CB_MSG_TYPE_STRING(UINT16 type, char* buffer, size_t size)
|
||||
{
|
||||
_snprintf(buffer, size, "%s [0x%04" PRIx16 "]", CB_MSG_TYPE_STR(type), type);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const char* CB_MSG_FLAGS_STRING(UINT16 msgFlags, char* buffer, size_t size)
|
||||
{
|
||||
if ((msgFlags & CB_RESPONSE_OK) != 0)
|
||||
winpr_str_append("CB_RESPONSE_OK", buffer, size, "|");
|
||||
if ((msgFlags & CB_RESPONSE_FAIL) != 0)
|
||||
winpr_str_append("CB_RESPONSE_FAIL", buffer, size, "|");
|
||||
if ((msgFlags & CB_ASCII_NAMES) != 0)
|
||||
winpr_str_append("CB_ASCII_NAMES", buffer, size, "|");
|
||||
|
||||
const size_t len = strnlen(buffer, size);
|
||||
if (len > 0)
|
||||
{
|
||||
/* remove trailing | */
|
||||
buffer[len - 1] = '\0';
|
||||
}
|
||||
else
|
||||
winpr_str_append("NONE", buffer, size, "");
|
||||
|
||||
char val[32] = { 0 };
|
||||
_snprintf(val, sizeof(val), "[0x%04" PRIx16 "]", msgFlags);
|
||||
winpr_str_append(val, buffer, size, "|");
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static BOOL cliprdr_validate_file_contents_request(const CLIPRDR_FILE_CONTENTS_REQUEST* request)
|
||||
{
|
||||
/*
|
||||
|
@ -29,6 +29,9 @@
|
||||
#include <freerdp/channels/cliprdr.h>
|
||||
#include <freerdp/api.h>
|
||||
|
||||
FREERDP_LOCAL const char* CB_MSG_TYPE_STRING(UINT16 type, char* buffer, size_t size);
|
||||
FREERDP_LOCAL const char* CB_MSG_FLAGS_STRING(UINT16 msgFlags, char* buffer, size_t size);
|
||||
|
||||
FREERDP_LOCAL wStream* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags, UINT32 dataLen);
|
||||
FREERDP_LOCAL wStream*
|
||||
cliprdr_packet_lock_clipdata_new(const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData);
|
||||
|
@ -902,10 +902,11 @@ static UINT cliprdr_server_receive_pdu(CliprdrServerContext* context, wStream* s
|
||||
WINPR_ASSERT(context);
|
||||
WINPR_ASSERT(header);
|
||||
|
||||
WLog_DBG(TAG,
|
||||
"CliprdrServerReceivePdu: msgType: %" PRIu16 " msgFlags: 0x%04" PRIX16
|
||||
" dataLen: %" PRIu32 "",
|
||||
header->msgType, header->msgFlags, header->dataLen);
|
||||
char buffer1[64] = { 0 };
|
||||
char buffer2[64] = { 0 };
|
||||
WLog_DBG(TAG, "CliprdrServerReceivePdu: msgType: %s, msgFlags: %s dataLen: %" PRIu32 "",
|
||||
CB_MSG_TYPE_STRING(header->msgType, buffer1, sizeof(buffer1)),
|
||||
CB_MSG_FLAGS_STRING(header->msgFlags, buffer2, sizeof(buffer2)), header->dataLen);
|
||||
|
||||
switch (header->msgType)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user