C# Класс SnmpSharpNet.ScopedPdu

SNMP Version 3 Scoped Protocol Data Unit.
ScopedPdu extends the Pdu class by adding SNMP version 3 specific Context Engine Id and Context Name variables to the beginning of the packet. Context engine id is retrieved from the agent using the SNMP version 3 standard defined discovery process. Context name is used to define which subsection of the agents MIB user is allowed (or wants) to access. When creating a new ScopedPdu, for a valid request, ContextEngineId value has to be set for a valid reply to be received. Context value is implementation specific (depends on the configuration of the agent) and might not be required for a successful request.
Наследование: Pdu
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
_contextEngineId OctetString
_contextName OctetString

Открытые методы

Метод Описание
ScopedPdu ( ) : System

Standard constructor.

Intializes the ScopedPdu type to SNMP-GET. For details see base class Pdu standard constructor definition. Context engine id and name variables are initialized to 0 length values.

ScopedPdu ( Pdu pdu ) : System

Constructor.

ScopedPdu ( PduType pduType ) : System

Constructor.

ScopedPdu ( PduType pduType, int requestId ) : System

Constructor.

Standard constructor that sets ScopedPdu request type and request id. For valid types see PduType. By default, requestId value is set to a random value. Second argument allows caller to specify request id for this packet

decode ( byte buffer, int offset ) : int

Decode BER encoded ScopedPdu values. This method does not perform SNMP v3 privacy operations and is not aware of privacy requirements. To decode a privacy protected SNMP v3 packet, you will need to a) extract OctetString value holding encrypted ScopedPdu data, b) decrypt the encrypted ScopedPdu data into an unecrypted byte array, c) pass unencrypted ScopedPdu and BER encoded byte array to this method for final data conversion from BER into individual sequences and variables.

encode ( MutableByte buffer ) : void

Convert ScopedPdu into a BER encoded byte array. Resulting byte array is appended to the argument specified MutableByte class. Privacy operations are not performed by this method. Value encoded and returned by this method is suitable for sending in NoAuthNoPriv or AuthNoPriv security configurations. If privacy is required, caller will have to perform encryption and decryption operations after BER encoding is performed. In privacy protected SNMP version 3 packets, ScopedPdu is 1) encrypted using configured encryption method, 2) added to a OctetString field, and 3) appended to the data buffer. Because privacy operation is intrusive, it is recommended that BER encoding of the ScopedPdu packet is stored in a temporary MutableByte class, where it can be privacy protected and added to the OctetString class for final encoding into the target SNMP v3 packet.

Описание методов

ScopedPdu() публичный Метод

Standard constructor.
Intializes the ScopedPdu type to SNMP-GET. For details see base class Pdu standard constructor definition. Context engine id and name variables are initialized to 0 length values.
public ScopedPdu ( ) : System
Результат System

ScopedPdu() публичный Метод

Constructor.
public ScopedPdu ( Pdu pdu ) : System
pdu Pdu Initialize class from this class
Результат System

ScopedPdu() публичный Метод

Constructor.
public ScopedPdu ( PduType pduType ) : System
pduType PduType Pdu type value. For available types see .
Результат System

ScopedPdu() публичный Метод

Constructor.
Standard constructor that sets ScopedPdu request type and request id. For valid types see PduType. By default, requestId value is set to a random value. Second argument allows caller to specify request id for this packet
public ScopedPdu ( PduType pduType, int requestId ) : System
pduType PduType Pdu type value.
requestId int Request id for the ScopedPdu instance.
Результат System

decode() публичный Метод

Decode BER encoded ScopedPdu values. This method does not perform SNMP v3 privacy operations and is not aware of privacy requirements. To decode a privacy protected SNMP v3 packet, you will need to a) extract OctetString value holding encrypted ScopedPdu data, b) decrypt the encrypted ScopedPdu data into an unecrypted byte array, c) pass unencrypted ScopedPdu and BER encoded byte array to this method for final data conversion from BER into individual sequences and variables.
Error was encountered when decoding the PDU Thrown when buffer is too short to contain the PDU
public decode ( byte buffer, int offset ) : int
buffer byte Buffer holding BER encoded data
offset int Offset within the buffer BER encoded data begins.
Результат int

encode() публичный Метод

Convert ScopedPdu into a BER encoded byte array. Resulting byte array is appended to the argument specified MutableByte class. Privacy operations are not performed by this method. Value encoded and returned by this method is suitable for sending in NoAuthNoPriv or AuthNoPriv security configurations. If privacy is required, caller will have to perform encryption and decryption operations after BER encoding is performed. In privacy protected SNMP version 3 packets, ScopedPdu is 1) encrypted using configured encryption method, 2) added to a OctetString field, and 3) appended to the data buffer. Because privacy operation is intrusive, it is recommended that BER encoding of the ScopedPdu packet is stored in a temporary MutableByte class, where it can be privacy protected and added to the OctetString class for final encoding into the target SNMP v3 packet.
public encode ( MutableByte buffer ) : void
buffer MutableByte class passed by reference that encoded ScopedPdu /// value is appended to.
Результат void

Описание свойств

_contextEngineId защищенное свойство

Context Engine Id variable.
protected OctetString _contextEngineId
Результат OctetString

_contextName защищенное свойство

Context name variable
protected OctetString _contextName
Результат OctetString