|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This class represents a AgentX subagent session
SnmpAgentX.connect(java.lang.String, int)
Method Summary | |
SnmpError |
allocateTableIndices(SnmpVarBind[] indices)
Allocates table indices, with NEW_INDEX and ANY_INDEX clear. |
SnmpError |
allocateTableIndices(SnmpVarBind[] indices,
int mode)
Allocates table indices. |
void |
close()
Closes this subagent session |
SnmpError |
deallocateTableIndices(SnmpVarBind[] indices)
Deallocates table indices |
String |
getContext()
Returns context string |
boolean |
isActive()
Returns the state of this session |
boolean |
pingMasterAgent()
Sends PING pdu to master agent in order to monitor the master agent's ability to receive and send AgentX PDUs over AgentX session. |
int |
register(String subtree)
Registers a subtree with master agent. |
int |
register(String subtree,
int range_subid,
long upper_bound,
int timeout)
Registers subtree. |
boolean |
sendTrap(SnmpTrap trap)
Sends out trap to master agent (not to trap receiver directly). |
boolean |
sendTrap(SnmpVarBind[] varbinds)
Sends out trap to master agent (not to trap receiver directly). |
void |
setContext(String context)
Sets context string |
void |
unregister()
Unregisters all previously registered subtrees |
boolean |
unregister(int index)
Unregisters subtree, asks master agent to remove the MIB region that was previously registered on this session. |
boolean |
unregister(String subtree)
Unregisters subtree |
boolean |
unregister(String subtree,
int range_subid,
long upper_bound)
Unregisters subtree |
Method Detail |
public int register(String subtree) throws IOException
Subagent needs to register for each region of the MIB variable naming tree that it wishes to support.
The choice of what to register is implementation-specific. Standard practice however is for a subagent to register at the highest level of the naming tree that makes sense. Registration of fully-qualified instances is typically done only when a subagent can perform management operations only on particular rows of a conceptual table.
If any of the subtree is exactly the same as any subtree currently registered within the master agent, this subtree is termed "duplicate subtrees" and master agent might reject this register message.
If the subtree is overlapped by any subtree registered within the master agent, this subtree is termed "overlapping subtrees" and master agent might reject this register message.
subtree
- An Object Identifier that names the basic subtree of a MIB region for which a subagent indicates its support. The term "subtree" is used generically here, it may represent a fully-qualified instance name, a partial instance name, a MIB table, an entire MIB, etc.
IOException
- raised if socket error occurredunregister(int index)
public int register(String subtree, int range_subid, long upper_bound, int timeout) throws IOException
Subagent needs to register for each region of the MIB variable naming tree that it wishes to support.
The choice of what to register is implementation-specific. Standard practice however is for a subagent to register at the highest level of the naming tree that makes sense. Registration of fully-qualified instances is typically done only when a subagent can perform management operations only on particular rows of a conceptual table.
If any of the subtree is exactly the same as any subtree currently registered within the master agent, this subtree is termed "duplicate subtrees" and master agent might reject this register message.
If the subtree is overlapped by any subtree registered within the master agent, this subtree is termed "overlapping subtrees" and master agent might reject this register message.
The use of range_subid and upper_bound provide a general shorthand mechanism for specifying a MIB region. For example, if subtree is the OID 1.3.6.1.2.1.2.2.1.1.7, range_subid is 10, and upper_bound is 22, the specified MIB region can be denoted 1.3.6.1.2.1.2.2.1.[1-22].7. Registering this region is equivalent to registering the union of subtrees
1.3.6.1.2.1.2.2.1.1.7 1.3.6.1.2.1.2.2.1.2.7 1.3.6.1.2.1.2.2.1.3.7 ... 1.3.6.1.2.1.2.2.1.22.7One expected use of this mechanism is registering a conceptual row with a single PDU. In the example above, the MIB region happens to be row 7 of the RFC 1573 ifTable.
subtree
- An Object Identifier that names the basic subtree of a MIB region for which a subagent indicates its support. The term "subtree" is used generically here, it may represent a fully-qualified instance name, a partial instance name, a MIB table, an entire MIB, etc.range_subid
- range_subid indicates the (1-based) index of this
sub-identifier within the OID represented by subtreeupper_bound
- The upper bound of a sub-identifier's range. This argument is
effective only if range_subid is not 0.timeout
- timeout value, in seconds
IOException
- raised if socket error occurredpublic void unregister() throws IOException
IOException
- raised if socket error occurredpublic boolean unregister(int index) throws IOException
index
- the index of registered subtree (the return value of register methods)
IOException
- raised if socket error occurredregister(java.lang.String)
public boolean unregister(String subtree) throws IOException
subtree
- An Object Identifier that names the basic subtree of a MIB region for which a subagent indicates its support. The term "subtree" is used generically here, it may represent a fully-qualified instance name, a partial instance name, a MIB table, an entire MIB, etc.
IOException
- raised if socket error occurredregister(java.lang.String)
public boolean unregister(String subtree, int range_subid, long upper_bound) throws IOException
subtree
- An Object Identifier that names the basic subtree of a MIB region for which a subagent indicates its support. The term "subtree" is used generically here, it may represent a fully-qualified instance name, a partial instance name, a MIB table, an entire MIB, etc.range_subid
- range_subid indicates the (1-based) index of this
sub-identifier within the OID represented by subtreeupper_bound
- The upper bound of a sub-identifier's range. This argument is
effective only if range_subid is not 0.
IOException
- raised if socket error occurredregister(java.lang.String)
public SnmpError allocateTableIndices(SnmpVarBind[] indices) throws IOException
Index allocation is a service provided by an AgentX master agent. It provides generic support for sharing MIB conceptual tables among subagents who are assumed to have no knowledge of each other. By convention, subagents use the MIB variable listed in the INDEX clause as the index object for which values must be allocated.
It is important to note that index allocation and MIB region registration are not coupled in the master agent. The current state of index allocations is not considered when processing registration requests, and the current registry is not considered when processing index allocation requests.
AgentX subagents can follow the model of "first request allocation of an index, then register the corresponding region". Then a successful index allocation request gives a subagent a good hint (but no guarantee) of what it should be able to register. The registration may fail (with `duplicateRegistration') because some other subagent session has already registered that row of the table.
Note that index allocation is necessary only when the index in question is an arbitrary value, and hence the subagent has no other reasonable way to determine which index values to use. When index values have intrinsic meaning it is not expected that subagents will allocate their index values.
For example, RFC 1514's table of running software processes (hrSWRunTable) is indexed by the system's native process identifier (pid). A subagent implementing the row of hrSWRunTable corresponding to its own process would simply register the region defining that row's object instances without allocating index values.
indices
- indices to be allocated. Variable binding's name is the OID prefix
of the MIB OBJECT-TYPE for which a value is to be allocated.
IOException
- raised if socket error occurredpublic SnmpError allocateTableIndices(SnmpVarBind[] indices, int mode) throws IOException
mode
- indices
- indices to be allocated. Variable binding's name is the OID prefix
of the MIB OBJECT-TYPE for which a value is to be allocated. If the mode is
NEW_INDEX or ANY_INDEX, this argument will be updated with the variable bindings
sent from master agent.
IOException
- raised if socket error occurredallocateTableIndices(SnmpVarBind[] indices)
public SnmpError deallocateTableIndices(SnmpVarBind[] indices) throws IOException
indices
- indices to be allocated.
IOException
- raised if socket error occurredpublic boolean sendTrap(SnmpVarBind[] varbinds) throws IOException
varbinds
- variable bindings. The first one's OID has to be sysUpTime or snmpTrapOID.
If the first one's OID is sysUpTime, the second one's OID has to be snmpTrapOID.
IOException
- raised if trap can not be sent out
IllegalArgumentException
- raise if passed varbinds is not validpublic boolean sendTrap(SnmpTrap trap) throws IOException
trap
- trap to be sent
IOException
- raised if trap can not be sent outpublic void setContext(String context)
public String getContext()
public boolean pingMasterAgent() throws IOException
IOException
- raised if there is socket errorpublic void close()
public boolean isActive()
|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |