On 11 January 2011 15:52, Abraham Varricatt
<[email protected]> wrote:

>  there is a function called "snmp_set_var_typed_value()"...... I've
> figured out that we essentially pass the result of a GET operation into this
> function, so the snmpd agent will report it back.

Correct.
The purpose of this routine is essentially:

    Here's a varbind structure - please set the type and value in it.


> Similarly, there is a function called "netsnmp_check_vb_type()" that is used
> to check the type of a SET operation

Correct.
Or more accurately, it checks the type of a particular varbind from
the SET request.
(Note that the first parameter to this routine is 'requests->requestvb')



> BUT, both these functions rely on a structure called "netsnmp_request_info".

This is a list of the varbind(s) that are relevant to this particular handler.
    (In this particular case of a scalar object, there will only ever be one
     varbind processed at a time, but table handlers may well receive a
     bundle of varbinds to process all together)

The main thing that you should be concerned with is the 'requestvb'
structure - this is the varbind from the incoming request.


> Is there any function in net-snmp that will let me extract the integer data
> value that comes with a SET operation out of this structure?

requests->requestvb  is the varbind structure (of type netsnmp_variable_list)
so the value is held in the (union) structure  requests->requestvb->val

So an integer value would be retrieved using

    long newval = *(requests->requestvb->val.integer);

OK?

Dave

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to