Re: netsnmp_tdata * table_data structure

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
2008/7/17 Richard Horton <[email protected]>:
> What I can't find documented inside net-snmp either online or in code
> is how to populate the table_data part of the call with the
> information I wish to add prior to calling *_createEntry.

You don't.
The 'table_data' structure is a black-box, containing the overall
table.   You shouldn't meddle with it.


> For instance my table is made up as follows (for the sake of brevity
> I've trimmed the common prefix):-
>
> tableIndex  -- Integer with a range of 0 to 255
> name          -- String - 0 to 255 characters long
> ifName        -- String - 0 to 255 characters long
> state           -- integer - range of 0 to 3.
>
> I'd like to pre-populate a few rows of the table on startup with some
> default names etc...

Having created and registered the table, you can then invoke
the 'createEntry' routine as many times as is required, giving
the index of each of the initial rows.

  This call will pass back an empty row structure, which you
can then populate with the name/ifName/state/etc

I.e.

     netsnmp_tdata_row *row;
     struct myTable_row *entry;

     row = myTable_createEntry( table_data,  1 );
     entry = (struct myTable_row *)row->data;
     entry->name = "row 1"
     entry->ifName = "eth0";
     entry->status = UNKNOWN;

     row = myTable_createEntry( table_data,  2 );
     entry = (struct myTable_row *)row->data;
     entry->name = "row 2"
     entry->ifName = "eth1";
     entry->status = IMAGINARY;

etc

Dave

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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.