X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/a05654cf045d0e8ecc104b019145f627ad6ce4eb..d0fdbc23533fdf51ff2474fadc1fc504ecd4a1dc:/projects/stargazer/plugins/capture/pcap/pcap_cap.h?ds=inline diff --git a/projects/stargazer/plugins/capture/pcap/pcap_cap.h b/projects/stargazer/plugins/capture/pcap/pcap_cap.h index b39f736a..bf050c17 100644 --- a/projects/stargazer/plugins/capture/pcap/pcap_cap.h +++ b/projects/stargazer/plugins/capture/pcap/pcap_cap.h @@ -30,6 +30,7 @@ #include #include +#include class USERS; class TARIFFS; @@ -41,6 +42,11 @@ class TRAFFCOUNTER; 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; @@ -62,7 +68,9 @@ public: 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; } @@ -72,6 +80,9 @@ private: 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; @@ -79,6 +90,7 @@ private: pthread_t thread; bool nonstop; bool isRunning; + MODULE_SETTINGS settings; DEV_MAP devices; TRAFFCOUNTER * traffCnt;