libfreerdp-core: TSG refactoring of context handles

This commit is contained in:
Marc-André Moreau 2012-11-09 12:52:34 -05:00
parent 22e259d3d0
commit cd8be905d8
4 changed files with 59 additions and 21 deletions

View File

@ -79,6 +79,29 @@ typedef struct
BYTE node[6];
} p_uuid_t;
#define ndr_c_int_big_endian 0
#define ndr_c_int_little_endian 1
#define ndr_c_float_ieee 0
#define ndr_c_float_vax 1
#define ndr_c_float_cray 2
#define ndr_c_float_ibm 3
#define ndr_c_char_ascii 0
#define ndr_c_char_ebcdic 1
typedef struct
{
BYTE int_rep;
BYTE char_rep;
BYTE float_rep;
BYTE reserved;
} ndr_format_t, *ndr_format_p_t;
typedef struct ndr_context_handle
{
UINT32 context_handle_attributes;
p_uuid_t context_handle_uuid;
} ndr_context_handle;
typedef struct
{
p_uuid_t if_uuid;

View File

@ -133,9 +133,8 @@ DWORD TsProxySendToServer(handle_t IDL_handle, byte pRpcMessage[], UINT32 count,
s = stream_new(28 + totalDataBytes);
/* PCHANNEL_CONTEXT_HANDLE_NOSERIALIZE_NR (20 bytes) */
stream_write_UINT32(s, 0); /* ContextType (4 bytes) */
stream_write(s, tsg->ChannelContext, 16); /* ContextUuid (16 bytes) */
stream_write(s, &tsg->ChannelContext.ContextType, 4); /* ContextType (4 bytes) */
stream_write(s, tsg->ChannelContext.ContextUuid, 16); /* ContextUuid (16 bytes) */
stream_write_UINT32_be(s, totalDataBytes); /* totalDataBytes (4 bytes) */
stream_write_UINT32_be(s, numBuffers); /* numBuffers (4 bytes) */
@ -349,14 +348,16 @@ BOOL tsg_proxy_create_tunnel_read_response(rdpTsg* tsg)
/* ??? (16 bytes): all zeros */
offset += 16;
offset += 4; /* ContextType (4 bytes) */
CopyMemory(tsg->TunnelContext, &buffer[offset], 16); /* ContextUuid */
/* TunnelContext (20 bytes) */
CopyMemory(&tsg->TunnelContext.ContextType, &buffer[offset], 4); /* ContextType */
CopyMemory(tsg->TunnelContext.ContextUuid, &buffer[offset + 4], 16); /* ContextUuid */
offset += 20;
/* TODO: trailing bytes */
#ifdef WITH_DEBUG_TSG
printf("TSG TunnelContext:\n");
freerdp_hexdump(tsg->TunnelContext, 16);
freerdp_hexdump((void*) &tsg->TunnelContext, 20);
printf("\n");
#endif
@ -422,14 +423,16 @@ BOOL tsg_proxy_create_tunnel_read_response(rdpTsg* tsg)
offset += 4; /* 0x00000001 (4 bytes) */
offset += 4; /* 0x00000002 (4 bytes) */
offset += 4; /* ContextType (4 bytes) */
CopyMemory(tsg->TunnelContext, &buffer[offset], 16); /* ContextUuid */
/* TunnelContext (20 bytes) */
CopyMemory(&tsg->TunnelContext.ContextType, &buffer[offset], 4); /* ContextType */
CopyMemory(tsg->TunnelContext.ContextUuid, &buffer[offset + 4], 16); /* ContextUuid */
offset += 20;
/* TODO: trailing bytes */
#ifdef WITH_DEBUG_TSG
printf("TSG TunnelContext:\n");
freerdp_hexdump(tsg->TunnelContext, 16);
freerdp_hexdump((void*) &tsg->TunnelContext, 20);
printf("\n");
#endif
@ -497,8 +500,9 @@ BOOL tsg_proxy_authorize_tunnel_write_request(rdpTsg* tsg)
length = offset;
buffer = (BYTE*) malloc(length);
*((UINT32*) &buffer[0]) = 0x00000000; /* ContextType */
CopyMemory(&buffer[4], tsg->TunnelContext, 16); /* ContextUuid */
/* TunnelContext */
CopyMemory(&buffer[0], &tsg->TunnelContext.ContextType, 4); /* ContextType */
CopyMemory(&buffer[4], tsg->TunnelContext.ContextUuid, 16); /* ContextUuid */
/* 4-byte alignment */
@ -661,8 +665,9 @@ BOOL tsg_proxy_make_tunnel_call_write_request(rdpTsg* tsg)
length = 40;
buffer = (BYTE*) malloc(length);
*((UINT32*) &buffer[0]) = 0x00000000; /* ContextType */
CopyMemory(&buffer[4], tsg->TunnelContext, 16); /* ContextUuid */
/* TunnelContext */
CopyMemory(&buffer[0], &tsg->TunnelContext.ContextType, 4); /* ContextType */
CopyMemory(&buffer[4], tsg->TunnelContext.ContextUuid, 16); /* ContextUuid */
*((UINT32*) &buffer[20]) = TSG_TUNNEL_CALL_ASYNC_MSG_REQUEST; /* ProcId */
@ -742,8 +747,9 @@ BOOL tsg_proxy_create_channel_write_request(rdpTsg* tsg)
buffer = (BYTE*) malloc(length);
*((UINT32*) &buffer[0]) = 0x00000000; /* ContextType */
CopyMemory(&buffer[4], tsg->TunnelContext, 16); /* ContextUuid */
/* TunnelContext */
CopyMemory(&buffer[0], &tsg->TunnelContext.ContextType, 4); /* ContextType */
CopyMemory(&buffer[4], tsg->TunnelContext.ContextUuid, 16); /* ContextUuid */
/* TSENDPOINTINFO */
@ -789,13 +795,15 @@ BOOL tsg_proxy_create_channel_read_response(rdpTsg* tsg)
length = status;
buffer = rpc->buffer;
CopyMemory(tsg->ChannelContext, &rpc->buffer[28], 16); /* ChannelContext (16 bytes) */
/* ChannelContext (20 bytes) */
CopyMemory(&tsg->ChannelContext.ContextType, &rpc->buffer[24], 4); /* ContextType (4 bytes) */
CopyMemory(tsg->ChannelContext.ContextUuid, &rpc->buffer[28], 16); /* ContextUuid (16 bytes) */
/* TODO: trailing bytes */
#ifdef WITH_DEBUG_TSG
printf("ChannelContext:\n");
freerdp_hexdump(tsg->ChannelContext, 16);
freerdp_hexdump((void*) &tsg->ChannelContext, 20);
printf("\n");
#endif
@ -843,8 +851,9 @@ BOOL tsg_proxy_setup_receive_pipe_write_request(rdpTsg* tsg)
buffer = (BYTE*) malloc(length);
*((UINT32*) &buffer[0]) = 0x00000000; /* ContextType */
CopyMemory(&buffer[4], tsg->ChannelContext, 16); /* ContextUuid */
/* ChannelContext */
CopyMemory(&buffer[0], &tsg->ChannelContext.ContextType, 4); /* ContextType */
CopyMemory(&buffer[4], tsg->ChannelContext.ContextUuid, 16); /* ContextUuid */
status = rpc_tsg_write(rpc, buffer, length, TsProxySetupReceivePipeOpnum);

View File

@ -50,8 +50,8 @@ struct rdp_tsg
BOOL bytesAvailable;
rdpSettings* settings;
rdpTransport* transport;
BYTE TunnelContext[16];
BYTE ChannelContext[16];
CONTEXT_HANDLE TunnelContext;
CONTEXT_HANDLE ChannelContext;
};
typedef WCHAR* RESOURCENAME;

View File

@ -42,6 +42,12 @@ typedef void* I_RPC_HANDLE;
typedef I_RPC_HANDLE RPC_BINDING_HANDLE;
typedef RPC_BINDING_HANDLE handle_t;
typedef struct _CONTEXT_HANDLE
{
UINT32 ContextType;
BYTE ContextUuid[16];
} CONTEXT_HANDLE;
typedef PCONTEXT_HANDLE PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE;
typedef PCONTEXT_HANDLE PTUNNEL_CONTEXT_HANDLE_SERIALIZE;