/// <summary>
        /// Constructor
        /// </summary>
        /// <param name="connectedRdpServer"></param>
        /// <param name="context"></param>
        /// <param name="transportType"></param>
        public Rdpemt_DVCServerTransport(RdpbcgrServer connectedRdpServer, RdpbcgrServerSessionContext context, DynamicVC_TransportType transportType)
        {
            this.serverSessionContext = context;
            this.rdpbcgrServer        = connectedRdpServer;
            this.transportProtocol    = Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECR;
            if (transportType == DynamicVC_TransportType.RDP_UDP_Lossy)
            {
                this.transportProtocol = Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECL;
            }

            if (!serverSessionContext.IsClientMultitransportChannelDataRecieved)
            {
                throw new NotSupportedException("This RDP connection doesn't support multiple transport!");
            }

            try
            {
                EstablishTransportConnection();
            }
            catch (Exception)
            {
                // Ensure resource can be released properly if exception occurred in Constructor
                Dispose();
                // Not suppress the exception, transfer the error to test result.
                throw;
            }

            decoder    = new ServerDecodingPduBuilder();
            pduBuilder = new PduBuilder();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context"></param>
        public Rdpbcgr_DVCClientTransport(RdpbcgrClientContext context)
        {
            this.context = context;

            if (context.SVCManager == null)
            {
                throw new NotSupportedException("Cannot get SVC from RDPBCGR connection for RDPEDYC, this transport must be created after RDPBCGR connection established.");
            }

            channel = context.SVCManager.GetChannelByName(StaticVirtualChannelName.RDPEDYC);
            if (channel == null)
            {
                throw new NotSupportedException("Cannot get SVC from RDPBCGR connection for RDPEDYC, the static virtual channel is not created.");
            }

            channel.Received += ReceivedBytes;
            if (!context.SVCManager.IsRunning)
            {
                // Must start the SVC manager here, so as to make sure the first packet of RDPEDYC can be processed
                context.SVCManager.Start();
            }

            decoder    = new ClientDecodingPduBuilder();
            pduBuilder = new PduBuilder();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context"></param>
        public Rdpbcgr_DVCServerTransport(RdpbcgrServerSessionContext context)
        {
            this.sessionContext = context;

            if (sessionContext.SVCManager == null)
            {
                throw new NotSupportedException("Cannot get SVC from RDPBCGR connection for RDPEDYC, this transport must be created after RDPBCGR connection established.");
            }

            channel = sessionContext.SVCManager.GetChannelByName(StaticVirtualChannelName.RDPEDYC);
            if (channel == null)
            {
                throw new NotSupportedException("Cannot get SVC from RDPBCGR connection for RDPEDYC, the static virtual channel is not created.");
            }

            channel.Received += ReceivedBytes;

            if (!sessionContext.SVCManager.IsRunning)
            {
                // Better start the SVC manager here, so as to make sure the first packet of RDPEDYC can be processed
                // it is not same restrict as client, since the first packet is sent by server
                sessionContext.SVCManager.Start();
            }

            decoder = new ServerDecodingPduBuilder();
            pduBuilder = new PduBuilder();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context"></param>
        public Rdpbcgr_DVCServerTransport(RdpbcgrServerSessionContext context)
        {
            this.sessionContext = context;

            if (sessionContext.SVCManager == null)
            {
                throw new NotSupportedException("Cannot get SVC from RDPBCGR connection for RDPEDYC, this transport must be created after RDPBCGR connection established.");
            }

            channel = sessionContext.SVCManager.GetChannelByName(StaticVirtualChannelName.RDPEDYC);
            if (channel == null)
            {
                throw new NotSupportedException("Cannot get SVC from RDPBCGR connection for RDPEDYC, the static virtual channel is not created.");
            }

            channel.Received += ReceivedBytes;

            if (!sessionContext.SVCManager.IsRunning)
            {
                // Better start the SVC manager here, so as to make sure the first packet of RDPEDYC can be processed
                // it is not same restrict as client, since the first packet is sent by server
                sessionContext.SVCManager.Start();
            }

            decoder    = new ServerDecodingPduBuilder();
            pduBuilder = new PduBuilder();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context"></param>
        public Rdpbcgr_DVCClientTransport(RdpbcgrClientContext context)
        {
            this.context = context;

            if (context.SVCManager == null)
            {
                throw new NotSupportedException("Cannot get SVC from RDPBCGR connection for RDPEDYC, this transport must be created after RDPBCGR connection established.");
            }

            channel = context.SVCManager.GetChannelByName(StaticVirtualChannelName.RDPEDYC);
            if (channel == null)
            {
                throw new NotSupportedException("Cannot get SVC from RDPBCGR connection for RDPEDYC, the static virtual channel is not created.");
            }

            channel.Received += ReceivedBytes;
            if (!context.SVCManager.IsRunning)
            {
                // Must start the SVC manager here, so as to make sure the first packet of RDPEDYC can be processed
                context.SVCManager.Start();
            }

            decoder = new ClientDecodingPduBuilder();
            pduBuilder = new PduBuilder();
        }
        public DynamicVirtualChannel(UInt32 channelId, string channelName, ushort priority, IDVCTransport transport)
        {
            this.channelId   = channelId;
            this.channelName = channelName;
            this.priority    = priority;
            this.transport   = transport;

            pduBuilder = new PduBuilder();
            IsActive   = true;
        }
        public DynamicVirtualChannel(UInt32 channelId, string channelName, ushort priority, IDVCTransport transport)
        {
            this.channelId = channelId;
            this.channelName = channelName;
            this.priority = priority;
            this.transport = transport;

            pduBuilder = new PduBuilder();
            IsActive = true;
        }
        /// <summary>
        /// Construcotr
        /// </summary>
        /// <param name="clientSessionContext"></param>
        /// <param name="transportType"></param>
        public Rdpemt_DVCClientTransport(RdpbcgrClientContext clientSessionContext, DynamicVC_TransportType transportType)
        {
            this.clientSessionContext = clientSessionContext;
            this.transportProtocol    = Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECR;
            if (transportType == DynamicVC_TransportType.RDP_UDP_Lossy)
            {
                this.transportProtocol = Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECL;
            }

            decoder    = new ClientDecodingPduBuilder();
            pduBuilder = new PduBuilder();
        }
        /// <summary>
        /// Construcotr
        /// </summary>
        /// <param name="clientSessionContext"></param>
        /// <param name="transportType"></param>
        public Rdpemt_DVCClientTransport(RdpbcgrClientContext clientSessionContext, DynamicVC_TransportType transportType)
        {
            this.clientSessionContext = clientSessionContext;
            this.transportProtocol = Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECR;
            if (transportType == DynamicVC_TransportType.RDP_UDP_Lossy)
            {
                this.transportProtocol = Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECL;
            }

            EstablishTransportConnection();

            decoder = new ClientDecodingPduBuilder();
            pduBuilder = new PduBuilder();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context"></param>
        /// <param name="autoCreateChannel"></param>
        /// <param name="callBackMethodsDic"></param>
        public RdpedycClient(RdpbcgrClientContext context, bool autoCreateChannel = true)
        {
            this.clientSessionContext = context;
            transportDic = new Dictionary <DynamicVC_TransportType, IDVCTransport>();
            unprocessedDVCPacketBuffer = new List <UnprocessedDVCPDUInfo>();
            Rdpbcgr_DVCClientTransport transport = new Rdpbcgr_DVCClientTransport(context);

            channelDicbyId = new Dictionary <uint, DynamicVirtualChannel>();

            this.autoCreateChannel = autoCreateChannel;

            pduBuilder = new PduBuilder();

            transport.Received += ProcessPacketFromTCP;
            transportDic.Add(DynamicVC_TransportType.RDP_TCP, transport);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="server"></param>
        /// <param name="context"></param>
        public RdpedycServer(RdpbcgrServer server, RdpbcgrServerSessionContext context, bool autoCloseChannel = true)
        {
            this.rdpbcgrServer = server;
            this.sessionContext = context;
            transportDic = new Dictionary<DynamicVC_TransportType, IDVCTransport>();
            unprocessedDVCPacketBuffer = new List<UnprocessedDVCPDUInfo>();
            Rdpbcgr_DVCServerTransport transport = new Rdpbcgr_DVCServerTransport(context);

            channelDicbyId = new Dictionary<uint, DynamicVirtualChannel>();

            pduBuilder = new PduBuilder();

            transport.Received += ProcessPacketFromTCP;
            transportDic.Add(DynamicVC_TransportType.RDP_TCP, transport);

            this.autoCloseChannel = autoCloseChannel;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="client"></param>
        /// <param name="context"></param>
        /// <param name="autoCreateChannel"></param>
        /// <param name="callBackMethodsDic"></param>
        public RdpedycClient(RdpbcgrClient client, RdpbcgrClientContext context, bool autoCreateChannel = true, Dictionary<string, ReceiveData> callBackMethodsDic = null)
        {
            this.rdpbcgrClient = client;
            this.clientSessionContext = context;
            transportDic = new Dictionary<DynamicVC_TransportType, IDVCTransport>();
            unprocessedDVCPacketBuffer = new List<UnprocessedDVCPDUInfo>();
            Rdpbcgr_DVCClientTransport transport = new Rdpbcgr_DVCClientTransport(context);

            channelDicbyId = new Dictionary<uint, DynamicVirtualChannel>();

            this.autoCreateChannel = autoCreateChannel;
            this.callBackMethodsDic = callBackMethodsDic;

            pduBuilder = new PduBuilder();

            transport.Received += ProcessPacketFromTCP;
            transportDic.Add(DynamicVC_TransportType.RDP_TCP, transport);
        }
Example #13
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="connectedRdpServer"></param>
        /// <param name="context"></param>
        /// <param name="transportType"></param>
        public Rdpemt_DVCServerTransport(RdpbcgrServer connectedRdpServer, RdpbcgrServerSessionContext context, DynamicVC_TransportType transportType)
        {
            this.serverSessionContext = context;
            this.rdpbcgrServer        = connectedRdpServer;
            this.transportProtocol    = Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECR;
            if (transportType == DynamicVC_TransportType.RDP_UDP_Lossy)
            {
                this.transportProtocol = Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECL;
            }

            if (!serverSessionContext.IsClientMultitransportChannelDataRecieved)
            {
                throw new NotSupportedException("This RDP connection doesn't support multiple transport!");
            }

            EstablishTransportConnection();

            decoder    = new ServerDecodingPduBuilder();
            pduBuilder = new PduBuilder();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="connectedRdpServer"></param>
        /// <param name="context"></param>
        /// <param name="transportType"></param>
        public Rdpemt_DVCServerTransport(RdpbcgrServer connectedRdpServer, RdpbcgrServerSessionContext context, DynamicVC_TransportType transportType)
        {
            this.serverSessionContext = context;
            this.rdpbcgrServer = connectedRdpServer;
            this.transportProtocol = Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECR;
            if (transportType == DynamicVC_TransportType.RDP_UDP_Lossy)
            {
                this.transportProtocol = Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECL;
            }

            if (!serverSessionContext.IsClientMultitransportChannelDataRecieved)
            {
                throw new NotSupportedException("This RDP connection doesn't support multiple transport!");
            }

            EstablishTransportConnection();

            decoder = new ServerDecodingPduBuilder();
            pduBuilder = new PduBuilder();
        }