The SnmpPacket type exposes the following members.

Constructors

  NameDescription
Public methodSnmpPacket()()()()
Constructor. Sets SNMP version to SNMPV1.
Public methodSnmpPacket(SnmpVersion)
Constructor. Initialize SNMP version as supplied.

Methods

  NameDescription
Public methoddecode
Decode SNMP packet header. This class decodes the initial sequence and SNMP protocol version number.
Public methodencode()()()()
Place holder for derived class implementations.
Public methodencode(MutableByte)
Wrap BER encoded SNMP information contained in the parameter MutableByte class. Information in the parameter is prepended by the SNMP version field and wrapped in a sequence header. Derived classes call this method to finalize SNMP packet encoding.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodStatic memberGetProtocolVersion
Get SNMP protocol version from the packet. This routine does not verify if version number is valid. Caller should verify that returned value represents a valid SNMP protocol version number.
CopyC#
int protocolVersion = Packet.GetProtocolVersion(inPacket, inLength);
if( protocolVersion != -1 )
{
    if( protocolVersion == SnmpConstants.SNMPV1 || protocolVersion == SnmpConstants.SNMPV2 || protocolVersion == SnmpConstants.SNMPV3 )
    {
        // do something
    }
    else
    {
        Console.WriteLine("Invalid SNMP protocol version.");
    }
}
else
{
    Console.WriteLine("Invalid SNMP packet.");
}
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)

Fields

  NameDescription
Protected field_protocolVersion
SNMP protocol version

Properties

  NameDescription
Public propertyIsNotification
Packet is a notification
Public propertyIsReport
Packet is a report
Public propertyIsRequest
Packet is a request
Public propertyIsResponse
Packet is a response
Public propertyPdu
Get Pdu
Public propertyVersion
SNMP Protocol version

See Also