#include "utils.h"
#include "smux.h"
+#ifdef SMUX_DEBUG
bool SMUX::CloseHandler(const SMUX_PDUs_t * pdus)
{
printfd(__FILE__, "SMUX::CloseHandler()\n");
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
return false;
}
+#else
+bool SMUX::CloseHandler(const SMUX_PDUs_t *)
+{
+return false;
+}
+#endif
+#ifdef SMUX_DEBUG
bool SMUX::RegisterResponseHandler(const SMUX_PDUs_t * pdus)
{
printfd(__FILE__, "SMUX::RegisterResponseHandler()\n");
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
return false;
}
+#else
+bool SMUX::RegisterResponseHandler(const SMUX_PDUs_t *)
+{
+return false;
+}
+#endif
bool SMUX::PDUsRequestHandler(const SMUX_PDUs_t * pdus)
{
+#ifdef SMUX_DEBUG
printfd(__FILE__, "SMUX::PDUsRequestHandler()\n");
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
+#endif
PDUsHandlers::iterator it;
it = pdusHandlers.find(pdus->choice.pdus.present);
if (it != pdusHandlers.end())
}
else
{
+#ifdef SMUX_DEBUG
switch (pdus->present)
{
case PDUs_PR_NOTHING:
default:
printfd(__FILE__, "SMUX::PDUsRequestHandler() - undefined\n");
}
+#endif
}
return false;
}
+#ifdef SMUX_DEBUG
bool SMUX::CommitOrRollbackHandler(const SMUX_PDUs_t * pdus)
{
printfd(__FILE__, "SMUX::CommitOrRollbackHandler()\n");
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
return false;
}
+#else
+bool SMUX::CommitOrRollbackHandler(const SMUX_PDUs_t *)
+{
+return false;
+}
+#endif
bool SMUX::GetRequestHandler(const PDUs_t * pdus)
{
+#ifdef SMUX_DEBUG
printfd(__FILE__, "SMUX::GetRequestHandler()\n");
asn_fprint(stderr, &asn_DEF_PDUs, pdus);
+#endif
const GetRequest_PDU_t * getRequest = &pdus->choice.get_request;
GetResponse_PDU_t * msg = static_cast<GetResponse_PDU_t *>(calloc(1, sizeof(GetResponse_PDU_t)));
assert(msg && "Enought mempry to allocate GetResponse_PDU_t");
}
SendGetResponsePDU(sock, msg);
+#ifdef SMUX_DEBUG
asn_fprint(stderr, &asn_DEF_GetResponse_PDU, msg);
+#endif
ASN_STRUCT_FREE(asn_DEF_GetResponse_PDU, msg);
return false;
}
bool SMUX::GetNextRequestHandler(const PDUs_t * pdus)
{
+#ifdef SMUX_DEBUG
printfd(__FILE__, "SMUX::GetNextRequestHandler()\n");
asn_fprint(stderr, &asn_DEF_PDUs, pdus);
+#endif
const GetRequest_PDU_t * getRequest = &pdus->choice.get_request;
GetResponse_PDU_t * msg = static_cast<GetResponse_PDU_t *>(calloc(1, sizeof(GetResponse_PDU_t)));
assert(msg && "Enought mempry to allocate GetResponse_PDU_t");
it = sensors.upper_bound(OID(&vb->name));
if (it == sensors.end())
{
+#ifdef SMUX_DEBUG
printfd(__FILE__, "SMUX::GetNextRequestHandler() - '%s' not found\n", OID(&vb->name).ToString().c_str());
+#endif
SendGetResponseErrorPDU(sock, getRequest,
PDU__error_status_noSuchName, i);
return true;
}
SendGetResponsePDU(sock, msg);
+#ifdef SMUX_DEBUG
asn_fprint(stderr, &asn_DEF_PDU, msg);
+#endif
ASN_STRUCT_FREE(asn_DEF_GetResponse_PDU, msg);
return false;
}
bool SMUX::SetRequestHandler(const PDUs_t * pdus)
{
+#ifdef SMUX_DEBUG
printfd(__FILE__, "SMUX::SetRequestHandler()\n");
asn_fprint(stderr, &asn_DEF_PDUs, pdus);
+#endif
SendGetResponseErrorPDU(sock, &pdus->choice.set_request,
PDU__error_status_readOnly, 0);
return false;
#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 "stg/traffcounter.h"*/
#include "smux.h"
#include "utils.h"
sensors[OID(".1.3.6.1.4.1.38313.1.1.3")] = new AuthorizedUsersSensor(*users);
sensors[OID(".1.3.6.1.4.1.38313.1.1.4")] = new AlwaysOnlineUsersSensor(*users);
sensors[OID(".1.3.6.1.4.1.38313.1.1.5")] = new NoCashUsersSensor(*users);
-sensors[OID(".1.3.6.1.4.1.38313.1.1.7")] = new DisabledDetailStatsUsersSensor(*users);
-sensors[OID(".1.3.6.1.4.1.38313.1.1.8")] = new DisabledUsersSensor(*users);
-sensors[OID(".1.3.6.1.4.1.38313.1.1.9")] = new PassiveUsersSensor(*users);
-sensors[OID(".1.3.6.1.4.1.38313.1.1.10")] = new CreditUsersSensor(*users);
-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);
+sensors[OID(".1.3.6.1.4.1.38313.1.1.6")] = new DisabledDetailStatsUsersSensor(*users);
+sensors[OID(".1.3.6.1.4.1.38313.1.1.7")] = new DisabledUsersSensor(*users);
+sensors[OID(".1.3.6.1.4.1.38313.1.1.8")] = new PassiveUsersSensor(*users);
+sensors[OID(".1.3.6.1.4.1.38313.1.1.9")] = new CreditUsersSensor(*users);
+sensors[OID(".1.3.6.1.4.1.38313.1.1.10")] = new FreeMbUsersSensor(*users);
+sensors[OID(".1.3.6.1.4.1.38313.1.1.11")] = 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.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", *tariffs, *users);
+tables[".1.3.6.1.4.1.38313.1.2.2"] = new TariffUsersTable(".1.3.6.1.4.1.38313.1.2.2", *tariffs, *users);
UpdateTables();
SetNotifiers();
-#ifdef DEBUG
+#ifdef SMUX_DEBUG
Sensors::const_iterator it(sensors.begin());
while (it != sensors.end())
{
}
else
{
+#ifdef SMUX_DEBUG
switch (pdus->present)
{
case SMUX_PDUs_PR_NOTHING:
printfd(__FILE__, "PDUs: undefined\n");
}
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
+#endif
}
return false;
}
}
arcs[arcPos++] = arc;
}
-printfd(__FILE__, "String2OI() - arcPos: %d\n", arcPos);
OBJECT_IDENTIFIER_set_arcs(oi, arcs, sizeof(arcs[0]), arcPos);
return true;
}
else
{
write(fd, buffer, error.encoded);
- printfd(__FILE__, "OpenPDU encoded successfully to %d bytes\n",
- error.encoded);
}
return true;
}
else
{
write(fd, buffer, error.encoded);
- printfd(__FILE__, "ClosePDU encoded successfully\n");
}
return 0;
}
else
{
write(fd, buffer, error.encoded);
- printfd(__FILE__, "RReqPDU encoded successfully to %d bytes\n",
- error.encoded);
}
return 0;
}
else
{
write(fd, buffer, error.encoded);
- printfd(__FILE__, "GetResponsePDU encoded successfully to %d bytes\n",
- error.encoded);
}
return 0;
}
else
{
write(fd, buffer, error.encoded);
- printfd(__FILE__,
- "GetResponsePDU for error encoded successfully to %d bytes\n",
- error.encoded);
}
return 0;
}