Class AgentXRequest

java.lang.Object
org.snmp4j.agent.request.AbstractRequest<AgentXRequest.AgentXSubRequest, AgentXCommandEvent<?>, AgentXResponsePDU>
org.snmp4j.agent.agentx.subagent.AgentXRequest
All Implemented Interfaces:
org.snmp4j.agent.request.Request<AgentXCommandEvent<?>, AgentXResponsePDU, AgentXRequest.AgentXSubRequest>

public class AgentXRequest extends org.snmp4j.agent.request.AbstractRequest<AgentXRequest.AgentXSubRequest, AgentXCommandEvent<?>, AgentXResponsePDU>
The AgentXRequest class represents AgentX sub-agent requests. AgentX sub-agent requests are similar to SNMP requests but especially for SET request processing and query scopes differences apply.
Version:
1.0
Author:
Frank Fock
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    The AgentXSubRequest implements the SubRequest interface for AgentX sub-requests.
    class 
    The AgentXSubRequestIterator iterates over the subrequests in a AgentX request.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.snmp4j.smi.OctetString
    The default context (an empty OctetString) that is used when the underlying AgentX PDU does not specify a context.
    protected Map<Object,Object>
    Map of user objects that are associated with the processing of this request and can be shared between the processing steps.

    Fields inherited from class org.snmp4j.agent.request.AbstractRequest

    errorStatus, phase, repeaterRowSize, repeaterStartIndex, reprocessCounter, response, source, subrequests, transactionID

    Fields inherited from interface org.snmp4j.agent.request.Request

    PHASE_1PC, PHASE_2PC_CLEANUP, PHASE_2PC_COMMIT, PHASE_2PC_PREPARE, PHASE_2PC_UNDO, PHASE_INIT
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an AgentXRequest from the given AgentX command event.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Appends a new repeater sub-request to the sub-requests list by continuing the repetition row of the corresponding predecessor sub-request.
    protected void
    Copies the current error status and error index of this request into the associated response PDU.
    org.snmp4j.smi.OctetString
     
    protected int
     
    int
    Returns the maximum number of repetitions requested for the repeater variable bindings, which only applies to GETBULK requests.
    int
     
    int
    Returns the number of non-repeater variable bindings of the request, which only applies to GETBULK requests.
     
     
    Returns the AgentX response PDU for this request.
    int
    Returns the security level for the request.
    int
     
    org.snmp4j.smi.OctetString
     
    org.snmp4j.smi.OctetString
     
    int
     
    protected boolean
    Indicates whether this request is processed using the AgentX two-phase commit (2PC) SET protocol, i.e. whether its command is one of the TestSet, CommitSet, UndoSet or CleanupSet PDUs.
    boolean
     
    boolean
     
     
    static int
    Returns the next unique transaction ID and increments the internal transaction ID counter.
     
    void
    Sets the AgentX command event that is the source of this request.
    protected void
     
    void
    setViewName(org.snmp4j.smi.OctetString viewName)
     
    int
     
     

    Methods inherited from class org.snmp4j.agent.request.AbstractRequest

    equals, find, get, getErrorIndex, getErrorStatus, getPhase, getReprocessCounter, getSource, getTransactionID, hashCode, incReprocessCounter, initSubRequests, isComplete, nextPhase, resetCompletionStatus, resetProcessedStatus, setErrorStatus, setPhase

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • DEFAULT_CONTEXT

      public static final org.snmp4j.smi.OctetString DEFAULT_CONTEXT
      The default context (an empty OctetString) that is used when the underlying AgentX PDU does not specify a context.
    • processingUserObjects

      protected Map<Object,Object> processingUserObjects
      Map of user objects that are associated with the processing of this request and can be shared between the processing steps. It is lazily initialized on first use.
  • Constructor Details

    • AgentXRequest

      public AgentXRequest(AgentXCommandEvent<?> request)
      Creates an AgentXRequest from the given AgentX command event. The request values are corrected according to the command type and a new unique transaction ID is assigned.
      Parameters:
      request - the AgentXCommandEvent that triggered this request.
  • Method Details

    • nextTransactionID

      public static int nextTransactionID()
      Returns the next unique transaction ID and increments the internal transaction ID counter.
      Returns:
      a new transaction ID for an AgentX request.
    • size

      public int size()
    • isBulkRequest

      public boolean isBulkRequest()
      Specified by:
      isBulkRequest in class org.snmp4j.agent.request.AbstractRequest<AgentXRequest.AgentXSubRequest, AgentXCommandEvent<?>, AgentXResponsePDU>
    • setupSubRequests

      protected void setupSubRequests()
      Specified by:
      setupSubRequests in class org.snmp4j.agent.request.AbstractRequest<AgentXRequest.AgentXSubRequest, AgentXCommandEvent<?>, AgentXResponsePDU>
    • getMaxRepetitions

      public int getMaxRepetitions()
      Returns the maximum number of repetitions requested for the repeater variable bindings, which only applies to GETBULK requests.
      Returns:
      the max-repetitions value of the underlying GETBULK PDU, or 0 if this is not a GETBULK request.
    • getNonRepeaters

      public int getNonRepeaters()
      Returns the number of non-repeater variable bindings of the request, which only applies to GETBULK requests.
      Returns:
      the non-repeaters value of the underlying GETBULK PDU, or 0 if this is not a GETBULK request.
    • getMaxPhase

      protected int getMaxPhase()
      Specified by:
      getMaxPhase in class org.snmp4j.agent.request.AbstractRequest<AgentXRequest.AgentXSubRequest, AgentXCommandEvent<?>, AgentXResponsePDU>
    • setRequestEvent

      public void setRequestEvent(AgentXCommandEvent<?> source)
      Sets the AgentX command event that is the source of this request.
      Parameters:
      source - the AgentXCommandEvent that triggered this request.
    • assignErrorStatus2Response

      protected void assignErrorStatus2Response()
      Copies the current error status and error index of this request into the associated response PDU.
    • getResponsePDU

      public AgentXResponsePDU getResponsePDU()
      Returns the AgentX response PDU for this request. This is a convenience method that delegates to getResponse().
      Returns:
      the AgentXResponsePDU associated with this request, or null for the cleanup and undo phases of a two-phase commit SET.
    • getResponse

      public AgentXResponsePDU getResponse()
      Specified by:
      getResponse in interface org.snmp4j.agent.request.Request<AgentXCommandEvent<?>, AgentXResponsePDU, AgentXRequest.AgentXSubRequest>
      Overrides:
      getResponse in class org.snmp4j.agent.request.AbstractRequest<AgentXRequest.AgentXSubRequest, AgentXCommandEvent<?>, AgentXResponsePDU>
    • iterator

    • is2PC

      protected boolean is2PC()
      Indicates whether this request is processed using the AgentX two-phase commit (2PC) SET protocol, i.e. whether its command is one of the TestSet, CommitSet, UndoSet or CleanupSet PDUs.
      Returns:
      true if this is a two-phase commit SET request, false otherwise.
    • getContext

      public org.snmp4j.smi.OctetString getContext()
    • getViewName

      public org.snmp4j.smi.OctetString getViewName()
    • setViewName

      public void setViewName(org.snmp4j.smi.OctetString viewName)
    • getSecurityLevel

      public int getSecurityLevel()
      Returns the security level for the request. The security level determines the authentication and encryption requirements for processing the request. For AgentXRequest always returns SecurityLevel.NOAUTH_NOPRIV because AgentX protocol does not support authentication and privacy (this needs to be implemented by the transport mapping).
      Returns:
      the security level as an integer, where: 1 represents "No Authentication, No Privacy" (SecurityLevel.NOAUTH_NOPRIV), 2 represents "Authentication, No Privacy" (SecurityLevel.AUTH_NOPRIV), 3 represents "Authentication and Privacy" (SecurityLevel.AUTH_PRIV).
    • getSecurityModel

      public int getSecurityModel()
    • getSecurityName

      public org.snmp4j.smi.OctetString getSecurityName()
    • getViewType

      public int getViewType()
    • addRepeaterSubRequest

      protected void addRepeaterSubRequest()
      Appends a new repeater sub-request to the sub-requests list by continuing the repetition row of the corresponding predecessor sub-request. This is used to dynamically grow the sub-requests of a GETBULK request while iterating.
    • getMessageProcessingModel

      public int getMessageProcessingModel()
    • toString

      public String toString()
      Overrides:
      toString in class org.snmp4j.agent.request.AbstractRequest<AgentXRequest.AgentXSubRequest, AgentXCommandEvent<?>, AgentXResponsePDU>
    • isPhaseComplete

      public boolean isPhaseComplete()
    • getProcessingUserObject

      public Object getProcessingUserObject(Object key)
    • setProcessingUserObject

      public Object setProcessingUserObject(Object key, Object value)