]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/smux/handlers.cpp
Simplified admins API
[stg.git] / projects / stargazer / plugins / other / smux / handlers.cpp
index 5fb3dfda7796e040f0bf729d7adbe69376ee48ce..b2292bda2cf6bffc6aef903b0918b5963af13a07 100644 (file)
@@ -1,16 +1,11 @@
-#include "asn1/OpenPDU.h"
-#include "asn1/ClosePDU.h"
-#include "asn1/RReqPDU.h"
-#include "asn1/GetRequest-PDU.h"
-#include "asn1/GetResponse-PDU.h"
-#include "asn1/VarBindList.h"
-#include "asn1/VarBind.h"
-#include "asn1/OBJECT_IDENTIFIER.h"
-#include "asn1/ber_decoder.h"
-#include "asn1/der_encoder.h"
+#include "stg/GetRequest-PDU.h"
+#include "stg/GetResponse-PDU.h"
+#include "stg/VarBindList.h"
+#include "stg/VarBind.h"
 
 #include "stg/common.h"
 
 
 #include "stg/common.h"
 
+#include "utils.h"
 #include "smux.h"
 
 bool SMUX::CloseHandler(const SMUX_PDUs_t * pdus)
 #include "smux.h"
 
 bool SMUX::CloseHandler(const SMUX_PDUs_t * pdus)
@@ -29,7 +24,7 @@ return false;
 
 bool SMUX::PDUsRequestHandler(const SMUX_PDUs_t * pdus)
 {
 
 bool SMUX::PDUsRequestHandler(const SMUX_PDUs_t * pdus)
 {
-printfd(__FILE__, "SMUX::PDUsHandler()\n");
+printfd(__FILE__, "SMUX::PDUsRequestHandler()\n");
 asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
 PDUsHandlers::iterator it;
 it = pdusHandlers.find(pdus->choice.pdus.present);
 asn_fprint(stderr, &asn_DEF_SMUX_PDUs, pdus);
 PDUsHandlers::iterator it;
 it = pdusHandlers.find(pdus->choice.pdus.present);
@@ -42,16 +37,16 @@ else
     switch (pdus->present)
         {
         case PDUs_PR_NOTHING:
     switch (pdus->present)
         {
         case PDUs_PR_NOTHING:
-            printfd(__FILE__, "SMUX::PDUsHandler() - nothing\n");
+            printfd(__FILE__, "SMUX::PDUsRequestHandler() - nothing\n");
             break;
         case PDUs_PR_get_response:
             break;
         case PDUs_PR_get_response:
-            printfd(__FILE__, "SMUX::PDUsHandler() - get response\n");
+            printfd(__FILE__, "SMUX::PDUsRequestHandler() - get response\n");
             break;
         case PDUs_PR_trap:
             break;
         case PDUs_PR_trap:
-            printfd(__FILE__, "SMUX::PDUsHandler() - trap\n");
+            printfd(__FILE__, "SMUX::PDUsRequestHandler() - trap\n");
             break;
         default:
             break;
         default:
-            printfd(__FILE__, "SMUX::PDUsHandler() - undefined\n");
+            printfd(__FILE__, "SMUX::PDUsRequestHandler() - undefined\n");
         }
     }
 return false;
         }
     }
 return false;
@@ -82,7 +77,7 @@ for (int i = 0; i < vbl->list.count; ++i)
     {
     VarBind_t * vb = getRequest->variable_bindings.list.array[i];
     Sensors::iterator it;
     {
     VarBind_t * vb = getRequest->variable_bindings.list.array[i];
     Sensors::iterator it;
-    it = sensors.find(OI2String(&vb->name));
+    it = sensors.find(OID(&vb->name));
     if (it == sensors.end())
         {
         SendGetResponseErrorPDU(sock, getRequest,
     if (it == sensors.end())
         {
         SendGetResponseErrorPDU(sock, getRequest,
@@ -122,7 +117,7 @@ for (int i = 0; i < vbl->list.count; ++i)
     {
     VarBind_t * vb = getRequest->variable_bindings.list.array[i];
     Sensors::iterator it;
     {
     VarBind_t * vb = getRequest->variable_bindings.list.array[i];
     Sensors::iterator it;
-    it = sensors.upper_bound(OI2String(&vb->name));
+    it = sensors.upper_bound(OID(&vb->name));
     if (it == sensors.end())
         {
         SendGetResponseErrorPDU(sock, getRequest,
     if (it == sensors.end())
         {
         SendGetResponseErrorPDU(sock, getRequest,
@@ -133,7 +128,7 @@ for (int i = 0; i < vbl->list.count; ++i)
     VarBind_t newVb;
     memset(&newVb, 0, sizeof(newVb));
 
     VarBind_t newVb;
     memset(&newVb, 0, sizeof(newVb));
 
-    newVb.name = vb->name;
+    it->first.ToOID(&newVb.name);
     it->second->GetValue(&newVb.value);
 
     ASN_SEQUENCE_ADD(varBindList, &newVb);
     it->second->GetValue(&newVb.value);
 
     ASN_SEQUENCE_ADD(varBindList, &newVb);