X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/a05654cf045d0e8ecc104b019145f627ad6ce4eb..f7ede97c7409f731705ae9771c712ebe900dc4ad:/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..3bdfd55e 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; @@ -59,10 +65,12 @@ public: int Start(); int Stop(); - int Reload() { return 0; } + int Reload(const MODULE_SETTINGS & /*ms*/) { 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;