Class: Scriptroute::ProbeResponse
- Inherits:
-
Object
- Object
- Scriptroute::ProbeResponse
- 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
-
#rtt ⇒ Float?
Provides the apparent round trip time of this probe-response pair, or nil if either time is missing.
-
#to_s ⇒ String
this method implemented in pure ruby regardless of interpreter state.
Instance Attribute Details
#response ⇒ TimedPacket
136 137 138 |
# File 'lib/scriptroute.rb', line 136 def response @response end |
Instance Method Details
#rtt ⇒ Float?
Returns 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_s ⇒ String
this method implemented in pure ruby regardless of interpreter state.
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 |
# File 'lib/scriptroute/packets.rb', line 1001 def to_s if @probe then if(@probe.time) then "%s @%5.6f -> %s +%5.6f" % [@probe.packet, @probe.time, (@response ? @response.packet : "<none>"), (rtt or "-1")] else "%s (not seen leaving) -> %s" % [@probe.packet, (@response or "<none>")] end else "bizarre nothingness. no probe." end end |