Hi,
Greetings to everyone.

Regarding my project , i am using Net Snmp 5.3.0.1
I have generated the .c code by using mib2c tool with iterator conf  option.
The Snmp agent implement like that i wont have the data directly,it will be 
getting by other lower layers.

In the get_first and get_next routines, i am using position coount as my loop 
context.
Here with i have given the sample code for you reference.

The issue, i have faced, During getBulk query ,i have retrieved all the rows 
from the table e.g 40 rows.
After that, it will call netsnmp next table handler api.

Any one of you, help me to resolve this issue, so that during getbulk, it wont 
start call another table api.

Here is the sample code...

netsnmp_variable_list *
ontEqpmtTable_get_first_data_point(void **my_loop_context,
                          void **my_data_context,
                          netsnmp_variable_list *put_index_data,
                          netsnmp_iterator_info *mydata)
{     
    netsnmp_variable_list *vptr;
    ontEqpmtTableEntry* myEntry;
        
    /* We use the positinonal count as our loop context */
    int *position = (int*)malloc(sizeof(int));
    *position = 0;


    *my_loop_context = position /** XXX */ ;

    myEntry = getEqpmtOntIndex();

    *my_data_context = (void *)&myEntry[*position] /** XXX */ ;

    vptr = put_index_data;

    snmp_set_var_value(vptr, (u_char *)&myEntry[*position].ontID,
                      sizeof(&myEntry[*position].ontID));
        
    vptr = vptr->next_variable;

    return put_index_data;
}


netsnmp_variable_list *
ontEqpmtTable_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;
   ontEqpmtTableEntry *myEntry;

    int *position = (int *) *my_loop_context;

    /* make sure we were called correctly */
    if (!position)
        return NULL;

    /* go to the next route in the list */
    (*position)++;

        printf("Value of position = %d\n",*position);
        /* change for no of rows.....*/
    /* Are we beyond the end? */
    if (*position > 32 )  
    {
        
        
        /* End of routes.  stop here by returning NULL */
        SNMP_FREE(position);
        *my_loop_context = NULL;
        *my_data_context = NULL;
        free(Eqpmtentry);
        return NULL;
    }

    *my_loop_context = position /** XXX */ ;

      myEntry = getEqpmtOntIndex();

    *my_data_context = (void *)&myEntry[*position] /** XXX */ ;

      vptr = put_index_data;

      snmp_set_var_value(vptr, (u_char *)&myEntry[*position].ontID,
                      sizeof(&myEntry[*position].ontID));
          
    vptr = vptr->next_variable;

    return put_index_data;
}








With thanks and Regards,
D.SenthilNathan



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to