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.
Namespace:
SnmpSharpNetAssembly: SnmpSharpNet (in SnmpSharpNet.dll) Version: 0.5.0.0 (0.5.0.0)
Syntax
| C# | Visual Basic | Visual C++ |
public abstract class SnmpPacket
Public MustInherit Class SnmpPacket
public ref class SnmpPacket abstract
Members
| All Members | Constructors | Properties | Methods |
| Member | Description | |
|---|---|---|
| SnmpPacket()()() |
Constructor. Sets SNMP version to SNMPV1.
| |
| SnmpPacket(SnmpVersion) |
Constructor. Initialize SNMP version as supplied.
| |
| decode(array<Byte>[]()[], Int32) |
Decode SNMP packet header. This class decodes the initial sequence and SNMP protocol version
number.
| |
| encode()()() |
Place holder for derived class implementations.
| |
| encode(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.
| |
| Equals(Object) | (Inherited from Object.) | |
| GetHashCode()()() |
Serves as a hash function for a particular type.
(Inherited from Object.) | |
| GetProtocolVersion(array<Byte>[]()[], Int32) |
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.
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."); } | |
| GetType()()() |
Gets the Type of the current instance.
(Inherited from Object.) | |
| IsNotification |
Packet is a notification
| |
| IsReport |
Packet is a report
| |
| IsRequest |
Packet is a request
| |
| IsResponse |
Packet is a response
| |
| Pdu |
Get Pdu
| |
| ToString()()() | (Inherited from Object.) | |
| Version |
SNMP Protocol version
|
Inheritance Hierarchy
System..::.Object
SnmpSharpNet..::.SnmpPacket
SnmpSharpNet..::.SnmpV1Packet
SnmpSharpNet..::.SnmpV1TrapPacket
SnmpSharpNet..::.SnmpV2Packet
SnmpSharpNet..::.SnmpV3Packet
SnmpSharpNet..::.SnmpPacket
SnmpSharpNet..::.SnmpV1Packet
SnmpSharpNet..::.SnmpV1TrapPacket
SnmpSharpNet..::.SnmpV2Packet
SnmpSharpNet..::.SnmpV3Packet