RE: Extending an Agent

"Mark Riehl" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <949FC6B65C66F542AC393DC95F2AE5D3067BCE@agiledc1.agilecommunications.com>
Dave - I tried to use the mib2c config file you suggested.  It generates a few
bugs in the c file that are pretty easy to see, others are a little more 
confusing.

For example, it generates the following function definition:

/*
 * create a new row in the table 
 */
struct jtrsMdlNeighborNodeTable_entry *
jtrsMdlNeighborNodeTable_createEntry(netsnmp_container * container,,
                                     long jtrsMdlChannelId,
                                     long jtrsNeighborNodeId)

Note the two commas in the argument list.

Inside the function, it generates the lines:

    entry->oid_index.len = XXX;
    entry->oid_index.oids = YYY;

Any ideas what XXX and YYY are supposed to be?  .len is supposed to be a u_short 
and YYY is a u_long *.


It also generates this block with a reference to a function:
netsnmp_container_table_extract()

    case MODE_SET_UNDO:
        for (request = requests; request; request = request->next) {
            container = netsnmp_container_table_extract(request);
            table_entry = (struct jtrsMdlNeighborNodeTable_entry *)
                netsnmp_container_table_extract_context(request);
            table_info = netsnmp_extract_table_info(request);

I can't find this defined, but I did find:
netsnmp_container_table_extract_context() - Is this what it was supposed
to be calling?  It doesn't seem to matter because *container is defined locally
in this function and isn't used after the above call.

In the initialize_table_jtrsMdlNeighborNodeTable function, I see a comment that 
says:
// Initialise the contents of the table here

I'm assuming I'll add my code here to set initial values for the table members.  It's 
a little unclear about how to do this.  Is the table data stored in the 
netsnmp_table_registration_info *table_info struct ptr?  I looked but
didn't see any example of how to do this.

Thanks for the help,
Mark







Thanks,
Mark

Mark Riehl
Agile Communications, Inc.
Email: [email protected]
Office: (732) 528-9305
Fax: (732) 528-9308
Cell: (732) 996-7630



-----Original Message-----
From: [email protected] on behalf of Dave Shield
Sent: Thu 5/10/2007 11:04 AM
To: Mark Riehl
Cc: [email protected]
Subject: Re: Extending an Agent
 
On 09/05/07, Mark Riehl <[email protected]> wrote:
>  Is the MfD the best config to use for this?

That probably depends who you ask.

I dislike the MfD framework myself, but I try not to let my personal
opinions colour the advice I give on the list.  Robert has put a lot
of work into this framework, and although I disagree with many of
the design decisions (not to mention the amount of code generated!),
there's a lot of good stuff there.

  My personal preference for implementing MIBs tends to be the
mib2c.container.conf framework.

But if all you want is a simple test module, and aren't really interested
in the internals, then you might like to take a look at the 'create-dataset'
template.
   This handles all of the table data internally, so you should be able
to populate and query it via SNMP queries, with minimal coding needed.
Just have a look through the init routine, and make sure the appropriate
flags are set to allow row creation, etc.

I wouldn't tend to use this for a "real" MIB module, monitoring some
underlying subsystem.  But it sounds ideal for your needs here.

Dave

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