/// <summary> /// Reasemble Chunk Data /// </summary> /// <param name="pdu"></param> /// <returns></returns> internal Virtual_Channel_Complete_Pdu ReassembleChunkData(Virtual_Channel_RAW_Pdu pdu) { if (!channelDicById.ContainsKey(pdu.commonHeader.channelId)) { // drop the pdu if the channel id does not exist //return null; throw new ArgumentException("The channel id of the pdu does not exist!"); } ServerStaticVirtualChannel channel = (ServerStaticVirtualChannel)channelDicById[pdu.commonHeader.channelId]; return(channel.ReassembleChunkData(pdu)); }
/// <summary> /// Constructor /// </summary> /// <param name="context"></param> public ServerStaticVirtualChannelManager(RdpbcgrServerSessionContext 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 ServerStaticVirtualChannel(virtualChannelIds[i], name, virtualChannelDefines[i].options, context.VCChunkSize, compressType, context.VirtualChannelCSCompressionType, SendPacket); channelDicById.Add(virtualChannelIds[i], channel); channelDicByName.Add(name, channel); } } }
/// <summary> /// Constructor /// </summary> /// <param name="context"></param> public ServerStaticVirtualChannelManager(RdpbcgrServerSessionContext 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_RDP62) { 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 ServerStaticVirtualChannel(virtualChannelIds[i], name, virtualChannelDefines[i].options, context.VCChunkSize, compressType, context.VirtualChannelCSCompressionType, SendPacket); channelDicById.Add(virtualChannelIds[i], channel); channelDicByName.Add(name, channel); } } }