#include <agentx_subagent.h>
Public Member Functions | |
AgentXSharedTable (const AgentXSharedTable &) | |
Copy constructor. | |
AgentXSharedTable (const Oidx &, const index_info *, unsigned int, const Oidx *, SubAgentXMib *, const NS_SNMP OctetStr &) | |
Constructor with object identifier and given index structure. | |
virtual | ~AgentXSharedTable () |
Destructor. | |
MibTableRow * | add_row (const Oidx &) |
Add a row with the given index to the table. | |
void | remove_row (const Oidx &) |
Remove a row with the given index from the table. | |
virtual MibTableRow * | init_row (const Oidx &, Vbx *) |
Initialize a row with values. | |
virtual void | new_index () |
Request a new index from the master agent. | |
virtual void | any_index () |
Request any index from the master agent. | |
virtual boolean | allocate_index (const Oidx &) |
Allocate an index at the master. | |
virtual void | index_allocated (const Oidx &, int, int) |
This method is being called, whenever an index allocation has been processed by the master and the result has been returned to the subagent. | |
Oidx | get_index_from_vbs (Vbx *, u_int) |
Get an index as an object identifier from a list of index objects. | |
SubAgentXMib * | get_subagent_mib () |
Get the SubAgentXMib instance for the table. | |
void | set_timeout (unsigned int t) |
Set the timeout value characteristics for this group of MIB objects. | |
unsigned int | get_timeout () |
Get the timeout (in seconds) for this MIB group. | |
virtual void | clear () |
Removes all rows from this table. | |
virtual void | reinit () |
Reallocates any indexes and reregisters any rows of this table. | |
Protected Member Functions | |
void | get_index_value (NS_SNMP SmiUINT32, const Oidx &, Vbx &vb) |
Vbx * | create_index_vbs (const Oidx &) |
Protected Attributes | |
NS_SNMP OctetStr | myContext |
Oidx * | indexOIDs |
SubAgentXMib * | backReference |
unsigned int | timeout |
The AgentXSharedTable only registers table rows instead of a whole table. Thus, other subagents may also register rows within the same conceptual table.
Do not add rows to this table before the SubAgentXMib::init() method has been called, because allocating an index or adding (registering) a row requires AgentX communication with the master agent.
Before adding a row by using the add_row method, the index of the new row should be allocated by allocate_index. A row with a new or any index may be added by calling new_index or any_index, respectively. The row_added method should be overriden, in order to set the values of the new row. The row_added method is called whenever a new row has been successfully registered with the master.
AgentXSharedTable::AgentXSharedTable | ( | const AgentXSharedTable & | ) |
Copy constructor.
AgentXSharedTable::AgentXSharedTable | ( | const Oidx & | , | |
const index_info * | , | |||
unsigned | int, | |||
const Oidx * | , | |||
SubAgentXMib * | , | |||
const NS_SNMP OctetStr & | ||||
) |
Constructor with object identifier and given index structure.
In AGENT++ the structure of a table's index is given by an array of integer values. Each element represents an object of the index. A value of -1 represents a implied variable length string or oid. A value of 0 a variable length string or oid index object. A value greater than 0 determines the length of the index object meassured in subidentifiers.
o | the object identifier of the table, which has to be the oid of the the SMI table entry object (table.1). | |
index | an integer array. The length of the array corresponds to the number of objects in the INDEX clause. | |
size | the size of the above index array. | |
indexOIDs | an array of size "size" with the OIDs of the index objects. | |
backReference | a pointer to a SubAgentXMib instance. | |
context | the context the shared table belongs to. An empty string denotes the default context. |
virtual AgentXSharedTable::~AgentXSharedTable | ( | ) | [virtual] |
Destructor.
MibTableRow* AgentXSharedTable::add_row | ( | const Oidx & | ) |
Add a row with the given index to the table.
by cloning the generator row and setting the oids accordingly. Unlike MibTable the row_added is only called when the registration of the row at the master was successful. The call of MibTable::row_added is synchronized with the table. This is different to MibTable::row_added which is not synchronized by AGENT++.
ind | the index of the new row. |
void AgentXSharedTable::remove_row | ( | const Oidx & | ) |
Remove a row with the given index from the table.
Before row_delete is called, the row will be unregistered at the master.
ind | the index of the row. |
virtual MibTableRow* AgentXSharedTable::init_row | ( | const Oidx & | , | |
Vbx * | ||||
) | [virtual] |
Initialize a row with values.
This method is typically called when a row is loaded from persistent storage. In contrast to the corresponding method of MibTable, this method allocates the index at the master agent.
index | the index of the row. | |
vbs | a pointer to an array of variable bindings that provides initial values for all columns in the newly created row. The size of the array must be the same as the size of the row. |
virtual void AgentXSharedTable::new_index | ( | ) | [virtual] |
Request a new index from the master agent.
This requests an index that must not have been allocated (even if sub- sequently released) to any subagent since the last re- initialization of the master agent. If a new index is available it is returned by calling the callback method index_allocated.
virtual void AgentXSharedTable::any_index | ( | ) | [virtual] |
Request any index from the master agent.
This requests an index that must not be currently allocated to any other subagent. If a new index is available it is returned by calling the callback method index_allocated.
virtual boolean AgentXSharedTable::allocate_index | ( | const Oidx & | ) | [virtual] |
Allocate an index at the master.
The index value is checked before it is send to the master. If the index is invalid for this table, FALSE will be returned and no index allocation will take place. If the index is valid, then an allocation request will be send to the master. If the request has been successfully processed, then index_allocated will be called with error status set to AGENTX_OK, otherwise the error status will be set to AGENTX_INDEX_ALREADY_ALLOCATED or AGENTX_INDEX_NONE_AVAILABLE and the error index value will be set to the subindex that failed.
index | an object identifier representing the whole index of a new row. |
virtual void AgentXSharedTable::index_allocated | ( | const Oidx & | , | |
int | , | |||
int | ||||
) | [virtual] |
This method is being called, whenever an index allocation has been processed by the master and the result has been returned to the subagent.
index | an object identifier. | |
error | an AgentX error code if the index allocation failed, or 0 if it has been completed successfully. | |
errorIndex | if error is not 0, errorIndex points to the index object within the index that actually failed (starting from 1). |
Oidx AgentXSharedTable::get_index_from_vbs | ( | Vbx * | , | |
u_int | ||||
) |
Get an index as an object identifier from a list of index objects.
vbs | an array of variable bindings. Each variable binding represents an index object of this table. The order of the vbs must be the same as in the table's INDEX clause. | |
size | the size of the above array. |
SubAgentXMib* AgentXSharedTable::get_subagent_mib | ( | ) | [inline] |
void AgentXSharedTable::set_timeout | ( | unsigned int | t | ) | [inline] |
Set the timeout value characteristics for this group of MIB objects.
Within AGENT++ this value is currently not used, but AgentX++ is using this value to set the region timeout when registering a subagent. Future implementations may also use this value for setting region (or subtree) timeouts.
timeout | a timeout value in seconds. 0 sets the systems default timeout. |
unsigned int AgentXSharedTable::get_timeout | ( | ) | [inline] |
Get the timeout (in seconds) for this MIB group.
virtual void AgentXSharedTable::clear | ( | ) | [virtual] |
Removes all rows from this table.
virtual void AgentXSharedTable::reinit | ( | ) | [virtual] |
Reallocates any indexes and reregisters any rows of this table.
void AgentXSharedTable::get_index_value | ( | NS_SNMP | SmiUINT32, | |
const Oidx & | , | |||
Vbx & | vb | |||
) | [protected] |
Vbx* AgentXSharedTable::create_index_vbs | ( | const Oidx & | ) | [protected] |
NS_SNMP OctetStr AgentXSharedTable::myContext [protected] |
Oidx* AgentXSharedTable::indexOIDs [protected] |
SubAgentXMib* AgentXSharedTable::backReference [protected] |
unsigned int AgentXSharedTable::timeout [protected] |