|
SNMP Stack 5_1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.co.westhawk.snmp.stack.TimeWindow
TimeWindow contains the lookup tables for the engine Id information.
TimeWindow should be created only once. Use the
getCurrent()
method to access any other method, i.e.
if (TimeWindow.getCurrent() == null) { TimeWindow timew = new TimeWindow(); } boolean known = TimeWindow.getCurrent().isSnmpEngineIdKnown(hostaddr, port);
This class contains two lookup tables. One that maps the host address+port onto the SNMP engine ID and one that keeps the SNMP engine ID with the timeline details about this engine.
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 hostaddr,
int port)
Returns the key to the engine ID lookup table, based on the specified host address and port. |
java.lang.String |
getSnmpEngineId(java.lang.String hostaddr,
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 hostaddr,
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 hostaddr,
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 hostaddr,
int port,
java.lang.String snmpEngineId)
Sets the SNMP engine ID that belongs to the specified hostaddr 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. |
java.lang.String |
toString()
Returns the string representation. |
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, wait, wait, wait |
Field Detail |
public static final int MaxTimeDifference
150
.
Constructor Detail |
public TimeWindow()
Method Detail |
public static TimeWindow getCurrent()
if (TimeWindow.getCurrent() == null) { TimeWindow timew = new TimeWindow(); } boolean known = TimeWindow.getCurrent().isSnmpEngineIdKnown(hostaddr, port);
public java.lang.String getSnmpEngineId(java.lang.String hostaddr, int port)
hostaddr
- The host address of the engine IDport
- The port number of the engine ID
isSnmpEngineIdKnown(String, int)
public boolean isSnmpEngineIdKnown(java.lang.String hostaddr, 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.
hostaddr
- The host address of the engine IDport
- The port number of the engine ID
public void setSnmpEngineId(java.lang.String hostaddr, int port, java.lang.String snmpEngineId)
hostaddr
- The host address of the engine IDport
- The port number of the engine IDsnmpEngineId
- The engine IDpublic boolean isEngineIdOK(java.lang.String hostaddr, int port, java.lang.String snmpEngineId)
If there is already an engine ID for this hostaddr and port, the method returns true if the specified engine ID is the same as the existing one, and false if they differ. In the latter case the engine ID in the table is not updated.
hostaddr
- The host address of the engine IDport
- The port number of the engine IDsnmpEngineId
- The engine ID
setSnmpEngineId(String, int, String)
public boolean isTimeLineKnown(java.lang.String snmpEngineId)
snmpEngineId
- The engine ID
public boolean isOutsideTimeWindow(java.lang.String snmpEngineId, int bootsA, int timeA)
snmpEngineId
- The SNMP engine IDbootsA
- The SNMP engine bootstimeA
- The SNMP engine time
updateTimeWindow(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 time
isOutsideTimeWindow(String, int, int)
protected void updateTimeWindows()
setTimeLine(String, TimeWindowNode)
,
getTimeLine(String)
protected java.lang.String getKey(java.lang.String hostaddr, int port)
hostaddr
- The host addressport
- The port
protected uk.co.westhawk.snmp.stack.TimeWindowNode getTimeLine(java.lang.String snmpEngineId)
snmpEngineId
- The engine ID
updateTimeWindows()
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 node
updateTimeWindows()
public java.lang.String toString()
toString
in class java.lang.Object
|
SNMP Stack 5_1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |