class Scriptroute::Tulip::ReordTrain
Attributes
destination[R]
intra_train[R]
train[R]
ttl[R]
type[R]
Public Class Methods
new(destination, intra_train, type, ttl)
click to toggle source
# File lib/scriptroute/tulip/reordering.rb, line 8 def initialize(destination, intra_train, type, ttl) @destination, @intra_train, @type, @ttl = destination, intra_train, type, ttl; #(dsts, numpackets, resolution, types, ttls, shuffle=false) @train = Train.new([@destination], 2, @intra_train, [@type], [@ttl]); end
Public Instance Methods
isFWro?()
click to toggle source
# File lib/scriptroute/tulip/reordering.rb, line 26 def isFWro? return false if (isLossy?); id1, id2 = [0,1].map { |v| @train.packets[0][v].response.packet.ip_id; } (id1 > id2)? true : false; end
isLossy?()
click to toggle source
# File lib/scriptroute/tulip/reordering.rb, line 16 def isLossy? return (@train.num_losses[0] > 0); end
isRTro?()
click to toggle source
# File lib/scriptroute/tulip/reordering.rb, line 20 def isRTro? return false if (isLossy?); rt1, rt2 = [0,1].map { |v| @train.packets[0][v].response.time; } (rt1 > rt2)? true : false; end
to_s()
click to toggle source
# File lib/scriptroute/tulip/reordering.rb, line 40 def to_s str = ""; str += "reordtrain %s %s %s %s\n" % [@destination, @ttl, @type, @intra_train]; @train.packets[0].each_index { |k| pr = @train.packets[0][k]; stime, sid = pr.probe.time.to_f * 1000, pr.probe.packet.ip_id; rtime = (pr.response) ? pr.response.time.to_f * 1000 : -1; sid = pr.probe.packet.ip_id; rid = (pr.response) ? pr.response.packet.ip_id : -1; src = (pr.response)? pr.response.packet.ip_src : -1; str += "#{src} %.3f +%.3fms %d %d" %[stime, rtime-stime, rid, sid]; str += "\n"; } return str; end
wasPcapped?()
click to toggle source
# File lib/scriptroute/tulip/reordering.rb, line 32 def wasPcapped? @train.packets[0].each_index { |k| pr = @train.packets[0][k]; return true if (!pr or !pr.probe or !pr.probe.time) } return false; end