SSF.OS.NetFlow.Util
Class NHIDemuxer

java.lang.Object
  |
  +--SSF.OS.NetFlow.Filter.FilterPlayer
        |
        +--SSF.OS.NetFlow.Util.NHIDemuxer
All Implemented Interfaces:
StreamInterface

public class NHIDemuxer
extends FilterPlayer

Given one flow data file, divide it into several files according to the nhi address prefixes of the hosts that dump the flow data. In this version, it just takes into account the fist 3 levels of nhi ID


Field Summary
 int level
           
protected  int numFileOpened
           
protected  int openFileMAX
           
 java.lang.String srcFileName
           
 
Fields inherited from class SSF.OS.NetFlow.Filter.FilterPlayer
filter, sourceDictionary, streamID, typeDictionary
 
Constructor Summary
NHIDemuxer(java.lang.String streamID)
           
NHIDemuxer(java.lang.String streamID, int nLevel)
           
 
Method Summary
protected  void addSource(java.lang.String spec)
          The method that will be called when a record of "source nhi" announcement is met in the inputStream.
protected  void addType(java.lang.String spec)
          The method that will be called when a record of "type" announcement is met in the inputStream.
 void disconnect()
          Signal that no more records are to be received (if reading) or sent (if writing).
static void errorUsage()
           
static java.lang.String getNhiPrefix(java.lang.String nhi, int level)
          Given the nhi address, return its first *level* prefix.
static void main(java.lang.String[] args)
          usage: java FilterPlayer <filter config> <flow data file> <stream name>
 int receive(int type_code, int source_code, double timestamp, byte[] buf, int offset, int length)
          operations after a record of netflow stream is met if the record is NOT a netflow record, this function should be overloaded.
 
Methods inherited from class SSF.OS.NetFlow.Filter.FilterPlayer
assignFilter, connectRead, connectWrite, getRecordSourceCode, getRecordSourceString, getRecordTypeCode, getRecordTypeString, isConnected, send, send
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

level

public int level

srcFileName

public java.lang.String srcFileName

openFileMAX

protected int openFileMAX

numFileOpened

protected int numFileOpened
Constructor Detail

NHIDemuxer

public NHIDemuxer(java.lang.String streamID)

NHIDemuxer

public NHIDemuxer(java.lang.String streamID,
                  int nLevel)
Method Detail

addType

protected void addType(java.lang.String spec)
                throws streamException
Description copied from class: FilterPlayer
The method that will be called when a record of "type" announcement is met in the inputStream.

Overrides:
addType in class FilterPlayer
Parameters:
spec - the string generated from the record.
streamException

addSource

protected void addSource(java.lang.String spec)
                  throws streamException
Description copied from class: FilterPlayer
The method that will be called when a record of "source nhi" announcement is met in the inputStream.

Overrides:
addSource in class FilterPlayer
Parameters:
spec - the string generated from the record.
streamException

receive

public int receive(int type_code,
                   int source_code,
                   double timestamp,
                   byte[] buf,
                   int offset,
                   int length)
Description copied from class: FilterPlayer
operations after a record of netflow stream is met if the record is NOT a netflow record, this function should be overloaded.

Specified by:
receive in interface StreamInterface
Overrides:
receive in class FilterPlayer

getNhiPrefix

public static java.lang.String getNhiPrefix(java.lang.String nhi,
                                            int level)
Given the nhi address, return its first *level* prefix. E.g. the first 2 level prefix of 3:2:5:2(0) is 3:2. If the level is too big, return the nhi address without the interface.


disconnect

public void disconnect()
Description copied from interface: StreamInterface
Signal that no more records are to be received (if reading) or sent (if writing). A stream may automatically disconnect under certain conditions.

Specified by:
disconnect in interface StreamInterface
Overrides:
disconnect in class FilterPlayer

main

public static void main(java.lang.String[] args)
Description copied from class: FilterPlayer
usage: java FilterPlayer <filter config> <flow data file> <stream name>


errorUsage

public static void errorUsage()