The Virtual Channel PDU is sent from client to server or from server to client and is used to transport data between static virtual channel end-points.
file:///C:/ts_dev/TestSuites/MS-RDPBCGR/TestSuite/Src/TD/latest_XMLS_16may/RDPBCGR/ _rfc_ms-rdpbcgr2_1_6_1a.xml
Наследование: RdpbcgrServerPdu
Пример #1
0
 public override StackPacket Clone()
 {
     Virtual_Channel_Complete_Server_Pdu pduClone = new Virtual_Channel_Complete_Server_Pdu();
     pduClone.channelId = channelId;
     pduClone.virtualChannelData = RdpbcgrUtility.CloneByteArray(virtualChannelData);
     if (rawPdus != null)
     {
         pduClone.rawPdus = new Collection<Virtual_Channel_RAW_Server_Pdu>();
         for (int i = 0; i < rawPdus.Count; ++i)
         {
             pduClone.rawPdus.Add(rawPdus[i]);
         }
     }
     return pduClone;
 }
        /// <summary>
        /// Reassemble static virtual channel PDU
        /// </summary>
        /// <param name="pdu"></param>
        /// <returns></returns>
        internal Virtual_Channel_Complete_Server_Pdu ReassembleChunkData(Virtual_Channel_RAW_Server_Pdu pdu)
        {
            if (pdu == null || pdu.virtualChannelData == null)
            {
                return null;
            }

            // the first chunk
            if ((pdu.channelPduHeader.flags & CHANNEL_PDU_HEADER_flags_Values.CHANNEL_FLAG_FIRST)
                == CHANNEL_PDU_HEADER_flags_Values.CHANNEL_FLAG_FIRST)
            {
                completeServerPdu = new Virtual_Channel_Complete_Server_Pdu();
                completeServerPdu.rawPdus = new System.Collections.ObjectModel.Collection<Virtual_Channel_RAW_Server_Pdu>();
                completeServerPdu.channelId = channelId;
                decompressedBuffer.Clear();
            }

            byte[] decompressedData = pdu.virtualChannelData;

            if (mppcDecompressor != null)   // has compression
            {
                CompressMode flag = CompressMode.None;

                if ((pdu.channelPduHeader.flags & CHANNEL_PDU_HEADER_flags_Values.CHANNEL_PACKET_AT_FRONT)
                    == CHANNEL_PDU_HEADER_flags_Values.CHANNEL_PACKET_AT_FRONT)
                {
                    flag |= CompressMode.SetToFront;
                }

                if ((pdu.channelPduHeader.flags & CHANNEL_PDU_HEADER_flags_Values.CHANNEL_PACKET_COMPRESSED)
                    == CHANNEL_PDU_HEADER_flags_Values.CHANNEL_PACKET_COMPRESSED)
                {
                    flag |= CompressMode.Compressed;
                }

                if ((pdu.channelPduHeader.flags & CHANNEL_PDU_HEADER_flags_Values.CHANNEL_PACKET_FLUSHED)
                    == CHANNEL_PDU_HEADER_flags_Values.CHANNEL_PACKET_FLUSHED)
                {
                    flag |= CompressMode.Flush;
                }

                if (flag != CompressMode.None)
                {
                    decompressedData = mppcDecompressor.Decompress(pdu.virtualChannelData, flag);
                }
            }

            if (completeServerPdu != null)
            {
                completeServerPdu.rawPdus.Add(pdu);
                decompressedBuffer.AddRange(decompressedData);
            }
            else
            {
                // not need to reassemble
                Virtual_Channel_Complete_Server_Pdu returnPDU = new Virtual_Channel_Complete_Server_Pdu();
                returnPDU.rawPdus = new System.Collections.ObjectModel.Collection<Virtual_Channel_RAW_Server_Pdu>();
                returnPDU.channelId = channelId;
                returnPDU.rawPdus.Add(pdu);
                returnPDU.virtualChannelData = decompressedData;
                return returnPDU;
            }

            // the last chunk
            if ((pdu.channelPduHeader.flags & CHANNEL_PDU_HEADER_flags_Values.CHANNEL_FLAG_LAST)
                == CHANNEL_PDU_HEADER_flags_Values.CHANNEL_FLAG_LAST)
            {
                if (decompressedBuffer != null)
                {
                    completeServerPdu.virtualChannelData = decompressedBuffer.ToArray();
                }
                Virtual_Channel_Complete_Server_Pdu returnPDU = completeServerPdu;
                completeServerPdu = null;
                return returnPDU;
            }

            return null;
        }