Multiple table OID request failure continued

"Greg L Robillard" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <002001c6bc14$7b06f860$0200a8c0@Greg>
Earlier I sent the initialization file, here is the handler and the for loop that is not looping.  I have upgraded the net-snmp to 5.3.1.  After looking at the debug, I have seen that the varBind is being created correctly.

Anyway, here is the handler.

int
commBaseStatsEntryTable_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_variable_list *var;
        static long value;
        unsigned int index;
        static unsigned char string[SPRINT_MAX_LEN];
        unsigned char debug_string[SPRINT_MAX_LEN];
        uint data_type = ASN_INTEGER;

        for (request = requests; request; request = request->next)
        {
                var = request->requestvb;

                if (request->processed != 0)
                        continue;
table_info = netsnmp_extract_table_info(request);
                index = *(table_info->indexes->val.integer);

                if(table_info == NULL)
                        continue;

              if((reqinfo->mode == MODE_GET) || (reqinfo->mode == MODE_GETNEXT))
                {
                   if(reqinfo->mode == MODE_GETNEXT)
                     index++;

                       switch(table_info->colnum)
                        {

                                case COLUMN_COMMBASESTATSENTRYINDEX:
                                        //if (getSensorStatsIndex(&value, index) < 0)
                                        //  value =  snmp_agent_common__BAD_APPL_IDX;
                                        getSensorStatsIndex(&value, index);
                                        data_type = ASN_INTEGER;
                                        break;
.....
.....
.....
.....
.....

 } // End switch

                        //check the value returned for errors

                        if(value != snmp_agent_common__BAD_APPL_IDX)
                        {
                          if ( data_type == ASN_OCTET_STR )
                              snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) string, strlen(string));
                          else if ( data_type == ASN_COUNTER )
                             snmp_set_var_typed_value(var, ASN_COUNTER, (u_char *) &value, sizeof(value));
                          else if ( data_type == ASN_INTEGER )
                            snmp_set_var_typed_value(var, ASN_INTEGER, (u_char *) &value, sizeof(value));
                          else
                            snmp_set_var_typed_value(var, ASN_NULL, (u_char *)SNMP_NOSUCHINSTANCE, 0);
                        }
                        else
                          snmp_set_var_typed_value(var, ASN_NULL, (u_char *)SNMP_NOSUCHINSTANCE, 0);
                 else
                 {
                   if(MODE_IS_SET(reqinfo->mode))
                        snmp_set_var_typed_value(var,ASN_NULL, (u_char *)SNMP_ERR_NOTWRITABLE,0);
                 } // END i(reqinfo->mode == MODE_GET) || (reqinfo->mode == MODE_GETNEXT)
        } // END FOR

  return SNMP_ERR_NOERROR;
}

Thanks if advance, I hope this is enough info.  I can't see any errors being created, except the for loop doesn't loop and the output for multiple values is always the index value.

Help

Greg L Robillard

-------------------------------------------------------------------------
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
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.