Class NetConfClient
- Namespace
- Renci.SshNet
- Assembly
- Renci.SshNet.dll
Contains operation for working with NetConf server.
public class NetConfClient : BaseClient, IBaseClient, IDisposableInheritance
Implements
Inherited Members
Constructors
NetConfClient(ConnectionInfo)
Initializes a new instance of the Renci.SshNet.NetConfClient class.
public NetConfClient(ConnectionInfo connectionInfo)Parameters
connectionInfoConnectionInfo-
The connection info.
Exceptions
- ArgumentNullException
-
connectionInfois null.
NetConfClient(string, int, string, string)
Initializes a new instance of the Renci.SshNet.NetConfClient class.
[SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", Justification = "Disposed in Dispose(bool) method.")]
public NetConfClient(string host, int port, string username, string password)Parameters
hoststring-
Connection host.
portint-
Connection port.
usernamestring-
Authentication username.
passwordstring-
Authentication password.
Exceptions
- ArgumentNullException
-
passwordis null. - ArgumentException
-
hostis invalid, orusernameis null or contains only whitespace characters. - ArgumentOutOfRangeException
-
portis 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
hoststring-
Connection host.
usernamestring-
Authentication username.
passwordstring-
Authentication password.
Exceptions
- ArgumentNullException
-
passwordis null. - ArgumentException
-
hostis invalid, orusernameis null or contains only whitespace characters.
NetConfClient(string, int, string, params IPrivateKeySource[])
Initializes a new instance of the Renci.SshNet.NetConfClient class.
[SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", Justification = "Disposed in Dispose(bool) method.")]
public NetConfClient(string host, int port, string username, params IPrivateKeySource[] keyFiles)Parameters
hoststring-
Connection host.
portint-
Connection port.
usernamestring-
Authentication username.
keyFilesIPrivateKeySource[]-
Authentication private key file(s) .
Exceptions
- ArgumentNullException
-
keyFilesis null. - ArgumentException
-
hostis invalid, -or-usernameis null or contains only whitespace characters. - ArgumentOutOfRangeException
-
portis 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
hoststring-
Connection host.
usernamestring-
Authentication username.
keyFilesIPrivateKeySource[]-
Authentication private key file(s) .
Exceptions
- ArgumentNullException
-
keyFilesis null. - ArgumentException
-
hostis invalid, -or-usernameis 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
ClientCapabilities
Gets the NetConf client capabilities.
public XmlDocument ClientCapabilities { get; }Property Value
Exceptions
- SshConnectionException
-
Client is not connected.
OperationTimeout
Gets or sets the operation timeout.
public TimeSpan OperationTimeout { get; set; }Property Value
Exceptions
- ArgumentOutOfRangeException
-
valuerepresents 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
Exceptions
- SshConnectionException
-
Client is not connected.
Methods
Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
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
rpcXmlDocument-
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
xmlstring-
The XML.
Returns
- XmlDocument
-
Reply message to RPC request.
Examples
var rpcXmlTemplate = "{0}"'
var rpcResponse = client.SendReceiveRpc(String.Format(rpcXmlTemplate, ""));