Class IndexRegistryEntry
java.lang.Object
org.snmp4j.agent.agentx.master.index.IndexRegistryEntry
- All Implemented Interfaces:
Comparable<IndexRegistryEntry>
- Direct Known Subclasses:
SubAgentXIndexRegistryEntry
A
IndexRegistryEntry represents an index value registry for a specific table index type, represented
by a VariableBinding.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SortedMap<IndexEntry, IndexEntry> Registry for active index values.protected SortedMap<IndexEntry, IndexEntry> Registry for used (old) index values. -
Constructor Summary
ConstructorsConstructorDescriptionIndexRegistryEntry(org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding indexType) Creates a new registry based on an index type. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddUsed(IndexEntry entry) Add a used index value to the used registry.intallocate(int sessionID, org.snmp4j.smi.Variable indexValue, boolean testOnly) Allocate an INDEX instance this index type.org.snmp4j.smi.VariableanyIndex(int sessionID, boolean testOnly) Creates any (used before or new) index value for this index type.intcompareTo(IndexRegistryEntry other) protected voidduplicateAllocation(IndexEntry entry) booleanorg.snmp4j.smi.OctetStringGets the context.org.snmp4j.smi.VariableBindingGets the index type identifier.inthashCode()org.snmp4j.smi.VariablenewIndex(int sessionID, boolean testOnly) Creates a new (never used before) index value for this index type.protected IndexEntrynewIndexEntry(int sessionID, org.snmp4j.smi.Variable indexValue) voidrelease(int sessionID) Release all index values of the specified session ID.intrelease(int sessionID, org.snmp4j.smi.Variable indexValue, boolean testOnly) Release a previously allocated INDEX instance.protected booleanremoveEntry(IndexEntry entryKey) Remove an index value from the active index values.
-
Field Details
-
indexValues
Registry for active index values. -
usedValues
Registry for used (old) index values.
-
-
Constructor Details
-
IndexRegistryEntry
public IndexRegistryEntry(org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding indexType) Creates a new registry based on an index type.- Parameters:
context- the SNMPv3 context.indexType- the index type.
-
-
Method Details
-
newIndexEntry
-
duplicateAllocation
-
allocate
public int allocate(int sessionID, org.snmp4j.smi.Variable indexValue, boolean testOnly) Allocate an INDEX instance this index type.- Parameters:
sessionID- the session allocating the index.indexValue- the index value of the requested index instance.testOnly- iftrue, only test if allocation could be done, otherwise directly allocate the index.- Returns:
AgentXProtocol.AGENTX_SUCCESSif the allocation was successful,AgentXProtocol.AGENTX_INDEX_WRONG_TYPE,AgentXProtocol.AGENTX_INDEX_NONE_AVAILABLE, andAgentXProtocol.AGENTX_INDEX_ALREADY_ALLOCATEDon error.
-
release
public int release(int sessionID, org.snmp4j.smi.Variable indexValue, boolean testOnly) Release a previously allocated INDEX instance.- Parameters:
sessionID- the session allocating the index.indexValue- the variable with the index value to release.testOnly- iftrue, only test if release could be done, otherwise directly release the index.- Returns:
AgentXProtocol.AGENTX_SUCCESSif the allocation was successful,AgentXProtocol.AGENTX_INDEX_NOT_ALLOCATED,AgentXProtocol.AGENTX_INDEX_ALREADY_ALLOCATEDon error.
-
removeEntry
Remove an index value from the active index values.- Parameters:
entryKey- the index value entry.- Returns:
trueif the removal was successful.
-
addUsed
Add a used index value to the used registry.- Parameters:
entry- the index value entry.
-
release
public void release(int sessionID) Release all index values of the specified session ID.- Parameters:
sessionID- the session to release index values for.
-
compareTo
- Specified by:
compareToin interfaceComparable<IndexRegistryEntry>
-
hashCode
public int hashCode() -
equals
-
getIndexType
public org.snmp4j.smi.VariableBinding getIndexType()Gets the index type identifier.- Returns:
- an index type identifier.
-
getContext
public org.snmp4j.smi.OctetString getContext()Gets the context.- Returns:
- a SNMPv3 context.
-
newIndex
public org.snmp4j.smi.Variable newIndex(int sessionID, boolean testOnly) Creates a new (never used before) index value for this index type.- Parameters:
sessionID- the session ID requesting the index.testOnly- iftrue, only test if allocation could be done, otherwise directly allocate the index.- Returns:
- the allocated index value.
-
anyIndex
public org.snmp4j.smi.Variable anyIndex(int sessionID, boolean testOnly) Creates any (used before or new) index value for this index type.- Parameters:
sessionID- the session ID requesting the index.testOnly- iftrue, only test if allocation could be done, otherwise directly allocate the index.- Returns:
- the allocated index value.
-