This is a discussion on TestAndIncr problem within the SNMP Users forums, part of the Networking and Network Related category; I'm trying to implement a TestAndIncr object as a column in table. This table as an OCTET STRING column, ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm trying to implement a TestAndIncr object as a column in table.
This table as an OCTET STRING column, and I want to be able to increment the TestAndIncr object, if the column name is updated. In an initial scenario, the table will be empty. I create a row using Snmpset ColumnName.1 s "Name 1" lockObject i 0. The lock object will be incremented to 1. So, if I want to update ColumnName.1, I should use : Snmpset ColumnName.1 s "Name 1 updated" lockObject i 1 I managed to implement this behavior, in the initial scenario the lockObject is incremented, but in the following updates the lockObject remains 1. The definition for the lock (it's a leaf in a table) is : lockObject OBJECT-TYPE SYNTAX TestAndIncr MAX-ACCESS read-create STATUS current I created the agent using the dataset helper and alter the table handler. In the MODE_SET_RESERVE1 I check if the value passed is equal to the one stored in the mib. In the MODE_SET_ACTION, I get the lockObject in the mib, increment it and store the value in the mib: setspinLock = *((long *) data->data.voidp); setspinLock++; *((long*)data->data.voidp) = setspinLock; This works fine the firs time. The following tries, the value isn't increased. I put a simple debug and it shows : In the first time : setspinLock : before increment: 0 setspinLock : after increment: 1 *((long*)data->data.voidp) = 1 In the next try: setspinLock : before increment: 1 setspinLock : after increment: 2 *((long*)data->data.voidp) = 2 But, if I do a snmpset to the lock object, the value returned is 1. Can you please tell what I'm doing wrong? Thank you all. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/...net-snmp-users |