2

I want to update my subagent's tables upon a GETBULK request without having to update for every internal GETNEXT request.

mib2c generated the following handler for GET requests - how can I set up a handler within the subagent to perform updates upon GETBULKs specifically?

int
table_handler(netsnmp_mib_handler *handler,
                           netsnmp_handler_registration *reginfo,
                           netsnmp_agent_request_info *reqinfo,
                           netsnmp_request_info *requests)
{

netsnmp_request_info *request;
netsnmp_table_request_info *table_info;
netsnmp_tdata  *table_data;
netsnmp_tdata_row *table_row;
struct table_entry *table_entry;
int             ret;
switch (reqinfo->mode) {
    /*                                                                                                                                                                                                          
     * Read-support (also covers GetNext requests)                                                                                                                                                              
     */
case MODE_GET:
  for (request = requests; request; request = request->next) {
        table_entry = (struct table_entry *)
            netsnmp_tdata_extract_entry(request);
        table_info = netsnmp_extract_table_info(request);

        switch (table_info->colnum) {
        case COLUMN_NAMESERVER:
            .
            .
            .
       case COLUMN_NAMESERVERPORT:
            .
            .
            .
        default:
            .
            .
            .
        }
Bubbles
  • 466
  • 4
  • 17

1 Answers1

1

I update my Net-SNMP cache based on time, not on a getbulk event in my data_access.h:

#define LINKTABLE_CACHE_TIMEOUT   10 //waits 10 seconds to load data

I think what you want to do is access the same functions, but invoke them on a getbulk event. Read the cache_handler functions to see if you can do it using those: SNMP Dev API

EhevuTov
  • 20,205
  • 16
  • 66
  • 71