Package org.snmp4j.agent.request
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:
Request<org.snmp4j.CommandResponderEvent,org.snmp4j.PDU, SnmpRequest.SnmpSubRequest>
public class SnmpRequest
extends AbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent,org.snmp4j.PDU>
The
SnmpRequest class implements requests from a SNMP source.- Version:
- 2.8.15
- Author:
- Frank Fock
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclass -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.snmp4j.smi.OctetStringprotected static intprotected intprotected MapFields inherited from class org.snmp4j.agent.request.AbstractRequest
errorStatus, phase, repeaterRowSize, repeaterStartIndex, reprocessCounter, response, source, subrequests, transactionIDFields 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
ConstructorsConstructorDescriptionSnmpRequest(org.snmp4j.CommandResponderEvent request, CoexistenceInfo cinfo) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidintReturns the number of repetitions that are complete.org.snmp4j.smi.OctetStringGets the context of the request.intorg.snmp4j.CommandResponderEventDeprecated.protected intintstatic intGets the upper limit for maxRepetitions handled bySnmpRequestinstances.intintGets the processing user object for the specified key.intorg.snmp4j.PDUReturns the response object for this request.org.snmp4j.PDUDeprecated.Use #getResponse() instead.intintorg.snmp4j.smi.OctetStringintorg.snmp4j.smi.OctetStringintstatic intgetViewType(int pduType) Returns the VACM view type for the supplied PDU type.protected booleanis2PC()booleanbooleanChecks whether the current phase is complete.iterator()iteratorstatic intstatic voidsetMaxRepetitionsLimit(int maxRepetitionsLimit) Sets the upper limit for maxRepetitions handled bySnmpRequestinstances.setProcessingUserObject(Object key, Object value) Sets an user object association.voidsetRequestEvent(org.snmp4j.CommandResponderEvent source) protected voidvoidsetViewName(org.snmp4j.smi.OctetString viewName) intsize()Gets the number of sub-requests in this request.Methods inherited from class org.snmp4j.agent.request.AbstractRequest
equals, find, get, getErrorStatus, getPhase, getReprocessCounter, getSource, hashCode, incReprocessCounter, initSubRequests, isComplete, nextPhase, resetCompletionStatus, resetProcessedStatus, setErrorStatus, setPhase, toString
-
Field Details
-
DEFAULT_CONTEXT
public static final org.snmp4j.smi.OctetString DEFAULT_CONTEXT -
processingUserObjects
-
maxRepetitionsWithLimit
protected int maxRepetitionsWithLimit -
maxRepetitionsLimit
protected static int maxRepetitionsLimit
-
-
Constructor Details
-
SnmpRequest
-
-
Method Details
-
nextTransactionID
public static int nextTransactionID() -
setupSubRequests
protected void setupSubRequests()- Specified by:
setupSubRequestsin classAbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent, org.snmp4j.PDU>
-
getCompleteRepetitions
public int getCompleteRepetitions()Returns the number of repetitions that are complete.- Returns:
- the minimum
rfor which alli<r*(pduSize-nonRepeaters)SubRequests returned byAbstractRequest.get(int i)return true onSubRequest.isComplete().
-
getMaxRepetitions
public int getMaxRepetitions() -
getNonRepeaters
public int getNonRepeaters() -
getMaxPhase
protected int getMaxPhase()- Specified by:
getMaxPhasein classAbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent, org.snmp4j.PDU>
-
size
public int size()Description copied from interface:RequestGets the number of sub-requests in this request. For GETBULK requests this number may increase over time.- Returns:
- a positive integer (greater or equal to zero).
-
getInitiatingEvent
public org.snmp4j.CommandResponderEvent getInitiatingEvent()Deprecated.UseAbstractRequest.getSource()instead.Gets the initiating event.- Returns:
AbstractRequest.getSource()
-
setRequestEvent
public void setRequestEvent(org.snmp4j.CommandResponderEvent source) -
assignErrorStatus2Response
protected void assignErrorStatus2Response() -
getResponsePDU
public org.snmp4j.PDU getResponsePDU()Deprecated.Use #getResponse() instead.Return the response PDU.- Returns:
getResponse()
-
getResponse
public org.snmp4j.PDU getResponse()Description copied from interface:RequestReturns the response object for this request.- Specified by:
getResponsein interfaceRequest<org.snmp4j.CommandResponderEvent,org.snmp4j.PDU, SnmpRequest.SnmpSubRequest> - Overrides:
getResponsein classAbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent, org.snmp4j.PDU> - Returns:
- an object containing the response for this request.
-
iterator
iterator- Returns:
- Iterator
-
is2PC
protected boolean is2PC() -
getContext
public org.snmp4j.smi.OctetString getContext()Description copied from interface:RequestGets the context of the request.- Returns:
- an
OctetStringinstance.
-
getViewName
public org.snmp4j.smi.OctetString getViewName() -
setViewName
public void setViewName(org.snmp4j.smi.OctetString viewName) -
getSecurityLevel
public int getSecurityLevel() -
getSecurityModel
public int getSecurityModel() -
getSecurityName
public org.snmp4j.smi.OctetString getSecurityName() -
getViewType
public int getViewType() -
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:
getErrorIndexin interfaceRequest<org.snmp4j.CommandResponderEvent,org.snmp4j.PDU, SnmpRequest.SnmpSubRequest> - Overrides:
getErrorIndexin classAbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent, org.snmp4j.PDU>
-
getTransactionID
public int getTransactionID()- Specified by:
getTransactionIDin interfaceRequest<org.snmp4j.CommandResponderEvent,org.snmp4j.PDU, SnmpRequest.SnmpSubRequest> - Overrides:
getTransactionIDin classAbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent, org.snmp4j.PDU>
-
getCoexistenceInfo
-
getMessageProcessingModel
public int getMessageProcessingModel() -
getRepeaterCount
public int getRepeaterCount() -
isPhaseComplete
public boolean isPhaseComplete()Description copied from interface:RequestChecks whether the current phase is complete.- Returns:
trueif all required processing has been finished for the current request phase. For single phase request types this method returns the same result asRequest.isComplete().
-
isBulkRequest
public boolean isBulkRequest()- Specified by:
isBulkRequestin classAbstractRequest<SnmpRequest.SnmpSubRequest,org.snmp4j.CommandResponderEvent, org.snmp4j.PDU>
-
getProcessingUserObject
Description copied from interface:RequestGets the processing user object for the specified key. By default there is no such object associated with a request, butManagedObjects may put their own objects into the request (for example to avoid unnecessary updates on behalf of the same request).- Parameters:
key- an Object.- Returns:
- the associated Object or
nullif their exists no such association.
-
setProcessingUserObject
Description copied from interface:RequestSets an user object association.- Parameters:
key- a key Object.value- a value Object associated withkey.- Returns:
- the previous value associated with
keyornullif no such association existed.
-
getMaxRepetitionsLimit
public static int getMaxRepetitionsLimit()Gets the upper limit for maxRepetitions handled bySnmpRequestinstances.- Returns:
- the upper limit of
maxRepetitionsprocessed. - Since:
- 2.8.15
-
setMaxRepetitionsLimit
public static void setMaxRepetitionsLimit(int maxRepetitionsLimit) Sets the upper limit for maxRepetitions handled bySnmpRequestinstances.- Parameters:
maxRepetitionsLimit- an upper limit ofmaxRepetitionsprocessed. Must be less thanShort.MAX_VALUEand greater than one.- Since:
- 2.8.15
-
AbstractRequest.getSource()instead.