Class: Fluent::Plugin::NetflowipfixInput::IP4Addr

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

Instance Method Summary collapse

Instance Method Details

#getObject

set



20
21
22
# File 'lib/fluent/plugin/netflowipfix_records.rb', line 20

def get
	IPAddr.new_ntoh([self.storage].pack('N')).to_s
end

#set(val) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/fluent/plugin/netflowipfix_records.rb', line 12

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