]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/smux/smux.cpp
Add some assertions
[stg.git] / projects / stargazer / plugins / other / smux / smux.cpp
index 79e9d208587b0398fa85ac86ee84f717b054b368..1300452f5cc4f5f3a5d8835da0ff097ba3c4bafa 100644 (file)
@@ -6,6 +6,7 @@
 #include <cerrno>
 #include <ctime>
 #include <csignal>
+#include <cassert>
 
 #include <vector>
 #include <algorithm>
 
 #include "stg/common.h"
 #include "stg/plugin_creator.h"
+#include "stg/users.h"
+#include "stg/tariffs.h"
+#include "stg/admins.h"
+#include "stg/services.h"
+#include "stg/corporations.h"
 
 #include "smux.h"
 #include "utils.h"
@@ -89,6 +95,9 @@ SMUX::SMUX()
     : PLUGIN(),
       users(NULL),
       tariffs(NULL),
+      admins(NULL),
+      services(NULL),
+      corporations(NULL),
       running(false),
       stopped(true),
       sock(-1)
@@ -128,6 +137,12 @@ return smuxSettings.ParseSettings(settings);
 
 int SMUX::Start()
 {
+assert(users != NULL && "users not NULL");
+assert(tariffs != NULL && "tariffs not NULL");
+assert(admins != NULL && "admins not NULL");
+assert(services != NULL && "services not NULL");
+assert(corporations != NULL && "corporations not NULL");
+
 if (PrepareNet())
     return -1;
 
@@ -145,6 +160,12 @@ sensors[OID(".1.3.6.1.4.1.38313.1.1.11")] = new FreeMbUsersSensor(*users);
 sensors[OID(".1.3.6.1.4.1.38313.1.1.12")] = new TariffChangeUsersSensor(*users);
 // Tariffs
 sensors[OID(".1.3.6.1.4.1.38313.1.2.1")] = new TotalTariffsSensor(*tariffs);
+// Admins
+sensors[OID(".1.3.6.1.4.1.38313.1.3.1")] = new TotalAdminsSensor(*admins);
+// Services
+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);
 
 // 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);