< Summary

Information
Class: Renci.SshNet.Messages.Connection.X11ForwardingRequestInfo
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Connection\ChannelRequest\X11ForwardingRequestInfo.cs
Line coverage
9%
Covered lines: 4
Uncovered lines: 37
Coverable lines: 41
Total lines: 133
Line coverage: 9.7%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_RequestName()100%10%
get_IsSingleConnection()100%10%
get_AuthenticationProtocol()100%10%
set_AuthenticationProtocol(...)100%10%
get_AuthenticationCookie()100%10%
get_ScreenNumber()100%10%
get_BufferCapacity()100%10%
.ctor()100%1100%
.ctor(...)100%10%
LoadData()100%10%
SaveData()100%10%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Connection\ChannelRequest\X11ForwardingRequestInfo.cs

#LineLine coverage
 1namespace Renci.SshNet.Messages.Connection
 2{
 3    /// <summary>
 4    /// Represents "x11-req" type channel request information.
 5    /// </summary>
 6    internal sealed class X11ForwardingRequestInfo : RequestInfo
 7    {
 8        private byte[] _authenticationProtocol;
 9
 10        /// <summary>
 11        /// Channel request name.
 12        /// </summary>
 13        public const string Name = "x11-req";
 14
 15        /// <summary>
 16        /// Gets the name of the request.
 17        /// </summary>
 18        /// <value>
 19        /// The name of the request.
 20        /// </value>
 21        public override string RequestName
 22        {
 023            get { return Name; }
 24        }
 25
 26        /// <summary>
 27        /// Gets or sets a value indicating whether it is a single connection.
 28        /// </summary>
 29        /// <value>
 30        /// <see langword="true"/> if it is a single connection; otherwise, <see langword="false"/>.
 31        /// </value>
 032        public bool IsSingleConnection { get; set; }
 33
 34        /// <summary>
 35        /// Gets the authentication protocol.
 36        /// </summary>
 37        /// <value>
 38        /// The authentication protocol.
 39        /// </value>
 40        public string AuthenticationProtocol
 41        {
 042            get { return Ascii.GetString(_authenticationProtocol, 0, _authenticationProtocol.Length); }
 043            private set { _authenticationProtocol = Ascii.GetBytes(value); }
 44        }
 45
 46        /// <summary>
 47        /// Gets or sets the authentication cookie.
 48        /// </summary>
 49        /// <value>
 50        /// The authentication cookie.
 51        /// </value>
 052        public byte[] AuthenticationCookie { get; set; }
 53
 54        /// <summary>
 55        /// Gets or sets the screen number.
 56        /// </summary>
 57        /// <value>
 58        /// The screen number.
 59        /// </value>
 060        public uint ScreenNumber { get; set; }
 61
 62        /// <summary>
 63        /// Gets the size of the message in bytes.
 64        /// </summary>
 65        /// <value>
 66        /// The size of the messages in bytes.
 67        /// </value>
 68        protected override int BufferCapacity
 69        {
 70            get
 071            {
 072                var capacity = base.BufferCapacity;
 073                capacity += 1; // IsSingleConnection
 074                capacity += 4; // AuthenticationProtocol length
 075                capacity += _authenticationProtocol.Length; // AuthenticationProtocol
 076                capacity += 4; // AuthenticationCookie length
 077                capacity += AuthenticationCookie.Length; // AuthenticationCookie
 078                capacity += 4; // ScreenNumber
 079                return capacity;
 080            }
 81        }
 82
 83        /// <summary>
 84        /// Initializes a new instance of the <see cref="X11ForwardingRequestInfo"/> class.
 85        /// </summary>
 280486        public X11ForwardingRequestInfo()
 280487        {
 280488            WantReply = true;
 280489        }
 90
 91        /// <summary>
 92        /// Initializes a new instance of the <see cref="X11ForwardingRequestInfo"/> class.
 93        /// </summary>
 94        /// <param name="isSingleConnection">if set to <see langword="true"/> it is a single connection.</param>
 95        /// <param name="protocol">The protocol.</param>
 96        /// <param name="cookie">The cookie.</param>
 97        /// <param name="screenNumber">The screen number.</param>
 98        public X11ForwardingRequestInfo(bool isSingleConnection, string protocol, byte[] cookie, uint screenNumber)
 099            : this()
 0100        {
 0101            IsSingleConnection = isSingleConnection;
 0102            AuthenticationProtocol = protocol;
 0103            AuthenticationCookie = cookie;
 0104            ScreenNumber = screenNumber;
 0105        }
 106
 107        /// <summary>
 108        /// Called when type specific data need to be loaded.
 109        /// </summary>
 110        protected override void LoadData()
 0111        {
 0112            base.LoadData();
 113
 0114            IsSingleConnection = ReadBoolean();
 0115            _authenticationProtocol = ReadBinary();
 0116            AuthenticationCookie = ReadBinary();
 0117            ScreenNumber = ReadUInt32();
 0118        }
 119
 120        /// <summary>
 121        /// Called when type specific data need to be saved.
 122        /// </summary>
 123        protected override void SaveData()
 0124        {
 0125            base.SaveData();
 126
 0127            Write(IsSingleConnection);
 0128            WriteBinaryString(_authenticationProtocol);
 0129            WriteBinaryString(AuthenticationCookie);
 0130            Write(ScreenNumber);
 0131        }
 132    }
 133}