Class: Scriptroute::TimedPacket

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

Overview

TimedPacket is a time, packet tuple, with a tsc value thrown in in case its useful

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time, tsc, packet) ⇒ TimedPacket

Returns a new instance of TimedPacket.

Parameters:

  • time (Float, nil)

    Seconds since the epoch, or nil if we didn’t see the packet leave due to pcap (happens)

  • tsc (Fixnum, nil)

    Value of the cycle counter (rdtsc) or nil if not supported

  • packet (IP)

    The packet received.

Raises:

  • (ArgumentError)


114
115
116
117
118
119
120
# File 'lib/scriptroute.rb', line 114

def initialize(time, tsc, packet)
  raise ArgumentError, "no packet" unless packet
  raise ArgumentError, "packet of the wrong class" unless packet.is_a?(IP)
  @time = time
  @tsc = tsc
  @packet = packet
end

Instance Attribute Details

#packetIP

Returns:



109
110
111
# File 'lib/scriptroute.rb', line 109

def packet
  @packet
end

#timeFloat?

Returns:

  • (Float, nil)


103
104
105
# File 'lib/scriptroute.rb', line 103

def time
  @time
end

#tscFixnum?

Returns The output of rdtsc can be a more useful value in calculating rtt when NTP’s adjustments via skew cause trouble.

Returns:

  • (Fixnum, nil)

    The output of rdtsc can be a more useful value in calculating rtt when NTP’s adjustments via skew cause trouble.



107
108
109
# File 'lib/scriptroute.rb', line 107

def tsc
  @tsc
end