public void RDPEGFX_Segmentation_Negative_SingleSegmentWithSegmentArray()
        {
            this.TestSite.Log.Add(LogEntryKind.Debug, "Establishing RDP connection ...");
            StartRDPConnection();

            this.TestSite.Log.Add(LogEntryKind.Debug, "Creating dynamic virtual channels for MS-RDPEGFX ...");
            bool bProtocolSupported = this.rdpegfxAdapter.ProtocolInitialize(this.rdpedycServer);

            TestSite.Assert.IsTrue(bProtocolSupported, "Client should support this protocol.");

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting capability advertise from client.");
            RDPGFX_CAPS_ADVERTISE capsAdv = this.rdpegfxAdapter.ExpectCapabilityAdvertise();

            this.TestSite.Assert.IsNotNull(capsAdv, "RDPGFX_CAPS_ADVERTISE is received.");

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.Segmentation_SingleSegment_WithSegmentArray);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.Segmentation_SingleSegment_WithSegmentArray);

            // Set first capset in capability advertise request, if no capdata in request, use default flag.
            CapsFlags capFlag = CapsFlags.RDPGFX_CAPS_FLAG_DEFAULT;

            if (capsAdv.capsSetCount > 0)
            {
                capFlag = (CapsFlags)BitConverter.ToUInt32(capsAdv.capsSets[0].capsData, 0);
            }
            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending capability confirm message with single segment with SegmentArray field to client.");
            this.rdpegfxAdapter.SendCapabilityConfirm(capFlag);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect SUT to drop the connection");
            bool bDisconnected = this.rdpbcgrAdapter.WaitForDisconnection(waitTime);

            this.TestSite.Assert.IsTrue(bDisconnected, "RDP client should terminate the connection when invalid message received.");
        }
        public void RDPEGFX_Segmentation_Negative_UncompressedNoSegmentHeader()
        {
            this.TestSite.Log.Add(LogEntryKind.Debug, "Establishing RDP connection ...");
            StartRDPConnection();

            this.TestSite.Log.Add(LogEntryKind.Debug, "Creating dynamic virtual channels for MS-RDPEGFX ...");
            bool bProtocolSupported = this.rdpegfxAdapter.ProtocolInitialize(this.rdpedycServer);

            this.TestSite.Assert.IsTrue(bProtocolSupported, "Client should support this protocol.");

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting capability advertise from client.");
            RDPGFX_CAPS_ADVERTISE capsAdv = this.rdpegfxAdapter.ExpectCapabilityAdvertise();

            this.TestSite.Assert.IsNotNull(capsAdv, "RDPGFX_CAPS_ADVERTISE is received.");

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.Segmentation_Uncompressed_NoSegmentHeader);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.Segmentation_Uncompressed_NoSegmentHeader);

            // Set first capset in capability advertise request, if no capdata in request, use default flag.
            CapsFlags capFlag = CapsFlags.RDPGFX_CAPS_FLAG_DEFAULT;

            if (capsAdv.capsSetCount > 0)
            {
                capFlag = (CapsFlags)BitConverter.ToUInt32(capsAdv.capsSets[0].capsData, 0);
            }
            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending capability confirm message not using RDP 8.0 compression technology without segment header to client.");
            this.rdpegfxAdapter.SendCapabilityConfirm(capFlag);

            RDPClientTryDropConnection("capability confirm message without RDP 8.0 compression technology without segment header");
        }
        public void RDPEGFX_CapabilityExchange_PositiveTest()
        {
            this.TestSite.Log.Add(LogEntryKind.Debug, "Establishing RDP connection ...");
            StartRDPConnection();

            this.TestSite.Log.Add(LogEntryKind.Debug, "Creating dynamic virtual channels for MS-RDPEGFX ...");
            bool bProtocolSupported = this.rdpegfxAdapter.ProtocolInitialize(this.rdpedycServer);

            this.TestSite.Assert.IsTrue(bProtocolSupported, "Client should support this protocol.");

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting capability advertise from client.");
            RDPGFX_CAPS_ADVERTISE capsAdv = this.rdpegfxAdapter.ExpectCapabilityAdvertise();

            this.TestSite.Assert.IsNotNull(capsAdv, "RDPGFX_CAPS_ADVERTISE is received.");

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending capability confirm to client.");
            // Set first capset in capability advertise request, if no capdata in request, use default flag.
            CapsFlags capFlag = CapsFlags.RDPGFX_CAPS_FLAG_DEFAULT;

            if (capsAdv.capsSetCount > 0)
            {
                capFlag = (CapsFlags)BitConverter.ToUInt32(capsAdv.capsSets[0].capsData, 0);
            }
            this.rdpegfxAdapter.SendCapabilityConfirm(capFlag);
        }
Exemple #4
0
 protected void Dispose(bool disposing)
 {
     Flags = CapsFlags.None;
     if (m_capsActive != null)
     {
         DeregisterHandlers();
         m_capsActive.Dispose();
         m_capsActive = null;
     }
 }
Exemple #5
0
        /// <summary>
        /// Method to do capability exchange with RDP client.
        /// This function is recommended to be called by other test cases to do capability exchange.
        /// </summary>
        private void RDPEGFX_CapabilityExchange(DynamicVC_TransportType transportType = DynamicVC_TransportType.RDP_TCP, bool isSoftSync = false)
        {
            this.TestSite.Log.Add(LogEntryKind.Debug, "Establishing RDP connection ...");
            StartRDPConnection(isSoftSync);

            this.TestSite.Log.Add(LogEntryKind.Debug, "Creating dynamic virtual channels for MS-RDPEGFX ...");
            bool bProtocolSupported = isSoftSync? InitializeForSoftSync(transportType) : this.rdpegfxAdapter.ProtocolInitialize(this.rdpedycServer, transportType);

            TestSite.Assert.IsTrue(bProtocolSupported, "Client should support this protocol.");

            this.TestSite.Log.Add(LogEntryKind.Debug, "Expecting capability advertise from client.");
            RDPGFX_CAPS_ADVERTISE capsAdv = this.rdpegfxAdapter.ExpectCapabilityAdvertise();

            this.TestSite.Assert.IsNotNull(capsAdv, "RDPGFX_CAPS_ADVERTISE is received.");

            this.isH264AVC420Supported = false;
            this.isH264AVC444Supported = false;
            this.isSmallCache          = false;

            this.TestSite.Log.Add(LogEntryKind.Debug, "Sending capability confirm to client.");
            // Set first capset in capability advertise request, if no capdata in request, use default flag.
            CapsFlags    capFlag = CapsFlags.RDPGFX_CAPS_FLAG_DEFAULT;
            CapsVersions version = CapsVersions.RDPGFX_CAPVERSION_8;

            if (capsAdv.capsSetCount > 0)
            {
                foreach (RDPGFX_CAPSET capSet in capsAdv.capsSets)
                {
                    CapsFlags flag = (CapsFlags)BitConverter.ToUInt32(capSet.capsData, 0);
                    if (capSet.version >= version)
                    {
                        version = capSet.version;
                        capFlag = flag;
                    }

                    if (capSet.version == CapsVersions.RDPGFX_CAPVERSION_81 &&
                        (flag & CapsFlags.RDPGFX_CAPS_FLAG_AVC420_ENABLED) == CapsFlags.RDPGFX_CAPS_FLAG_AVC420_ENABLED)
                    {
                        this.isH264AVC420Supported = true;
                    }
                    else if (capSet.version >= CapsVersions.RDPGFX_CAPVERSION_10 && //RDPGFX_CAPVERSION_10 and RDPGFX_CAPVERSION_102
                             (flag & CapsFlags.RDPGFX_CAPS_FLAG_AVC_DISABLED) == 0)
                    {
                        this.isH264AVC420Supported = true;
                        this.isH264AVC444Supported = true;
                    }

                    if ((flag & CapsFlags.RDPGFX_CAPS_FLAG_SMALL_CACHE) == CapsFlags.RDPGFX_CAPS_FLAG_SMALL_CACHE)
                    {
                        this.isSmallCache = true;
                    }
                }
            }
            this.rdpegfxAdapter.SendCapabilityConfirm(capFlag, version);
        }
        public void RDPEGFX_Segmentation_Positive_UncompressedSegmentHeader()
        {
            this.TestSite.Log.Add(LogEntryKind.Debug, "Establishing RDP connection ...");
            StartRDPConnection();

            this.TestSite.Log.Add(LogEntryKind.Debug, "Creating dynamic virtual channels for MS-RDPEGFX ...");
            bool bProtocolSupported = this.rdpegfxAdapter.ProtocolInitialize(this.rdpedycServer);

            this.TestSite.Assert.IsTrue(bProtocolSupported, "Client should support this protocol.");

            this.TestSite.Log.Add(LogEntryKind.Debug, "Expecting capability advertise from client.");
            RDPGFX_CAPS_ADVERTISE capsAdv = this.rdpegfxAdapter.ExpectCapabilityAdvertise();

            this.TestSite.Assert.IsNotNull(capsAdv, "RDPGFX_CAPS_ADVERTISE is received.");

            // Set the test type, based on the test type, all the messages in this test case will not use RDP 8.0 Bulk Compression techniques
            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.Segmentation_Uncompressed_WithSegmentHeader);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.Segmentation_Uncompressed_WithSegmentHeader);

            // Set first capset in capability advertise request, if no capdata in request, use default flag.
            CapsFlags capFlag = CapsFlags.RDPGFX_CAPS_FLAG_DEFAULT;

            if (capsAdv.capsSetCount > 0)
            {
                capFlag = (CapsFlags)BitConverter.ToUInt32(capsAdv.capsSets[0].capsData, 0);
            }
            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending capability confirm message not using RDP 8.0 compression technology to client.");
            this.rdpegfxAdapter.SendCapabilityConfirm(capFlag);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create a surface and fill it with green color.");
            // Create & output a surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            // Send solid fill request to client to fill surface with green color
            RDPGFX_RECT16 fillSurfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.imgPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);

            RDPGFX_RECT16[] fillRects = { fillSurfRect };  // Relative to surface
            uint            fid       = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, fillRects);

            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled with solid color in frame: {0}", fid);

            // Expect the client to send a frame acknowledge pdu
            // If the server receives the message, it indicates that the client has been successfully decoded the logical frame of graphics commands
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            // Delete the surface
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
        }
Exemple #7
0
        public void RDPEGFX_CacheManagement_Negative_Default_ExceedMaxCacheSize()
        {
            this.TestSite.Log.Add(LogEntryKind.Debug, "Establishing RDP connection ...");
            StartRDPConnection();

            this.TestSite.Log.Add(LogEntryKind.Debug, "Creating dynamic virtual channels for MS-RDPEGFX ...");
            bool bProtocolSupported = this.rdpegfxAdapter.ProtocolInitialize(this.rdpedycServer);

            TestSite.Assert.IsTrue(bProtocolSupported, "Client should support this protocol.");

            this.TestSite.Log.Add(LogEntryKind.Debug, "Expecting capability advertise from client.");
            RDPGFX_CAPS_ADVERTISE capsAdv = this.rdpegfxAdapter.ExpectCapabilityAdvertise();

            this.TestSite.Assert.IsNotNull(capsAdv, "RDPGFX_CAPS_ADVERTISE is received.");

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending capability confirm with default capability flag to client.");
            // Set capability flag to default, then the max cache size is 100MB
            CapsFlags capFlag = CapsFlags.RDPGFX_CAPS_FLAG_DEFAULT;

            this.rdpegfxAdapter.SendCapabilityConfirm(capFlag);

            // Create & output a surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.largeSurfWidth, RdpegfxTestUtility.largeSurfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_ARGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.CacheManagement_Default_ExceedMaxCacheSize);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.CacheManagement_Default_ExceedMaxCacheSize);

            // Send message to trigger client to allocate cache slots with cache size exceed the max value 100MB
            this.TestSite.Log.Add(LogEntryKind.Comment, "Trigger client to allocate cache slots with cache size exceeds the max value 100MB");
            try
            {
                this.rdpegfxAdapter.CacheSurface(surf, RdpegfxTestUtility.largeCacheRect, RdpegfxTestUtility.cacheKey, null, RdpegfxTestUtility.fillColorRed);
                //Expect the RDP client handle the negative request by dropping the connection as Windows does, or deny the request or ignore the request.
                RDPClientTryDropConnection("allocate cache slots with cache size exceeds the max value 100MB");
            }
            catch (Exception ex)
            {
                this.TestSite.Log.Add(LogEntryKind.CheckFailed, "SUT should terminate the connection, or deny the request, or ignore the request to create duplicated surface instead of throw out an exception: {0}.", ex.Message);
            }
        }
Exemple #8
0
        public Caps(IHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
                    UUID agent, string regionName)
        {
            m_capsObjectPath       = capsPath;
            m_httpListener         = httpServer;
            m_httpListenerHostName = httpListen;

            m_httpListenPort = httpPort;

            if (httpServer != null && httpServer.UseSSL)
            {
                m_httpListenPort = httpServer.SSLPort;
                httpListen       = httpServer.SSLCommonName;
                httpPort         = httpServer.SSLPort;
            }

            m_agentID      = agent;
            m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort);
            m_regionName   = regionName;
            Flags          = CapsFlags.None;
            m_capsActive.Reset();
        }
 /// <summary>
 /// Method to send a Capability Confirm to client.
 /// </summary> 
 /// <param name="capFlag">The valid rdpgfx_capset_version8 flag.</param>
 /// <param name="version">version of the capability</param>
 public void SendCapabilityConfirm(CapsFlags capFlag, CapsVersions version = CapsVersions.RDPGFX_CAPVERSION_8)
 {
     MakeCapabilityConfirmPdu(capFlag, version);
     PackAndSendServerPdu();
 }
        /// <summary>
        /// Method to make a Capability Confirm PDU.
        /// </summary>
        /// <param name="capFlag">The valid rdpgfx_capset_version8 flag.</param>
        /// <param name="version">version of the capability</param>
        void MakeCapabilityConfirmPdu(CapsFlags capFlag, CapsVersions version)
        {
            RDPGFX_CAPS_CONFIRM capsConfirm = egfxServer.CreateCapabilityConfirmPdu(capFlag, version);

            if (currentTestType == RdpegfxNegativeTypes.Capability_Incorrect_Version)
                capsConfirm.capsSet.version += 1;  // Set to an invalid value 1 more than 0x00080004.
            else if (currentTestType == RdpegfxNegativeTypes.Capability_Incorrect_CapsDatalength)
                capsConfirm.capsSet.capsDataLength = 0x01;  // Set to an invalid value 0x01.
            else if (currentTestType == RdpegfxNegativeTypes.SurfaceToScreen_Incorrect_PduLengthInHeader)
                capsConfirm.Header.pduLength = 0x00;        // Set to an invalid value 0x00.
            else if (currentTestType == RdpegfxNegativeTypes.Capability_InvalidCapFlag)
                capsConfirm.capsSet.capsData = BitConverter.GetBytes((uint)(0x03));  // 0x03 is an invalid cap flag.

            AddPdusToBuffer(capsConfirm);
        }
        /// <summary>
        /// Constructor, create a  version 8 capability confirm message.
        /// </summary>
        /// <param name="v8flag"> this is used to specify the flag of capability.</param>
        /// <param name="version">version of the capability</param>
        public RDPGFX_CAPS_CONFIRM(CapsFlags v8flag, CapsVersions version)
        {
            Header.cmdId = PacketTypeValues.RDPGFX_CMDID_CAPSCONFIRM;
            Header.flags = 0x0;

            capsSet.version = version;
            capsSet.capsDataLength = 0x04;
            capsSet.capsData = new byte[capsSet.capsDataLength];
            // Assign flag into the capsData structure(byte[]).
            capsSet.capsData = BitConverter.GetBytes((uint)v8flag);

            Header.pduLength = (uint)Marshal.SizeOf(Header) + 8 + capsSet.capsDataLength;
        }
        /// <summary>
        /// Create a Capability Confirm PDU.
        /// </summary>
        /// <param name="capFlag">The valid rdpgfx_capset_version8 flag.</param>
        /// <param name="version">version of the capability</param>
        public RDPGFX_CAPS_CONFIRM CreateCapabilityConfirmPdu(CapsFlags capFlag, CapsVersions version)
        {
            RDPGFX_CAPS_CONFIRM capsConfirm = new RDPGFX_CAPS_CONFIRM(capFlag, version);

            return(capsConfirm);
        }