Open Source native C# implementation of the Simple Network Management Protocol version 1, 2 and 3.

Types

               
 All Types  Classes   Interfaces  Enumerations  Delegates 
 NameDescription
AgentParameters
SNMP Agent specific values. This class stores values to access SNMP version 1 and version 2 agents. Pass this class with your request data (Pdu) to the request method of the target class to make a request.
AsnType
Base class for all ASN.1 value classes
AsyncRequestResult
Result codes sent by UdpTarget class to the SnmpAsyncCallback delegate.
Authentication
Helper class to make dealing with multiple (if 2 qualifies as multiple) authentication protocols in a transparent way. Calling class keeps the authentication protocol selection (as defined on the agent) in an integer variable that can have 3 values: None, MD5, or SHA1. Using GetInstance(AuthenticationDigests), calling method can get authentication protocol implementation class instance cast as IAuthenticationDigest interface and perform authentication operations (either authenticate outgoing packets to verify authentication of incoming packets) without needing to further care about which authentication protocol is used. Example of how to use this class:
CopyC#
IAuthenticationDigest authenticationImplementation = Authentication.GetInstance(AuthenticationDigests.MD5);
authenticationImplementation.authenticateIncomingMsg(...);
authenticationImplementation.authenticateOutgoingMsg(...);
AuthenticationDigests
Enumeration of available authentication digests
AuthenticationMD5
MD5 Authentication class.
AuthenticationSHA1
SHA-1 Authentication class.
Counter32
ASN.1 Counter32 type implementation.
Counter64
ASN.1 Counter64 value implementation.
EndOfMibView
Returned when end of MIB has been reached when performing GET-NEXT or GET-BULK operations.
EthernetAddress
EthernetAddress class encapsulates a 6 byte OctetString representing an Ethernet MAC address.
Gauge32
ASN.1 Gauge32 value class.
IAgentParameters
Every agent parameters class implements this interface
IAuthenticationDigest
Authentication digest interface. Interface defines authentication methods for incoming and outgoing requests.
Integer32
This class defines the SNMP 32-bit signed integer used by the SNMP SMI. This class also serves as a base class for any additional SNMP SMI types that exits now or may be defined in the future.
IpAddress
ASN.1 IPAddress type implementation
IPrivacyProtocol
Privacy protocol interface. Defines encryption and decryption methods for all privacy protocols allowing for any of the available protocols to be cast as the interface and called to perform privacy operations on packets.
MsgFlags
Message flags in the SNMP v3 header. Message flags hold flags that indicate if packet is authenticated, privacy protected and if report reply is expected on errors. Message flags field is a 1 byte OctetString encoded field.
MutableByte
Mutable byte class allows for manipulation of a byte array with operations like append, prepend. Functionality is implemented through temporary buffer creation and data duplication.
CopyC#
MutableByte buffer = new MutableByte();
buffer += "test data";
buffer.Append(". More test data");
buffer.Prepend("This is ");
Console.WriteLine(buffer.ToString()); // Prints out "This is test data. More test data"
buffer.RemoveBeginning(8); // The buffer now holds "test data. More test data"
buffer.Prepend("It could be "); // buffer is "It could be test data. More test data"
buffer.RemoveEnd(" More test data".Length); // buffer: "It could be test data."
buffer.Remove(12,5); // buffer: "It could be data"
Console.WriteLine("{0}",Convert.ToChar(buffer[1])); // Output: "t"
byte[] tmpBuffer = buffer; // Implicit conversion to byte[]
buffer.Reset(); // Erase all the data from the buffer
NoSuchInstance
Returned when requested instance is not present in a table of an SNMP version 2 agent.
NoSuchObject
NoSuchObject is returned by the agent in response to a SNMP version 2 request when requested object does not exist in its MIB. This value is returned as a with data of length 0 For example:
CopyC#
[... prepare for a get operation ...]
Pdu response = target.request(outpdu);
foreach(Vb vb in response.VbList) {
    if( vb.Value is NoSuchObject ) {
        return "Requested MIB variable does not exist on the agent.";
    }
}
Null
ASN.1 Null value implementation.
OctetString
ASN.1 OctetString type implementation
Oid
ASN.1 ObjectId type implementation
Opaque
Opaque type is an application-wide type supports the capability to pass arbitrary ASN.1 syntax
Pdu
SNMP Protocol Data Unit
PrivacyAES
AES privacy protocol implementation class. This class implements 128, 192 and 256-bit key versions of the privacy protocol.
PrivacyAES128
AES 128-bit key size privacy protocol implementation class.
PrivacyDES
SNMP Version 3 DES privacy protocol implementation. DES requires an encryption key be provided of 16 bytes in length. Class will accept longer key values (which will be trimmed to 16 bytes) but both encrypt and decrypt operations will fail if key is shorter then required value length. Decryption operation depends on USM header privacyParameters field value which is generated by the Encrypt method. Make sure privacyParameters argument value is correctly inserted into the target packet to enable SNMP agent to decrypt the message.
PrivacyProtocol
Privacy protocol helper class. This class is used to define privacy protocol encryption type in other classes using integer constants representing each protocol supported, and allows for easy instantiation of privacy protocol when used for encryption or decryption of data in a encryption method independent way. Example of how to use this class:
CopyC#
int myPrivacyProtocol = PrivacyProtocol.AES128;

IPrivacyProtocol privacyImplementation = PrivacyProtocol.GetInstance(myPrivacyProtocol);
byte[] result = privacyImplementation.Encrypt(....);
PrivacyProtocols
Privacy protocol enumeration.
ScopedPdu
SNMP Version 3 Scoped Protocol Data Unit. ScopedPdu extends the Pdu class by adding SNMP version 3 specific Context Engine Id and Context Name variables to the beginning of the packet. Context engine id is retrieved from the agent using the SNMP version 3 standard defined discovery process. Context name is used to define which subsection of the agents MIB user is allowed (or wants) to access. When creating a new ScopedPdu, for a valid request, ContextEngineId value has to be set for a valid reply to be received. Context value is implementation specific (depends on the configuration of the agent) and might not be required for a successful request.
SecureAgentParameters
SNMP Agent specific values. This class stores values to access SNMP version 3 agents. Pass this class with your request data (Pdu) to the request method of the target class to make a request. Based on the information in this class, an appropriate request will be made by the request class. Following request types are generated: * if EngineBoots and EngineTime are integer value 0 or if EngineId value is length 0, Discovery request is made and passed instance of the SecureAgentParameters is updated with returned values. * in all other cases, SNMP request is made to the agent
Sequence
Represents SNMP sequence
SimpleSnmp
Utility class to enable simplified access to SNMP version 1 and version 2 requests and replies.
SnmpAsyncResponse
Callback used to pass result of an async SNMP operation back to the caller.
SnmpConstants
SNMP SMI version 1, version 2c and version 3 constants.
SnmpDecodingException
Exception thrown on failure to decode BER encoded information.
SnmpError
Helper class provides translation of SNMP version 1 and 2 error status codes to short, descriptive error messages. To use, call the static member ErrorMessage(Int32). Example:
CopyC#
SnmpError.ErrorMessage(12);
SnmpException
SNMP generic exception. Thrown every time SNMP specific error is encountered.
SnmpNetworkException
Exception thrown when network error was encountered. Network errors include host, network unreachable, connection refused, etc. One network exception that is not covered by this exception is request timeout.
SnmpPacket
Base SNMP packet class. All SNMP packets begin with the SMI_SEQUENCE header and SNMP protocol version number. This class parses and encodes these values. Derived classes parse further information from SNMP packets.
SnmpV1Packet
SNMP version 1 packet class. Supported types are SNMP-GET, SNMP-GETNEXT, SNMP-SET and SNMP-RESPONSE.
SnmpV1TrapPacket
SNMP version 1 TRAP packet class. Available packet classes are: This class is provided to simplify encoding and decoding of packets and to provide consistent interface for users who wish to handle transport part of protocol on their own without using the UdpTarget class. SnmpPacket and derived classes have been developed to implement SNMP packet support. For SNMP version 1 and 2 packet, SnmpV1Packet and SnmpV2Packet classes provides sufficient support for encoding and decoding data to/from BER buffers to satisfy requirements of most applications. SNMP version 3 on the other hand requires a lot more information to be passed to the encoder method and returned by the decode method. Attempt of implementing SNMP version 3 as part of SnmpV3Packet class was operational but required too many function arguments to operate so a different interface was developed using dedicated SnmpV3Packet class.
SnmpV2Packet
SNMP version 2 packet class.
SnmpV3Packet
SNMP version 3 packet implementation class.
SNMPV3ReportError
SNMP class translates SNMP version 3 report errors into error strings.
SnmpVersion
SNMP Version number enumeration
TimeTicks
ASN.1 TimeTicks value representation. Value is stored as an unsigned 32-bit integer and stores the number of 1/100s of a second periods of uptime.
TrapPdu
SNMP version 1 TRAP Protocol Data Unit class. Use it to encode/decode SNMPv1 trap PDUs and allow access to trap values. This is a unique PDU type and is replaced by the standard PDU layout in version 2 (no special PDU for traps).
UdpTarget
InternetProtocol version 4 User Datagram Protocol (IP/UDP) transport protocol implementation for use with SNMP versions 1, 2 and 3. See example programs included for usage samples.
UdpTransport
IP/UDP transport class.
UInteger32
ASN.1 unsigned 32-bit integer value class.
UserSecurityModel
User security model implementation class.
V2Error
Base class for SNMP version 2 error type. For details see NoSuchInstance, NoSuchObject and EndOfMibView.
V2PartyClock
Defines an SNMPv2 Party Clock. The Party Clock is currently Obsolete, but included for backwards compatibility. Obsoleted in RFC 1902.
Vb
Vb item. Stores Oid => value pair for each value
VbCollection
Just a placeholder class extending ArrayList class dedicated to hold the Vb collection