-
-
Field Summary
Fields Modifier and Type Field Description static int
VACM_MATCH_EXACT
static int
VACM_MATCH_PREFIX
static int
VACM_VIEW_EXCLUDED
static int
VACM_VIEW_INCLUDED
-
Fields inherited from interface org.snmp4j.agent.security.VACM
VACM_NO_ACCESS_ENTRY, VACM_NO_GROUP_NAME, VACM_NO_SUCH_CONTEXT, VACM_NO_SUCH_VIEW, VACM_NOT_IN_VIEW, VACM_OK, VACM_OTHER_ERROR, VIEW_NOTIFY, VIEW_READ, VIEW_WRITE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
accessEntryCount(org.snmp4j.smi.OctetString groupName)
Counts the number of access entries for the provided group name.void
addAccess(org.snmp4j.smi.OctetString groupName, org.snmp4j.smi.OctetString prefix, int securityModel, int securityLevel, int match, org.snmp4j.smi.OctetString readView, org.snmp4j.smi.OctetString writeView, org.snmp4j.smi.OctetString notifyView, int storageType)
Adds an access entry for the specified group name.void
addGroup(int securityModel, org.snmp4j.smi.OctetString securityName, org.snmp4j.smi.OctetString groupName, int storageType)
Adds a security name to group mapping to the VACM.void
addViewTreeFamily(org.snmp4j.smi.OctetString viewName, org.snmp4j.smi.OID subtree, org.snmp4j.smi.OctetString mask, int type, int storageType)
Adds a view tree family to an VACM view.boolean
hasSecurityToGroupMapping(int securityModel, org.snmp4j.smi.OctetString securityName)
Check if there is a security mapping for the specified security model and security name.boolean
removeAccess(org.snmp4j.smi.OctetString groupName, org.snmp4j.smi.OctetString prefix, int securityModel, int securityLevel)
Removes an access entry from the VACM.boolean
removeGroup(int securityModel, org.snmp4j.smi.OctetString securityName)
Removes a security name to group mapping from the VACM.boolean
removeViewTreeFamily(org.snmp4j.smi.OctetString viewName, org.snmp4j.smi.OID subtree)
Removes a view tree family from a VACM view.int
viewTreeFamilyEntryCount(org.snmp4j.smi.OctetString viewName)
Counts the number of view name to tree family mapping entries in this VACM.-
Methods inherited from interface org.snmp4j.agent.security.VACM
getViewName, isAccessAllowed, isAccessAllowed
-
-
-
-
Field Detail
-
VACM_MATCH_EXACT
static final int VACM_MATCH_EXACT
- See Also:
- Constant Field Values
-
VACM_MATCH_PREFIX
static final int VACM_MATCH_PREFIX
- See Also:
- Constant Field Values
-
VACM_VIEW_INCLUDED
static final int VACM_VIEW_INCLUDED
- See Also:
- Constant Field Values
-
VACM_VIEW_EXCLUDED
static final int VACM_VIEW_EXCLUDED
- See Also:
- Constant Field Values
-
-
Method Detail
-
addGroup
void addGroup(int securityModel, org.snmp4j.smi.OctetString securityName, org.snmp4j.smi.OctetString groupName, int storageType)
Adds a security name to group mapping to the VACM.- Parameters:
securityModel
- the security model the mapping is based on, seeSecurityModel
for possible values.securityName
- the security name to map to a group.groupName
- the name of the group.storageType
- the storage type to use for the entry. Possible values are defined byStorageType
.
-
removeGroup
boolean removeGroup(int securityModel, org.snmp4j.smi.OctetString securityName)
Removes a security name to group mapping from the VACM.- Parameters:
securityModel
- the security model the mapping is based on, seeSecurityModel
for possible values.securityName
- the mapped security name.- Returns:
true
if the entry has been removed,false
otherwise (i.e. if such an entry does not exists).
-
hasSecurityToGroupMapping
boolean hasSecurityToGroupMapping(int securityModel, org.snmp4j.smi.OctetString securityName)
Check if there is a security mapping for the specified security model and security name.- Parameters:
securityModel
- the security model the mapping is based on, seeSecurityModel
for possible values.securityName
- a security name.- Returns:
true
if there is a mapping andfalse
otherwise.
-
addAccess
void addAccess(org.snmp4j.smi.OctetString groupName, org.snmp4j.smi.OctetString prefix, int securityModel, int securityLevel, int match, org.snmp4j.smi.OctetString readView, org.snmp4j.smi.OctetString writeView, org.snmp4j.smi.OctetString notifyView, int storageType)
Adds an access entry for the specified group name.- Parameters:
groupName
- the group name for which to create an access entry.prefix
- ifmatch
isVACM_MATCH_PREFIX
the context name checked by the VACM must exatcly match this value, otherwise a prefix match is sufficient.securityModel
- the security model that must be used to gain access on behalf of this entry, seeSecurityModel
for possible values.securityLevel
- the minimum security level that must be used to gain access on behalf of this entry, seeSecurityLevel
for possible values.match
- specifies the type of context match used by this entry. Possible values areVACM_MATCH_EXACT
andVACM_MATCH_PREFIX
.readView
- the MIB view of the SNMP context to which this conceptual row authorizes read access. If the value is the empty string or if there is no active MIB view having this value of vacmViewTreeFamilyViewName, then no access is granted.writeView
- the MIB view of the SNMP context to which this conceptual row authorizes write access. If the value is the empty string or if there is no active MIB view having this value of vacmViewTreeFamilyViewName, then no access is granted.notifyView
- the MIB view of the SNMP context to which this conceptual row authorizes access for notifications. If the value is the empty string or if there is no active MIB view having this value of vacmViewTreeFamilyViewName, then no access is granted.storageType
- the storage type to use for the entry. Possible values are defined byStorageType
.
-
removeAccess
boolean removeAccess(org.snmp4j.smi.OctetString groupName, org.snmp4j.smi.OctetString prefix, int securityModel, int securityLevel)
Removes an access entry from the VACM.- Parameters:
groupName
- the group name for which to remove an access entry.prefix
- the context name or prefix of the access entry.securityModel
- the security model that must be used to gain access on behalf of this entry, seeSecurityModel
for possible values.securityLevel
- the minimum security level that must be used to gain access on behalf of this entry, seeSecurityLevel
for possible values.- Returns:
true
if the entry has been removed,false
otherwise (i.e. if such an entry does not exists).
-
accessEntryCount
int accessEntryCount(org.snmp4j.smi.OctetString groupName)
Counts the number of access entries for the provided group name.- Parameters:
groupName
- the group name for which access entries should be counted.- Returns:
- the number of group to view(s) access entries.
- Since:
- 3.0
-
addViewTreeFamily
void addViewTreeFamily(org.snmp4j.smi.OctetString viewName, org.snmp4j.smi.OID subtree, org.snmp4j.smi.OctetString mask, int type, int storageType)
Adds a view tree family to an VACM view.- Parameters:
viewName
- the view name to which a tree family is to be added.subtree
- the MIB subtree which when combined with the corresponding instance ofmask
(vacmViewTreeFamilyMask) defines a family of view subtrees.mask
- The bit mask which, in combination with the corresponding instance ofsubtree
(vacmViewTreeFamilySubtree), defines a family of view subtrees. See RFC 3415 vacmViewTreeFamilySubtree definition for more details on the bit mask.type
- specifies whether the subtree is includedVACM_VIEW_INCLUDED
or excludedVACM_VIEW_EXCLUDED
from the view.storageType
- the storage type to use for the entry. Possible values are defined byStorageType
.
-
removeViewTreeFamily
boolean removeViewTreeFamily(org.snmp4j.smi.OctetString viewName, org.snmp4j.smi.OID subtree)
Removes a view tree family from a VACM view.- Parameters:
viewName
- the view name from which a subtree family is to be removed.subtree
- the MIB subtree associated with this entry.- Returns:
true
if the entry has been removed,false
otherwise (i.e. if such an entry does not exists).
-
viewTreeFamilyEntryCount
int viewTreeFamilyEntryCount(org.snmp4j.smi.OctetString viewName)
Counts the number of view name to tree family mapping entries in this VACM.- Parameters:
viewName
- a VACM view name.- Returns:
- the number of view tree family entries for this view name.
- Since:
- 3.0
-
-