BOOL rts_send_ping_pdu(rdpRpc* rpc) { STREAM* s; RTS_PDU_HEADER header; header.rpc_vers = 5; header.rpc_vers_minor = 0; header.ptype = PTYPE_RTS; header.pfc_flags = PFC_FIRST_FRAG | PFC_LAST_FRAG; header.packed_drep[0] = 0x10; header.packed_drep[1] = 0x00; header.packed_drep[2] = 0x00; header.packed_drep[3] = 0x00; header.frag_length = 20; header.auth_length = 0; header.call_id = 0; header.flags = 1; header.numberOfCommands = 0; DEBUG_RPC("Sending Ping RTS PDU"); s = stream_new(header.frag_length); rts_pdu_header_write(s, &header); /* RTS Header (20 bytes) */ stream_seal(s); rpc_in_write(rpc, s->data, s->size); stream_free(s); return TRUE; }
boolean rts_send_keep_alive_pdu(rdpRpc* rpc) { STREAM* s; RTS_PDU_HEADER header; header.rpc_vers = 5; header.rpc_vers_minor = 0; header.ptype = PTYPE_RTS; header.pfc_flags = PFC_FIRST_FRAG | PFC_LAST_FRAG; header.packed_drep[0] = 0x10; header.packed_drep[1] = 0x00; header.packed_drep[2] = 0x00; header.packed_drep[3] = 0x00; header.frag_length = 28; header.auth_length = 0; header.call_id = 0; header.flags = 2; header.numberOfCommands = 1; DEBUG_RPC("Sending Keep-Alive RTS PDU"); s = stream_new(header.frag_length); rts_pdu_header_write(s, &header); /* RTS Header (20 bytes) */ rts_client_keepalive_command_write(s, 0x00007530); /* ClientKeepalive (8 bytes) */ stream_seal(s); rpc_in_write(rpc, s->data, s->size); stream_free(s); return true; }
BOOL rts_send_CONN_B1_pdu(rdpRpc* rpc) { STREAM* s; RTS_PDU_HEADER header; BYTE* INChannelCookie; BYTE* AssociationGroupId; BYTE* VirtualConnectionCookie; header.rpc_vers = 5; header.rpc_vers_minor = 0; header.ptype = PTYPE_RTS; header.pfc_flags = PFC_FIRST_FRAG | PFC_LAST_FRAG; header.packed_drep[0] = 0x10; header.packed_drep[1] = 0x00; header.packed_drep[2] = 0x00; header.packed_drep[3] = 0x00; header.frag_length = 104; header.auth_length = 0; header.call_id = 0; header.flags = 0; header.numberOfCommands = 6; DEBUG_RPC("Sending CONN_B1 RTS PDU"); s = stream_new(header.frag_length); rpc_generate_cookie((BYTE*) &(rpc->VirtualConnection->DefaultInChannelCookie)); rpc_generate_cookie((BYTE*) &(rpc->VirtualConnection->AssociationGroupId)); VirtualConnectionCookie = (BYTE*) &(rpc->VirtualConnection->Cookie); INChannelCookie = (BYTE*) &(rpc->VirtualConnection->DefaultInChannelCookie); AssociationGroupId = (BYTE*) &(rpc->VirtualConnection->AssociationGroupId); rts_pdu_header_write(s, &header); /* RTS Header (20 bytes) */ rts_version_command_write(s); /* Version (8 bytes) */ rts_cookie_command_write(s, VirtualConnectionCookie); /* VirtualConnectionCookie (20 bytes) */ rts_cookie_command_write(s, INChannelCookie); /* INChannelCookie (20 bytes) */ rts_channel_lifetime_command_write(s, 0x40000000); /* ChannelLifetime (8 bytes) */ rts_client_keepalive_command_write(s, 0x000493E0); /* ClientKeepalive (8 bytes) */ rts_association_group_id_command_write(s, AssociationGroupId); /* AssociationGroupId (20 bytes) */ stream_seal(s); rpc_in_write(rpc, s->data, s->size); stream_free(s); return TRUE; }
BOOL rts_send_CONN_A1_pdu(rdpRpc* rpc) { STREAM* s; RTS_PDU_HEADER header; UINT32 ReceiveWindowSize; BYTE* OUTChannelCookie; BYTE* VirtualConnectionCookie; header.rpc_vers = 5; header.rpc_vers_minor = 0; header.ptype = PTYPE_RTS; header.pfc_flags = PFC_FIRST_FRAG | PFC_LAST_FRAG; header.packed_drep[0] = 0x10; header.packed_drep[1] = 0x00; header.packed_drep[2] = 0x00; header.packed_drep[3] = 0x00; header.frag_length = 76; header.auth_length = 0; header.call_id = 0; header.flags = 0; header.numberOfCommands = 4; DEBUG_RPC("Sending CONN_A1 RTS PDU"); s = stream_new(header.frag_length); rpc_generate_cookie((BYTE*) &(rpc->VirtualConnection->Cookie)); rpc_generate_cookie((BYTE*) &(rpc->VirtualConnection->DefaultOutChannelCookie)); VirtualConnectionCookie = (BYTE*) &(rpc->VirtualConnection->Cookie); OUTChannelCookie = (BYTE*) &(rpc->VirtualConnection->DefaultOutChannelCookie); ReceiveWindowSize = rpc->VirtualConnection->DefaultOutChannel->ReceiveWindow; rts_pdu_header_write(s, &header); /* RTS Header (20 bytes) */ rts_version_command_write(s); /* Version (8 bytes) */ rts_cookie_command_write(s, VirtualConnectionCookie); /* VirtualConnectionCookie (20 bytes) */ rts_cookie_command_write(s, OUTChannelCookie); /* OUTChannelCookie (20 bytes) */ rts_receive_window_size_command_write(s, ReceiveWindowSize); /* ReceiveWindowSize (8 bytes) */ stream_seal(s); rpc_out_write(rpc, s->data, s->size); stream_free(s); return TRUE; }
BOOL rts_send_flow_control_ack_pdu(rdpRpc* rpc) { STREAM* s; RTS_PDU_HEADER header; UINT32 BytesReceived; UINT32 AvailableWindow; BYTE* ChannelCookie; header.rpc_vers = 5; header.rpc_vers_minor = 0; header.ptype = PTYPE_RTS; header.pfc_flags = PFC_FIRST_FRAG | PFC_LAST_FRAG; header.packed_drep[0] = 0x10; header.packed_drep[1] = 0x00; header.packed_drep[2] = 0x00; header.packed_drep[3] = 0x00; header.frag_length = 56; header.auth_length = 0; header.call_id = 0; header.flags = 2; header.numberOfCommands = 2; DEBUG_RPC("Sending FlowControlAck RTS PDU"); BytesReceived = rpc->VirtualConnection->DefaultOutChannel->BytesReceived; AvailableWindow = rpc->VirtualConnection->DefaultOutChannel->ReceiverAvailableWindow; ChannelCookie = (BYTE*) &(rpc->VirtualConnection->DefaultOutChannelCookie); s = stream_new(header.frag_length); rts_pdu_header_write(s, &header); /* RTS Header (20 bytes) */ rts_destination_command_write(s, FDOutProxy); /* Destination Command (8 bytes) */ /* FlowControlAck Command (28 bytes) */ rts_flow_control_ack_command_write(s, BytesReceived, AvailableWindow, ChannelCookie); stream_seal(s); rpc_in_write(rpc, s->data, s->size); stream_free(s); return TRUE; }