# < Summary

Information

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

Line coverage
100%

Covered lines: | 37
Uncovered lines: | 0
Coverable lines: | 37
Total lines: | 102
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

Method | Branch coverage | Cyclomatic complexity | Line coverage
--- | --- | --- | ---
get_RequestName() | 100% | 1 | 100%
set_RequestName(...) | 100% | 1 | 100%
get_RequestData() | 100% | 1 | 100%
get_BufferCapacity() | 100% | 1 | 100%
.ctor() | 100% | 1 | 100%
.ctor(...) | 100% | 1 | 100%
LoadData() | 100% | 1 | 100%
SaveData() | 100% | 1 | 100%
Process(...) | 100% | 1 | 100%

# File(s)

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

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `namespace Renci.SshNet.Messages.Connection`
|  | `2` |  | `{`
|  | `3` |  | `/// <summary>`
|  | `4` |  | `/// Represents SSH_MSG_CHANNEL_REQUEST message.`
|  | `5` |  | `/// </summary>`
|  | `6` |  | `[Message("SSH_MSG_CHANNEL_REQUEST", 98)]`
|  | `7` |  | `public class ChannelRequestMessage : ChannelMessage`
|  | `8` |  | `{`
|  | `9` |  | `private string _requestName;`
|  | `10` |  | `private byte[] _requestNameBytes;`
|  | `11` |  | ``
|  | `12` |  | `/// <summary>`
|  | `13` |  | `/// Gets the name of the request.`
|  | `14` |  | `/// </summary>`
|  | `15` |  | `/// <value>`
|  | `16` |  | `/// The name of the request.`
|  | `17` |  | `/// </value>`
|  | `18` |  | `public string RequestName`
|  | `19` |  | `{`
|  | `20` |  | `get`
| 1698 | `21` |  | `{`
| 1698 | `22` |  | `return _requestName;`
| 1698 | `23` |  | `}`
|  | `24` |  | `private set`
| 1713 | `25` |  | `{`
| 1713 | `26` |  | `_requestName = value;`
| 1713 | `27` |  | `_requestNameBytes = Ascii.GetBytes(value);`
| 1713 | `28` |  | `}`
|  | `29` |  | `}`
|  | `30` |  | ``
|  | `31` |  | `/// <summary>`
|  | `32` |  | `/// Gets channel request data.`
|  | `33` |  | `/// </summary>`
| 8517 | `34` |  | `public byte[] RequestData { get; private set; }`
|  | `35` |  | ``
|  | `36` |  | `/// <summary>`
|  | `37` |  | `/// Gets the size of the message in bytes.`
|  | `38` |  | `/// </summary>`
|  | `39` |  | `/// <value>`
|  | `40` |  | `/// The size of the messages in bytes.`
|  | `41` |  | `/// </value>`
|  | `42` |  | `protected override int BufferCapacity`
|  | `43` |  | `{`
|  | `44` |  | `get`
| 1707 | `45` |  | `{`
| 1707 | `46` |  | `var capacity = base.BufferCapacity;`
| 1707 | `47` |  | `capacity += 4; // RequestName length`
| 1707 | `48` |  | `capacity += _requestNameBytes.Length; // RequestName`
| 1707 | `49` |  | `capacity += RequestData.Length; // RequestData`
| 1707 | `50` |  | `return capacity;`
| 1707 | `51` |  | `}`
|  | `52` |  | `}`
|  | `53` |  | ``
|  | `54` |  | `/// <summary>`
|  | `55` |  | `/// Initializes a new instance of the <see cref="ChannelRequestMessage"/> class.`
|  | `56` |  | `/// </summary>`
| 1692 | `57` |  | `public ChannelRequestMessage()`
| 1692 | `58` |  | `{`
|  | `59` |  | `// Required for dynamically loading request type when it comes from the server`
| 1692 | `60` |  | `}`
|  | `61` |  | ``
|  | `62` |  | `/// <summary>`
|  | `63` |  | `/// Initializes a new instance of the <see cref="ChannelRequestMessage"/> class.`
|  | `64` |  | `/// </summary>`
|  | `65` |  | `/// <param name="localChannelNumber">The local channel number.</param>`
|  | `66` |  | `/// <param name="info">The info.</param>`
|  | `67` |  | `public ChannelRequestMessage(uint localChannelNumber, RequestInfo info)`
| 1713 | `68` |  | `: base(localChannelNumber)`
| 1713 | `69` |  | `{`
| 1713 | `70` |  | `RequestName = info.RequestName;`
| 1713 | `71` |  | `RequestData = info.GetBytes();`
| 1713 | `72` |  | `}`
|  | `73` |  | ``
|  | `74` |  | `/// <summary>`
|  | `75` |  | `/// Called when type specific data need to be loaded.`
|  | `76` |  | `/// </summary>`
|  | `77` |  | `protected override void LoadData()`
| 1692 | `78` |  | `{`
| 1692 | `79` |  | `base.LoadData();`
|  | `80` |  | ``
| 1692 | `81` |  | `_requestNameBytes = ReadBinary();`
| 1692 | `82` |  | `_requestName = Ascii.GetString(_requestNameBytes, 0, _requestNameBytes.Length);`
| 1692 | `83` |  | `RequestData = ReadBytes();`
| 1692 | `84` |  | `}`
|  | `85` |  | ``
|  | `86` |  | `/// <summary>`
|  | `87` |  | `/// Called when type specific data need to be saved.`
|  | `88` |  | `/// </summary>`
|  | `89` |  | `protected override void SaveData()`
| 1707 | `90` |  | `{`
| 1707 | `91` |  | `base.SaveData();`
|  | `92` |  | ``
| 1707 | `93` |  | `WriteBinaryString(_requestNameBytes);`
| 1707 | `94` |  | `Write(RequestData);`
| 1707 | `95` |  | `}`
|  | `96` |  | ``
|  | `97` |  | `internal override void Process(Session session)`
| 1692 | `98` |  | `{`
| 1692 | `99` |  | `session.OnChannelRequestReceived(this);`
| 1692 | `100` |  | `}`
|  | `101` |  | `}`
|  | `102` |  | `}`

# Methods/Properties

get_RequestName()
set_RequestName(System.String)
get_RequestData()
get_BufferCapacity()
.ctor()
.ctor(System.UInt32,Renci.SshNet.Messages.Connection.RequestInfo)
LoadData()
SaveData()
Process(Renci.SshNet.Session)