C# Class SnmpSharpNet.UdpTarget

Transport class for IPv4 using UDP
InternetProtocol version 4 User Datagram Protocol (IP/UDP) transport protocol implementation for use with SNMP versions 1, 2 and 3.
Inheritance: UdpTransport, IDisposable
Mostrar archivo Open project: griffina/SnmpSharpNet Class Usage Examples

Protected Properties

Property Type Description
_address System.Net.IPAddress
_agentParameters IAgentParameters
_port int
_retry int
_timeout int

Public Methods

Method Description
Discovery ( SecureAgentParameters param ) : bool

Perform SNMP version 3 discovery operation. This is the first operation that needs to be performed on a newly accessed agent to retrieve agentId, agentBoots and agentTime values, critical for further authentication and privacy operations.

DiscoveryAsync ( SecureAgentParameters param, SnmpAsyncResponse callback ) : bool

Make an async discovery request for protocol version 3.

Request ( Pdu pdu, IAgentParameters agentParameters ) : SnmpPacket

Make SNMP Request

Make SNMP request. With this method you can make blocked SNMP version 1, 2 and 3 requests of type GET, GET-NEXT, GET-BULK, SET and REPORT (request types have to compatible with the SNMP protocol version you are using). This method will pass through any exceptions thrown by parsing classes/methods so see individual packet classes, ASN.1 type classes, authentication, privacy, etc. classes for exceptions thrown.

RequestAsync ( Pdu pdu, IAgentParameters agentParameters, SnmpAsyncResponse responseCallback ) : bool

Make SNMP request. With this method you can make blocked SNMP version 1, 2 and 3 requests of type GET, GET-NEXT, GET-BULK, SET and REPORT (request types have to compatible with the SNMP protocol version you are using). This method will pass through any exceptions thrown by parsing classes/methods so see individual packet classes, ASN.1 type classes, authentication, privacy, etc. classes for exceptions thrown.

UdpTarget ( IPAddress peer ) : System

Constructor

Initializes the class with defaults for timeout (2000ms = 2 seconds), retry (two) and agent UDP port number (161).

UdpTarget ( IPAddress peer, int port, int timeout, int retry ) : System

Constructor.

Private Methods

Method Description
AsyncResponse ( AsyncRequestResult result, IPEndPoint peer, byte buffer, int buflen ) : void

Method Details

Discovery() public method

Perform SNMP version 3 discovery operation. This is the first operation that needs to be performed on a newly accessed agent to retrieve agentId, agentBoots and agentTime values, critical for further authentication and privacy operations.
public Discovery ( SecureAgentParameters param ) : bool
param SecureAgentParameters class instance that will be updated /// with discovered agent values. This class with be reset to its defaults prior to agent /// discovered values so do not store any critical information in it prior to calling the /// discovery method
return bool

DiscoveryAsync() public method

Make an async discovery request for protocol version 3.
public DiscoveryAsync ( SecureAgentParameters param, SnmpAsyncResponse callback ) : bool
param SecureAgentParameters Agent parameters
callback SnmpAsyncResponse Callback method
return bool

Request() public method

Make SNMP Request
Make SNMP request. With this method you can make blocked SNMP version 1, 2 and 3 requests of type GET, GET-NEXT, GET-BULK, SET and REPORT (request types have to compatible with the SNMP protocol version you are using). This method will pass through any exceptions thrown by parsing classes/methods so see individual packet classes, ASN.1 type classes, authentication, privacy, etc. classes for exceptions thrown.
Thrown on SNMPv3 requests when authentication password /// is not specified on authNoPriv or authPriv requests in SecureAgentParameters or if incoming packet /// authentication check failed. /// /// With SNMP ver1 and ver2c, authentication check fails when invalid community name is parsed in the reply. Thrown on SNMPv3 requests when privacy password is not /// specified in SecureAgentParameters on authPriv requests. Thrown in following cases: /// /// * IAgentParameters.Valid() returned false. SnmpException.ErrorCode is set to SnmpException.InvalidIAgentParameters /// * No data received on request. SnmpException.ErrorCode is set to SnmpException.NoDataReceived /// * Invalid RequestId in reply. SnmpException.ErrorCode is set to SnmpException.InvalidRequestId ///
public Request ( Pdu pdu, IAgentParameters agentParameters ) : SnmpPacket
pdu Pdu Pdu class (do not pass ScopedPdu)
agentParameters IAgentParameters Security information for the request. Use /// for SNMP versions 1 and 2 requests. Use for SNMP version 3 /// requests.
return SnmpPacket

RequestAsync() public method

Make SNMP request. With this method you can make blocked SNMP version 1, 2 and 3 requests of type GET, GET-NEXT, GET-BULK, SET and REPORT (request types have to compatible with the SNMP protocol version you are using). This method will pass through any exceptions thrown by parsing classes/methods so see individual packet classes, ASN.1 type classes, authentication, privacy, etc. classes for exceptions thrown.
public RequestAsync ( Pdu pdu, IAgentParameters agentParameters, SnmpAsyncResponse responseCallback ) : bool
pdu Pdu Pdu class (do not pass ScopedPdu)
agentParameters IAgentParameters Security information for the request. Use /// for SNMP versions 1 and 2 requests. Use for SNMP version 3 /// requests.
responseCallback SnmpAsyncResponse Callback that receives the result of the async operation.
return bool

UdpTarget() public method

Constructor
Initializes the class with defaults for timeout (2000ms = 2 seconds), retry (two) and agent UDP port number (161).
public UdpTarget ( IPAddress peer ) : System
peer System.Net.IPAddress Agent IP address
return System

UdpTarget() public method

Constructor.
public UdpTarget ( IPAddress peer, int port, int timeout, int retry ) : System
peer System.Net.IPAddress SNMP peer IP address
port int SNMP peer UDP port number
timeout int SNMP peer timeout in milliseconds
retry int SNMP peer maximum retires setting. Value of 0 will result in a single request with no retries.
return System

Property Details

_address protected_oe property

SNMP request target host IP address
protected IPAddress,System.Net _address
return System.Net.IPAddress

_agentParameters protected_oe property

Internal storage of the agent parameters information passed to the async request member function.
protected IAgentParameters _agentParameters
return IAgentParameters

_port protected_oe property

SNMP target UDP port number
protected int _port
return int

_retry protected_oe property

Maximum number of retries. Value of 0 (zero) will result in a single request without retries.
protected int _retry
return int

_timeout protected_oe property

SNMP request timeout value in milliseconds
protected int _timeout
return int