|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.adventnet.snmp.beans.SnmpServer
This class maintains all the resources required for Snmp manager applications and applets. The resources are like SnmpAPI, SnmpSession, MibOperations and etc.The beans component like SnmpTarget and SnmpRequestServer extends this class. For every instance of these beans the SnmpServer uses the same resources.
| Field Summary | |
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 |
CBC_3DES
Constant for SNMPV3 usmUser CBC_3DES PrivProtocol. |
static int |
CBC_DES
Constant for SNMPV3 usmUser CBC_DES PrivProtocol. |
static int |
CFB_AES_128
Constant for SNMPV3 usmUser CFB_AES_128 PrivProtocol. |
static int |
CFB_AES_192
Constant for SNMPV3 usmUser CFB_AES_192 PrivProtocol. |
static int |
CFB_AES_256
Constant for SNMPV3 usmUser CFB_AES_256 PrivProtocol. |
static int |
MD5_AUTH
Constants USM Authentication |
static int |
NO_AUTH
Constants USM Authentication |
static byte |
NO_AUTH_NO_PRIV
Used to specify that both authentication and privacy should not be used. |
static int |
NO_PRIV
Constant for SNMPV3 usmUser NoPrivProtocol. |
SnmpOID[] |
oidList
The Object Identifiers will be stored in this array variable. |
static int |
SHA_AUTH
Constants USM Authentication |
static byte |
SNMPGET
Constant for SNMP get request. |
static byte |
SNMPGETBULK
Constant for SNMP V2 Get Bulk request. |
static byte |
SNMPGETNEXT
Constant for SNMP get next request. |
static byte |
SNMPINFORM
Constant for SNMP V2 INFORM request. |
static byte |
SNMPREPORT
Constant for SNMP V2 Report request. |
static byte |
SNMPRESPONSE
Constant for SNMP response request |
static byte |
SNMPSET
Constant for SNMP set request request. |
static byte |
SNMPTRAP
Constant for SNMP trap request. |
static byte |
SNMPV2TRAP
Constant for SNMP V2 Trap request. |
static int |
VERSION1
Constant for SNMP Version 1. |
static int |
VERSION2C
Constant for SNMP Version 2C. |
static int |
VERSION3
Constant for SNMP Version 3. |
| Method Summary | |
void |
async_create_v3_tables()
Method to create new users and add them to the userTable in
USMUserTable. |
int |
create_v3_tables()
Method to create new users and add them to the userTable in
USMUserTable. |
protected void |
finalize()
This cleanses up the common connection if no one is using |
protected void |
genEvent(SnmpPDU pdu)
generate the events to the listeners |
protected void |
genEvent(SnmpPDU pdu,
SnmpServer server)
generate the events to the listeners |
protected void |
genTimeoutEvent(SnmpPDU pdu)
generate the events to the listeners |
java.lang.String |
getCharacterEncoding()
Get the Character Encoding being used. |
java.lang.String |
getHostAddress(java.lang.String hostname)
To return the ip address as String for the given host name. |
boolean |
getIgnoreSpecificControlCodes()
To get the value determining whether the new-line characters, tabs and carriage returns are printed or their hex values. |
java.lang.String[] |
getLocalAddresses()
Returns the value of localAddress bound on the session instance. |
java.lang.String |
getMibPath()
To get the search Path in which the loadMibModules() will search for the MIB modules. |
boolean |
getOverwriteCMI()
Deprecated. Instead use isOverwriteCMI() method. |
int |
getPacketBufferSize()
Gets the Datagram Buffer Size used for receiving SNMP packets. |
byte |
getSecLevelForTimeSync()
Returns the securitylevel that would be used when doing
a V3 timeSync for a authPriv user. |
SecurityProvider |
getSecurityProvider()
Gets the security provider. |
java.lang.Object |
getSecurityTable(int secModel)
Returns the SecurityModelTable as an object for a given
security model. |
java.lang.String |
getSerializedMibFileName()
Gets the name of the Serialized Mib file |
java.text.SimpleDateFormat |
getSimpleDateFormat()
Gets the SimpleDateFormat for this class. |
byte[] |
getSnmpEngineID()
Gets the SnmpEngineID of this SNMP entity. |
SnmpEngineTable |
getSnmpEngineTable()
returns the SnmpEnginetable which contains the information about
v3 engine configured to this bean |
int |
getTimeoutInMilliSec()
Returns the timeout value in milliseconds. |
int |
getTimeToWait()
Gets the inter-packet delay time set on this SnmpSession object. |
USMUserTable |
getUSMTable()
returns the USMUserTable which contains the informations about v3 Users |
java.lang.String |
getV3ConfigTable()
Gets the table name that was configured for V3. |
int |
getV3MsgMaxSize()
Get the maximum size of the Snmp3Message. |
void |
initJdbcParams(java.lang.String driverName,
java.lang.String URL,
java.lang.String userName,
java.lang.String passWord)
If you need to use a database support, this method should be invoked to initialize the Jdbc Parameters. |
void |
initSecurityProvider()
This method initiates the SecurityProvider by reading from the
file securityProvider.confg . |
boolean |
isBroadcastFeatureEnable()
The method returns whether the API has the broadcast feature enabled or not. |
boolean |
isLoadFromCompiledMibs()
To check whether the mib will be loaded from CompiledMib files or not. |
boolean |
isLoadFromSerializedMibs()
To check whether the mib will be loaded from Serialized Mib files or not. |
boolean |
isLoadMibsFromDatabase()
To check whether the mib will be loaded from database or not. |
boolean |
isOverwriteCMI()
Returns the status of whether overwrite compiled mibs option is set. |
boolean |
isOverwriteMibsInDatabase()
Returns whether the mibs in database will be overwritten or not. |
boolean |
isReadDesc()
Returns true if reading descriptions from compiled modules is enabled |
boolean |
isSendPDUByGroup()
returns the state whether the pdus will be grouped and sent as single PDU. |
boolean |
isSerializeMibs()
Returns whether the mib file will be serialized or not. |
boolean |
isSetAutoInformResponse()
High level API method to check if the automatic response flag for the
Inform Request is set. |
boolean |
isSupportedSecurityModel(int secModel)
Specifies if a particular security model is supported or not. |
boolean |
isV3DatabaseFlag()
To check whether V3 database flag is set or not |
boolean |
isValidateUser()
To check whether the validating user is enabled for v3 case |
void |
manage_v3_tables()
Method to create new users and add them to userTable in
USMUserTable. |
void |
managing_v3_tables()
Method to create new users and add them to userTable in
USMUserTable. |
void |
releaseResources()
Though the resources will be cleaned up by the garbage collector, if the application is no more using the SnmpTarget and SnmpRequestServer bean instances, this method can be used to immediately release the resources. |
void |
setAutoInformResponse(boolean flag)
High-level API method to set the automatic response flag for the Inform
Request. |
void |
setBroadcastFeatureEnable(boolean bool)
The method can be used to enable/disable the broadcast feature available in the API. |
void |
setCharacterEncoding(java.lang.String enc)
Set the Character Encoding to be used. |
void |
setErrorFlagEnable(boolean errflag)
|
void |
setIgnoreSpecificControlCodes(boolean specConCode)
To set the value determining whether the new-line characters, tabs and carriage returns are printed or their hex values. |
void |
setLoadFromCompiledMibs(boolean flag)
Defines whether to load mib from compiled MIBs. |
void |
setLoadFromSerializedMibs(boolean flag)
Method defines whether to load MIB from serialized file. |
void |
setLoadMibsFromDatabase(boolean flag)
Defines whether to load mib from DataBase. |
void |
setMibOperations(MibOperations mibops)
Set the MibOperations.This can be used when the API user wants the MibBrowser to use the localinstance of MibOperations instead of the Static MibOperations shared by all the other beans. |
void |
setMibPath(java.lang.String path)
To set the search Path in which the loadMibModules() will search for the MIB modules. |
void |
setOverwriteCMI(boolean overWrite)
Defines whether to overwrite the existing compiled MIB files. |
void |
setOverwriteMibsInDatabase(boolean overWrite)
Defines whether to overwrite the MIB in the DataBase. |
void |
setPacketBufferSize(int size)
Sets the Datagram Buffer Size used for receiving SNMP packets. |
void |
setReadDesc(boolean readFlag)
Sets the flag to read descriptions from compiled mib modules. |
void |
setReceiveBufferSize(int size)
Sets the buffer size of this SnmpServer. |
void |
setSecLevelForTimeSync(byte secLevel)
Sets the securityLevel to use when doing
a V3 timeSync for a authPriv user. |
void |
setSendPDUByGroup(boolean flag)
set the state whether the PDUs should be grouped and send all PDUs as single PDU.After setting it to true this instance will be added to vector.This should be set to false, if this instance is no longer used. |
void |
setSerializedMibFileName(java.lang.String serFileName)
Method defines the name of the Serialized MIB File. |
void |
setSerializeMibs(boolean flag)
Defines whether to serialize the MibModule. |
void |
setSimpleDateFormat(java.text.SimpleDateFormat sdf)
Sets the SimpleDateFormat for this class. |
void |
setSnmpEngineID(byte[] engineID)
Sets the SnmpEngineID for this SNMP entity. |
void |
setTimeoutInMilliSec(int time)
Sets the timeout value which should be given in milliseconds. |
void |
setTimeToWait(int waittime)
Sets the inter-packet delay time. |
void |
setV3ConfigTable(java.lang.String tableName)
Sets the configured tableName specified in the case of V3Database. |
void |
setV3DatabaseFlag(boolean v3Flag)
If you need to use database support for V3 , set this flag to true. |
void |
setV3MsgMaxSize(int size)
Sets the maximum size of Snmp3Message. |
void |
validateUser(boolean validate)
Can be used to set whether the NO_AUTH_NO_PRIV user should be authenticated
and, to validate the privPassword in AUTHPRIV case |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public SnmpOID[] oidList
public static final byte SNMPGET
public static final byte SNMPGETNEXT
public static final byte SNMPRESPONSE
public static final byte SNMPSET
public static final byte SNMPTRAP
public static final byte SNMPGETBULK
Constant for SNMP V2 Get Bulk request.
public static final byte SNMPINFORM
Constant for SNMP V2 INFORM request.
public static final byte SNMPV2TRAP
Constant for SNMP V2 Trap request.
public static final byte SNMPREPORT
Constant for SNMP V2 Report request.
public static final int VERSION1
Constant for SNMP Version 1.
public static final int VERSION2C
Constant for SNMP Version 2C.
public static final int VERSION3
Constant for SNMP Version 3.
public static final int NO_AUTH
Constants USM Authentication
public static final int MD5_AUTH
Constants USM Authentication
public static final int SHA_AUTH
Constants USM Authentication
public static final int NO_PRIV
Constant for SNMPV3 usmUser NoPrivProtocol.
public static final int CBC_DES
Constant for SNMPV3 usmUser CBC_DES PrivProtocol.
public static final int CFB_AES_128
Constant for SNMPV3 usmUser CFB_AES_128 PrivProtocol.
public static final int CFB_AES_192
Constant for SNMPV3 usmUser CFB_AES_192 PrivProtocol.
public static final int CFB_AES_256
Constant for SNMPV3 usmUser CFB_AES_256 PrivProtocol.
public static final int CBC_3DES
Constant for SNMPV3 usmUser CBC_3DES PrivProtocol.
public static final byte NO_AUTH_NO_PRIV
Used to specify that both authentication and privacy should not be used.
public static final byte AUTH_NO_PRIV
Used to specify that authenticated message be sent to the peer.
public static final byte AUTH_PRIV
Used to specify that authentication and privacy are used in the
communication with the peer.
| Method Detail |
public java.lang.String getHostAddress(java.lang.String hostname)
hostname - the host whose ipaddress needs to be looked up
public SecurityProvider getSecurityProvider()
Gets the security provider.
public boolean isSendPDUByGroup()
public void setSendPDUByGroup(boolean flag)
public int getPacketBufferSize()
public void setPacketBufferSize(int size)
size - The size of the datagram packet buffer to be used in bytes.
An initial allocation of 64K is made by default.protected void genTimeoutEvent(SnmpPDU pdu)
protected void genEvent(SnmpPDU pdu,
SnmpServer server)
public void setSimpleDateFormat(java.text.SimpleDateFormat sdf)
getSimpleDateFormat()public java.text.SimpleDateFormat getSimpleDateFormat()
setSimpleDateFormat(SimpleDateFormat)public USMUserTable getUSMTable()
returns the USMUserTable which contains the informations about v3 Users
USMUserTablepublic SnmpEngineTable getSnmpEngineTable()
returns the SnmpEnginetable which contains the information about
v3 engine configured to this bean
SnmpEngineTablepublic void setSnmpEngineID(byte[] engineID)
Sets the SnmpEngineID for this SNMP entity.
engineID - The SnmpEngineID to be used.public byte[] getSnmpEngineID()
Gets the SnmpEngineID of this SNMP entity.
protected void genEvent(SnmpPDU pdu)
public void initJdbcParams(java.lang.String driverName,
java.lang.String URL,
java.lang.String userName,
java.lang.String passWord)
throws java.sql.SQLException,
java.lang.ClassNotFoundException
driverName - Name of the DataBase driver.URL - URL pointing to the DataBase file nameuserName - userNamepassWord - password
java.sql.SQLException
java.lang.ClassNotFoundExceptionpublic boolean isV3DatabaseFlag()
To check whether V3 database flag is set or not
public void setV3DatabaseFlag(boolean v3Flag)
you need to use database support for V3 , set this flag to true.
v3Flag - flag to be set.public void setV3ConfigTable(java.lang.String tableName)
Sets the configured tableName specified in the case of V3Database.
tableName - the name of the table name to be configured.public java.lang.String getV3ConfigTable()
Gets the table name that was configured for V3.
public void releaseResources()
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable - in case of finalization of errorspublic byte getSecLevelForTimeSync()
Returns the securitylevel that would be used when doing
a V3 timeSync for a authPriv user. Can be AUTH_PRIV(3)
or AUTH_NO_PRIV(1).
public void setSecLevelForTimeSync(byte secLevel)
Sets the securityLevel to use when doing
a V3 timeSync for a authPriv user. Can be either AUTH_PRIV(3)
or AUTH_NO_PRIV(1).
secLevel - The securityLevel to be set on this SnmpServer instance.public void async_create_v3_tables()
Method to create new users and add them to the userTable in
USMUserTable. It performs a discovery and timeSync (if required)
asynchronously. Returns immediately after sending the requests.
public void validateUser(boolean validate)
Can be used to set whether the NO_AUTH_NO_PRIV user should be authenticated
and, to validate the privPassword in AUTHPRIV case
validate - The boolean value. If this value is set to true,
and if this method is called for an
public boolean isValidateUser()
To check whether the validating user is enabled for v3 case
public int create_v3_tables()
Method to create new users and add them to the userTable in
USMUserTable. Returns 1 if userTable is successfully created,
negative value otherwise.
The following error codes can be set ErrorCodes DISCOVERY_FAILED, TIME_SYNC_FAILED,
WRONG_DIGEST_ERR,DECRYPT_ERROR_ERR, UKNOWN_ENGINEID_ERR,UKNOWN_USERNAMES_ERR,UNSUPP_SECLEVEL_ERR,
WRONG_PRIVPASSWORD.
ErrorMessages,
#getErrorCode(),
#getErrorString()public void manage_v3_tables()
Method to create new users and add them to userTable in
USMUserTable. If the v3 parameters specified are already
present in the userTable, it modifies the entry. However the
UserName cannot be modified.
The following error codes can be set ErrorCodes DISCOVERY_FAILED, TIME_SYNC_FAILED
ErrorMessages,
#getErrorCode(),
#geterrorstring()
public void managing_v3_tables()
throws SnmpException
Method to create new users and add them to userTable in
USMUserTable. If the v3 parameters specified are already
present in the userTable, it modifies the entry. However the
UserName cannot be modified.
The following error codes can be set ErrorCodes DISCOVERY_FAILED, TIME_SYNC_FAILED
SnmpExceptionErrorMessages,
#getErrorCode(),
#getErrorString()public void setCharacterEncoding(java.lang.String enc)
enc - The name of a character encoding. All the string encoding
will be done base on this encoding.public java.lang.String getCharacterEncoding()
public void setSerializeMibs(boolean flag)
public boolean isSerializeMibs()
public void setLoadFromSerializedMibs(boolean flag)
public void setLoadFromCompiledMibs(boolean flag)
If both loadFromSerializedMibs and loadFromCompiledMibs is set to true, it will just try to load the MIB as a serialized file.
public void setLoadMibsFromDatabase(boolean flag)
flag - booleaninitJdbcParams(java.lang.String, java.lang.String, java.lang.String, java.lang.String)public void setOverwriteMibsInDatabase(boolean overWrite)
public void setOverwriteCMI(boolean overWrite)
public boolean getOverwriteCMI()
public boolean isOverwriteCMI()
public boolean isOverwriteMibsInDatabase()
public void setReadDesc(boolean readFlag)
public boolean isReadDesc()
public boolean isLoadFromSerializedMibs()
public boolean isLoadFromCompiledMibs()
public boolean isLoadMibsFromDatabase()
public void setSerializedMibFileName(java.lang.String serFileName)
public boolean getIgnoreSpecificControlCodes()
public void setIgnoreSpecificControlCodes(boolean specConCode)
specConCode - true implies that they are printed as they are
false implies that their hex value is printed.public java.lang.String getSerializedMibFileName()
public void initSecurityProvider()
throws SnmpException
This method initiates the SecurityProvider by reading from the
file securityProvider.confg . It will register all the security
models specified in the securityProvider.config file.
Before you make any requests using any of the beans, this method
has to be called so that the security provider is initiated.
SnmpException - if the file could not be found or if the
security model could not be registered.public java.lang.Object getSecurityTable(int secModel)
Returns the SecurityModelTable as an object for a given
security model.
public boolean isSupportedSecurityModel(int secModel)
Specifies if a particular security model is supported or not.
Returns true if the security model is supported. False otherwise.
secModel - The secuirty model number which needs to be checked
if it is supported.
public boolean isSetAutoInformResponse()
High level API method to check if the automatic response flag for the
Inform Request is set. The default value is true.
public void setAutoInformResponse(boolean flag)
High-level API method to set the automatic response flag for the Inform
Request. If this flag is set to true, then the SNMP stack automatically
sends a Get Reponse message back to the sender. The default value is true.
flag - boolean value of the flag to be set.public void setMibPath(java.lang.String path)
public java.lang.String getMibPath()
public void setMibOperations(MibOperations mibops)
public void setTimeToWait(int waittime)
public int getTimeToWait()
public void setTimeoutInMilliSec(int time)
time - The timeout value to be set in milliseconds.public int getTimeoutInMilliSec()
public java.lang.String[] getLocalAddresses()
public void setReceiveBufferSize(int size)
size - the size of the buffer.public void setBroadcastFeatureEnable(boolean bool)
bool - the boolean value that is to enable/disable
the broadcast feature in the API.public boolean isBroadcastFeatureEnable()
setBroadcastFeatureEnable(boolean)public void setErrorFlagEnable(boolean errflag)
public void setV3MsgMaxSize(int size)
Sets the maximum size of Snmp3Message.
This method is to set the maximum size of the Snmp3Message.
If this is not set, then it will take the default size as 8192
which is already set as default in Snmp3Message.
size - the maximum size of Snmp3Message.public int getV3MsgMaxSize()
Get the maximum size of the Snmp3Message.
This method is to get the maximum size of the Snmp3Message.
It will return the msgMaxSize set using setV3MsgMaxSize().
If not set using setV3MsgMaxSize, then it will fetch the default value set in Snmp3Message.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||