Package org.snmp4j.agent.agentx
Class AgentXResponsePDU
java.lang.Object
org.snmp4j.agent.agentx.AgentXPDU
org.snmp4j.agent.agentx.AgentXResponsePDU
- All Implemented Interfaces:
Serializable
he
AgentXResponsePDU
represents the agentx-Regsponse-PDU defined by RFC 2741.- See Also:
-
Field Summary
Fields inherited from class org.snmp4j.agent.agentx.AgentXPDU
AGENTX_ADDAGENTCAPS_PDU, AGENTX_CLEANUPSET_PDU, AGENTX_CLOSE_PDU, AGENTX_COMMITSET_PDU, AGENTX_GET_PDU, AGENTX_GETBULK_PDU, AGENTX_GETNEXT_PDU, AGENTX_INDEXALLOCATE_PDU, AGENTX_INDEXDEALLOCATE_PDU, AGENTX_NOTIFY_PDU, AGENTX_OPEN_PDU, AGENTX_PING_PDU, AGENTX_REGISTER_PDU, AGENTX_REMOVEAGENTCAPS_PDU, AGENTX_RESPONSE_PDU, AGENTX_TESTSET_PDU, AGENTX_UNDOSET_PDU, AGENTX_UNREGISTER_PDU, byteOrder, flags, packetID, RESERVED, sessionID, transactionID, type, version
-
Constructor Summary
ConstructorsConstructorDescriptionAgentXResponsePDU
(int sysUpTime, short errorStatus, short errorIndex) Creates a newAgentXResponsePDU
from payload values.AgentXResponsePDU
(AgentXMessageHeader header) Creates aAgentXResponsePDU
from aAgentXMessageHeader
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(org.snmp4j.smi.VariableBinding vb) Adds aVariableBinding
to the response PDU.protected void
Initialize flags and other things before a PDU is encoded.void
clear()
Remove all variable bindings.void
decodePayload
(ByteBuffer buf, int length) Decode this PDU's payload.protected void
encodePayload
(ByteBuffer buf) Encode the payload to the given byte buffer.short
Gets the error index.short
Gets the error status.int
Gets the payload length.int
Gets the sysUpTime value.org.snmp4j.smi.VariableBinding[]
Gets theVariableBinding
s of the response PDU.void
setErrorIndex
(int errorIndex) Sets the error index.void
setErrorIndex
(short errorIndex) Sets the error index.void
setErrorStatus
(int errorStatus) Sets the error status.void
setErrorStatus
(short errorStatus) Sets the error status.void
setSysUpTime
(int sysUpTime) Sets the sysUpTime integer value.void
setVariableBindings
(org.snmp4j.smi.VariableBinding[] variableBindings) Sets theVariableBinding
instances in the response.int
size()
Gets the number of variable bindings in the response PDU.protected String
Returns a string representation of the PDU members.Methods inherited from class org.snmp4j.agent.agentx.AgentXPDU
addFlag, decode, encode, getByteOrder, getFlags, getPacketID, getSessionID, getTransactionID, getType, getVersion, isConfirmedPDU, isFlagSet, setByteOrder, setFlags, setPacketID, setSessionAttributes, setSessionID, setTransactionID, setType, setVersion, toString
-
Constructor Details
-
AgentXResponsePDU
public AgentXResponsePDU(int sysUpTime, short errorStatus, short errorIndex) Creates a newAgentXResponsePDU
from payload values.- Parameters:
sysUpTime
- the sysUpTime to return to the command sender.errorStatus
- the error status.errorIndex
- the error index.
-
AgentXResponsePDU
Creates aAgentXResponsePDU
from aAgentXMessageHeader
.- Parameters:
header
- the message header.
-
-
Method Details
-
decodePayload
Description copied from class:AgentXPDU
Decode this PDU's payload.- Specified by:
decodePayload
in classAgentXPDU
- Parameters:
buf
- the buffer positioned at the end of the encoded context.length
- the length of the PDU to be decoded.- Throws:
IOException
- if the buffer contains less data than expected.
-
encodePayload
Description copied from class:AgentXPDU
Encode the payload to the given byte buffer.- Specified by:
encodePayload
in classAgentXPDU
- Parameters:
buf
- the buffer.
-
getPayloadLength
public int getPayloadLength()Description copied from class:AgentXPDU
Gets the payload length.- Specified by:
getPayloadLength
in classAgentXPDU
- Returns:
- the payload length.
-
getSysUpTime
public int getSysUpTime()Gets the sysUpTime value.- Returns:
- the sysUpTime integer value.
-
getVariableBindings
public org.snmp4j.smi.VariableBinding[] getVariableBindings()Gets theVariableBinding
s of the response PDU.- Returns:
- an array of
VariableBinding
instances.
-
size
public int size()Gets the number of variable bindings in the response PDU.- Returns:
- the number of variable bindings.
-
getErrorIndex
public short getErrorIndex()Gets the error index.- Returns:
- the error index.
-
getErrorStatus
public short getErrorStatus()Gets the error status.- Returns:
- the error status.
-
setVariableBindings
public void setVariableBindings(org.snmp4j.smi.VariableBinding[] variableBindings) Sets theVariableBinding
instances in the response.- Parameters:
variableBindings
- an array ofVariableBinding
instances.
-
setSysUpTime
public void setSysUpTime(int sysUpTime) Sets the sysUpTime integer value.- Parameters:
sysUpTime
- the system up time of the command responder.
-
setErrorStatus
public void setErrorStatus(short errorStatus) Sets the error status.- Parameters:
errorStatus
- an error status as short value (= wire type).
-
setErrorIndex
public void setErrorIndex(short errorIndex) Sets the error index.- Parameters:
errorIndex
- the error index as short value (= wire type).
-
setErrorStatus
public void setErrorStatus(int errorStatus) Sets the error status.- Parameters:
errorStatus
- an error status as integer value (will be casted to short on the wire).
-
setErrorIndex
public void setErrorIndex(int errorIndex) Sets the error index.- Parameters:
errorIndex
- an error index as integer value (will be casted to short on the wire).
-
add
public void add(org.snmp4j.smi.VariableBinding vb) Adds aVariableBinding
to the response PDU.- Parameters:
vb
- aVariableBinding
.
-
clear
public void clear()Remove all variable bindings. -
beforeEncode
protected void beforeEncode()Description copied from class:AgentXPDU
Initialize flags and other things before a PDU is encoded.- Specified by:
beforeEncode
in classAgentXPDU
-
toStringExtMembers
Description copied from class:AgentXPDU
Returns a string representation of the PDU members. An empty string is returned by this base class.- Overrides:
toStringExtMembers
in classAgentXPDU
- Returns:
- a string representation of the PDU members.
-