Table of Contents

Class NetConfClient

Namespace
Renci.SshNet
Assembly
Renci.SshNet.dll

Contains operation for working with NetConf server.

public class NetConfClient : BaseClient, IBaseClient, IDisposable

Inheritance

Implements

Inherited Members

Constructors

NetConfClient(ConnectionInfo)

Initializes a new instance of the Renci.SshNet.NetConfClient class.

public NetConfClient(ConnectionInfo connectionInfo)

Parameters

connectionInfo ConnectionInfo

The connection info.

Exceptions

ArgumentNullException

connectionInfo is null.

NetConfClient(string, int, string, string)

Initializes a new instance of the Renci.SshNet.NetConfClient class.

public NetConfClient(string host, int port, string username, string password)

Parameters

host string

Connection host.

port int

Connection port.

username string

Authentication username.

password string

Authentication password.

Exceptions

ArgumentNullException

password is null.

ArgumentException

host is invalid, or username is null or contains only whitespace characters.

ArgumentOutOfRangeException

port is not within System.Net.IPEndPoint.MinPort and System.Net.IPEndPoint.MaxPort.

NetConfClient(string, string, string)

Initializes a new instance of the Renci.SshNet.NetConfClient class.

public NetConfClient(string host, string username, string password)

Parameters

host string

Connection host.

username string

Authentication username.

password string

Authentication password.

Exceptions

ArgumentNullException

password is null.

ArgumentException

host is invalid, or username is null or contains only whitespace characters.

NetConfClient(string, int, string, params IPrivateKeySource[])

Initializes a new instance of the Renci.SshNet.NetConfClient class.

public NetConfClient(string host, int port, string username, params IPrivateKeySource[] keyFiles)

Parameters

host string

Connection host.

port int

Connection port.

username string

Authentication username.

keyFiles IPrivateKeySource[]

Authentication private key file(s) .

Exceptions

ArgumentNullException

keyFiles is null.

ArgumentException

host is invalid, -or- username is null or contains only whitespace characters.

ArgumentOutOfRangeException

port is not within System.Net.IPEndPoint.MinPort and System.Net.IPEndPoint.MaxPort.

NetConfClient(string, string, params IPrivateKeySource[])

Initializes a new instance of the Renci.SshNet.NetConfClient class.

public NetConfClient(string host, string username, params IPrivateKeySource[] keyFiles)

Parameters

host string

Connection host.

username string

Authentication username.

keyFiles IPrivateKeySource[]

Authentication private key file(s) .

Exceptions

ArgumentNullException

keyFiles is null.

ArgumentException

host is invalid, -or- username is null or contains only whitespace characters.

Properties

AutomaticMessageIdHandling

Gets or sets a value indicating whether automatic message id handling is enabled.

public bool AutomaticMessageIdHandling { get; set; }

Property Value

bool

ClientCapabilities

Gets the NetConf client capabilities.

public XmlDocument ClientCapabilities { get; }

Property Value

XmlDocument

Exceptions

SshConnectionException

Client is not connected.

OperationTimeout

Gets or sets the operation timeout.

public TimeSpan OperationTimeout { get; set; }

Property Value

TimeSpan

Exceptions

ArgumentOutOfRangeException

value represents a value that is less than -1 or greater than System.Int32.MaxValue milliseconds.

ServerCapabilities

Gets the NetConf server capabilities.

public XmlDocument ServerCapabilities { get; }

Property Value

XmlDocument

Exceptions

SshConnectionException

Client is not connected.

Methods

Dispose(bool)

Releases unmanaged and - optionally - managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

OnConnected()

Called when client is connected to the server.

protected override void OnConnected()

OnDisconnecting()

Called when client is disconnecting from the server.

protected override void OnDisconnecting()

SendCloseRpc()

Sends the close RPC.

public XmlDocument SendCloseRpc()

Returns

XmlDocument

Reply message to closing RPC request.

Exceptions

SshConnectionException

Client is not connected.

SendReceiveRpc(XmlDocument)

Sends the receive RPC.

public XmlDocument SendReceiveRpc(XmlDocument rpc)

Parameters

rpc XmlDocument

The RPC.

Returns

XmlDocument

Reply message to RPC request.

Examples

var rpcXmlTemplate = "{0}"'
rpc.LoadXml(String.Format(rpcXmlTemplate, ""));
var rpcResponse = client.SendReceiveRpc(rpc);

Exceptions

SshConnectionException

Client is not connected.

SendReceiveRpc(string)

Sends the receive RPC.

public XmlDocument SendReceiveRpc(string xml)

Parameters

xml string

The XML.

Returns

XmlDocument

Reply message to RPC request.

Examples

var rpcXmlTemplate = "{0}"'
var rpcResponse = client.SendReceiveRpc(String.Format(rpcXmlTemplate, ""));