TestAndIncr problem

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, ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Users

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-18-2008
vsaavedra
 
Posts: n/a
Default TestAndIncr problem

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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:17 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0