< Summary

Information
Class: Renci.SshNet.Messages.Connection.CancelTcpIpForwardGlobalRequestMessage
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Connection\CancelTcpIpForwardGlobalRequestMessage.cs
Line coverage
90%
Covered lines: 20
Uncovered lines: 2
Coverable lines: 22
Total lines: 66
Line coverage: 90.9%
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
.ctor(...)100%1100%
get_AddressToBind()100%1100%
set_AddressToBind(...)100%1100%
get_PortToBind()100%1100%
get_BufferCapacity()100%1100%
LoadData()100%10%
SaveData()100%1100%

File(s)

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

#LineLine coverage
 1using System;
 2
 3namespace Renci.SshNet.Messages.Connection
 4{
 5    internal sealed class CancelTcpIpForwardGlobalRequestMessage : GlobalRequestMessage
 6    {
 7        private byte[] _addressToBind;
 8
 9        public CancelTcpIpForwardGlobalRequestMessage(string addressToBind, uint portToBind)
 13710            : base(Ascii.GetBytes("cancel-tcpip-forward"), wantReply: true)
 13711        {
 13712            AddressToBind = addressToBind;
 13713            PortToBind = portToBind;
 13714        }
 15
 16        /// <summary>
 17        /// Gets the address to bind to.
 18        /// </summary>
 19        public string AddressToBind
 20        {
 40521            get { return Utf8.GetString(_addressToBind, 0, _addressToBind.Length); }
 41122            private set { _addressToBind = Utf8.GetBytes(value); }
 23        }
 24
 25        /// <summary>
 26        /// Gets port number to bind to.
 27        /// </summary>
 27428        public uint PortToBind { 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
 239            {
 240                var capacity = base.BufferCapacity;
 241                capacity += 4; // AddressToBind length
 242                capacity += _addressToBind.Length; // AddressToBind
 243                capacity += 4; // PortToBind
 244                return capacity;
 245            }
 46        }
 47
 48        /// <summary>
 49        /// Called when type specific data need to be loaded.
 50        /// </summary>
 51        protected override void LoadData()
 052        {
 053            throw new NotImplementedException();
 54        }
 55
 56        /// <summary>
 57        /// Called when type specific data need to be saved.
 58        /// </summary>
 59        protected override void SaveData()
 260        {
 261            base.SaveData();
 262            WriteBinaryString(_addressToBind);
 263            Write(PortToBind);
 264        }
 65    }
 66}