com.adventnet.snmp.snmp2
Class SecurityProvider

java.lang.Object
  |
  +--com.adventnet.snmp.snmp2.SecurityProvider

public class SecurityProvider
extends java.lang.Object

This class is used to register the appropriate security model to be used with AdventNet SNMP API. The API users need not instantiate this class. The SnmpAPI does it and provides method getSecurityProvider() to get the SecurityProvider reference. With this reference, the user has to register the appropriate securityModel using the registerSecurityModel method by specifying the security model number, securityModelTable and securityModelEntry class names. By default the USM security model is registered. So there is no need to register the USM security model.

Two abstract classes, SecurityModelEntry and SecurityModelTable are provided to implement a new Security Model. The SecurityModelEntry has abstract methods to encode/decode the messageSecurityParameters and authenticate the message to be sent/received. The SecurityModelEntry should be extended to provide security model specific attributes. The SecurityModelTable is used to mainatin a list of SecurityModel entries. For e.g In case of USM security model, the SecurityModelEntry will have userName, engineID, engineBoots, engineTime, authentication parameters and privacy parameters as attributes. Each user is identified by a SecurityModelEntry. The SecurityModelTable will have a list of these model entries for each user. The SecurityModelTable abstract class has abstract methods to add, delete and modify SecurityModel entries.

See Also:
SecurityModelEntry, SecurityModelTable

Field Summary
static int ENTRY_CLASS
          The offset values of the Table and Entry class names stored.
static int TABLE_CLASS
          The offset values of the Table and Entry class names stored.
 
Method Summary
 java.lang.Object createTable(int m)
          Creates a new SecurityModelTable Object for the specific securityModel.
 java.lang.String[] getClassNames(int model)
          Returns the SecurityModelTable and SecurityModelEntry class names as an array of strings.
 java.lang.Object getTable(int m)
          Returns the SecurityModelTable as an object for a given security model.
 boolean isSupportedSecurityModel(int m)
          Specifies if a particular security model is supported or not.
 boolean registerSecurityModel(int m, java.lang.String tableClassName, java.lang.String entryClassName)
          Registers a particular security model to be used.
 boolean unRegisterSecurityModel(int m)
          Unregisters a supported security model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE_CLASS

public static final int TABLE_CLASS
The offset values of the Table and Entry class names stored. Useful in getting the Table and Entry class names from the getClassNames method.

ENTRY_CLASS

public static final int ENTRY_CLASS
The offset values of the Table and Entry class names stored. Useful in getting the Table and Entry class names from the getClassNames method.
Method Detail

createTable

public java.lang.Object createTable(int m)
                             throws SnmpException
Creates a new SecurityModelTable Object for the specific securityModel. A new SecurityModelTable Object will be instantiated once, for the SecurityModelTable class specified while registering the securityModel. The API user should not instantiate a security model Table. He should use the SecurityModelTable Object instance from this provider class. The SecurityModelTable Object instance can be got by the getTable() method in this class.
Returns:
the appropriate securityModelTable Object instantiated.
Throws:
SnmpException - appropriate SecurityModelTable object instance could not be created.
See Also:
getTable(int)

getTable

public java.lang.Object getTable(int m)
Returns the SecurityModelTable as an object for a given security model.
Returns:
the SecurityModelTable as an object for a given security model. Null if the SecurityModelTable is not created.

registerSecurityModel

public boolean registerSecurityModel(int m,
                                     java.lang.String tableClassName,
                                     java.lang.String entryClassName)
Registers a particular security model to be used. The class name of the table class that extends the SecurityModelTable and the class name of the entry class are required in addition to the security model number.
Parameters:
m - The securityModel number of the security model to be registered.
tableClassName - The class name of the table class that extends the SecurityModelTable.
entryClassName - The class name of the entry class that extends the SecurityModelEntry.
Returns:
true if the security model was successfully registered. False otherwise.

unRegisterSecurityModel

public boolean unRegisterSecurityModel(int m)
Unregisters a supported security model. This method unregisters a previously registered securityModel.
Parameters:
m - The securityModel number to be unregistered.
Returns:
true if the specified security model was successfully unregistered. False otherwise.

isSupportedSecurityModel

public boolean isSupportedSecurityModel(int m)
Specifies if a particular security model is supported or not. Returns true if the security model is supported. False otherwise.
Parameters:
m - The secuirty model number which needs to be checked if it is supported.
Returns:
true if the specified securitymodel is supported. False otherwise.

getClassNames

public java.lang.String[] getClassNames(int model)
Returns the SecurityModelTable and SecurityModelEntry class names as an array of strings. One can use the fields TABLE_CLASS and ENTRY_CLASS provided in this class to get the SecurityModelTable and SecurityModelEntry class names.
Parameters:
model - The security model for which the security model table and entry class have to be retrived.
Returns:
the SecurityModelTable and SecurityModelEntry class names as an array of strings.


Copyright (c)AdventNet Inc., 1996-2004