C# 클래스 SnmpSharpNet.SnmpV2Packet

SNMP version 2 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 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: SnmpV2Packet packetv2 = new SnmpV2Packet(); packetv2.Community.Set("public"); packetv2.Pdu.Set(mypdu); byte[] berpacket = packetv2.encode(); Example, SNMP version 2 packet decoding: SnmpV2Packet packetv2 = new SnmpV2Packet(); packetv2.decode(inbuffer,inlen);
상속: SnmpPacket
파일 보기 프로젝트 열기: griffina/SnmpSharpNet 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
_pdu Pdu

보호된 프로퍼티들

프로퍼티 타입 설명
_snmpCommunity OctetString

공개 메소드들

메소드 설명
BuildInformResponse ( ) : SnmpV2Packet

Build SNMP RESPONSE packet for the received INFORM packet.

BuildInformResponse ( SnmpV2Packet informPacket ) : SnmpV2Packet

Build SNMP RESPONSE packet for the INFORM packet class.

SnmpV2Packet ( ) : System

Standard constructor.

SnmpV2Packet ( string snmpCommunity ) : System

Standard constructor.

ToString ( ) : string

String representation of the SNMP v1 Packet contents.

decode ( byte buffer, int length ) : int

Decode received SNMP packet.

encode ( ) : byte[]

Encode SNMP packet for sending.

메소드 상세

BuildInformResponse() 공개 메소드

Build SNMP RESPONSE packet for the received INFORM packet.
public BuildInformResponse ( ) : SnmpV2Packet
리턴 SnmpV2Packet

BuildInformResponse() 공개 정적인 메소드

Build SNMP RESPONSE packet for the INFORM packet class.
Parameter is not an INFORM SNMP version 2 packet class Parameter is not a SNMP version 2 packet
public static BuildInformResponse ( SnmpV2Packet informPacket ) : SnmpV2Packet
informPacket SnmpV2Packet SNMP INFORM packet
리턴 SnmpV2Packet

SnmpV2Packet() 공개 메소드

Standard constructor.
public SnmpV2Packet ( ) : System
리턴 System

SnmpV2Packet() 공개 메소드

Standard constructor.
public SnmpV2Packet ( string snmpCommunity ) : System
snmpCommunity string SNMP community name for the packet
리턴 System

ToString() 공개 메소드

String representation of the SNMP v1 Packet contents.
public ToString ( ) : string
리턴 string

decode() 공개 메소드

Decode received SNMP packet.
Thrown when invalid encoding has been found in the packet Thrown when parsed header points to more data then is available in the packet Thrown when parsed packet is not SNMP version 1 Thrown when received PDU is of a type not supported by SNMP version 1
public decode ( byte buffer, int length ) : int
buffer byte BER encoded packet buffer
length int BER encoded packet buffer length
리턴 int

encode() 공개 메소드

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

프로퍼티 상세

_pdu 공개적으로 프로퍼티

SNMP Protocol Data Unit
public Pdu _pdu
리턴 Pdu

_snmpCommunity 보호되어 있는 프로퍼티

SNMP community name
protected OctetString _snmpCommunity
리턴 OctetString