예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChannelOpenMessage"/> class.
 /// </summary>
 /// <param name="channelNumber">The channel number.</param>
 /// <param name="initialWindowSize">Initial size of the window.</param>
 /// <param name="maximumPacketSize">Maximum size of the packet.</param>
 /// <param name="info">The info.</param>
 public ChannelOpenMessage(uint channelNumber, uint initialWindowSize, uint maximumPacketSize, ChannelOpenInfo info)
 {
     this.LocalChannelNumber = channelNumber;
     this.InitialWindowSize = initialWindowSize;
     this.MaximumPacketSize = maximumPacketSize;
     this.Info = info;
 }
예제 #2
0
        /// <summary>
        /// Called when type specific data need to be loaded.
        /// </summary>
        protected override void LoadData()
        {
            var channelName = this.ReadString();
            this.LocalChannelNumber = this.ReadUInt32();
            this.InitialWindowSize = this.ReadUInt32();
            this.MaximumPacketSize = this.ReadUInt32();
            var bytes = this.ReadBytes();

            if (channelName == SessionChannelOpenInfo.NAME)
            {
                this.Info = new SessionChannelOpenInfo();
            }
            else if (channelName == X11ChannelOpenInfo.NAME)
            {
                this.Info = new X11ChannelOpenInfo();
            }
            else if (channelName == DirectTcpipChannelInfo.NAME)
            {
                this.Info = new DirectTcpipChannelInfo();
            }
            else if (channelName == ForwardedTcpipChannelInfo.NAME)
            {
                this.Info = new ForwardedTcpipChannelInfo();
            }
            else
            {
                throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Channel type '{0}' is not supported.", channelName));
            }

            this.Info.Load(bytes);

        }
예제 #3
0
        /// <summary>
        /// Called when type specific data need to be loaded.
        /// </summary>
        protected override void LoadData()
        {
            var channelName = this.ReadString();

            this.LocalChannelNumber = this.ReadUInt32();
            this.InitialWindowSize  = this.ReadUInt32();
            this.MaximumPacketSize  = this.ReadUInt32();
            var bytes = this.ReadBytes();

            if (channelName == SessionChannelOpenInfo.NAME)
            {
                this.Info = new SessionChannelOpenInfo();
            }
            else if (channelName == X11ChannelOpenInfo.NAME)
            {
                this.Info = new X11ChannelOpenInfo();
            }
            else if (channelName == DirectTcpipChannelInfo.NAME)
            {
                this.Info = new DirectTcpipChannelInfo();
            }
            else if (channelName == ForwardedTcpipChannelInfo.NAME)
            {
                this.Info = new ForwardedTcpipChannelInfo();
            }
            else
            {
                throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Channel type '{0}' is not supported.", channelName));
            }

            this.Info.Load(bytes);
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChannelOpenMessage"/> class.
 /// </summary>
 /// <param name="channelNumber">The channel number.</param>
 /// <param name="initialWindowSize">Initial size of the window.</param>
 /// <param name="maximumPacketSize">Maximum size of the packet.</param>
 /// <param name="info">The info.</param>
 public ChannelOpenMessage(uint channelNumber, uint initialWindowSize, uint maximumPacketSize, ChannelOpenInfo info)
 {
     this.LocalChannelNumber = channelNumber;
     this.InitialWindowSize  = initialWindowSize;
     this.MaximumPacketSize  = maximumPacketSize;
     this.Info = info;
 }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChannelOpenMessage"/> class.
        /// </summary>
        /// <param name="channelNumber">The channel number.</param>
        /// <param name="initialWindowSize">Initial size of the window.</param>
        /// <param name="maximumPacketSize">Maximum size of the packet.</param>
        /// <param name="info">Information specific to the type of the channel to open.</param>
        /// <exception cref="ArgumentNullException"><paramref name="info"/> is <c>null</c>.</exception>
        public ChannelOpenMessage(uint channelNumber, uint initialWindowSize, uint maximumPacketSize, ChannelOpenInfo info)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }

            ChannelType        = Ascii.GetBytes(info.ChannelType);
            LocalChannelNumber = channelNumber;
            InitialWindowSize  = initialWindowSize;
            MaximumPacketSize  = maximumPacketSize;
            Info       = info;
            _infoBytes = info.GetBytes();
        }
 /// <summary>
 /// Called when channel need to be open on the client.
 /// </summary>
 /// <param name="info">Channel open information.</param>
 protected virtual void OnOpen(ChannelOpenInfo info)
 {
 }
예제 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChannelOpenMessage"/> class.
        /// </summary>
        /// <param name="channelNumber">The channel number.</param>
        /// <param name="initialWindowSize">Initial size of the window.</param>
        /// <param name="maximumPacketSize">Maximum size of the packet.</param>
        /// <param name="info">Information specific to the type of the channel to open.</param>
        /// <exception cref="ArgumentNullException"><paramref name="info"/> is <c>null</c>.</exception>
        public ChannelOpenMessage(uint channelNumber, uint initialWindowSize, uint maximumPacketSize, ChannelOpenInfo info)
        {
            if (info == null)
                throw new ArgumentNullException("info");

#if TUNING
            ChannelType = Ascii.GetBytes(info.ChannelType);
#endif
            LocalChannelNumber = channelNumber;
            InitialWindowSize = initialWindowSize;
            MaximumPacketSize = maximumPacketSize;
            Info = info;
#if TUNING
            _infoBytes = info.GetBytes();
#endif
        }