X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/f5776429a3145d59f5b131c25d0f9428ae947f4e..51998949e60e2a7e86e4393b315cfb76a58ca80d:/projects/stargazer/plugins/capture/pcap/pcap_cap.cpp?ds=inline diff --git a/projects/stargazer/plugins/capture/pcap/pcap_cap.cpp b/projects/stargazer/plugins/capture/pcap/pcap_cap.cpp index 57a5a878..394487f3 100644 --- a/projects/stargazer/plugins/capture/pcap/pcap_cap.cpp +++ b/projects/stargazer/plugins/capture/pcap/pcap_cap.cpp @@ -21,7 +21,6 @@ #include "pcap_cap.h" #include "stg/traffcounter.h" -#include "stg/plugin_creator.h" #include "stg/common.h" #include "stg/raw_ip_packet.h" @@ -32,7 +31,6 @@ //----------------------------------------------------------------------------- namespace { -PLUGIN_CREATOR pcc; const size_t SNAP_LEN = 1518; const size_t ETHER_ADDR_LEN = 6; @@ -46,13 +44,13 @@ u_short ether_type; /* IP? ARP? RARP? etc */ } -extern "C" PLUGIN * GetPlugin(); //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -PLUGIN * GetPlugin() +extern "C" STG::Plugin* GetPlugin() { -return pcc.GetPlugin(); + static PCAP_CAP plugin; + return &plugin; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -63,12 +61,10 @@ return "pcap_cap v.1.0"; } //----------------------------------------------------------------------------- PCAP_CAP::PCAP_CAP() - : errorStr(), - thread(), - nonstop(false), + : nonstop(false), isRunning(false), traffCnt(NULL), - logger(GetPluginLogger(GetStgLogger(), "cap_pcap")) + logger(STG::PluginLogger::get("pcap_cap")) { } //----------------------------------------------------------------------------- @@ -79,7 +75,7 @@ devices.erase(devices.begin(), devices.end()); if (settings.moduleParams.empty()) { devices.push_back(DEV()); - logger("Defaulting to pseudo-device 'all'."); + logger("Defaulting to pseudo-device 'any'."); return 0; } @@ -294,7 +290,7 @@ const ETH * eth = reinterpret_cast(packet); if (eth->ether_type != 0x8) return; -RAW_PACKET ip; +STG::RawPacket ip; memcpy(&ip.rawPacket, packet + 14, sizeof(ip.rawPacket)); -traffCnt->Process(ip); +traffCnt->process(ip); }