# < Summary

Information

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

Line coverage
87%

Covered lines: | 28
Uncovered lines: | 4
Coverable lines: | 32
Total lines: | 116
Line coverage: | 87.5%

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_Username() | 100% | 1 | 100%
get_ServiceName() | 100% | 1 | 100%
get_MethodName() | 100% | 1 | 100%
get_BufferCapacity() | 100% | 1 | 100%
.ctor(...) | 100% | 1 | 100%
LoadData() | 100% | 1 | 0%
SaveData() | 100% | 1 | 100%
Process(...) | 100% | 1 | 0%
ToString() | 100% | 1 | 100%

# File(s)

## \home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Authentication\RequestMessage.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | `using Renci.SshNet.Common;`
|  | `3` |  | ``
|  | `4` |  | `namespace Renci.SshNet.Messages.Authentication`
|  | `5` |  | `{`
|  | `6` |  | `/// <summary>`
|  | `7` |  | `/// Represents SSH_MSG_USERAUTH_REQUEST message. Server as a base message for other user authentication requests.`
|  | `8` |  | `/// </summary>`
|  | `9` |  | `[Message("SSH_MSG_USERAUTH_REQUEST", AuthenticationMessageCode)]`
|  | `10` |  | `public abstract class RequestMessage : Message`
|  | `11` |  | `{`
|  | `12` |  | `/// <summary>`
|  | `13` |  | `/// Returns the authentication message code for <c>SSH_MSG_USERAUTH_REQUEST</c>.`
|  | `14` |  | `/// </summary>`
|  | `15` |  | `internal const int AuthenticationMessageCode = 50;`
|  | `16` |  | ``
|  | `17` |  | `private readonly byte[] _serviceName;`
|  | `18` |  | `private readonly byte[] _userName;`
|  | `19` |  | `private readonly byte[] _methodNameBytes;`
|  | `20` |  | `private readonly string _methodName;`
|  | `21` |  | ``
|  | `22` |  | `/// <summary>`
|  | `23` |  | `/// Gets authentication username as UTF-8 encoded byte array.`
|  | `24` |  | `/// </summary>`
|  | `25` |  | `public byte[] Username`
|  | `26` |  | `{`
| 13359 | `27` |  | `get { return _userName; }`
|  | `28` |  | `}`
|  | `29` |  | ``
|  | `30` |  | `/// <summary>`
|  | `31` |  | `/// Gets the name of the service as ASCII encoded byte array.`
|  | `32` |  | `/// </summary>`
|  | `33` |  | `/// <value>`
|  | `34` |  | `/// The name of the service.`
|  | `35` |  | `/// </value>`
|  | `36` |  | `public byte[] ServiceName`
|  | `37` |  | `{`
| 9279 | `38` |  | `get { return _serviceName; }`
|  | `39` |  | `}`
|  | `40` |  | ``
|  | `41` |  | `/// <summary>`
|  | `42` |  | `/// Gets the name of the authentication method.`
|  | `43` |  | `/// </summary>`
|  | `44` |  | `/// <value>`
|  | `45` |  | `/// The name of the method.`
|  | `46` |  | `/// </value>`
|  | `47` |  | `public virtual string MethodName`
|  | `48` |  | `{`
| 10899 | `49` |  | `get { return _methodName; }`
|  | `50` |  | `}`
|  | `51` |  | ``
|  | `52` |  | `/// <summary>`
|  | `53` |  | `/// Gets the size of the message in bytes.`
|  | `54` |  | `/// </summary>`
|  | `55` |  | `/// <value>`
|  | `56` |  | `/// The size of the messages in bytes.`
|  | `57` |  | `/// </value>`
|  | `58` |  | `protected override int BufferCapacity`
|  | `59` |  | `{`
|  | `60` |  | `get`
| 3093 | `61` |  | `{`
| 3093 | `62` |  | `var capacity = base.BufferCapacity;`
| 3093 | `63` |  | `capacity += 4; // Username length`
| 3093 | `64` |  | `capacity += Username.Length; // Username`
| 3093 | `65` |  | `capacity += 4; // ServiceName length`
| 3093 | `66` |  | `capacity += ServiceName.Length; // ServiceName`
| 3093 | `67` |  | `capacity += 4; // MethodName length`
| 3093 | `68` |  | `capacity += _methodNameBytes.Length; // MethodName`
| 3093 | `69` |  | `return capacity;`
| 3093 | `70` |  | `}`
|  | `71` |  | `}`
|  | `72` |  | ``
|  | `73` |  | `/// <summary>`
|  | `74` |  | `/// Initializes a new instance of the <see cref="RequestMessage"/> class.`
|  | `75` |  | `/// </summary>`
|  | `76` |  | `/// <param name="serviceName">Name of the service.</param>`
|  | `77` |  | `/// <param name="username">Authentication username.</param>`
|  | `78` |  | `/// <param name="methodName">The name of the authentication method.</param>`
| 4569 | `79` |  | `protected RequestMessage(ServiceName serviceName, string username, string methodName)`
| 4569 | `80` |  | `{`
| 4569 | `81` |  | `_serviceName = serviceName.ToArray();`
| 4569 | `82` |  | `_userName = Utf8.GetBytes(username);`
| 4569 | `83` |  | `_methodNameBytes = Ascii.GetBytes(methodName);`
| 4569 | `84` |  | `_methodName = methodName;`
| 4569 | `85` |  | `}`
|  | `86` |  | ``
|  | `87` |  | `/// <summary>`
|  | `88` |  | `/// Called when type specific data need to be loaded.`
|  | `89` |  | `/// </summary>`
|  | `90` |  | `protected override void LoadData()`
| 0 | `91` |  | `{`
| 0 | `92` |  | `throw new InvalidOperationException("Load data is not supported.");`
|  | `93` |  | `}`
|  | `94` |  | ``
|  | `95` |  | `/// <summary>`
|  | `96` |  | `/// Called when type specific data need to be saved.`
|  | `97` |  | `/// </summary>`
|  | `98` |  | `protected override void SaveData()`
| 3093 | `99` |  | `{`
| 3093 | `100` |  | `WriteBinaryString(_userName);`
| 3093 | `101` |  | `WriteBinaryString(_serviceName);`
| 3093 | `102` |  | `WriteBinaryString(_methodNameBytes);`
| 3093 | `103` |  | `}`
|  | `104` |  | ``
|  | `105` |  | `internal override void Process(Session session)`
| 0 | `106` |  | `{`
| 0 | `107` |  | `throw new NotImplementedException();`
|  | `108` |  | `}`
|  | `109` |  | ``
|  | `110` |  | `/// <inheritdoc/>`
|  | `111` |  | `public override string ToString()`
| 3093 | `112` |  | `{`
| 3093 | `113` |  | `return $"SSH_MSG_USERAUTH_REQUEST ({MethodName})";`
| 3093 | `114` |  | `}`
|  | `115` |  | `}`
|  | `116` |  | `}`

# Methods/Properties

get_Username()
get_ServiceName()
get_MethodName()
get_BufferCapacity()
.ctor(Renci.SshNet.Messages.ServiceName,System.String,System.String)
LoadData()
SaveData()
Process(Renci.SshNet.Session)
ToString()