Class AgentXContextPDU

java.lang.Object
org.snmp4j.agent.agentx.AgentXPDU
org.snmp4j.agent.agentx.AgentXContextPDU
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AgentXAddAgentCapsPDU, AgentXPingPDU, AgentXRegisterPDU, AgentXRemoveAgentCapsPDU, AgentXRequestPDU, AgentXVariableBindingPDU

public abstract class AgentXContextPDU extends AgentXPDU
A AgentXContextPDU is a AgentXPDU with context support.
See Also:
  • Field Details

    • context

      protected org.snmp4j.smi.OctetString context
      The SNMPv43 context.
  • Constructor Details

  • Method Details

    • decodeAfterContext

      protected abstract void decodeAfterContext(ByteBuffer buf, int length) throws IOException
      Decode this PDU after the end of the encoded context.
      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.
    • encodeAfterContext

      protected abstract void encodeAfterContext(ByteBuffer buf)
      Encode this PDU after already encoded context (thus context will not be encoded by this operation).
      Parameters:
      buf - the target buffer.
    • getAfterContextLength

      protected abstract int getAfterContextLength()
      Gets the encoded length after an already encoded context.
      Returns:
      the BER encoded length (without context).
    • decodePayload

      public final void decodePayload(ByteBuffer buf, int length) throws IOException
      Decode the PDU payload from the ByteBuffer.
      Specified by:
      decodePayload in class AgentXPDU
      Parameters:
      buf - the byte buffer from which to decode the payload.
      length - the length of the payload to decode.
      Throws:
      IOException - if the byte bufferdoes not contain the expected data.
    • encodePayload

      public final void encodePayload(ByteBuffer buf)
      Encode this PDU payload to the given ByteBuffer.
      Specified by:
      encodePayload in class AgentXPDU
      Parameters:
      buf - the byte buffer into which to encode the payload.
    • getPayloadLength

      public final int getPayloadLength()
      Gets the payload length.
      Specified by:
      getPayloadLength in class AgentXPDU
      Returns:
      the number of bytes needed to encode the payload.
    • getContext

      public org.snmp4j.smi.OctetString getContext()
      Gets the context.
      Returns:
      an OctetString representing the context.
    • setContext

      public void setContext(org.snmp4j.smi.OctetString context)
      Sets the context.
      Parameters:
      context - an OctetString representing the context.
    • 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.
    • beforeEncode

      protected void beforeEncode()
      Initialize flags and other things before a PDU is encoded.
      Specified by:
      beforeEncode in class AgentXPDU