[AGENT++] Problem with V3_MP Object

Jochen Katz katz at agentpp.com
Sun Aug 7 20:15:54 CEST 2005


Hi,

> Also is there any way to flush the Engineer Table. There is a function
> in the V3_MP Class delete cache but this function is protected.

the patch below will add the missing function.

Regards,
  Jochen

diff -u -r1.7 mp_v3.h
--- include/snmp_pp/mp_v3.h     26 Mar 2004 18:06:33 -0000      1.7
+++ include/snmp_pp/mp_v3.h     7 Aug 2005 18:06:46 -0000
@@ -197,6 +197,15 @@
                               const OctetStr &host, int port) const
     {  return engine_id_table.get_entry(engineID, host, port); };

+  /**
+   * Remove all entries from the engine id table.
+   *
+   * @return - SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR,
+   *           SNMPv3_MP_OK
+   */
+  int reset_engine_id_table()
+    {  return engine_id_table.reset(); };
+
   // ----------[ Access to status counters for agent++ ]--------------

   /**
@@ -400,6 +409,14 @@
      */
     int get_entry(OctetStr &engine_id, const OctetStr &host, int port)
const;

+    /**
+     * Remove all entries from the engine id table.
+     *
+     * @return - SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR,
+     *           SNMPv3_MP_OK
+     */
+    int reset();
+
   private:
     int initialize_table(const int size);

Index: src/mp_v3.cpp
===================================================================
RCS file: /home/cvs/SNMP_PP/src/mp_v3.cpp,v
retrieving revision 1.13
diff -u -r1.13 mp_v3.cpp
--- src/mp_v3.cpp       2 Jul 2005 14:45:20 -0000       1.13
+++ src/mp_v3.cpp       7 Aug 2005 18:06:50 -0000
@@ -177,6 +177,17 @@
   return SNMPv3_MP_OK;
 }

+// Remove all entries from the engine id table.
+int v3MP::EngineIdTable::reset()
+{
+  if (!table)
+    return SNMPv3_MP_NOT_INITIALIZED;
+
+  entries = 0;
+
+  return SNMPv3_MP_OK;
+}
+

 int v3MP::EngineIdTable::initialize_table(const int size)
 {



More information about the AGENTPP mailing list