|
SNMP Stack 4_12 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.co.westhawk.snmp.stack.TimeWindow
TimeWindow keeps the lookup tables for the engine Id information.
TimeWindow should be created only once. Only use the
getCurrent()
method to access any other method, i.e.
if (TimeWindow.getCurrent() == null) { TimeWindow timew = new TimeWindow(); } boolean known = TimeWindow.getCurrent().isSnmpEngineIdKnown(host, port);
This class contains 2 lookup tables. One that matches the hostname+port onto the SNMP engine ID. Another that matches the SNMP engine ID with the timeline details about this engine.
This class will also update the timeline details every second.
getCurrent()
Field Summary | |
static int |
MaxTimeDifference
The maximum number of seconds the engine time in the Pdu is allowed to differ from my estimated engine time. |
Constructor Summary | |
TimeWindow()
Constructor. |
Method Summary | |
static TimeWindow |
getCurrent()
Returns the current reference to this class. |
protected java.lang.String |
getKey(java.lang.String host,
int port)
Returns the key based on the specified hostname and port to the engine ID lookup table. |
java.lang.String |
getSnmpEngineId(java.lang.String host,
int port)
Returns the snmp engine ID. |
protected uk.co.westhawk.snmp.stack.TimeWindowNode |
getTimeLine(java.lang.String snmpEngineId)
Returns the timeline details of the snmp engine ID. |
boolean |
isEngineIdOK(java.lang.String host,
int port,
java.lang.String snmpEngineId)
Checks if the engine ID is OK. |
boolean |
isOutsideTimeWindow(java.lang.String snmpEngineId,
int bootsA,
int timeA)
Returns if the time details are outside the time window. |
boolean |
isSnmpEngineIdKnown(java.lang.String host,
int port)
Returns if the snmp engine ID is known. |
boolean |
isTimeLineKnown(java.lang.String snmpEngineId)
Returns if the timeline details of this snmp engine ID are known. |
void |
setSnmpEngineId(java.lang.String host,
int port,
java.lang.String snmpEngineId)
Sets the SNMP engine ID that belongs to the specified host and port. |
protected uk.co.westhawk.snmp.stack.TimeWindowNode |
setTimeLine(java.lang.String snmpEngineId,
uk.co.westhawk.snmp.stack.TimeWindowNode newNode)
Sets the timeline details of the snmp engine ID. |
boolean |
updateTimeWindow(java.lang.String snmpEngineId,
int bootsA,
int timeA,
boolean isAuthentic)
Tries to update the time window and returns if succeeded. |
protected void |
updateTimeWindows()
Updates the estimated engine time of all gathered time details. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MaxTimeDifference
Constructor Detail |
public TimeWindow()
Method Detail |
public static TimeWindow getCurrent()
getCurrent()
method to access any other method, i.e.
if (TimeWindow.getCurrent() == null) { TimeWindow timew = new TimeWindow(); } boolean known = TimeWindow.getCurrent().isSnmpEngineIdKnown(host, port);
public java.lang.String getSnmpEngineId(java.lang.String host, int port)
host
- The hostname of the engine IDport
- The port number of the engine IDisSnmpEngineIdKnown(String, int)
public boolean isSnmpEngineIdKnown(java.lang.String host, int port)
When the SNMP engine ID is known, this doesn't necessarily mean that the timeline details of this engine ID are known, since it takes a second discovery step to find out.
host
- The hostname of the engine IDport
- The port number of the engine IDpublic void setSnmpEngineId(java.lang.String host, int port, java.lang.String snmpEngineId)
host
- The hostname of the engine IDport
- The port number of the engine IDsnmpEngineId
- The engine IDpublic boolean isEngineIdOK(java.lang.String host, int port, java.lang.String snmpEngineId)
If there is already an engine ID for this host and port, the method returns true is they are the same and false if they differ. In the latter case the engine ID in the table is not updated.
host
- The hostname of the engine IDport
- The port number of the engine IDsnmpEngineId
- The engine IDsetSnmpEngineId(String, int, String)
public boolean isTimeLineKnown(java.lang.String snmpEngineId)
snmpEngineId
- The engine IDpublic boolean isOutsideTimeWindow(java.lang.String snmpEngineId, int bootsA, int timeA)
snmpEngineId
- The SNMP engine IDbootsA
- The SNMP engine bootstimeA
- The SNMP engine timeupdateTimeWindow(String, int, int, boolean)
public boolean updateTimeWindow(java.lang.String snmpEngineId, int bootsA, int timeA, boolean isAuthentic)
An update will only occur if the message was authentic and the bootsA and timeA meet the requirements. New data will be inserted if the (bootsA>0), irrespectively whether the message was authentic or not.
snmpEngineId
- The SNMP engine IDbootsA
- The SNMP engine bootstimeA
- The SNMP engine timeisOutsideTimeWindow(String, int, int)
protected void updateTimeWindows()
setTimeLine(String, TimeWindowNode)
,
getTimeLine(String)
protected java.lang.String getKey(java.lang.String host, int port)
host
- The hostnameport
- The portprotected uk.co.westhawk.snmp.stack.TimeWindowNode getTimeLine(java.lang.String snmpEngineId)
snmpEngineId
- The engine IDupdateTimeWindows()
protected uk.co.westhawk.snmp.stack.TimeWindowNode setTimeLine(java.lang.String snmpEngineId, uk.co.westhawk.snmp.stack.TimeWindowNode newNode)
snmpEngineId
- The engine IDnewNode
- The added time window node nodeupdateTimeWindows()
|
SNMP Stack 4_12 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |