Struct.new(:a1, :a2, :a3, :a4)
AddrIpv6 handles addressing for IPv6Header
Int32 :a1 Int32 :a2 Int32 :a3 Int32 :a4
Reads in a string and casts it as an IPv6 address
# File lib/packetfu/protos/ipv6/header.rb, line 38 def read(str) force_binary(str) return self if str.nil? self[:a1].read str[0,4] self[:a2].read str[4,4] self[:a3].read str[8,4] self[:a4].read str[12,4] self end
Reads in a colon-delimited hex string and casts it as an IPv6 address.
# File lib/packetfu/protos/ipv6/header.rb, line 49 def read_x(str) addr = IPAddr.new(str).to_i self[:a1]=Int32.new(addr >> 96) self[:a2]=Int32.new((addr & 0x00000000ffffffff0000000000000000) >> 64) self[:a3]=Int32.new((addr & 0x0000000000000000ffffffff00000000) >> 32) self[:a4]=Int32.new(addr & 0x000000000000000000000000ffffffff) self end
Returns the address as a fairly ginormous integer.
# File lib/packetfu/protos/ipv6/header.rb, line 28 def to_i (a1.to_i << 96) + (a2.to_i << 64) + (a3.to_i << 32) + a4.to_i end
Generated with the Darkfish Rdoc Generator 2.