Class: Scriptroute::ICMP6unreach

Inherits:
ICMP6 show all
Defined in:
lib/scriptroute/packets.rb

Constant Summary

Constants inherited from ICMP6

Scriptroute::ICMP6::ICMP6_DST_UNREACH, Scriptroute::ICMP6::ICMP6_ECHO, Scriptroute::ICMP6::ICMP6_ECHOREPLY, Scriptroute::ICMP6::ICMP6_PACKET_TOO_BIG, Scriptroute::ICMP6::ICMP6_PARAM_PROB, Scriptroute::ICMP6::ICMP6_TIME_EXCEEDED

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 ICMP6

#icmp_cksum, #icmp_code, #icmp_type, #ip_payload_len

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(string) ⇒ ICMP6unreach

Can create an unreachable only from string contents, never from filling in fields given a size. param string [String] the contents of the received packet.



860
861
862
863
864
865
# File 'lib/scriptroute/packets.rb', line 860

def initialize(string) 
  # first four are code, type, checksum.
  # second four are undefined
  @contents = IPv6.creator(string[8..-1])
  super(string)
end

Instance Attribute Details

#contentsIPv4 (readonly)

Returns The packet header embedded within the ICMP unreachable error message.

Returns:

  • (IPv4)

    The packet header embedded within the ICMP unreachable error message.



853
854
855
# File 'lib/scriptroute/packets.rb', line 853

def contents
  @contents
end

Instance Method Details

#marshalvoid

This method returns an undefined value.

Cannot marshal an unreachable packet for transmission; raises an exception.



868
869
870
# File 'lib/scriptroute/packets.rb', line 868

def marshal
  raise "not supported"
end

#to_sString

Returns formats the packet and the embedded packet as a string.

Returns:

  • (String)

    formats the packet and the embedded packet as a string.



872
873
874
# File 'lib/scriptroute/packets.rb', line 872

def to_s
  super + " ( " + @contents.to_s + " )"
end