MibContext Class Reference

#include <mib_context.h>

Inheritance diagram for MibContext:

ThreadManager Synchronized

List of all members.

Public Member Functions

 MibContext ()
 Default constructor.
 MibContext (const NS_SNMP OctetStr &)
 Create a given context.
virtual ~MibContext ()
 Destructor.
virtual boolean init_from (const NS_SNMP OctetStr &)
 Initialize context, thus load initialize groups with data from persistent storage.
virtual boolean load_from (const NS_SNMP OctetStr &)
 Loads persistent data from the supplied path.
virtual boolean save_to (const NS_SNMP OctetStr &)
 Save management data to persistent storage.
OidxPtr key ()
 Return a key value for the receiver context.
virtual MibEntryadd (MibEntry *)
 Register a MIB object for the context.
virtual MibEntryremove (const Oidx &)
 Unregister a MIB object from the context.
virtual MibEntryget (const Oidx &)
 Get the MIB object with a given object id.
virtual MibEntryseek (const Oidx &)
 Get the MIB entry with a given object id if such an entry exists or otherwise an object near to the given oid.
virtual int find (const Oidx &, MibEntryPtr &)
 Find a MIB entry with a given oid.
virtual int find_lower (const Oidx &, MibEntryPtr &)
 Find a MIB entry with an oid less or equal to a given oid.
virtual int find_upper (const Oidx &, MibEntryPtr &)
 Find a MIB entry with an oid greater or equal to a given oid.
virtual MibEntryfind_next (const Oidx &)
 Find the successor of a given MibEntry.
OidListCursor< MibEntryget_content ()
 Get a OidListCursor at the first element of the receiver.
OidListCursor< MibGroupget_groups ()
 Get a Cursor at the first element of registered groups.
virtual MibGroupfind_group (const Oidx &)
 Find a group with a given OID.
virtual boolean remove_group (const Oidx &)
 Remove a group and all its entries from the context.
virtual MibGroupfind_group_of (const Oidx &)
 Find the MibGroup that contains a MibEntry with a given object ID.
NS_SNMP OctetStr get_name ()
 Get the name of the context.
unsigned int get_num_groups () const
 Get the number of MibGroup instances in this context.
MibGroupget_group (int n)
 Get the nth group of the MibGroup instances in this context.
unsigned int get_num_entries () const
 Get the number of entries in this context.

Protected Attributes

OidList< MibEntrycontent
OidList< MibGroupgroups
Oidx contextKey
NS_SNMP OctetStr context
NS_SNMP OctetStr * persistencyPath


Constructor & Destructor Documentation

MibContext::MibContext (  ) 

Default constructor.

Creates a default context.

MibContext::MibContext ( const NS_SNMP OctetStr &   ) 

Create a given context.

Parameters:
context an OctetStr instance identifying the context to be created.

virtual MibContext::~MibContext (  )  [virtual]

Destructor.


Member Function Documentation

virtual boolean MibContext::init_from ( const NS_SNMP OctetStr &   )  [virtual]

Initialize context, thus load initialize groups with data from persistent storage.

Parameters:
path where data should be loaded from.
Returns:
TRUE if initialization was successful, FALSE otherwise.

virtual boolean MibContext::load_from ( const NS_SNMP OctetStr &   )  [virtual]

Loads persistent data from the supplied path.

Any previously existing data will be deleted before loading.

Parameters:
path where data should be loaded from.
Returns:
TRUE if initialization was successful, FALSE otherwise.

virtual boolean MibContext::save_to ( const NS_SNMP OctetStr &   )  [virtual]

Save management data to persistent storage.

NOTE: This method is called by the receiver's destructor with the path used by init_from.

Parameters:
path where data should be written to.
Returns:
TRUE if data could be saved successfully, FALSE otherwise.

OidxPtr MibContext::key (  ) 

Return a key value for the receiver context.

Returns:
a pointer to an Oidx instance.

virtual MibEntry* MibContext::add ( MibEntry  )  [virtual]

Register a MIB object for the context.

(SYNCHRONIZED)

Parameters:
item a pointer to a MibEntry object (i.e., MibLeaf, MibTable, MibGroup, ...).
Returns:
the input pointer, or 0 if the object could not be registered.

virtual MibEntry* MibContext::remove ( const Oidx  )  [virtual]

Unregister a MIB object from the context.

This method does not work for MibGroups, instead you have to remove each MibGroup's MIB object seperately. (SYNCHRONIZED)

Parameters:
oid the oid of the object to be removed.
Returns:
a pointer to the removed object, or 0 if such an object could not be found.

virtual MibEntry* MibContext::get ( const Oidx  )  [virtual]

Get the MIB object with a given object id.

Parameters:
key an object identifier
Returns:
a pointer to a MibEntry instance if an object with the given key could be found or 0 otherwise.

virtual MibEntry* MibContext::seek ( const Oidx  )  [virtual]

Get the MIB entry with a given object id if such an entry exists or otherwise an object near to the given oid.

Parameters:
key an object identifier
Returns:
a pointer to a MibEntry instance if an object could be found or 0 otherwise.

virtual int MibContext::find ( const Oidx ,
MibEntryPtr  
) [virtual]

Find a MIB entry with a given oid.

Parameters:
oid an object identifier.
entry changed to a pointer to the found entry or unchanged if the return value is different from SNMP_ERROR_SUCCESS.
Returns:
SNMP_ERROR_SUCCESS if an entry has been found and SNMP_ERROR_NO_SUCH_NAME otherwise.

virtual int MibContext::find_lower ( const Oidx ,
MibEntryPtr  
) [virtual]

Find a MIB entry with an oid less or equal to a given oid.

Parameters:
oid an object identifier.
entry changed to a pointer to the found entry or unchanged if the return value is different from SNMP_ERROR_SUCCESS.
Returns:
SNMP_ERROR_SUCCESS if an entry has been found and SNMP_ERROR_NO_SUCH_NAME otherwise.

virtual int MibContext::find_upper ( const Oidx ,
MibEntryPtr  
) [virtual]

Find a MIB entry with an oid greater or equal to a given oid.

Parameters:
oid an object identifier.
entry changed to a pointer to the found entry or unchanged if the return value is different from SNMP_ERROR_SUCCESS.
Returns:
SNMP_ERROR_SUCCESS if an entry has been found and SNMP_ERROR_NO_SUCH_NAME otherwise.

virtual MibEntry* MibContext::find_next ( const Oidx  )  [virtual]

Find the successor of a given MibEntry.

Parameters:
oid an object identifier of an existing MibEntry. If the receiver doesnot contain such an object, 0 will be returned.
Returns:
a pointer to the successor MibEntry if the specified object could be found, 0 otherwise.

OidListCursor<MibEntry> MibContext::get_content (  ) 

Get a OidListCursor at the first element of the receiver.

Returns:
an OidListCursor instance.

OidListCursor<MibGroup> MibContext::get_groups (  ) 

Get a Cursor at the first element of registered groups.

Returns:
a ListCursor instance.

virtual MibGroup* MibContext::find_group ( const Oidx  )  [virtual]

Find a group with a given OID.

(NOT SYNCHRONIZED)

Parameters:
oid a group's oid.
Returns:
a pointer a MibGroup instance, or 0 if no such group exists.

virtual boolean MibContext::remove_group ( const Oidx  )  [virtual]

Remove a group and all its entries from the context.

(SYNCHRONIZED)

Parameters:
oid a group's oid.
Returns:
TRUE if such a group could be found (and removed), FALSE otherwise.

virtual MibGroup* MibContext::find_group_of ( const Oidx  )  [virtual]

Find the MibGroup that contains a MibEntry with a given object ID.

Parameters:
oid a object identifier.
Returns:
a pointer to the MibGroup instance that contains an instance with the given oid, or 0 otherwise.

NS_SNMP OctetStr MibContext::get_name (  )  [inline]

Get the name of the context.

Returns:
an OctetStr instance.

unsigned int MibContext::get_num_groups (  )  const [inline]

Get the number of MibGroup instances in this context.

Returns:
the number of MibGroups in this context.

MibGroup* MibContext::get_group ( int  n  )  [inline]

Get the nth group of the MibGroup instances in this context.

Parameters:
n a 0-based index to the MibGroup to return.
Returns:
a pointer to the n-th MibGroup of this context or 0 if n is out of range.

unsigned int MibContext::get_num_entries (  )  const [inline]

Get the number of entries in this context.

Returns:
the number of entries in this context.


Member Data Documentation

NS_SNMP OctetStr MibContext::context [protected]

NS_SNMP OctetStr* MibContext::persistencyPath [protected]


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

Generated on Fri May 29 22:36:54 2009 for AGENT++ by  doxygen 1.5.6