channels/rail: add new debug output

This commit is contained in:
Marc-André Moreau 2013-10-11 17:36:34 -04:00
parent 11109b00e9
commit 53bdd952bf
5 changed files with 44 additions and 14 deletions

View File

@ -78,11 +78,15 @@ static void rail_process_connect(rdpSvcPlugin* plugin)
rail->rail_order = rail_order_new();
rail->rail_order->settings = (rdpSettings*) plugin->channel_entry_points.pExtendedData;
rail->rail_order->plugin = rail;
WLog_Print(rail->log, WLOG_DEBUG, "Connect");
}
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)
@ -409,6 +413,11 @@ int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
*(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);
return 1;

View File

@ -24,12 +24,12 @@
#include <freerdp/rail.h>
#include <freerdp/settings.h>
#include <freerdp/utils/debug.h>
#include <freerdp/utils/svc_plugin.h>
#include <freerdp/client/rail.h>
#include <winpr/crt.h>
#include <winpr/wlog.h>
#include <winpr/stream.h>
#include "../rail_common.h"
@ -37,6 +37,8 @@
struct rail_plugin
{
rdpSvcPlugin plugin;
wLog* log;
rdpRailOrder* rail_order;
};
typedef struct rail_plugin railPlugin;

View File

@ -41,8 +41,7 @@ void rail_send_pdu(rdpRailOrder* railOrder, wStream* s, UINT16 orderType)
rail_write_pdu_header(s, orderType, orderLength);
Stream_SetPosition(s, orderLength);
/* send */
DEBUG_RAIL("Sending %s PDU, length:%d",
WLog_Print(((railPlugin*) railOrder->plugin)->log, WLOG_DEBUG, "Sending %s PDU, length: %d",
RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)], 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;
}
void rail_write_client_status_order(wStream* s, RAIL_CLIENT_STATUS_ORDER* clientStatus)
{
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))
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);
switch (orderType)

View File

@ -40,10 +40,15 @@ const char* const RAIL_ORDER_TYPE_STRINGS[] =
"Language Bar Info",
"Get Application ID Request",
"Get Application ID Response",
"Execute Result"
"Execute Result",
"",
"",
"",
"",
"",
""
};
void rail_string_to_unicode_string(char* string, RAIL_UNICODE_STRING* unicode_string)
{
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->length = 0;
if (string == NULL || strlen(string) < 1)
if (!string || strlen(string) < 1)
return;
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)
return FALSE;
Stream_Read_UINT16(s, *orderType); /* orderType (2 bytes) */
Stream_Read_UINT16(s, *orderLength); /* orderLength (2 bytes) */
return TRUE;
}
@ -91,7 +98,9 @@ BOOL rail_read_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake)
{
if (Stream_GetRemainingLength(s) < 4)
return FALSE;
Stream_Read_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
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) */
}
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) */
}

View File

@ -24,12 +24,6 @@
#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[];
#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);
BOOL rail_read_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);
BOOL rail_read_pdu_header(wStream* s, UINT16* orderType, UINT16* orderLength);