com.adventnet.snmp.snmp2.vacm
Class SnmpVacm

java.lang.Object
  |
  +--com.adventnet.snmp.snmp2.SnmpACM
        |
        +--com.adventnet.snmp.snmp2.vacm.SnmpVacm

public class SnmpVacm
extends SnmpACM

This class is used for VACM implementation and provides the method "isAccessAllowed" which does the access verifications. The access verifications are performed, only if the vacmUsed flag is set true. The method setVacmUsed, is used to set the vacmUsed flag. The constructor takes the SnmpAPI as a parameter. This is required as the SnmpAPI has a reference to the vacm tables i.e., VacmContextTable, VacmGroupTable, VacmGroupAccessTable and VacmViewTreeTable. The api user need not instantiate these four tables, as the SnmpAPI instantiates them. The SnmpAPI provides methods to get a reference to these tables. Before the "isAccessAllowed method" is called in, the vacm tables should have the necessary configuration.


Field Summary
static int ACCESS_ALLOWED
          Constant value for AccessAllowed
static byte AUTH_NO_PRIV
          Used to specify that authenticated message be sent to the peer.
static byte AUTH_PRIV
          Used to specify that authentication and privacy are used in the communication with the peer.
static int NO_ACCESS_ENTRY
          Constant value for noAccessEntry
static byte NO_AUTH_NO_PRIV
          Used to specify that both authentication and privacy are not used.
static int NO_GROUP_NAME
          Constant value for noGroupName
static int NO_SUCH_CONTEXT
          Constant value for noSuchContext
static int NO_SUCH_VIEW
          Constant value for noSuchView
static int NOT_IN_VIEW
          Constant value for notInView
static int OTHER_ERROR
          Constant value for otherError
 
Constructor Summary
SnmpVacm()
          The constructor takes the SnmpAPI as parameter and initializes the vacm data structures.
 
Method Summary
 VacmContextTable getContextTable()
          Gets the VacmContextTable.
 VacmGroupAccessTable getGroupAccessTable()
          Gets the VacmGroupAccessTable.
 VacmGroupTable getGroupTable()
          Gets the VacmGroupTable.
 VacmViewTreeTable getViewTable()
          Gets the VacmViewTreeTable.
 int isAccessAllowed(SnmpPDU pdu, SnmpOID oid)
          This method processess the isAccessAllowed request.
 boolean isAcmUsed()
          Gets the status of the vacmUsed flag.
 void setAcmUsed(boolean used)
          This method is used to set the vacmUsed flag.
protected  void setDBOperations(com.adventnet.utils.DatabaseOperations d)
           
protected  void setV3DatabaseFlag(boolean dbFlag)
           
 
Methods inherited from class com.adventnet.snmp.snmp2.SnmpACM
setDBOperations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCESS_ALLOWED

public static final int ACCESS_ALLOWED
Constant value for AccessAllowed

NO_ACCESS_ENTRY

public static final int NO_ACCESS_ENTRY
Constant value for noAccessEntry

NOT_IN_VIEW

public static final int NOT_IN_VIEW
Constant value for notInView

NO_SUCH_VIEW

public static final int NO_SUCH_VIEW
Constant value for noSuchView

NO_SUCH_CONTEXT

public static final int NO_SUCH_CONTEXT
Constant value for noSuchContext

NO_GROUP_NAME

public static final int NO_GROUP_NAME
Constant value for noGroupName

OTHER_ERROR

public static final int OTHER_ERROR
Constant value for otherError

NO_AUTH_NO_PRIV

public static final byte NO_AUTH_NO_PRIV
Used to specify that both authentication and privacy are not used.

AUTH_NO_PRIV

public static final byte AUTH_NO_PRIV
Used to specify that authenticated message be sent to the peer.

AUTH_PRIV

public static final byte AUTH_PRIV
Used to specify that authentication and privacy are used in the communication with the peer.
Constructor Detail

SnmpVacm

public SnmpVacm()
The constructor takes the SnmpAPI as parameter and initializes the vacm data structures. The SnmpAPI has the reference to the different vacm tables. These tables should have the vacm data configured, when this constructor is called. The vacm data structures in this class are initialized from the SnmpAPI reference of the different vacm tables.
Method Detail

setAcmUsed

public void setAcmUsed(boolean used)
This method is used to set the vacmUsed flag. Only if this flag is set to true, the access verifications are performed. Otherwise the isAccessAllowed method returns with a value ACCESS_ALLOWED.
Overrides:
setAcmUsed in class SnmpACM
Parameters:
used - The boolean value to set the vacmUsed flag.

setDBOperations

protected void setDBOperations(com.adventnet.utils.DatabaseOperations d)

setV3DatabaseFlag

protected void setV3DatabaseFlag(boolean dbFlag)
Overrides:
setV3DatabaseFlag in class SnmpACM

isAcmUsed

public boolean isAcmUsed()
Gets the status of the vacmUsed flag.
Overrides:
isAcmUsed in class SnmpACM
Returns:
True, if the flag vacmUsed is set. Returns false otherwise

getContextTable

public VacmContextTable getContextTable()
Gets the VacmContextTable.
Returns:
The VacmContextTable corresponding to this SnmpVacm instance.

getGroupTable

public VacmGroupTable getGroupTable()
Gets the VacmGroupTable.
Returns:
The VacmGroupTable corresponding to this SnmpVacm instance.

getGroupAccessTable

public VacmGroupAccessTable getGroupAccessTable()
Gets the VacmGroupAccessTable.
Returns:
The VacmGroupAccessTable corresponding to this SnmpVacm instance.

getViewTable

public VacmViewTreeTable getViewTable()
Gets the VacmViewTreeTable.
Returns:
The VacmViewTreeTable corrsponding to this SnmpVacm instance.

isAccessAllowed

public int isAccessAllowed(SnmpPDU pdu,
                           SnmpOID oid)
This method processess the isAccessAllowed request. The isAccessAllowed performs the access verifications according to the procedure specified in the VIEW BASED ACCESS CONTROL for SNMP. The SnmpPDU which is the input parameter, has all the data elements required for access verifications. The SnmpOID parameter is the Object Identifier for which the access verifications are to be performed. The isAccessAllowed returns an intger value which is a success or an errorIndication. The success returns a positive value '1' while the error will have a negative value. The constants for the success and error values are defined in this class.
Overrides:
isAccessAllowed in class SnmpACM
Parameters:
pdu - The SnmpPDU which has all the parameters required for processing the isAccessAllowed.(context,securityName,securityModel etc.)
oid - The SnmpOID. It has the Object Identifier for which the access verifications are to be performed.
Returns:
an integer value. Returns 1 if access is allowed. Returns a negative value if access is not allowed. The constants for the negative value are specified in this class.


Copyright (c)AdventNet Inc., 1996-2004