mirror of https://github.com/FreeRDP/FreeRDP
channels/rail: add new debug output
This commit is contained in:
parent
11109b00e9
commit
53bdd952bf
|
@ -78,11 +78,15 @@ static void rail_process_connect(rdpSvcPlugin* plugin)
|
||||||
rail->rail_order = rail_order_new();
|
rail->rail_order = rail_order_new();
|
||||||
rail->rail_order->settings = (rdpSettings*) plugin->channel_entry_points.pExtendedData;
|
rail->rail_order->settings = (rdpSettings*) plugin->channel_entry_points.pExtendedData;
|
||||||
rail->rail_order->plugin = rail;
|
rail->rail_order->plugin = rail;
|
||||||
|
|
||||||
|
WLog_Print(rail->log, WLOG_DEBUG, "Connect");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rail_process_terminate(rdpSvcPlugin* plugin)
|
static void rail_process_terminate(rdpSvcPlugin* plugin)
|
||||||
{
|
{
|
||||||
|
railPlugin* rail = (railPlugin*) plugin;
|
||||||
|
|
||||||
|
WLog_Print(rail->log, WLOG_DEBUG, "Terminate");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rail_process_receive(rdpSvcPlugin* plugin, wStream* s)
|
static void rail_process_receive(rdpSvcPlugin* plugin, wStream* s)
|
||||||
|
@ -409,6 +413,11 @@ int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
||||||
*(pEntryPointsEx->ppInterface) = (void*) context;
|
*(pEntryPointsEx->ppInterface) = (void*) context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WLog_Init();
|
||||||
|
_p->log = WLog_Get("com.freerdp.channels.rail.client");
|
||||||
|
|
||||||
|
WLog_Print(_p->log, WLOG_DEBUG, "VirtualChannelEntry");
|
||||||
|
|
||||||
svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints);
|
svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -24,12 +24,12 @@
|
||||||
|
|
||||||
#include <freerdp/rail.h>
|
#include <freerdp/rail.h>
|
||||||
#include <freerdp/settings.h>
|
#include <freerdp/settings.h>
|
||||||
#include <freerdp/utils/debug.h>
|
|
||||||
#include <freerdp/utils/svc_plugin.h>
|
#include <freerdp/utils/svc_plugin.h>
|
||||||
|
|
||||||
#include <freerdp/client/rail.h>
|
#include <freerdp/client/rail.h>
|
||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
|
#include <winpr/wlog.h>
|
||||||
#include <winpr/stream.h>
|
#include <winpr/stream.h>
|
||||||
|
|
||||||
#include "../rail_common.h"
|
#include "../rail_common.h"
|
||||||
|
@ -37,6 +37,8 @@
|
||||||
struct rail_plugin
|
struct rail_plugin
|
||||||
{
|
{
|
||||||
rdpSvcPlugin plugin;
|
rdpSvcPlugin plugin;
|
||||||
|
|
||||||
|
wLog* log;
|
||||||
rdpRailOrder* rail_order;
|
rdpRailOrder* rail_order;
|
||||||
};
|
};
|
||||||
typedef struct rail_plugin railPlugin;
|
typedef struct rail_plugin railPlugin;
|
||||||
|
|
|
@ -41,8 +41,7 @@ void rail_send_pdu(rdpRailOrder* railOrder, wStream* s, UINT16 orderType)
|
||||||
rail_write_pdu_header(s, orderType, orderLength);
|
rail_write_pdu_header(s, orderType, orderLength);
|
||||||
Stream_SetPosition(s, orderLength);
|
Stream_SetPosition(s, orderLength);
|
||||||
|
|
||||||
/* send */
|
WLog_Print(((railPlugin*) railOrder->plugin)->log, WLOG_DEBUG, "Sending %s PDU, length: %d",
|
||||||
DEBUG_RAIL("Sending %s PDU, length:%d",
|
|
||||||
RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)], orderLength);
|
RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)], orderLength);
|
||||||
|
|
||||||
rail_send_channel_data(railOrder->plugin, Stream_Buffer(s), orderLength);
|
rail_send_channel_data(railOrder->plugin, Stream_Buffer(s), orderLength);
|
||||||
|
@ -157,7 +156,6 @@ BOOL rail_read_langbar_info_order(wStream* s, RAIL_LANGBAR_INFO_ORDER* langbarIn
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void rail_write_client_status_order(wStream* s, RAIL_CLIENT_STATUS_ORDER* clientStatus)
|
void rail_write_client_status_order(wStream* s, RAIL_CLIENT_STATUS_ORDER* clientStatus)
|
||||||
{
|
{
|
||||||
Stream_Write_UINT32(s, clientStatus->flags); /* flags (4 bytes) */
|
Stream_Write_UINT32(s, clientStatus->flags); /* flags (4 bytes) */
|
||||||
|
@ -396,7 +394,7 @@ BOOL rail_order_recv(rdpRailOrder* railOrder, wStream* s)
|
||||||
if (!rail_read_pdu_header(s, &orderType, &orderLength))
|
if (!rail_read_pdu_header(s, &orderType, &orderLength))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
DEBUG_RAIL("Received %s PDU, length:%d",
|
WLog_Print(((railPlugin*) railOrder->plugin)->log, WLOG_DEBUG, "Received %s PDU, length: %d",
|
||||||
RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)], orderLength);
|
RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)], orderLength);
|
||||||
|
|
||||||
switch (orderType)
|
switch (orderType)
|
||||||
|
|
|
@ -40,10 +40,15 @@ const char* const RAIL_ORDER_TYPE_STRINGS[] =
|
||||||
"Language Bar Info",
|
"Language Bar Info",
|
||||||
"Get Application ID Request",
|
"Get Application ID Request",
|
||||||
"Get Application ID Response",
|
"Get Application ID Response",
|
||||||
"Execute Result"
|
"Execute Result",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
""
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void rail_string_to_unicode_string(char* string, RAIL_UNICODE_STRING* unicode_string)
|
void rail_string_to_unicode_string(char* string, RAIL_UNICODE_STRING* unicode_string)
|
||||||
{
|
{
|
||||||
WCHAR* buffer = NULL;
|
WCHAR* buffer = NULL;
|
||||||
|
@ -55,7 +60,7 @@ void rail_string_to_unicode_string(char* string, RAIL_UNICODE_STRING* unicode_st
|
||||||
unicode_string->string = NULL;
|
unicode_string->string = NULL;
|
||||||
unicode_string->length = 0;
|
unicode_string->length = 0;
|
||||||
|
|
||||||
if (string == NULL || strlen(string) < 1)
|
if (!string || strlen(string) < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
length = ConvertToUnicode(CP_UTF8, 0, string, -1, &buffer, 0) * 2;
|
length = ConvertToUnicode(CP_UTF8, 0, string, -1, &buffer, 0) * 2;
|
||||||
|
@ -68,8 +73,10 @@ BOOL rail_read_pdu_header(wStream* s, UINT16* orderType, UINT16* orderLength)
|
||||||
{
|
{
|
||||||
if (Stream_GetRemainingLength(s) < 4)
|
if (Stream_GetRemainingLength(s) < 4)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Stream_Read_UINT16(s, *orderType); /* orderType (2 bytes) */
|
Stream_Read_UINT16(s, *orderType); /* orderType (2 bytes) */
|
||||||
Stream_Read_UINT16(s, *orderLength); /* orderLength (2 bytes) */
|
Stream_Read_UINT16(s, *orderLength); /* orderLength (2 bytes) */
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +98,9 @@ BOOL rail_read_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake)
|
||||||
{
|
{
|
||||||
if (Stream_GetRemainingLength(s) < 4)
|
if (Stream_GetRemainingLength(s) < 4)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Stream_Read_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
|
Stream_Read_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,3 +109,19 @@ void rail_write_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake)
|
||||||
Stream_Write_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
|
Stream_Write_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL rail_read_handshake_ex_order(wStream* s, RAIL_HANDSHAKE_EX_ORDER* handshakeEx)
|
||||||
|
{
|
||||||
|
if (Stream_GetRemainingLength(s) < 8)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
Stream_Read_UINT32(s, handshakeEx->buildNumber); /* buildNumber (4 bytes) */
|
||||||
|
Stream_Read_UINT32(s, handshakeEx->railHandshakeFlags); /* railHandshakeFlags (4 bytes) */
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rail_write_handshake_ex_order(wStream* s, RAIL_HANDSHAKE_EX_ORDER* handshakeEx)
|
||||||
|
{
|
||||||
|
Stream_Write_UINT32(s, handshakeEx->buildNumber); /* buildNumber (4 bytes) */
|
||||||
|
Stream_Write_UINT32(s, handshakeEx->railHandshakeFlags); /* railHandshakeFlags (4 bytes) */
|
||||||
|
}
|
||||||
|
|
|
@ -24,12 +24,6 @@
|
||||||
|
|
||||||
#include <freerdp/rail.h>
|
#include <freerdp/rail.h>
|
||||||
|
|
||||||
#ifdef WITH_DEBUG_RAIL
|
|
||||||
#define DEBUG_RAIL(fmt, ...) DEBUG_CLASS(RAIL, fmt, ## __VA_ARGS__)
|
|
||||||
#else
|
|
||||||
#define DEBUG_RAIL(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern const char* const RAIL_ORDER_TYPE_STRINGS[];
|
extern const char* const RAIL_ORDER_TYPE_STRINGS[];
|
||||||
|
|
||||||
#define RAIL_PDU_HEADER_LENGTH 4
|
#define RAIL_PDU_HEADER_LENGTH 4
|
||||||
|
@ -73,6 +67,8 @@ typedef struct rdp_rail_order rdpRailOrder;
|
||||||
void rail_string_to_unicode_string(char* string, RAIL_UNICODE_STRING* unicode_string);
|
void rail_string_to_unicode_string(char* string, RAIL_UNICODE_STRING* unicode_string);
|
||||||
BOOL rail_read_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake);
|
BOOL rail_read_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake);
|
||||||
void rail_write_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake);
|
void rail_write_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake);
|
||||||
|
BOOL rail_read_handshake_ex_order(wStream* s, RAIL_HANDSHAKE_EX_ORDER* handshakeEx);
|
||||||
|
void rail_write_handshake_ex_order(wStream* s, RAIL_HANDSHAKE_EX_ORDER* handshakeEx);
|
||||||
|
|
||||||
wStream* rail_pdu_init(int length);
|
wStream* rail_pdu_init(int length);
|
||||||
BOOL rail_read_pdu_header(wStream* s, UINT16* orderType, UINT16* orderLength);
|
BOOL rail_read_pdu_header(wStream* s, UINT16* orderType, UINT16* orderLength);
|
||||||
|
|
Loading…
Reference in New Issue