C# 클래스 SnmpSharpNet.SnmpPacket

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.
파일 보기 프로젝트 열기: griffina/SnmpSharpNet 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
_protocolVersion Integer32

공개 메소드들

메소드 설명
GetProtocolVersion ( byte buffer, int bufferLength ) : int

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."); }

SnmpPacket ( ) : System

Constructor. Sets SNMP version to SNMPV1.

SnmpPacket ( SnmpVersion protocolVersion ) : System

Constructor. Initialize SNMP version as supplied.

decode ( byte buffer, int length ) : int

Decode SNMP packet header. This class decodes the initial sequence and SNMP protocol version number.

encode ( ) : byte[]

Place holder for derived class implementations.

encode ( MutableByte buffer ) : void

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.

메소드 상세

GetProtocolVersion() 공개 정적인 메소드

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."); }
Thrown when invalid sequence type is found at the start of the SNMP packet being decoded
public static GetProtocolVersion ( byte buffer, int bufferLength ) : int
buffer byte BER encoded SNMP packet
bufferLength int Length of the BER encoded packet
리턴 int

SnmpPacket() 공개 메소드

Constructor. Sets SNMP version to SNMPV1.
public SnmpPacket ( ) : System
리턴 System

SnmpPacket() 공개 메소드

Constructor. Initialize SNMP version as supplied.
public SnmpPacket ( SnmpVersion protocolVersion ) : System
protocolVersion SnmpVersion Protocol version. Acceptable values are SnmpConstants.SNMPV1, /// SnmpConstants.SNMPV2 and SnmpConstants.SNMPV3
리턴 System

decode() 공개 메소드

Decode SNMP packet header. This class decodes the initial sequence and SNMP protocol version number.
Thrown when invalid sequence type is found at the start of the SNMP packet being decoded
public decode ( byte buffer, int length ) : int
buffer byte BER encoded SNMP packet
length int Packet length
리턴 int

encode() 공개 추상적인 메소드

Place holder for derived class implementations.
public abstract encode ( ) : byte[]
리턴 byte[]

encode() 공개 메소드

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 encode ( MutableByte buffer ) : void
buffer MutableByte Buffer containing BER encoded SNMP information
리턴 void

프로퍼티 상세

_protocolVersion 보호되어 있는 프로퍼티

SNMP protocol version
protected Integer32 _protocolVersion
리턴 Integer32