class RoundTripTimePinger

Round Trip Time Pinger. More...

Full nameCoral::RoundTripTimePinger
Definition#include <roundtriptimepinger.h>
InheritsCoral::TimedThread
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Members


Detailed Description

This class implements a round trip time pinger.

 RoundTripTimePinger (Socket* ping4socket, Socket* ping6socket, const card64 delay = 1000000)

Constructor.

Parameters:
ping4socketSocket for IPv4 pings.
ping6socketSocket for IPv6 pings.
delayMaximum delay between two pings in microseconds.

RoundTripTimePinger ()

Destructor.

inline bool  ready ()

[const]

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:
alphaAlpha.

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:
delayDelay in microseconds.

cardinal  getRoundTripTime (const InternetAddress& address, const card8 trafficClass = 0x00)

Get round trip time for given host and traffic class.

Parameters:
trafficClassTraffic 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:
addressHost address.
trafficClassTraffic 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:
addressHost address.
trafficClassTraffic class.

void  activateLogger (ostream* scriptStream, ostream* dataStream, const char* dataName)

Activate logger. Very important: Logging will be deactivated by addHost() and removeHost() calls!

Parameters:
scriptStreamScript output stream.
dataStreamData output stream.
dataNameData file name (for GNUplot's plot command).

void  deactivateLogger ()

Deactivate logger.

inline bool  isLogging ()

[const]

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:
osOutput stream.
dataNameName of data file.
lineStyleFirst GNUplot line style or 0 for using GNUplot's defaults.

void  writeGPData (ostream& os)

Write GNUplot data line.

Parameters:
osOutput 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).