Exemplo n.º 1
0
        /// <summary>
        /// Reassemble chunk data
        /// </summary>
        /// <param name="pdu"></param>
        /// <returns></returns>
        internal Virtual_Channel_Complete_Server_Pdu ReassembleChunkData(Virtual_Channel_RAW_Server_Pdu pdu)
        {
            if (!channelDicById.ContainsKey(pdu.commonHeader.channelId))
            {
                // drop the pdu if the channel id does not exist
                return(null);
            }
            ClientStaticVirtualChannel channel = (ClientStaticVirtualChannel)channelDicById[pdu.commonHeader.channelId];

            return(channel.ReassembleChunkData(pdu));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context"></param>
        public ClientStaticVirtualChannelManager(RdpbcgrClientContext context)
        {
            this.context          = context;
            this.channelDicById   = new Dictionary <ushort, StaticVirtualChannel>();
            this.channelDicByName = new Dictionary <string, StaticVirtualChannel>();
            ushort[]      virtualChannelIds     = context.VirtualChannelIdStore;
            CHANNEL_DEF[] virtualChannelDefines = context.VirtualChannelDefines;
            if (virtualChannelIds != null && virtualChannelDefines != null &&
                virtualChannelIds.Length == virtualChannelDefines.Length)
            {
                CompressionType compressType = context.VirtualChannelSCCompressionType;
                if (context.CompressionTypeSupported == CompressionType.PACKET_COMPR_TYPE_NONE)
                {
                    compressType = CompressionType.PACKET_COMPR_TYPE_NONE;
                }
                else if (context.CompressionTypeSupported == CompressionType.PACKET_COMPR_TYPE_RDP6 ||
                         context.CompressionTypeSupported == CompressionType.PACKET_COMPR_TYPE_RDP61)
                {
                    compressType = CompressionType.PACKET_COMPR_TYPE_64K;
                }

                for (int i = 0; i < virtualChannelIds.Length; ++i)
                {
                    string name = virtualChannelDefines[i].name;
                    if (name != null)
                    {
                        name = name.Replace("\0", string.Empty).ToUpper();
                    }
                    StaticVirtualChannel channel = new ClientStaticVirtualChannel(virtualChannelIds[i],
                                                                                  name,
                                                                                  virtualChannelDefines[i].options,
                                                                                  context.VCChunkSize,
                                                                                  compressType,
                                                                                  context.VirtualChannelCSCompressionType,
                                                                                  SendPacket);
                    channelDicById.Add(virtualChannelIds[i], channel);
                    channelDicByName.Add(name, channel);
                }
            }
        }