]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/capture/ether_freebsd/ether_cap.h
Move projects back into subfolder.
[stg.git] / projects / stargazer / plugins / capture / ether_freebsd / ether_cap.h
index 0a00cb045babf5bb7ca1324ffbe9ffada6dfde6d..07380bda4fe1cefbb6cfa922cdafda81f05d2025 100644 (file)
 * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
 */
 
-#ifndef ETHER_CAP_H
-#define ETHER_CAP_H
+#pragma once
 
-#include <pthread.h>
-
-#include <string>
-#include <vector>
-
-#include "stg/os_int.h"
 #include "stg/plugin.h"
 #include "stg/module_settings.h"
 #include "stg/logger.h"
 
-extern "C" PLUGIN * GetPlugin();
+#include <string>
+#include <vector>
+#include <cstdint>
+
+#include <pthread.h>
+#include <sys/poll.h>
 
 #define BUFF_LEN (128)
 
-class TRAFFCOUNTER;
+namespace STG
+{
+struct TraffCounter;
+}
 
 //-----------------------------------------------------------------------------
 struct BPF_DATA {
@@ -81,9 +82,8 @@ std::string      iface;
 //-----------------------------------------------------------------------------
 class BPF_CAP_SETTINGS {
 public:
-    virtual         ~BPF_CAP_SETTINGS() {}
     const std::string & GetStrError() const { return errorStr; }
-    int             ParseSettings(const MODULE_SETTINGS & s);
+    int             ParseSettings(const STG::ModuleSettings & s);
     std::string     GetIface(unsigned int num);
 
 private:
@@ -91,25 +91,24 @@ private:
     mutable std::string errorStr;
 };
 //-----------------------------------------------------------------------------
-class BPF_CAP : public PLUGIN {
+class BPF_CAP : public STG::Plugin {
 public:
                         BPF_CAP();
-    virtual             ~BPF_CAP() {}
 
-    void                SetTraffcounter(TRAFFCOUNTER * tc) { traffCnt = tc; }
+    void                SetTraffcounter(STG::TraffCounter * tc) override { traffCnt = tc; }
 
-    int                 Start();
-    int                 Stop();
-    int                 Reload() { return 0; }
-    bool                IsRunning() { return isRunning; }
+    int                 Start() override;
+    int                 Stop() override;
+    int                 Reload(const STG::ModuleSettings & /*ms*/) override { return 0; }
+    bool                IsRunning() override { return isRunning; }
 
-    void                SetSettings(const MODULE_SETTINGS & s) { settings = s; }
-    int                 ParseSettings();
+    void                SetSettings(const STG::ModuleSettings & s) override { settings = s; }
+    int                 ParseSettings() override;
 
-    const std::string & GetStrError() const { return errorStr; }
-    const std::string   GetVersion() const;
-    uint16_t            GetStartPosition() const { return 40; }
-    uint16_t            GetStopPosition() const { return 40; }
+    const std::string & GetStrError() const override { return errorStr; }
+    std::string         GetVersion() const override;
+    uint16_t            GetStartPosition() const override { return 40; }
+    uint16_t            GetStopPosition() const override { return 40; }
 
 private:
     BPF_CAP(const BPF_CAP & rvalue);
@@ -133,12 +132,9 @@ private:
     bool                  nonstop;
     bool                  isRunning;
     int                   capSock;
-    MODULE_SETTINGS       settings;
+    STG::ModuleSettings       settings;
 
-    TRAFFCOUNTER *        traffCnt;
+    STG::TraffCounter *        traffCnt;
 
-    PLUGIN_LOGGER         logger;
+    STG::PluginLogger         logger;
 };
-//-----------------------------------------------------------------------------
-
-#endif