< Summary

Information
Class: Renci.SshNet.Messages.Connection.GlobalRequestMessage
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Connection\GlobalRequestMessage.cs
Line coverage
100%
Covered lines: 28
Uncovered lines: 0
Coverable lines: 28
Total lines: 89
Line coverage: 100%
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%1100%
get_WantReply()100%1100%
get_BufferCapacity()100%1100%
.ctor()100%1100%
.ctor(...)100%1100%
LoadData()100%1100%
SaveData()100%1100%
Process(...)100%1100%

File(s)

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

#LineLine coverage
 1namespace Renci.SshNet.Messages.Connection
 2{
 3    /// <summary>
 4    /// Represents SSH_MSG_GLOBAL_REQUEST message.
 5    /// </summary>
 6    [Message("SSH_MSG_GLOBAL_REQUEST", 80)]
 7    public class GlobalRequestMessage : Message
 8    {
 9        private byte[] _requestName;
 10
 11        /// <summary>
 12        /// Gets the name of the request.
 13        /// </summary>
 14        /// <value>
 15        /// The name of the request.
 16        /// </value>
 17        public string RequestName
 18        {
 1819            get { return Ascii.GetString(_requestName, 0, _requestName.Length); }
 20        }
 21
 22        /// <summary>
 23        /// Gets a value indicating whether message reply should be sent..
 24        /// </summary>
 25        /// <value>
 26        /// <see langword="true"/> if message reply should be sent; otherwise, <see langword="false"/>.
 27        /// </value>
 145028        public bool WantReply { get; private set; }
 29
 30        /// <summary>
 31        /// Gets the size of the message in bytes.
 32        /// </summary>
 33        /// <value>
 34        /// The size of the messages in bytes.
 35        /// </value>
 36        protected override int BufferCapacity
 37        {
 38            get
 739            {
 740                var capacity = base.BufferCapacity;
 741                capacity += 4; // RequestName length
 742                capacity += _requestName.Length; // RequestName
 743                capacity += 1; // WantReply
 744                return capacity;
 745            }
 46        }
 47
 48        /// <summary>
 49        /// Initializes a new instance of the <see cref="GlobalRequestMessage"/> class.
 50        /// </summary>
 115751        public GlobalRequestMessage()
 115752        {
 115753        }
 54
 55        /// <summary>
 56        /// Initializes a new instance of the <see cref="GlobalRequestMessage"/> class.
 57        /// </summary>
 58        /// <param name="requestName">Name of the request.</param>
 59        /// <param name="wantReply">if set to <see langword="true"/> [want reply].</param>
 28360        internal GlobalRequestMessage(byte[] requestName, bool wantReply)
 28361        {
 28362            _requestName = requestName;
 28363            WantReply = wantReply;
 28364        }
 65
 66        /// <summary>
 67        /// Called when type specific data need to be loaded.
 68        /// </summary>
 69        protected override void LoadData()
 115470        {
 115471            _requestName = ReadBinary();
 115472            WantReply = ReadBoolean();
 115473        }
 74
 75        /// <summary>
 76        /// Called when type specific data need to be saved.
 77        /// </summary>
 78        protected override void SaveData()
 779        {
 780            WriteBinaryString(_requestName);
 781            Write(WantReply);
 782        }
 83
 84        internal override void Process(Session session)
 115485        {
 115486            session.OnGlobalRequestReceived(this);
 115487        }
 88    }
 89}