Class SnmpRequest

java.lang.Object
org.snmp4j.agent.request.AbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU>
org.snmp4j.agent.request.SnmpRequest
All Implemented Interfaces:
Serializable, Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>

public class SnmpRequest extends AbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU> implements Serializable
The SnmpRequest class implements requests from a SNMP source.
Version:
3.6.5
Author:
Frank Fock
See Also:
  • Field Details

    • DEFAULT_CONTEXT

      public static final org.snmp4j.smi.OctetString DEFAULT_CONTEXT
    • processingUserObjects

      protected Map<Object,Object> processingUserObjects
    • maxRepetitionsWithLimit

      protected int maxRepetitionsWithLimit
    • maxRepetitionsLimit

      protected static int maxRepetitionsLimit
  • Constructor Details

    • SnmpRequest

      public SnmpRequest(org.snmp4j.CommandResponderEvent<?> request, CoexistenceInfo cinfo)
  • Method Details

    • nextTransactionID

      public static int nextTransactionID()
    • setupSubRequests

      protected void setupSubRequests()
      Specified by:
      setupSubRequests in class AbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU>
    • getCompleteRepetitions

      public int getCompleteRepetitions()
      Returns the number of repetitions that are complete.
      Returns:
      the minimum r for which all i<r*(pduSize-nonRepeaters) SubRequests returned by AbstractRequest.get(int i) return true on SubRequest.isComplete().
    • getMaxRepetitions

      public int getMaxRepetitions()
    • getNonRepeaters

      public int getNonRepeaters()
    • getMaxPhase

      protected int getMaxPhase()
      Specified by:
      getMaxPhase in class AbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU>
    • size

      public int size()
      Description copied from interface: Request
      Gets the number of sub-requests in this request. For GETBULK requests this number may increase over time.
      Specified by:
      size in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
      Returns:
      a positive integer (greater or equal to zero).
    • setRequestEvent

      public void setRequestEvent(org.snmp4j.CommandResponderEvent<?> source)
    • assignErrorStatus2Response

      protected void assignErrorStatus2Response()
    • getResponse

      public org.snmp4j.PDU getResponse()
      Return the response PDU.
      Specified by:
      getResponse in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
      Overrides:
      getResponse in class AbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU>
      Returns:
      the PDU received as response.
    • iterator

      Description copied from interface: Request
      Returns an Iterator over the sub-requests of this request.
      Specified by:
      iterator in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
      Returns:
      an Iterator
    • iteratorSortedByVariableBindingOID

      public Iterator<SnmpRequest.SnmpSubRequest> iteratorSortedByVariableBindingOID()
    • is2PC

      protected boolean is2PC()
    • getContext

      public org.snmp4j.smi.OctetString getContext()
      Description copied from interface: Request
      Gets the context of the request.
      Specified by:
      getContext in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
      Returns:
      an OctetString instance.
    • getViewName

      public org.snmp4j.smi.OctetString getViewName()
      Specified by:
      getViewName in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
    • setViewName

      public void setViewName(org.snmp4j.smi.OctetString viewName)
      Specified by:
      setViewName in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
    • getSecurityLevel

      public int getSecurityLevel()
      Specified by:
      getSecurityLevel in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
    • getSecurityModel

      public int getSecurityModel()
      Specified by:
      getSecurityModel in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
    • getSecurityName

      public org.snmp4j.smi.OctetString getSecurityName()
      Specified by:
      getSecurityName in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
    • getViewType

      public int getViewType()
      Specified by:
      getViewType in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
    • getViewType

      public static int getViewType(int pduType)
      Returns the VACM view type for the supplied PDU type.
      Parameters:
      pduType - a PDU type.
      Returns:
      the corresponding VACM view type.
    • addRepeaterSubRequest

      protected void addRepeaterSubRequest()
    • getErrorIndex

      public int getErrorIndex()
      Specified by:
      getErrorIndex in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
      Overrides:
      getErrorIndex in class AbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU>
    • getTransactionID

      public int getTransactionID()
      Specified by:
      getTransactionID in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
      Overrides:
      getTransactionID in class AbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU>
    • getCoexistenceInfo

      public CoexistenceInfo getCoexistenceInfo()
    • getMessageProcessingModel

      public int getMessageProcessingModel()
      Specified by:
      getMessageProcessingModel in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
    • getRepeaterCount

      public int getRepeaterCount()
    • isPhaseComplete

      public boolean isPhaseComplete()
      Description copied from interface: Request
      Checks whether the current phase is complete.
      Specified by:
      isPhaseComplete in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
      Returns:
      true if all required processing has been finished for the current request phase. For single phase request types this method returns the same result as Request.isComplete().
    • isBulkRequest

      public boolean isBulkRequest()
      Specified by:
      isBulkRequest in class AbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU>
    • getProcessingUserObject

      public Object getProcessingUserObject(Object key)
      Description copied from interface: Request
      Gets the processing user object for the specified key. By default there is no such object associated with a request, but ManagedObjects may put their own objects into the request (for example to avoid unnecessary updates on behalf of the same request).
      Specified by:
      getProcessingUserObject in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
      Parameters:
      key - an Object.
      Returns:
      the associated Object or null if their exists no such association.
    • setProcessingUserObject

      public Object setProcessingUserObject(Object key, Object value)
      Description copied from interface: Request
      Sets an user object association.
      Specified by:
      setProcessingUserObject in interface Request<org.snmp4j.CommandResponderEvent<?>,org.snmp4j.PDU,SnmpRequest.SnmpSubRequest>
      Parameters:
      key - a key Object.
      value - a value Object associated with key.
      Returns:
      the previous value associated with key or null if no such association existed.
    • getMaxRepetitionsLimit

      public static int getMaxRepetitionsLimit()
      Gets the upper limit for maxRepetitions handled by SnmpRequest instances.
      Returns:
      the upper limit of maxRepetitions processed.
      Since:
      3.6.5
    • setMaxRepetitionsLimit

      public static void setMaxRepetitionsLimit(int maxRepetitionsLimit)
      Sets the upper limit for maxRepetitions handled by SnmpRequest instances.
      Parameters:
      maxRepetitionsLimit - an upper limit of maxRepetitions processed. Must be less than Short.MAX_VALUE and greater than one.
      Since:
      3.6.5