On Mon, 22 Nov 2004 23:17:13 +0000 Dave wrote:
DS> Yup, it's your nightmare scenario - I'm finally looking seriously at
DS> the MfD helper :-)
Aaaaaaauuuuuuugggggghhhhhhh! Why does everyone want to poke at it and find bugs
now that we're frozen!?!?
<heave breathing into a paper bag>
DS> The first problem I ran into is that the 'myTable_interface.c' file
DS> refers to routines 'myTable_undo_setup' and 'myTable_undo_cleanup',
DS> which are not defined anywhere in the generated template code. Are these
DS> routines something I should define myself, or is this an error in the
DS> config? If it's up to me to define them, what should they contain?
This has already been reported, and fixed in cvs. Two options here:
1) set m2c_data_init to 1 in default-table-xyzTable.m2d
2) Apply the patch I sent on the 17th (Re: mtb and snmpwalk problems (bugs?))
Then regenerate.
DS> The second place where this code failed to compile was in the
DS> 'myTable_cache_load' routine. This seems to refer to various local
DS> variables that weren't actually declared for some (but not all) of the
DS> column object fields.
Hmm.. that's not good. Can you send me your test MIB?
DS> I'm probably rather confused over what is meant
DS> to be ready-to-go code, and what is template code that I need to change.
Oh bother. I thought I had done pretty well with the comments. Maybe not would
be a good time to link in the tutorial to the main tutorial page. Take a gander
at it and see if it helps.
http://www.net-snmp.org/tutorial/tutorial-5/toolkit/mfd/
If you didn't disable the example code, most of it gets bracketed in comments.
To get a pseudo-todo list, try this command in your source directory:
grep -n "TODO:" *.[ch] | sed 's/\([^ ]*\) \(.*\)TODO\(.*\)/\3 (\1)/' | sort -n
Key:
:o: Optional
:r: Recommended
:M: Mandatory
:A: Advanced users
DS> This may well be described in one of the README files, but I haven't
DS> managed to spot it - any chance of a nudge in the right direction?
It's probably not exactly what you are looking for, but check out the Function
Flow section of myTable-README-myTable.txt.
DS> I got things to compile by commenting out both of these chunks of code,
DS> so I've now got a basic table implementation that ought to work. But of
DS> course it's currently empty, and although I've got code to initialise a
DS> container-based table from the earlier examples, I'm not quite sure how
DS> to plug that into the new framework. Are there any examples of how to
DS> set up the initial contents of an MfD-based table?
Good question! I think all the tables I've done so far have been external data,
so I haven't had any initial data. Looks like I've painted myself into a bit of
a corner.. Two options:
1) in myTable_container_init, create your container instead of letting the
interface code do it for you. All you need is:
*container_ptr_ptr =
netsnmp_container_find("myTable:table_container");
Then you can insert rows to you hearts content.
2) put a function in myTable_interface.c to return the container from
myTable_if_ctx.container. This could be called from data_init.
3) in interface.c, move the call to container_init before the call to
data_init, and add the container as a parameter.
Not sure which would be the right fix. Probably 3, but I seem to recall already
switching the order once... if I could just remember why...
As for other examples, 'ls -d agent/mibgroup/*-mib/*Table'.
--
Robert Story; NET-SNMP Junkie
Support: <http://www.net-snmp.org/> <irc://irc.freenode.net/#net-snmp>
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-coders>
You are lost in a twisty maze of little standards, all different.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Net-snmp-coders mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders