[AGENT++] Update MibTable

Pedro pedroemail at gmail.com
Thu Jul 9 09:44:40 CEST 2009


Hi,

I´m testing with dynamic tables. I have a problem with update method to
Mibtable. The Oidx (subrequestOID,indexOID) always are with empty
information.




 virtual void update(Request* pReq) {

          if (currentRequest == pReq->get_request_id()) return;
          currentRequest = pReq->get_request_id();

          clear();
          mPreviousIndexOID.clear();  // see below

          for (u_int sub = 0,n = pReq->subrequests(); sub < n; sub++)
          {
              // Extract the index value for this subrequest.
              Oidx subrequestOID(pReq->get_oid(sub));
              Oidx indexOID(index(subrequestOID));

              switch (pReq->get_type())
              {
              case sNMP_PDU_GET:
              case sNMP_PDU_SET:
                  // See whether the requested OID is in this table.
                  if (base(subrequestOID) != *key())
                      break;

                  // See whether we have a valid index OID.
                  if (!is_index_valid(indexOID))
                      break;

                  // Create a row for this index OID, if found in the
database.
                  /*myDatabase.*/loadRow(indexOID);
                  break;

              case sNMP_PDU_GETNEXT:
              case sNMP_PDU_GETBULK:
                  // If this table's update() method was called in response
                  // to a GETNEXT request on the last object in a previous
                  // table, try to load the first row of the table, so that
                  // Agent++ knows it needs to descend into this subtree.
                  if (base(subrequestOID) < *key())
                  {
                      // As an optimization, see whether we just filled in
                      // the row corresponding to this index OID; see below.
                      if ((mPreviousIndexOID.len() == 0) ||
                          (indexOID != mPreviousIndexOID))
                      {
                          mPreviousIndexOID = indexOID;
                          loadFirstRow();
                      }
                  }

                  // Now the overridden MibTable::find_succ() method will
call
                  // loadNextRow() as Agent++ traverses the table's subtree.
                  break;

              default:
                  break;
              }
          }
      }


Best Regards

Pedro J Calero


-- 
UN SALUDO.
Pedro.

                           ''~``
                          ( o o )
+----------------------oooO--(_)--Oooo--------------+

          E-Mail : pedroemail at gmail.com
                      .oooO
                        (   )   Oooo.
+------------------------\ (----(   )----------------------+
                          \_)    ) /
                                (_/



More information about the AGENTPP mailing list