thanks for your reply.

After looking at some sample code generated by mib2c i used following method 
to aceess tables with static data and no index storage in structure.

I changed only get first and get next data points.
index is used to store table index.In this case i have two indices.
This file is generated by mib2c using table iterator conf.
#################################################

extern CARD_ST cardst[20];

 int indexSLT[2];
 int *idxSLPtr;


 /*
  * Example iterator hook routines - using 'get_next' to do most of the work
  */
 netsnmp_variable_list *
 slotTable_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 *idx = put_index_data;

  indexSLT[0] = 0;
  indexSLT[1] = 0;

  idxSLPtr = indexSLT;

  snmp_set_var_typed_integer(idx, ASN_INTEGER, indexSLT[0] );
  idx = idx->next_variable;
  snmp_set_var_typed_integer(idx, ASN_INTEGER, indexSLT[1]);
  idx = idx->next_variable;

//  printf("\n ENTRY[%d] \n",*idxPtr);

  *my_data_context = (void *)&cardst[0];
  *my_loop_context = (void *)idxSLPtr;


  return put_index_data;

//  return slotTable_get_next_data_point(my_loop_context, my_data_context,
//            put_index_data, mydata);
 }

 netsnmp_variable_list *
 slotTable_get_next_data_point(void **my_loop_context,
          void **my_data_context,
          netsnmp_variable_list * put_index_data,
          netsnmp_iterator_info *mydata)
 {
  int *entry =
   (int *) *my_loop_context;
  netsnmp_variable_list *idx = put_index_data;

  if (entry) {
  entry[1]++;
  if((entry[1])>=10)
  {
   entry[0]++;
   if(entry[0] >= 20)
    return NULL;
   entry[1] = 0;
  }

   snmp_set_var_typed_integer(idx, ASN_INTEGER, entry[0]);
   idx = idx->next_variable;
   snmp_set_var_typed_integer(idx, ASN_INTEGER,entry[1]);
   idx = idx->next_variable;

   *my_data_context = (void *) &cardst[entry[1]];
   *my_loop_context = (void *) entry;
   return put_index_data;
  } else {
   return NULL;
  }
 }

#################################################

It help others also.

Parveen Yadav

----- Original Message ----- 
From: "Wes Hardaker" <[EMAIL PROTECTED]>
To: "Parveen Yadav" <[EMAIL PROTECTED]>
Cc: "SNMP USERS" <[email protected]>
Sent: Tuesday, December 09, 2008 8:26 PM
Subject: Re: Need Help


>>>>>> On Fri, 5 Dec 2008 13:09:03 +0530, "Parveen Yadav" 
>>>>>> <[EMAIL PROTECTED]> said:
>
> PY> I am new user to net-SNMP and i am trying to implement new tables in
> PY> code.My data is in shared space and in the form of static structure.
> PY> Can somebody provide some examples of using integer index as
> PY> my_loop_context pointer.
>
> There are some examples in the code you may look at.  You might try
> looking at agent/mibgroup/examples/netSnmpHostsTable_access.c which
> doesn't use an integer but may help you anyway.
> -- 
> Wes Hardaker
> Sparta, Inc.
>
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, 
> Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________
> 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
> 


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
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

Reply via email to