class Scriptroute::ICMP6echo
Class for ping packets (echo and echo reply) much duplicated with ICMPecho
Attributes
icmp_id[R]
@return [Fixnum]
icmp_seq[RW]
@return [Fixnum]
Public Class Methods
new(paylen_or_str = 0)
click to toggle source
Calls superclass method
Scriptroute::ICMP6::new
# File lib/scriptroute/packets.rb, line 746 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 + 4 @icmp_id = 666 @icmp_seq = 1 super(ICMP6_ECHO) else # x is skip forward a character. @ip_payload_len = paylen_or_str.length - 8 @icmp_id, @icmp_seq = paylen_or_str.unpack("xxxxnn") 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::ICMP6#marshal
# File lib/scriptroute/packets.rb, line 761 def marshal super + [ @icmp_id, @icmp_seq ].pack("nn") + "\0" * ( @ip_payload_len - 4 - 4 ) end
to_s()
click to toggle source
@return [String]
Calls superclass method
Scriptroute::ICMP6#to_s
# File lib/scriptroute/packets.rb, line 765 def to_s super + ": ECHO6: id %d seq %d len %d" % [ @icmp_id, @icmp_seq, @ip_payload_len ] end