Class: Scriptroute::ICMP6

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

Direct Known Subclasses

ICMP6echo, ICMP6unreach

Constant Summary collapse

ICMP6_ECHO =

type

128
ICMP6_ECHOREPLY =
129
ICMP6_DST_UNREACH =
1
ICMP6_PACKET_TOO_BIG =
2
ICMP6_TIME_EXCEEDED =
3
ICMP6_PARAM_PROB =
4
@@icmp6_creators =
Hash.new

Constants inherited from IPv6

Scriptroute::IPv6::IPPROTO_ICMP6

Constants inherited from IP

Scriptroute::IP::IPPROTO_TCP, Scriptroute::IP::IPPROTO_UDP

Instance Attribute Summary collapse

Attributes inherited from IPv6

#ip6_dst, #ip6_flow, #ip6_hlim, #ip6_src

Instance Method Summary collapse

Methods inherited from IPv6

creator, #ip_ttl=, #ipv6_unmarshal

Methods inherited from IP

creator, #to_bytes

Constructor Details

#initialize(type_or_str) ⇒ ICMP6

Returns a new instance of ICMP6.



116
117
118
119
120
121
122
123
124
125
# 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

Instance Attribute Details

#icmp_cksumObject (readonly)

Returns the value of attribute icmp_cksum.



97
98
99
# File 'lib/scriptroute/packets.rb', line 97

def icmp_cksum
  @icmp_cksum
end

#icmp_codeObject (readonly)

Returns the value of attribute icmp_code.



97
98
99
# File 'lib/scriptroute/packets.rb', line 97

def icmp_code
  @icmp_code
end

#icmp_typeObject (readonly)

Returns the value of attribute icmp_type.



97
98
99
# File 'lib/scriptroute/packets.rb', line 97

def icmp_type
  @icmp_type
end

#ip_payload_lenObject (readonly)

Returns the value of attribute ip_payload_len.



98
99
100
# File 'lib/scriptroute/packets.rb', line 98

def ip_payload_len
  @ip_payload_len
end

Instance Method Details

#to_sString

Returns:

  • (String)


134
135
136
# 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