X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/82ede2a92a721d1c8f0e3fd109a2594f2096306e..cf951863b80fb594f99b29e87558e03d453f75ef:/projects/stargazer/plugins/other/smux/smux.cpp

diff --git a/projects/stargazer/plugins/other/smux/smux.cpp b/projects/stargazer/plugins/other/smux/smux.cpp
index ac77ce6e..99c65b8c 100644
--- a/projects/stargazer/plugins/other/smux/smux.cpp
+++ b/projects/stargazer/plugins/other/smux/smux.cpp
@@ -6,6 +6,7 @@
 #include <cerrno>
 #include <ctime>
 #include <csignal>
+#include <cassert>
 
 #include <vector>
 #include <algorithm>
@@ -15,11 +16,12 @@
 
 #include "stg/common.h"
 #include "stg/plugin_creator.h"
-#include "stg/users.h"
+/*#include "stg/users.h"
 #include "stg/tariffs.h"
 #include "stg/admins.h"
 #include "stg/services.h"
 #include "stg/corporations.h"
+#include "stg/traffcounter.h"*/
 
 #include "smux.h"
 #include "utils.h"
@@ -97,6 +99,7 @@ SMUX::SMUX()
       admins(NULL),
       services(NULL),
       corporations(NULL),
+      traffcounter(NULL),
       running(false),
       stopped(true),
       sock(-1)
@@ -136,6 +139,13 @@ return smuxSettings.ParseSettings(settings);
 
 int SMUX::Start()
 {
+assert(users != NULL && "users must not be NULL");
+assert(tariffs != NULL && "tariffs must not be NULL");
+assert(admins != NULL && "admins must not be NULL");
+assert(services != NULL && "services must not be NULL");
+assert(corporations != NULL && "corporations must not be NULL");
+assert(traffcounter != NULL && "traffcounter must not be NULL");
+
 if (PrepareNet())
     return -1;
 
@@ -159,6 +169,8 @@ sensors[OID(".1.3.6.1.4.1.38313.1.3.1")] = new TotalAdminsSensor(*admins);
 sensors[OID(".1.3.6.1.4.1.38313.1.4.1")] = new TotalServicesSensor(*services);
 // Corporations
 sensors[OID(".1.3.6.1.4.1.38313.1.5.1")] = new TotalCorporationsSensor(*corporations);
+// Traffcounter
+sensors[OID(".1.3.6.1.4.1.38313.1.6.1")] = new TotalRulesSensor(*traffcounter);
 
 // Table data
 tables[".1.3.6.1.4.1.38313.1.1.6"] = new TariffUsersTable(".1.3.6.1.4.1.38313.1.1.6", *users);
@@ -246,7 +258,10 @@ while(running)
         {
         SMUX_PDUs_t * pdus = RecvSMUXPDUs(sock);
         if (pdus)
+            {
             DispatchPDUs(pdus);
+            ASN_STRUCT_FREE(asn_DEF_SMUX_PDUs, pdus);
+            }
         }
     if (!running)
         break;