class Scriptroute::ICMP6

Constants

ICMP6_DST_UNREACH
ICMP6_ECHO

type

ICMP6_ECHOREPLY
ICMP6_PACKET_TOO_BIG
ICMP6_PARAM_PROB
ICMP6_TIME_EXCEEDED

Attributes

icmp_cksum[R]
icmp_code[R]
icmp_type[R]
ip_payload_len[R]

Public Class Methods

new(type_or_str) click to toggle source
Calls superclass method Scriptroute::IPv6::new
# File lib/scriptroute/packets.rb, line 116
def initialize(type_or_str) 
  if(type_or_str.is_a?(Fixnum)) then
    @icmp_type = type_or_str
    @icmp_code = 0
    @icmp_cksum = 0
    super(IPPROTO_ICMP6) 
  else
    @icmp_type, @icmp_code, @icmp_cksum = type_or_str.unpack("CCn")
  end
end

Public Instance Methods

to_s() click to toggle source

@return [String]

Calls superclass method Scriptroute::IPv6#to_s
# File lib/scriptroute/packets.rb, line 134
def to_s
  super + ": ICMP6: type %d code %d cksum %d" %[ @icmp_type, @icmp_code, @icmp_cksum ]
end

Private Instance Methods

marshal() click to toggle source

@return [String] The packet in string form

Calls superclass method Scriptroute::IPv6#marshal
# File lib/scriptroute/packets.rb, line 127
def marshal
  @icmp_type or raise "type is nil"
  @icmp_code or raise "code is nil"
  @icmp_cksum = 0
  super + [ @icmp_type, @icmp_code, @icmp_cksum ].pack("CCn")
end