Class AgentXIndexRegistry
java.lang.Object
org.snmp4j.agent.agentx.master.index.AgentXIndexRegistry
- Direct Known Subclasses:
SubAgentXIndexRegistry
The
AgentXIndexRegistry
stores INDEX values reserved by sub-agents at the master agent.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
allocate
(int sessionID, org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding vb, boolean testOnly) Allocate a new INDEX from an AgentX index allocation request.int
anyIndex
(int sessionID, org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding vb, boolean testOnly) Allocate any index (if released is available, re-allocate it, otherwise create a new one).int
newIndex
(int sessionID, org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding vb, boolean testOnly) Allocate a new index that has not been used yet.protected IndexRegistryEntry
newIndexRegistryEntry
(org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding vb) Creates a new index type.void
release
(int sessionID) Release all indexes of the specified session ID.int
release
(int sessionID, org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding vb, boolean testOnly) Release a previously allocated INDEX.
-
Constructor Details
-
AgentXIndexRegistry
public AgentXIndexRegistry()Creates newAgentXIndexRegistry
.
-
-
Method Details
-
newIndexRegistryEntry
protected IndexRegistryEntry newIndexRegistryEntry(org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding vb) Creates a new index type.- Parameters:
context
- the SNMPv3 context.vb
- the index type identifier.- Returns:
- a new
IndexRegistryEntry
representing an index type.
-
allocate
public int allocate(int sessionID, org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding vb, boolean testOnly) Allocate a new INDEX from an AgentX index allocation request.- Parameters:
sessionID
- the session allocating the index.context
- the SNMPv3 context.vb
- the variable binding with the requested index.testOnly
- iftrue
, only test if allocation could be done, otherwise directly allocate the index.- Returns:
AgentXProtocol.AGENTX_SUCCESS
if the allocation was successful,AgentXProtocol.AGENTX_INDEX_WRONG_TYPE
,AgentXProtocol.AGENTX_INDEX_NONE_AVAILABLE
, andAgentXProtocol.AGENTX_INDEX_ALREADY_ALLOCATED
on error.
-
release
public int release(int sessionID, org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding vb, boolean testOnly) Release a previously allocated INDEX.- Parameters:
sessionID
- the session allocating the index.context
- the SNMPv3 context.vb
- the variable binding with the requested index.testOnly
- iftrue
, only test if release could be done, otherwise directly release the index.- Returns:
AgentXProtocol.AGENTX_SUCCESS
if the allocation was successful,AgentXProtocol.AGENTX_INDEX_NOT_ALLOCATED
on error.
-
release
public void release(int sessionID) Release all indexes of the specified session ID.- Parameters:
sessionID
- the session to release indexes for.
-
newIndex
public int newIndex(int sessionID, org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding vb, boolean testOnly) Allocate a new index that has not been used yet.- Parameters:
sessionID
- the session allocating the index.context
- the SNMPv3 context.vb
- the variable binding with the requested index.testOnly
- iftrue
, only test if allocation could be done, otherwise directly allocate the index.- Returns:
AgentXProtocol.AGENTX_SUCCESS
if the allocation was successful,AgentXProtocol.AGENTX_INDEX_NONE_AVAILABLE
on error.
-
anyIndex
public int anyIndex(int sessionID, org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding vb, boolean testOnly) Allocate any index (if released is available, re-allocate it, otherwise create a new one).- Parameters:
sessionID
- the session allocating the index.context
- the SNMPv3 context.vb
- the variable binding with the requested index.testOnly
- iftrue
, only test if allocation could be done, otherwise directly allocate the index.- Returns:
AgentXProtocol.AGENTX_SUCCESS
if the allocation was successful,AgentXProtocol.AGENTX_INDEX_NONE_AVAILABLE
on error.
-