|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | 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 | |
(package private) SnmpAPI |
api
|
(package private) java.applet.Applet |
applet
This is if SAS needs to be used |
(package private) static java.lang.String |
ASN1_ERROR_ERR
|
(package private) static java.lang.String |
ASN1_ERROR_OID
|
(package private) boolean |
attemptCompleteData
get complete PDU by spliting the request if tooBig |
(package private) boolean |
attemptPartialData
get part of the PDU if some objects fails |
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) byte[] |
authKey
|
(package private) java.lang.String |
authPassword
|
(package private) int |
authProtocol
|
(package private) boolean |
broadCast
|
(package private) int |
clientID
|
(package private) java.lang.String |
community
|
(package private) byte[] |
contextID
|
(package private) java.lang.String |
contextName
|
(package private) int |
count
|
(package private) boolean |
debugon
|
(package private) static java.lang.String |
DECRYPT_ERROR_ERR
|
(package private) static java.lang.String |
DECRYPT_ERROR_OID
|
(package private) java.util.Vector |
discoveryTimeSyncListener
|
(package private) java.lang.String |
enc
|
(package private) byte[] |
engineID
|
(package private) SnmpEngineTable |
engineTable
|
(package private) java.lang.String |
error
|
(package private) int |
errorCode
|
(package private) java.util.Hashtable |
errorcodes
|
(package private) int |
errorIndex
|
(package private) int |
exceptionCode
|
(package private) java.util.Hashtable |
exceptionCodes
|
(package private) static boolean |
finalize_called
|
(package private) SnmpGroup |
group
|
(package private) java.lang.String[] |
group_oidList
|
(package private) boolean |
isName
|
(package private) boolean |
isNotSet
|
(package private) boolean |
isSendPDUByGroup
|
(package private) java.util.Vector |
listeners
|
(package private) java.lang.String[] |
localAddrs
|
(package private) int |
localPort
this is for starting session at this localport |
(package private) boolean |
logFlag
|
(package private) com.adventnet.utils.SnmpLoggerImpl |
loggerImpl
|
(package private) int |
logLevel
|
(package private) int |
logType
|
(package private) java.util.Vector |
matchServ
|
(package private) java.util.Hashtable |
matchtable
|
(package private) int |
MAX_NUM_ROWS
|
(package private) int |
maxRepetitions
|
static int |
MD5_AUTH
Constants USM Authentication |
(package private) MibOperations |
mibOps
|
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. |
(package private) int |
nonRepeaters
|
(package private) static java.lang.String |
NOT_TIME_WINDOWS_ERR
|
(package private) static java.lang.String |
NOT_TIME_WINDOWS_OID
|
(package private) java.util.Vector |
nullsession_targets
|
SnmpOID[] |
oidList
The Object Identifiers will be stored in this array variable. |
(package private) ProtocolOptions |
options
|
(package private) int |
pduErrorIndex
|
(package private) java.util.Vector |
pollertargets
|
(package private) int |
pollInterval
|
(package private) int |
port
|
(package private) java.util.Vector |
port_targets
|
(package private) java.lang.String |
principal
|
(package private) java.lang.String |
printStr
|
(package private) byte[] |
privKey
|
(package private) java.lang.String |
privPassword
|
(package private) int |
privProtocol
|
(package private) java.util.Vector |
propertylisteners
|
(package private) int |
protocol
|
(package private) com.adventnet.snmp.snmp2.server.RequestHandler |
reqHandler
|
(package private) int |
reqid
|
(package private) int |
retries
|
(package private) int |
secModel
|
(package private) byte |
securityLevel
|
(package private) boolean |
sendTimeoutEvents
|
(package private) int |
sentreqid
|
(package private) SnmpSession |
session
|
(package private) java.util.Vector |
session_port_targets
To keep track of the number of different targets. |
(package private) java.util.Vector |
session_targets
|
(package private) java.lang.String |
sessionName
|
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. |
(package private) static java.util.Hashtable |
snmpStore
This will store the common session used by all SnmpServers in a VM |
static byte |
SNMPTRAP
Constant for SNMP trap request. |
static byte |
SNMPV2TRAP
Constant for SNMP V2 Trap request. |
(package private) java.lang.String |
targetHost
|
(package private) java.util.Vector |
targets
This will track SnmpServers using the common SNMP session |
(package private) int |
timeout
|
(package private) static java.lang.String |
UKN_ENGINEID_ERR
|
(package private) static java.lang.String |
UKN_ENGINEID_OID
|
(package private) static java.lang.String |
UKN_USERNAMES_ERR
|
(package private) static java.lang.String |
UKN_USERNAMES_OID
|
(package private) static java.lang.String |
UNSUPP_SEC_LEVEL_ERR
|
(package private) static java.lang.String |
UNSUPP_SEC_LEVEL_OID
|
(package private) java.lang.String |
userError
|
(package private) int |
userErrorCode
|
(package private) USMUserTable |
usmTable
|
(package private) java.util.Hashtable |
v3ErrorTable
|
(package private) boolean |
validateUser
|
(package private) int |
varbinds_per_request
number of varbinds to be sent with the splitted request |
(package private) SnmpVar[] |
varList
|
(package private) int |
version
|
static int |
VERSION1
Constant for SNMP Version 1. |
static int |
VERSION2C
Constant for SNMP Version 2C. |
static int |
VERSION3
Constant for SNMP Version 3. |
(package private) java.lang.String |
writeCommunity
|
(package private) static java.lang.String |
WRONG_DIGEST_ERR
|
(package private) static java.lang.String |
WRONG_DIGEST_OID
|
| Constructor Summary | |
(package private) |
SnmpServer()
Use this constructor for applications. |
(package private) |
SnmpServer(java.applet.Applet applet)
Use this constructor for applets. |
(package private) |
SnmpServer(java.applet.Applet applet,
int localPort,
java.lang.String sessionName)
Use this constructor for applets with the specified local port and specified session name . |
(package private) |
SnmpServer(int protocol,
ProtocolOptions options)
Use this constructor when using protocols other than UDP/IP with the specified protocol and the protocol options. |
(package private) |
SnmpServer(int localPort,
java.lang.String sessionName)
Use this constructor for applications with the specified local port and specified session name . |
(package private) |
SnmpServer(SnmpSession ses,
MibOperations mib)
|
(package private) |
SnmpServer(java.lang.String[] localAddrs,
java.lang.String sessionName)
Use this constructor for applications in which the session needs to be bound to some local address. |
| Method Summary | |
(package private) void |
assignLogger(com.adventnet.afp.log.LoggerProperties loggerProps)
|
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. |
(package private) java.lang.Object[] |
getCompleteResponse(int varbinds_per_request)
Gets the complete data from the agent by splitting the varbinds into multiple requests.This can set if request pdu is very big. |
(package private) void |
getGROUPSNMPResponse(SnmpPDU pdu)
|
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. |
(package private) SnmpPDU |
getPdu(byte command)
|
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 |
(package private) SnmpPDU |
getSNMPResponse(byte command)
This gets the SNMP response from the agent |
(package private) SnmpPDU |
getSNMPResponse(SnmpOID[] oids,
SnmpVar[] vars,
byte command)
This gets the SNMP response from the agent |
(package private) SnmpPDU |
getSNMPResponse(SnmpPDU pdu)
|
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. |
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 . |
(package private) void |
initSnmpStore(SnmpServer target)
This sets up the common connection |
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 |
(package private) void |
loadMibs(java.lang.String mibs)
Load the mibs specified by white-space separated list of mibs. |
(package private) void |
logErrorMessage(java.lang.String error)
All the methods of this class (including sub classes), which needs to redirect an error message to the LogManger or to the standard console, can use this method. |
(package private) void |
logInfoMessage(java.lang.String info)
All the methods of this class (including sub classes), which needs to redirect an info message to the LogManger or to the standard console, can use this method. |
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. |
(package private) int |
sendSNMPRequest(byte command)
This gets the SNMP response from the agent |
(package private) int |
sendSNMPRequest(SnmpOID[] oids,
SnmpVar[] vars,
byte command)
This sends the SNMP request to the agent |
(package private) int |
sendSNMPRequest(SnmpPDU pdu)
This sends the SNMP request. |
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. |
(package private) void |
setErrorMessage(java.lang.Exception e,
SnmpPDU pdu)
|
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. |
(package private) void |
setPduParams(SnmpPDU pdu)
|
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. |
(package private) void |
updateEntry(USMUserEntry u,
byte[] eid,
int authProtocol,
java.lang.String authPassword,
java.lang.String privPassword)
|
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 |
|
| Field Detail |
int reqid
boolean debugon
int clientID
int protocol
ProtocolOptions options
static volatile boolean finalize_called
java.lang.String[] localAddrs
transient com.adventnet.snmp.snmp2.server.RequestHandler reqHandler
boolean broadCast
com.adventnet.utils.SnmpLoggerImpl loggerImpl
boolean logFlag
int logLevel
int logType
java.lang.String printStr
boolean isSendPDUByGroup
boolean isNotSet
int count
int sentreqid
java.util.Hashtable matchtable
java.util.Vector matchServ
java.lang.String[] group_oidList
static java.util.Hashtable snmpStore
transient java.util.Vector targets
transient java.util.Vector session_port_targets
transient java.util.Vector session_targets
transient java.util.Vector port_targets
transient java.util.Vector nullsession_targets
transient java.util.Vector pollertargets
transient SnmpAPI api
transient SnmpSession session
transient SnmpGroup group
transient MibOperations mibOps
java.util.Vector propertylisteners
java.util.Vector listeners
boolean sendTimeoutEvents
java.lang.String targetHost
int port
java.lang.String community
java.lang.String writeCommunity
public SnmpOID[] oidList
SnmpVar[] varList
int timeout
int retries
int maxRepetitions
int nonRepeaters
int MAX_NUM_ROWS
int version
boolean isName
int localPort
java.lang.String sessionName
int pollInterval
java.lang.String principal
byte[] engineID
java.lang.String contextName
byte[] contextID
java.lang.String authPassword
java.lang.String privPassword
byte[] authKey
int authProtocol
int privProtocol
byte[] privKey
byte securityLevel
int secModel
SnmpEngineTable engineTable
USMUserTable usmTable
java.util.Vector discoveryTimeSyncListener
java.applet.Applet applet
boolean attemptPartialData
boolean attemptCompleteData
int varbinds_per_request
java.lang.String error
java.lang.String userError
int userErrorCode
int errorCode
int errorIndex
int pduErrorIndex
java.util.Hashtable errorcodes
int exceptionCode
java.util.Hashtable exceptionCodes
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
public static final byte SNMPINFORM
public static final byte SNMPV2TRAP
public static final byte SNMPREPORT
public static final int VERSION1
public static final int VERSION2C
public static final int VERSION3
public static final int NO_AUTH
public static final int MD5_AUTH
public static final int SHA_AUTH
public static final byte NO_AUTH_NO_PRIV
public static final byte AUTH_NO_PRIV
public static final byte AUTH_PRIV
boolean validateUser
java.util.Hashtable v3ErrorTable
static java.lang.String UNSUPP_SEC_LEVEL_OID
static java.lang.String NOT_TIME_WINDOWS_OID
static java.lang.String UKN_USERNAMES_OID
static java.lang.String UKN_ENGINEID_OID
static java.lang.String WRONG_DIGEST_OID
static java.lang.String DECRYPT_ERROR_OID
static java.lang.String ASN1_ERROR_OID
static java.lang.String UNSUPP_SEC_LEVEL_ERR
static java.lang.String NOT_TIME_WINDOWS_ERR
static java.lang.String UKN_USERNAMES_ERR
static java.lang.String UKN_ENGINEID_ERR
static java.lang.String WRONG_DIGEST_ERR
static java.lang.String DECRYPT_ERROR_ERR
static java.lang.String ASN1_ERROR_ERR
java.lang.String enc
| Constructor Detail |
SnmpServer(SnmpSession ses,
MibOperations mib)
SnmpServer()
SnmpServer(java.applet.Applet applet)
SnmpServer(int localPort,
java.lang.String sessionName)
SnmpServer(java.applet.Applet applet,
int localPort,
java.lang.String sessionName)
SnmpServer(int protocol,
ProtocolOptions options)
SnmpServer(java.lang.String[] localAddrs,
java.lang.String sessionName)
localAddrs - The local addresses to which the session needs
to be bound.sessionName - Specify unique sessionNames for the instances
which need to use different SnmpSession instances to send data.| Method Detail |
void loadMibs(java.lang.String mibs)
throws MibException,
java.io.IOException,
java.io.FileNotFoundException
public java.lang.String getHostAddress(java.lang.String hostname)
hostname - the host whose ipaddress needs to be looked uppublic SecurityProvider getSecurityProvider()
SnmpPDU getSNMPResponse(SnmpOID[] oids,
SnmpVar[] vars,
byte command)
SnmpPDU getSNMPResponse(SnmpPDU pdu)
public boolean isSendPDUByGroup()
public void setSendPDUByGroup(boolean flag)