git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ticket 37. The message variable definition moved from if() construction
[stg.git]
/
projects
/
stargazer
/
plugins
/
other
/
smux
/
handlers.cpp
diff --git
a/projects/stargazer/plugins/other/smux/handlers.cpp
b/projects/stargazer/plugins/other/smux/handlers.cpp
index 7ceb29949243afee8370a322f355c2e1636be106..ac179da9cc28ba6b0ae040c3e4e2d4aa7fb8f8ee 100644
(file)
--- a/
projects/stargazer/plugins/other/smux/handlers.cpp
+++ b/
projects/stargazer/plugins/other/smux/handlers.cpp
@@
-15,12
+15,12
@@
bool SMUX::CloseHandler(const SMUX_PDUs_t * pdus)
{
printfd(__FILE__, "SMUX::CloseHandler()\n");
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
{
printfd(__FILE__, "SMUX::CloseHandler()\n");
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
-return
fals
e;
+return
tru
e;
}
#else
bool SMUX::CloseHandler(const SMUX_PDUs_t *)
{
}
#else
bool SMUX::CloseHandler(const SMUX_PDUs_t *)
{
-return
fals
e;
+return
tru
e;
}
#endif
}
#endif
@@
-29,12
+29,12
@@
bool SMUX::RegisterResponseHandler(const SMUX_PDUs_t * pdus)
{
printfd(__FILE__, "SMUX::RegisterResponseHandler()\n");
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
{
printfd(__FILE__, "SMUX::RegisterResponseHandler()\n");
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
-return
fals
e;
+return
tru
e;
}
#else
bool SMUX::RegisterResponseHandler(const SMUX_PDUs_t *)
{
}
#else
bool SMUX::RegisterResponseHandler(const SMUX_PDUs_t *)
{
-return
fals
e;
+return
tru
e;
}
#endif
}
#endif
@@
-44,15
+44,14
@@
bool SMUX::PDUsRequestHandler(const SMUX_PDUs_t * pdus)
printfd(__FILE__, "SMUX::PDUsRequestHandler()\n");
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
#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);
}
if (it != pdusHandlers.end())
{
return (this->*(it->second))(&pdus->choice.pdus);
}
+#ifdef SMUX_DEBUG
else
{
else
{
-#ifdef SMUX_DEBUG
switch (pdus->present)
{
case PDUs_PR_NOTHING:
switch (pdus->present)
{
case PDUs_PR_NOTHING:
@@
-67,9
+66,9
@@
else
default:
printfd(__FILE__, "SMUX::PDUsRequestHandler() - undefined\n");
}
default:
printfd(__FILE__, "SMUX::PDUsRequestHandler() - undefined\n");
}
-#endif
}
}
-return false;
+#endif
+return true;
}
#ifdef SMUX_DEBUG
}
#ifdef SMUX_DEBUG
@@
-77,12
+76,12
@@
bool SMUX::CommitOrRollbackHandler(const SMUX_PDUs_t * pdus)
{
printfd(__FILE__, "SMUX::CommitOrRollbackHandler()\n");
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
{
printfd(__FILE__, "SMUX::CommitOrRollbackHandler()\n");
asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
-return
fals
e;
+return
tru
e;
}
#else
bool SMUX::CommitOrRollbackHandler(const SMUX_PDUs_t *)
{
}
#else
bool SMUX::CommitOrRollbackHandler(const SMUX_PDUs_t *)
{
-return
fals
e;
+return
tru
e;
}
#endif
}
#endif
@@
-111,9
+110,8
@@
for (int i = 0; i < vbl->list.count; ++i)
it = sensors.find(OID(&vb->name));
if (it == sensors.end())
{
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)));
}
VarBind_t * newVb = static_cast<VarBind_t *>(calloc(1, sizeof(VarBind_t)));
@@
-125,12
+123,12
@@
for (int i = 0; i < vbl->list.count; ++i)
ASN_SEQUENCE_ADD(varBindList, newVb);
}
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);
#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)
}
bool SMUX::GetNextRequestHandler(const PDUs_t * pdus)
@@
-161,9
+159,8
@@
for (int i = 0; i < vbl->list.count; ++i)
#ifdef SMUX_DEBUG
printfd(__FILE__, "SMUX::GetNextRequestHandler() - '%s' not found\n", OID(&vb->name).ToString().c_str());
#endif
#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)));
}
VarBind_t * newVb = static_cast<VarBind_t *>(calloc(1, sizeof(VarBind_t)));
@@
-175,12
+172,12
@@
for (int i = 0; i < vbl->list.count; ++i)
ASN_SEQUENCE_ADD(varBindList, newVb);
}
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);
#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)
}
bool SMUX::SetRequestHandler(const PDUs_t * pdus)
@@
-189,7
+186,6
@@
bool SMUX::SetRequestHandler(const PDUs_t * pdus)
printfd(__FILE__, "SMUX::SetRequestHandler()\n");
asn_fprint(stderr, &asn_DEF_PDUs, pdus);
#endif
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);
}
}