SNMP version 2 packet class.

Namespace: SnmpSharpNet
Assembly: SnmpSharpNet (in SnmpSharpNet.dll) Version: 0.9.1.0 (0.9.1)

Syntax

C#
public class SnmpV2Packet : SnmpPacket
Visual Basic
Public Class SnmpV2Packet _
	Inherits SnmpPacket
Visual C++
public ref class SnmpV2Packet : public SnmpPacket

Remarks

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 version 1, 2 and 3 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. While using SnmpV3Packet class for full packet handling is possible, transport specific class UdpTarget uses SecureAgentParameters class to store protocol version 3 specific information that carries over from request to request when used on the same SNMP agent and therefore simplifies both initial definition of agents configuration (mostly security) as well as removes the need for repeated initialization of the packet class for subsequent requests. If you decide not to use transport helper class(es) like UdpTarget, BER encoding and decoding and packets is easily done with SnmpPacket derived classes. Example, SNMP version 2 packet encoding:
CopyC#
SnmpV2Packet packetv2 = new SnmpV2Packet();
packetv2.Community.Set("public");
packetv2.Pdu.Set(mypdu);
byte[] berpacket = packetv2.encode();
Example, SNMP version 2 packet decoding:
CopyC#
SnmpV2Packet packetv2 = new SnmpV2Packet();
packetv2.decode(inbuffer,inlen);

Inheritance Hierarchy

System..::..Object
  SnmpSharpNet..::..SnmpPacket
    SnmpSharpNet..::..SnmpV2Packet

See Also