public void S1_Connection_ChannelConnection_PositiveTest() { #region Test Steps //1. Initiate an RDP connection to SUT and complete the Connection Initiation phase and Basic Setting Exchange phase. //2. Test Suite sends a Client MCS Erect Domain Request PDU and a Client MCS Attach User Request PDU. //3. Test Suite expects a Server MCS Attach User Confirm PDU from SUT. //4. Test Suite verifies the received MCS Attach User Confirm PDU. //5. Test Suite start the channel join sequence. Test suite use the MCS Channel Join Request PDU to join the user channel obtained from the Attach User Confirm PDU, the I/O channel and all of the static virtual channels obtained from the Server Network Data structure. //6. Test Suite expects and verifies a Server MCS Channel Join Confirm PDU respectively for each MCS Channel Join Request PDU. //7. After all the channels created, the Test suite close the connection. #endregion Test Steps #region Test Code this.Site.Log.Add(LogEntryKind.Comment, "Establish transport connection with RDP Server, encrypted protocol is {0}.", transportProtocol.ToString()); rdpbcgrAdapter.ConnectToServer(this.transportProtocol); #region Connection Initiation this.Site.Log.Add(LogEntryKind.Comment, "Send a Client X.224 Connection Request PDU to SUT, supported security protocol is {0}.", requestProtocol.ToString()); rdpbcgrAdapter.SendClientX224ConnectionRequest(NegativeType.None, requestProtocol); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server X224 Connection Confirm."); Server_X_224_Connection_Confirm_Pdu confirmPdu = rdpbcgrAdapter.ExpectPacket <Server_X_224_Connection_Confirm_Pdu>(timeout); this.Site.Assert.IsNotNull(confirmPdu, "RDP Server MUST response a Server X224 Connection Confirm PDU after receiving a Client X224 Connection Request PDU."); #endregion Connection Initiation #region Basic Setting Exchange string[] SVCNames = new string[] { RdpConstValue.SVCNAME_RDPEDYC }; bool supportMultitransportReliable = false; bool supportMultitransportLossy = false; this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Connect Initial PDU with GCC Conference Create Request to SUT, supportMultitransportReliable is {0}, supportMultitransportLossy is {1}.", supportMultitransportReliable, supportMultitransportLossy); rdpbcgrAdapter.SendClientMCSConnectInitialPDU(NegativeType.None, SVCNames, false, false, false, supportMultitransportReliable, supportMultitransportLossy, false); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server MCS Connect Response PDU with GCC Conference Create Response."); Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response response = rdpbcgrAdapter.ExpectPacket <Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response>(timeout); this.Site.Assert.IsNotNull(confirmPdu, "RDP Server MUST response a Server MCS Connect Response after receiving a Client MCS Connect Initial PDU."); #endregion Basic Setting Exchange this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Erect Domain Request PDU to SUT."); rdpbcgrAdapter.SendClientMCSErectDomainRequest(NegativeType.None); this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Attach User Request PDU to SUT."); rdpbcgrAdapter.SendClientMCSAttachUserRequest(NegativeType.None); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server MCS Attach User Confirm PDU."); Server_MCS_Attach_User_Confirm_Pdu attachuserConfirm = rdpbcgrAdapter.ExpectPacket <Server_MCS_Attach_User_Confirm_Pdu>(timeout); this.Site.Assert.IsNotNull(attachuserConfirm, "RDP Server MUST response a Server MCS Attach User Confirm PDU after receiving a Client MCS Attach User Request PDU."); this.Site.Log.Add(LogEntryKind.Comment, "The test suite proceeds to join the user channel, the input/output (I/O) channel, and all of the static virtual channels."); rdpbcgrAdapter.ChannelJoinRequestAndConfirm(); #endregion Test Code }
private void StartRDPConnect() { this.Site.Log.Add(LogEntryKind.Comment, "Establish transport connection with RDP Server, encrypted protocol is {0}.", testConfig.transportProtocol.ToString()); rdpbcgrAdapter.ConnectToServer(testConfig.transportProtocol); #region Connection Initiation this.Site.Log.Add(LogEntryKind.Comment, "Send a Client X.224 Connection Request PDU to SUT, supported security protocol is {0}.", testConfig.requestProtocol.ToString()); rdpbcgrAdapter.SendClientX224ConnectionRequest(Rdpbcgr.NegativeType.None, testConfig.requestProtocol); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server X224 Connection Confirm."); Server_X_224_Connection_Confirm_Pdu confirmPdu = rdpbcgrAdapter.ExpectPacket <Server_X_224_Connection_Confirm_Pdu>(testConfig.timeout); this.Site.Assert.IsNotNull(confirmPdu, "RDP Server MUST response a Server X224 Connection Confirm PDU after receiving a Client X224 Connection Request PDU."); #endregion Connection Initiation #region Basic Setting Exchange string[] SVCNames = new string[] { RdpConstValue.SVCNAME_RDPEDYC }; bool supportMultitransportReliable = true; bool supportMultitransportLossy = true; this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Connect Initial PDU with GCC Conference Create Request to SUT, supportMultitransportReliable is {0}, supportMultitransportLossy is {1}.", supportMultitransportReliable, supportMultitransportLossy); rdpbcgrAdapter.SendClientMCSConnectInitialPDU(Rdpbcgr.NegativeType.None, SVCNames, false, false, false, supportMultitransportReliable, supportMultitransportLossy, false); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server MCS Connect Response PDU with GCC Conference Create Response."); Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response response = rdpbcgrAdapter.ExpectPacket <Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response>(testConfig.timeout); this.Site.Assert.IsNotNull(confirmPdu, "RDP Server MUST response a Server MCS Connect Response after receiving a Client MCS Connect Initial PDU."); #endregion Basic Setting Exchange #region Channel Connection this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Erect Domain Request PDU to SUT."); rdpbcgrAdapter.SendClientMCSErectDomainRequest(Rdpbcgr.NegativeType.None); this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Attach User Request PDU to SUT."); rdpbcgrAdapter.SendClientMCSAttachUserRequest(Rdpbcgr.NegativeType.None); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server MCS Attach User Confirm PDU."); Server_MCS_Attach_User_Confirm_Pdu attachuserConfirm = rdpbcgrAdapter.ExpectPacket <Server_MCS_Attach_User_Confirm_Pdu>(testConfig.timeout); this.Site.Assert.IsNotNull(attachuserConfirm, "RDP Server MUST response a Server MCS Attach User Confirm PDU after receiving a Client MCS Attach User Request PDU."); this.Site.Log.Add(LogEntryKind.Comment, "The test suite proceeds to join the user channel, the input/output (I/O) channel, and all of the static virtual channels."); rdpbcgrAdapter.ChannelJoinRequestAndConfirm(); #endregion Channel Connection if (testConfig.requestProtocol == requestedProtocols_Values.PROTOCOL_RDP_FLAG) { this.Site.Log.Add(LogEntryKind.Comment, "Standard RDP Security mechanisms are being employed, Test Suite sends a Client Security Exchange PDU to SUT."); rdpbcgrAdapter.SendClientSecurityExchangePDU(Rdpbcgr.NegativeType.None); } this.Site.Log.Add(LogEntryKind.Comment, "Send a Client Info PDU."); rdpbcgrAdapter.SendClientInfoPDU(Rdpbcgr.NegativeType.None, CompressionType.PACKET_COMPR_TYPE_RDP61, false); }
public void S1_Connection_ConnectionFinalization_PositiveTest() { #region Test Steps //1. Initiate an RDP connection and complete the Connection Initiation phase, Basic Setting Exchange phase, Channel Connection phase, RDP Security Commencement phase, Secure Setting Exchange phase, Licensing phase, and Capabilities Exchange phase. //2. Test Suite continues the connection by sending the following PDUs sequentially: // Client Synchronize PDU // Client Control PDU - Cooperate // Client Control PDU - Request Control // Client Persistent Key List PDU(optional) // Client Font List PDU //3. Test Suite expects and verifies the following PDUs one by one from SUT sequentially: // Server Synchronize PDU // Server Control PDU – Cooperate // Server Control PDU - Granted Control // Server Font Map PDU #endregion Test Steps #region Test Code this.Site.Log.Add(LogEntryKind.Comment, "Establish transport connection with RDP Server, encrypted protocol is {0}.", transportProtocol.ToString()); rdpbcgrAdapter.ConnectToServer(this.transportProtocol); #region Connection Initiation this.Site.Log.Add(LogEntryKind.Comment, "Send a Client X.224 Connection Request PDU to SUT, supported security protocol is {0}.", requestProtocol.ToString()); rdpbcgrAdapter.SendClientX224ConnectionRequest(NegativeType.None, requestProtocol); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server X224 Connection Confirm."); Server_X_224_Connection_Confirm_Pdu confirmPdu = rdpbcgrAdapter.ExpectPacket <Server_X_224_Connection_Confirm_Pdu>(timeout); this.Site.Assert.IsNotNull(confirmPdu, "RDP Server MUST response a Server X224 Connection Confirm PDU after receiving a Client X224 Connection Request PDU."); #endregion Connection Initiation #region Basic Setting Exchange string[] SVCNames = new string[] { RdpConstValue.SVCNAME_RDPEDYC }; bool supportMultitransportReliable = false; bool supportMultitransportLossy = false; this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Connect Initial PDU with GCC Conference Create Request to SUT, supportMultitransportReliable is {0}, supportMultitransportLossy is {1}.", supportMultitransportReliable, supportMultitransportLossy); rdpbcgrAdapter.SendClientMCSConnectInitialPDU(NegativeType.None, SVCNames, false, false, false, supportMultitransportReliable, supportMultitransportLossy, false); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server MCS Connect Response PDU with GCC Conference Create Response."); Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response response = rdpbcgrAdapter.ExpectPacket <Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response>(timeout); this.Site.Assert.IsNotNull(confirmPdu, "RDP Server MUST response a Server MCS Connect Response after receiving a Client MCS Connect Initial PDU."); #endregion Basic Setting Exchange #region Channel Connection this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Erect Domain Request PDU to SUT."); rdpbcgrAdapter.SendClientMCSErectDomainRequest(NegativeType.None); this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Attach User Request PDU to SUT."); rdpbcgrAdapter.SendClientMCSAttachUserRequest(NegativeType.None); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server MCS Attach User Confirm PDU."); Server_MCS_Attach_User_Confirm_Pdu attachuserConfirm = rdpbcgrAdapter.ExpectPacket <Server_MCS_Attach_User_Confirm_Pdu>(timeout); this.Site.Assert.IsNotNull(attachuserConfirm, "RDP Server MUST response a Server MCS Attach User Confirm PDU after receiving a Client MCS Attach User Request PDU."); this.Site.Log.Add(LogEntryKind.Comment, "The test suite proceeds to join the user channel, the input/output (I/O) channel, and all of the static virtual channels."); rdpbcgrAdapter.ChannelJoinRequestAndConfirm(); #endregion Channel Connection #region Security Commencement phase, Secure Setting Exchange Phase and Licensing phase if (requestProtocol == requestedProtocols_Values.PROTOCOL_RDP_FLAG) { this.Site.Log.Add(LogEntryKind.Comment, "Standard RDP Security mechanisms are being employed, Test Suite sends a Client Security Exchange PDU to SUT."); rdpbcgrAdapter.SendClientSecurityExchangePDU(NegativeType.None); } this.Site.Log.Add(LogEntryKind.Comment, "Send a Client Info PDU."); rdpbcgrAdapter.SendClientInfoPDU(NegativeType.None, CompressionType.PACKET_COMPR_TYPE_RDP61, false); Server_License_Error_Pdu_Valid_Client licenseErrorPdu = rdpbcgrAdapter.ExpectPacket <Server_License_Error_Pdu_Valid_Client>(timeout); this.Site.Assert.IsNotNull(licenseErrorPdu, "RDP Server MUST send a Server License Error PDU during Licensing phase."); #endregion Security Commencement phase, Secure Setting Exchange Phase and Licensing phase #region Capabilities Exchange phase Server_Demand_Active_Pdu demandActivePdu = rdpbcgrAdapter.ExpectPacket <Server_Demand_Active_Pdu>(timeout); this.Site.Assert.IsNotNull(demandActivePdu, "If the Licensing phase of the RDP Connection Sequence is successfully completed, RDP server must send a Server Demand Active PDU."); this.Site.Log.Add(LogEntryKind.Comment, "Send a Client Confirm Active PDU."); rdpbcgrAdapter.SendClientConfirmActivePDU(NegativeType.None, true, true, true, true, true, true); #endregion Capabilities Exchange phase this.Site.Log.Add(LogEntryKind.Comment, "Send a Client Synchronize PDU."); rdpbcgrAdapter.SendClientSynchronizePDU(); Server_Synchronize_Pdu synchronizePdu = rdpbcgrAdapter.ExpectPacket <Server_Synchronize_Pdu>(timeout); this.Site.Assert.IsNotNull(synchronizePdu, "RDP Server MUST send a Server Synchronize PDU after receiving a Client Confirm Active PDU."); Server_Control_Pdu_Cooperate controlPdu = rdpbcgrAdapter.ExpectPacket <Server_Control_Pdu_Cooperate>(timeout); this.Site.Assert.IsNotNull(controlPdu, "RDP Server MUST send a Server Control PDU – Cooperate during Connection Finalization phase"); this.Site.Log.Add(LogEntryKind.Comment, "Send a Client Control PDU - Cooperate."); rdpbcgrAdapter.SendClientControlCooperatePDU(); this.Site.Log.Add(LogEntryKind.Comment, "Send a Client Control PDU - Request Control."); rdpbcgrAdapter.SendClientControlRequestPDU(); Server_Control_Pdu_Granted_Control grantedControlPdu = rdpbcgrAdapter.ExpectPacket <Server_Control_Pdu_Granted_Control>(timeout); this.Site.Assert.IsNotNull(grantedControlPdu, "RDP Server MUST send a Server Control PDU – Granted Control during Connection Finalization phase"); if (rdpbcgrAdapter.IsBitmapCacheHostSupport) { this.Site.Log.Add(LogEntryKind.Comment, "Bitmap Cache Host is supported, send a Client Persistent Key List PDU."); rdpbcgrAdapter.SendClientPersistentKeyListPDU(); } this.Site.Log.Add(LogEntryKind.Comment, "Send a Client Font List PDU."); rdpbcgrAdapter.SendClientFontListPDU(); Server_Font_Map_Pdu fontMapPdu = rdpbcgrAdapter.ExpectPacket <Server_Font_Map_Pdu>(timeout); this.Site.Assert.IsNotNull(fontMapPdu, "RDP Server MUST send a Server Font Map PDU during Connection Finalization phase"); #endregion Test Code }
public void S1_Connection_SecurityExchange_PositiveTest() { #region Test Steps //1. Initiate an RDP connection to RDP server (SUT) and complete the Connection Initiation phase, Basic Setting Exchange phase, and Channel Connection phase. //2. If Standard RDP Security mechanisms are being employed, Test Suite sends a Client Security Exchange PDU to SUT. //3. Test Suite sends SUT a Client Info PDU to SUT. //4. Test Suite expects a Server License Error PDU from SUT. //5.Test Suite verifies the Server License Error PDU received. #endregion Test Steps #region Test Code this.Site.Log.Add(LogEntryKind.Comment, "Establish transport connection with RDP Server, encrypted protocol is {0}.", transportProtocol.ToString()); rdpbcgrAdapter.ConnectToServer(this.transportProtocol); #region Connection Initiation this.Site.Log.Add(LogEntryKind.Comment, "Send a Client X.224 Connection Request PDU to SUT, supported security protocol is {0}.", requestProtocol.ToString()); rdpbcgrAdapter.SendClientX224ConnectionRequest(NegativeType.None, requestProtocol); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server X224 Connection Confirm."); Server_X_224_Connection_Confirm_Pdu confirmPdu = rdpbcgrAdapter.ExpectPacket <Server_X_224_Connection_Confirm_Pdu>(timeout); this.Site.Assert.IsNotNull(confirmPdu, "RDP Server MUST response a Server X224 Connection Confirm PDU after receiving a Client X224 Connection Request PDU."); #endregion Connection Initiation #region Basic Setting Exchange string[] SVCNames = new string[] { RdpConstValue.SVCNAME_RDPEDYC }; bool supportMultitransportReliable = false; bool supportMultitransportLossy = false; this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Connect Initial PDU with GCC Conference Create Request to SUT, supportMultitransportReliable is {0}, supportMultitransportLossy is {1}.", supportMultitransportReliable, supportMultitransportLossy); rdpbcgrAdapter.SendClientMCSConnectInitialPDU(NegativeType.None, SVCNames, false, false, false, supportMultitransportReliable, supportMultitransportLossy, false); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server MCS Connect Response PDU with GCC Conference Create Response."); Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response response = rdpbcgrAdapter.ExpectPacket <Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response>(timeout); this.Site.Assert.IsNotNull(confirmPdu, "RDP Server MUST response a Server MCS Connect Response after receiving a Client MCS Connect Initial PDU."); #endregion Basic Setting Exchange #region Channel Connection this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Erect Domain Request PDU to SUT."); rdpbcgrAdapter.SendClientMCSErectDomainRequest(NegativeType.None); this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Attach User Request PDU to SUT."); rdpbcgrAdapter.SendClientMCSAttachUserRequest(NegativeType.None); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server MCS Attach User Confirm PDU."); Server_MCS_Attach_User_Confirm_Pdu attachuserConfirm = rdpbcgrAdapter.ExpectPacket <Server_MCS_Attach_User_Confirm_Pdu>(timeout); this.Site.Assert.IsNotNull(attachuserConfirm, "RDP Server MUST response a Server MCS Attach User Confirm PDU after receiving a Client MCS Attach User Request PDU."); this.Site.Log.Add(LogEntryKind.Comment, "The test suite proceeds to join the user channel, the input/output (I/O) channel, and all of the static virtual channels."); rdpbcgrAdapter.ChannelJoinRequestAndConfirm(); #endregion Channel Connection if (requestProtocol == requestedProtocols_Values.PROTOCOL_RDP_FLAG) { this.Site.Log.Add(LogEntryKind.Comment, "Standard RDP Security mechanisms are being employed, Test Suite sends a Client Security Exchange PDU to SUT."); rdpbcgrAdapter.SendClientSecurityExchangePDU(NegativeType.None); } this.Site.Log.Add(LogEntryKind.Comment, "Send a Client Info PDU."); rdpbcgrAdapter.SendClientInfoPDU(NegativeType.None, CompressionType.PACKET_COMPR_TYPE_RDP61, false); Server_License_Error_Pdu_Valid_Client licenseErrorPdu = rdpbcgrAdapter.ExpectPacket <Server_License_Error_Pdu_Valid_Client>(timeout); this.Site.Assert.IsNotNull(licenseErrorPdu, "RDP Server MUST send a Server License Error PDU during Licensing phase."); #endregion Test Code }
private bool EstablishRDPConnection( Configs config, requestedProtocols_Values requestedProtocols, string[] SVCNames, CompressionType highestCompressionTypeSupported, bool isReconnect = false, bool autoLogon = false, bool supportEGFX = false, bool supportAutoDetect = false, bool supportHeartbeatPDU = false, bool supportMultitransportReliable = false, bool supportMultitransportLossy = false, bool supportAutoReconnect = false, bool supportFastPathInput = false, bool supportFastPathOutput = false, bool supportSurfaceCommands = false, bool supportSVCCompression = false, bool supportRemoteFXCodec = false) { // Connection Initiation SendClientX224ConnectionRequest(requestedProtocols); Server_X_224_Connection_Confirm_Pdu connectionConfirmPdu = ExpectPacket <Server_X_224_Connection_Confirm_Pdu>(new TimeSpan(0, 0, 60)); if (connectionConfirmPdu == null) { TimeSpan waitTime = new TimeSpan(0, 0, 1); Server_X_224_Negotiate_Failure_Pdu failurePdu = ExpectPacket <Server_X_224_Negotiate_Failure_Pdu>(waitTime); if (failurePdu != null) { DetectorUtil.WriteLog("Received a Server X224 Connection confirm with RDP_NEG_FAILURE structure."); } DetectorUtil.WriteLog("Expecting a Server X224 Connection Confirm PDU."); return(false); } // Basic Settings Exchange SendClientMCSConnectInitialPDU( SVCNames, supportEGFX, supportAutoDetect, supportHeartbeatPDU, supportMultitransportReliable, supportMultitransportLossy, false); connectResponsePdu = ExpectPacket <Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response>(timeout); if (connectResponsePdu == null) { return(false); } bool serverSupportUDPFECR = false; bool serverSupportUDPFECL = false; if (connectResponsePdu.mcsCrsp.gccPdu.serverMultitransportChannelData != null) { if (connectResponsePdu.mcsCrsp.gccPdu.serverMultitransportChannelData.flags.HasFlag(MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDPFECR)) { serverSupportUDPFECR = true; } if (connectResponsePdu.mcsCrsp.gccPdu.serverMultitransportChannelData.flags.HasFlag(MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDPFECL)) { serverSupportUDPFECL = true; } } detectInfo.IsSupportRDPEMT = serverSupportUDPFECR || serverSupportUDPFECL; // Channel Connection SendClientMCSErectDomainRequest(); SendClientMCSAttachUserRequest(); Server_MCS_Attach_User_Confirm_Pdu userConfirmPdu = ExpectPacket <Server_MCS_Attach_User_Confirm_Pdu>(timeout); if (userConfirmPdu == null) { return(false); } ChannelJoinRequestAndConfirm(); // RDP Security Commencement if (rdpbcgrClient.Context.ServerSelectedProtocol == (uint)selectedProtocols_Values.PROTOCOL_RDP_FLAG) { SendClientSecurityExchangePDU(); } // Secure Settings Exchange SendClientInfoPDU(config, highestCompressionTypeSupported, isReconnect, autoLogon); rdpeleClient = new RdpeleClient(rdpbcgrClient); try { detectInfo.IsSupportRDPELE = ProcessLicenseSequence(config, timeout); } catch { detectInfo.IsSupportRDPELE = false; } rdpeleClient.Dispose(); // Capabilities Exchange Server_Demand_Active_Pdu demandActivePdu = ExpectPacket <Server_Demand_Active_Pdu>(timeout); if (demandActivePdu == null) { return(false); } SendClientConfirmActivePDU( supportAutoReconnect, supportFastPathInput, supportFastPathOutput, supportSVCCompression); // Connection Finalization SendClientSynchronizePDU(); Server_Synchronize_Pdu syncPdu = ExpectPacket <Server_Synchronize_Pdu>(timeout); if (syncPdu == null) { return(false); } Server_Control_Pdu_Cooperate CoopControlPdu = ExpectPacket <Server_Control_Pdu_Cooperate>(timeout); if (CoopControlPdu == null) { return(false); } SendClientControlCooperatePDU(); SendClientControlRequestPDU(); Server_Control_Pdu_Granted_Control grantedControlPdu = ExpectPacket <Server_Control_Pdu_Granted_Control>(timeout); if (grantedControlPdu == null) { return(false); } SendClientFontListPDU(); Server_Font_Map_Pdu fontMapPdu = ExpectPacket <Server_Font_Map_Pdu>(timeout); if (fontMapPdu == null) { return(false); } return(true); }
/// <summary> /// Establish a RDP connection with RDP Server /// </summary> /// <param name="requestedProtocols">Flags indicate supported security protocols</param> /// <param name="SVCNames">Array of static virtual channels' name</param> /// <param name="highestCompressionTypeSupported">Indicate the highest compression type supported</param> /// <param name="isReconnect">Whether this is in a reconnection sequence</param> /// /// <param name="autoLogon">Whether auto logon using username and password in client info PDU</param> /// <param name="supportEGFX">Set the support of RDPEGFX</param> /// <param name="supportAutoDetect">Set the support of auto-detect</param> /// <param name="supportHeartbeatPDU">Set the support of Heartbeat PDU</param> /// <param name="supportMultitransportReliable">Set the support of reliable multitransport</param> /// <param name="supportMultitransportLossy">Set the support of lossy multitransport</param> /// <param name="supportAutoReconnect">Set the support of auto-reconnect</param> /// <param name="supportFastPathInput">Set the support of fast-path input</param> /// <param name="supportFastPathOutput">Set the support of fast-path output</param> /// <param name="supportSurfaceCommands">Set the support of surface commands</param> /// <param name="supportSVCCompression">Set the support of static virtual channel data compression</param> /// <param name="supportRemoteFXCodec">Set the support of RemoteFX codecs</param> public void EstablishRDPConnection(requestedProtocols_Values requestedProtocols, string[] SVCNames, CompressionType highestCompressionTypeSupported, bool isReconnect = false, bool autoLogon = false, bool supportEGFX = false, bool supportAutoDetect = false, bool supportHeartbeatPDU = false, bool supportMultitransportReliable = false, bool supportMultitransportLossy = false, bool supportAutoReconnect = false, bool supportFastPathInput = false, bool supportFastPathOutput = false, bool supportSurfaceCommands = false, bool supportSVCCompression = false, bool supportRemoteFXCodec = false) { #region logging string requestProtocolString = "PROTOCOL_RDP_FLAG"; if (requestedProtocols.HasFlag(requestedProtocols_Values.PROTOCOL_SSL_FLAG)) { requestProtocolString = requestProtocolString + "|PROTOCOL_SSL_FLAG"; } if (requestedProtocols.HasFlag(requestedProtocols_Values.PROTOCOL_HYBRID_FLAG)) { requestProtocolString = requestProtocolString + "|PROTOCOL_HYBRID_FLAG"; } if (requestedProtocols.HasFlag(requestedProtocols_Values.PROTOCOL_HYBRID_EX)) { requestProtocolString = requestProtocolString + "|PROTOCOL_HYBRID_EX"; } string svcNameString = ""; if (SVCNames != null && SVCNames.Length > 0) { foreach (string svcName in SVCNames) { svcNameString = svcNameString + svcName + ","; } } this.Site.Log.Add(LogEntryKind.Comment, @"EstablishRDPConnection: request Protocols = {0}, Name of static virtual channels = {1}, Highest compression type supported = {2}, Is Reconnect = {3} RDPEGFX supported = {4}, AutoDetect supported = {5}, HeartbeatPDU supported = {6}, Reliable Multitransport supported = {7}, Lossy Multitransport supported = {8}, AutoReconnect supported = {9}, FastPathInput supported= {10}, FastPathOutput supported = {11}, SurfaceCommands supported = {12}, SVCCompression supported = {13}, RemoteFXCodec supported = {14}.", requestProtocolString, svcNameString, highestCompressionTypeSupported.ToString(), isReconnect, supportEGFX, supportAutoDetect, supportHeartbeatPDU, supportMultitransportReliable, supportMultitransportLossy, supportAutoReconnect, supportFastPathInput, supportFastPathOutput, supportSurfaceCommands, supportSVCCompression, supportRemoteFXCodec); #endregion logging #region Connection Initiation SendClientX224ConnectionRequest(NegativeType.None, requestedProtocols); Server_X_224_Connection_Confirm_Pdu connectionConfirmPdu = ExpectPacket <Server_X_224_Connection_Confirm_Pdu>(pduWaitTimeSpan); if (connectionConfirmPdu == null) { TimeSpan waitTime = new TimeSpan(0, 0, 1); Server_X_224_Negotiate_Failure_Pdu failurePdu = ExpectPacket <Server_X_224_Negotiate_Failure_Pdu>(waitTime); if (failurePdu != null) { Site.Assert.Fail("Received a Server X224 Connection confirm with RDP_NEG_FAILURE structure, failureCode is {0}.", failurePdu.rdpNegFailure.failureCode); } Site.Assert.Fail("Expecting a Server X224 Connection Confirm PDU."); } if (supportEGFX) { // Verify support of EGFX on Server Site.Assert.IsTrue(connectionConfirmPdu.rdpNegData != null && connectionConfirmPdu.rdpNegData.flags.HasFlag(RDP_NEG_RSP_flags_Values.DYNVC_GFX_PROTOCOL_SUPPORTED), "The RDP Server should support RDPEGFX."); } #endregion Connection Initiation #region Basic Setting Exchange SendClientMCSConnectInitialPDU(NegativeType.None, SVCNames, supportEGFX, supportAutoDetect, supportHeartbeatPDU, supportMultitransportReliable, supportMultitransportLossy, false); Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response connectResponsePdu = ExpectPacket <Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response>(pduWaitTimeSpan); Site.Assert.IsNotNull(connectResponsePdu, "Expecting a Server MCS Connect Response PDU with GCC Conference Create Response."); if (connectResponsePdu.mcsCrsp.gccPdu.serverMultitransportChannelData != null) { if (connectResponsePdu.mcsCrsp.gccPdu.serverMultitransportChannelData.flags.HasFlag(MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDPFECR)) { this.serverSupportUDPFECR = true; } if (connectResponsePdu.mcsCrsp.gccPdu.serverMultitransportChannelData.flags.HasFlag(MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDPFECL)) { this.serverSupportUDPFECL = true; } if (connectResponsePdu.mcsCrsp.gccPdu.serverMultitransportChannelData.flags.HasFlag(MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDP_PREFERRED)) { this.serverSupportUDPPrefferred = true; } } #endregion Basic Setting Exchange #region Channel Connection SendClientMCSErectDomainRequest(NegativeType.None); SendClientMCSAttachUserRequest(NegativeType.None); Server_MCS_Attach_User_Confirm_Pdu userConfirmPdu = ExpectPacket <Server_MCS_Attach_User_Confirm_Pdu>(pduWaitTimeSpan); Site.Assert.IsNotNull(userConfirmPdu, "Expecting a Server MCS Attach User Confirm PDU."); ChannelJoinRequestAndConfirm(); #endregion #region RDP Security Commencement if (rdpbcgrClientStack.Context.ServerSelectedProtocol == (uint)selectedProtocols_Values.PROTOCOL_RDP_FLAG) { SendClientSecurityExchangePDU(NegativeType.None); } #endregion #region Secure Setting Exchange SendClientInfoPDU(NegativeType.None, highestCompressionTypeSupported, isReconnect, autoLogon); #endregion #region Licensing Server_License_Error_Pdu_Valid_Client licenseErrorPdu = ExpectPacket <Server_License_Error_Pdu_Valid_Client>(pduWaitTimeSpan); Site.Assert.IsNotNull(licenseErrorPdu, "Expecting a Server License Error PDU."); #endregion #region Capabilities Exchange Server_Demand_Active_Pdu demandActivePdu = ExpectPacket <Server_Demand_Active_Pdu>(pduWaitTimeSpan); Site.Assert.IsNotNull(demandActivePdu, "Expecting a Server Demand Active PDU."); SendClientConfirmActivePDU(NegativeType.None, supportAutoReconnect, supportFastPathInput, supportFastPathOutput, supportSurfaceCommands, supportSVCCompression, supportRemoteFXCodec); #endregion #region Connection Finalization SendClientSynchronizePDU(); Server_Synchronize_Pdu syncPdu = ExpectPacket <Server_Synchronize_Pdu>(pduWaitTimeSpan); Site.Assert.IsNotNull(syncPdu, "Expecting a Server Synchronize PDU."); Server_Control_Pdu_Cooperate CoopControlPdu = ExpectPacket <Server_Control_Pdu_Cooperate>(pduWaitTimeSpan); Site.Assert.IsNotNull(CoopControlPdu, "Expecting a Server Control PDU - Cooperate."); SendClientControlCooperatePDU(); SendClientControlRequestPDU(); Server_Control_Pdu_Granted_Control grantedControlPdu = ExpectPacket <Server_Control_Pdu_Granted_Control>(pduWaitTimeSpan); Site.Assert.IsNotNull(grantedControlPdu, "Expecting a Server Control PDU - Granted Control."); if (IsBitmapCacheHostSupport) { SendClientPersistentKeyListPDU(); } SendClientFontListPDU(); Server_Font_Map_Pdu fontMapPdu = ExpectPacket <Server_Font_Map_Pdu>(pduWaitTimeSpan); Site.Assert.IsNotNull(fontMapPdu, "Expecting a Server Font Map PDU."); #endregion }
/// <summary> /// Establish RDP Connection /// </summary> private void EstablishRDPConnection() { sessionContext = rdpbcgrServerStack.ExpectConnect(timeout); #region Connection Initial x224ConnectionRequest = ExpectPacket <Client_X_224_Connection_Request_Pdu>(sessionContext, timeout); Server_X_224_Connection_Confirm_Pdu confirmPdu = rdpbcgrServerStack.CreateX224ConnectionConfirmPdu(sessionContext, selectedProtocols_Values.PROTOCOL_RDP_FLAG, RDP_NEG_RSP_flags_Values.DYNVC_GFX_PROTOCOL_SUPPORTED | RDP_NEG_RSP_flags_Values.EXTENDED_CLIENT_DATA_SUPPORTED); SendPdu(confirmPdu); if (bool.Parse(detectInfo.IsWindowsImplementation)) { RdpbcgrServerSessionContext orgSession = sessionContext; sessionContext = rdpbcgrServerStack.ExpectConnect(timeout); if (sessionContext.Identity == orgSession.Identity) { sessionContext = rdpbcgrServerStack.ExpectConnect(timeout); } x224ConnectionRequest = ExpectPacket <Client_X_224_Connection_Request_Pdu>(sessionContext, timeout); confirmPdu = rdpbcgrServerStack.CreateX224ConnectionConfirmPdu(sessionContext, selectedProtocols_Values.PROTOCOL_RDP_FLAG, RDP_NEG_RSP_flags_Values.DYNVC_GFX_PROTOCOL_SUPPORTED | RDP_NEG_RSP_flags_Values.EXTENDED_CLIENT_DATA_SUPPORTED); SendPdu(confirmPdu); } #endregion Connection Initial #region Basic Setting Exchange mscConnectionInitialPDU = ExpectPacket <Client_MCS_Connect_Initial_Pdu_with_GCC_Conference_Create_Request>(sessionContext, timeout); SERVER_CERTIFICATE cert = null; int certLen = 0; int dwKeysize = 2048; byte[] privateExp, publicExp, modulus; cert = rdpbcgrServerStack.GenerateCertificate(dwKeysize, out privateExp, out publicExp, out modulus); certLen = 120 + dwKeysize / 8; Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response connectRespPdu = rdpbcgrServerStack.CreateMCSConnectResponsePduWithGCCConferenceCreateResponsePdu( sessionContext, EncryptionMethods.ENCRYPTION_METHOD_128BIT, EncryptionLevel.ENCRYPTION_LEVEL_LOW, cert, certLen, MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDPFECL | MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDPFECR); SendPdu(connectRespPdu); sessionContext.ServerPrivateExponent = new byte[privateExp.Length]; Array.Copy(privateExp, sessionContext.ServerPrivateExponent, privateExp.Length); #endregion Basic Setting Exchange #region Channel Connection ExpectPacket <Client_MCS_Erect_Domain_Request>(sessionContext, timeout); ExpectPacket <Client_MCS_Attach_User_Request>(sessionContext, timeout); Server_MCS_Attach_User_Confirm_Pdu attachUserConfirmPdu = rdpbcgrServerStack.CreateMCSAttachUserConfirmPdu(sessionContext); SendPdu(attachUserConfirmPdu); //Join Channel int channelNum = 2; if (sessionContext.VirtualChannelIdStore != null) { channelNum += sessionContext.VirtualChannelIdStore.Length; } if (sessionContext.IsServerMessageChannelDataSend) { channelNum++; } for (int i = 0; i < channelNum; i++) { Client_MCS_Channel_Join_Request channelJoinPdu = ExpectPacket <Client_MCS_Channel_Join_Request>(sessionContext, timeout); Server_MCS_Channel_Join_Confirm_Pdu channelJoinResponse = rdpbcgrServerStack.CreateMCSChannelJoinConfirmPdu( sessionContext, channelJoinPdu.mcsChannelId); SendPdu(channelJoinResponse); } #endregion Channel Connection #region RDP Security Commencement securityExchangePDU = ExpectPacket <Client_Security_Exchange_Pdu>(sessionContext, timeout); #endregion RDP Security Commencement #region Secure Setting Exchange clientInfoPDU = ExpectPacket <Client_Info_Pdu>(sessionContext, timeout); #endregion Secure Setting Exchange #region Licensing Server_License_Error_Pdu_Valid_Client licensePdu = rdpbcgrServerStack.CreateLicenseErrorMessage(sessionContext); SendPdu(licensePdu); #endregion Licensing #region Capabilities Exchange RdpbcgrCapSet capSet = new RdpbcgrCapSet(); capSet.GenerateCapabilitySets(); Server_Demand_Active_Pdu demandActivePdu = rdpbcgrServerStack.CreateDemandActivePdu(sessionContext, capSet.CapabilitySets); SendPdu(demandActivePdu); confirmActivePDU = ExpectPacket <Client_Confirm_Active_Pdu>(sessionContext, timeout); clientCapSet = new RdpbcgrCapSet(); clientCapSet.CapabilitySets = confirmActivePDU.confirmActivePduData.capabilitySets; #endregion Capabilities Exchange #region Connection Finalization ExpectPacket <Client_Synchronize_Pdu>(sessionContext, timeout); Server_Synchronize_Pdu synchronizePdu = rdpbcgrServerStack.CreateSynchronizePdu(sessionContext); SendPdu(synchronizePdu); Server_Control_Pdu controlCooperatePdu = rdpbcgrServerStack.CreateControlCooperatePdu(sessionContext); SendPdu(controlCooperatePdu); ExpectPacket <Client_Control_Pdu_Cooperate>(sessionContext, timeout); ExpectPacket <Client_Control_Pdu_Request_Control>(sessionContext, timeout); Server_Control_Pdu controlGrantedPdu = rdpbcgrServerStack.CreateControlGrantedPdu(sessionContext); SendPdu(controlGrantedPdu); ITsCapsSet cap = this.clientCapSet.FindCapSet(capabilitySetType_Values.CAPSTYPE_BITMAPCACHE_REV2); if (cap != null) { TS_BITMAPCACHE_CAPABILITYSET_REV2 bitmapCacheV2 = (TS_BITMAPCACHE_CAPABILITYSET_REV2)cap; if ((bitmapCacheV2.CacheFlags & CacheFlags_Values.PERSISTENT_KEYS_EXPECTED_FLAG) != 0) { ExpectPacket <Client_Persistent_Key_List_Pdu>(sessionContext, timeout); } } ExpectPacket <Client_Font_List_Pdu>(sessionContext, timeout); Server_Font_Map_Pdu fontMapPdu = rdpbcgrServerStack.CreateFontMapPdu(sessionContext); SendPdu(fontMapPdu); #endregion Connection Finalization // Init for RDPEDYC try { rdpedycServer = new RdpedycServer(rdpbcgrServerStack, sessionContext); rdpedycServer.ExchangeCapabilities(timeout); } catch (Exception) { rdpedycServer = null; } }
public void S6_AutoDetect_PositiveTest_ConnectTimeAutoDetect() { #region Test Steps //1. Initiate an RDP connection to RDP server (SUT) and complete the Connection Initiation phase, Basic Setting Exchange phase, Channel Connection phase, RDP Security Commencement phase, Secure Setting Exchange Phase. Verify that the server support auto detect and advise the client’s support of auto detect. //2. During connect time auto detect phase, test suite expects and verifies a Server Auto-Detect Request PDU: // If the request contains a RDP_RTT_REQUEST, the test suite reply a Client Auto-Detect Response PDU with RDP_RTT_RESPONSE, then repeat step 2. // If the request contains a RDP_BW_START, the test suite start a bandwidth count, then repeat step 2. // If the request contains a RDP_BW_PAYLOAD, the test suite add bytes to bandwidth count, then repeat step 2. // If the request contains a RDP_BW_STOP, the test suite reply a Client Auto-Detect Response PDU with RDP_BW_RESULTS, then repeat step 2. // If the request contains a RDP_NETCHAR_RESULT, stop the test run. #endregion Test Steps #region Test Code this.Site.Log.Add(LogEntryKind.Comment, "To test auto detect, the RDP server should be configured to support auto-detect."); this.Site.Log.Add(LogEntryKind.Comment, "Establish transport connection with RDP Server, encrypted protocol is {0}.", transportProtocol.ToString()); rdpbcgrAdapter.ConnectToServer(this.transportProtocol); #region Connection Initiation this.Site.Log.Add(LogEntryKind.Comment, "Send a Client X.224 Connection Request PDU to SUT, supported security protocol is {0}.", requestProtocol.ToString()); rdpbcgrAdapter.SendClientX224ConnectionRequest(NegativeType.None, requestProtocol); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server X224 Connection Confirm."); Server_X_224_Connection_Confirm_Pdu confirmPdu = rdpbcgrAdapter.ExpectPacket <Server_X_224_Connection_Confirm_Pdu>(timeout); this.Site.Assert.IsNotNull(confirmPdu, "RDP Server MUST response a Server X224 Connection Confirm PDU after receiving a Client X224 Connection Request PDU."); #endregion Connection Initiation #region Basic Setting Exchange string[] SVCNames = new string[] { RdpConstValue.SVCNAME_RDPEDYC }; bool supportMultitransportReliable = false; bool supportMultitransportLossy = false; this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Connect Initial PDU with GCC Conference Create Request to SUT, supportMultitransportReliable is {0}, supportMultitransportLossy is {1}.", supportMultitransportReliable, supportMultitransportLossy); rdpbcgrAdapter.SendClientMCSConnectInitialPDU(NegativeType.None, SVCNames, true, true, true, supportMultitransportReliable, supportMultitransportLossy, false); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server MCS Connect Response PDU with GCC Conference Create Response."); Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response response = rdpbcgrAdapter.ExpectPacket <Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response>(timeout); this.Site.Assert.IsNotNull(confirmPdu, "RDP Server MUST response a Server MCS Connect Response after receiving a Client MCS Connect Initial PDU."); #endregion Basic Setting Exchange #region Channel Connection this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Erect Domain Request PDU to SUT."); rdpbcgrAdapter.SendClientMCSErectDomainRequest(NegativeType.None); this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Attach User Request PDU to SUT."); rdpbcgrAdapter.SendClientMCSAttachUserRequest(NegativeType.None); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server MCS Attach User Confirm PDU."); Server_MCS_Attach_User_Confirm_Pdu attachuserConfirm = rdpbcgrAdapter.ExpectPacket <Server_MCS_Attach_User_Confirm_Pdu>(timeout); this.Site.Assert.IsNotNull(attachuserConfirm, "RDP Server MUST response a Server MCS Attach User Confirm PDU after receiving a Client MCS Attach User Request PDU."); this.Site.Log.Add(LogEntryKind.Comment, "The test suite proceeds to join the user channel, the input/output (I/O) channel, and all of the static virtual channels."); rdpbcgrAdapter.ChannelJoinRequestAndConfirm(); #endregion Channel Connection #region Security Commencement phase / Secure Setting Exchange Phase if (requestProtocol == requestedProtocols_Values.PROTOCOL_RDP_FLAG) { this.Site.Log.Add(LogEntryKind.Comment, "Standard RDP Security mechanisms are being employed, Test Suite sends a Client Security Exchange PDU to SUT."); rdpbcgrAdapter.SendClientSecurityExchangePDU(NegativeType.None); } this.Site.Log.Add(LogEntryKind.Comment, "Send a Client Info PDU."); rdpbcgrAdapter.SendClientInfoPDU(NegativeType.None, CompressionType.PACKET_COMPR_TYPE_RDP61, false); #endregion Security Commencement phase / Secure Setting Exchange Phase this.Site.Log.Add(LogEntryKind.Comment, "Process network auto detect phase."); rdpbcgrAdapter.ProcessAutoDetectSequence(); #endregion Test Code }
public void S7_MultitransportBootstrapping_PositiveTest() { #region Test Steps //1. Initiate an RDP connection to RDP server (SUT) and complete the Connection Initiation phase, Basic Setting Exchange phase, Channel Connection phase, RDP Security Commencement phase, Secure Setting Exchange Phase and Licensing phase. Indicate support for both reliable and lossy multitransport in basic setting exchange phase. //2. Test Suite expects a Server Initiate Multitransport Request PDU with requestedProtocol set to INITITATE_REQUEST_PROTOCOL_UDPFECR (0x01). When received, Test Suite verifies this PDU. //3. Test Suite expects a Server Initiate Multitransport Request PDU with requestedProtocol set to INITITATE_REQUEST_PROTOCOL_UDPFECL (0x02). When received, Test Suite verifies this PDU. #endregion Test Steps #region Test Code this.Site.Log.Add(LogEntryKind.Comment, "Establish transport connection with RDP Server, encrypted protocol is {0}.", testConfig.transportProtocol.ToString()); rdpbcgrAdapter.ConnectToServer(testConfig.transportProtocol); #region Connection Initiation this.Site.Log.Add(LogEntryKind.Comment, "Send a Client X.224 Connection Request PDU to SUT, supported security protocol is {0}.", testConfig.requestProtocol.ToString()); rdpbcgrAdapter.SendClientX224ConnectionRequest(NegativeType.None, testConfig.requestProtocol); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server X224 Connection Confirm."); Server_X_224_Connection_Confirm_Pdu confirmPdu = rdpbcgrAdapter.ExpectPacket <Server_X_224_Connection_Confirm_Pdu>(testConfig.timeout); this.Site.Assert.IsNotNull(confirmPdu, "RDP Server MUST response a Server X224 Connection Confirm PDU after receiving a Client X224 Connection Request PDU."); #endregion Connection Initiation #region Basic Setting Exchange string[] SVCNames = new string[] { RdpConstValue.SVCNAME_RDPEDYC }; bool supportMultitransportReliable = true; bool supportMultitransportLossy = true; this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Connect Initial PDU with GCC Conference Create Request to SUT, supportMultitransportReliable is {0}, supportMultitransportLossy is {1}.", supportMultitransportReliable, supportMultitransportLossy); rdpbcgrAdapter.SendClientMCSConnectInitialPDU(NegativeType.None, SVCNames, false, false, false, supportMultitransportReliable, supportMultitransportLossy, false); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server MCS Connect Response PDU with GCC Conference Create Response."); Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response response = rdpbcgrAdapter.ExpectPacket <Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response>(testConfig.timeout); this.Site.Assert.IsNotNull(confirmPdu, "RDP Server MUST response a Server MCS Connect Response after receiving a Client MCS Connect Initial PDU."); bool serverSupportUDPFECR = false; bool serverSupportUDPFECL = false; if (response.mcsCrsp.gccPdu.serverMultitransportChannelData != null) { if (response.mcsCrsp.gccPdu.serverMultitransportChannelData.flags.HasFlag(MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDPFECR)) { serverSupportUDPFECR = true; } if (response.mcsCrsp.gccPdu.serverMultitransportChannelData.flags.HasFlag(MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDPFECL)) { serverSupportUDPFECL = true; } } this.Site.Assume.IsTrue(serverSupportUDPFECR || serverSupportUDPFECL, "To run test case for multitransport, the RDP server should be configured to support RDP-UDP: reliable, lossy, or both."); #endregion Basic Setting Exchange #region Channel Connection this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Erect Domain Request PDU to SUT."); rdpbcgrAdapter.SendClientMCSErectDomainRequest(NegativeType.None); this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Attach User Request PDU to SUT."); rdpbcgrAdapter.SendClientMCSAttachUserRequest(NegativeType.None); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server MCS Attach User Confirm PDU."); Server_MCS_Attach_User_Confirm_Pdu attachuserConfirm = rdpbcgrAdapter.ExpectPacket <Server_MCS_Attach_User_Confirm_Pdu>(testConfig.timeout); this.Site.Assert.IsNotNull(attachuserConfirm, "RDP Server MUST response a Server MCS Attach User Confirm PDU after receiving a Client MCS Attach User Request PDU."); this.Site.Log.Add(LogEntryKind.Comment, "The test suite proceeds to join the user channel, the input/output (I/O) channel, and all of the static virtual channels."); rdpbcgrAdapter.ChannelJoinRequestAndConfirm(); #endregion Channel Connection if (testConfig.requestProtocol == requestedProtocols_Values.PROTOCOL_RDP_FLAG) { this.Site.Log.Add(LogEntryKind.Comment, "Standard RDP Security mechanisms are being employed, Test Suite sends a Client Security Exchange PDU to SUT."); rdpbcgrAdapter.SendClientSecurityExchangePDU(NegativeType.None); } this.Site.Log.Add(LogEntryKind.Comment, "Send a Client Info PDU."); rdpbcgrAdapter.SendClientInfoPDU(NegativeType.None, CompressionType.PACKET_COMPR_TYPE_RDP61, false); rdpbcgrAdapter.ProcessLicenseSequence(testConfig.timeout); bool receivedServerInitiateMultitransportRequestForReliable = false; bool receivedServerInitiateMultitransportRequestForLossy = false; int expectedServerInitiateMultitransportRequestNum = 1; if (serverSupportUDPFECR && serverSupportUDPFECL) { expectedServerInitiateMultitransportRequestNum = 2; } for (int i = 0; i < expectedServerInitiateMultitransportRequestNum; i++) { Server_Initiate_Multitransport_Request_PDU request = rdpbcgrAdapter.ExpectPacket <Server_Initiate_Multitransport_Request_PDU>(testConfig.timeout); Site.Assert.IsNotNull(request, "RDP Server MUST send Server_Initiate_Multitransport_Request_PDU packet to initiate multiple transport."); if (request.requestedProtocol == Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECR) { receivedServerInitiateMultitransportRequestForReliable = true; } else if (request.requestedProtocol == Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECL) { receivedServerInitiateMultitransportRequestForLossy = true; } } if (serverSupportUDPFECR) { Site.Assert.IsTrue(receivedServerInitiateMultitransportRequestForReliable, "RDP Server MUST send Server_Initiate_Multitransport_Request_PDU packets for reliable multitransport."); } if (serverSupportUDPFECL) { Site.Assert.IsTrue(receivedServerInitiateMultitransportRequestForLossy, "RDP Server MUST send Server_Initiate_Multitransport_Request_PDU packets for lossy multitransport."); } #endregion Test Code }
private void StartRDPConnect() { this.Site.Log.Add(LogEntryKind.Comment, "Establish transport connection with RDP Server, encrypted protocol is {0}.", transportProtocol.ToString()); rdpbcgrAdapter.ConnectToServer(this.transportProtocol); #region Connection Initiation this.Site.Log.Add(LogEntryKind.Comment, "Send a Client X.224 Connection Request PDU to SUT, supported security protocol is {0}.", requestProtocol.ToString()); rdpbcgrAdapter.SendClientX224ConnectionRequest(Rdpbcgr.NegativeType.None, requestProtocol); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server X224 Connection Confirm."); Server_X_224_Connection_Confirm_Pdu confirmPdu = rdpbcgrAdapter.ExpectPacket <Server_X_224_Connection_Confirm_Pdu>(timeout); this.Site.Assert.IsNotNull(confirmPdu, "RDP Server MUST response a Server X224 Connection Confirm PDU after receiving a Client X224 Connection Request PDU."); #endregion Connection Initiation #region Basic Setting Exchange string[] SVCNames = new string[] { RdpConstValue.SVCNAME_RDPEDYC }; bool supportMultitransportReliable = true; bool supportMultitransportLossy = true; this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Connect Initial PDU with GCC Conference Create Request to SUT, supportMultitransportReliable is {0}, supportMultitransportLossy is {1}.", supportMultitransportReliable, supportMultitransportLossy); rdpbcgrAdapter.SendClientMCSConnectInitialPDU(Rdpbcgr.NegativeType.None, SVCNames, false, false, false, supportMultitransportReliable, supportMultitransportLossy, false); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server MCS Connect Response PDU with GCC Conference Create Response."); Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response response = rdpbcgrAdapter.ExpectPacket <Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response>(timeout); this.Site.Assert.IsNotNull(confirmPdu, "RDP Server MUST response a Server MCS Connect Response after receiving a Client MCS Connect Initial PDU."); serverSupportUDPFECR = false; serverSupportUDPFECL = false; if (response.mcsCrsp.gccPdu.serverMultitransportChannelData != null) { if (response.mcsCrsp.gccPdu.serverMultitransportChannelData.flags.HasFlag(MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDPFECR)) { serverSupportUDPFECR = true; } if (response.mcsCrsp.gccPdu.serverMultitransportChannelData.flags.HasFlag(MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDPFECL)) { serverSupportUDPFECL = true; } } this.Site.Assume.IsTrue(serverSupportUDPFECR || serverSupportUDPFECL, "To run test case for multitransport, the RDP server should be configured to support RDP-UDP: reliable, lossy, or both."); #endregion Basic Setting Exchange #region Channel Connection this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Erect Domain Request PDU to SUT."); rdpbcgrAdapter.SendClientMCSErectDomainRequest(Rdpbcgr.NegativeType.None); this.Site.Log.Add(LogEntryKind.Comment, "Send a Client MCS Attach User Request PDU to SUT."); rdpbcgrAdapter.SendClientMCSAttachUserRequest(Rdpbcgr.NegativeType.None); this.Site.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Server MCS Attach User Confirm PDU."); Server_MCS_Attach_User_Confirm_Pdu attachuserConfirm = rdpbcgrAdapter.ExpectPacket <Server_MCS_Attach_User_Confirm_Pdu>(timeout); this.Site.Assert.IsNotNull(attachuserConfirm, "RDP Server MUST response a Server MCS Attach User Confirm PDU after receiving a Client MCS Attach User Request PDU."); this.Site.Log.Add(LogEntryKind.Comment, "The test suite proceeds to join the user channel, the input/output (I/O) channel, and all of the static virtual channels."); rdpbcgrAdapter.ChannelJoinRequestAndConfirm(); #endregion Channel Connection if (requestProtocol == requestedProtocols_Values.PROTOCOL_RDP_FLAG) { this.Site.Log.Add(LogEntryKind.Comment, "Standard RDP Security mechanisms are being employed, Test Suite sends a Client Security Exchange PDU to SUT."); rdpbcgrAdapter.SendClientSecurityExchangePDU(Rdpbcgr.NegativeType.None); } this.Site.Log.Add(LogEntryKind.Comment, "Send a Client Info PDU."); rdpbcgrAdapter.SendClientInfoPDU(Rdpbcgr.NegativeType.None, CompressionType.PACKET_COMPR_TYPE_RDP61, false); Server_License_Error_Pdu_Valid_Client licenseErrorPdu = rdpbcgrAdapter.ExpectPacket <Server_License_Error_Pdu_Valid_Client>(timeout); this.Site.Assert.IsNotNull(licenseErrorPdu, "RDP Server MUST send a Server License Error PDU during Licensing phase."); }