/// <summary> /// Expect SUT start the channel join sequence /// </summary> public void ChannelJoinRequestAndConfirm(NegativeType invalidType) { int channelNum = 2; if (sessionContext.VirtualChannelIdStore != null) { channelNum += sessionContext.VirtualChannelIdStore.Length; } if (sessionContext.IsServerMessageChannelDataSend) channelNum++; for (int i = 0; i < channelNum; i++) { //Expect a Client MCS Channel Join Request PDU. ExpectPacket<Client_MCS_Channel_Join_Request>(sessionContext, pduWaitTimeSpan); //Respond a Server MCS Channel Join Confirm PDU. MCSChannelJoinConfirm(lastRequestJoinChannelId, invalidType); if (invalidType != NegativeType.None) { //Expect SUT to drop the connection this.site.Log.Add(LogEntryKind.Comment, "Expect SUT to drop the connection"); this.WaitForDisconnection(pduWaitTimeSpan); break; } } }
/// <summary> /// Expect SUT start the channel join sequence /// </summary> public void ChannelJoinRequestAndConfirm(NegativeType invalidType) { int channelNum = 2; if (sessionContext.VirtualChannelIdStore != null) { channelNum += sessionContext.VirtualChannelIdStore.Length; } if (sessionContext.IsServerMessageChannelDataSend) { channelNum++; } for (int i = 0; i < channelNum; i++) { //Expect a Client MCS Channel Join Request PDU. ExpectPacket <Client_MCS_Channel_Join_Request>(sessionContext, pduWaitTimeSpan); //Respond a Server MCS Channel Join Confirm PDU. MCSChannelJoinConfirm(lastRequestJoinChannelId, invalidType); if (invalidType != NegativeType.None) { //Expect SUT to drop the connection this.site.Log.Add(LogEntryKind.Comment, "Expect SUT to drop the connection"); this.WaitForDisconnection(pduWaitTimeSpan); break; } } }
public Client_MCS_Erect_Domain_Request_Ex(Client_MCS_Erect_Domain_Request originalPacket, RdpbcgrClientContext clientContext, NegativeType invalidType) : base(clientContext) { this.tpktHeader = originalPacket.tpktHeader; this.x224Data = originalPacket.x224Data; this.subHeight = originalPacket.subHeight; this.subInterval = originalPacket.subInterval; this.invalidType = invalidType; }
/// <summary> /// Generate static virtual channel traffics /// </summary> /// <param name="invalidType">Invalid Type used for negative test case</param> public void GenerateStaticVirtualChannelTraffics(NegativeType invalidType) { if (rdpbcgrClientStack.Context.SVCManager == null) { Site.Assume.Fail("SVC Manager must be created before generate static virtual channel data."); } StaticVirtualChannel RDPEDYCChannel = rdpbcgrClientStack.Context.SVCManager.GetChannelByName(SVCNameForRDPEDYC); if (RDPEDYCChannel == null) { Site.Assume.Fail("Static virtual channel: {0} must be created.", SVCNameForRDPEDYC); } ushort channelId = RDPEDYCChannel.ChannelId; // Expect a RDPEDYC caps request PDU Virtual_Channel_RAW_Server_Pdu svcPdu = this.ExpectPacket <Virtual_Channel_RAW_Server_Pdu>(pduWaitTimeSpan); if (svcPdu == null) { Site.Assert.Fail("Timeout when receiving RDPEDYC static virtual channel data."); } ClientDecodingPduBuilder decoder = new ClientDecodingPduBuilder(); PduBuilder pduBuilder = new PduBuilder(); DynamicVCPDU pdu = decoder.ToPdu(svcPdu.virtualChannelData); if (pdu == null) { Site.Assert.Fail("Received static virtual channel data must be a DVC Capabilities Request PDU!"); } DYNVC_CAPS_Version version = DYNVC_CAPS_Version.VERSION3; if (pdu is CapsVer1ReqDvcPdu) { version = DYNVC_CAPS_Version.VERSION1; } else if (pdu is CapsVer2ReqDvcPdu) { version = DYNVC_CAPS_Version.VERSION2; } // Response a RDPEDYC caps response PDU CapsRespDvcPdu capResp = pduBuilder.CreateCapsRespPdu((ushort)version); SendVirtualChannelPDU(channelId, pduBuilder.ToRawData(capResp), invalidType); }
/// <summary> /// Send Tunnel Create Request PDU to server. /// </summary> /// <param name="negativeType">The negative type want to test.</param> /// <param name="requestedProtocol">The request multitransport protocol.</param> public void SendTunnelCreateRequest(NegativeType negativeType, Multitransport_Protocol_value requestedProtocol) { var serverInitiateMultitransportRequestPDU = serverInitiateMultitransportRequestPDUs[requestedProtocol]; uint requestId = serverInitiateMultitransportRequestPDU.requestId; var securityCookie = serverInitiateMultitransportRequestPDU.securityCookie; bool modifyRequestID = false; bool modifySecurityCookie = false; switch (negativeType) { case NegativeType.TunnelCreateRequest_InvalidRequestID: modifyRequestID = true; break; case NegativeType.TunnelCreateRequest_InvalidSecurityCookie: modifySecurityCookie = true; break; case NegativeType.TunnelCreateRequest_InvalidRequestIDAndSecurityCookie: modifyRequestID = true; modifySecurityCookie = true; break; } if (modifyRequestID) { requestId = (uint)RequestID_Values.Invalid; } if (modifySecurityCookie) { securityCookie = securityCookie.Select(x => (byte)~x).ToArray(); } var createTunnelCreateRequestPDU = rdpemtClients[requestedProtocol].CreateTunnelCreateRequest(requestId, securityCookie); rdpemtClients[requestedProtocol].SendRdpemtPacket(createTunnelCreateRequestPDU); }
/// <summary> /// Start a server Initiated disconnection sequence /// </summary> /// <param name="sendDisonnectPdu">Indicates if server send MCS Disconnect Provider Ultimatum PDU to client.</param> /// <param name="adminInitiated">Indicates it's an Administrator-Initiated disconnection or User-Initiated disconnection.</param> /// <param name="invalidType">Indicates the invalid type for negative cases</param> public void ServerInitiatedDisconnect(bool sendDisonnectPdu, bool adminInitiated, NegativeType invalidType) { ServerDeactivateAll(); if (sendDisonnectPdu) { Server_MCSDisconnectProviderUltimatum(adminInitiated, invalidType); } rdpbcgrServerStack.Disconnect(sessionContext); sessionState = ServerSessionState.TransportConnected; }
private void ConnectionInitiationTest(NegativeType negativeType) { Site.Log.Add(LogEntryKind.TestStep, "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."); StartRDPConnect(); Site.Log.Add(LogEntryKind.TestStep, "2. Test Suite expects the Server Initiate Multitransport Request PDUs with requestedProtocol supported by SUT. When received, Test Suite verifies this PDUs."); var serverInitiateMultitransportRequestPDUs = ExpectServerInitiateMultitransportRequestPDUs(); Site.Log.Add(LogEntryKind.TestStep, "3. Start the underlying multitransport connect with SUT."); rdpemtAdapter.StartMultitransportConnect(serverInitiateMultitransportRequestPDUs.ToArray()); Site.Log.Add(LogEntryKind.TestStep, "4. Send the Tunnel Create Request PDU to SUT with invalid RequestID."); foreach (var pdu in serverInitiateMultitransportRequestPDUs) { rdpemtAdapter.SendTunnelCreateRequest(negativeType, pdu.requestedProtocol); } var responses = new List <RDP_TUNNEL_CREATERESPONSE>(); foreach (var pdu in serverInitiateMultitransportRequestPDUs) { var response = rdpemtAdapter.ExpectTunnelCreateResponse(pdu.requestedProtocol); responses.Add(response); } if (negativeType == NegativeType.None) { Site.Log.Add(LogEntryKind.TestStep, "5. Expect the Tunnel Create Response from SUT and verify."); foreach (var response in responses) { Site.Log.Add(LogEntryKind.Comment, "If a match for the RequestID and SecurityCookie pair is found on the server for a pending multitransport request, the server associates the incoming multitransport connection with the existing session and MUST send the client an RDP_TUNNEL_CREATERESPONSE PDU with a successful HRESULT code."); if (testConfig.isWindowsImplementation) { Site.Log.Add(LogEntryKind.Comment, "Windows always sends an HrResponse code of S_OK (0x0) if the connection is accepted"); Site.Assert.AreEqual((uint)HrResponse_Value.S_OK, response.HrResponse, "SUT return HRESULT code S_OK."); } else { bool isSuccess = (response.HrResponse & (uint)HRESULT.S) == 0; Site.Assert.IsTrue(isSuccess, "SUT returned a successful HRESULT code."); } } } else { Site.Log.Add(LogEntryKind.TestStep, "5. Expect SUT will either close the connection or respond Tunnel Create Response with HRESULT code indicating failure."); foreach (var response in responses) { Site.Log.Add(LogEntryKind.Comment, "If a match is not found, the server can either close the connection to the client or send an RDP_TUNNEL_CREATERESPONSE PDU with an unsuccessful HRESULT code."); if (testConfig.isWindowsImplementation) { Site.Log.Add(LogEntryKind.Comment, "Windows closes the connection to the client if a successful match is not found."); Site.Assert.IsNull(response, "SUT closed the underlying connection."); } else { if (response == null) { Site.Assert.Pass("SUT closed the underlying connection."); } else { bool isSuccess = (response.HrResponse & (uint)HRESULT.S) == 0; Site.Assert.IsFalse(isSuccess, "SUT returned an unsuccessful HRESULT code."); } } } } }
public Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response_Ex(Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response orgPdu, RdpbcgrServerSessionContext serverSessionContext, NegativeType invalidType) : base(serverSessionContext) { this.tpktHeader = orgPdu.tpktHeader; this.x224Data = orgPdu.x224Data; this.mcsCrsp = orgPdu.mcsCrsp; this.invalidType = invalidType; }