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 ClassesModifier and TypeClassDescriptionclassTheAgentXSubRequestimplements theSubRequestinterface for AgentX sub-requests.classThe AgentXSubRequestIterator iterates over the subrequests in a AgentX request. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.snmp4j.smi.OctetStringThe default context (an emptyOctetString) that is used when the underlying AgentX PDU does not specify a context.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, 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
ConstructorsConstructorDescriptionAgentXRequest(AgentXCommandEvent<?> request) Creates anAgentXRequestfrom the given AgentX command event. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAppends a new repeater sub-request to the sub-requests list by continuing the repetition row of the corresponding predecessor sub-request.protected voidCopies the current error status and error index of this request into the associated response PDU.org.snmp4j.smi.OctetStringprotected intintReturns the maximum number of repetitions requested for the repeater variable bindings, which only applies to GETBULK requests.intintReturns the number of non-repeater variable bindings of the request, which only applies to GETBULK requests.Returns the AgentX response PDU for this request.intReturns the security level for the request.intorg.snmp4j.smi.OctetStringorg.snmp4j.smi.OctetStringintprotected booleanis2PC()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.booleanbooleaniterator()static intReturns the next unique transaction ID and increments the internal transaction ID counter.setProcessingUserObject(Object key, Object value) voidsetRequestEvent(AgentXCommandEvent<?> source) Sets the AgentX command event that is the source of this request.protected voidvoidsetViewName(org.snmp4j.smi.OctetString viewName) intsize()toString()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
-
Field Details
-
DEFAULT_CONTEXT
public static final org.snmp4j.smi.OctetString DEFAULT_CONTEXTThe default context (an emptyOctetString) that is used when the underlying AgentX PDU does not specify a context. -
processingUserObjects
-
-
Constructor Details
-
AgentXRequest
Creates anAgentXRequestfrom 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- theAgentXCommandEventthat 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:
isBulkRequestin classorg.snmp4j.agent.request.AbstractRequest<AgentXRequest.AgentXSubRequest, AgentXCommandEvent<?>, AgentXResponsePDU>
-
setupSubRequests
protected void setupSubRequests()- Specified by:
setupSubRequestsin classorg.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
0if 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
0if this is not a GETBULK request.
-
getMaxPhase
protected int getMaxPhase()- Specified by:
getMaxPhasein classorg.snmp4j.agent.request.AbstractRequest<AgentXRequest.AgentXSubRequest, AgentXCommandEvent<?>, AgentXResponsePDU>
-
setRequestEvent
Sets the AgentX command event that is the source of this request.- Parameters:
source- theAgentXCommandEventthat triggered this request.
-
assignErrorStatus2Response
protected void assignErrorStatus2Response()Copies the current error status and error index of this request into the associated response PDU. -
getResponsePDU
Returns the AgentX response PDU for this request. This is a convenience method that delegates togetResponse().- Returns:
- the
AgentXResponsePDUassociated with this request, ornullfor the cleanup and undo phases of a two-phase commit SET.
-
getResponse
- Specified by:
getResponsein interfaceorg.snmp4j.agent.request.Request<AgentXCommandEvent<?>, AgentXResponsePDU, AgentXRequest.AgentXSubRequest>- Overrides:
getResponsein classorg.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:
trueif this is a two-phase commit SET request,falseotherwise.
-
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. ForAgentXRequestalways returnsSecurityLevel.NOAUTH_NOPRIVbecause 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
- Overrides:
toStringin classorg.snmp4j.agent.request.AbstractRequest<AgentXRequest.AgentXSubRequest, AgentXCommandEvent<?>, AgentXResponsePDU>
-
isPhaseComplete
public boolean isPhaseComplete() -
getProcessingUserObject
-
setProcessingUserObject
-