]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/capture/ether_freebsd/ether_cap.h
Ticket 37. TIMEZONE fixed to TIMESTAMP for change_policy_timeout in
[stg.git] / projects / stargazer / plugins / capture / ether_freebsd / ether_cap.h
index 7097c28009a1dca621e5e00adc40d9fdc1efd434..b9150b8d231281b686017e761399b6ce56e9580c 100644 (file)
 #include <string>
 #include <vector>
 
-#ifdef FREE_BSD5
-#include <inttypes.h>
-#endif
-
-#ifdef FREE_BSD
-#include <sys/inttypes.h>
-#endif
-
-#include "plugin.h"
-#include "module_settings.h"
-#include "../../../traffcounter.h"
-
-extern "C" PLUGIN * GetPlugin();
+#include "stg/os_int.h"
+#include "stg/plugin.h"
+#include "stg/module_settings.h"
+#include "stg/logger.h"
 
 #define BUFF_LEN (128)
 
+class TRAFFCOUNTER;
+
 //-----------------------------------------------------------------------------
 struct BPF_DATA {
     BPF_DATA()
@@ -74,14 +67,14 @@ struct BPF_DATA {
         iface = bd.iface;
         };
 
-int             fd;
-uint8_t *       p;
-int             r;
-int             sum;
-uint8_t         buffer[BUFF_LEN];
+int              fd;
+uint8_t *        p;
+int              r;
+int              sum;
+uint8_t          buffer[BUFF_LEN];
 struct bpf_hdr * bh;
-int             canRead;
-std::string     iface;
+int              canRead;
+std::string      iface;
 };
 //-----------------------------------------------------------------------------
 class BPF_CAP_SETTINGS {
@@ -101,27 +94,25 @@ public:
                         BPF_CAP();
     virtual             ~BPF_CAP() {}
 
-    void                SetUsers(USERS *) {}
-    void                SetTariffs(TARIFFS *) {}
-    void                SetAdmins(ADMINS *) {}
-    void                SetTraffcounter(TRAFFCOUNTER * tc);
-    void                SetStore(STORE *) {}
-    void                SetStgSettings(const SETTINGS *) {}
+    void                SetTraffcounter(TRAFFCOUNTER * tc) { traffCnt = tc; }
 
     int                 Start();
     int                 Stop();
-    int                 Reload() { return 0; }
-    bool                IsRunning();
+    int                 Reload(const MODULE_SETTINGS & /*ms*/) { return 0; }
+    bool                IsRunning() { return isRunning; }
 
-    void                SetSettings(const MODULE_SETTINGS & s);
+    void                SetSettings(const MODULE_SETTINGS & s) { settings = s; }
     int                 ParseSettings();
 
-    const std::string & GetStrError() const;
-    const std::string   GetVersion() const;
-    uint16_t            GetStartPosition() const;
-    uint16_t            GetStopPosition() const;
+    const std::string & GetStrError() const { return errorStr; }
+    std::string         GetVersion() const;
+    uint16_t            GetStartPosition() const { return 40; }
+    uint16_t            GetStopPosition() const { return 40; }
 
 private:
+    BPF_CAP(const BPF_CAP & rvalue);
+    BPF_CAP & operator=(const BPF_CAP & rvalue);
+
     static void *       Run(void *);
     int                 BPFCapOpen();
     int                 BPFCapOpen(BPF_DATA * bd);
@@ -143,6 +134,8 @@ private:
     MODULE_SETTINGS       settings;
 
     TRAFFCOUNTER *        traffCnt;
+
+    PLUGIN_LOGGER         logger;
 };
 //-----------------------------------------------------------------------------