|
|
This class implements a round trip time pinger.
RoundTripTimePinger (Socket* ping4socket, Socket* ping6socket, const card64 delay = 1000000) |
Constructor.
Parameters:
ping4socket | Socket for IPv4 pings. |
ping6socket | Socket for IPv6 pings. |
delay | Maximum delay between two pings in microseconds. |
~RoundTripTimePinger () |
Destructor.
inline bool ready () |
Check, if RoundTripTimePinger is ready.
Returns: true, if RoundTripTimePinger is ready; false otherwise.
inline cardinal getHosts () |
Get number of hosts in RoundTripTimePinger.
Returns: Number of hosts.
inline double getAlpha () |
Get constant alpha: RTT = alpha * oldValue + (1 - alpha) * newValue.
Returns: alpha.
inline void setAlpha (const double alpha) |
Set constant alpha: RTT = alpha * oldValue + (1 - alpha) * newValue.
Parameters:
alpha | Alpha. |
inline card64 getMaxPingDelay () |
Get maximum delay between two pings in microseconds.
Returns: Delay in microseconds.
inline void setMaxPingDelay (const card64 delay) |
Set maximum delay between two pings in microseconds.
Parameters:
delay | Delay in microseconds. |
cardinal getRoundTripTime (const InternetAddress& address, const card8 trafficClass = 0x00) |
Get round trip time for given host and traffic class.
Parameters:
trafficClass | Traffic class. |
Returns: Round trip time in microseconds; -1 for hosts not in list or unreachable.
bool addHost (const InternetAddress& address, const card8 trafficClass = 0x00) |
Add host to RoundTripTimePinger list.
Parameters:
address | Host address. |
trafficClass | Traffic class. |
Returns: true, if host has been added; false otherwise (duplicate).
void removeHost (const InternetAddress& address, const card8 trafficClass = 0x00) |
Remove host from RoundTripTimePinger list.
Parameters:
address | Host address. |
trafficClass | Traffic class. |
void activateLogger (ostream* scriptStream, ostream* dataStream, const char* dataName) |
Activate logger. Very important: Logging will be deactivated by addHost() and removeHost() calls!
Parameters:
scriptStream | Script output stream. |
dataStream | Data output stream. |
dataName | Data file name (for GNUplot's plot command). |
void deactivateLogger () |
Deactivate logger.
inline bool isLogging () |
Check, if logger is running.
void writeGPHeader (ostream& os, const char* dataName, const cardinal lineStyle = 1) |
Write GNUplot header. Very important: This header will become invalid when calling addHost() or removeHost()!
Parameters:
os | Output stream. |
dataName | Name of data file. |
lineStyle | First GNUplot line style or 0 for using GNUplot's defaults. |
void writeGPData (ostream& os) |
Write GNUplot data line.
Parameters:
os | Output stream. |
friend ostream& operator<< (ostream& os, RoundTripTimePinger& pinger) |
Friend output operator.
static const cardinal MaxRoundTripTime |
Maximum round trip time in microseconds.
static const double UnreachableFactor |
Unreachable Factor: Assume current round trip time to be diff = now - host.LastEchoTimeStamp, if diff > MinUnreachableAsumption (for OS delay) or diff > UnreachableFactor * MaxRawRoundTripTime (for real network delay).
static const card64 MinUnreachableAsumption |
MinUnreachableAsumption: Assume current round trip time to be diff = now - host.LastEchoTimeStamp, if diff > MinUnreachableAsumption (for OS delay) or diff > UnreachableFactor * MaxRawRoundTripTime (for real network delay).