AGENT++  4.0.3
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Vacm Class Reference

#include <vacm.h>

Classes

struct  ClassPointers
 

Public Member Functions

 Vacm ()
 
 Vacm (Mib &)
 
virtual ~Vacm ()
 
virtual int isAccessAllowed (const int securityModel, const NS_SNMP OctetStr &securityName, const int securityLevel, const int viewType, const NS_SNMP OctetStr &context, const Oidx &o)
 Does the user have the rights to access the Oid.
 
virtual int isAccessAllowed (const NS_SNMP OctetStr &viewName, const Oidx &o)
 Is the oid within the view.
 
virtual int getViewName (const int securityModel, const NS_SNMP OctetStr &securityName, const int securityLevel, const int viewType, const NS_SNMP OctetStr &context, NS_SNMP OctetStr &viewName)
 Get the view name for the given params.
 
void incUnknownContexts ()
 
NS_SNMP SnmpInt32 getUnknownContexts ()
 
bool addNewContext (const NS_SNMP OctetStr &newContext)
 Add a new context to the VacmContextTable.
 
void deleteContext (const NS_SNMP OctetStr &context)
 Delete the given context from the VacmContextTable.
 
bool addNewGroup (const int securityModel, const NS_SNMP OctetStr &securityName, const NS_SNMP OctetStr &groupName, const int storageType)
 Add a new security name to group mapping to the VacmSecurityToGroupTable.
 
void deleteGroup (const int securityModel, const NS_SNMP OctetStr &securityName)
 Delete the given securityName from the VacmSecurityToGroupTable.
 
bool addNewAccessEntry (const NS_SNMP OctetStr &groupName, const NS_SNMP OctetStr &prefix, const int securityModel, const int securityLevel, const int match, const NS_SNMP OctetStr &readView, const NS_SNMP OctetStr &writeView, const NS_SNMP OctetStr &notifyView, const int storageType)
 Add a new entry to the VacmAccessTable.
 
void deleteAccessEntry (const NS_SNMP OctetStr &groupName, const NS_SNMP OctetStr &prefix, const int securityModel, const int securityLevel)
 Delete a entry from the VacmAccessTable.
 
bool addNewView (const NS_SNMP OctetStr &viewName, const Oidx &subtree, const NS_SNMP OctetStr &mask, const int type, const int storageType)
 Add a new view to the VacmViewTreeFamilyTable.
 
void deleteView (const NS_SNMP OctetStr &viewName, const Oidx &subtree)
 Delete the subtree from the view from the VacmViewTreeFamilyTable.
 
ClassPointers get_vacm_tables ()
 Get the pointers to the VACM SNMP tables used by the VACM.
 
void clear ()
 Delete any content of the VACM tables and thus completely reset the VACM configuration.
 

Static Public Member Functions

static const char * getErrorMsg (int nr)
 

Protected Attributes

ClassPointers vcp
 

Constructor & Destructor Documentation

Vacm::Vacm ( )
Vacm::Vacm ( Mib )
virtual Vacm::~Vacm ( )
virtual

Member Function Documentation

bool Vacm::addNewAccessEntry ( const NS_SNMP OctetStr &  groupName,
const NS_SNMP OctetStr &  prefix,
const int  securityModel,
const int  securityLevel,
const int  match,
const NS_SNMP OctetStr &  readView,
const NS_SNMP OctetStr &  writeView,
const NS_SNMP OctetStr &  notifyView,
const int  storageType 
)

Add a new entry to the VacmAccessTable.

Parameters
[in]groupNamevacmGroupName
[in]prefixvacmAccessContextPrefix
[in]securityModelvacmAccessSecurityModel
[in]securityLevelvacmAccessSecurityLevel
[in]matchvacmAccessContextMatch
[in]readViewvacmAccessReadViewName
[in]writeViewvacmAccessWriteViewName
[in]notifyViewvacmAccessNotifyViewName
[in]storageTypevacmAccessStorageType (storageType_volatile, ...)
bool Vacm::addNewContext ( const NS_SNMP OctetStr &  newContext)

Add a new context to the VacmContextTable.

Parameters
[in]newContextvacmContextName
Returns
true, if the new context could be added. If the context already exists, false is returned.
bool Vacm::addNewGroup ( const int  securityModel,
const NS_SNMP OctetStr &  securityName,
const NS_SNMP OctetStr &  groupName,
const int  storageType 
)

Add a new security name to group mapping to the VacmSecurityToGroupTable.

Parameters
[in]securityModelvacmSecurityModel
[in]securityNamevacmSecurityName
[in]groupNamevacmGroupName
[in]storageTypevacmSecurityToGroupStorageType
bool Vacm::addNewView ( const NS_SNMP OctetStr &  viewName,
const Oidx subtree,
const NS_SNMP OctetStr &  mask,
const int  type,
const int  storageType 
)

Add a new view to the VacmViewTreeFamilyTable.

Parameters
[in]viewNamevacmViewTreeFamilyViewName
[in]subtreevacmViewTreeFamilySubtree
[in]maskvacmViewTreeFamilyMask
[in]typevacmViewTreeFamilyType (view_included or view_excluded)
[in]storageTypevacmViewTreeFamilyStorageType (storageType_volatile, ...)
Returns
true if the new row could be added. False, if it already exists.
void Vacm::clear ( )

Delete any content of the VACM tables and thus completely reset the VACM configuration.

This method is not synchronized. When called while the VACM is potentially being used by other threads, lock the tables by

   mib->lock_mib();
   ClassPointers vacmTables = vacm->get_vacm_tables();
   vacmTables.contextTable->start_synch();
   vacmTabes.securityToGroupTable->start_synch();
   vacmTables.accessTable->start_synch();
   vacmTables.viewTreeFamilyTable->start_synch();
   vacm->clear();
   vacmTables.contextTable->end_synch();
   vacmTabes.securityToGroupTable->end_synch();
   vacmTables.accessTable->end_synch();
   vacmTables.viewTreeFamilyTable->end_synch();
   mib->unlock_mib();
void Vacm::deleteAccessEntry ( const NS_SNMP OctetStr &  groupName,
const NS_SNMP OctetStr &  prefix,
const int  securityModel,
const int  securityLevel 
)

Delete a entry from the VacmAccessTable.

Parameters
[in]groupNamevacmGroupName
[in]prefixvacmAccessContextPrefix
[in]securityModelvacmAccessSecurityModel
[in]securityLevelvacmAccessSecurityLevel
void Vacm::deleteContext ( const NS_SNMP OctetStr &  context)

Delete the given context from the VacmContextTable.

Parameters
[in]contextvacmContextName
void Vacm::deleteGroup ( const int  securityModel,
const NS_SNMP OctetStr &  securityName 
)

Delete the given securityName from the VacmSecurityToGroupTable.

void Vacm::deleteView ( const NS_SNMP OctetStr &  viewName,
const Oidx subtree 
)

Delete the subtree from the view from the VacmViewTreeFamilyTable.

Parameters
[in]viewNamevacmViewTreeFamilyViewName
[in]subtreevacmViewTreeFamilySubtree
ClassPointers Vacm::get_vacm_tables ( )
inline

Get the pointers to the VACM SNMP tables used by the VACM.

Returns
a Vacm::ClassPointers instance containing the pointers of the SNMP tables used by the VACM.
static const char* Vacm::getErrorMsg ( int  nr)
inlinestatic
NS_SNMP SnmpInt32 Vacm::getUnknownContexts ( )
virtual int Vacm::getViewName ( const int  securityModel,
const NS_SNMP OctetStr &  securityName,
const int  securityLevel,
const int  viewType,
const NS_SNMP OctetStr &  context,
NS_SNMP OctetStr &  viewName 
)
virtual

Get the view name for the given params.

Parameters
[in]securityModelThe security model used
[in]securityNameThe security name of the user
[in]securityLevelThe security level
[in]viewTypeSelect one of mibView_read, write or notify
[in]contextThe MIB context
[out]viewNameIf found, the name of the matching view
Returns
VACM_viewFound on success, error codes on failure
void Vacm::incUnknownContexts ( )
virtual int Vacm::isAccessAllowed ( const int  securityModel,
const NS_SNMP OctetStr &  securityName,
const int  securityLevel,
const int  viewType,
const NS_SNMP OctetStr &  context,
const Oidx o 
)
virtual

Does the user have the rights to access the Oid.

All parameters are used to check if access is allowed.

Parameters
[in]securityModelThe security model used
[in]securityNameThe security name of the user
[in]securityLevelThe security level
[in]viewTypeRead, write or notify view
[in]contextThe MIB context
[in]oThe Oid the user wants to access
Returns
true if access is allowed
virtual int Vacm::isAccessAllowed ( const NS_SNMP OctetStr &  viewName,
const Oidx o 
)
virtual

Is the oid within the view.

Check if the given Oid is within the named view.

Parameters
[in]viewNameName of the view
[in]oOid to check
Returns
true if the oid is within the view

Member Data Documentation

ClassPointers Vacm::vcp
protected

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