X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/af9452155f0892e1d2862efad4a87861ca60867d..611c8051a2ae58a1c306675c8250865e12563834:/stargazer/plugins/capture/nfqueue/nfqueue.cpp?ds=sidebyside diff --git a/stargazer/plugins/capture/nfqueue/nfqueue.cpp b/stargazer/plugins/capture/nfqueue/nfqueue.cpp index e0248df6..3c79c1b1 100644 --- a/stargazer/plugins/capture/nfqueue/nfqueue.cpp +++ b/stargazer/plugins/capture/nfqueue/nfqueue.cpp @@ -21,7 +21,6 @@ #include "nfqueue.h" #include "stg/traffcounter.h" -#include "stg/plugin_creator.h" #include "stg/common.h" #include "stg/raw_ip_packet.h" @@ -45,8 +44,6 @@ extern "C" { namespace { -PLUGIN_CREATOR ncc; - int Callback(struct nfq_q_handle * queueHandle, struct nfgenmsg * /*msg*/, struct nfq_data * nfqData, void *data) { @@ -63,7 +60,7 @@ unsigned char * payload = NULL; if (nfq_get_payload(nfqData, &payload) < 0 || payload == NULL) return id; -RAW_PACKET packet; +STG::RawPacket packet; memcpy(&packet.rawPacket, payload, sizeof(packet.rawPacket)); @@ -76,13 +73,10 @@ return nfq_set_verdict(queueHandle, id, NF_ACCEPT, 0, NULL); } -extern "C" PLUGIN * GetPlugin(); -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -PLUGIN * GetPlugin() +extern "C" STG::Plugin* GetPlugin() { -return ncc.GetPlugin(); + static NFQ_CAP plugin; + return &plugin; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -99,7 +93,7 @@ NFQ_CAP::NFQ_CAP() nfqHandle(NULL), queueHandle(NULL), traffCnt(NULL), - logger(GetPluginLogger(GetStgLogger(), "cap_nfqueue")) + logger(STG::PluginLogger::get("cap_nfqueue")) { } //----------------------------------------------------------------------------- @@ -246,7 +240,7 @@ dc->isRunning = false; return NULL; } //----------------------------------------------------------------------------- -void NFQ_CAP::Process(const RAW_PACKET & packet) +void NFQ_CAP::Process(const STG::RawPacket & packet) { -traffCnt->Process(packet); +traffCnt->process(packet); }