On 29 May 2012 18:17, Magda Stefan <fane...@yahoo.com> wrote:
>     I chose to use a table for my data because the agent that I am making
> has to run on multiples computers, some of them having multiple interfaces.
> That's why my netSnmpPrvIndex is actually ifIndex (from ifTable). On the
> first column I have the local address, an on the others I will have the data
> that I  will collect from multiple files. The program that I'm using
> generates 2 files for each interface (each file starts with the name of the
> interface).

OK - so you'll have multiple files (one pair per row of the table),
rather than multiple lines in a single (pair of) files.
Yes - that should work OK.



>     I'm sorry and ashamed to say this but I don't know how to populate the
> row table (witch I guess is 'this') with the column values,

There's nothing wrong with needing to ask how to do something,
or asking about the details of a particular task.
  The thing that gets me annoyed is when people don't even make
the attempt, and seem to expect us to write the whole thing for them!

Looking at the code fragment you posted yesterday,  the basic idea
is correct.   It's just that you're setting up the contents of the row
*before* creating it.

The call to
     netSnmpPrvTable_createEntry( table, 1 );

will return the data structure for that row.
This structure is called 'this' in the generated code,
and 'row' in the example you seem to be looking at.
The 'entry' field is already set up (as 'row->data')
so you simply populate that -  just as you did before,
but *after* the call to create the entry, not before.

i.e. something like:

     this = netSnmpPrvTable_createEntry(table, 1);  // Note - pass the
index value here
     if ( this && this->data ) {
         entry = this->data;
         strcpy(entry->netSnmpPrvOWD,"1234");
         entry->netSnmpPrvOWD_len=4;
         strcpy(entry->netSnmpPrvOWD,"4321");
         entry->netSnmpPrvOWD_len=4;
    }

(though that second pair should probably be netSnmpPrvATR!)


Do you follow what's happening here?

Dave

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to