private bool rdprfxNegativeTest(RdprfxNegativeType negType)
        {
            StartRDPConnection();

            this.rdprfxAdapter.SetTestType(negType);

            #region Fill parameters
            TS_RFX_ICAP[] clientSupportedCaps;
            rdprfxAdapter.ReceiveAndCheckClientCapabilities(maxRequestSize, out clientSupportedCaps);

            OperationalMode  opMode      = OperationalMode.ImageMode;
            EntropyAlgorithm enAlgorithm = EntropyAlgorithm.CLW_ENTROPY_RLGR3;
            ushort           destLeft    = 0; //the left bound of the frame.
            ushort           destTop     = 0; //the top bound of the frame.

            //Set OperationalMode/EntropyAlgorithm to valid pair.
            if (clientSupportedCaps != null)
            {
                opMode      = (OperationalMode)clientSupportedCaps[0].flags;
                enAlgorithm = (EntropyAlgorithm)clientSupportedCaps[0].entropyBits;
            }
            #endregion

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending one frame of encoded bitmap data to client. Operational Mode = {0}, Entropy Algorithm = {1}, destLeft = {2}, destTop = {3}.",
                                  opMode, enAlgorithm, destLeft, destTop);
            this.rdprfxAdapter.SendImageToClient(image_64X64, opMode, enAlgorithm, destLeft, destTop);

            bool fDisconnected = this.rdpbcgrAdapter.WaitForDisconnection(waitTime);

            StopRDPConnection();

            return(fDisconnected);
        }
        /// <summary>
        /// Method to send one frame of encoded data message to client.
        /// </summary>
        /// <param name="image">The image to be sent.</param>
        /// <param name="opMode">Indicates the operational mode.</param>
        /// <param name="entropy">Indicates the entropy algorithm.</param>
        /// <param name="destLeft">Left bound of the frame.</param>
        /// <param name="destTop">Left bound of the frame.</param>
        public void SendImageToClient(System.Drawing.Image image, OperationalMode opMode, EntropyAlgorithm entropy, ushort destLeft, ushort destTop)
        {
            if (image == null)
            {
                Site.Log.Add(LogEntryKind.Debug, "[In iRdprfxAdapter.SendImageToClient Method] The image to be send is null.");
                return;
            }

            TileImage[] tileImageArr = RdprfxTileUtils.SplitToTileImage(image, RdprfxServer.TileSize, RdprfxServer.TileSize);

            for (int idx = 0; idx < tileImageArr.Length; idx++)
            {
                if (idx == 0 || opMode == OperationalMode.ImageMode)
                {
                    SendTsRfxSync();
                    SendTsRfxCodecVersions();
                    SendTsRfxChannels();
                    SendTsRfxContext(opMode, entropy);
                }
                SendTsRfxFrameBegin((uint)idx);
                SendTsRfxRegion();
                SendTsRfxTileSet(opMode, entropy, tileImageArr[idx].image);
                SendTsRfxFrameEnd();
                FlushEncodedData((ushort)(destLeft + tileImageArr[idx].x), (ushort)(destTop + tileImageArr[idx].y));
                if (currentTestType != RdprfxNegativeType.None)
                {
                    // Only send one message if it is in a negative test case.
                    break;
                }
            }
        }
        /// <summary>
        /// Method to create TS_RFX_CONTEXT.
        /// </summary>
        /// <param name="isImageMode">Indicates the operational mode.</param>
        /// <param name="entropy">Indicates the entropy algorithm.</param>
        public TS_RFX_CONTEXT CreateTsRfxContext(OperationalMode opMode, EntropyAlgorithm entropy)
        {
            TS_RFX_CONTEXT rfxContext = new TS_RFX_CONTEXT();
            rfxContext.CodecChannelT = new TS_RFX_CODEC_CHANNELT();
            rfxContext.CodecChannelT.blockType = blockType_Value.WBT_CONTEXT;
            rfxContext.CodecChannelT.blockLen = 13;
            rfxContext.CodecChannelT.codecId = 0x01;
            rfxContext.CodecChannelT.channelId = 0x00;
            rfxContext.ctxId = 0x00;
            rfxContext.tileSize = 0x0040;

            ushort flags = 0x0002;
            if (opMode == OperationalMode.VideoMode) flags = 0x0000;
            ushort cct = 0x0001;
            ushort xft = 0x0001;
            ushort et = 0x0001;
            if (entropy == EntropyAlgorithm.CLW_ENTROPY_RLGR3) et = 0x0004;
            ushort qt = 0x0001;
            ushort r = 0x0000;

            rfxContext.properties = 0x0000;
            rfxContext.properties |= flags;
            rfxContext.properties |= (ushort)(cct << 3);
            rfxContext.properties |= (ushort)(xft << 5);
            rfxContext.properties |= (ushort)(et << 9);
            rfxContext.properties |= (ushort)(qt << 13);
            rfxContext.properties |= (ushort)(r << 15);

            return rfxContext;
        }
        private TurnOnRequestedMessage(OperationalMode requestedOperationalMode, int?desiredTemperature, TimeSpan?desiredDuration)
        {
            RequestedOperationalMode = requestedOperationalMode;

            _desiredDuration    = desiredDuration;
            _desiredTemperature = desiredTemperature;
        }
        /// <summary>
        /// Using RDPRFX to send image whose resolution is Width x Height
        /// </summary>
        /// <param name="imagefile">Image to send</param>
        /// <param name="width">Width of image to send</param>
        /// <param name="height">Height of image to send</param>
        public bool RdprfxSendImage(Image image, ushort width, ushort height)
        {
            uint             frameId     = 0; //The index of the sending frame.
            OperationalMode  opMode      = OperationalMode.ImageMode;
            EntropyAlgorithm enAlgorithm = EntropyAlgorithm.CLW_ENTROPY_RLGR1;
            ushort           destLeft    = 0; //the left bound of the frame.
            ushort           destTop     = 0; //the top bound of the frame.

            // Crop Image
            Bitmap    bitmap   = new Bitmap(width, height);
            Graphics  graphics = Graphics.FromImage(bitmap);
            Rectangle section  = new Rectangle(0, 0, width, height);

            graphics.DrawImage(image, 0, 0, section, GraphicsUnit.Pixel);

            //Check if the above setting is supported by the client.
            if (!this.rdprfxAdapter.CheckIfClientSupports(opMode, enAlgorithm))
            {
                return(false);
            }
            rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_BEGIN, frameId);

            rdprfxAdapter.SendImageToClient(bitmap, opMode, enAlgorithm, destLeft, destTop);
            rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_END, frameId);
            rdprfxAdapter.ExpectTsFrameAcknowledgePdu(frameId, waitTime);
            return(true);
        }
        /// <summary>
        /// Method to send TS_RFX_CONTEXT to client.
        /// </summary>
        /// <param name="isImageMode">Indicates the operational mode.</param>
        /// <param name="entropy">Indicates the entropy algorithm.</param>
        public void SendTsRfxContext(OperationalMode opMode, EntropyAlgorithm entropy)
        {
            this.admEntropyAlgorithm = entropy;
            this.admOperationMode    = opMode;

            TS_RFX_CONTEXT rfxContext = rdprfxServer.CreateTsRfxContext(opMode, entropy);

            if (this.currentTestType == RdprfxNegativeType.TsRfxContext_InvalidCtxId)
            {
                rfxContext.ctxId = 0x01; //set to an invalid value other than 0x00.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxContext_InvalidTileSize)
            {
                rfxContext.tileSize = 0x0080; //set to an invalid value other than 0x0040.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxContext_InvalidCct)
            {
                rfxContext.properties &= 0xFFF7; //set "cct" to an invalid value: 0x0.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxContext_InvalidXft)
            {
                rfxContext.properties &= 0xFE1F; //set "xft" to an invalid value: 0x0.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxContext_InvalidQt)
            {
                rfxContext.properties &= 0x9FFF; //set "qt" to an invalid value: 0x0.
            }

            AddToPendingList(rfxContext);
        }
示例#7
0
 public LuceneIndexImplementation(DatabaseLayout databaseLayout, Config config, System.Func <IndexConfigStore> indexStore, FileSystemAbstraction fileSystemAbstraction, OperationalMode operationalMode)
 {
     this._databaseLayout        = databaseLayout;
     this._config                = config;
     this._indexStore            = indexStore;
     this._fileSystemAbstraction = fileSystemAbstraction;
     this._operationalMode       = operationalMode;
 }
示例#8
0
 /// <summary>
 /// Constructs this data source.
 /// </summary>
 public LuceneDataSource(DatabaseLayout directoryStructure, Config config, IndexConfigStore indexStore, FileSystemAbstraction fileSystemAbstraction, OperationalMode operationalMode)
 {
     this._directoryStructure    = directoryStructure;
     this._config                = config;
     this._indexStore            = indexStore;
     this._typeCache             = new IndexTypeCache(indexStore);
     this._fileSystemAbstraction = fileSystemAbstraction;
     this._operationalMode       = operationalMode;
 }
        protected void btnDrawMode_onClick(MouseEventArgs eventArgs)
        {
            OperationalMode prevMode = CurrOperationalMode;

            CurrOperationalMode = OperationalMode.draw;
            if (CurrOperationalMode != prevMode)
            {
                OperationalModeHasChanged();
            }
        }
示例#10
0
 /// <summary>
 /// Write the device configuration to the  ASCOM  Profile store
 /// </summary>
 internal void WriteProfile()
 {
     using (Profile driverProfile = new Profile()
     {
         DeviceType = "ObservingConditions"
     })
     {
         driverProfile.WriteValue(DriverId, VantagePro_OpMode, OperationalMode.ToString());
         driverProfile.WriteValue(DriverId, VantagePro_DataFile, DataFile);
         driverProfile.WriteValue(DriverId, VantagePro_SerialPort, PortName);
     }
 }
示例#11
0
 /// <summary>
 /// Write the device configuration to the  ASCOM  Profile store
 /// </summary>
 internal void WriteProfile()
 {
     using (Profile driverProfile = new Profile()
     {
         DeviceType = "ObservingConditions"
     })
     {
         driverProfile.WriteValue(DriverId, Profile_OpMode, OperationalMode.ToString());
         driverProfile.WriteValue(DriverId, Profile_Tracing, Tracing.ToString());
         driverProfile.WriteValue(DriverId, Profile_Interval, interval.TotalSeconds.ToString());
         fetcher.WriteProfile();
     }
 }
示例#12
0
        internal FulltextIndexProvider(IndexProviderDescriptor descriptor, IndexDirectoryStructure.Factory directoryStructureFactory, FileSystemAbstraction fileSystem, Config config, TokenHolders tokenHolders, DirectoryFactory directoryFactory, OperationalMode operationalMode, JobScheduler scheduler, AuxiliaryTransactionStateManager auxiliaryTransactionStateManager, Log log) : base(descriptor, directoryStructureFactory)
        {
            this._fileSystem      = fileSystem;
            this._config          = config;
            this._tokenHolders    = tokenHolders;
            this._operationalMode = operationalMode;
            this._auxiliaryTransactionStateManager = auxiliaryTransactionStateManager;
            this._log = log;

            _defaultAnalyzerName = config.Get(FulltextConfig.FulltextDefaultAnalyzer);
            _defaultEventuallyConsistentSetting = Convert.ToString(config.Get(FulltextConfig.EventuallyConsistent));
            _indexUpdateSink     = new IndexUpdateSink(scheduler, config.Get(FulltextConfig.EventuallyConsistentIndexUpdateQueueMaxLength));
            _openOnlineAccessors = new ConcurrentDictionary <StoreIndexDescriptor, FulltextIndexAccessor>();
            _indexStorageFactory = BuildIndexStorageFactory(fileSystem, directoryFactory);
        }
        /// <summary>
        /// Method to send an image to the client.
        /// </summary>
        /// <param name="image">The image to be sent.</param>
        /// <param name="destLeft">The left bound of the frame.</param>
        /// <param name="destTop">The top bound of the frame.</param>
        /// <param name="frameId">The index of the sending frame.</param>
        public static void SendImageToClient(Image image, ushort destLeft, ushort destTop, uint frameId)
        {
            OperationalMode  opMode      = OperationalMode.ImageMode;
            EntropyAlgorithm enAlgorithm = EntropyAlgorithm.CLW_ENTROPY_RLGR1;

            Site.Log.Add(LogEntryKind.Comment, "Sending Frame Marker Command (Begin) with frameID: {0}.", frameId);
            rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_BEGIN, frameId);

            Site.Log.Add(LogEntryKind.Comment, "Sending encoded bitmap data to client. Operational Mode = {0}, Entropy Algorithm = {1}, destLeft = {2}, destTop = {3}.",
                         opMode, enAlgorithm, destLeft, destTop);
            rdprfxAdapter.SendImageToClient(image, opMode, enAlgorithm, destLeft, destTop);

            Site.Log.Add(LogEntryKind.Comment, "Sending Frame Marker Command (End) with frameID: {0}.", frameId);
            rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_END, frameId);
        }
        /// <summary>
        /// Method to send TS_RFX_TILESET to client.
        /// </summary>
        /// <param name="opMode">Indicates the operational mode.</param>
        /// <param name="entropy">Indicates the entropy algorithm.</param>
        /// <param name="tileImages">The image array for tiles to be sent. The width and height must be less than or equals with 64.</param>
        /// <param name="positions">A TILE_POSITION array indicating the positions of each tile images</param>
        /// <param name="codecQuantVals">Quant values array</param>
        /// <param name="quantIdxYs">Index array of Y component in Quant value array</param>
        /// <param name="quantIdxCbs">Index array of Cb component in Quant value array</param>
        /// <param name="quantIdxCrs">Index array of Cr component in Quant value array</param>
        public void SendTsRfxTileSet(OperationalMode opMode, EntropyAlgorithm entropy, Image[] tileImages, TILE_POSITION[] positions,
                                     TS_RFX_CODEC_QUANT[] codecQuantVals = null, byte[] quantIdxYs = null, byte[] quantIdxCbs = null, byte[] quantIdxCrs = null)
        {
            this.admEntropyAlgorithm = entropy;
            this.admOperationMode    = opMode;
            TS_RFX_TILESET rfxTileSet = rdprfxServer.CreateTsRfxTileSet(opMode, entropy, tileImages, positions, codecQuantVals, quantIdxYs, quantIdxCbs, quantIdxCrs);

            if (this.currentTestType == RdprfxNegativeType.TsRfxTileSet_InvalidIdx)
            {
                rfxTileSet.idx = 0x0001; //set to an invalid value other than 0x0000.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxTileSet_InvalidLt)
            {
                rfxTileSet.properties &= 0xFFFE; //set "lt" to an invalid value: 0x0.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxTileSet_InvalidCct)
            {
                rfxTileSet.properties &= 0xFFCF; //set "cct" to an invalid value: 0x0.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxTileSet_InvalidXft)
            {
                rfxTileSet.properties &= 0xFC3F; //set "xft" to an invalid value: 0x0.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxTileSet_InvalidQt)
            {
                rfxTileSet.properties &= 0x3FFF; //set "xft" to an invalid value: 0x0.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxTileSet_InvalidTileSize)
            {
                rfxTileSet.tileSize = 0x80; //set to an invalid value other than 0x40.
            }

            if (this.rdpbcgrAdapter.SimulatedScreen != null)
            {
                this.rdpbcgrAdapter.SimulatedScreen.SetRemoteFXTileSet(rfxTileSet, entropy);
            }

            AddToPendingList(rfxTileSet);
            if (!CheckIfClientSupports(opMode, entropy))
            {
                Site.Log.Add(LogEntryKind.Debug, "The client Cap is not supported: OperationalMode = {0}, EntropyAlgorithm = {1}",
                             opMode.ToString(),
                             entropy.ToString());
            }
        }
        protected override Task OnInitializedAsync()
        {
            BlazorWindowHelper.BlazorWindowHelper.Initialize();
            BlazorWindowHelper.BWHJsInterop.SetOnOrOff(true);
            BlazorWindowHelper.BlazorWindowHelper.OnScroll = OnScroll;
            BlazorWindowHelper.BlazorWindowHelper.OnResize = OnScroll;

            CurrentBackgroundImageURI = "";

            CurrOperationalMode = OperationalMode.select;
            OperationalModeHasChanged();

            //buildDate = new DateTime(2000, 1, 1).AddDays(version.Build).AddSeconds(version.Revision * 2);
            displayableVersion = $"{version}";


            return(base.OnInitializedAsync());
        }
示例#16
0
        /// <summary>
        /// Copy from RDPRFX test suite code
        /// </summary>
        private void receiveAndLogClientRfxCapabilites()
        {
            uint maxRequestSize = 38055; // MS-RDPBCGR section 2.2.7.2.7

            TS_RFX_ICAP[] clientRfxCaps;

            this.TestSite.Log.Add(LogEntryKind.Comment, "Receive and check client capabilities...");
            rdprfxAdapter.ReceiveAndCheckClientCapabilities(maxRequestSize, out clientRfxCaps);

            if (clientRfxCaps != null)
            {
                foreach (TS_RFX_ICAP iCap in clientRfxCaps)
                {
                    OperationalMode  opMode = (OperationalMode)iCap.flags;
                    EntropyAlgorithm enAlg  = (EntropyAlgorithm)iCap.entropyBits;
                    this.TestSite.Log.Add(LogEntryKind.Comment, "Client supports ({0}, {1}).", opMode, enAlg);
                }
            }
        }
示例#17
0
        /// <summary>
        /// Method to create TS_RFX_CONTEXT.
        /// </summary>
        /// <param name="isImageMode">Indicates the operational mode.</param>
        /// <param name="entropy">Indicates the entropy algorithm.</param>
        public TS_RFX_CONTEXT CreateTsRfxContext(OperationalMode opMode, EntropyAlgorithm entropy)
        {
            TS_RFX_CONTEXT rfxContext = new TS_RFX_CONTEXT();

            rfxContext.CodecChannelT           = new TS_RFX_CODEC_CHANNELT();
            rfxContext.CodecChannelT.blockType = blockType_Value.WBT_CONTEXT;
            rfxContext.CodecChannelT.blockLen  = 13;
            rfxContext.CodecChannelT.codecId   = 0x01;
            rfxContext.CodecChannelT.channelId = 0xFF;
            rfxContext.ctxId    = 0x00;
            rfxContext.tileSize = 0x0040;

            ushort flags = 0x0002;

            if (opMode == OperationalMode.VideoMode)
            {
                flags = 0x0000;
            }
            ushort cct = 0x0001;
            ushort xft = 0x0001;
            ushort et  = 0x0001;

            if (entropy == EntropyAlgorithm.CLW_ENTROPY_RLGR3)
            {
                et = 0x0004;
            }
            ushort qt = 0x0001;
            ushort r  = 0x0000;

            rfxContext.properties  = 0x0000;
            rfxContext.properties |= flags;
            rfxContext.properties |= (ushort)(cct << 3);
            rfxContext.properties |= (ushort)(xft << 5);
            rfxContext.properties |= (ushort)(et << 9);
            rfxContext.properties |= (ushort)(qt << 13);
            rfxContext.properties |= (ushort)(r << 15);

            return(rfxContext);
        }
 /// <summary>
 /// Method to check if the input pair of the operation mode and entropy algorithm is supported by the client.
 /// </summary>
 /// <param name="opMode">The operation mode.</param>
 /// <param name="entropy">The entropy algorithm.</param>
 /// <returns></returns>
 public bool CheckIfClientSupports(OperationalMode opMode, EntropyAlgorithm entropy)
 {
     TS_RFX_ICAP[] iCaps = this.client_RFX_Caps_Container.capsData.capsetsData[0].icapsData;
     foreach (TS_RFX_ICAP icap in iCaps)
     {
         if ((icap.flags & (byte)OperationalMode.ImageMode) == (byte)0 &&
             ((byte)icap.entropyBits == (byte)entropy))
         {
             //OperationalMode.ImageMode is not set, both the image mode and the video mode of the codec are supported
             return(true);
         }
         else if ((byte)icap.entropyBits == (byte)entropy)
         {
             //OperationalMode.ImageMode is set, only image mode is supported
             if (opMode == OperationalMode.ImageMode)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
示例#19
0
            public override Lifecycle NewInstance(KernelContext context, SchemaIndexHaIT.IndexProviderDependencies deps)
            {
                PageCache pageCache             = deps.PageCache();
                File      databaseDirectory     = context.Directory();
                DefaultFileSystemAbstraction fs = FileSystemRule.get();

                IndexProvider.Monitor monitor   = IndexProvider.Monitor_Fields.EMPTY;
                Config          config          = deps.Config();
                OperationalMode operationalMode = context.DatabaseInfo().OperationalMode;
                RecoveryCleanupWorkCollector recoveryCleanupWorkCollector = deps.RecoveryCleanupWorkCollector();

                FusionIndexProvider fusionIndexProvider = NativeLuceneFusionIndexProviderFactory20.create(pageCache, databaseDirectory, fs, monitor, config, operationalMode, recoveryCleanupWorkCollector);

                if (InjectLatchPredicate.test(deps.Db()))
                {
                    ControlledIndexProvider provider = new ControlledIndexProvider(fusionIndexProvider);
                    PerDbIndexProvider[deps.Db()] = provider;
                    return(provider);
                }
                else
                {
                    return(fusionIndexProvider);
                }
            }
示例#20
0
文件: HMC6352.cs 项目: WebGE/HMC6352
 // Set the operational mode.
 // Mode = Standby, Query, Continuous
 // Frequency = 1, 45, 10, 20 Hz
 // Periodic reset = true/false
 public void SetOperationalMode(OperationalMode mode, Frequency freq, Boolean periodicReset)
 {
     byte r = periodicReset ? (byte)(0x01 << 3) : (byte) 0;
     byte f = (byte)((byte)freq << 5);
     byte op = (byte)((byte)mode | r | f);
     myI2Command[0] = I2CDevice.CreateWriteTransaction(new byte[] { (byte)Command.WriteEEPROM, (byte)EEPROMAddress.OperationalModeByte, op });
     // Exécution de la transaction
     BusI2C = new I2CDevice(ConfigHM6352); // Connexion virtuelle de l'objet HMC6352  au bus I2C
     myBytesTransmitted = BusI2C.Execute(myI2Command, 100);
     BusI2C.Dispose(); // Déconnexion virtuelle de l'objet HMC6352 du bus I2C
 }
        /// <summary>
        /// Method to create TS_RFX_TILESET.
        /// </summary>
        /// <param name="opMode">Indicates the operational mode.</param>
        /// <param name="entropy">Indicates the entropy algorithm.</param>
        /// <param name="tileImages">An array of bitmaps in Image type for a tile. The width and heigth must be less than or equals with 64.</param>
        /// <param name="positions">A TILE_POSITION array indicating the positions of each tile images</param>
        /// <param name="codecQuantVals">Quant values array</param>
        /// <param name="quantIdxYs">Index array of Y component in Quant value array</param>
        /// <param name="quantIdxCbs">Index array of Cb component in Quant value array</param>
        /// <param name="quantIdxCrs">Index array of Cr component in Quant value array</param>
        /// <returns></returns>
        public TS_RFX_TILESET CreateTsRfxTileSet(
            OperationalMode opMode,
            EntropyAlgorithm entropy,
            Image[] tileImages,
            TILE_POSITION[] positions,
            TS_RFX_CODEC_QUANT[] codecQuantVals = null,
            byte[] quantIdxYs = null,
            byte[] quantIdxCbs = null,
            byte[] quantIdxCrs = null
            )
        {
            if (codecQuantVals == null)
            {
                codecQuantVals = new TS_RFX_CODEC_QUANT[1];
                codecQuantVals[0] = codecQuant;
            }

            TS_RFX_TILESET rfxTileSet = new TS_RFX_TILESET();
            rfxTileSet.CodecChannelT = new TS_RFX_CODEC_CHANNELT();
            rfxTileSet.CodecChannelT.blockType = blockType_Value.WBT_EXTENSION;
            rfxTileSet.CodecChannelT.blockLen = 22 + 5;
            rfxTileSet.CodecChannelT.codecId = 0x01;
            rfxTileSet.CodecChannelT.channelId = 0x00;
            rfxTileSet.subtype = 0xCAC2;
            rfxTileSet.idx = 0x0000;

            ushort lt = 0x0001;
            ushort flags = 0x0002;
            if (opMode == OperationalMode.VideoMode) flags = 0x0000;
            ushort cct = 0x0001;
            ushort xft = 0x0001;
            ushort et = 0x0001;
            if (entropy == EntropyAlgorithm.CLW_ENTROPY_RLGR3) et = 0x0004;
            ushort qt = 0x0001;
            rfxTileSet.properties = lt;
            rfxTileSet.properties |= (ushort)(flags << 1);
            rfxTileSet.properties |= (ushort)(cct << 4);
            rfxTileSet.properties |= (ushort)(xft << 6);
            rfxTileSet.properties |= (ushort)(et << 10);
            rfxTileSet.properties |= (ushort)(qt << 14);

            rfxTileSet.numQuant = (byte)codecQuantVals.Length;
            rfxTileSet.tileSize = RdprfxServer.TileSize;
            rfxTileSet.numTiles = 1;

            rfxTileSet.quantVals = codecQuantVals;

            byte[] yData, cbData, crData;

            rfxTileSet.tiles = new TS_RFX_TILE[tileImages.Length];
            rfxTileSet.numTiles = (ushort) rfxTileSet.tiles.Length;

            for (int i = 0; i < tileImages.Length; i++)
            {
                byte quantIdxY = quantIdxYs == null ? (byte)0 : (quantIdxYs.Length > i ? quantIdxYs[i] : (byte)0);
                byte quantIdxCb = quantIdxCbs == null ? (byte)0 : (quantIdxCbs.Length > i ? quantIdxCbs[i] : (byte)0);
                byte quantIdxCr = quantIdxCrs == null ? (byte)0 : (quantIdxCrs.Length > i ? quantIdxCrs[i] : (byte)0);

                RemoteFXCodecContext encodingContext = new RemoteFXCodecContext(codecQuantVals, quantIdxY, quantIdxCb, quantIdxCr, entropy);
                RemoteFXEncoder.EncodeTile(tileImages[i], 0, 0, encodingContext);
                yData = encodingContext.YData;
                cbData = encodingContext.CbData;
                crData = encodingContext.CrData;

                rfxTileSet.tiles[i].BlockT.blockType = blockType_Value.CBT_TILE;
                rfxTileSet.tiles[i].BlockT.blockLen = (uint)(19 + yData.Length + cbData.Length + crData.Length);
                rfxTileSet.tiles[i].quantIdxY = quantIdxY;
                rfxTileSet.tiles[i].quantIdxCb = quantIdxCb;
                rfxTileSet.tiles[i].quantIdxCr = quantIdxCr;
                rfxTileSet.tiles[i].xIdx = positions[i].xIdx;
                rfxTileSet.tiles[i].yIdx = positions[i].yIdx;
                rfxTileSet.tiles[i].YLen = (ushort)yData.Length;
                rfxTileSet.tiles[i].CbLen = (ushort)cbData.Length;
                rfxTileSet.tiles[i].CrLen = (ushort)crData.Length;
                rfxTileSet.tiles[i].YData = yData;
                rfxTileSet.tiles[i].CbData = cbData;
                rfxTileSet.tiles[i].CrData = crData;

                rfxTileSet.tilesDataSize += rfxTileSet.tiles[i].BlockT.blockLen;
                rfxTileSet.CodecChannelT.blockLen = (uint)(22 + 5 * rfxTileSet.numQuant + rfxTileSet.tilesDataSize);
            }

            return rfxTileSet;
        }
        private void NegtiveTest_DuplicatedTile(OperationalMode mode)
        {
            #region Test Description
            /*
            Step 1: [RDPBCGR] establishing the connection.
            Step 2: [RDPBCGR] send Frame Maker Command (Begin) to SUT.
            Step 3: [RDPRFX] Send Encode Header Messages to SUT.
            Step 4: [RDPRFX] Send one frame of Encode Data Messages (encoded with RLGR1) to SUT, the TS_RFX_REGION structure contains rectangular which contains a duplicated tile.
            Step 5: [RDPRFX] Expect the client terminates the RDP connection.
            */
            #endregion

            #region Test Sequence

            //Start RDP listening.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Starting RDP listening.");
            this.rdpbcgrAdapter.StartRDPListening(transportProtocol);

            #region Trigger client to connect
            //Trigger client to connect.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Triggering SUT to initiate a RDP connection to server.");
            triggerClientRDPConnect(transportProtocol, true);
            #endregion

            #region RDPBCGR Connection

            //Waiting for the transport level connection request.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting the transport layer connection request.");
            this.rdpbcgrAdapter.ExpectTransportConnection(RDPSessionType.Normal);

            //Set Server Capability with RomoteFX codec supported.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Setting Server Capability.");
            setServerCapabilitiesWithRemoteFxSupported();

            //Waiting for the RDP connection sequence.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Establishing RDP connection.");
            this.rdpbcgrAdapter.EstablishRDPConnection(selectedProtocol, enMethod, enLevel, true, false, rdpServerVersion);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Server Save Session Info PDU to SUT to notify user has logged on.");
            this.rdpbcgrAdapter.ServerSaveSessionInfo(LogonNotificationType.UserLoggedOn, ErrorNotificationType_Values.LOGON_FAILED_OTHER);

            #endregion

            //Initial the RDPRFX adapter context.
            rdprfxAdapter.Accept(this.rdpbcgrAdapter.ServerStack, this.rdpbcgrAdapter.SessionContext);

            receiveAndLogClientRfxCapabilites();

            uint frameId = 0; //The index of the sending frame.
            OperationalMode opMode = mode;
            EntropyAlgorithm enAlgorithm = EntropyAlgorithm.CLW_ENTROPY_RLGR1;
            ushort destLeft = 0; //the left bound of the frame.
            ushort destTop = 0; //the top bound of the frame.

            //Check if the above setting is supported by client.
            if (!this.rdprfxAdapter.CheckIfClientSupports(opMode, enAlgorithm))
            {
                this.TestSite.Log.Add(LogEntryKind.Comment, "the input pair of Operational Mode ({0}) / Entropy Algorithm ({1}) is not supported by client, so stop running this test case.", opMode, enAlgorithm);
                return;
            }

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Frame Marker Command (Begin) with frameID: {0}.", frameId);
            rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_BEGIN, frameId);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Start to send encoded bitmap data to client. Operational Mode = {0}, Entropy Algorithm = {1}, destLeft = {2}, destTop = {3}.",
                opMode, enAlgorithm, destLeft, destTop);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create rectangles list, this rectangle list is used for TS_RFX_REGION structure to clip the bitmap.");
            Rectangle clipRect1 = new Rectangle(0, 0, RgbTile.TileSize * 2, RgbTile.TileSize * 2);

            Rectangle[] rects = new Rectangle[] { clipRect1 };

            rdprfxAdapter.SendTsRfxSync();
            rdprfxAdapter.SendTsRfxCodecVersions();
            rdprfxAdapter.SendTsRfxChannels(RgbTile.TileSize * 2, RgbTile.TileSize * 2);
            rdprfxAdapter.SendTsRfxContext(opMode, enAlgorithm);

            var bitmapBlue = new Bitmap(RgbTile.TileSize, RgbTile.TileSize);
            Graphics graphics = Graphics.FromImage(bitmapBlue);
            graphics.FillRectangle(Brushes.Blue, new Rectangle(0, 0, RgbTile.TileSize, RgbTile.TileSize));
            var bitmapRed = new Bitmap(RgbTile.TileSize, RgbTile.TileSize);
            graphics = Graphics.FromImage(bitmapRed);
            graphics.FillRectangle(Brushes.Red, new Rectangle(0, 0, RgbTile.TileSize, RgbTile.TileSize));

            rdprfxAdapter.SendTsRfxFrameBegin(0);
            rdprfxAdapter.SendTsRfxRegion(rects);

            TILE_POSITION[] positions = new TILE_POSITION[5]{
                new TILE_POSITION{ xIdx = 1, yIdx = 1 },
                new TILE_POSITION{ xIdx = 0, yIdx = 0 },
                new TILE_POSITION{ xIdx = 1, yIdx = 0 },
                new TILE_POSITION{ xIdx = 0, yIdx = 1 },
                new TILE_POSITION{ xIdx = 1, yIdx = 1 },
            };

            rdprfxAdapter.SendTsRfxTileSet(
                opMode,
                enAlgorithm,
                new Image[] { bitmapRed, bitmapBlue, bitmapBlue, bitmapBlue, bitmapBlue },
                positions);
            rdprfxAdapter.SendTsRfxFrameEnd();
            rdprfxAdapter.FlushEncodedData(destLeft, destTop, RgbTile.TileSize * 2, RgbTile.TileSize * 2);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting the client terminates the RDP connection.");
            bool bDisconnected = rdpbcgrAdapter.WaitForDisconnection(waitTime);

            this.TestSite.Assert.IsTrue(bDisconnected, "Client is expected to drop the connection if received duplicated tiles in Video Mode when Image Mode is in effect.");

            #endregion
        }
        private void SendOutOfRects(OperationalMode mode)
        {
            #region Test Description
            /*
            Step 1: [RDPBCGR] establishing the connection.
            Step 2: [RDPBCGR] send Frame Maker Command (Begin) to SUT.
            Step 3: [RDPRFX] Send Encode Header Messages to SUT.
            Step 4: [RDPRFX] Send one frame of Encode Data Messages (encoded with RLGR1) to SUT, when some tiles are out of the rectangle in TS_RFX_REGION.
            Step 5: [RDPBCGR] send Frame Maker Command (End) to SUT.
            Step 6: [RDPRFX] Expect SUT sends a TS_FRAME_ACKNOWLEDGE_PDU.
            */
            #endregion

            #region Test Sequence

            //Start RDP listening.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Starting RDP listening.");
            this.rdpbcgrAdapter.StartRDPListening(transportProtocol);

            #region Trigger client to connect
            //Trigger client to connect.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Triggering SUT to initiate a RDP connection to server.");
            triggerClientRDPConnect(transportProtocol, true);
            #endregion

            #region RDPBCGR Connection

            //Waiting for the transport level connection request.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting the transport layer connection request.");
            this.rdpbcgrAdapter.ExpectTransportConnection(RDPSessionType.Normal);

            //Set Server Capability with RomoteFX codec supported.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Setting Server Capability.");
            setServerCapabilitiesWithRemoteFxSupported();

            //Waiting for the RDP connection sequence.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Establishing RDP connection.");
            this.rdpbcgrAdapter.EstablishRDPConnection(selectedProtocol, enMethod, enLevel, true, false, rdpServerVersion);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Server Save Session Info PDU to SUT to notify user has logged on.");
            this.rdpbcgrAdapter.ServerSaveSessionInfo(LogonNotificationType.UserLoggedOn, ErrorNotificationType_Values.LOGON_FAILED_OTHER);

            #endregion

            //Initial the RDPRFX adapter context.
            rdprfxAdapter.Accept(this.rdpbcgrAdapter.ServerStack, this.rdpbcgrAdapter.SessionContext);

            receiveAndLogClientRfxCapabilites();

            uint frameId = 0; //The index of the sending frame.
            OperationalMode opMode = mode;
            EntropyAlgorithm enAlgorithm = EntropyAlgorithm.CLW_ENTROPY_RLGR1;
            ushort destLeft = 0; //the left bound of the frame.
            ushort destTop = 0; //the top bound of the frame.

            //Check if the above setting is supported by client.
            if (!this.rdprfxAdapter.CheckIfClientSupports(opMode, enAlgorithm))
            {
                this.TestSite.Log.Add(LogEntryKind.Comment, "the input pair of Operational Mode ({0}) / Entropy Algorithm ({1}) is not supported by client, so stop running this test case.", opMode, enAlgorithm);
                return;
            }

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Frame Marker Command (Begin) with frameID: {0}.", frameId);
            rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_BEGIN, frameId);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Start to send encoded bitmap data to client. Operational Mode = {0}, Entropy Algorithm = {1}, destLeft = {2}, destTop = {3}.",
                opMode, enAlgorithm, destLeft, destTop);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create rectangles whose height is TileSize/2, this rectangle is used for TS_RFX_REGION structure to clip the bitmap.");
            Rectangle clipRect = new Rectangle(64, 64, RgbTile.TileSize, RgbTile.TileSize);
            Rectangle[] rects = new Rectangle[] { clipRect };

            rdprfxAdapter.SendTsRfxSync();
            rdprfxAdapter.SendTsRfxCodecVersions();
            rdprfxAdapter.SendTsRfxChannels(RgbTile.TileSize * 2, RgbTile.TileSize * 2);
            rdprfxAdapter.SendTsRfxContext(opMode, enAlgorithm);

            rdprfxAdapter.SendTsRfxFrameBegin(0);
            rdprfxAdapter.SendTsRfxRegion(rects);
            TILE_POSITION[] positions = new TILE_POSITION[4]{
                new TILE_POSITION{ xIdx = 0, yIdx = 0 },
                new TILE_POSITION{ xIdx = 0, yIdx = 1 },
                new TILE_POSITION{ xIdx = 1, yIdx = 0 },
                new TILE_POSITION{ xIdx = 1, yIdx = 1 }
            };
            rdprfxAdapter.SendTsRfxTileSet(
                opMode,
                enAlgorithm,
                new Image[] { image_64X64, image_64X64, image_64X64, image_64X64 },
                positions);
            rdprfxAdapter.SendTsRfxFrameEnd();
            rdprfxAdapter.FlushEncodedData(destLeft, destTop, RgbTile.TileSize * 2, RgbTile.TileSize * 2);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Frame Marker Command (End) with frameID: {0}.", frameId);
            rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_END, frameId);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting TS_FRAME_ACKNOWLEDGE_PDU.");
            rdprfxAdapter.ExpectTsFrameAcknowledgePdu(frameId, waitTime);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Verify output on SUT Display if the verifySUTDisplay entry in PTF config is true.");
            Rectangle compareRect = new Rectangle(destLeft, destTop, RgbTile.TileSize * 2, RgbTile.TileSize * 2);
            this.VerifySUTDisplay(true, compareRect);

            #endregion
        }
        public void Rdprfx_HeaderMessage_NegativeTest_UnspecifiedMessage()
        {
            #region Test Description
            /*
            Step 1: [RDPBCGR] establish the RDP connection.
            Step 2: [RDPRFX] send one unspecified message to client.
            Step 3: [RDPRFX] expect SUT terminate the RDP connectioin.
            */
            #endregion

            #region Test Sequence

            //Start RDP listening.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Starting RDP listening.");
            this.rdpbcgrAdapter.StartRDPListening(transportProtocol);

            #region Trigger client to connect
            //Trigger client to connect. 
            this.TestSite.Log.Add(LogEntryKind.Comment, "Triggering SUT to initiate a RDP connection to server.");
            triggerClientRDPConnect(transportProtocol);
            #endregion

            #region RDPBCGR Connection

            //Waiting for the transport level connection request.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting the transport layer connection request.");
            this.rdpbcgrAdapter.ExpectTransportConnection(RDPSessionType.Normal);


            //Set Server Capability with RomoteFX codec supported.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Setting Server Capability.");
            setServerCapabilitiesWithRemoteFxSupported();

            //Waiting for the RDP connection sequence.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Establishing RDP connection.");
            this.rdpbcgrAdapter.EstablishRDPConnection(selectedProtocol, enMethod, enLevel, true, false, rdpServerVersion);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Server Save Session Info PDU to SUT to notify user has logged on.");
            this.rdpbcgrAdapter.ServerSaveSessionInfo(LogonNotificationType.UserLoggedOn, ErrorNotificationType_Values.LOGON_FAILED_OTHER);

            #endregion

            //Initial the RDPRFX adapter context.
            rdprfxAdapter.Accept(this.rdpbcgrAdapter.ServerStack, this.rdpbcgrAdapter.SessionContext);

            #region Fill parameters
            TS_RFX_ICAP[] clientSupportedCaps;
            rdprfxAdapter.ReceiveAndCheckClientCapabilities(maxRequestSize, out clientSupportedCaps);

            OperationalMode opMode = OperationalMode.ImageMode;
            EntropyAlgorithm enAlgorithm = EntropyAlgorithm.CLW_ENTROPY_RLGR3;
            ushort destLeft = 0; //the left bound of the frame.
            ushort destTop = 0; //the top bound of the frame.

            //Set OperationalMode/EntropyAlgorithm to valid pair.
            if (clientSupportedCaps != null)
            {
                opMode = (OperationalMode)clientSupportedCaps[0].flags;
                enAlgorithm = (EntropyAlgorithm)clientSupportedCaps[0].entropyBits;
            }
            #endregion

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdprfxNegativeType.UnspecifiedBlockType);
            rdprfxAdapter.SetTestType(RdprfxNegativeType.UnspecifiedBlockType);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Encode Header/Data Messages to client.");
            rdprfxAdapter.SendImageToClient(image_64X64, opMode, enAlgorithm, destLeft, destTop);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting the client terminates the RDP connection.");
            bool bDisconnected = rdpbcgrAdapter.WaitForDisconnection(waitTime);

            this.TestSite.Assert.IsTrue(bDisconnected, "Client is expected to drop the connection when received an invalid message.");

            #endregion
        }
        /// <summary>
        /// Method to check if the input pair of the operation mode and entropy algorithm is supported by the client.
        /// </summary>
        /// <param name="opMode">The operation mode.</param>
        /// <param name="entropy">The entropy algorithm.</param>
        /// <returns></returns>
        public bool CheckIfClientSupports(OperationalMode opMode, EntropyAlgorithm entropy)
        {
            TS_RFX_ICAP[] iCaps = this.client_RFX_Caps_Container.capsData.capsetsData[0].icapsData;
            foreach (TS_RFX_ICAP icap in iCaps)
            {
                if ((icap.flags & (byte)OperationalMode.ImageMode) == (byte)0 &&
                    ((byte)icap.entropyBits == (byte)entropy))
                {
                    //OperationalMode.ImageMode is not set, both the image mode and the video mode of the codec are supported
                    return true;
                }
                else if ((byte)icap.entropyBits == (byte)entropy)
                {
                    //OperationalMode.ImageMode is set, only image mode is supported
                    if (opMode == OperationalMode.ImageMode)
                        return true;
                }

            }
            return false;
        }
        /// <summary>
        /// Method to send one frame of encoded data message to client.
        /// </summary>
        /// <param name="image">The image to be sent.</param>
        /// <param name="opMode">Indicates the operational mode.</param>
        /// <param name="entropy">Indicates the entropy algorithm.</param>
        /// <param name="destLeft">Left bound of the frame.</param>
        /// <param name="destTop">Left bound of the frame.</param>
        public void SendImageToClient(System.Drawing.Image image, OperationalMode opMode, EntropyAlgorithm entropy, ushort destLeft, ushort destTop)
        {
            if (image == null)
            {
                Site.Log.Add(LogEntryKind.Debug, "[In iRdprfxAdapter.SendImageToClient Method] The image to be send is null.");
                return;
            }

            TileImage[] tileImageArr = RdprfxTileUtils.SplitToTileImage(image, RdprfxServer.TileSize, RdprfxServer.TileSize);

            for (int idx = 0; idx < tileImageArr.Length; idx++)
            {
                if (idx == 0 || opMode == OperationalMode.ImageMode)
                {
                    SendTsRfxSync();
                    SendTsRfxCodecVersions();
                    SendTsRfxChannels();
                    SendTsRfxContext(opMode, entropy);
                }
                SendTsRfxFrameBegin((uint)idx);
                SendTsRfxRegion();
                SendTsRfxTileSet(opMode, entropy, tileImageArr[idx].image);
                SendTsRfxFrameEnd();
                FlushEncodedData((ushort)(destLeft + tileImageArr[idx].x), (ushort)(destTop + tileImageArr[idx].y));
                if (currentTestType != RdprfxNegativeType.None)
                {
                    // Only send one message if it is in a negative test case.
                    break;
                }
            }
        }
        /// <summary>
        /// Method to send TS_RFX_TILESET to client.
        /// </summary>
        /// <param name="opMode">Indicates the operational mode.</param>
        /// <param name="entropy">Indicates the entropy algorithm.</param>
        /// <param name="tileImages">The image array for tiles to be sent. The width and height must be less than or equals with 64.</param>
        /// <param name="positions">A TILE_POSITION array indicating the positions of each tile images</param>
        /// <param name="codecQuantVals">Quant values array</param>
        /// <param name="quantIdxYs">Index array of Y component in Quant value array</param>
        /// <param name="quantIdxCbs">Index array of Cb component in Quant value array</param>
        /// <param name="quantIdxCrs">Index array of Cr component in Quant value array</param>
        public void SendTsRfxTileSet(OperationalMode opMode, EntropyAlgorithm entropy, Image[] tileImages, TILE_POSITION[] positions,
            TS_RFX_CODEC_QUANT[] codecQuantVals = null, byte[] quantIdxYs = null, byte[] quantIdxCbs = null, byte[] quantIdxCrs = null)
        {
            this.admEntropyAlgorithm = entropy;
            this.admOperationMode = opMode;
            TS_RFX_TILESET rfxTileSet = rdprfxServer.CreateTsRfxTileSet(opMode, entropy, tileImages, positions, codecQuantVals, quantIdxYs, quantIdxCbs, quantIdxCrs);
            if (this.currentTestType == RdprfxNegativeType.TsRfxTileSet_InvalidIdx)
            {
                rfxTileSet.idx = 0x0001; //set to an invalid value other than 0x0000.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxTileSet_InvalidLt)
            {
                rfxTileSet.properties &= 0xFFFE; //set "lt" to an invalid value: 0x0.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxTileSet_InvalidCct)
            {
                rfxTileSet.properties &= 0xFFCF; //set "cct" to an invalid value: 0x0.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxTileSet_InvalidXft)
            {
                rfxTileSet.properties &= 0xFC3F; //set "xft" to an invalid value: 0x0.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxTileSet_InvalidQt)
            {
                rfxTileSet.properties &= 0x3FFF; //set "xft" to an invalid value: 0x0.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxTileSet_InvalidTileSize)
            {
                rfxTileSet.tileSize = 0x80; //set to an invalid value other than 0x40.
            }

            if (this.rdpbcgrAdapter.SimulatedScreen != null)
            {
                this.rdpbcgrAdapter.SimulatedScreen.SetRemoteFXTileSet(rfxTileSet, entropy);
            }

            AddToPendingList(rfxTileSet);
            if (!CheckIfClientSupports(opMode, entropy))
            {
                Site.Log.Add(LogEntryKind.Debug, "The client Cap is not supported: OperationalMode = {0}, EntropyAlgorithm = {1}",
                    opMode.ToString(),
                    entropy.ToString());
            }
        }
示例#28
0
 public SbtResult SetOperationalMode(OperationalMode operationalMode)
 {
     return((SbtResult)global::ApiDefinitions.ZebraMessaging.UInt32_objc_msgSend_UInt32(this.Handle, Selector.GetHandle("sbtSetOperationalMode:"), (UInt32)operationalMode));
 }
        /// <summary>
        /// Method to send TS_RFX_CONTEXT to client.
        /// </summary>
        /// <param name="isImageMode">Indicates the operational mode.</param>
        /// <param name="entropy">Indicates the entropy algorithm.</param>
        public void SendTsRfxContext(OperationalMode opMode, EntropyAlgorithm entropy)
        {
            this.admEntropyAlgorithm = entropy;
            this.admOperationMode = opMode;

            TS_RFX_CONTEXT rfxContext = rdprfxServer.CreateTsRfxContext(opMode, entropy);
            if (this.currentTestType == RdprfxNegativeType.TsRfxContext_InvalidCtxId)
            {
                rfxContext.ctxId = 0x01; //set to an invalid value other than 0x00.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxContext_InvalidTileSize)
            {
                rfxContext.tileSize = 0x0080; //set to an invalid value other than 0x0040.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxContext_InvalidCct)
            {
                rfxContext.properties &= 0xFFF7; //set "cct" to an invalid value: 0x0.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxContext_InvalidXft)
            {
                rfxContext.properties &= 0xFE1F; //set "xft" to an invalid value: 0x0.
            }
            else if (this.currentTestType == RdprfxNegativeType.TsRfxContext_InvalidQt)
            {
                rfxContext.properties &= 0x9FFF; //set "qt" to an invalid value: 0x0.
            }

            AddToPendingList(rfxContext);
        }
        /// <summary>
        /// Pack a Rdprfx message for a tile image.
        /// </summary>
        /// <param name="index"> Frame index in frame begin block.</param>
        /// <param name="opMode"> Indicate Operational Mode.</param>
        /// <param name="entropy"> Indicate Entropy Algorithm.</param>
        /// <param name="tileImage"> The image to be encoded as RFX codec.</param>
        /// <return> A byte array of image encoded as RFX codec.</return>
        private byte[] PackRfxTileImage(uint index, OperationalMode opMode, EntropyAlgorithm entropy, System.Drawing.Image tileImage)
        {
            lock (syncLocker)
            {
                pendingRfxBuffer.Clear();
            }

            if (index == 0 || opMode == OperationalMode.ImageMode)
            {
                TS_RFX_SYNC rfxSync = rdprfxServer.CreateTsRfxSync();
                AddToPendingList(rfxSync);

                TS_RFX_CODEC_VERSIONS rfxVersions = rdprfxServer.CreateTsRfxCodecVersions();
                AddToPendingList(rfxVersions);

                TS_RFX_CHANNELS rfxChannels = rdprfxServer.CreateTsRfxChannels();
                AddToPendingList(rfxChannels);

                TS_RFX_CONTEXT rfxContext = rdprfxServer.CreateTsRfxContext(opMode, entropy);
                AddToPendingList(rfxContext);
            }

            TS_RFX_FRAME_BEGIN rfxBegin = rdprfxServer.CreateTsRfxFrameBegin(index);
            AddToPendingList(rfxBegin);

            TS_RFX_REGION rfxRegion = rdprfxServer.CreateTsRfxRegion();
            AddToPendingList(rfxRegion);

            TS_RFX_TILESET rfxTileSet = rdprfxServer.CreateTsRfxTileSet(opMode, entropy, tileImage);
            AddToPendingList(rfxTileSet);

            TS_RFX_FRAME_END rfxEnd = rdprfxServer.CreateTsRfxFrameEnd();
            AddToPendingList(rfxEnd);

            if (this.bcgrAdapter.SimulatedScreen != null)
            {
                this.bcgrAdapter.SimulatedScreen.SetRemoteFXRegion(rfxRegion);
                this.bcgrAdapter.SimulatedScreen.SetRemoteFXTileSet(rfxTileSet, entropy);
            }

            lock (syncLocker)
            {
                return pendingRfxBuffer.ToArray();
            }
        }
        public void Rdprfx_ImageMode_PositiveTest_MultiQuantVals()
        {
            #region Test Description

            /*
             * Step 1: [RDPBCGR] establishing the connection.
             * Step 2: [RDPBCGR] send Frame Maker Command (Begin) to SUT.
             * Step 3: [RDPRFX] Send Encode Header Messages to SUT.
             * Step 4: [RDPRFX] Send one frame of Encode Data Messages (encoded with RLGR1) to SUT, each component use different quantization value.
             * Step 5: [RDPBCGR] send Frame Maker Command (End) to SUT.
             * Step 6: [RDPRFX] Expect SUT sends a TS_FRAME_ACKNOWLEDGE_PDU.
             */
            #endregion

            #region Test Sequence

            //Start RDP listening.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Starting RDP listening.");
            this.rdpbcgrAdapter.StartRDPListening(transportProtocol);

            #region Trigger client to connect
            //Trigger client to connect.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Triggering SUT to initiate a RDP connection to server.");
            triggerClientRDPConnect(transportProtocol, true);
            #endregion

            #region RDPBCGR Connection

            //Waiting for the transport level connection request.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting the transport layer connection request.");
            this.rdpbcgrAdapter.ExpectTransportConnection(RDPSessionType.Normal);

            //Set Server Capability with RomoteFX codec supported.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Setting Server Capability.");
            setServerCapabilitiesWithRemoteFxSupported();

            //Waiting for the RDP connection sequence.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Establishing RDP connection.");
            this.rdpbcgrAdapter.EstablishRDPConnection(selectedProtocol, enMethod, enLevel, true, false, rdpServerVersion);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Server Save Session Info PDU to SUT to notify user has logged on.");
            this.rdpbcgrAdapter.ServerSaveSessionInfo(LogonNotificationType.UserLoggedOn, ErrorNotificationType_Values.LOGON_FAILED_OTHER);

            #endregion

            //Initial the RDPRFX adapter context.
            rdprfxAdapter.Accept(this.rdpbcgrAdapter.ServerStack, this.rdpbcgrAdapter.SessionContext);

            receiveAndLogClientRfxCapabilites();

            uint             frameId     = 0; //The index of the sending frame.
            OperationalMode  opMode      = OperationalMode.ImageMode;
            EntropyAlgorithm enAlgorithm = EntropyAlgorithm.CLW_ENTROPY_RLGR1;
            ushort           destLeft    = 64; //the left bound of the frame.
            ushort           destTop     = 64; //the top bound of the frame.

            //Check if the above setting is supported by the client.
            if (!this.rdprfxAdapter.CheckIfClientSupports(opMode, enAlgorithm))
            {
                this.TestSite.Log.Add(LogEntryKind.Comment, "the input pair of Operational Mode ({0}) / Entropy Algorithm ({1}) is not supported by the client, so stop running this test case.", opMode, enAlgorithm);
                return;
            }

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Frame Marker Command (Begin) with frameID: {0}.", frameId);
            rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_BEGIN, frameId);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Start to send encoded bitmap data to client. Operational Mode = {0}, Entropy Algorithm = {1}, destLeft = {2}, destTop = {3}.",
                                  opMode, enAlgorithm, destLeft, destTop);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Generate Quantization value, each component has different quant index.");
            TS_RFX_CODEC_QUANT[] quantVals = this.GenerateCodecQuantVals();
            byte quantIdxY  = 0;
            byte quantIdxCb = 1;
            byte quantIdxCr = 2;

            TileImage[] tileImageArr = RdprfxTileUtils.SplitToTileImage(image_64X64, RdprfxServer.TileSize, RdprfxServer.TileSize);
            for (int idx = 0; idx < tileImageArr.Length; idx++)
            {
                if (idx == 0)
                {
                    rdprfxAdapter.SendTsRfxSync();
                    rdprfxAdapter.SendTsRfxCodecVersions();
                    rdprfxAdapter.SendTsRfxChannels();
                    rdprfxAdapter.SendTsRfxContext(opMode, enAlgorithm);
                }
                rdprfxAdapter.SendTsRfxFrameBegin((uint)idx);
                rdprfxAdapter.SendTsRfxRegion();
                rdprfxAdapter.SendTsRfxTileSet(opMode, enAlgorithm, tileImageArr[idx].image, quantVals, quantIdxY, quantIdxCb, quantIdxCr);
                rdprfxAdapter.SendTsRfxFrameEnd();
                rdprfxAdapter.FlushEncodedData((ushort)(destLeft + tileImageArr[idx].x), (ushort)(destTop + tileImageArr[idx].y));
            }

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Frame Marker Command (End) with frameID: {0}.", frameId);
            rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_END, frameId);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting TS_FRAME_ACKNOWLEDGE_PDU.");
            rdprfxAdapter.ExpectTsFrameAcknowledgePdu(frameId, waitTime);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Verify output on SUT Display if the verifySUTDisplay entry in PTF config is true.");
            Rectangle compareRect = new Rectangle(destLeft, destTop, image_64X64.Width, image_64X64.Height);
            this.VerifySUTDisplay(true, compareRect);

            #endregion
        }
        /// <summary>
        /// Method to create TS_RFX_TILESET.
        /// </summary>
        /// <param name="isImageMode">Indicates the operational mode.</param>
        /// <param name="entropy">Indicates the entropy algorithm.</param>
        /// <param name="tileImage">A RgbTile. The width and heigth must be less than or equals with 64.</param>
        public TS_RFX_TILESET CreateTsRfxTileSet(OperationalMode opMode, EntropyAlgorithm entropy, RgbTile tileImage)
        {
            TS_RFX_TILESET rfxTileSet = new TS_RFX_TILESET();
            rfxTileSet.CodecChannelT = new TS_RFX_CODEC_CHANNELT();
            rfxTileSet.CodecChannelT.blockType = blockType_Value.WBT_EXTENSION;
            rfxTileSet.CodecChannelT.blockLen = 22 + 5;
            rfxTileSet.CodecChannelT.codecId = 0x01;
            rfxTileSet.CodecChannelT.channelId = 0x00;
            rfxTileSet.subtype = 0xCAC2;
            rfxTileSet.idx = 0x0000;

            ushort lt = 0x0001;
            ushort flags = 0x0002;
            if (opMode == OperationalMode.VideoMode) flags = 0x0000;
            ushort cct = 0x0001;
            ushort xft = 0x0001;
            ushort et = 0x0001;
            if (entropy == EntropyAlgorithm.CLW_ENTROPY_RLGR3) et = 0x0004;
            ushort qt = 0x0001;
            rfxTileSet.properties = lt;
            rfxTileSet.properties |= (ushort)(flags << 1);
            rfxTileSet.properties |= (ushort)(cct << 4);
            rfxTileSet.properties |= (ushort)(xft << 6);
            rfxTileSet.properties |= (ushort)(et << 10);
            rfxTileSet.properties |= (ushort)(qt << 14);

            rfxTileSet.numQuant = 1;
            rfxTileSet.tileSize = RdprfxServer.TileSize;
            rfxTileSet.numTiles = 1;

            rfxTileSet.quantVals = new TS_RFX_CODEC_QUANT[1];
            rfxTileSet.quantVals[0] = codecQuant;

            byte[] yData, cbData, crData;

            RemoteFXCodecContext encodingContext = new RemoteFXCodecContext(codecQuant, entropy);
            RemoteFXEncoder.EncodeTile(tileImage, 0, 0, encodingContext);
            yData = encodingContext.YData;
            cbData = encodingContext.CbData;
            crData = encodingContext.CrData;

            rfxTileSet.tiles = new TS_RFX_TILE[1];
            rfxTileSet.tiles[0].BlockT.blockType = blockType_Value.CBT_TILE;
            rfxTileSet.tiles[0].BlockT.blockLen = (uint)(19 + yData.Length + cbData.Length + crData.Length);
            rfxTileSet.tiles[0].quantIdxY = 0;
            rfxTileSet.tiles[0].quantIdxCb = 0;
            rfxTileSet.tiles[0].quantIdxCr = 0;
            rfxTileSet.tiles[0].xIdx = 0;
            rfxTileSet.tiles[0].yIdx = 0;
            rfxTileSet.tiles[0].YLen = (ushort)yData.Length;
            rfxTileSet.tiles[0].CbLen = (ushort)cbData.Length;
            rfxTileSet.tiles[0].CrLen = (ushort)crData.Length;
            rfxTileSet.tiles[0].YData = yData;
            rfxTileSet.tiles[0].CbData = cbData;
            rfxTileSet.tiles[0].CrData = crData;

            rfxTileSet.tilesDataSize = rfxTileSet.tiles[0].BlockT.blockLen;
            rfxTileSet.CodecChannelT.blockLen = 22 + 5 + rfxTileSet.tilesDataSize;

            return rfxTileSet;
        }
示例#33
0
        private static bool IsCausalClusterInstance(KernelContext kernelContext)
        {
            OperationalMode thisMode = kernelContext.DatabaseInfo().OperationalMode;

            return(OperationalMode.core.Equals(thisMode) || OperationalMode.read_replica.Equals(thisMode));
        }
        public void Rdprfx_HeaderMessage_PositiveTest_OrderTest_VersionsContextChannels()
        {
            #region Test Description
            /*
            Step 1: [RDPBCGR] establishing the connection.
            Step 2: [RDPBCGR] send Frame Maker Command (Begin) to SUT.
            Step 3: [RDPRFX] Send Encode Header Messages to SUT in order of TS_RFX_SYNC -> TS_RFX_VERSIONS -> TS_RFX_CONTEXT -> TS_RFX_CHANNELS.
            Step 4: [RDPRFX] Send one frame of Encode Data Messages to SUT.
            Step 5: [RDPBCGR] send Frame Maker Command (End) to SUT.
            Step 6: [RDPRFX] Expect SUT sends a TS_FRAME_ACKNOWLEDGE_PDU.
            */
            #endregion

            #region Test Sequence

            //Start RDP listening.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Starting RDP listening.");
            this.rdpbcgrAdapter.StartRDPListening(transportProtocol);

            #region Trigger client to connect
            //Trigger client to connect. 
            this.TestSite.Log.Add(LogEntryKind.Comment, "Triggering SUT to initiate a RDP connection to server.");
            triggerClientRDPConnect(transportProtocol);
            #endregion

            #region RDPBCGR Connection

            //Waiting for the transport level connection request.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting the transport layer connection request.");
            this.rdpbcgrAdapter.ExpectTransportConnection(RDPSessionType.Normal);

            
            //Set Server Capability with RomoteFX codec supported.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Setting Server Capability.");
            setServerCapabilitiesWithRemoteFxSupported();

            //Waiting for the RDP connection sequence.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Establishing RDP connection.");
            this.rdpbcgrAdapter.EstablishRDPConnection(selectedProtocol, enMethod, enLevel, true, false, rdpServerVersion);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Server Save Session Info PDU to SUT to notify user has logged on.");
            this.rdpbcgrAdapter.ServerSaveSessionInfo(LogonNotificationType.UserLoggedOn, ErrorNotificationType_Values.LOGON_FAILED_OTHER);

            #endregion

            //Initial the RDPRFX adapter context.
            rdprfxAdapter.Accept(this.rdpbcgrAdapter.ServerStack, this.rdpbcgrAdapter.SessionContext);

            TS_RFX_ICAP[] clientSupportedCaps;
            rdprfxAdapter.ReceiveAndCheckClientCapabilities(maxRequestSize, out clientSupportedCaps);

            uint frameId = 0; //The index of the sending frame.
            OperationalMode opMode = OperationalMode.ImageMode;
            EntropyAlgorithm enAlgorithm = EntropyAlgorithm.CLW_ENTROPY_RLGR3;
            ushort destLeft = 0; //the left bound of the frame.
            ushort destTop = 0; //the top bound of the frame.

            //Set OperationalMode/EntropyAlgorithm to valid pair.
            if (clientSupportedCaps != null)
            {
                opMode = (OperationalMode)clientSupportedCaps[0].flags;
                enAlgorithm = (EntropyAlgorithm)clientSupportedCaps[0].entropyBits;
            }

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Frame Marker Command (Begin) with frameID: {0}.", frameId);
            rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_BEGIN, frameId);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending one frame of encoded bitmap data to client. Operational Mode = {0}, Entropy Algorithm = {1}, destLeft = {2}, destTop = {3}.",
                opMode, enAlgorithm, destLeft, destTop);

            this.TestSite.Log.Add(LogEntryKind.Comment,
                "Sending the encode header messages in the order of TS_RFX_SYNC -> TS_RFX_VERSIONS -> TS_RFX_CONTEXT -> TS_RFX_CHANNELS.");
            rdprfxAdapter.SendTsRfxSync();
            rdprfxAdapter.SendTsRfxCodecVersions();
            rdprfxAdapter.SendTsRfxContext(opMode, enAlgorithm);
            rdprfxAdapter.SendTsRfxChannels();

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending the encode data messages to client.");
            rdprfxAdapter.SendTsRfxFrameBegin(0);
            rdprfxAdapter.SendTsRfxRegion();
            rdprfxAdapter.SendTsRfxTileSet(opMode, enAlgorithm, image_64X64);
            rdprfxAdapter.SendTsRfxFrameEnd();
            rdprfxAdapter.FlushEncodedData(destLeft, destTop);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Frame Marker Command (End) with frameID: {0}.", frameId);
            rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_END, frameId);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting TS_FRAME_ACKNOWLEDGE_PDU.");
            rdprfxAdapter.ExpectTsFrameAcknowledgePdu(frameId, waitTime);
            #endregion
        } 
        public void Rdprfx_ImageMode_NegativeTest_TsRfxFrameBegin_InvalidBlockLen()
        {
            #region Test Description

            /*
             * Step 1: [RDPBCGR] establishing the connection.
             * Step 2: [RDPRFX] send one frame of Encode Header and Data Messages to client, set the blockLen field of TS_RFX_FRAME_BEGIN to an invalid value (less than the actual).
             * Step 3: [RDPRFX] expect the client terminates the RDP connection.
             */
            #endregion

            #region Test Sequence

            //Start RDP listening.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Starting RDP listening.");
            this.rdpbcgrAdapter.StartRDPListening(transportProtocol);

            #region Trigger client to connect
            //Trigger client to connect.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Triggering SUT to initiate a RDP connection to server.");
            triggerClientRDPConnect(transportProtocol);
            #endregion

            #region RDPBCGR Connection

            //Waiting for the transport level connection request.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting the transport layer connection request.");
            this.rdpbcgrAdapter.ExpectTransportConnection(RDPSessionType.Normal);

            //Set Server Capability with RomoteFX codec supported.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Setting Server Capability.");
            setServerCapabilitiesWithRemoteFxSupported();

            //Waiting for the RDP connection sequence.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Establishing RDP connection.");
            this.rdpbcgrAdapter.EstablishRDPConnection(selectedProtocol, enMethod, enLevel, true, false, rdpServerVersion);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Server Save Session Info PDU to SUT to notify user has logged on.");
            this.rdpbcgrAdapter.ServerSaveSessionInfo(LogonNotificationType.UserLoggedOn, ErrorNotificationType_Values.LOGON_FAILED_OTHER);

            #endregion

            //Initial the RDPRFX adapter context.
            rdprfxAdapter.Accept(this.rdpbcgrAdapter.ServerStack, this.rdpbcgrAdapter.SessionContext);

            receiveAndLogClientRfxCapabilites();

            OperationalMode  opMode      = OperationalMode.ImageMode;
            EntropyAlgorithm enAlgorithm = EntropyAlgorithm.CLW_ENTROPY_RLGR3;
            ushort           destLeft    = 0; //the left bound of the frame.
            ushort           destTop     = 0; //the top bound of the frame.

            //Check if the above setting is supported by the client.
            if (!this.rdprfxAdapter.CheckIfClientSupports(opMode, enAlgorithm))
            {
                enAlgorithm = EntropyAlgorithm.CLW_ENTROPY_RLGR1;
                if (!this.rdprfxAdapter.CheckIfClientSupports(opMode, enAlgorithm))
                {
                    this.TestSite.Log.Add(LogEntryKind.Comment, "Client does not support Image Mode, so stop running this test case.");
                    return;
                }
            }

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdprfxNegativeType.TsRfxFrameBegin_InvalidBlockLen);
            rdprfxAdapter.SetTestType(RdprfxNegativeType.TsRfxFrameBegin_InvalidBlockLen);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Encode Header/Data Messages to client.");
            rdprfxAdapter.SendImageToClient(image_64X64, opMode, enAlgorithm, destLeft, destTop);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting the client terminates the RDP connection.");
            bool bDisconnected = rdpbcgrAdapter.WaitForDisconnection(waitTime);

            this.TestSite.Assert.IsTrue(bDisconnected, "Client is expected to drop the connection if received encode data in Video Mode when Image Mode is in effect.");

            #endregion
        }
示例#36
0
 public LuceneKernelExtension(File storeDir, Config config, System.Func <IndexConfigStore> indexStore, FileSystemAbstraction fileSystemAbstraction, IndexProviders indexProviders, OperationalMode operationalMode)
 {
     Org.Neo4j.Kernel.spi.explicitindex.IndexProviders proxyIndexProviders = CreateImposterOf(typeof(Org.Neo4j.Kernel.spi.explicitindex.IndexProviders), indexProviders);
     @delegate = new Org.Neo4j.Kernel.Api.Impl.Index.LuceneKernelExtension(storeDir, config, indexStore, fileSystemAbstraction, proxyIndexProviders, operationalMode);
 }
        /// <summary>
        /// Encode a bitmap data by RemoteFX codec.
        /// </summary>
        /// <param name="image"> The bitmap image to be sent </param>
        /// <param name="opMode"> Indicate Operational Mode.</param>
        /// <param name="entropy"> Indicate Entropy Algorithm.</param>
        /// <param name="imgPos"> The top-left position of bitmap image relative to surface</param>
        /// <param name="sId"> The surface Id that bitmap image is sent to </param>
        /// <returns> A dictionary with frameId and byte stream frame pair </returns>
        public Dictionary<uint, byte[]> RemoteFXCodecEncode(System.Drawing.Image image, OperationalMode opMode, EntropyAlgorithm entropy,
            RDPGFX_POINT16 imgPos, ushort sId, PixelFormat pixFormat)
        {
            if (image == null) return null;

            Dictionary<uint, byte[]> frDict = new Dictionary<uint, byte[]>();   // Save encoded frames for one tile

            TileImage[] tileImageArr = RdprfxTileUtils.SplitToTileImage(image, RdprfxServer.TileSize, RdprfxServer.TileSize);

            for (uint index = 0; index < tileImageArr.Length; index++)
            {
                byte[] tileBitmap = this.PackRfxTileImage(index, opMode, entropy, tileImageArr[index].image);
                ushort tileLeft = (ushort)(imgPos.x + tileImageArr[index].x);
                ushort tileTop = (ushort)(imgPos.y + tileImageArr[index].y);
                RDPGFX_RECT16 tileRect = new RDPGFX_RECT16(tileLeft, tileTop,
                                                            (ushort)(tileLeft + tileImageArr[index].image.Width),
                                                            (ushort)(tileTop + tileImageArr[index].image.Height));

                uint fid = MakeStartFramePdu();
                MakeWireToSurfacePdu1(sId, CodecType.RDPGFX_CODECID_CAVIDEO, pixFormat, tileRect, tileBitmap);
                MakeEndFramePdu(fid);

                if (this.bcgrAdapter.SimulatedScreen != null)
                {
                    this.bcgrAdapter.SimulatedScreen.RenderRemoteFXTile(sId, tileRect);
                }

                frDict.Add(fid, EncodePdusToSent());
            }

            return frDict;
        }
示例#38
0
 private LuceneDataSource GetLuceneDataSource(Config config, OperationalMode operationalMode)
 {
     return(new LuceneDataSource(_directory.databaseLayout(), config, _indexStore, new DefaultFileSystemAbstraction(), operationalMode));
 }
示例#39
0
 public abstract SbtResult SetOperationalMode(OperationalMode operationalMode);
        public void Rdprfx_VerifyClientCapabilities()
        {
            #region Test Description

            /*
             * Step 1: trigger SUT initial a connection request.
             * Step 2: continue the connection until Capabilities Exchange phase.
             * Step 3: server sends Demand Active PDU to SUT.
             * Step 4: Expect SUT responds a Confirm Active PDU and verify this PDU.
             */
            #endregion

            #region Test Sequence

            //Start RDP listening.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Starting RDP listening.");
            this.rdpbcgrAdapter.StartRDPListening(transportProtocol);

            #region Trigger client to connect
            //Trigger client to connect.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Triggering SUT to initiate a RDP connection to server.");
            triggerClientRDPConnect(transportProtocol);
            #endregion

            #region Connection initialization phase

            //Waiting for the transport level connection request.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting the transport layer connection request.");
            this.rdpbcgrAdapter.ExpectTransportConnection(RDPSessionType.Normal);

            #region Connection Initiation phase
            //Expect SUT send a Client X.224 Connection Request PDU.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Client X.224 Connection Request PDU");
            this.rdpbcgrAdapter.ExpectPacket <Client_X_224_Connection_Request_Pdu>(waitTime);

            //Respond a Server X.224 Connection Confirm PDU and set the EXTENDED_CLIENT_DATA_SUPPORTED flag.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Server X.224 Connection Confirm PDU to SUT. Selected protocol: {0}; Extended Client Data supported: true", selectedProtocol.ToString());
            this.rdpbcgrAdapter.Server_X_224_Connection_Confirm(selectedProtocol, true, true, NegativeType.None);
            #endregion

            #region Basic Setting Exchange phase
            //Expect SUT send Client MCS Connect Initial PDU.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Client MCS Connect Initial PDU.");
            this.rdpbcgrAdapter.ExpectPacket <Client_MCS_Connect_Initial_Pdu_with_GCC_Conference_Create_Request>(waitTime);

            //Respond a Server MCS Connect Response PDU with GCC Conference Create Response.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Server MCS Connect Response PDU to SUT. Encryption Method {0}; Encryption Level: {1}; RDP Version Code: {2}.", enMethod.ToString(), enLevel.ToString(), TS_UD_SC_CORE_version_Values.V2.ToString());
            this.rdpbcgrAdapter.Server_MCS_Connect_Response(enMethod, enLevel, TS_UD_SC_CORE_version_Values.V2, NegativeType.None);
            #endregion

            #region Channel Connection phase
            //Expect a Client MCS Erect Domain Request PDU.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Client MCS Erect Domain Request PDU.");
            this.rdpbcgrAdapter.ExpectPacket <Client_MCS_Erect_Domain_Request>(waitTime);

            //Expect a Client MCS Attach User Request PDU
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Client MCS Attach User Request PDU.");
            this.rdpbcgrAdapter.ExpectPacket <Client_MCS_Attach_User_Request>(waitTime);

            //Respond a Server MCS Channel Join Confirm PDU.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Server MCS Channel Join Confirm PDU to SUT.");
            this.rdpbcgrAdapter.MCSAttachUserConfirm(NegativeType.None);

            //Expect SUT start a channel join sequence
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect SUT to start the  channel join sequence.");
            this.rdpbcgrAdapter.ChannelJoinRequestAndConfirm(NegativeType.None);
            #endregion

            #region RDP Security Commencement phase
            //Expects SUT continue the connection by sending a Client Security Exchange PDU
            //(if Standard RDP Security mechanisms are being employed) or a Client Info PDU.
            if (transportProtocol == EncryptedProtocol.Rdp)
            {
                this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting SUT to send Client a Security Exchange PDU.");
                this.rdpbcgrAdapter.ExpectPacket <Client_Security_Exchange_Pdu>(waitTime);
            }
            #endregion

            #region Secure Setting Exchange phase
            //Expect a Client Info PDU.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting SUT to send Client a Client Info PDU.");
            this.rdpbcgrAdapter.ExpectPacket <Client_Info_Pdu>(waitTime);
            #endregion

            #region Licensing phase
            //Send SUT a Server License Error Pdu - Valid Client.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending a Server License Error Pdu - Valid Client to SUT.");
            this.rdpbcgrAdapter.Server_License_Error_Pdu_Valid_Client(NegativeType.None);
            #endregion

            #region Capabilities Exchange phase
            //Set Server Capability with RomoteFX codec supported.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Setting Server Capability. Server advertises the support for MS-RDPRFX.");
            setServerCapabilitiesWithRemoteFxSupported();

            //Send a Server Demand Active PDU to SUT.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending a Server Demand Active PDU to SUT.");
            this.rdpbcgrAdapter.Server_Demand_Active(NegativeType.None);

            //Expect SUT respond a Client Confirm Active PDU.
            //Once the Confirm Active PDU has been sent, the client can start sending input PDUs (see section 2.2.8) to the server.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Client Confirm Active PDU.");
            this.rdpbcgrAdapter.ExpectPacket <Client_Confirm_Active_Pdu>(waitTime);
            #endregion

            //Initial the RDPRFX adapter context.
            this.rdprfxAdapter.Accept(this.rdpbcgrAdapter.ServerStack, this.rdpbcgrAdapter.SessionContext);

            //Verify the Client capabilites.
            TS_RFX_ICAP[] supportedRfxCaps;
            this.rdprfxAdapter.ReceiveAndCheckClientCapabilities(maxRequestSize, out supportedRfxCaps);

            if (supportedRfxCaps != null)
            {
                foreach (TS_RFX_ICAP iCap in supportedRfxCaps)
                {
                    OperationalMode  opMode = (OperationalMode)iCap.flags;
                    EntropyAlgorithm enAlg  = (EntropyAlgorithm)iCap.entropyBits;
                    this.TestSite.Log.Add(LogEntryKind.Comment, "Client supports ({0}, {1}).", opMode, enAlg);
                }
            }

            #endregion

            #endregion
        }
        public void Rdprfx_ImageMode_PositiveTest_RLGR3()
        {
            #region Test Description

            /*
             * Step 1: [RDPBCGR] establishing the connection.
             * Step 2: [RDPBCGR] send Frame Maker Command (Begin) to SUT.
             * Step 3: [RDPRFX] Send Encode Header Messages to SUT.
             * Step 4: [RDPRFX] Send one frame of Encode Data Messages (encoded with RLGR3) to SUT.
             * Step 5: [RDPBCGR] send Frame Maker Command (End) to SUT.
             * Step 6: [RDPRFX] Expect SUT sends a TS_FRAME_ACKNOWLEDGE_PDU.
             */
            #endregion

            #region Test Sequence

            //Start RDP listening.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Starting RDP listening.");
            this.rdpbcgrAdapter.StartRDPListening(transportProtocol);

            #region Trigger client to connect
            //Trigger client to connect.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Triggering SUT to initiate a RDP connection to server.");
            triggerClientRDPConnect(transportProtocol, true);
            #endregion

            #region RDPBCGR Connection

            //Waiting for the transport level connection request.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting the transport layer connection request.");
            this.rdpbcgrAdapter.ExpectTransportConnection(RDPSessionType.Normal);

            //Set Server Capability with RomoteFX codec supported.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Setting Server Capability.");
            setServerCapabilitiesWithRemoteFxSupported();

            //Waiting for the RDP connection sequence.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Establishing RDP connection.");
            this.rdpbcgrAdapter.EstablishRDPConnection(selectedProtocol, enMethod, enLevel, true, false, rdpServerVersion);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Server Save Session Info PDU to SUT to notify user has logged on.");
            this.rdpbcgrAdapter.ServerSaveSessionInfo(LogonNotificationType.UserLoggedOn, ErrorNotificationType_Values.LOGON_FAILED_OTHER);

            #endregion

            //Initial the RDPRFX adapter context.
            rdprfxAdapter.Accept(this.rdpbcgrAdapter.ServerStack, this.rdpbcgrAdapter.SessionContext);

            receiveAndLogClientRfxCapabilites();

            uint             frameId     = 0; //The index of the sending frame.
            OperationalMode  opMode      = OperationalMode.ImageMode;
            EntropyAlgorithm enAlgorithm = EntropyAlgorithm.CLW_ENTROPY_RLGR3;
            ushort           destLeft    = 64; //the left bound of the frame.
            ushort           destTop     = 64; //the top bound of the frame.

            //Check if the above setting is supported by the client.
            if (!this.rdprfxAdapter.CheckIfClientSupports(opMode, enAlgorithm))
            {
                this.TestSite.Log.Add(LogEntryKind.Comment, "the input pair of Operational Mode ({0}) / Entropy Algorithm ({1}) is not supported by the client, so stop running this test case.", opMode, enAlgorithm);
                return;
            }

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Frame Marker Command (Begin) with frameID: {0}.", frameId);
            rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_BEGIN, frameId);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending one frame of encoded bitmap data to client. Operational Mode = {0}, Entropy Algorithm = {1}, destLeft = {2}, destTop = {3}.",
                                  opMode, enAlgorithm, destLeft, destTop);
            rdprfxAdapter.SendImageToClient(image_64X64, opMode, enAlgorithm, destLeft, destTop);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Frame Marker Command (End) with frameID: {0}.", frameId);
            rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_END, frameId);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting TS_FRAME_ACKNOWLEDGE_PDU.");
            rdprfxAdapter.ExpectTsFrameAcknowledgePdu(frameId, waitTime);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Verify output on SUT Display if the verifySUTDisplay entry in PTF config is true.");
            Rectangle compareRect = new Rectangle(destLeft, destTop, image_64X64.Width, image_64X64.Height);
            this.VerifySUTDisplay(true, compareRect);

            #endregion
        }
示例#42
0
 private DatabaseInfo(Edition edition, OperationalMode operationalMode)
 {
     this.Edition         = edition;
     this.OperationalMode = operationalMode;
 }