com.adventnet.snmp.snmp2.vacm
Class SnmpVacm

java.lang.Object
  extended by com.adventnet.snmp.snmp2.SnmpACM
      extended by 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
(package private)  VacmAccessEntry accessEntry
           
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.
(package private)  VacmContextEntry contextEntry
           
(package private)  byte[] contextName
          The contextName used for processing the isAccessAllowed.
(package private)  VacmContextTable contextTable
           
(package private)  VacmFamilyEntry familyEntry
           
(package private)  VacmGroupAccessEntry groupAccessEntry
           
(package private)  VacmGroupAccessTable groupAccessTable
           
(package private)  VacmGroupEntry groupEntry
           
(package private)  byte[] groupName
           
(package private)  VacmGroupTable groupTable
           
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
(package private)  int[] OID
           
static int OTHER_ERROR
          Constant value for otherError
(package private)  SnmpPDU rpdu
           
(package private)  byte securityLevel
          The SecurityLevel used for processing the isAccessAllowed.
(package private)  int securityModel
          The SecurityModel used for processing the isAccessAllowed.
(package private)  byte[] securityName
          The SecurityName used for processing the isAccessAllowed.
(package private)  boolean vacmUsed
           
(package private)  SnmpVarBind varb
           
(package private)  java.util.Vector variables
           
(package private)  VacmViewTreeTable viewTable
           
(package private)  VacmViewTreeEntry viewTreeEntry
           
 
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.
(package private) static void logErrorMessage(java.lang.String error)
          This method will log the message in the LogManager through the static "logErrorMessage(String)" method present in the LogManager class.
(package private) static void logInfoMessage(java.lang.String info)
          This method will log the message in the LogManager through the static "logInfoMessage(String)" method present in the LogManager class.
(package private) static void logMessage(java.lang.String message)
          This method will log the message in the LogManager through the static "logMessage(String)" method present in the LogManager class.
(package private) static void logMessage(java.lang.String message, int id)
          This method will log the message in the LogManager through the static "logMessage(String, int)" method present in the LogManager class.
 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)
           
(package private)  void setVacmData()
           
 
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

See Also:
Constant Field Values

NO_ACCESS_ENTRY

public static final int NO_ACCESS_ENTRY
Constant value for noAccessEntry

See Also:
Constant Field Values

NOT_IN_VIEW

public static final int NOT_IN_VIEW
Constant value for notInView

See Also:
Constant Field Values

NO_SUCH_VIEW

public static final int NO_SUCH_VIEW
Constant value for noSuchView

See Also:
Constant Field Values

NO_SUCH_CONTEXT

public static final int NO_SUCH_CONTEXT
Constant value for noSuchContext

See Also:
Constant Field Values

NO_GROUP_NAME

public static final int NO_GROUP_NAME
Constant value for noGroupName

See Also:
Constant Field Values

OTHER_ERROR

public static final int OTHER_ERROR
Constant value for otherError

See Also:
Constant Field Values

NO_AUTH_NO_PRIV

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

See Also:
Constant Field Values

AUTH_NO_PRIV

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

See Also:
Constant Field Values

AUTH_PRIV

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

See Also:
Constant Field Values

rpdu

SnmpPDU rpdu

varb

SnmpVarBind varb

variables

java.util.Vector variables

contextEntry

VacmContextEntry contextEntry

contextTable

VacmContextTable contextTable

groupEntry

VacmGroupEntry groupEntry

groupTable

VacmGroupTable groupTable

accessEntry

VacmAccessEntry accessEntry

groupAccessEntry

VacmGroupAccessEntry groupAccessEntry

groupAccessTable

VacmGroupAccessTable groupAccessTable

viewTreeEntry

VacmViewTreeEntry viewTreeEntry

viewTable

VacmViewTreeTable viewTable

familyEntry

VacmFamilyEntry familyEntry

groupName

byte[] groupName

OID

int[] OID

vacmUsed

boolean vacmUsed

contextName

byte[] contextName
The contextName used for processing the isAccessAllowed.


securityName

byte[] securityName
The SecurityName used for processing the isAccessAllowed.


securityLevel

byte securityLevel
The SecurityLevel used for processing the isAccessAllowed.


securityModel

int securityModel
The SecurityModel used for processing the isAccessAllowed.

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.

Specified by:
setAcmUsed in class SnmpACM
Parameters:
used - The boolean value to set the vacmUsed flag.

setDBOperations

protected void setDBOperations(com.adventnet.utils.DatabaseOperations d)
Overrides:
setDBOperations in class SnmpACM

setV3DatabaseFlag

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

isAcmUsed

public boolean isAcmUsed()
Gets the status of the vacmUsed flag.

Specified by:
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.

Specified by:
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.

setVacmData

void setVacmData()

logMessage

static void logMessage(java.lang.String message)
This method will log the message in the LogManager through the static "logMessage(String)" method present in the LogManager class.


logMessage

static void logMessage(java.lang.String message,
                       int id)
This method will log the message in the LogManager through the static "logMessage(String, int)" method present in the LogManager class.


logInfoMessage

static void logInfoMessage(java.lang.String info)
This method will log the message in the LogManager through the static "logInfoMessage(String)" method present in the LogManager class.


logErrorMessage

static void logErrorMessage(java.lang.String error)
This method will log the message in the LogManager through the static "logErrorMessage(String)" method present in the LogManager class.