00001 /*************************************************************************** 00002 flow.h 00003 ------------------- 00004 begin : Fri Feb 1 2002 00005 copyright : (C) 2002 by Constantinos A. Kotsokalis 00006 email : ckotso@grnet.gr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef FLOW_H 00019 #define FLOW_H 00020 00025 class Flow; 00026 00027 #include "common.h" 00028 #include "timestamp.h" 00029 00030 // A union of the possible flow body formats 00031 union FlowBody { 00032 V1Body v1; 00033 V5Body v5; 00034 V8BodyAS v8as; 00035 V8BodyPP v8pp; 00036 V8BodySP v8sp; 00037 V8BodyDP v8dp; 00038 V8BodyPR v8pr; 00039 V9Body v9; 00040 }; 00041 00042 // Represents a single flow of data as provided by NetFlow 00043 class Flow { 00044 private: 00045 // The flow body 00046 FlowBody flowbody; 00047 // Protocol version 00048 uint16_t version; 00049 // Input and output interface 00050 uint16_t input, output; 00051 // Destination address 00052 uint32_t dstaddr; 00053 // Aggregation type 00054 uint8_t aggtype; 00055 TimeStamp begin, end; 00056 00057 public: 00058 Flow(); 00059 virtual ~Flow(); 00060 // Set the flow data from a raw buffer 00061 void flSet(uint16_t&, uint32_t&, uint32_t&, uint32_t&, uint8_t *, uint8_t maggtype=0); 00062 // Return the input interface 00063 virtual const uint16_t getInput() {return input;} 00064 // Return the output interface 00065 virtual const uint16_t getOutput() {return output;} 00066 // Return the version number 00067 virtual const uint16_t getVersion() {return version;} 00068 // Return the destination address 00069 virtual const uint32_t getDstAddr() {return dstaddr;} 00070 // Return the number of packets thath this flow holds 00071 virtual const uint32_t getPackets(); 00072 // Return the number of octets that this flow holds 00073 virtual const uint32_t getOctets(); 00074 // Return the timestamp indicating when the flow started 00075 virtual const uint32_t getStartTime(); 00076 // Return the timestamp indicating when the flow ended 00077 virtual const uint32_t getEndTime(); 00078 virtual TimeStamp getUBegin() { return begin; } 00079 virtual TimeStamp getUEnd() { return end; } 00080 }; 00081 00082 #endif
1.2.18