]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/capture/cap_debug/debug_cap.cpp
Lots of stylistic fixes.
[stg.git] / projects / stargazer / plugins / capture / cap_debug / debug_cap.cpp
index 799e399d39c9884541f37a6e9109b386b3671923..480ef202ba63deb67b13c23afc6e47705aa13ef1 100644 (file)
@@ -37,9 +37,10 @@ $Author: faust $
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#include "debug_cap.h"
-#include "../../../traffcounter.h"
 #include "libpal.h"
 #include "libpal.h"
+#include "stg/plugin_creator.h"
+#include "stg/traffcounter.h"
+#include "debug_cap.h"
 
 //-----------------------------------------------------------------------------
 void WriteStat(uint32_t u, uint32_t d)
 
 //-----------------------------------------------------------------------------
 void WriteStat(uint32_t u, uint32_t d)
@@ -53,49 +54,34 @@ fprintf(f, "up %5.2f Mbit, down %5.2f Mbit, sum %5.2f Mbit\n",
 fclose(f);
 }
 //-----------------------------------------------------------------------------
 fclose(f);
 }
 //-----------------------------------------------------------------------------
-
-class CAP_DEBUG_CREATOR
-{
-private:
-    DEBUG_CAP * dc;
-
-public:
-    CAP_DEBUG_CREATOR()
-        : dc(new DEBUG_CAP())
-        {
-        };
-    ~CAP_DEBUG_CREATOR()
-        {
-        delete dc;
-        };
-
-    DEBUG_CAP * GetCapturer()
-    {
-        return dc;
-    };
-};
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-RAW_PACKET MakeTCPPacket(const char * src,
-                         const char * dst,
-                         uint16_t sport,
-                         uint16_t dport,
-                         uint16_t len);
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-CAP_DEBUG_CREATOR cdc;
+namespace
+{
+PLUGIN_CREATOR<DEBUG_CAP> cdc;
+}
+
+extern "C" BASE_PLUGIN * GetPlugin();
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 BASE_PLUGIN * GetPlugin()
 {
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 BASE_PLUGIN * GetPlugin()
 {
-return cdc.GetCapturer();
+return cdc.GetPlugin();
 }
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 }
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-const string DEBUG_CAP::GetVersion() const
+
+//-----------------------------------------------------------------------------
+RAW_PACKET MakeTCPPacket(const char * src,
+                         const char * dst,
+                         uint16_t sport,
+                         uint16_t dport,
+                         uint16_t len);
+std::string DEBUG_CAP::GetVersion() const
 {
 {
-return "Debug_cap v.0.01a";
+return "cap_debug v.0.01a";
 }
 //-----------------------------------------------------------------------------
 DEBUG_CAP::DEBUG_CAP()
 }
 //-----------------------------------------------------------------------------
 DEBUG_CAP::DEBUG_CAP()
@@ -109,7 +95,7 @@ void DEBUG_CAP::SetTraffcounter(TRAFFCOUNTER * tc)
 traffCnt = tc;
 }
 //-----------------------------------------------------------------------------
 traffCnt = tc;
 }
 //-----------------------------------------------------------------------------
-const string & DEBUG_CAP::GetStrError() const
+const std::string & DEBUG_CAP::GetStrError() const
 {
 return errorStr;
 }
 {
 return errorStr;
 }
@@ -453,12 +439,12 @@ return NULL;
 //-----------------------------------------------------------------------------
 uint16_t DEBUG_CAP::GetStartPosition() const
 {
 //-----------------------------------------------------------------------------
 uint16_t DEBUG_CAP::GetStartPosition() const
 {
-return 0;
+return 40;
 }
 //-----------------------------------------------------------------------------
 uint16_t DEBUG_CAP::GetStopPosition() const
 {
 }
 //-----------------------------------------------------------------------------
 uint16_t DEBUG_CAP::GetStopPosition() const
 {
-return 0;
+return 40;
 }
 //-----------------------------------------------------------------------------
 RAW_PACKET MakeTCPPacket(const char * src,
 }
 //-----------------------------------------------------------------------------
 RAW_PACKET MakeTCPPacket(const char * src,