X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/641204dfbdb9fc870cdd2e7f9e3169a44693e7bf..6e3e89772ba2bdcc78e97da7f1f0cf95e187c81a:/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp?ds=sidebyside diff --git a/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp b/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp index 0ebec5b6..0f6cb98c 100644 --- a/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp +++ b/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp @@ -48,21 +48,15 @@ $Author: faust $ #include #include -#include -#include - #include "ether_cap.h" #include "common.h" #include "raw_ip_packet.h" -using namespace std; - //#define CAP_DEBUG 1 //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -class BPF_CAP_CREATOR -{ +class BPF_CAP_CREATOR { private: BPF_CAP * bpfc; @@ -88,7 +82,7 @@ BPF_CAP_CREATOR bcc; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -BASE_PLUGIN * GetPlugin() +PLUGIN * GetPlugin() { return bcc.GetCapturer(); } @@ -99,7 +93,7 @@ int BPF_CAP_SETTINGS::ParseSettings(const MODULE_SETTINGS & s) { //char sep[]= ", \t\n\r"; //char *s; -string ifaces; +std::string ifaces; //char * str; //char *p; @@ -159,7 +153,7 @@ if (!ifaces.size()) return 0; } //----------------------------------------------------------------------------- -string BPF_CAP_SETTINGS::GetIface(unsigned int num) +std::string BPF_CAP_SETTINGS::GetIface(unsigned int num) { if (num >= iface.size()) { @@ -170,15 +164,17 @@ return iface[num]; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -const string BPF_CAP::GetVersion() const +const std::string BPF_CAP::GetVersion() const { return "bpf_cap v.1.0"; } //----------------------------------------------------------------------------- BPF_CAP::BPF_CAP() + : nonstop(false), + isRunning(false), + capSock(-1), + traffCnt(NULL) { -isRunning = false; -nonstop = false; } //----------------------------------------------------------------------------- void BPF_CAP::SetSettings(const MODULE_SETTINGS & s) @@ -202,7 +198,7 @@ void BPF_CAP::SetTraffcounter(TRAFFCOUNTER * tc) traffCnt = tc; } //----------------------------------------------------------------------------- -const string & BPF_CAP::GetStrError() const +const std::string & BPF_CAP::GetStrError() const { return errorStr; } @@ -363,7 +359,7 @@ strncpy(ifr.ifr_name, bd->iface.c_str(), sizeof(ifr.ifr_name)); //if (ioctl(cd[n].fd, BIOCSBLEN, (caddr_t)&l) < 0) if (ioctl(bd->fd, BIOCSBLEN, (caddr_t)&l) < 0) { - errorStr = bd->iface + " BIOCSBLEN " + string(strerror(errno)); + errorStr = bd->iface + " BIOCSBLEN " + std::string(strerror(errno)); printfd(__FILE__, "ioctl failed: '%s'\n", errorStr.c_str()); return -1; } @@ -371,7 +367,7 @@ if (ioctl(bd->fd, BIOCSBLEN, (caddr_t)&l) < 0) //if (ioctl(cd[n].fd, BIOCSETIF, (caddr_t)&ifr) < 0 ) if (ioctl(bd->fd, BIOCSETIF, (caddr_t)&ifr) < 0) { - errorStr = bd->iface + " BIOCSETIF " + string(strerror(errno)); + errorStr = bd->iface + " BIOCSETIF " + std::string(strerror(errno)); printfd(__FILE__, "ioctl failed: '%s'\n", errorStr.c_str()); return -1; } @@ -379,7 +375,7 @@ if (ioctl(bd->fd, BIOCSETIF, (caddr_t)&ifr) < 0) //if (ioctl(cd[n].fd, BIOCIMMEDIATE, &im) < 0 ) if (ioctl(bd->fd, BIOCIMMEDIATE, &im) < 0) { - errorStr = bd->iface + " BIOCIMMEDIATE " + string(strerror(errno)); + errorStr = bd->iface + " BIOCIMMEDIATE " + std::string(strerror(errno)); printfd(__FILE__, "ioctl failed: '%s'\n", errorStr.c_str()); return -1; }