class Scriptroute::ICMPtstamp
Attributes
icmp_id[R]
@return [Fixnum]
icmp_otime[R]
icmp_rtime[R]
icmp_seq[RW]
@return [Fixnum]
icmp_ttime[R]
Public Class Methods
new(paylen_or_str = 0)
click to toggle source
Calls superclass method
Scriptroute::ICMP::new
# File lib/scriptroute/packets.rb, line 779 def initialize(paylen_or_str = 0) if(paylen_or_str.is_a?(Fixnum)) then if( paylen_or_str < 0) then raise "payload length must be >= 0" end @ip_payload_len = paylen_or_str + 4 + 16 @icmp_id = 666 @icmp_seq = 1 @icmp_otime = 0 # one of these three should probably be nonzero by the client, but I forget which. @icmp_rtime = 0 @icmp_ttime = 0 super(ICMP_TIMESTAMP) else # x is skip forward a character. @ip_payload_len = paylen_or_str.length - 20 @icmp_id, @icmp_seq, @icmp_otime, @icmp_rtime, @icmp_ttime = paylen_or_str.unpack("xxxxnnNNN") super(paylen_or_str) end end
Public Instance Methods
marshal()
click to toggle source
@return [String] The packet in string form
Calls superclass method
Scriptroute::ICMP#marshal
# File lib/scriptroute/packets.rb, line 797 def marshal array_of_elements = [ @icmp_id, @icmp_seq, @icmp_otime, @icmp_rtime, @icmp_ttime ] raise "an ICMP timestamp field #{array_of_elements.index(nil)} was unset" if array_of_elements.include?(nil) super + array_of_elements.pack("nnNNN") end