com.adventnet.snmp.beans
Class AccessControlSnmpAgent

java.lang.Object
  extended by com.adventnet.snmp.snmp2.agent.Cache
      extended by com.adventnet.snmp.snmp2.agent.BaseSnmpStore
          extended by com.adventnet.snmp.snmp2.agent.BaseSnmpAgent
              extended by com.adventnet.snmp.snmp2.agent.SnmpAgent
                  extended by com.adventnet.snmp.beans.AccessControlSnmpAgent
All Implemented Interfaces:
PropertyRegistrationListener, TrapRequestListener, SnmpClient, AgentEventListener, java.io.Serializable

public class AccessControlSnmpAgent
extends SnmpAgent
implements TrapRequestListener

AccessControlSnmpAgent uses Access Control List to control access This is a target component for SnmpPduRequestEvents and a listener for TrapRequestEvents

Parses a Access Control File and authenticates requests from managers on the basis of this

Uses the trap information in the access control files for triggerring traps to managers specified in the same file by using the SnmpTrapService component

Note all instances of SnmpAgent share the same session and hence only a single agent could be running in a JVM.

See Also:
com.adventnet.snmp.snmp2.SnmpAgent, com.adventnet.snmp.snmp2.SnmpTrapService, Serialized Form

Field Summary
(package private)  java.lang.String aclFile
           
(package private)  boolean aclFlag
           
(package private)  ACLParser parser
           
(package private)  java.util.Vector readCommunities
          The community policies Vector of read AccessPolicy
(package private)  SnmpTrapService trapService
           
(package private)  java.util.Vector trapVector
          The Trap policies Vector of TrapPolicy
(package private)  java.util.Vector writeCommunities
          The community policies Vector of read-write AccessPolicy
 
Fields inherited from class com.adventnet.snmp.snmp2.agent.SnmpAgent
actionHandlerListener, homeDirectory, remoteV3Client
 
Fields inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpAgent
AgentScheduler, api, decoder, ENABLE_SNMP_AUTHEN_TRAPS, pduRequestHdlr, port, schedulerHash, snmpLog, snmpVersion, started, startTime, statusListener, TRANSPORT_PROVIDER, trapListener, utilities, versionInInt
 
Fields inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpStore
debugLevel, localAddress, protocol, session
 
Constructor Summary
AccessControlSnmpAgent()
          The default no arg constructor
AccessControlSnmpAgent(java.lang.String aclFile)
          This constructor loads the specified acl file
 
Method Summary
 void addTrapRequest(TrapRequestEvent te)
          This is the listener method for TrapRequestEvents Source beans would call this method when they need to issue Traps
 boolean authenticate(SnmpPDU pdu, java.lang.String community)
          The authenticate implementation of SnmpClient interface If there are no AcessPolicies loaded calls the Supers authenticate
protected  boolean authenticate(SnmpPDU pdu, java.util.Vector comm)
          This method authenticates using Vector of AccessPolicy implementations
 java.lang.String getAclFile()
          Getter for the acl File
 java.lang.String getEnterpriseOID()
          Getter for enterpriseOID
 int getTrapIndex()
          Getter for trapIndex
 SnmpTrapService getTrapService()
          Getter for SnmpTrapService associated with this agent
 int getVersion()
          Getter for the version of the Trap to be sent
 void sendTrap(TrapPolicy policy, java.util.Vector varbinds, long timeticks)
          This uses the Trap Policy in the param to send a Trap
 boolean sendTrap(java.util.Vector varbinds, long timeticks)
          Use this method to send traps using details from ACL files
 void setAclFile(java.lang.String file)
          set the acl file to the files existing
 void setEnterpriseOID(java.lang.String oid)
          Setter for trapIndex
 void setTrapIndex(int trapIndex)
          Setter for trapIndex
 void setVersion(int version)
          Setter for the version of the Trap to be sent
(package private)  void updateParms(ACLParser parser)
           
 
Methods inherited from class com.adventnet.snmp.snmp2.agent.SnmpAgent
addActionHandler, addRemoteV3Client, addV3Initialiser, callback, decodePdu, enableUsmSpinLock, getAclTableInstance, getEngineBootsFileName, getRemoteV3Client, getSerializeFileName, getSnmpCommunityTableListener, getSnmpNotifyFilterProfileTableListener, getSnmpNotifyFilterTableListener, getSnmpNotifyTableListener, getSnmpTargetAddrExtTableListener, getSnmpTargetAddrTableListener, getSnmpTargetParamsTableListener, getSnmpVacm, getSpinLock, getSubAgent, getUsmUserTableListener, getV3AdaptorStorageMode, getV3Configuration, getV3Initialiser, getVacmAccessTableListener, getVacmContextTableListener, getVacmSecurityToGroupTableListener, getVacmViewTreeFamilyTableListener, getViewBasedFlag, getWindowsSubAgent, initializeAdaptorV3Settings, isRemoteConfigurable, isSnmpV3Compliance, isStrictlyV3, isUsmSpinLockEnabled, killSnmpAgent, nativeInit, nativeStdOutErr, readValuesFromConf, removeRemoteV3Client, restartSnmpAgent, send, serializeTable, setAclTableInstance, setDebug, setDebugOff, setDebugOn, setEngineBootsFileName, setSerializeFileName, setSnmpV3Compliance, setSnmpVersion, setSpinLock, setStrictlyV3, setSubAgent, setTrapSourceDefault, setV3Configuration, setVacmRemoteConfiguration, setViewBasedFlag, setWarmStart, setWindowsSubAgent, stopSnmpAgent
 
Methods inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpAgent
addAccessListener, addAuthenticationListener, addClientAndOpenSession, addRegistrationListener, addSnmpPduRequestListener, addSnmpSetGroupListener, addSysORTableListener, addSystemGroupListener, addTrapRequestListener, authenticateReceivedCommunity, checkVersion, createProtocolOptions, createStatusEvent, debugPrint, disableAuthTraps, disableStartUpTrap, genPort, getAccessListener, getAsyncMode, getCommunityVector, getDebugLevel, getLocalAddress, getMaxThreads, getPort, getReadCommunities, getReadCommunity, getSnmpGroup, getSnmpVersion, getSystemGroupListener, getUpTime, getV1v2AccessControl, getV1v2AccessControlTable, getWriteCommunities, getWriteCommunity, handleInformRequest, incrementSnmpOutTraps, isCallbackThread, isStarted, isTrapSourceDefault, removeAuthenticationListener, removeSnmpClient, removeSnmpPduRequestListener, removeSysORTableListener, restartSnmpAgent, scheduleAndProcessRequestEvent, sendAuthenticationFailureTrap, sendGenericTrap, setAgentScheduler, setAsyncMode, setCallbackThread, setCommunityVector, setDebugLevel, setDefaultTrap, setEnableAuthenTraps, setLocalAddress, setMaxThreads, setPort, setPort, setProtocol, setReadCommunities, setReadCommunity, setSnmpVersion, setStarted, setV1v2AccessControl, setV1v2AccessControlTable, setWriteCommunities, setWriteCommunity
 
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

aclFlag

boolean aclFlag

trapService

SnmpTrapService trapService

aclFile

java.lang.String aclFile

parser

ACLParser parser

readCommunities

java.util.Vector readCommunities
The community policies Vector of read AccessPolicy


writeCommunities

java.util.Vector writeCommunities
The community policies Vector of read-write AccessPolicy


trapVector

java.util.Vector trapVector
The Trap policies Vector of TrapPolicy

Constructor Detail

AccessControlSnmpAgent

public AccessControlSnmpAgent()
The default no arg constructor


AccessControlSnmpAgent

public AccessControlSnmpAgent(java.lang.String aclFile)
                       throws java.io.FileNotFoundException,
                              ParseException
This constructor loads the specified acl file

Throws:
java.io.FileNotFoundException
ParseException
Method Detail

getTrapService

public SnmpTrapService getTrapService()
Getter for SnmpTrapService associated with this agent

Returns:
the TRAP service in this agent

setAclFile

public void setAclFile(java.lang.String file)
set the acl file to the files existing


updateParms

void updateParms(ACLParser parser)

setTrapIndex

public void setTrapIndex(int trapIndex)
Setter for trapIndex


getTrapIndex

public int getTrapIndex()
Getter for trapIndex


setEnterpriseOID

public void setEnterpriseOID(java.lang.String oid)
Setter for trapIndex


getEnterpriseOID

public java.lang.String getEnterpriseOID()
Getter for enterpriseOID


setVersion

public void setVersion(int version)
Setter for the version of the Trap to be sent


getVersion

public int getVersion()
Getter for the version of the Trap to be sent


getAclFile

public java.lang.String getAclFile()
Getter for the acl File


addTrapRequest

public void addTrapRequest(TrapRequestEvent te)
This is the listener method for TrapRequestEvents Source beans would call this method when they need to issue Traps

Specified by:
addTrapRequest in interface TrapRequestListener
Parameters:
te - The trap event.

sendTrap

public boolean sendTrap(java.util.Vector varbinds,
                        long timeticks)
Use this method to send traps using details from ACL files

Parameters:
varbinds - to be sent
timeticks - value
Returns:
true if a trap Policy has been dound successfully
See Also:
, setTrapIndex

sendTrap

public void sendTrap(TrapPolicy policy,
                     java.util.Vector varbinds,
                     long timeticks)
This uses the Trap Policy in the param to send a Trap

Parameters:
the - TrapPolicy which is used for verification and host details
Vector - of varbinds which need to be sent
timeticks - or sysUpTime in milliseconds
See Also:
TrapPolicy

authenticate

public boolean authenticate(SnmpPDU pdu,
                            java.lang.String community)
The authenticate implementation of SnmpClient interface If there are no AcessPolicies loaded calls the Supers authenticate

Specified by:
authenticate in interface SnmpClient
Overrides:
authenticate in class SnmpAgent
Parameters:
pdu - the Snmp PDU.
community - the value of the community.
Returns:
false if the PDU doesnt satisfy authentication mechanism
See Also:
SnmpClient

authenticate

protected boolean authenticate(SnmpPDU pdu,
                               java.util.Vector comm)
This method authenticates using Vector of AccessPolicy implementations

Parameters:
the - Pdu Received
Vector - of AccessPolicy to validate against