]> git.stg.codes - stg.git/commitdiff
Small fixes.
authorMaxim Mamontov <faust.madf@gmail.com>
Sun, 8 Jun 2014 09:54:52 +0000 (12:54 +0300)
committerMaxim Mamontov <faust.madf@gmail.com>
Sun, 8 Jun 2014 09:54:52 +0000 (12:54 +0300)
projects/stargazer/plugins/capture/cap_debug/debug_cap.cpp
projects/stargazer/plugins/capture/cap_nf/cap_nf.cpp
projects/stargazer/plugins/capture/cap_nf/cap_nf.h
projects/stargazer/plugins/capture/divert_freebsd/divert_cap.cpp
projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp
projects/stargazer/plugins/capture/ether_linux/ether_cap.cpp
projects/stargazer/plugins/capture/ipq_linux/ipq_cap.cpp
projects/stargazer/plugins/capture/pcap/pcap_cap.cpp

index 6ec8c3420e1dc3dd91d9f25bc848f2403c7e60f6..480ef202ba63deb67b13c23afc6e47705aa13ef1 100644 (file)
@@ -81,7 +81,7 @@ RAW_PACKET MakeTCPPacket(const char * src,
                          uint16_t len);
 std::string DEBUG_CAP::GetVersion() const
 {
                          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()
index 41ad9faed1ab4d769ba4359e11c3fac673cb642f..8c4fdc2dd350cf9dbc9306d59273cf39446d2366 100644 (file)
@@ -39,7 +39,7 @@ $Author: faust $
 
 #include <vector>
 
 
 #include <vector>
 
-#include "stg/common.h" 
+#include "stg/common.h"
 #include "stg/raw_ip_packet.h"
 #include "stg/traffcounter.h"
 #include "stg/plugin_creator.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";
         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;
         }
         printfd(__FILE__, "Error: Cannot create UDP thread\n");
         return -1;
         }
@@ -139,7 +139,7 @@ if (portT > 0)
         {
         runningTCP = false;
         CloseTCP();
         {
         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;
         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";
         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;
             }
             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";
         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");
             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;
         }
     }
 return 0;
@@ -283,10 +283,10 @@ while (cap->runningUDP)
         break;
 
     if (res < 0)
         break;
 
     if (res < 0)
-       {
-       cap->logger("recvfrom error: %s", strerror(errno));
-       continue;
-       }
+        {
+        cap->logger("recvfrom error: %s", strerror(errno));
+        continue;
+        }
 
     if (res == 0) // EOF
         {
 
     if (res == 0) // EOF
         {
@@ -334,7 +334,7 @@ while (cap->runningTCP)
     if (sd <= 0)
         {
         if (sd < 0)
     if (sd <= 0)
         {
         if (sd < 0)
-           cap->logger("accept error: %s", strerror(errno));
+            cap->logger("accept error: %s", strerror(errno));
         continue;
         }
 
         continue;
         }
 
index 23f7d7db2e18fc4f4f176581dce105c507b65949..bcb8b743619ac4658a49bb130a6b50bd5909a188 100644 (file)
@@ -39,7 +39,7 @@ $Author: faust $
 #include "stg/module_settings.h"
 #include "stg/logger.h"
 
 #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
 
 #define START_POS 40
 #define STOP_POS 40
 
index 96476d4e204027ee8f1d556f7dc54544a52489d8..41817d92f7821aecf18da8c3f9443a22027dc8b0 100644 (file)
@@ -80,7 +80,7 @@ return dcc.GetPlugin();
 //-----------------------------------------------------------------------------
 std::string DIVERT_CAP::GetVersion() const
 {
 //-----------------------------------------------------------------------------
 std::string DIVERT_CAP::GetVersion() const
 {
-return "Divert_cap v.1.0";
+return "cap_divert v.1.0";
 }
 //-----------------------------------------------------------------------------
 DIVERT_CAP::DIVERT_CAP()
 }
 //-----------------------------------------------------------------------------
 DIVERT_CAP::DIVERT_CAP()
@@ -147,7 +147,7 @@ if (isRunning)
     if (pthread_kill(thread, SIGINT))
         {
         errorStr = "Cannot kill thread.";
     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;
         }
         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)
         *iface = cddiv.iface;
 
     if (!disableForwarding)
-       {
+        {
         if (sendto(cddiv.sock, buf, bytes, 0, (struct sockaddr*)&divertaddr, divertaddrSize) < 0)
         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
     {
     }
 else
     {
index 72e7f73bdcad694183f5cb94c03fe9dd33d1e241..254fd3f92d53d34d05c0f03dd43b805cede7ff06 100644 (file)
@@ -117,7 +117,7 @@ return iface[num];
 //-----------------------------------------------------------------------------
 std::string BPF_CAP::GetVersion() const
 {
 //-----------------------------------------------------------------------------
 std::string BPF_CAP::GetVersion() const
 {
-return "bpf_cap v.1.0";
+return "cap_bpf v.1.0";
 }
 //-----------------------------------------------------------------------------
 BPF_CAP::BPF_CAP()
 }
 //-----------------------------------------------------------------------------
 BPF_CAP::BPF_CAP()
@@ -131,7 +131,7 @@ BPF_CAP::BPF_CAP()
       capSock(-1),
       settings(),
       traffCnt(NULL),
       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.";
     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;
         }
         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)
         {
     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;
         struct timespec ts = {0, 20000000};
         nanosleep(&ts, NULL);
         return -1;
index a97fa8e7d07e5490569f7f9c73e14d6107776717..fd83c48542b663028a7d202a10a36a43839c6ff6 100644 (file)
@@ -71,10 +71,10 @@ return ecc.GetPlugin();
 }
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 }
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------        
+//-----------------------------------------------------------------------------
 std::string ETHER_CAP::GetVersion() const
 {
 std::string ETHER_CAP::GetVersion() const
 {
-return "Ether_cap v.1.2";
+return "cap_ether v.1.2";
 }
 //-----------------------------------------------------------------------------
 ETHER_CAP::ETHER_CAP()
 }
 //-----------------------------------------------------------------------------
 ETHER_CAP::ETHER_CAP()
@@ -132,7 +132,7 @@ if (isRunning)
     if (pthread_kill(thread, SIGUSR1))
         {
         errorStr = "Cannot kill thread.";
     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)
         return -1;
         }
     for (int i = 0; i < 25 && isRunning; ++i)
@@ -143,7 +143,7 @@ if (isRunning)
     if (isRunning)
         {
         errorStr = "ETHER_CAP not stopped.";
     if (isRunning)
         {
         errorStr = "ETHER_CAP not stopped.";
-       logger("Cannot stop thread.");
+        logger("Cannot stop thread.");
         printfd(__FILE__, "Cannot stop thread\n");
         return -1;
         }
         printfd(__FILE__, "Cannot stop thread\n");
         return -1;
         }
index 055993063d44b96d617f2b164ce89a11f9663aca..45ca9b1f76ce0fa1e461fe937a5f30768c7c91db 100644 (file)
@@ -58,7 +58,7 @@ return icc.GetPlugin();
 //-----------------------------------------------------------------------------
 std::string IPQ_CAP::GetVersion() const
 {
 //-----------------------------------------------------------------------------
 std::string IPQ_CAP::GetVersion() const
 {
-return "ipq_cap v.1.2";
+return "cap_ipq v.1.2";
 }
 //-----------------------------------------------------------------------------
 IPQ_CAP::IPQ_CAP()
 }
 //-----------------------------------------------------------------------------
 IPQ_CAP::IPQ_CAP()
index 10033d039bbd86e3a4aa81d56e66869519c398c2..5e3e874d9fe6202963c79961c58b6000aa690389 100644 (file)
@@ -68,7 +68,7 @@ PCAP_CAP::PCAP_CAP()
       nonstop(false),
       isRunning(false),
       traffCnt(NULL),
       nonstop(false),
       isRunning(false),
       traffCnt(NULL),
-      logger(GetPluginLogger(GetStgLogger(), "cap_pcap"))
+      logger(GetPluginLogger(GetStgLogger(), "pcap_cap"))
 {
 }
 //-----------------------------------------------------------------------------
 {
 }
 //-----------------------------------------------------------------------------