On Fri, 2005-12-02 at 15:47 -0800, manik chopra wrote: 
> Following is a sample of my sub-agent stub file:
> 
> unsigned char *var_fnc()
> {
>     my_struct *p;
> 
>     header_simple_table(........)
>      {    }

I trust you're actually checking the return value of this
routine, to tell whether to continue processing or not?


>     if ( fnc(p->value)  < 0)
>     {    return NULL;    }

How is 'p' being initialised?
I'd expect you to extract the index from the OID returned
by 'header_simple_table', and use this to select the
appropriate row of the table.

But you don't show any of this code.



>  If "( fnc(p->value)  < 0)" for 1st node, the function returns null
> and never checks 2nd and the 3rd node for "( fnc(p->value)  < 0)". 

See above.
How is 'p' set?


> In my case "( fnc(p->value)" will be "> 0" only at the 3rd node. but
> at present if "( fnc(p->value)  < 0)" for 1st node, "*var_fnc()" is
> never called again.

Then I'm not quite sure why you are using this particular test?

The 'var_fnc' routine will be called *once* to process *one*
varbind. The utility routine 'header_simple_table' will validate
the request (and update the OID for a GETNEXT request).

Then it's up to you to locate the row that's being asked for,
and return the appropriate column value.   If you're asked
for a value from the first row, that's what you should return.
If you're asked for a value from the third row, then that's
what you should return.  If you're asked for a value from the
fourth row, then you should return NULL.


With the limited code that you've shown us, it's impossible to
provide any more detailed advice.

Dave 


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
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/listinfo/net-snmp-users

Reply via email to