|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ireasoning.protocol.ListenerManager
com.ireasoning.protocol.Session
com.ireasoning.protocol.snmp.SnmpBaseSession
com.ireasoning.protocol.snmp.SnmpTrapdSession
Trap receiver class, a daemon session collecting SNMPv1, v2 and v3 trap and SNMPv2/v3 inform messages.
For a class to process trap, it needs to register a Listener by calling
addListener
method.
Note:
Community name is not verified for each trap (SNMPv1/v2c). So even if commnity name is not
correct, it's still considered as a valid trap. However, this verification can be added in user's code
fairly easily.
Field Summary | |
protected static int |
_engineBoots
number of enginer boots |
Fields inherited from class com.ireasoning.protocol.Session |
_state, _target, _timeout, _transportLayer, _tries, DEFAULT_TIME_OUT, TCP, UDP |
Fields inherited from class com.ireasoning.protocol.ListenerManager |
_listeners |
Fields inherited from interface com.ireasoning.core.jmx.State |
STARTED, STARTING, STATES, STOPPED, STOPPING |
Constructor Summary | |
SnmpTrapdSession()
Constructs a trapd session, using the default port 162. |
|
SnmpTrapdSession(int port)
Constructs a trapd session. |
|
SnmpTrapdSession(int port,
InetAddress laddr)
Constructs a trapd session |
|
SnmpTrapdSession(int port,
InetAddress laddr,
EDU.oswego.cs.dl.util.concurrent.PooledExecutor executor)
Constructs a trapd session |
Method Summary | |
void |
addEngine(byte[] engineID)
Adds a new SnmpEngine |
void |
addEngine(SnmpEngine engine)
Adds a new SnmpEngine |
void |
addV3Params(String userName,
String authProtocol,
byte[] authKey,
int privProtocol,
byte[] privKey,
byte[] engineID)
Adds SNMPV3 trap receiver's properties if you know localized authentication and privacy keys. |
void |
addV3Params(String userName,
String authProtocol,
String authPassword,
int privProtocol,
String privPassword,
byte[] engineID)
Adds SNMPV3 trap receiver's properties. |
void |
addV3Params(String userName,
String authProtocol,
String authPassword,
String privPassword,
byte[] engineID)
Adds SNMPV3 trap receiver's properties. |
void |
close()
Closes session and stops waiting for traps |
byte[] |
getEngineID()
Returns the engine ID of this trap daemon. Note: only apply to SnmpV3 InformRequest |
protected static int |
getEngineTime()
snmpEngineTime, which is the number of seconds since the snmpEngineBoots counter was last incremented. |
int |
getReceiveBufferSize()
Returns the receiver's buffer size |
DatagramSocket |
getSocket()
Returns the DatagramPacket object used internally for receiving UDP packets. |
SnmpEngine |
lookupEngine(byte[] engineID)
Looks up SnmpEngine instance based on engineID |
SnmpEngine |
lookupEngine(String host,
int port)
Looks up SnmpEngine instance based on host name and port |
SnmpEngine |
lookupEngine(Target target)
Looks up SnmpEngine instance based on host name and port |
protected UsmUser |
lookupUsmUser(String userName,
byte[] engineID,
InetAddress address)
Looks up USM user based on passed user name and engineID. |
protected Object |
receiveObject()
Not applicable for this class |
SnmpEngine |
removeEngine(byte[] engineID)
Removes SnmpEngine from engine table |
SnmpEngine |
removeEngine(SnmpEngine engine)
Removes SnmpEngine from engine table |
SnmpEngine |
removeEngine(String host,
int port)
Removes SnmpEngine from engine table |
SnmpEngine |
removeEngine(Target target)
Removes SnmpEngine from engine table |
void |
removeUsmUser(String userName,
byte[] engineID)
Removes a UserUser instance from internal map. |
void |
setEngineID(byte[] engineID)
Sets the engine ID of this trap daemon Note: only apply to SnmpV3 InformRequest |
void |
setReceiveBufferSize(int size)
Sets the size of receiver's buffer. |
void |
waitForTrap()
Blocks and waits for SnmpV1 ,V2c, v3 trap or SNMPv2c/v3 InformRequest. |
Methods inherited from class com.ireasoning.protocol.Session |
finalize, getRetries, getState, getStateString, getTarget, getTimeout, getTransportLayer, open, open, reopen, setRetries, setTarget, setTimeout, setTransportLayer, startThread |
Methods inherited from class com.ireasoning.protocol.ListenerManager |
addListener, listenerExists, notifyListeners, notifyListeners, removeListener |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static int _engineBoots
Constructor Detail |
public SnmpTrapdSession() throws SocketException
public SnmpTrapdSession(int port) throws SocketException
port
- the UDP port used for collecting trapspublic SnmpTrapdSession(int port, InetAddress laddr) throws SocketException
port
- the UDP port used for collecting trapsladdr
- local address to bindpublic SnmpTrapdSession(int port, InetAddress laddr, EDU.oswego.cs.dl.util.concurrent.PooledExecutor executor) throws SocketException
port
- the UDP port used for collecting trapsladdr
- local address to bindMethod Detail |
public void waitForTrap()
public void close()
close
in class Session
public void addV3Params(String userName, String authProtocol, String authPassword, String privPassword, byte[] engineID)
Security level is determined by the passed authPassword and privPassword, if both of them are null or empty strings, security level is noAuthNoPriv. If privPassword is null or empty string, security level is authNoPriv. If both of them are non-empty strings, security level is authPriv.
Note: One of JVM's security property files, java.security, will be modified to add required security provider if it's not already installed.
userName
- user nameauthProtocol
- authentication protocol, one of {SnmpConst.MD5,
SnmpConst.SHA}authPassword
- authentication password. It will be used to generate localized authentication key.privPassword
- privacy protocol password. It will be used to generate localized privacy key.engineID
- engine ID of the authoritive snmp entity (trap sender)public void addV3Params(String userName, String authProtocol, String authPassword, int privProtocol, String privPassword, byte[] engineID)
Security level is determined by the passed authPassword and privPassword, if both of them are null or empty strings, security level is noAuthNoPriv. If privPassword is null or empty string, security level is authNoPriv. If both of them are non-empty strings, security level is authPriv.
Note: One of JVM's security property files, java.security, will be modified to add required security provider if it's not already installed.
userName
- user nameauthProtocol
- authentication protocol, one of {SnmpConst.MD5,
SnmpConst.SHA}authPassword
- authentication password. It will be used to generate localized authentication key.privProtocol
- privacy protocol, either SnmpConst.DES (DES algorithm) or SnmpConst.AES (128-bit AES algorithm). Default value is SnmpConst.DESprivPassword
- privacy protocol password. It will be used to generate localized privacy key.engineID
- engine ID of the authoritive snmp entity (trap sender)public void addV3Params(String userName, String authProtocol, byte[] authKey, int privProtocol, byte[] privKey, byte[] engineID)
Security level is determined by the passed authPassword and privPassword, if both of them are null or empty strings, security level is noAuthNoPriv. If privPassword is null or empty string, security level is authNoPriv. If both of them are non-empty strings, security level is authPriv.
Note: One of JVM's security property files, java.security, will be modified to add required security provider if it's not already installed.
userName
- user nameauthProtocol
- authentication protocol, one of {SnmpConst.MD5,
SnmpConst.SHA}privProtocol
- privacy protocol, either SnmpConst.DES (DES algorithm) or SnmpConst.AES (128-bit AES algorithm). Default value is SnmpConst.DESauthKey
- localized authentication keyprivKey
- localized privacy keyengineID
- engine ID of the authoritive snmp entity (trap sender)public byte[] getEngineID()
protected static int getEngineTime()
public void setEngineID(byte[] engineID)
public void setReceiveBufferSize(int size)
public int getReceiveBufferSize()
public DatagramSocket getSocket()
public SnmpEngine lookupEngine(String host, int port)
public SnmpEngine lookupEngine(Target target)
public SnmpEngine lookupEngine(byte[] engineID)
public void addEngine(SnmpEngine engine)
engine
- a instance of SnmpEngine to be addedpublic void addEngine(byte[] engineID)
engineID
- engine ID of the SnmpEngine to be addedpublic SnmpEngine removeEngine(byte[] engineID)
engineID
- the engine ID of the engine to be removed
public SnmpEngine removeEngine(Target target)
target
- the target object of the engine to be removed
public SnmpEngine removeEngine(String host, int port)
host
- the host name of the engine to be removedport
- the port number of the engine to be removed
public SnmpEngine removeEngine(SnmpEngine engine)
engine
- the engine to be removed
public void removeUsmUser(String userName, byte[] engineID)
protected UsmUser lookupUsmUser(String userName, byte[] engineID, InetAddress address)
userName
- USM user name contained in the PDUengineID
- SNMPv3 engine IDaddress
- sender's IP addressprotected Object receiveObject() throws IOException
receiveObject
in class Session
IOException
|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |