Class AgentXResponsePDU

java.lang.Object
org.snmp4j.agent.agentx.AgentXPDU
org.snmp4j.agent.agentx.AgentXResponsePDU
All Implemented Interfaces:
Serializable

public class AgentXResponsePDU extends AgentXPDU implements Serializable
he AgentXResponsePDU represents the agentx-Regsponse-PDU defined by RFC 2741.
See Also:
  • Constructor Details

    • AgentXResponsePDU

      public AgentXResponsePDU(int sysUpTime, short errorStatus, short errorIndex)
      Creates a new AgentXResponsePDU from payload values.
      Parameters:
      sysUpTime - the sysUpTime to return to the command sender.
      errorStatus - the error status.
      errorIndex - the error index.
    • AgentXResponsePDU

      public AgentXResponsePDU(AgentXMessageHeader header)
      Parameters:
      header - the message header.
  • Method Details

    • decodePayload

      public void decodePayload(ByteBuffer buf, int length) throws IOException
      Description copied from class: AgentXPDU
      Decode this PDU's payload.
      Specified by:
      decodePayload in class AgentXPDU
      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

      protected void encodePayload(ByteBuffer buf)
      Description copied from class: AgentXPDU
      Encode the payload to the given byte buffer.
      Specified by:
      encodePayload in class AgentXPDU
      Parameters:
      buf - the buffer.
    • getPayloadLength

      public int getPayloadLength()
      Description copied from class: AgentXPDU
      Gets the payload length.
      Specified by:
      getPayloadLength in class AgentXPDU
      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 the VariableBindings 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 the VariableBinding instances in the response.
      Parameters:
      variableBindings - an array of VariableBinding 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 a VariableBinding to the response PDU.
      Parameters:
      vb - a VariableBinding.
    • 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 class AgentXPDU
    • toStringExtMembers

      protected String 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 class AgentXPDU
      Returns:
      a string representation of the PDU members.