Double Index tables

"vsaavedra" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hi to all! 

This is my first post here!

 

I'm trying to implement a netsnmp subagent, and I'm having some problems.

I have two tables :

 

-         applicationTypeTable

-         applicationTable

 

The applicationTypeTable has one index: applicationTypeIndex

The applicationTable is indexed by (applicationTypeIndex, applicationIndex)

 

In my netsnmp subagent code, I have an array to store applicationTypeTable data, and and double index array to store applicationTable.

 

I managed to retrieve the data from  applicationTypeTable successfully with this code:

 

u_char *var_table_app_type(struct variable *vp, oid * name, size_t * length, int exact,

                    size_t * var_len, WriteMethod ** write_method)

{

   if (header_simple_table

         (vp, name, length, exact, var_len, write_method, col_size[vp->magic]))

         return (NULL);

 

   int idx = name[*length-1];   ret = NULL;  *write_method        = 0;   u_char * ret;

 

   switch (vp->magic)

   {

      case _APPLICATION_TYPE_IDX : //_APPLICATION_TYPE_IDX

                pos = _APPLICATION_TYPE_IDX;

                *write_method = write_AppTypeTable;

                ret =  (u_char *) & applicationTypeTable[idx].applicationTypeIDX;

                break;

 

      case  _APPLICATION_TYPE_NAME : // _APPLICATION_TYPE_NAME

                pos = _APPLICATION_TYPE_NAME;

                *var_len = strlen((char *)applicationTypeTable[idx].applicationTypeNAME);

                *write_method = write_AppTypeTable;

                ret =  (u_char *) & applicationTypeTable[idx].applicationTypeNAME;

                break;

   }

 

   return ret;

}

 

 

So, to get the data from applicationTypeTable, I get the index with the name[*length-1];   

 

My main question is : 

 

In my function u_char *var_table_XXX() , how can I retrieve the first and second indexes of the table  applicationTable ?

 

 

I tried to use (13 and 14 are the positions of the applicationTypeIndex and applicationIndex):

 

  idx_app_type         = name[13];  

  idx_app                  = name[14];

 

 This works for direct GET commands, but doesn't work for GETBULK commands.

 

Can anyone clarify me ?

 

Thanks in advance!

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
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.