Re: netsnmp_create_handler_registration

Wes Hardaker <[email protected]>
Newsgroups gmane.network.net-snmp.user
Organization Sparta
Message-ID <[email protected]>
>>>>> On Sat, 3 Jan 2009 15:33:51 +0200, "Nikos Balkanas" <[email protected]> said:

NB> During a SET operation the custom handler will be called 4 times, 2
NB> with old values and 2 with new ones (Reserve1, Reserve2, Action,
NB> Commit).

The values in the varbinds are always the new ones (IE, the ones from
the SET packet).

NB> If the same handler is used also for GET operations
NB> (HANDLER_CAN_RWRITE) will be called once only (let's call it
NB> Reserve1).

It's called GET actually :-)

NB> How can one distinguish between GET and SET calls?

The reqinfo->mode variable will be set to one of (snmp_agent.h):

#define MODE_GET              SNMP_MSG_GET
#define MODE_GETNEXT          SNMP_MSG_GETNEXT
#define MODE_GETBULK          SNMP_MSG_GETBULK
#define MODE_GET_STASH        SNMP_MSG_INTERNAL_GET_STASH

#define MODE_SET_BEGIN        SNMP_MSG_INTERNAL_SET_BEGIN
#define MODE_SET_RESERVE1     SNMP_MSG_INTERNAL_SET_RESERVE1
#define MODE_SET_RESERVE2     SNMP_MSG_INTERNAL_SET_RESERVE2
#define MODE_SET_ACTION       SNMP_MSG_INTERNAL_SET_ACTION
#define MODE_SET_COMMIT       SNMP_MSG_INTERNAL_SET_COMMIT
#define MODE_SET_FREE         SNMP_MSG_INTERNAL_SET_FREE
#define MODE_SET_UNDO         SNMP_MSG_INTERNAL_SET_UNDO

There is even a MODE_IS_GET(x) macro that tells you if the incoming mode
is a GET type vs a SET type operation.


-- 
Wes Hardaker
Sparta, Inc.

------------------------------------------------------------------------------
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.