Module: PacketFu::IPHeaderMixin
- Included in:
- HSRPPacket, ICMPPacket, IPPacket, TCPPacket, UDPPacket
- Defined in:
- lib/packetfu/protos/ip/mixin.rb
Overview
This Mixin simplifies access to the IPHeaders. Mix this in with your packet interface, and it will add methods that essentially delegate to the ‘ip_header’ method (assuming that it is a IPHeader object)
Instance Method Summary collapse
- #ip_calc_id ⇒ Object
- #ip_calc_len ⇒ Object
- #ip_calc_sum ⇒ Object
-
#ip_calc_sum_on_addr(cksum = 0) ⇒ Object
Add method to each packet class on IP to ease checksum computation.
- #ip_daddr ⇒ Object
- #ip_daddr=(v) ⇒ Object
- #ip_dst ⇒ Object
- #ip_dst=(v) ⇒ Object
- #ip_dst_readable ⇒ Object
- #ip_frag ⇒ Object
- #ip_frag=(v) ⇒ Object
- #ip_hl ⇒ Object
- #ip_hl=(v) ⇒ Object
- #ip_hlen ⇒ Object
- #ip_id ⇒ Object
- #ip_id=(v) ⇒ Object
- #ip_id_readable ⇒ Object
- #ip_len ⇒ Object
- #ip_len=(v) ⇒ Object
- #ip_proto ⇒ Object
- #ip_proto=(v) ⇒ Object
- #ip_recalc(*args) ⇒ Object
- #ip_saddr ⇒ Object
- #ip_saddr=(v) ⇒ Object
- #ip_src ⇒ Object
- #ip_src=(v) ⇒ Object
- #ip_src_readable ⇒ Object
- #ip_sum ⇒ Object
- #ip_sum=(v) ⇒ Object
- #ip_sum_readable ⇒ Object
- #ip_tos ⇒ Object
- #ip_tos=(v) ⇒ Object
- #ip_ttl ⇒ Object
- #ip_ttl=(v) ⇒ Object
- #ip_v ⇒ Object
- #ip_v=(v) ⇒ Object
Instance Method Details
#ip_calc_id ⇒ Object
8 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 8 def ip_calc_id; self.ip_header.ip_calc_id ; end |
#ip_calc_len ⇒ Object
9 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 9 def ip_calc_len; self.ip_header.ip_calc_len ; end |
#ip_calc_sum ⇒ Object
10 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 10 def ip_calc_sum; self.ip_header.ip_calc_sum ; end |
#ip_calc_sum_on_addr(cksum = 0) ⇒ Object
Add method to each packet class on IP to ease checksum computation
45 46 47 48 49 50 51 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 45 def ip_calc_sum_on_addr(cksum=0) checksum = cksum checksum += (ip_src.to_i >> 16) checksum += (ip_src.to_i & 0xffff) checksum += (ip_dst.to_i >> 16) checksum += (ip_dst.to_i & 0xffff) end |
#ip_daddr ⇒ Object
11 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 11 def ip_daddr; self.ip_header.ip_daddr ; end |
#ip_daddr=(v) ⇒ Object
12 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 12 def ip_daddr=(v); self.ip_header.ip_daddr= v; end |
#ip_dst ⇒ Object
13 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 13 def ip_dst; self.ip_header.ip_dst ; end |
#ip_dst=(v) ⇒ Object
14 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 14 def ip_dst=(v); self.ip_header.ip_dst= v; end |
#ip_dst_readable ⇒ Object
15 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 15 def ip_dst_readable; self.ip_header.ip_dst_readable ; end |
#ip_frag ⇒ Object
16 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 16 def ip_frag; self.ip_header.ip_frag ; end |
#ip_frag=(v) ⇒ Object
17 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 17 def ip_frag=(v); self.ip_header.ip_frag= v; end |
#ip_hl ⇒ Object
18 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 18 def ip_hl; self.ip_header.ip_hl ; end |
#ip_hl=(v) ⇒ Object
19 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 19 def ip_hl=(v); self.ip_header.ip_hl= v; end |
#ip_hlen ⇒ Object
20 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 20 def ip_hlen; self.ip_header.ip_hlen ; end |
#ip_id ⇒ Object
21 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 21 def ip_id; self.ip_header.ip_id ; end |
#ip_id=(v) ⇒ Object
22 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 22 def ip_id=(v); self.ip_header.ip_id= v; end |
#ip_id_readable ⇒ Object
23 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 23 def ip_id_readable; self.ip_header.ip_id_readable ; end |
#ip_len ⇒ Object
24 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 24 def ip_len; self.ip_header.ip_len ; end |
#ip_len=(v) ⇒ Object
25 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 25 def ip_len=(v); self.ip_header.ip_len= v; end |
#ip_proto ⇒ Object
26 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 26 def ip_proto; self.ip_header.ip_proto ; end |
#ip_proto=(v) ⇒ Object
27 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 27 def ip_proto=(v); self.ip_header.ip_proto= v; end |
#ip_recalc(*args) ⇒ Object
28 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 28 def ip_recalc(*args); self.ip_header.ip_recalc(*args) ; end |
#ip_saddr ⇒ Object
29 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 29 def ip_saddr; self.ip_header.ip_saddr ; end |
#ip_saddr=(v) ⇒ Object
30 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 30 def ip_saddr=(v); self.ip_header.ip_saddr= v; end |
#ip_src ⇒ Object
31 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 31 def ip_src; self.ip_header.ip_src ; end |
#ip_src=(v) ⇒ Object
32 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 32 def ip_src=(v); self.ip_header.ip_src= v; end |
#ip_src_readable ⇒ Object
33 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 33 def ip_src_readable; self.ip_header.ip_src_readable ; end |
#ip_sum ⇒ Object
34 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 34 def ip_sum; self.ip_header.ip_sum ; end |
#ip_sum=(v) ⇒ Object
35 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 35 def ip_sum=(v); self.ip_header.ip_sum= v; end |
#ip_sum_readable ⇒ Object
36 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 36 def ip_sum_readable; self.ip_header.ip_sum_readable ; end |
#ip_tos ⇒ Object
37 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 37 def ip_tos; self.ip_header.ip_tos ; end |
#ip_tos=(v) ⇒ Object
38 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 38 def ip_tos=(v); self.ip_header.ip_tos= v; end |
#ip_ttl ⇒ Object
39 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 39 def ip_ttl; self.ip_header.ip_ttl ; end |
#ip_ttl=(v) ⇒ Object
40 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 40 def ip_ttl=(v); self.ip_header.ip_ttl= v; end |
#ip_v ⇒ Object
41 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 41 def ip_v; self.ip_header.ip_v ; end |
#ip_v=(v) ⇒ Object
42 |
# File 'lib/packetfu/protos/ip/mixin.rb', line 42 def ip_v=(v); self.ip_header.ip_v= v; end |