Is there someone who can help Peilong? It has been years
since I worked with this level of detail on net-snmp, so I
directed him to this list.

Basically, he has an ordered list of data structures from
which he can retrieve data for his table entries. The index
is in the data structure itself and he can request the next
one, in order.

Is raw-table.conf the appropriate mib2c config?

Thanks for your help!

--mrt

From: Peilong Xia [mailto:x...@broadcom.com]
Sent: Thursday, June 13, 2013 7:09 PM
To: net-snmp-users@lists.sourceforge.net
Subject: Is there an example of how to implement get_next_entry of raw-table 
generated c file?


I used mib2c.raw-table.conf to generate c file.
But I don't know how to implement the get_next_entry() in the generated c file.
Actually, I don't know how to "Use the 'indexes' parameter to identify the next 
row in the table" and how to "update the 'indexes' parameter with the 
appropriate index values ..."
I searched both in the net-snmp source code, and on internet, and couldn't find 
an example about it.

The following is the generated code:
/** determine the appropriate row for an fuzzy request */
static struct myTable_entry *
myTable_get_next_entry( netsnmp_handler_registration *reginfo,
                     netsnmp_request_info         *request,
                     int                           column,
                     netsnmp_variable_list        *indexes ) {
    struct myTable_entry *row = NULL;
    oid             build_space[MAX_OID_LEN];
    size_t          build_space_len = 0;
    size_t          index_oid_len = 0;


    /* XXX - Use the 'indexes' parameter to identify the
             next row in the table.... */



    /* XXX   .... update the 'indexes' parameter with the
             appropriate index values ... */

    /* ... and update the requested OID to match this instance */
    memcpy(build_space, reginfo->rootoid,   /* registered oid */
                        reginfo->rootoid_len * sizeof(oid));
    build_space_len = reginfo->rootoid_len;
    build_space[build_space_len++] = 1;  /* entry */
    build_space[build_space_len++] = column; /* column */
    build_oid_noalloc(build_space + build_space_len,
                      MAX_OID_LEN - build_space_len, &index_oid_len,
                      NULL, 0, indexes);
    snmp_set_var_objid(request->requestvb, build_space,
                       build_space_len + index_oid_len);

    /*  Finally, return the data structure for this row */
    return row;
}

Could anyone proved a simple example of it?

Thanks a lot!

Best Regards,
Peilong

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
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