Re: related tables design

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On 18/01/2008, Xuan Pan <[email protected]> wrote:
> I understand why I can implement two tables separately. I think I need two
> linked list for storing data from DHCP settings table and IP Range Table
> respectively.

Two (separate) linked lists would work.

Or you could hold the IP Range Table data for each DHCP pool as part
of the DHCP settings data structure:

   struct dhcpSetting {
       int      index;
       char *name;
       IPaddress  serverIP;
       int      status;

       struct ipRangeEntry *iprange;
       struct dhcpSetting *next;
   }

   struct ipRangeEntry {
        int index;
        IPaddress  startIP;
        IPaddress  endIP;

       struct ipRangeEntry *next;
    }


Or you could even let one of the agent helpers (e.g. table_tdata) hold
the list of entries rather than storing them yourself.

There's no One Right Answer.
A lot depends on how you want to use this information - is it just
the MIB code, or will you be doing other things as well?
How will you be tracking changes?  etc, etc.



> The question is how I parse multiple index values in the IP Range Table.


> int rowNumber;
   int dhcpSindex,  ipRangeIndex;

> netsnmp_request_info * pRequests; //from the argument of the handler
> pTableInfo = netsnmp_extract_table(pRequests);
> rowNumber = *(pTableInfo->indexes->val.integer);

   dhcpSindex = *(pTableInfo->indexes->val.integer);
   ipRangeIndex = *(pTableInfo->indexes->next->val.integer);


Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
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.