Class: Netflow

Inherits:
Object
  • Object
show all
Defined in:
lib/netflow/parsers/parsers.rb,
lib/netflow/storage/storage.rb

Class Method Summary collapse

Class Method Details

.parse_packet(data) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/netflow/parsers/parsers.rb', line 2

def self.parse_packet(data)
  begin
    header = Header.read(data)
    if header.version == 9
      flowset = Netflow9PDU.read(data)
    elsif header.version == 5
      flowset = Netflow5PDU.read(data)
    else
      raise "Unsupported Netflow version"
    end
  rescue
    raise "Error reading header."
  end
end