Ok, so I need to use the same index for Table2 as I used in Table1, but I do 
not know how to actually do this?

Here is what I am doing to create Table1 currently. 

In the "container_load()" routine I perform the following steps to populate all 
requried indices in the ocStbHostAVInterfaceTable:


1) Obtain a unique NetSNMP index:

   ocStbHostAVInterfaceIndex = 
se_find_free_value_in_slist("ocStbHostAVInterface")

   Note: The "ocStbHostAVInterface" input parameter is a unique text string 
which I made up.


2) Indicate the index has been reserved for the ocStbHostAVInterface table: 

   se_add_pair_to_slist("ocStbHostAVInterface", strdup(<uniqueTextString>), 
ocStbHostAVInterfaceIndex)

   Note: The index (ocStbHostAVInterfaceIndex) is associated with a 
<uniqueTextString> and then stored against the "ocStbHostAVInterface" table


3) Allocate new a row for the table:

   rowreq_ctx = ocStbHostAVInterfaceTable_allocate_rowreq_ctx(NULL);


4) Store the index into the row:

   ocStbHostAVInterfaceTable_indexes_set(rowreq_ctx, ocStbHostAVInterfaceIndex)


5) Populate the rest of the data table fields now for Table1:

   ocStbHostAVInterfaceIndex  = <populated previously in Step 1 above>
   ocStbHostAVInterfaceType   = <set to the appropriate enum value type>
   ocStbHostAVInterfaceDesc   = <set to the unique interface description text>
   ocStbHostAVInterfaceStatus = <set to "enable" or "disable">


The four steps above are used to define each required row in the table with a 
unique index.  For example, if there are 20 "AVInterfaces" required, then there 
will be 20 rows in the table.


Now, it is time to create Table2.   

Inside the "container_load()" routine of Table2, I do not believe I want to 
perform any of the 4 steps above, since I do not want to generate a new index 
or new row for Table2 entries .... correct?   

If no new index and no new row should be created for Table2, then I am not sure 
how to obtain the internal NetSNMP index (ie: ocStbHostAVInterfaceIndex) 
previously generated and stored for Table1.  

Is there a way in which I could loop through all rows of Table1?  If so, then I 
could loop through each row of Table1 to find which "ocStbHostAVInterfaceType" 
fields are set to the "1394" interface enum (since Table2 is only related to 
"1394" interface data).  

Now, lets pretend I find that "row2" and "row4" of Table1 have an interface 
type of "1394" somehow.  I would not be sure what I need to do with index 2 and 
4 in order to populate Table2.  Basically, if I find the index from Table1 
which is related to my Table2 row data, I still have no idea how to populate 
the Table2 data.  I can not store Table2 data fields into the rows defined for 
Table1 since the row defined for Table1 does not include the Table2 fields.  
The row definition for Table1 only has four fields in it:

   ocStbHostAVInterfaceIndex 
   ocStbHostAVInterfaceType  
   ocStbHostAVInterfaceDesc  
   ocStbHostAVInterfaceStatus



So, if I can somehow determine which row index from Table1 is the index I need 
to use Table2, then I still have no idea how to actually use the index for 
popultaing Table2 once I have it?  Is there some special routine I need to call 
from within the "container_load()" procedure which will link that particular 
index to Table2 and Table1 somehow?

I am afraid you are going to say I need to wait for Robert to response, 
although I have never seen a Robert on the forum respond to any of my postings 
yet, so I might be stuck here and not understand how to proceed.

I never thought an SNMP table could be an extension of another table, so this 
is obviously causing me grief.

Thanks for all your help though .... much appreciated.



Dave Shield <[EMAIL PROTECTED]> wrote: On 31/05/07, Need Help  wrote:
> My biggest concern is whether I need to use an internal SNMP row index from
> Table1 to somehow populate stuff in Table2 within NetSNMP or whether I can
> simply start populating rows for Table2 with new row index values which have
> no relationship to Table1 at all.

If Table2 is meant to augment Table1 (either directly, or as a
table-in-a-table),
then the index values you use for Table2 must match those used for Table1.
The responsibility for doing this lies with the 'data_access' or
'load' routines.
As long as this is done, then the rest of the agent processing will work
correctly.



> Somehow I keep thinking there is this relationship between Table1 and Table2
> which needs to be maintained

Yes - this is done via the (shared) index values.

Imagine you have two children - in separate rooms, so that they can't
see or hear each other.  You stand in the corridoor between them, and
give each of them four cards.
The cards you give to the first child contain the numbers  7, 3, 5, and 6.
The cards you give to the second child contain the numbers  49, 9, 25 and 36.

If you ask the two children to both hold up the second card, then you'll
see that the square of 3 is 9,  and similarly for the other three cards.

The effect is that you have a single combined table, displaying the
squares of (selected) numbers.   But the individual tables [children]
don't know anything about this.   It only works because you gave the
two children the correct cards in the first place, and in the same order.
(i.e. with the same index values).

If you gave the children cards in a random order (i.e. with different
indexes), then you couldn't subsequently pull the information together.

The bottom line is that:
   - the code to populate the two tables, needs to know about the relationship.
   - the code to interpret the results, needs to know about the relationship.
   - the code to *implement* the tables, does not.


Does that make things any clearer?

Dave


 
---------------------------------
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to