|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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 |
_localAddr, _localPort, _state, _target, _thread, _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, UNINITIALIZED |
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,
int threadCount)
Constructs a trapd session |
|
SnmpTrapdSession(int port,
InetAddress laddr,
EDU.oswego.cs.dl.util.concurrent.PooledExecutor executor)
Constructs a trapd session |
Method Summary | |
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 |
SnmpDataType |
decode(byte[] bytes,
int length)
|
static int |
getEngineBoots()
|
byte[] |
getEngineID()
Returns the engine ID of this trap daemon. Note: only applies 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. |
SnmpDataType |
process(byte[] _bytes,
int _length,
InetAddress _address,
int _port,
PacketSender sender)
|
static void |
setEngineBoots(int boots)
Sets new engineBoots value |
void |
setEngineID(byte[] engineID)
Sets the engine ID of this trap daemon |
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.snmp.SnmpBaseSession |
addEngine, addEngine, lookupEngine, lookupEngine, lookupEngine, lookupUsmUser, receiveObject, removeEngine, removeEngine, removeEngine, removeEngine, removeUsmUser |
Methods inherited from class com.ireasoning.protocol.Session |
finalize, getRetries, getState, getStateString, getTarget, getTimeout, getTransportLayer, getTransportLayer, open, open, open, reopen, setRetries, setTarget, setTimeout, setTransportLayer, 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, int threadCount) throws SocketException
port
- the UDP port used for collecting trapsladdr
- local address to bindthreadCount
- max number of threads in the thread pool, which is used to process received traps.public 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.
userName
- user nameauthProtocol
- authentication protocol, one of {SnmpConst.MD5,
SnmpConst.SHA, SnmpConst.SHA224, SnmpConst.SHA256, SnmpConst.SHA384, SnmpConst.SHA512}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). If trap sender's engineID can be ignored, null value can be used.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.
userName
- user nameauthProtocol
- authentication protocol, one of {SnmpConst.MD5,
SnmpConst.SHA, SnmpConst.SHA224, SnmpConst.SHA256, SnmpConst.SHA384, SnmpConst.SHA512}authPassword
- authentication password. It will be used to generate localized authentication key.privProtocol
- privacy protocol. One of {SnmpConst.DES, SnmpConst.AES, SnmpConst.AES192, SnmpConst.AES256}. 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). If trap sender's engineID can be ignored, null value can be used.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.
userName
- user nameauthProtocol
- authentication protocol, one of {SnmpConst.MD5,
SnmpConst.SHA, SnmpConst.SHA224, SnmpConst.SHA256, SnmpConst.SHA384, SnmpConst.SHA512}privProtocol
- privacy protocol. One of {SnmpConst.DES, SnmpConst.AES, SnmpConst.AES192, SnmpConst.AES256}. Default value is SnmpConst.DESauthKey
- localized authentication keyprivKey
- localized privacy keyengineID
- engine ID of the authoritive snmp entity (trap sender). If trap sender's engineID can be ignored, null value can be used.protected static int getEngineTime()
public static int getEngineBoots()
public static void setEngineBoots(int boots)
public byte[] getEngineID()
public void setEngineID(byte[] engineID)
public void setReceiveBufferSize(int size)
public int getReceiveBufferSize()
public DatagramSocket getSocket()
public SnmpDataType decode(byte[] bytes, int length)
public SnmpDataType process(byte[] _bytes, int _length, InetAddress _address, int _port, PacketSender sender)
|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |