00001 /*************************************************************************** 00002 collector.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 COLLECTOR_H 00019 #define COLLECTOR_H 00020 00021 class Collector; 00022 00023 #include <cc++/socket.h> 00024 00025 #ifdef CCXX_NAMESPACES 00026 using namespace std; 00027 using namespace ost; 00028 #endif 00029 00030 #include <sys/stat.h> 00031 00032 #include "mconfig.h" 00033 #include "timestamp.h" 00034 #include "timeslot.h" 00035 #include "pdu.h" 00036 #include "webbroker.h" 00037 #include "peer.h" 00038 #include "detector.h" 00039 00043 typedef struct RemoteDetector { 00044 InetHostAddress local; 00045 InetHostAddress remote; 00046 uint16_t remport; 00047 string remid; 00048 } RemoteDetector; 00049 00055 class Collector { 00056 public: 00058 Collector(); 00060 virtual ~Collector(); 00062 void BindAndLoop(); 00068 void setConfiguration(MConfig &); 00070 virtual void setIfInfoFile(const char * _newVal); 00072 virtual const char * getIfInfoFile(); 00074 void setRemotePeer(const InetHostAddress&, const InetHostAddress&, const uint16_t&, const string&); 00076 RemoteDetector getRemotePeer(const InetHostAddress&); 00078 void makeSlots(uint32_t&, uint32_t&); 00080 TimeSlot *getProcTS() { return tsProc; } 00082 string getUID() const { return myuid; } 00083 00084 private: 00086 const char * ifinfofile; 00088 InetHostAddress router; 00090 InetHostAddress websrv; 00092 Mutex *mtx; 00094 uint32_t SlotPeriod; 00096 uint32_t slotcount; 00098 float increase; 00100 float percentage; 00102 char *incharge; 00104 char *execcmd; 00106 uint16_t port; 00108 uint16 peer_port; 00110 uint16 web_port; 00112 vector<RemoteDetector> RemotePeers; 00114 UDPSocket sock; 00116 TimeSlot *tsAdd, *tsProc, *tsPrev, *tsLast; 00118 PDU *datapacket; 00120 uint8_t buff[MAX_DATAGRAM_LEN]; 00122 uint32_t lostpackets; 00124 string myuid; 00126 uint16_t netflow; 00127 }; 00128 00129 #endif
1.2.18