Class: Scriptroute::ICMP
- Defined in:
- lib/scriptroute/packets.rb,
lib/scriptroute/packets.rb
Direct Known Subclasses
ICMPecho, ICMPmaskreq, ICMPparamter_problem, ICMPtstamp, ICMPunreach
Constant Summary collapse
- ICMP_ECHO =
8
- ICMP_ECHOREPLY =
0
- ICMP_UNREACH =
3
- ICMP_TIMXCEED =
11
- ICMP_TIMESTAMP =
13
- ICMP_TIMESTAMPREPLY =
14
- ICMP_MASKREQ =
/* address mask request */
17
- ICMP_MASKREPLY =
/* address mask reply */
18
- ICMP_PARAMETERPROB =
12
- ICMP_UNREACH_NET =
/* bad net */
0
- ICMP_UNREACH_HOST =
/* bad host */
1
- ICMP_UNREACH_PROTOCOL =
/* bad protocol */
2
- ICMP_UNREACH_PORT =
/* bad port */
3
- ICMP_UNREACH_NEEDFRAG =
/* IP_DF caused drop */
4
- ICMP_UNREACH_SRCFAIL =
/* src route failed */
5
- ICMP_UNREACH_NET_UNKNOWN =
/* unknown net */
6
- ICMP_UNREACH_HOST_UNKNOWN =
/* unknown host */
7
- ICMP_UNREACH_ISOLATED =
/* src host isolated */
8
- ICMP_UNREACH_NET_PROHIB =
/* net denied */
9
- ICMP_UNREACH_HOST_PROHIB =
/* host denied */
10
- ICMP_UNREACH_TOSNET =
/* bad tos for net */
11
- ICMP_UNREACH_TOSHOST =
/* bad tos for host */
12
- ICMP_UNREACH_FILTER_PROHIB =
/* admin prohib */
13
- ICMP_UNREACH_HOST_PRECEDENCE =
/* host prec vio. */
14
- ICMP_UNREACH_PRECEDENCE_CUTOFF =
/* prec cutoff */
15
- @@icmp_creators =
Hash.new
Constants inherited from IPv4
Scriptroute::IPv4::IPPROTO_ICMP
Constants inherited from IP
Scriptroute::IP::IPPROTO_TCP, Scriptroute::IP::IPPROTO_UDP
Instance Attribute Summary collapse
-
#icmp_cksum ⇒ Object
readonly
Returns the value of attribute icmp_cksum.
-
#icmp_code ⇒ Object
readonly
Returns the value of attribute icmp_code.
-
#icmp_type ⇒ Object
readonly
Returns the value of attribute icmp_type.
-
#ip_p ⇒ Object
readonly
Returns the value of attribute ip_p.
-
#ip_payload_len ⇒ Object
readonly
Returns the value of attribute ip_payload_len.
Attributes inherited from IPv4
#ip_dst, #ip_hl, #ip_id, #ip_len, #ip_off, #ip_options, #ip_src, #ip_sum, #ip_tos, #ip_ttl, #ip_v
Instance Method Summary collapse
-
#initialize(type_or_str) ⇒ ICMP
constructor
A new instance of ICMP.
- #to_s ⇒ String
Methods inherited from IPv4
#add_option, #calculate_header_len, #calculate_packet_len, creator, #ipv4_unmarshal
Methods inherited from IP
Constructor Details
#initialize(type_or_str) ⇒ ICMP
Returns a new instance of ICMP.
679 680 681 682 683 684 685 686 687 688 |
# 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 |
Instance Attribute Details
#icmp_cksum ⇒ Object (readonly)
Returns the value of attribute icmp_cksum.
666 667 668 |
# File 'lib/scriptroute/packets.rb', line 666 def icmp_cksum @icmp_cksum end |
#icmp_code ⇒ Object (readonly)
Returns the value of attribute icmp_code.
666 667 668 |
# File 'lib/scriptroute/packets.rb', line 666 def icmp_code @icmp_code end |
#icmp_type ⇒ Object (readonly)
Returns the value of attribute icmp_type.
666 667 668 |
# File 'lib/scriptroute/packets.rb', line 666 def icmp_type @icmp_type end |
#ip_p ⇒ Object (readonly)
Returns the value of attribute ip_p.
667 668 669 |
# File 'lib/scriptroute/packets.rb', line 667 def ip_p @ip_p end |
#ip_payload_len ⇒ Object (readonly)
Returns the value of attribute ip_payload_len.
667 668 669 |
# File 'lib/scriptroute/packets.rb', line 667 def ip_payload_len @ip_payload_len end |
Instance Method Details
#to_s ⇒ String
698 699 700 |
# 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 |