class Scriptroute::ICMP
Constants
- ICMP_ECHO
- ICMP_ECHOREPLY
- ICMP_MASKREPLY
- ICMP_MASKREQ
- ICMP_PARAMETERPROB
- ICMP_TIMESTAMP
- ICMP_TIMESTAMPREPLY
- ICMP_TIMXCEED
- ICMP_UNREACH
- ICMP_UNREACH_FILTER_PROHIB
- ICMP_UNREACH_HOST
- ICMP_UNREACH_HOST_PRECEDENCE
- ICMP_UNREACH_HOST_PROHIB
- ICMP_UNREACH_HOST_UNKNOWN
- ICMP_UNREACH_ISOLATED
- ICMP_UNREACH_NEEDFRAG
- ICMP_UNREACH_NET
- ICMP_UNREACH_NET_PROHIB
- ICMP_UNREACH_NET_UNKNOWN
- ICMP_UNREACH_PORT
- ICMP_UNREACH_PRECEDENCE_CUTOFF
- ICMP_UNREACH_PROTOCOL
- ICMP_UNREACH_SRCFAIL
- ICMP_UNREACH_TOSHOST
- ICMP_UNREACH_TOSNET
Attributes
icmp_cksum[R]
icmp_code[R]
icmp_type[R]
ip_p[R]
ip_payload_len[R]
Public Class Methods
new(type_or_str)
click to toggle source
Calls superclass method
Scriptroute::IPv4::new
# File lib/scriptroute/packets.rb, line 679 def initialize(type_or_str) if(type_or_str.is_a?(Fixnum)) then @ip_p = IPPROTO_ICMP @icmp_type = type_or_str @icmp_code = 0 super(IPPROTO_ICMP) 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::IPv4#to_s
# File lib/scriptroute/packets.rb, line 698 def to_s super + ": ICMP: 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::IPv4#marshal
# File lib/scriptroute/packets.rb, line 691 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