# < Summary

Information

Class: | Renci.SshNet.Messages.Connection.ChannelOpenFailureMessage
Assembly: | Renci.SshNet
File(s): | \home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Connection\ChannelOpenFailureMessage.cs

Line coverage
63%

Covered lines: | 26
Uncovered lines: | 15
Coverable lines: | 41
Total lines: | 120
Line coverage: | 63.4%

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

Method | Branch coverage | Cyclomatic complexity | Line coverage
--- | --- | --- | ---
get_ReasonCode() | 100% | 1 | 100%
get_Description() | 100% | 1 | 100%
set_Description(...) | 100% | 1 | 100%
get_Language() | 100% | 1 | 100%
set_Language(...) | 100% | 1 | 100%
get_BufferCapacity() | 100% | 1 | 0%
.ctor() | 100% | 1 | 100%
.ctor(...) | 100% | 1 | 100%
.ctor(...) | 100% | 1 | 100%
LoadData() | 100% | 1 | 100%
SaveData() | 100% | 1 | 0%
Process(...) | 100% | 1 | 100%

# File(s)

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

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `namespace Renci.SshNet.Messages.Connection`
|  | `2` |  | `{`
|  | `3` |  | `/// <summary>`
|  | `4` |  | `/// Represents SSH_MSG_CHANNEL_OPEN_FAILURE message.`
|  | `5` |  | `/// </summary>`
|  | `6` |  | `[Message("SSH_MSG_CHANNEL_OPEN_FAILURE", 92)]`
|  | `7` |  | `public class ChannelOpenFailureMessage : ChannelMessage`
|  | `8` |  | `{`
|  | `9` |  | `internal const uint AdministrativelyProhibited = 1;`
|  | `10` |  | `internal const uint ConnectFailed = 2;`
|  | `11` |  | `internal const uint UnknownChannelType = 3;`
|  | `12` |  | `internal const uint ResourceShortage = 4;`
|  | `13` |  | ``
|  | `14` |  | `private byte[] _description;`
|  | `15` |  | `private byte[] _language;`
|  | `16` |  | ``
|  | `17` |  | `/// <summary>`
|  | `18` |  | `/// Gets failure reason code.`
|  | `19` |  | `/// </summary>`
| 303 | `20` |  | `public uint ReasonCode { get; private set; }`
|  | `21` |  | ``
|  | `22` |  | `/// <summary>`
|  | `23` |  | `/// Gets description for failure.`
|  | `24` |  | `/// </summary>`
|  | `25` |  | `public string Description`
|  | `26` |  | `{`
| 414 | `27` |  | `get { return Utf8.GetString(_description, 0, _description.Length); }`
| 324 | `28` |  | `private set { _description = Utf8.GetBytes(value); }`
|  | `29` |  | `}`
|  | `30` |  | ``
|  | `31` |  | `/// <summary>`
|  | `32` |  | `/// Gets message language.`
|  | `33` |  | `/// </summary>`
|  | `34` |  | `public string Language`
|  | `35` |  | `{`
| 414 | `36` |  | `get { return Utf8.GetString(_language, 0, _language.Length); }`
| 324 | `37` |  | `private set { _language = Utf8.GetBytes(value); }`
|  | `38` |  | `}`
|  | `39` |  | ``
|  | `40` |  | `/// <summary>`
|  | `41` |  | `/// Gets the size of the message in bytes.`
|  | `42` |  | `/// </summary>`
|  | `43` |  | `/// <value>`
|  | `44` |  | `/// The size of the messages in bytes.`
|  | `45` |  | `/// </value>`
|  | `46` |  | `protected override int BufferCapacity`
|  | `47` |  | `{`
|  | `48` |  | `get`
| 0 | `49` |  | `{`
| 0 | `50` |  | `var capacity = base.BufferCapacity;`
| 0 | `51` |  | `capacity += 4; // ReasonCode`
| 0 | `52` |  | `capacity += 4; // Description length`
| 0 | `53` |  | `capacity += _description.Length; // Description`
| 0 | `54` |  | `capacity += 4; // Language length`
| 0 | `55` |  | `capacity += _language.Length; // Language`
| 0 | `56` |  | `return capacity;`
| 0 | `57` |  | `}`
|  | `58` |  | `}`
|  | `59` |  | ``
|  | `60` |  | `/// <summary>`
|  | `61` |  | `/// Initializes a new instance of the <see cref="ChannelOpenFailureMessage"/> class.`
|  | `62` |  | `/// </summary>`
| 57 | `63` |  | `public ChannelOpenFailureMessage()`
| 57 | `64` |  | `{`
| 57 | `65` |  | `}`
|  | `66` |  | ``
|  | `67` |  | `/// <summary>`
|  | `68` |  | `/// Initializes a new instance of the <see cref="ChannelOpenFailureMessage"/> class.`
|  | `69` |  | `/// </summary>`
|  | `70` |  | `/// <param name="localChannelNumber">The local channel number.</param>`
|  | `71` |  | `/// <param name="description">The description.</param>`
|  | `72` |  | `/// <param name="reasonCode">The reason code.</param>`
|  | `73` |  | `public ChannelOpenFailureMessage(uint localChannelNumber, string description, uint reasonCode)`
| 81 | `74` |  | `: this(localChannelNumber, description, reasonCode, "en")`
| 81 | `75` |  | `{`
| 81 | `76` |  | `}`
|  | `77` |  | ``
|  | `78` |  | `/// <summary>`
|  | `79` |  | `/// Initializes a new instance of the <see cref="ChannelOpenFailureMessage"/> class.`
|  | `80` |  | `/// </summary>`
|  | `81` |  | `/// <param name="localChannelNumber">The local channel number.</param>`
|  | `82` |  | `/// <param name="description">The description.</param>`
|  | `83` |  | `/// <param name="reasonCode">The reason code.</param>`
|  | `84` |  | `/// <param name="language">The language (RFC3066).</param>`
|  | `85` |  | `public ChannelOpenFailureMessage(uint localChannelNumber, string description, uint reasonCode, string language)`
| 108 | `86` |  | `: base(localChannelNumber)`
| 108 | `87` |  | `{`
| 108 | `88` |  | `Description = description;`
| 108 | `89` |  | `ReasonCode = reasonCode;`
| 108 | `90` |  | `Language = language;`
| 108 | `91` |  | `}`
|  | `92` |  | ``
|  | `93` |  | `/// <summary>`
|  | `94` |  | `/// Called when type specific data need to be loaded.`
|  | `95` |  | `/// </summary>`
|  | `96` |  | `protected override void LoadData()`
| 57 | `97` |  | `{`
| 57 | `98` |  | `base.LoadData();`
| 57 | `99` |  | `ReasonCode = ReadUInt32();`
| 57 | `100` |  | `_description = ReadBinary();`
| 57 | `101` |  | `_language = ReadBinary();`
| 57 | `102` |  | `}`
|  | `103` |  | ``
|  | `104` |  | `/// <summary>`
|  | `105` |  | `/// Called when type specific data need to be saved.`
|  | `106` |  | `/// </summary>`
|  | `107` |  | `protected override void SaveData()`
| 0 | `108` |  | `{`
| 0 | `109` |  | `base.SaveData();`
| 0 | `110` |  | `Write(ReasonCode);`
| 0 | `111` |  | `WriteBinaryString(_description);`
| 0 | `112` |  | `WriteBinaryString(_language);`
| 0 | `113` |  | `}`
|  | `114` |  | ``
|  | `115` |  | `internal override void Process(Session session)`
| 57 | `116` |  | `{`
| 57 | `117` |  | `session.OnChannelOpenFailureReceived(this);`
| 57 | `118` |  | `}`
|  | `119` |  | `}`
|  | `120` |  | `}`

# Methods/Properties

get_ReasonCode()
get_Description()
set_Description(System.String)
get_Language()
set_Language(System.String)
get_BufferCapacity()
.ctor()
.ctor(System.UInt32,System.String,System.UInt32)
.ctor(System.UInt32,System.String,System.UInt32,System.String)
LoadData()
SaveData()
Process(Renci.SshNet.Session)