int rts_recv_OUT_R1_A2_pdu(rdpRpc* rpc, BYTE* buffer, UINT32 length) { int status; UINT32 offset; UINT32 Destination = 0; RpcVirtualConnection* connection = rpc->VirtualConnection; WLog_DBG(TAG, "Receiving OUT R1/A2 RTS PDU"); offset = 24; offset += rts_destination_command_read(rpc, &buffer[offset], length - offset, &Destination) + 4; connection->NonDefaultOutChannel = rpc_out_channel_new(rpc); if (!connection->NonDefaultOutChannel) return -1; status = rpc_out_channel_replacement_connect(connection->NonDefaultOutChannel, 5000); if (status < 0) { WLog_ERR(TAG, "rpc_out_channel_replacement_connect failure"); return -1; } rpc_out_channel_transition_to_state(connection->DefaultOutChannel, CLIENT_OUT_CHANNEL_STATE_OPENED_A6W); return 1; }
static RpcVirtualConnection* rpc_virtual_connection_new(rdpRpc* rpc) { RpcVirtualConnection* connection; connection = (RpcVirtualConnection*) calloc(1, sizeof(RpcVirtualConnection)); if (!connection) return NULL; rts_generate_cookie((BYTE*) & (connection->Cookie)); rts_generate_cookie((BYTE*) & (connection->AssociationGroupId)); connection->State = VIRTUAL_CONNECTION_STATE_INITIAL; connection->DefaultInChannel = rpc_in_channel_new(rpc); if (!connection->DefaultInChannel) goto out_free; connection->DefaultOutChannel = rpc_out_channel_new(rpc); if (!connection->DefaultOutChannel) goto out_default_in; return connection; out_default_in: free(connection->DefaultInChannel); out_free: free(connection); return NULL; }