Module: PacketFu::IPv6HeaderMixin

Included in:
ICMPv6Packet, IPv6Packet, TCPPacket, UDPPacket
Defined in:
lib/packetfu/protos/ipv6/mixin.rb

Overview

This Mixin simplifies access to the IPv6Headers. Mix this in with your packet interface, and it will add methods that essentially delegate to the ‘ipv6_header’ method (assuming that it is a IPv6Header object)

Instance Method Summary collapse

Instance Method Details

#ipv6?Boolean

Returns:

  • (Boolean)


31
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 31

def ipv6?; not self.ipv6_header.nil?; end

#ipv6_calc_lenObject



23
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 23

def ipv6_calc_len; self.ipv6_header.ipv6_calc_len; end

#ipv6_calc_sum_on_addr(cksum = 0) ⇒ Object

Add method to each packet class on IPv6 to ease checksum computation



34
35
36
37
38
39
40
41
42
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 34

def ipv6_calc_sum_on_addr(cksum=0)
  checksum = cksum
  [ipv6_src, ipv6_dst].each do |iaddr|
    8.times do |i|
      checksum += (iaddr >> (i * 16)) & 0xffff
    end
  end
  checksum
end

#ipv6_classObject



10
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 10

def ipv6_class; self.ipv6_header.ipv6_class; end

#ipv6_class=(v) ⇒ Object



9
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 9

def ipv6_class=(v); self.ipv6_header.ipv6_class= v; end

#ipv6_daddrObject



27
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 27

def ipv6_daddr; self.ipv6_header.ipv6_daddr; end

#ipv6_daddr=(v) ⇒ Object



28
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 28

def ipv6_daddr=(v); self.ipv6_header.ipv6_daddr= v; end

#ipv6_dstObject



22
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 22

def ipv6_dst; self.ipv6_header.ipv6_dst; end

#ipv6_dst=(v) ⇒ Object



21
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 21

def ipv6_dst=(v); self.ipv6_header.ipv6_dst= v; end

#ipv6_dst_readableObject



30
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 30

def ipv6_dst_readable; self.ipv6_header.ipv6_dst_readable; end

#ipv6_hopObject



18
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 18

def ipv6_hop; self.ipv6_header.ipv6_hop; end

#ipv6_hop=(v) ⇒ Object



17
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 17

def ipv6_hop=(v); self.ipv6_header.ipv6_hop= v; end

#ipv6_labelObject



12
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 12

def ipv6_label; self.ipv6_header.ipv6_label; end

#ipv6_label=(v) ⇒ Object



11
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 11

def ipv6_label=(v); self.ipv6_header.ipv6_label= v; end

#ipv6_lenObject



14
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 14

def ipv6_len; self.ipv6_header.ipv6_len; end

#ipv6_len=(v) ⇒ Object



13
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 13

def ipv6_len=(v); self.ipv6_header.ipv6_len= v; end

#ipv6_nextObject



16
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 16

def ipv6_next; self.ipv6_header.ipv6_next; end

#ipv6_next=(v) ⇒ Object



15
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 15

def ipv6_next=(v); self.ipv6_header.ipv6_next= v; end

#ipv6_recalc(*v) ⇒ Object



24
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 24

def ipv6_recalc(*v); self.ipv6_header.ipv6_recalc(*v); end

#ipv6_saddrObject



25
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 25

def ipv6_saddr; self.ipv6_header.ipv6_saddr; end

#ipv6_saddr=(v) ⇒ Object



26
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 26

def ipv6_saddr=(v); self.ipv6_header.ipv6_saddr= v; end

#ipv6_srcObject



20
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 20

def ipv6_src; self.ipv6_header.ipv6_src; end

#ipv6_src=(v) ⇒ Object



19
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 19

def ipv6_src=(v); self.ipv6_header.ipv6_src= v; end

#ipv6_src_readableObject



29
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 29

def ipv6_src_readable; self.ipv6_header.ipv6_src_readable; end

#ipv6_vObject



8
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 8

def ipv6_v; self.ipv6_header.ipv6_v; end

#ipv6_v=(v) ⇒ Object



7
# File 'lib/packetfu/protos/ipv6/mixin.rb', line 7

def ipv6_v=(v); self.ipv6_header.ipv6_v= v; end