From: Maxim Mamontov Date: Sun, 8 Jun 2014 09:54:52 +0000 (+0300) Subject: Small fixes. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/89bf1ada977fd8c84e395de5e664f3d4dff912a6?ds=sidebyside;hp=--cc Small fixes. --- 89bf1ada977fd8c84e395de5e664f3d4dff912a6 diff --git a/projects/stargazer/plugins/capture/cap_debug/debug_cap.cpp b/projects/stargazer/plugins/capture/cap_debug/debug_cap.cpp index 6ec8c342..480ef202 100644 --- a/projects/stargazer/plugins/capture/cap_debug/debug_cap.cpp +++ b/projects/stargazer/plugins/capture/cap_debug/debug_cap.cpp @@ -81,7 +81,7 @@ RAW_PACKET MakeTCPPacket(const char * src, 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() diff --git a/projects/stargazer/plugins/capture/cap_nf/cap_nf.cpp b/projects/stargazer/plugins/capture/cap_nf/cap_nf.cpp index 41ad9fae..8c4fdc2d 100644 --- a/projects/stargazer/plugins/capture/cap_nf/cap_nf.cpp +++ b/projects/stargazer/plugins/capture/cap_nf/cap_nf.cpp @@ -39,7 +39,7 @@ $Author: faust $ #include -#include "stg/common.h" +#include "stg/common.h" #include "stg/raw_ip_packet.h" #include "stg/traffcounter.h" #include "stg/plugin_creator.h" @@ -123,7 +123,7 @@ if (portU > 0) runningUDP = false; CloseUDP(); errorStr = "Cannot create UDP thread"; - logger("Cannot create UDP thread."); + logger("Cannot create UDP thread."); printfd(__FILE__, "Error: Cannot create UDP thread\n"); return -1; } @@ -139,7 +139,7 @@ if (portT > 0) { runningTCP = false; CloseTCP(); - logger("Cannot create TCP thread."); + logger("Cannot create TCP thread."); errorStr = "Cannot create TCP thread"; printfd(__FILE__, "Error: Cannot create TCP thread\n"); return -1; @@ -168,7 +168,7 @@ if (portU && !stoppedUDP) if (pthread_kill(tidUDP, SIGUSR1)) { errorStr = "Error sending signal to UDP thread"; - logger("Error sending sugnal to UDP thread."); + logger("Error sending sugnal to UDP thread."); printfd(__FILE__, "Error: Error sending signal to UDP thread\n"); return -1; } @@ -193,12 +193,12 @@ if (portT && !stoppedTCP) if (pthread_kill(tidTCP, SIGUSR1)) { errorStr = "Error sending signal to TCP thread"; - logger("Error sending signal to TCP thread."); + logger("Error sending signal to TCP thread."); printfd(__FILE__, "Error: Error sending signal to TCP thread\n"); return -1; } printfd(__FILE__, "TCP thread NOT stopped\n"); - logger("Cannot stop TCP thread."); + logger("Cannot stop TCP thread."); } } return 0; @@ -283,10 +283,10 @@ while (cap->runningUDP) break; if (res < 0) - { - cap->logger("recvfrom error: %s", strerror(errno)); - continue; - } + { + cap->logger("recvfrom error: %s", strerror(errno)); + continue; + } if (res == 0) // EOF { @@ -334,7 +334,7 @@ while (cap->runningTCP) if (sd <= 0) { if (sd < 0) - cap->logger("accept error: %s", strerror(errno)); + cap->logger("accept error: %s", strerror(errno)); continue; } diff --git a/projects/stargazer/plugins/capture/cap_nf/cap_nf.h b/projects/stargazer/plugins/capture/cap_nf/cap_nf.h index 23f7d7db..bcb8b743 100644 --- a/projects/stargazer/plugins/capture/cap_nf/cap_nf.h +++ b/projects/stargazer/plugins/capture/cap_nf/cap_nf.h @@ -39,7 +39,7 @@ $Author: faust $ #include "stg/module_settings.h" #include "stg/logger.h" -#define VERSION "CAP_NF v. 0.4" +#define VERSION "cap_nf v. 0.4" #define START_POS 40 #define STOP_POS 40 diff --git a/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.cpp b/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.cpp index 96476d4e..41817d92 100644 --- a/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.cpp +++ b/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.cpp @@ -80,7 +80,7 @@ return dcc.GetPlugin(); //----------------------------------------------------------------------------- std::string DIVERT_CAP::GetVersion() const { -return "Divert_cap v.1.0"; +return "cap_divert v.1.0"; } //----------------------------------------------------------------------------- DIVERT_CAP::DIVERT_CAP() @@ -147,7 +147,7 @@ if (isRunning) if (pthread_kill(thread, SIGINT)) { errorStr = "Cannot kill thread."; - logger("Cannot send signal to thread."); + logger("Cannot send signal to thread."); printfd(__FILE__, "Cannot kill thread\n"); return -1; } @@ -262,10 +262,10 @@ if ((bytes = recvfrom (cddiv.sock, buf, BUFF_LEN, *iface = cddiv.iface; if (!disableForwarding) - { + { if (sendto(cddiv.sock, buf, bytes, 0, (struct sockaddr*)&divertaddr, divertaddrSize) < 0) - logger("sendto error: %s", strerror(errno)); - } + logger("sendto error: %s", strerror(errno)); + } } else { diff --git a/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp b/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp index 72e7f73b..254fd3f9 100644 --- a/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp +++ b/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp @@ -117,7 +117,7 @@ return iface[num]; //----------------------------------------------------------------------------- std::string BPF_CAP::GetVersion() const { -return "bpf_cap v.1.0"; +return "cap_bpf v.1.0"; } //----------------------------------------------------------------------------- BPF_CAP::BPF_CAP() @@ -131,7 +131,7 @@ BPF_CAP::BPF_CAP() capSock(-1), settings(), traffCnt(NULL), - logger(GetPluginLogger(GetStgLogger(), "cap_ether")) + logger(GetPluginLogger(GetStgLogger(), "cap_bpf")) { } //----------------------------------------------------------------------------- @@ -197,7 +197,7 @@ if (isRunning) if (pthread_kill(thread, SIGINT)) { errorStr = "Cannot kill thread."; - logger("Cannot send signal to thread."); + logger("Cannot send signal to thread."); printfd(__FILE__, "Cannot kill thread\n"); return -1; } @@ -347,7 +347,7 @@ if (bd->canRead) bd->r = read(bd->fd, bd->buffer, BUFF_LEN); if (bd->r < 0) { - logger("read error: %s", strerror(errno)); + logger("read error: %s", strerror(errno)); struct timespec ts = {0, 20000000}; nanosleep(&ts, NULL); return -1; diff --git a/projects/stargazer/plugins/capture/ether_linux/ether_cap.cpp b/projects/stargazer/plugins/capture/ether_linux/ether_cap.cpp index a97fa8e7..fd83c485 100644 --- a/projects/stargazer/plugins/capture/ether_linux/ether_cap.cpp +++ b/projects/stargazer/plugins/capture/ether_linux/ether_cap.cpp @@ -71,10 +71,10 @@ return ecc.GetPlugin(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- std::string ETHER_CAP::GetVersion() const { -return "Ether_cap v.1.2"; +return "cap_ether v.1.2"; } //----------------------------------------------------------------------------- ETHER_CAP::ETHER_CAP() @@ -132,7 +132,7 @@ if (isRunning) if (pthread_kill(thread, SIGUSR1)) { errorStr = "Cannot kill thread."; - logger("Cannot send signal to thread."); + logger("Cannot send signal to thread."); return -1; } for (int i = 0; i < 25 && isRunning; ++i) @@ -143,7 +143,7 @@ if (isRunning) if (isRunning) { errorStr = "ETHER_CAP not stopped."; - logger("Cannot stop thread."); + logger("Cannot stop thread."); printfd(__FILE__, "Cannot stop thread\n"); return -1; } diff --git a/projects/stargazer/plugins/capture/ipq_linux/ipq_cap.cpp b/projects/stargazer/plugins/capture/ipq_linux/ipq_cap.cpp index 05599306..45ca9b1f 100644 --- a/projects/stargazer/plugins/capture/ipq_linux/ipq_cap.cpp +++ b/projects/stargazer/plugins/capture/ipq_linux/ipq_cap.cpp @@ -58,7 +58,7 @@ return icc.GetPlugin(); //----------------------------------------------------------------------------- std::string IPQ_CAP::GetVersion() const { -return "ipq_cap v.1.2"; +return "cap_ipq v.1.2"; } //----------------------------------------------------------------------------- IPQ_CAP::IPQ_CAP() diff --git a/projects/stargazer/plugins/capture/pcap/pcap_cap.cpp b/projects/stargazer/plugins/capture/pcap/pcap_cap.cpp index 10033d03..5e3e874d 100644 --- a/projects/stargazer/plugins/capture/pcap/pcap_cap.cpp +++ b/projects/stargazer/plugins/capture/pcap/pcap_cap.cpp @@ -68,7 +68,7 @@ PCAP_CAP::PCAP_CAP() nonstop(false), isRunning(false), traffCnt(NULL), - logger(GetPluginLogger(GetStgLogger(), "cap_pcap")) + logger(GetPluginLogger(GetStgLogger(), "pcap_cap")) { } //-----------------------------------------------------------------------------