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
NetConfClient
Implements
Inherited Members

Constructors

NetConfClient(ConnectionInfo)

Initializes a new instance of the NetConfClient class.

public NetConfClient(ConnectionInfo connectionInfo)

Parameters

connectionInfo ConnectionInfo

The connection info.

Exceptions

ArgumentNullException

connectionInfo is null.

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

Initializes a new instance of the 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 MinPort and MaxPort.

NetConfClient(string, int, string, string)

Initializes a new instance of the 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 MinPort and MaxPort.

NetConfClient(string, string, params IPrivateKeySource[])

Initializes a new instance of the 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.

NetConfClient(string, string, string)

Initializes a new instance of the 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.

Properties

AutomaticMessageIdHandling

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

public bool AutomaticMessageIdHandling { get; set; }

Property Value

bool

true if automatic message id handling is enabled; otherwise, false. The default value is true.

ClientCapabilities

Gets the NetConf client capabilities.

public XmlDocument ClientCapabilities { get; }

Property Value

XmlDocument

The NetConf client capabilities.

Exceptions

SshConnectionException

Client is not connected.

OperationTimeout

Gets or sets the operation timeout.

public TimeSpan OperationTimeout { get; set; }

Property Value

TimeSpan

The timeout to wait until an operation completes. The default value is negative one (-1) milliseconds, which indicates an infinite time-out period.

Exceptions

ArgumentOutOfRangeException

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

ServerCapabilities

Gets the NetConf server capabilities.

public XmlDocument ServerCapabilities { get; }

Property Value

XmlDocument

The NetConf server capabilities.

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(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, ""));

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.