An additional question. Consider the following code:

netsnmp_variable_list *moTable_get_next_data_point(void **my_loop_context, void **my_data_context,
                         netsnmp_variable_list *put_index_data,
                         netsnmp_iterator_info *mydata)
{
    netsnmp_variable_list *vptr;

        struct moTable_entry *entry;
        entry = (struct moTable_entry*)(*my_loop_context);
       
        if (entry == NULL) {
            ...
        }
       
        entry = entry->next;
        *my_loop_context = (void*)entry;
        *my_data_context = (void*)entry;
       
    vptr = put_index_data;

        // End of table
        if (entry == NULL) {
            snmp_set_var_value(vptr, (u_char *) NULL, 0);
            vptr = vptr->next_variable;
            return put_index_data;
        }


        snmp_set_var_value(vptr, (u_char *) &entry->moIndex, sizeof(entry->moIndex));
        vptr = vptr->next_variable;

      return put_index_data;
}


In the "End of table" code portion, how should the function return(the iterator should end, no more entries are available)? My .so is crashing snmpd...
Thanks,
    Sebastian-


Sebastian Bello escribió:
Thanks Dave!

Dave Shield escribió:
  
On 07/09/06, Sebastian Bello <[EMAIL PROTECTED]> wrote:
    
1- the data from the MIB table will be collected periodically from other
processes, and be probably cached for some time; is table_iterator the
right choice?
      
It can certainly be used that way.

   mib2c -S cache=1 -c mib2c.iterator.conf ...

should generate a suitable template.


    
2- mib2c created a list representing the table. Will net-snmp browse
this table to look for the data or should the data be obtained from
another source (programatically or from another data structure)?
      
The template code generated will walk this list.
You can set the cache_load routine to build it from some external source.

Alternatively, you can amend the get_{first,next} routines to read the
data from elsewhere instead.  That list is primarily to illustrate how
to handle things, rather than forcing you to work this exact way.



    
3- where is the 'data context' stored (I don't see where it gets
'registered')? What is it for (to be able to keep an additional data
structure other than the table itself)?
      
The data_context is your handle on a particular row of the table.
This is what's passed to the handler routine (via
'netsnmp_extract_iterator_context')
Your haqndler then uses this to retrieve the appropriate column value
from that particular row.



    
4- what information does the 'netsnmp_variable_list' hold in
'_get_next_data_point' and '_get_first_data_point'?
      
The index value(s) for each row in turn.


    
5- is there a full documentation for the API (is there doc for
'snmp_set_var_typed_value' for example)?
      
Probably not.
There's some info on the project web pages  (Documentation->API),
auto-generated from the code files.  Not sure that this counts as
"full documentation" though.

Dave

    

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
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

  
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
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