AGENT++  4.0.3
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
MibTable Class Reference

#include <mib.h>

Inheritance diagram for MibTable:
MibEntry MibTableVoter ThreadManager Synchronized SimMibTable StorageTable TimeStampTable VacmContextTable snmpNotifyEntry snmpNotifyFilterEntry snmpNotifyFilterProfileEntry snmpProxyEntry snmpTargetAddrEntry snmpTargetParamsEntry VacmAccessTable VacmSecurityToGroupTable VacmViewTreeFamilyTable sysOREntry

Public Member Functions

 MibTable (const MibTable &)
 Copy constructor.
 
 MibTable (const Oidx &)
 Constructor with object identifier with single index object like string or oid with implied length.
 
 MibTable (const Oidx &, int)
 Constructor with object identifier and single index object's index length (meassured in subidentifiers).
 
 MibTable (const Oidx &, int, bool)
 Constructor with object identifier and given fixed index length.
 
 MibTable (const Oidx &, const index_info *, unsigned int)
 Constructor with object identifier and given index structure.
 
virtual ~MibTable ()
 Destructor.
 
mib_type type () const
 Return the type of the receiver.
 
virtual MibEntryPtr clone ()
 Clone the receiver object.
 
virtual void add_col (MibLeaf *)
 Add a column to the receiver table.
 
virtual void add_col (snmpRowStatus *)
 Add a row status column to the receiver table.
 
virtual void replace_col (unsigned int, MibLeaf *)
 Replace a column of the table.
 
virtual bool serialize (char *&, int &)
 Serialize the values of the receiver table.
 
virtual bool deserialize (char *, int &)
 Read the value of the receiver from a byte stream.
 
virtual OidxPtr max_key ()
 Return the immediate successor of the greatest object identifier within the receiver's scope.
 
virtual void update (Request *)
 This method is called by a Mib instance whenever it needs to know how many rows the receiver contains.
 
virtual bool is_empty ()
 Return whether the table is empty or not.
 
virtual int set_value (Request *, int)
 Set a value of column in a row of the receiver table.
 
virtual void get_request (Request *, int)
 Let the receiver process a SNMP GET subrequest.
 
virtual void get_next_request (Request *, int)
 Let the receiver process a SNMP GETNEXT subrequest.
 
virtual int commit_set_request (Request *, int)
 Let the receiver commit a SNMP SET subrequest.
 
virtual int prepare_set_request (Request *, int &)
 Let the receiver prepare a SNMP SET subrequest.
 
virtual int undo_set_request (Request *, int &)
 Let the receiver undo a SNMP SET subrequest.
 
virtual void cleanup_set_request (Request *, int &)
 Free any resources allocated for a SET request (i.e., undo information).
 
virtual bool ready_for_service (Vbx *pvbs, int sz)
 Check whether the specified row is ready to set in service.
 
virtual MibTableRowadd_row (const Oidx &)
 Add a row with the given index to the table.
 
virtual MibTableRowinit_row (const Oidx &, Vbx *)
 Initialize a row with values.
 
virtual void remove_row (const Oidx &)
 Remove a row with the given index from the table and call row_delete before.
 
virtual void row_init (MibTableRow *, const Oidx &, MibTable *t=0)
 Is called after a new row has been initialized (i.e., after it has been loaded from persistent storage)
 
virtual void row_added (MibTableRow *, const Oidx &, MibTable *t=0)
 Is called after a new row has been created and automatic index generation has taken place.
 
virtual void row_delete (MibTableRow *, const Oidx &, MibTable *t=0)
 Is called before a row is deleted by MibTable.
 
virtual void row_activated (MibTableRow *, const Oidx &, MibTable *t=0)
 Is called when a row is activated by a SET request setting the row�s snmpRowStatus object to active(1).
 
virtual void row_deactivated (MibTableRow *, const Oidx &, MibTable *t=0)
 Is called when a row is deactivated by a SET request setting the row�s snmpRowStatus object to notInService(2).
 
virtual Oidx get_next_avail_index () const
 Return the next available index value for the receiver table, that can be used be a manager to create a new row.
 
MibTableRowfind_index (const Oidx &) const
 Find the row within the receiver table with a given index.
 
Oidx index (const Oidx &) const
 Returns the index part of a given oid (relative to the receiver).
 
virtual bool is_index_valid (const Oidx &) const
 Check whether the given index is a valid index for the receiver table.
 
Oidx base (const Oidx &)
 Returns the base of an oid.
 
virtual void get_contents (Vbx **&, int &, int &, int=rowActive)
 Return all (active) rows as a two dimensional array of Vbx objects.
 
OidList< MibTableRow > * rows ()
 Return a pointer to the internal list of rows.
 
virtual List< MibTableRow > * get_rows (int=rowActive)
 Return all (active) rows as a list of pointers to the corresponding MibTableRow instances.
 
virtual List< MibTableRow > * get_rows_cloned (int=rowActive)
 Return all (active) rows as a list of pointers to the corresponding MibTableRow instances.
 
virtual List< MibTableRow > * get_rows_cloned (const Oidx *, int=rowActive)
 Return those (active) rows as a list of pointers to the corresponding MibTableRow instances, of which the index starts with the given prefix.
 
virtual int size ()
 Return the size of the table meassured in rows.
 
virtual void add_voter (MibTableVoter *)
 Add a MibTableVoter instance that listens for row status transition events and votes for or against commiting such a transition.
 
virtual void remove_voter (MibTableVoter *)
 Remove a MibTableVoter listener.
 
virtual void add_listener (MibTable *)
 Add a listener that will be informed about row additions or deletions.
 
virtual void remove_listener (MibTable *)
 Remove a listener that no longer wants to be informed about row additions or deletions.
 
void fire_row_changed (int, MibTableRow *, const Oidx &)
 Fire the row changed event to the receiver and all its listeners.
 
ListCursor< MibTable > * get_listeners ()
 Gets a cursor on the listeners for this table's row events.
 
bool has_listeners () const
 Checks whether this table has any listeners for row events.
 
virtual void clear ()
 Removes all rows from this table.
 
virtual void reset ()
 Resets the content of the table to its state right after construction.
 
virtual MibTableRowget_columns ()
 Gets the columns (a.k.a.
 
MibLeaffind (const Oidx &) const
 Find a MibLeaf object of the receiver with a given oid.
 
virtual MibLeaffind_next (const Oidx &)
 Find the lexicographical successor MibLeaf object to a given oid.
 
MibLeaffind_prev (const Oidx &)
 Find the lexicographical predessor MibLeaf object to a given oid.
 
MibLeafget (int, int)
 Return the MibLeaf object of the receiver at a given position.
 
virtual void reinit ()
 Reinitialize the table.
 
- Public Member Functions inherited from MibEntry
 MibEntry ()
 Default constructor.
 
 MibEntry (const Oidx &, mib_access)
 Construct a MibEntry instance with a given object identifier and maximum access rights.
 
 MibEntry (const MibEntry &)
 Copy constructor.
 
virtual ~MibEntry ()
 Destructor.
 
virtual void load_from_file (const char *)
 Load the value(s) of the receiver node from a file.
 
virtual void save_to_file (const char *)
 Save the value(s) of the receiver node to a file.
 
virtual void notify_change (const Oidx &, mib_change)
 Notify all registered nodes of changes to an object managed by the receiver node.
 
virtual void register_for_notifications (MibEntry *)
 Register an MibEntry object to receive notifications about changes of the receiver node.
 
virtual void add_change_notification (MibEntry *e)
 Wrapper function for register_for_notifications.
 
virtual void change_notification (const Oidx &, mib_change)
 Receive a notification about changes to a managed object.
 
OidxPtr key ()
 Return a pointer to the key (object identifier) of the receiver.
 
virtual mib_access get_access ()
 Return the maximum access rights for the managed object represented by the receiver node.
 
virtual bool is_volatile ()
 Check whether the entry is volatile or not.
 
int operator< (const MibEntry &) const
 
int operator> (const MibEntry &) const
 
int operator== (const MibEntry &) const
 
int operator< (const Oidx &) const
 
int operator> (const Oidx &) const
 
int operator<= (const Oidx &) const
 
int operator>= (const Oidx &) const
 
int operator== (const Oidx &) const
 
- Public Member Functions inherited from ThreadManager
 ThreadManager ()
 Default constructor.
 
virtual ~ThreadManager ()
 Destructor.
 
void start_synch ()
 Start synchronized execution.
 
void end_synch ()
 End synchronized execution.
 
- Public Member Functions inherited from Synchronized
 Synchronized ()
 
 ~Synchronized ()
 
void wait ()
 Causes current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object.
 
bool wait (unsigned long timeout)
 Causes current thread to wait until either another thread invokes the notify() method or the notifyAll() method for this object, or a specified amount of time has elapsed.
 
void notify ()
 Wakes up a single thread that is waiting on this object's monitor.
 
void notify_all ()
 Wakes up all threads that are waiting on this object's monitor.
 
bool lock ()
 Enter a critical section.
 
TryLockResult trylock ()
 Try to enter a critical section.
 
bool unlock ()
 Leave a critical section.
 
- Public Member Functions inherited from MibTableVoter
 MibTableVoter ()
 
virtual ~MibTableVoter ()
 
virtual int is_transition_ok (MibTable *, MibTableRow *, const Oidx &, int, int)
 Check whether a transition from an old to a new RowStatus value is allowed.
 

Protected Member Functions

void init (const Oidx &, const index_info *, unsigned int)
 Initialize the receiver.
 
virtual bool could_ever_be_managed (const Oidx &, int &)
 Check if an object of a given oid could be created.
 
void remove_obsolete_rows (OrderedList< Oidx > &confirmed)
 Remove all rows that are not in the given list.
 
virtual Oidx find_succ (const Oidx &, Request *req=0)
 Return the successor of a given object identifier within the receiver's scope and the context of a given Request.
 
MibLeafget_generator (const Oidx &)
 Return a pointer to the generator object of a given column.
 
virtual int check_creation (Request *, int &)
 Test whether a row can be created succesfully using the RowStatus mechanism.
 
virtual bool ready (Vbx *pvbs, int sz, MibTableRow *row)
 Check whether the specified row is ready to set in service.
 
virtual void get_required_columns (bool *, Vbx *vbs=0)
 Determine the required columns of a row.
 
int get_row_status (MibTableRow *)
 Get the value of the snmpRowStatus object of a given row.
 
int set_row_status (MibTableRow *, int)
 Set the value of the snmpRowStatus object of a given row.
 
void remove_unused_rows ()
 Periodically remove all rows that are notReady for more than a given timeout (default is 5 minutes).
 
bool check_index (Oidx &, unsigned long, unsigned long) const
 Check an index for subidentifiers greater than 255.
 
virtual bool is_persistent (MibTableRow *)
 Check whether the given row should be serialized or not.
 
int perform_voting (MibTableRow *, int, int)
 Let all voters vote for or against a row status transition.
 
- Protected Member Functions inherited from MibEntry
void set_oid (const Oidx &)
 Set the object identifier of the receiver node.
 

Protected Attributes

Oidx upper
 
MibTableRow generator
 
OidList< MibTableRowcontent
 
unsigned int index_len
 
index_infoindex_struc
 
snmpRowStatusrow_status
 
Timer row_timeout
 
OrderedList< MibTableRownotready_rows
 
OrderedList< MibTableRowdelete_rows
 
List< MibTablelisteners
 
List< MibTableVotervoters
 
- Protected Attributes inherited from MibEntry
Oidx oid
 
mib_access access
 
List< MibEntrynotifies
 

Friends

class Mib
 
class snmpRowStatus
 

Additional Inherited Members

- Public Types inherited from Synchronized
enum  TryLockResult { LOCKED = 1, BUSY = 0, OWNED = -1 }
 
- Static Public Member Functions inherited from ThreadManager
static void start_global_synch ()
 Start global synchronized execution.
 
static void end_global_synch ()
 End global synchronized execution.
 

Constructor & Destructor Documentation

MibTable::MibTable ( const MibTable )

Copy constructor.

MibTable::MibTable ( const Oidx )

Constructor with object identifier with single index object like string or oid with implied length.

Parameters
othe object identifier of the table, which has to be the oid of the the SMI table entry object (table.1).
MibTable::MibTable ( const Oidx ,
int   
)

Constructor with object identifier and single index object's index length (meassured in subidentifiers).

Parameters
othe object identifier of the table, which has to be the oid of the the SMI table entry object (table.1).
ilenthe length of the index meassured in subidentifiers. 0 represents a variable length string or oid index object. -1 represents a variable length string or oid index object with implied length.
MibTable::MibTable ( const Oidx ,
int  ,
bool   
)

Constructor with object identifier and given fixed index length.

Deprecated:
Use MibTable(const Oidx&, unsigned long[][], unsigned int) instead
Parameters
o- The object identifier of the table, which has to be the oid of the the SMI table entry object (table.1).
ilen- The length of the index meassured in subidentifiers.
a- not used
MibTable::MibTable ( const Oidx ,
const index_info ,
unsigned  int 
)

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 measured in subidentifiers.

Parameters
othe object identifier of the table, which has to be the oid of the the SMI table entry object (table.1).
indexan integer array. The length of the array corresponds to the number of objects in the INDEX clause.
sizethe size of the above index array.
virtual MibTable::~MibTable ( )
virtual

Destructor.

Member Function Documentation

virtual void MibTable::add_col ( MibLeaf )
virtual

Add a column to the receiver table.

Parameters
l- A pointer to a MibLeaf object which should be added to the columnar objects of the receiver.
virtual void MibTable::add_col ( snmpRowStatus )
virtual

Add a row status column to the receiver table.

Parameters
l- A pointer to a snmpRowStatus object which should be added to the columnar objects of the receiver.
Note
A table can only have one row status columnar object.
virtual void MibTable::add_listener ( MibTable )
virtual

Add a listener that will be informed about row additions or deletions.

Note: Since v3.5.8 listeners are no longer locked when fire_row_changed is executed. Instead, all listeners are locked when this table gets locked by Request::set_locked!

Parameters
listenera pointer to another instance of MibTable whose row_added, row_delete, row_activated, and row_deactivated methods will be called whenever the corresponding action is performed on this table.
virtual MibTableRow* MibTable::add_row ( const Oidx )
virtual

Add a row with the given index to the table.

by cloning the generator row and setting the oids accordingly. Then call row_added.

Parameters
indThe index of the new row.
Returns
A pointer to the added row.
virtual void MibTable::add_voter ( MibTableVoter )
virtual

Add a MibTableVoter instance that listens for row status transition events and votes for or against commiting such a transition.

Parameters
listenera pointer to a MibTableVoter instance.
Oidx MibTable::base ( const Oidx )

Returns the base of an oid.

(the entry oid without index and item index)

Parameters
oid- The oid that should be scoped to this tables base
Returns
The base of the given oid.
virtual int MibTable::check_creation ( Request ,
int &   
)
protectedvirtual

Test whether a row can be created succesfully using the RowStatus mechanism.

Parameters
req- A pointer to the whole SNMP SET request.
ind- The index of the subrequest to be processed.
Returns
SNMP_ERROR_SUCCESS on success and SNMP_ERROR_WRONG_VALUE, SNMP_ERROR_INCONSIST_VAL, or SNMP_ERROR_WRONG_TYPE on failure.
Note
In case of an error: ind is set to the vb index in the processed request req where the error actually occured.

Reimplemented in SimMibTable.

bool MibTable::check_index ( Oidx ,
unsigned  long,
unsigned  long 
) const
protected

Check an index for subidentifiers greater than 255.

Parameters
index
begin
end
Returns
TRUE if no such subid exists.
virtual void MibTable::cleanup_set_request ( Request ,
int &   
)
virtual

Free any resources allocated for a SET request (i.e., undo information).

Parameters
reqa pointer to the SNMP SET request.
indthe index of the subrequest to be processed.
Returns
SNMP_ERROR_SUCCESS if the new value has been set, SNMP_ERROR_WRONG_TYPE or SNMP_ERROR_BAD_VALUE otherwise.

Reimplemented from MibEntry.

virtual void MibTable::clear ( )
virtual

Removes all rows from this table.

Reimplemented in VacmViewTreeFamilyTable, and VacmContextTable.

virtual MibEntryPtr MibTable::clone ( )
inlinevirtual

Clone the receiver object.

Returns
A pointer to the clone.

Reimplemented from MibEntry.

virtual int MibTable::commit_set_request ( Request ,
int   
)
virtual

Let the receiver commit a SNMP SET subrequest.

Parameters
req- A pointer to the whole SNMP SET request.
ind- The index of the subrequest to be processed.
Returns
SNMP_ERROR_SUCCESS on success and SNMP_ERROR_COMITFAIL on failure.

Reimplemented from MibEntry.

virtual bool MibTable::could_ever_be_managed ( const Oidx ,
int &   
)
protectedvirtual

Check if an object of a given oid could be created.

Parameters
othe oid to be checked.
resultreturns the SNMP error code, which explains why creation could not be performed. Possible values are: SNMP_ERROR_NO_CREATION and SNMP_ERROR_NOT_WRITEABLE
Returns
TRUE if an object of the given oid could be created.

Reimplemented in VacmViewTreeFamilyTable, VacmAccessTable, and VacmSecurityToGroupTable.

virtual bool MibTable::deserialize ( char *  ,
int &   
)
virtual

Read the value of the receiver from a byte stream.

Parameters
bufa pointer to the input byte stream.
szthe size of the input buffer. On output it contains the size remaining unread in the input buffer.
Returns
TRUE if deserialization was successful, FALSE otherwise.

Reimplemented from MibEntry.

MibLeaf* MibTable::find ( const Oidx ) const

Find a MibLeaf object of the receiver with a given oid.

Parameters
o- The oid of the object to find.
Returns
A pointer to the found object, 0 otherwise.
MibTableRow* MibTable::find_index ( const Oidx ) const

Find the row within the receiver table with a given index.

Parameters
ind- The index to search for.
Returns
A pointer to the found row, or 0 if a row with the given index does not exists.
virtual MibLeaf* MibTable::find_next ( const Oidx )
virtual

Find the lexicographical successor MibLeaf object to a given oid.

Parameters
o- An oid.
Returns
A pointer to the successor object, 0 otherwise.
MibLeaf* MibTable::find_prev ( const Oidx )

Find the lexicographical predessor MibLeaf object to a given oid.

Parameters
o- An oid.
Returns
A pointer to the predessor object, 0 otherwise.
virtual Oidx MibTable::find_succ ( const Oidx ,
Request req = 0 
)
protectedvirtual

Return the successor of a given object identifier within the receiver's scope and the context of a given Request.

SYNCHRONIZED

Parameters
oidan object identifier
requesta pointer to a Request instance.
Returns
an object identifier if a successor could be found, otherwise (if no successor exists or is out of scope) a zero length oid is returned

Reimplemented from MibEntry.

void MibTable::fire_row_changed ( int  ,
MibTableRow ,
const Oidx  
)

Fire the row changed event to the receiver and all its listeners.

Note: Since v3.5.8 this method no longer locks the listeners when calling their methods. See also Request::set_locked.

Parameters
eventdescribes the event that occured: rowCreateAndGo, rowCreateAndWait for row_added, rowActive for row_activated, rowNotInService for row_deactivated, and rowDestroy fro row_delete.
rowa pointer to the MibTableRow instance to be changed.
indexthe index of the above row.
MibLeaf* MibTable::get ( int  ,
int   
)

Return the MibLeaf object of the receiver at a given position.

Parameters
n- The column (counted from 0).
m- The row (counted from 0).
Returns
A pointer to the MibLeaf object at position (n,m), 0 if n or m are out of range.
virtual MibTableRow* MibTable::get_columns ( )
virtual

Gets the columns (a.k.a.

generator row) definitions for this table.

Returns
a pointer to a MibTableRow instance that is used by this table to generate rows from by cloning its elements.
virtual void MibTable::get_contents ( Vbx **&  ,
int &  ,
int &  ,
int  = rowActive 
)
virtual

Return all (active) rows as a two dimensional array of Vbx objects.

If the receiver table does not have any snmpRowStatus column all rows are returned.

This method is synchronized on its receiver.

Parameters
contentsa two dimensional array of Vbx objects returned. Memory is allocated if the pointer is NULL. Otherwise the rows and cols parameter must provide the size of the given array.
rowsthe number of rows returned or the max rows capacitiy of the given array, respectively.
colsthe number of cols returned or the max cols capacitiy of the given array, respectively.
discriminatorif the receiver table has a snmpRowStatus, the discriminator selects the rows to be returned. Default is rowActive, which means all active rows are returned. If the discriminator is rowEnmpty(0), all rows are returned.
MibLeaf* MibTable::get_generator ( const Oidx )
protected

Return a pointer to the generator object of a given column.

(The generator object of a column is the not accessible object a the top of each row - the master copy)

Parameters
o- The oid of an MibLeaf instance of the receiver.
Returns
A pointer to the generator object of the specified column.
ListCursor<MibTable>* MibTable::get_listeners ( )
inline

Gets a cursor on the listeners for this table's row events.

This method is not synchronized.

Returns
a pointer to a ListCursor.
virtual Oidx MibTable::get_next_avail_index ( ) const
virtual

Return the next available index value for the receiver table, that can be used be a manager to create a new row.

Returns
The next available index value.
Note
Works best if the table�s index is a single scalar sub-identifier.
virtual void MibTable::get_next_request ( Request ,
int   
)
virtual

Let the receiver process a SNMP GETNEXT subrequest.

Parameters
req- A pointer to the whole SNMP GETNEXT request.
ind- The index of the subrequest to be processed.

Reimplemented from MibEntry.

virtual void MibTable::get_request ( Request ,
int   
)
virtual

Let the receiver process a SNMP GET subrequest.

Parameters
req- A pointer to the whole SNMP GET request.
ind- The index of the subrequest to be processed.

Reimplemented from MibEntry.

virtual void MibTable::get_required_columns ( bool *  ,
Vbx vbs = 0 
)
protectedvirtual

Determine the required columns of a row.

Parameters
requiredan array of at least the size of each receiver's row.
vbsan array of variable bindings of at least the size of a row. It returns the default values of that row. If vbs is 0 no default values are returned.
int MibTable::get_row_status ( MibTableRow )
protected

Get the value of the snmpRowStatus object of a given row.

Parameters
row- A row of the receiver.
Returns
The value of the snmpRowStatus object of the given row. If the row has no snmpRowStatus object return rowDestroy.
virtual List<MibTableRow>* MibTable::get_rows ( int  = rowActive)
virtual

Return all (active) rows as a list of pointers to the corresponding MibTableRow instances.

If the receiver table does not have any snmpRowStatus column all rows are returned.

Note
Don't use this method for tables where rows are deleted, because you only get references, that then may point to nowhere.
Call List::clear() method before its destructor to avoid deletion of the rows of this table.
Parameters
discriminatorif the receiver table has a snmpRowStatus, the discriminator selects the rows to be returned. Default is rowActive, which means all active rows are returned. If the discriminator is rowEmpty(0), all rows are returned.
virtual List<MibTableRow>* MibTable::get_rows_cloned ( int  = rowActive)
virtual

Return all (active) rows as a list of pointers to the corresponding MibTableRow instances.

If the receiver table does not have any snmpRowStatus column all rows are returned.

This method is synchronized on its receiver.

Note
This method is escpecially useful for tables where rows are deleted, because you get copies of the rows rather than references.
Parameters
discriminatorif the receiver table has a snmpRowStatus, the discriminator selects the rows to be returned. Default is rowActive, which means all active rows are returned. If the discriminator is rowEmpty(0), all rows are returned.
Returns
a pointer to a cloned list of the rows in the receiver.
virtual List<MibTableRow>* MibTable::get_rows_cloned ( const Oidx ,
int  = rowActive 
)
virtual

Return those (active) rows as a list of pointers to the corresponding MibTableRow instances, of which the index starts with the given prefix.

This method is synchronized on its receiver.

Note
This method is escpecially useful for tables where rows are deleted, because you get copies of the rows rather than references.
Parameters
prefixa pointer to an oid. If the pointer is 0 this method behaves like MibTable::get_rows_cloned(bool).
discriminatorif the receiver table has a snmpRowStatus, the discriminator selects the rows to be returned. Default is rowActive, which means all active rows are returned. If the discriminator is rowEmpty(0), all rows are returned.
Returns
a pointer to a cloned list of the rows in the receiver.
bool MibTable::has_listeners ( ) const
inline

Checks whether this table has any listeners for row events.

Returns
TRUE if there is at least one listener attached to this table via ::add_listener, FALSE otherwise.
Oidx MibTable::index ( const Oidx ) const

Returns the index part of a given oid (relative to the receiver).

Parameters
entry_oid- The oid of an instance in the receiver table.
Returns
The index part of the given oid.
void MibTable::init ( const Oidx ,
const index_info ,
unsigned  int 
)
protected

Initialize the receiver.

Parameters
o- The initialize object identifer of the receiver.
ilen- The fixed index length, or VARIABLE_INDEX_LENGTH if the index length is variable.
a- If TRUE the automatic index object initialization is activated.
virtual MibTableRow* MibTable::init_row ( const Oidx ,
Vbx  
)
virtual

Initialize a row with values.

This method is typically called when a row is loaded from persistent storage.

Parameters
indexthe index of the row.
vbsa 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.
Returns
a pointer to the added row.
virtual bool MibTable::is_empty ( )
inlinevirtual

Return whether the table is empty or not.

Returns
TRUE if the table is empty, FALSE otherwise.

Reimplemented from MibEntry.

virtual bool MibTable::is_index_valid ( const Oidx ) const
virtual

Check whether the given index is a valid index for the receiver table.

Parameters
indexan Oidx instance.
Returns
TRUE if the index is valid, FALSE otherwise.
virtual bool MibTable::is_persistent ( MibTableRow )
inlineprotectedvirtual

Check whether the given row should be serialized or not.

Parameters
rowa MibTableRow instance.
Returns
TRUE if the row should be stored persistently, FALSE otherwise

Reimplemented in StorageTable.

virtual OidxPtr MibTable::max_key ( )
virtual

Return the immediate successor of the greatest object identifier within the receiver's scope.

Returns
a pointer to the non including upper bound of the receiver's scope

Reimplemented from MibEntry.

int MibTable::perform_voting ( MibTableRow ,
int  ,
int   
)
protected

Let all voters vote for or against a row status transition.

Parameters
rowa pointer to the MibTableRow to be changed.
currentStatusthe row's current status.
requestedStatusthe row's requested new status.
Returns
a SNMP error status or SNMP_ERROR_SUCCESS if the transition is acknowledged by all voters.
virtual int MibTable::prepare_set_request ( Request ,
int &   
)
virtual

Let the receiver prepare a SNMP SET subrequest.

Parameters
req- A pointer to the whole SNMP SET request.
ind- The index of the subrequest to be processed.
Returns
SNMP_ERROR_SUCCESS on success and SNMP_ERROR_WRONG_VALUE, SNMP_ERROR_WRONG_TYPE, or SNMP_ERROR_NOT_WRITEABLE on failure.

Reimplemented from MibEntry.

virtual bool MibTable::ready ( Vbx pvbs,
int  sz,
MibTableRow row 
)
protectedvirtual

Check whether the specified row is ready to set in service.

  • check if all required (non default) values are given.
  • check if given values are ok (by asking MibLeaf::value_ok).
  • ask ready_for_service whether row can be set active.
Parameters
pvbsa pointer to an array of Vbx objects containing the (possible new) values and oids of the columns of a row to check.
szthe size of the array.
rowa pointer to the original row. If this is a new row, it is pointing to a MibTableRow that is filled with the new values, but is not inserted into the table.
Returns
TRUE if the specified row is ready to set for service.
virtual bool MibTable::ready_for_service ( Vbx pvbs,
int  sz 
)
virtual

Check whether the specified row is ready to set in service.

This method is left empty for override by the API user.

Parameters
pvbs- A pointer to an array of Vbx objects containing the values and oids of the columns of a row to check.
sz- The size of the array.
Returns
TRUE if the specified row is ready to set for service.

Reimplemented in VacmViewTreeFamilyTable, snmpTargetAddrEntry, VacmAccessTable, and VacmSecurityToGroupTable.

virtual void MibTable::reinit ( )
inlinevirtual

Reinitialize the table.

By default, this method does nothing. The method is called when a Mib instance needs to reinitialize its objects, for example, if a subagent needs to reconnect to its master agent.

Since
3.5.22
virtual void MibTable::remove_listener ( MibTable )
virtual

Remove a listener that no longer wants to be informed about row additions or deletions.

Parameters
listenera pointer to another instance of MibTable
void MibTable::remove_obsolete_rows ( OrderedList< Oidx > &  confirmed)
protected

Remove all rows that are not in the given list.

Parameters
confirmed_rows- A list of row indecies of rows which should not be removed from the receiver.
virtual void MibTable::remove_row ( const Oidx )
virtual

Remove a row with the given index from the table and call row_delete before.

Parameters
indthe index of the row.
void MibTable::remove_unused_rows ( )
protected

Periodically remove all rows that are notReady for more than a given timeout (default is 5 minutes).

For tables that have no row status, this can also be used for deferred row deletion: simply add the row to delete to the notread_rows list and let Mib::cleanup delete the rows by calling this method.

Note: a row cannot be set from notInService or active to notReady

virtual void MibTable::remove_voter ( MibTableVoter )
virtual

Remove a MibTableVoter listener.

Parameters
listenera pointer to a MibTableVoter instance.
virtual void MibTable::replace_col ( unsigned  int,
MibLeaf  
)
virtual

Replace a column of the table.

Parameters
columnIndexthe index of the column counted from 0.
newColumnthe new column MibLeaf instance.
virtual void MibTable::reset ( )
inlinevirtual

Resets the content of the table to its state right after construction.

By default this method calls MibTable::clear() to remove all rows.

Reimplemented from MibEntry.

Reimplemented in StorageTable, and VacmViewTreeFamilyTable.

virtual void MibTable::row_activated ( MibTableRow ,
const Oidx ,
MibTable t = 0 
)
inlinevirtual

Is called when a row is activated by a SET request setting the row�s snmpRowStatus object to active(1).

Parameters
row- A pointer to MibTableRow that has been activated.
index- The index of the activated row.
sourcea pointer to the source MibTable of the event, or 0 if the event is local.

Reimplemented in VacmViewTreeFamilyTable.

virtual void MibTable::row_added ( MibTableRow ,
const Oidx ,
MibTable t = 0 
)
inlinevirtual

Is called after a new row has been created and automatic index generation has taken place.

Parameters
rowA pointer to MibTableRow that has been created.
index- The index of the row.
sourcea pointer to the source MibTable of the event, or 0 if the event is local.

Reimplemented in TimeStampTable, VacmViewTreeFamilyTable, VacmAccessTable, and VacmSecurityToGroupTable.

virtual void MibTable::row_deactivated ( MibTableRow ,
const Oidx ,
MibTable t = 0 
)
inlinevirtual

Is called when a row is deactivated by a SET request setting the row�s snmpRowStatus object to notInService(2).

Parameters
row- A pointer to MibTableRow that has been deactivated.
index- The index of the deactivated row.
sourcea pointer to the source MibTable of the event, or 0 if the event is local.

Reimplemented in VacmViewTreeFamilyTable.

virtual void MibTable::row_delete ( MibTableRow ,
const Oidx ,
MibTable t = 0 
)
inlinevirtual

Is called before a row is deleted by MibTable.

Parameters
rowA pointer to MibTableRow that will be deleted.
index- The index of the row.
sourcea pointer to the source MibTable of the event, or 0 if the event is local.

Reimplemented in TimeStampTable, and VacmViewTreeFamilyTable.

virtual void MibTable::row_init ( MibTableRow ,
const Oidx ,
MibTable t = 0 
)
inlinevirtual

Is called after a new row has been initialized (i.e., after it has been loaded from persistent storage)

Parameters
rowa pointer to MibTableRow that has been created.
indexthe index of the row.
sourcea pointer to the source MibTable of the event, or 0 if the event is local.

Reimplemented in VacmViewTreeFamilyTable.

OidList<MibTableRow>* MibTable::rows ( )
inline

Return a pointer to the internal list of rows.

This list operates directly of the tables data. Do not delete the returned pointer, as this would corrupt the table.

Returns
a pointer to an OidList instance.
virtual bool MibTable::serialize ( char *&  ,
int &   
)
virtual

Serialize the values of the receiver table.

Parameters
buf- A pointer to byte stream buffer returned.
sz- The size of the buffer returned.
Returns
TRUE if serialization was successful, FALSE otherwise.

Reimplemented from MibEntry.

int MibTable::set_row_status ( MibTableRow ,
int   
)
protected

Set the value of the snmpRowStatus object of a given row.

Parameters
row- A row of the receiver.
status- The new value for the snmpRowStatus object.
Returns
If the row has no snmpRowStatus object return SNMP_ERROR_RESOURCE_UNAVAIL, on success SNMP_ERROR_SUCCESS.
virtual int MibTable::set_value ( Request ,
int   
)
virtual

Set a value of column in a row of the receiver table.

If the row does not exist, try to create one.

Parameters
req- A pointer to the whole SNMP GET request.
ind- The index of the subrequest to be processed.
Returns
SNMP_ERROR_SUCCESS on success, SNMP_ERROR_WRONG_TYPE or SNMP_ERROR_BAD_VALUE otherwise.
virtual int MibTable::size ( )
virtual

Return the size of the table meassured in rows.

Returns
the size of the receiver.
mib_type MibTable::type ( ) const
inlinevirtual

Return the type of the receiver.

Returns
AGENTPP_TABLE

Reimplemented from MibEntry.

virtual int MibTable::undo_set_request ( Request ,
int &   
)
virtual

Let the receiver undo a SNMP SET subrequest.

Parameters
req- A pointer to the whole SNMP SET request.
ind- The index of the subrequest to be processed.
Returns
SNMP_ERROR_SUCCESS on success and SNMP_ERROR_UNDO_FAIL on failure.

Reimplemented from MibEntry.

virtual void MibTable::update ( Request )
inlinevirtual

This method is called by a Mib instance whenever it needs to know how many rows the receiver contains.

This method can be used to update the receiver before a request accessing the receiver is processed. Note: The method may be called once for each subrequest of the given request. So, it is the implementor's responsibility to check whether an update is needed or not. For example, the pointer to the last request could be saved within the receiver. Only if req is different from the last request pointer, an update will actually be performed.

Parameters
reqthe request that needs to update the receiver.

Friends And Related Function Documentation

friend class Mib
friend
friend class snmpRowStatus
friend

Member Data Documentation

OidList<MibTableRow> MibTable::content
protected
OrderedList<MibTableRow> MibTable::delete_rows
protected
MibTableRow MibTable::generator
protected
unsigned int MibTable::index_len
protected
index_info* MibTable::index_struc
protected
List<MibTable> MibTable::listeners
protected
OrderedList<MibTableRow> MibTable::notready_rows
protected
snmpRowStatus* MibTable::row_status
protected
Timer MibTable::row_timeout
protected
Oidx MibTable::upper
protected
List<MibTableVoter> MibTable::voters
protected

The documentation for this class was generated from the following file: