The DYNVC_DATA_COMPRESSED PDU is used to send both single messages and blocks of fragmented messages when the data block is compressed.
상속: DataDvcBasePdu
예제 #1
0
        /// <summary>
        /// Create a DataCompressedDvcPdu
        /// </summary>
        /// <param name="channelId"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public DataCompressedDvcPdu[] CreateCompressedDataPdu(uint channelId, byte[] data)
        {
            MemoryStream ms = new MemoryStream(data);
            List <DataCompressedDvcPdu> pdus = new List <DataCompressedDvcPdu>();

            byte[] compressed = CompressDataToRdp8BulkEncodedData(data, PACKET_COMPR_FLAG.PACKET_COMPR_TYPE_LITE | PACKET_COMPR_FLAG.PACKET_COMPRESSED);

            DataCompressedDvcPdu pdu = new DataCompressedDvcPdu();

            pdu.HeaderBits.Cmd         = Cmd_Values.DataCompressed;
            pdu.HeaderBits.Sp          = 0x0;
            pdu.HeaderBits.CbChannelId = cbChId_Values.OneByte;
            pdu.ChannelId = channelId;

            RDP_SEGMENTED_DATA rdpSegmentedData = new RDP_SEGMENTED_DATA();

            rdpSegmentedData.descriptor = DescriptorTypes.SINGLE;

            RDP8_BULK_ENCODED_DATA rdp8BulkEncodedData = new RDP8_BULK_ENCODED_DATA();

            rdp8BulkEncodedData.header = (byte)(PACKET_COMPR_FLAG.PACKET_COMPR_TYPE_LITE | PACKET_COMPR_FLAG.PACKET_COMPRESSED);
            rdp8BulkEncodedData.data   = compressed;

            pdu.Data = PduMarshaler.Marshal(rdpSegmentedData);
            pdus.Add(pdu);
            return(pdus.ToArray());
        }
예제 #2
0
        /// <summary>
        ///  Create DYNVC_DATA_COMPRESSED
        /// </summary>
        public DataCompressedDvcPdu CreateDataCompressedReqPdu(uint channelId, byte[] data)
        {
            DataCompressedDvcPdu compressedPdu = new DataCompressedDvcPdu(channelId, data);

            compressedPdu.GetNonDataSize();
            return(compressedPdu);
        }
예제 #3
0
        /// <summary>
        /// Create a DataCompressedDvcPdu
        /// </summary>
        /// <param name="channelId"></param>
        /// <param name="data"></param>
        /// <param name="channelChunkLength"></param>
        /// <returns></returns>
        public DataCompressedDvcPdu[] CreateCompressedDataPdu(uint channelId, byte[] data, int channelChunkLength = 1599)
        {
            MemoryStream ms = new MemoryStream(data);
            List <DataCompressedDvcPdu> pdus = new List <DataCompressedDvcPdu>();

            //TODO: Here the compress algorithm has bug and cannot compress the data correctly. The size will become bigger than before comprssion
            byte[] compressed = CompressDataToRdp8BulkEncodedData(data, PACKET_COMPR_FLAG.PACKET_COMPR_TYPE_LITE | PACKET_COMPR_FLAG.PACKET_COMPRESSED);

            DataCompressedDvcPdu pdu = new DataCompressedDvcPdu();

            pdu.HeaderBits.Cmd         = Cmd_Values.DataCompressed;
            pdu.HeaderBits.Sp          = 0x0;
            pdu.HeaderBits.CbChannelId = cbChId_Values.OneByte;
            pdu.ChannelId = channelId;

            //RDP8_BULK_ENCODED_DATA rdp8BulkEncodedData = new RDP8_BULK_ENCODED_DATA();
            //rdp8BulkEncodedData.descriptor = 0xE0; //Single
            //rdp8BulkEncodedData.header = 0x26;//PACKET_COMPRESSED (0x2), PACKET_CMPR_TYPE_RDP8_LITE (0x06)
            //rdp8BulkEncodedData.data = compressed;

            byte[] rdp8Header = new byte[] { 0xE0, 0x26 }; //0xE0; Single 0x26:PACKET_COMPRESSED (0x2), PACKET_CMPR_TYPE_RDP8_LITE (0x06)

            var s = new MemoryStream();

            s.Write(rdp8Header, 0, rdp8Header.Length);
            s.Write(compressed, 0, compressed.Length);
            byte[] rdp8BulkEncodedData = s.ToArray();
            pdu.Data = rdp8BulkEncodedData;
            pdus.Add(pdu);
            return(pdus.ToArray());
        }
        private void SendDataCompressedReqPdu(uint channelId, byte[] data, DynamicVC_TransportType transportType)
        {
            DataCompressedDvcPdu pdu = pduBuilder.CreateDataCompressedReqPdu(channelId, data);

            Send(pdu, transportType);
        }
 /// <summary>
 ///  Create DYNVC_DATA_COMPRESSED 
 /// </summary>
 public DataCompressedDvcPdu CreateDataCompressedReqPdu(uint channelId, byte[] data)
 {
     DataCompressedDvcPdu compressedPdu = new DataCompressedDvcPdu(channelId, data);
     compressedPdu.GetNonDataSize();
     return compressedPdu;
 }
        /// <summary>
        /// Create a DataCompressedDvcPdu
        /// </summary>
        /// <param name="channelId"></param>
        /// <param name="data"></param>
        /// <param name="channelChunkLength"></param>
        /// <returns></returns>
        public DataCompressedDvcPdu[] CreateCompressedDataPdu(uint channelId, byte[] data, int channelChunkLength = 1599)
        {
            MemoryStream ms = new MemoryStream(data);
            List<DataCompressedDvcPdu> pdus = new List<DataCompressedDvcPdu>();

            //TODO: Here the compress algorithm has bug and cannot compress the data correctly. The size will become bigger than before comprssion
            byte[] compressed = CompressDataToRdp8BulkEncodedData(data, PACKET_COMPR_FLAG.PACKET_COMPR_TYPE_LITE | PACKET_COMPR_FLAG.PACKET_COMPRESSED);

            DataCompressedDvcPdu pdu = new DataCompressedDvcPdu();
            pdu.HeaderBits.Cmd = Cmd_Values.DataCompressed;
            pdu.HeaderBits.Sp = 0x0;
            pdu.HeaderBits.CbChannelId = cbChId_Values.OneByte;
            pdu.ChannelId = channelId;

            //RDP8_BULK_ENCODED_DATA rdp8BulkEncodedData = new RDP8_BULK_ENCODED_DATA();
            //rdp8BulkEncodedData.descriptor = 0xE0; //Single
            //rdp8BulkEncodedData.header = 0x26;//PACKET_COMPRESSED (0x2), PACKET_CMPR_TYPE_RDP8_LITE (0x06)
            //rdp8BulkEncodedData.data = compressed;

            byte[] rdp8Header = new byte[] { 0xE0, 0x26 }; //0xE0; Single 0x26:PACKET_COMPRESSED (0x2), PACKET_CMPR_TYPE_RDP8_LITE (0x06)

            var s = new MemoryStream();
            s.Write(rdp8Header, 0, rdp8Header.Length);
            s.Write(compressed, 0, compressed.Length);
            byte[] rdp8BulkEncodedData = s.ToArray();
            pdu.Data = rdp8BulkEncodedData;
            pdus.Add(pdu);
            return pdus.ToArray();
        }
예제 #7
0
        public void SendDataCompressedReqPdu(uint channelId, byte[] data)
        {
            DataCompressedDvcPdu pdu = pduBuilder.CreateDataCompressedReqPdu(channelId, data);

            Send(pdu, DynamicVC_TransportType.RDP_UDP_Reliable);
        }