|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.adventnet.snmp.snmp2.agent.Cache
com.adventnet.snmp.snmp2.agent.BaseSnmpStore
com.adventnet.snmp.snmp2.agent.BaseSnmpAgent
com.adventnet.snmp.snmp2.agent.SnmpAgent
public class SnmpAgent
This class handles all the SNMP requests by forwarding the requests to SnmpPduRequestListeners which is registered with the Agent
This class implements SnmpClient and adds itself as client to the SnmpSession.Hence if any pdu is received at the session,its clients authenticate is called.If the authenticate passes,then its SnmpClient callback method is called where the SnmpPDU is given for agents processing.
For sending back the response the send method in SnmpAgent is called.
API users can extend this class and override authenticate method for having access policies which require any special handling.
The agent doesn't require a MIB. This is especially useful when memory constraints are high and some packages can therefore be avoided.
In a JVM you could have a multiple instance of SnmpAgent.
#SnmpSession, #SnmpAPI, #SnmpStore, #SnmpClient,
Serialized Form| Field Summary | |
|---|---|
(package private) AclTable |
aclTable
The Authentication Control Table associated with this SnmpAgent. |
protected static com.adventnet.utilities.ui.event.ActionHandlerListener |
actionHandlerListener
|
(package private) boolean |
debug
|
(package private) SnmpEngineEntry |
entry
|
static java.lang.String |
homeDirectory
The home directory. |
(package private) boolean |
isRemoteConfigurable
|
(package private) boolean |
isV3Adaptor
|
(package private) boolean |
mibSupportForAdaptor
|
RemoteV3Client |
remoteV3Client
This interface will be called whenever the USM or VACM table is updated , provided the it is added to the SnmpAgent using the addREmoteV3Client(). |
(package private) boolean |
strictlyV3
|
(package private) SnmpEngineTable |
table
|
(package private) java.lang.String |
v3AdaptorStorage
|
(package private) V3Initialiser |
v3Initialiser
The object of this class will be used if the user wants to implement his own class from which the V3 configurations have to be initialised. |
(package private) boolean |
v3UserConfig
|
(package private) boolean |
viewBasedFlag
|
(package private) boolean |
windowsSubAgent
|
| Fields inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpAgent |
|---|
AgentScheduler, api, asyncMode, authListener, callbackThread, communityVector, communityWriter, decoder, ENABLE_SNMP_AUTHEN_TRAPS, errstat, isAuthTrapsDisabled, isStartUpTrapDisabled, outTraps, pduRequestHdlr, port, recdPdu, registrationlistener, schedulerHash, sgl, snmpLog, snmpVersion, started, startTime, statusListener, sysORTableListener, systemGroupHandler, TRANSPORT_PROVIDER, trapListener, trapSourceDefault, utilities, v1v2AccessControl, versionInInt |
| Fields inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpStore |
|---|
debugLevel, localAddress, oldAddress, oldPort, protocol, session |
| Fields inherited from class com.adventnet.snmp.snmp2.agent.Cache |
|---|
cache |
| Constructor Summary | |
|---|---|
SnmpAgent()
Constructor which initialises the session parameters with default values of |
|
SnmpAgent(int port)
One argument (port) Constructor which initialises the session parameters with default values of |
|
SnmpAgent(java.lang.String ipAddress)
One Argument(ipAddress) Constructor which initialises the session parameters with default values of |
|
SnmpAgent(java.lang.String ipAddress,
int port)
Two argument (ipAddress, port) Constructor which initialises the session parameters with default values of |
|
| Method Summary | |
|---|---|
void |
addActionHandler(com.adventnet.utilities.ui.event.ActionHandlerListener ahlistener)
Method to add ActionHandler for this class. |
void |
addRemoteV3Client(RemoteV3Client client)
Provides a hook for the user to implement his own class to which all the USM and VACM updations are propogated. |
void |
addV3Initialiser(V3Initialiser v3Initialiser)
Adds the V3Initialiser object from which the V3 Configurations will be read to the SnmpAgent. |
boolean |
authenticate(SnmpPDU pdu,
java.lang.String community)
This method is called before the callback and related processing methods are called has a simple checks based on the community of the pdu which has been received. |
boolean |
callback(SnmpSession session,
SnmpPDU pdu,
int reqid)
The callback of SnmpClient interface for incoming PDUs which is implemented by this agent. |
protected void |
decodePdu(SnmpPDU pdu)
|
void |
enableUsmSpinLock(boolean usm)
|
AclTable |
getAclTableInstance()
Getter for the AclTable instance of this Agent. |
java.lang.String |
getEngineBootsFileName()
Getter for EngineBoots File Name |
RemoteV3Client |
getRemoteV3Client()
Getter for RemoteV3Client. |
java.lang.String |
getSerializeFileName()
Get the name of the serialized file which the SnmpAgent uses to configure the V3 settings. |
SnmpCommunityTableRequestHandler |
getSnmpCommunityTableListener()
The method to get the SnmpCommunityTableListener. |
SnmpNotifyFilterProfileTableRequestHandler |
getSnmpNotifyFilterProfileTableListener()
The method to get the SnmpNotifyFilterProfileTableListener. |
SnmpNotifyFilterTableRequestHandler |
getSnmpNotifyFilterTableListener()
The method to get the SnmpNotifyFilterTableListener. |
SnmpNotifyTableRequestHandler |
getSnmpNotifyTableListener()
The method to get the SnmpNotifyTableListener. |
SnmpTargetAddrExtTableRequestHandler |
getSnmpTargetAddrExtTableListener()
The method to get the SnmpTargetAddrExtTableListener. |
SnmpTargetAddrTableRequestHandler |
getSnmpTargetAddrTableListener()
The method to get the SnmpTargetAddrTableListener. |
SnmpTargetParamsTableRequestHandler |
getSnmpTargetParamsTableListener()
The method to get the SnmpTargetParamsTableListener. |
SnmpVacm |
getSnmpVacm()
The Getter for SNMP Vacm. |
boolean |
getSpinLock()
Get the SpinLock flag set in the agent.This flag is primarily for USMUserTable remote configuration in the agent.API Users need not require this method. |
java.lang.String[] |
getSubAgent()
Return the properties of the sub agent. |
UsmUserTableRequestHandler |
getUsmUserTableListener()
The method to get the UsmUserTableListener. |
java.lang.String |
getV3AdaptorStorageMode()
The method to get the Adaptor Storage Type. |
boolean |
getV3Configuration()
Getter for the V3Configuration flag. |
V3Initialiser |
getV3Initialiser()
Getter of V3Initialiser |
VacmAccessTableRequestHandler |
getVacmAccessTableListener()
The method to get the VacmAccessTableListener. |
VacmContextTableRequestHandler |
getVacmContextTableListener()
The method to get the VacmContextTableListener. |
VacmSecurityToGroupTableRequestHandler |
getVacmSecurityToGroupTableListener()
The method to get the VacmSecurityToGroupTableListener. |
VacmViewTreeFamilyTableRequestHandler |
getVacmViewTreeFamilyTableListener()
The method to get the VacmViewTreeFamilyTableListener. |
(package private) NativeSnmpVar |
getValue(NativeSnmpVar var,
byte req)
Set methods from dll |
(package private) SnmpVar |
getValue(SnmpVarBind varbind,
byte req)
returns the variable requested |
(package private) NativeSnmpVar |
getValue(java.lang.String OidString,
byte req)
Get Requests From DLL |
boolean |
getViewBasedFlag()
Getter for the ViewBasedFlag. |
boolean |
getWindowsSubAgent()
gets the windows subagent flag |
void |
initializeAdaptorV3Settings(java.lang.String format,
boolean communityAndTargetSupport)
The method is to set the Storage type for the V3 Tables and the Community Target and Notificaiton MibSupport in Snmp Adaptor. |
(package private) void |
initSnmpAgent()
|
boolean |
isRemoteConfigurable()
Getter of mode of VACM RemoteConfiguration for the V3agent. |
boolean |
isSnmpV3Compliance()
Getter for the V3Compliance flag. |
boolean |
isStrictlyV3()
|
boolean |
isUsmSpinLockEnabled()
|
static void |
killSnmpAgent()
Method to kill this Snmp Agent. |
void |
nativeInit(java.lang.String mibFile,
java.lang.String homeDir)
Called in the case when SnmpAgent acts as a sub agent for windows. |
static void |
nativeStdOutErr(java.lang.String logfile)
Deprecated. - as logging is included. Setter for standard out and standard error messges. |
void |
readValuesFromConf(AgentParamOptions options,
java.lang.String dirPath)
Method to start this Agent by reading the Values from a conf file. |
void |
removeRemoteV3Client()
Removes the RemoteV3Client from the SnmpAgent. |
boolean |
restartSnmpAgent(int agentPort)
Restarts the receiver Thread for receiving requests |
void |
send(SnmpPDU newPdu)
Sends the PDU out from the agent. |
void |
serializeTable()
Serializes the Snmp Version 3 Tables |
void |
setAclTableInstance(AclTable table)
Setter for the AclTable for Authentication of this SnmpAgent. |
void |
setDebug(boolean val)
Deprecated. - use Logging Setter for debug flag. Sets the debug mode as on or off. |
void |
setDebugOff()
Deprecated. - use Logging. Sets debug flag of the agent as false |
void |
setDebugOn()
Deprecated. - use the Logging. Sets debug flag of the agent as true. |
void |
setEngineBootsFileName(java.lang.String name)
Setter for EngineBoots File Name |
void |
setSerializeFileName(java.lang.String fileName)
Set the fileName into which the SNMPv3 configuration tables are serialized. |
void |
setSnmpV3Compliance(boolean snmpV3Compliance)
Setter for V3Compliance flag. |
void |
setSnmpVersion(java.lang.String snmpVersion,
boolean restart)
The version in which the agent is going to run. |
void |
setSpinLock(boolean flag)
Set the spinLock flag in the agent.This is also useful in the USMUserTable configuration in the agent.API users need not require this method |
void |
setStrictlyV3(boolean flag)
|
void |
setSubAgent(java.lang.String[] props)
Sets the sub agent properties. |
void |
setTrapSourceDefault(boolean value)
Deprecated. Make use of the method setDefaultTrap(boolean isDefault) This method switches the trapSource (DEFAULT/TFTABLE) ie, specifies whether the manager to which the trap to be sent must be taken from TFTABLE / DEFAULT. In the case of default, the traps can be sent to only one manager and by default , it is Users should set this flag to false to use the TrapForwardingTable. localhost - port number 162. |
void |
setV3Configuration(boolean v3Config)
Setter for the V3Configuration. |
void |
setVacmRemoteConfiguration(boolean value)
This method turns on the VACM RemoteConfiguration for the V3agent. |
void |
setViewBasedFlag(boolean vbac)
Setter for the ViewBasedFlag. |
void |
setWarmStart(boolean warmStart)
Hook method to send warmStart trap. |
void |
setWindowsSubAgent(boolean value)
allows agent to act as a sub-agent. |
void |
stopSnmpAgent()
Stops the receiver Thread and closes the socket used by this agent. |
| Methods inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpStore |
|---|
closeAll, finalize, getSnmpAPI, getSnmpSession, getSnmpSession, initSession, initSnmpStore, isAlive, isDebug |
| Methods inherited from class com.adventnet.snmp.snmp2.agent.Cache |
|---|
getFromCache, getMibOperations, putInCache, setMibOperations |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
boolean windowsSubAgent
boolean v3UserConfig
boolean mibSupportForAdaptor
java.lang.String v3AdaptorStorage
boolean isV3Adaptor
boolean strictlyV3
SnmpEngineEntry entry
SnmpEngineTable table
AclTable aclTable
boolean debug
public static java.lang.String homeDirectory
public RemoteV3Client remoteV3Client
V3Initialiser v3Initialiser
boolean isRemoteConfigurable
boolean viewBasedFlag
protected static com.adventnet.utilities.ui.event.ActionHandlerListener actionHandlerListener
| Constructor Detail |
|---|
public SnmpAgent()
Read/Write Community = "public"
It starts agent at a random port.
Also it initialises the SnmpV3 parameters.
SnmpAgent(String ipAddress),
SnmpAgent(int port),
SnmpStore()public SnmpAgent(java.lang.String ipAddress)
Read/Write Community = "public"
It starts agent at a random port and a given ipAddress.
Also it initialises the SnmpV3 parameters.
SnmpAgent(),
SnmpAgent(int port),
SnmpStore(String ipAddress)public SnmpAgent(int port)
Read/Write Community = "public"
It starts the agent at the specified port and address.
Also it initialises the SnmpV3 parameters.
SnmpAgent(),
SnmpAgent(String ipAddress),
SnmpStore(int port)
public SnmpAgent(java.lang.String ipAddress,
int port)
Read/Write Community = "public"
It starts the agent at the specified port and address.
Also it initialises the SnmpV3 parameters.
SnmpAgent(),
SnmpAgent(int port),
SnmpAgent(String ipAddress),
SnmpStore(String ipAddress, int port)| Method Detail |
|---|
public void setWindowsSubAgent(boolean value)
value - boolean value to set agent as a subagent or stand alone
agent.public boolean getWindowsSubAgent()
getWindowsSubAgent in interface PropertyRegistrationListenergetWindowsSubAgent in class BaseSnmpAgentpublic SnmpVacm getSnmpVacm()
getSnmpVacm in interface PropertyRegistrationListenergetSnmpVacm in class BaseSnmpAgentpublic boolean getSpinLock()
setSpinLock(boolean flag)public void setSpinLock(boolean flag)
flag - the spinLock flag value to be set.getSpinLock()public void enableUsmSpinLock(boolean usm)
public boolean isUsmSpinLockEnabled()
void initSnmpAgent()
public void setDebug(boolean val)
BaseSnmpStore
setDebug in class BaseSnmpStoreval - the value for debug mode.SnmpAPIpublic void setDebugOn()
setDebugOff()public void setDebugOff()
setDebugOn()
public void nativeInit(java.lang.String mibFile,
java.lang.String homeDir)
mibFile - the name of the mib file.homeDir - the home directory of the mibfile.
public void send(SnmpPDU newPdu)
throws SnmpException
send in class BaseSnmpAgentnewPdu - the response PDU.
SnmpException - on send errors or if
the session is not alivepublic void setStrictlyV3(boolean flag)
public boolean isStrictlyV3()
public boolean callback(SnmpSession session,
SnmpPDU pdu,
int reqid)
BaseSnmpAgentWhen a pdu reached at the session for which this SnmpAgent is registered as SnmpClient, then the client(here BaseSnmpAgent) callback is called.
callback in interface SnmpClientcallback in class BaseSnmpAgentsession - the session on which agent is communicating.pdu - the Snmp PDU.reqid - the value of reqid.public java.lang.String getSerializeFileName()
getSerializeFileName in interface PropertyRegistrationListenergetSerializeFileName in class BaseSnmpAgent
public void setSerializeFileName(java.lang.String fileName)
throws SnmpException
setSerializeFileName in interface PropertyRegistrationListenersetSerializeFileName in class BaseSnmpAgentfileName - The fileName into which the SNMPv3 configuration tables can be serialized
SnmpException - if problem occurs while deserializing the file if the agent
is already started in v3.
NativeSnmpVar getValue(java.lang.String OidString,
byte req)
throws AgentSnmpException,
RowCreationException
AgentSnmpException
RowCreationException
NativeSnmpVar getValue(NativeSnmpVar var,
byte req)
throws AgentSnmpException,
RowCreationException
AgentSnmpException
RowCreationException
SnmpVar getValue(SnmpVarBind varbind,
byte req)
throws AgentSnmpException,
RowCreationException
AgentSnmpException
RowCreationExceptionprotected void decodePdu(SnmpPDU pdu)
decodePdu in class BaseSnmpAgent
public boolean authenticate(SnmpPDU pdu,
java.lang.String community)
authenticate in interface SnmpClientauthenticate in class BaseSnmpAgentpdu - the Snmp PDU.community - the value of the community.
SnmpClientpublic static void nativeStdOutErr(java.lang.String logfile)
logFile - the file name to set the standard out and error messages.
public boolean restartSnmpAgent(int agentPort)
throws AgentRuntimeException
restartSnmpAgent in class BaseSnmpAgentagentPort - the port number on which the SnmpAgent will run.
AgentRuntimeException - if the specified port is already in
use.BaseSnmpStore.isAlive(),
BaseSnmpAgent.restartSnmpAgent()public void stopSnmpAgent()
This thread doesn't kill all the threads and sessions.
stopSnmpAgent in class BaseSnmpAgentSnmpStorepublic void setWarmStart(boolean warmStart)
setWarmStart in class BaseSnmpAgentwarmStart - The warmStart trap flag.
public void setSnmpVersion(java.lang.String snmpVersion,
boolean restart)
The values could be either v1,v2,v2c or v3. restart SnmpAgent to get this change into effect.
setSnmpVersion in class BaseSnmpAgentsnmpVersion - the version number.restart - specifies whether the agent needs to be restarted
after setting the version.BaseSnmpAgent.getSnmpVersion(),
BaseSnmpAgent.setSnmpVersion(String snmpVersion)public void setSubAgent(java.lang.String[] props)
props - Properties of sub agent.getSubAgent()public java.lang.String[] getSubAgent()
setSubAgent(String[] props)public void serializeTable()
public void setTrapSourceDefault(boolean value)
value - The Default option flag, if true the Default option is taken.BaseSnmpAgent.isTrapSourceDefault()public void addRemoteV3Client(RemoteV3Client client)
client - The RemoteV3Client implementation.removeRemoteV3Client()public void removeRemoteV3Client()
addRemoteV3Client(RemoteV3Client client)public RemoteV3Client getRemoteV3Client()
addRemoteV3Client(RemoteV3Client client)public void addV3Initialiser(V3Initialiser v3Initialiser)
v3Initialiser - The V3Initialiser implemented by the user.getV3Initialiser()public V3Initialiser getV3Initialiser()
addV3Initialiser(V3Initialiser v3Initialiser)public void setVacmRemoteConfiguration(boolean value)
value - The flag of VACM RemoteConfiguration of the V3 Agent.isRemoteConfigurable()public boolean isRemoteConfigurable()
setVacmRemoteConfiguration(boolean value)public void setEngineBootsFileName(java.lang.String name)
name - The EngineBoots file Name with full path.getEngineBootsFileName()public java.lang.String getEngineBootsFileName()
setEngineBootsFileName(String name)public void setSnmpV3Compliance(boolean snmpV3Compliance)
snmpV3Compliance - The SNMP Version 3 compliance flagisSnmpV3Compliance()public boolean isSnmpV3Compliance()
setV3Compliancepublic void setViewBasedFlag(boolean vbac)
vbac - boolean to be set as viewBasedFlaggetViewBasedFlag()public boolean getViewBasedFlag()
setViewBasedFlag(boolean vbac)public boolean getV3Configuration()
setV3Configuration(boolean v3Config)public void setV3Configuration(boolean v3Config)
v3Config - boolean to be set as v3ConfigurationgetV3Configuration()
public void initializeAdaptorV3Settings(java.lang.String format,
boolean communityAndTargetSupport)
format - the Storage Type for the V3Tables(eg., "xml", "ser").communityAndTargetSupport - true to specify the Community, Target
and Notificaion Mib Support.public java.lang.String getV3AdaptorStorageMode()
public UsmUserTableRequestHandler getUsmUserTableListener()
public VacmAccessTableRequestHandler getVacmAccessTableListener()
public VacmContextTableRequestHandler getVacmContextTableListener()
public VacmSecurityToGroupTableRequestHandler getVacmSecurityToGroupTableListener()
public VacmViewTreeFamilyTableRequestHandler getVacmViewTreeFamilyTableListener()
public SnmpCommunityTableRequestHandler getSnmpCommunityTableListener()
public SnmpTargetAddrTableRequestHandler getSnmpTargetAddrTableListener()
public SnmpTargetAddrExtTableRequestHandler getSnmpTargetAddrExtTableListener()
public SnmpTargetParamsTableRequestHandler getSnmpTargetParamsTableListener()
public SnmpNotifyTableRequestHandler getSnmpNotifyTableListener()
public SnmpNotifyFilterTableRequestHandler getSnmpNotifyFilterTableListener()
public SnmpNotifyFilterProfileTableRequestHandler getSnmpNotifyFilterProfileTableListener()
public void readValuesFromConf(AgentParamOptions options,
java.lang.String dirPath)
options - The AgentparamOptions for this Agent.dirPath - the directory Location where the file exists.public void addActionHandler(com.adventnet.utilities.ui.event.ActionHandlerListener ahlistener)
ahlistener - ActionHandlerListener to be added with this class.public static void killSnmpAgent()
public void setAclTableInstance(AclTable table)
the - AclTable instance to be set.getAclTableInstance()public AclTable getAclTableInstance()
setAclTableInstance(AclTable table)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||