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 newAgentXResponsePDUfrom payload values.AgentXResponsePDU(AgentXMessageHeader header) Creates aAgentXResponsePDUfrom aAgentXMessageHeader. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(org.snmp4j.smi.VariableBinding vb) Adds aVariableBindingto the response PDU.protected voidInitialize flags and other things before a PDU is encoded.voidclear()Remove all variable bindings.voiddecodePayload(ByteBuffer buf, int length) Decode this PDU's payload.protected voidencodePayload(ByteBuffer buf) Encode the payload to the given byte buffer.shortGets the error index.shortGets the error status.intGets the payload length.intGets the sysUpTime value.org.snmp4j.smi.VariableBinding[]Gets theVariableBindings of the response PDU.voidsetErrorIndex(int errorIndex) Sets the error index.voidsetErrorIndex(short errorIndex) Sets the error index.voidsetErrorStatus(int errorStatus) Sets the error status.voidsetErrorStatus(short errorStatus) Sets the error status.voidsetSysUpTime(int sysUpTime) Sets the sysUpTime integer value.voidsetVariableBindings(org.snmp4j.smi.VariableBinding[] variableBindings) Sets theVariableBindinginstances in the response.intsize()Gets the number of variable bindings in the response PDU.protected StringReturns 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 newAgentXResponsePDUfrom payload values.- Parameters:
sysUpTime- the sysUpTime to return to the command sender.errorStatus- the error status.errorIndex- the error index.
-
AgentXResponsePDU
Creates aAgentXResponsePDUfrom aAgentXMessageHeader.- Parameters:
header- the message header.
-
-
Method Details
-
decodePayload
Description copied from class:AgentXPDUDecode this PDU's payload.- Specified by:
decodePayloadin 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:AgentXPDUEncode the payload to the given byte buffer.- Specified by:
encodePayloadin classAgentXPDU- Parameters:
buf- the buffer.
-
getPayloadLength
public int getPayloadLength()Description copied from class:AgentXPDUGets the payload length.- Specified by:
getPayloadLengthin 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 theVariableBindings of the response PDU.- Returns:
- an array of
VariableBindinginstances.
-
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 theVariableBindinginstances in the response.- Parameters:
variableBindings- an array ofVariableBindinginstances.
-
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 aVariableBindingto the response PDU.- Parameters:
vb- aVariableBinding.
-
clear
public void clear()Remove all variable bindings. -
beforeEncode
protected void beforeEncode()Description copied from class:AgentXPDUInitialize flags and other things before a PDU is encoded.- Specified by:
beforeEncodein classAgentXPDU
-
toStringExtMembers
Description copied from class:AgentXPDUReturns a string representation of the PDU members. An empty string is returned by this base class.- Overrides:
toStringExtMembersin classAgentXPDU- Returns:
- a string representation of the PDU members.
-