Class: Scriptroute::ProbeResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/scriptroute.rb,
lib/scriptroute/packets.rb

Overview

A ProbeResponse is a pair of a probe and its response. Scriptroute is designed around the idea that a general purpose engine can recognize the response to any probe, and be in charge of doing so, so that measurement tools need not have the rights to look at every packet.

This design does limit somewhat, since probes that are capable of soliciting more than one response (e.g., via fragmentation) will not be managed properly.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#probeTimedPacket

Returns:



134
135
136
# File 'lib/scriptroute.rb', line 134

def probe
  @probe
end

#responseTimedPacket

Returns:



136
137
138
# File 'lib/scriptroute.rb', line 136

def response
  @response
end

Instance Method Details

#rttFloat?

Returns Provides the apparent round trip time of this probe-response pair, or nil if either time is missing.

Returns:

  • (Float, nil)

    Provides the apparent round trip time of this probe-response pair, or nil if either time is missing.



138
139
140
141
142
143
144
# File 'lib/scriptroute.rb', line 138

def rtt
  if response and probe and probe.time then
    response.time - probe.time
  else
    nil
  end
end

#to_sString

this method implemented in pure ruby regardless of interpreter state.

Returns:

  • (String)


792
793
794
# File 'lib/scriptroute/packets.rb', line 792

def to_s
  "%s @%5.6f -> %s +%5.6f" % [@probe, @probe.time, (@response or "<none>"), (rtt or "-1")]
end