libfreerdp-core: start fixing TunnelContext creation

This commit is contained in:
Marc-André Moreau 2012-04-21 21:43:30 -04:00
parent 0b35c71b34
commit 60da98cea0
5 changed files with 21 additions and 22 deletions

View File

@ -633,7 +633,7 @@ int rpc_out_read(rdpRpc* rpc, uint8* data, int length)
else
{
/* RTS PDUs are not subject to flow control */
rpc->VirtualConnection->DefaultOutChannel->RecipientBytesReceived += header.frag_length;
rpc->VirtualConnection->DefaultOutChannel->BytesReceived += header.frag_length;
rpc->VirtualConnection->DefaultOutChannel->ReceiverAvailableWindow -= header.frag_length;
}
@ -779,8 +779,7 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length)
{
if (rpc->read_buffer_len > length)
{
/* TODO fix read_buffer is too long problem */
printf("ERROR! RPC Stores data in read_buffer fits not in data on rpc_read.\n");
printf("rpc_read error: receiving buffer is not large enough\n");
return -1;
}
@ -803,7 +802,7 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length)
{
printf("Error! rpc_out_read() returned negative value. BytesSent: %d, BytesReceived: %d\n",
rpc->VirtualConnection->DefaultInChannel->BytesSent,
rpc->VirtualConnection->DefaultOutChannel->RecipientBytesReceived);
rpc->VirtualConnection->DefaultOutChannel->BytesReceived);
xfree(rpc_data);
return status;
@ -878,7 +877,7 @@ boolean rpc_connect(rdpRpc* rpc)
void rpc_client_virtual_connection_init(rdpRpc* rpc, RpcVirtualConnection* virtual_connection)
{
virtual_connection->DefaultInChannel->BytesSent = 0;
virtual_connection->DefaultOutChannel->RecipientBytesReceived = 0;
virtual_connection->DefaultOutChannel->BytesReceived = 0;
virtual_connection->DefaultOutChannel->ReceiverAvailableWindow = rpc->ReceiveWindow;
virtual_connection->DefaultOutChannel->ReceiveWindow = rpc->ReceiveWindow;
virtual_connection->DefaultOutChannel->ReceiveWindowSize = rpc->ReceiveWindow;

View File

@ -594,7 +594,7 @@ struct rpc_out_channel
uint32 ReceiveWindow;
uint32 ReceiveWindowSize;
uint32 ReceiverAvailableWindow;
uint32 RecipientBytesReceived;
uint32 BytesReceived;
uint32 AvailableWindowAdvertised;
};
typedef struct rpc_out_channel RpcOutChannel;

View File

@ -505,7 +505,7 @@ boolean rts_send_flow_control_ack_pdu(rdpRpc* rpc)
DEBUG_RPC("Sending FlowControlAck RTS PDU");
BytesReceived = rpc->VirtualConnection->DefaultOutChannel->RecipientBytesReceived;
BytesReceived = rpc->VirtualConnection->DefaultOutChannel->BytesReceived;
AvailableWindow = rpc->VirtualConnection->DefaultOutChannel->ReceiverAvailableWindow;
ChannelCookie = (uint8*) &(rpc->VirtualConnection->DefaultOutChannelCookie);

View File

@ -245,16 +245,16 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
return false;
}
tsg->tunnelContext = xmalloc(16);
memcpy(tsg->tunnelContext, data + 0x91c, 16);
tsg->TunnelContext = xmalloc(16);
memcpy(tsg->TunnelContext, data + 2300, 16);
#ifdef WITH_DEBUG_TSG
printf("TSG tunnelContext:\n");
freerdp_hexdump(tsg->tunnelContext, 16);
freerdp_hexdump(tsg->TunnelContext, 16);
printf("\n");
#endif
memcpy(tsg_packet2 + 4, tsg->tunnelContext, 16);
memcpy(tsg_packet2 + 4, tsg->TunnelContext, 16);
/**
* OpNum = 2
@ -284,7 +284,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
return false;
}
memcpy(tsg_packet3 + 4, tsg->tunnelContext, 16);
memcpy(tsg_packet3 + 4, tsg->TunnelContext, 16);
/**
* OpNum = 3
@ -312,7 +312,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
uint8* dest_addr_unic = (uint8*) freerdp_uniconv_out(tsg_uniconv, hostname, (size_t*) &dest_addr_unic_len);
freerdp_uniconv_free(tsg_uniconv);
memcpy(tsg_packet4 + 4, tsg->tunnelContext, 16);
memcpy(tsg_packet4 + 4, tsg->TunnelContext, 16);
memcpy(tsg_packet4 + 38, &port, 2);
STREAM* s_p4 = stream_new(60 + dest_addr_unic_len + 2);
@ -321,7 +321,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
stream_write_uint32(s_p4, 0x00000000); /* Offset */
stream_write_uint32(s_p4, (dest_addr_unic_len / 2) + 1);/* ActualCount */
stream_write(s_p4, dest_addr_unic, dest_addr_unic_len);
stream_write_uint16(s_p4,0x0000); /* unicode zero to terminate hostname string */
stream_write_uint16(s_p4, 0x0000); /* unicode zero to terminate hostname string */
/**
* OpNum = 4
@ -352,16 +352,16 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
return false;
}
tsg->channelContext = xmalloc(16);
memcpy(tsg->channelContext, data + 4, 16);
tsg->ChannelContext = xmalloc(16);
memcpy(tsg->ChannelContext, data + 4, 16);
#ifdef WITH_DEBUG_TSG
printf("TSG channelContext:\n");
freerdp_hexdump(tsg->channelContext, 16);
printf("TSG ChannelContext:\n");
freerdp_hexdump(tsg->ChannelContext, 16);
printf("\n");
#endif
memcpy(tsg_packet5 + 4, tsg->channelContext, 16);
memcpy(tsg_packet5 + 4, tsg->ChannelContext, 16);
/**
* OpNum = 8
@ -405,7 +405,7 @@ int tsg_write(rdpTsg* tsg, uint8* data, uint32 length)
tsg_pkg = xmalloc(tsg_length);
memset(tsg_pkg, 0, 4);
memcpy(tsg_pkg + 4, tsg->channelContext, 16);
memcpy(tsg_pkg + 4, tsg->ChannelContext, 16);
memcpy(tsg_pkg + 20, s->data, 12);
memcpy(tsg_pkg + 32, data, length);

View File

@ -37,8 +37,8 @@ typedef struct rdp_tsg rdpTsg;
struct rdp_tsg
{
rdpRpc* rpc;
uint8* tunnelContext;
uint8* channelContext;
uint8* TunnelContext;
uint8* ChannelContext;
rdpSettings* settings;
rdpTransport* transport;
};