#include <pcap.h>
#include <pthread.h>
+#include <sys/select.h>
class USERS;
class TARIFFS;
struct DEV
{
+ DEV() : device("any"), filterExpression("ip"), handle(NULL), fd(-1) {}
+ DEV(const std::string & d) : device(d), filterExpression("ip"), handle(NULL), fd(-1) {}
+ DEV(const std::string & d, const std::string & f)
+ : device(d), filterExpression(f), handle(NULL), fd(-1) {}
+
std::string device;
std::string filterExpression;
pcap_t * handle;
int Reload() { return 0; }
bool IsRunning() { return isRunning; }
- int ParseSettings() { return 0; }
+ void SetSettings(const MODULE_SETTINGS & s) { settings = s; }
+ int ParseSettings();
+
const std::string & GetStrError() const { return errorStr; }
std::string GetVersion() const;
uint16_t GetStartPosition() const { return 40; }
PCAP_CAP(const PCAP_CAP & rvalue);
PCAP_CAP & operator=(const PCAP_CAP & rvalue);
+ void TryRead(const fd_set & set);
+ void TryReadDev(const DEV & dev);
+
static void * Run(void *);
mutable std::string errorStr;
pthread_t thread;
bool nonstop;
bool isRunning;
+ MODULE_SETTINGS settings;
DEV_MAP devices;
TRAFFCOUNTER * traffCnt;