-#include <cassert>
+#include "smux.h"
+#include "utils.h"
+#include "stg/common.h"
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
#include "stg/GetRequest-PDU.h"
#include "stg/GetResponse-PDU.h"
#include "stg/VarBindList.h"
#include "stg/VarBind.h"
+#pragma GCC diagnostic pop
-#include "stg/common.h"
+#include <cassert>
-#include "utils.h"
-#include "smux.h"
+using STG::SMUX;
#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;
+return true;
}
#else
bool SMUX::CloseHandler(const SMUX_PDUs_t *)
{
-return false;
+return true;
}
#endif
{
printfd(__FILE__, "SMUX::RegisterResponseHandler()\n");
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
-return false;
+return true;
}
#else
bool SMUX::RegisterResponseHandler(const SMUX_PDUs_t *)
{
-return false;
+return true;
}
#endif
printfd(__FILE__, "SMUX::PDUsRequestHandler()\n");
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
#endif
-PDUsHandlers::iterator it;
-it = pdusHandlers.find(pdus->choice.pdus.present);
+PDUsHandlers::iterator it(pdusHandlers.find(pdus->choice.pdus.present));
if (it != pdusHandlers.end())
{
return (this->*(it->second))(&pdus->choice.pdus);
}
+#ifdef SMUX_DEBUG
else
{
-#ifdef SMUX_DEBUG
switch (pdus->present)
{
case PDUs_PR_NOTHING:
default:
printfd(__FILE__, "SMUX::PDUsRequestHandler() - undefined\n");
}
-#endif
}
-return false;
+#endif
+return true;
}
#ifdef SMUX_DEBUG
{
printfd(__FILE__, "SMUX::CommitOrRollbackHandler()\n");
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
-return false;
+return true;
}
#else
bool SMUX::CommitOrRollbackHandler(const SMUX_PDUs_t *)
{
-return false;
+return true;
}
#endif
it = sensors.find(OID(&vb->name));
if (it == sensors.end())
{
- SendGetResponseErrorPDU(sock, getRequest,
- PDU__error_status_noSuchName, i);
- return true;
+ return SendGetResponseErrorPDU(sock, getRequest,
+ PDU__error_status_noSuchName, i);
}
VarBind_t * newVb = static_cast<VarBind_t *>(calloc(1, sizeof(VarBind_t)));
ASN_SEQUENCE_ADD(varBindList, newVb);
}
-SendGetResponsePDU(sock, msg);
+bool res = 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;
+return res;
}
bool SMUX::GetNextRequestHandler(const PDUs_t * pdus)
#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;
+ return SendGetResponseErrorPDU(sock, getRequest,
+ PDU__error_status_noSuchName, i);
}
VarBind_t * newVb = static_cast<VarBind_t *>(calloc(1, sizeof(VarBind_t)));
ASN_SEQUENCE_ADD(varBindList, newVb);
}
-SendGetResponsePDU(sock, msg);
+bool res = SendGetResponsePDU(sock, msg);
#ifdef SMUX_DEBUG
asn_fprint(stderr, &asn_DEF_PDU, msg);
#endif
ASN_STRUCT_FREE(asn_DEF_GetResponse_PDU, msg);
-return false;
+return res;
}
bool SMUX::SetRequestHandler(const PDUs_t * pdus)
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;
+return SendGetResponseErrorPDU(sock, &pdus->choice.set_request,
+ PDU__error_status_readOnly, 0);
}