Class: Scriptroute::ICMPunreach
- Defined in:
- lib/scriptroute/packets.rb
Overview
also handles time exceeded messages for now (same format, different code )
Constant Summary
Constants inherited from ICMP
Scriptroute::ICMP::ICMP_ECHO, Scriptroute::ICMP::ICMP_ECHOREPLY, Scriptroute::ICMP::ICMP_MASKREPLY, Scriptroute::ICMP::ICMP_MASKREQ, Scriptroute::ICMP::ICMP_PARAMETERPROB, Scriptroute::ICMP::ICMP_TIMESTAMP, Scriptroute::ICMP::ICMP_TIMESTAMPREPLY, Scriptroute::ICMP::ICMP_TIMXCEED, Scriptroute::ICMP::ICMP_UNREACH, Scriptroute::ICMP::ICMP_UNREACH_FILTER_PROHIB, Scriptroute::ICMP::ICMP_UNREACH_HOST, Scriptroute::ICMP::ICMP_UNREACH_HOST_PRECEDENCE, Scriptroute::ICMP::ICMP_UNREACH_HOST_PROHIB, Scriptroute::ICMP::ICMP_UNREACH_HOST_UNKNOWN, Scriptroute::ICMP::ICMP_UNREACH_ISOLATED, Scriptroute::ICMP::ICMP_UNREACH_NEEDFRAG, Scriptroute::ICMP::ICMP_UNREACH_NET, Scriptroute::ICMP::ICMP_UNREACH_NET_PROHIB, Scriptroute::ICMP::ICMP_UNREACH_NET_UNKNOWN, Scriptroute::ICMP::ICMP_UNREACH_PORT, Scriptroute::ICMP::ICMP_UNREACH_PRECEDENCE_CUTOFF, Scriptroute::ICMP::ICMP_UNREACH_PROTOCOL, Scriptroute::ICMP::ICMP_UNREACH_SRCFAIL, Scriptroute::ICMP::ICMP_UNREACH_TOSHOST, Scriptroute::ICMP::ICMP_UNREACH_TOSNET
Constants inherited from IPv4
Scriptroute::IPv4::IPPROTO_ICMP, Scriptroute::IPv4::IPPROTO_TCP, Scriptroute::IPv4::IPPROTO_UDP
Instance Attribute Summary collapse
-
#contents ⇒ IPv4
readonly
The packet header embedded within the ICMP unreachable error message.
Attributes inherited from ICMP
#icmp_cksum, #icmp_code, #icmp_type, #ip_p, #ip_payload_len
Attributes inherited from IPv4
#ip_dst, #ip_hl, #ip_id, #ip_len, #ip_off, #ip_options, #ip_p, #ip_src, #ip_sum, #ip_tos, #ip_ttl, #ip_v
Instance Method Summary collapse
-
#initialize(string) ⇒ ICMPunreach
constructor
Can create an unreachable only from string contents, never from filling in fields given a size.
-
#marshal ⇒ void
Cannot marshal an unreachable packet for transmission; raises an exception.
-
#to_s ⇒ String
Formats the packet and the embedded packet as a string.
Methods inherited from IPv4
#add_option, #calculate_header_len, #calculate_packet_len, creator, #ip_payload_len, #ipv4_unmarshal
Constructor Details
#initialize(string) ⇒ ICMPunreach
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.
652 653 654 655 656 657 |
# File 'lib/scriptroute/packets.rb', line 652 def initialize(string) # first four are code, type, checksum. # second four are undefined @contents = IPv4.creator(string[8..-1]) super(string) end |
Instance Attribute Details
#contents ⇒ IPv4 (readonly)
Returns The packet header embedded within the ICMP unreachable error message.
645 646 647 |
# File 'lib/scriptroute/packets.rb', line 645 def contents @contents end |
Instance Method Details
#marshal ⇒ void
This method returns an undefined value.
Cannot marshal an unreachable packet for transmission; raises an exception.
660 661 662 |
# File 'lib/scriptroute/packets.rb', line 660 def marshal raise "not supported" end |
#to_s ⇒ String
Returns formats the packet and the embedded packet as a string.
664 665 666 |
# File 'lib/scriptroute/packets.rb', line 664 def to_s super + " ( " + @contents.to_s + " )" end |