mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
[core,gateway] add trace log for messages sent
This commit is contained in:
@@ -482,10 +482,18 @@ SSIZE_T rpc_channel_read(RpcChannel* channel, wStream* s, size_t length)
|
||||
return -1;
|
||||
}
|
||||
|
||||
SSIZE_T rpc_channel_write(RpcChannel* channel, const BYTE* data, size_t length)
|
||||
SSIZE_T rpc_channel_write_int(RpcChannel* channel, const BYTE* data, size_t length,
|
||||
const char* file, size_t line, const char* fkt)
|
||||
{
|
||||
if (!channel)
|
||||
return -1;
|
||||
WINPR_ASSERT(channel);
|
||||
WINPR_ASSERT(channel->rpc);
|
||||
|
||||
const DWORD level = WLOG_TRACE;
|
||||
if (WLog_IsLevelActive(channel->rpc->log, level))
|
||||
{
|
||||
WLog_PrintMessage(channel->rpc->log, WLOG_MESSAGE_TEXT, level, line, file, fkt,
|
||||
"Sending [%s] %" PRIuz " bytes", fkt, length);
|
||||
}
|
||||
|
||||
return freerdp_tls_write_all(channel->tls, data, length);
|
||||
}
|
||||
|
||||
@@ -767,7 +767,10 @@ FREERDP_LOCAL size_t rpc_offset_pad(size_t* offset, size_t pad);
|
||||
FREERDP_LOCAL BOOL rpc_get_stub_data_info(rdpRpc* rpc, const rpcconn_hdr_t* header, size_t* offset,
|
||||
size_t* length);
|
||||
|
||||
FREERDP_LOCAL SSIZE_T rpc_channel_write(RpcChannel* channel, const BYTE* data, size_t length);
|
||||
#define rpc_channel_write(channel, data, length) \
|
||||
rpc_channel_write_int((channel), (data), (length), __FILE__, __LINE__, __func__)
|
||||
FREERDP_LOCAL SSIZE_T rpc_channel_write_int(RpcChannel* channel, const BYTE* data, size_t length,
|
||||
const char* file, size_t line, const char* fkt);
|
||||
|
||||
FREERDP_LOCAL SSIZE_T rpc_channel_read(RpcChannel* channel, wStream* s, size_t length);
|
||||
|
||||
|
||||
@@ -1509,15 +1509,26 @@ void rts_generate_cookie(BYTE* cookie)
|
||||
winpr_RAND(cookie, 16);
|
||||
}
|
||||
|
||||
static BOOL rts_send_buffer(RpcChannel* channel, wStream* s, size_t frag_length)
|
||||
#define rts_send_buffer(channel, s, frag_length) \
|
||||
rts_send_buffer_int((channel), (s), (frag_length), __FILE__, __LINE__, __func__)
|
||||
static BOOL rts_send_buffer_int(RpcChannel* channel, wStream* s, size_t frag_length,
|
||||
const char* file, size_t line, const char* fkt)
|
||||
{
|
||||
BOOL status = FALSE;
|
||||
SSIZE_T rc = 0;
|
||||
|
||||
WINPR_ASSERT(channel);
|
||||
WINPR_ASSERT(channel->rpc);
|
||||
WINPR_ASSERT(s);
|
||||
|
||||
Stream_SealLength(s);
|
||||
|
||||
const DWORD level = WLOG_TRACE;
|
||||
if (WLog_IsLevelActive(channel->rpc->log, level))
|
||||
{
|
||||
WLog_PrintMessage(channel->rpc->log, WLOG_MESSAGE_TEXT, level, line, file, fkt,
|
||||
"Sending [%s] %" PRIuz " bytes", fkt, Stream_Length(s));
|
||||
}
|
||||
if (Stream_Length(s) < sizeof(rpcconn_common_hdr_t))
|
||||
goto fail;
|
||||
if (Stream_Length(s) != frag_length)
|
||||
|
||||
Reference in New Issue
Block a user