C# Class SnmpSharpNet.SnmpV1TrapPacket

SNMP version 1 TRAP packet class.
Available packet classes are:
  • SnmpV1Packet
  • SnmpV1TrapPacket
  • SnmpV2Packet
  • SnmpV3Packet
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.
Inheritance: SnmpPacket
Show file Open project: griffina/SnmpSharpNet Class Usage Examples

Protected Properties

Property Type Description
_pdu TrapPdu
_snmpCommunity OctetString

Public Methods

Method Description
SnmpV1TrapPacket ( ) : System

Standard constructor.

SnmpV1TrapPacket ( string snmpCommunity ) : System

Standard constructor.

decode ( byte buffer, int length ) : int

Decode received packet. This method overrides the base implementation that cannot be used with this type of the packet.

encode ( ) : byte[]

Encode SNMP packet for sending.

Method Details

SnmpV1TrapPacket() public method

Standard constructor.
public SnmpV1TrapPacket ( ) : System
return System

SnmpV1TrapPacket() public method

Standard constructor.
public SnmpV1TrapPacket ( string snmpCommunity ) : System
snmpCommunity string SNMP community name for the packet
return System

decode() public method

Decode received packet. This method overrides the base implementation that cannot be used with this type of the packet.
public decode ( byte buffer, int length ) : int
buffer byte Packet buffer
length int Buffer length
return int

encode() public method

Encode SNMP packet for sending.
public encode ( ) : byte[]
return byte[]

Property Details

_pdu protected property

SNMP Protocol Data Unit
protected TrapPdu,SnmpSharpNet _pdu
return TrapPdu

_snmpCommunity protected property

SNMP community name
protected OctetString _snmpCommunity
return OctetString