Class: Fluent::Plugin::NetflowipfixInput::IP6Addr

Inherits:
BinData::Primitive
  • Object
show all
Defined in:
lib/fluent/plugin/netflowipfix_records.rb

Instance Method Summary collapse

Instance Method Details

#getObject



38
39
40
41
42
# File 'lib/fluent/plugin/netflowipfix_records.rb', line 38

def get
  IPAddr.new_ntoh((0..7).map { |i|
	  (self.storage >> (112 - 16 * i)) & 0xffff
	}.pack('n8')).to_s
end

#set(val) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/fluent/plugin/netflowipfix_records.rb', line 30

def set(val)
  ip = IPAddr.new(val)
  if ! ip.ipv6?
	raise ArgumentError, "invalid IPv6 address `#{val}'"
  end
  self.storage = ip.to_i
end