| java.lang.Object snmp.SNMPObject snmp.SNMPSequence snmp.SNMPPDU
All known Subclasses: snmp.SNMPv2InformRequestPDU, snmp.SNMPv2TrapPDU,
SNMPPDU | public class SNMPPDU extends SNMPSequence (Code) | | The SNMPPDU class represents an SNMP PDU from RFC 1157, as indicated below. This
forms the payload of an SNMP message.
-- protocol data units
PDUs ::=
CHOICE {
get-request
GetRequest-PDU,
get-next-request
GetNextRequest-PDU,
get-response
GetResponse-PDU,
set-request
SetRequest-PDU,
trap
Trap-PDU
}
-- PDUs
GetRequest-PDU ::=
[0]
IMPLICIT PDU
GetNextRequest-PDU ::=
[1]
IMPLICIT PDU
GetResponse-PDU ::=
[2]
IMPLICIT PDU
SetRequest-PDU ::=
[3]
IMPLICIT PDU
PDU ::=
SEQUENCE {
request-id
INTEGER,
error-status -- sometimes ignored
INTEGER {
noError(0),
tooBig(1),
noSuchName(2),
badValue(3),
readOnly(4),
genErr(5)
},
error-index -- sometimes ignored
INTEGER,
variable-bindings -- values are sometimes ignored
VarBindList
}
-- variable bindings
VarBind ::=
SEQUENCE {
name
ObjectName,
value
ObjectSyntax
}
VarBindList ::=
SEQUENCE OF
VarBind
END
|
Constructor Summary | |
public | SNMPPDU(byte pduType, int requestID, int errorStatus, int errorIndex, SNMPSequence varList) Create a new PDU of the specified type, with given request ID, error status, and error index,
and containing the supplied SNMP sequence as data. | protected | SNMPPDU(byte[] enc, byte pduType) Create a new PDU of the specified type from the supplied BER encoding. |
Method Summary | |
public int | getErrorIndex() A utility method that returns the error index for this PDU, identifying the problematic variable. | public int | getErrorStatus() A utility method that extracts the error status for this PDU; if nonzero, can get index of
problematic variable using getErrorIndex(). | public byte | getPDUType() A utility method that returns the PDU type of this PDU. | public int | getRequestID() A utility method that extracts the request ID number from this PDU. | public SNMPSequence | getVarBindList() A utility method that extracts the variable binding list from the pdu. |
SNMPPDU | public SNMPPDU(byte pduType, int requestID, int errorStatus, int errorIndex, SNMPSequence varList) throws SNMPBadValueException(Code) | | Create a new PDU of the specified type, with given request ID, error status, and error index,
and containing the supplied SNMP sequence as data.
|
SNMPPDU | protected SNMPPDU(byte[] enc, byte pduType) throws SNMPBadValueException(Code) | | Create a new PDU of the specified type from the supplied BER encoding.
throws: SNMPBadValueException - Indicates invalid SNMP PDU encoding supplied in enc. |
getErrorIndex | public int getErrorIndex()(Code) | | A utility method that returns the error index for this PDU, identifying the problematic variable.
|
getErrorStatus | public int getErrorStatus()(Code) | | A utility method that extracts the error status for this PDU; if nonzero, can get index of
problematic variable using getErrorIndex().
|
getPDUType | public byte getPDUType()(Code) | | A utility method that returns the PDU type of this PDU.
|
getRequestID | public int getRequestID()(Code) | | A utility method that extracts the request ID number from this PDU.
|
getVarBindList | public SNMPSequence getVarBindList()(Code) | | A utility method that extracts the variable binding list from the pdu. Useful for retrieving
the set of (object identifier, value) pairs returned in response to a request to an SNMP
device. The variable binding list is just an SNMP sequence containing the identifier, value pairs.
See Also: snmp.SNMPVarBindList |
|
|