On 22 June 2010 16:13, makkalot <makka...@gmail.com> wrote: > - Should i use mib2c ? > is that the easiest way to go when creating new modules ?
It's probably the easiest way to get started, yes. > - How can i know which configuration(template) to use when using mib2c > , > is it documented somewhere ? Have a look at the FAQ entries What's the difference between the various mib2c configuration files? and Which mib2c configuration file should I use? > - I'm looking at agent/mibgroup/examples/netSnmpHostsTable.c and there > are a few things i dont undesrtand. I see cases like those : > > case MODE_GET: > case MODE_SET_RESERVE1: > case MODE_SET_RESERVE2: > case MODE_SET_ACTION: > case MODE_SET_COMMIT: > case MODE_SET_UNDO: > case MODE_SET_FREE: > > What should be done on each of them, GET is used to handle both GET, GETNEXT and GETBULK requests. Typically, the handler chain will take care of the "find the next row" aspect of processing GETNEXT and GETBULK requests, and convert these into the equivalent GET request internally. So the initial stage in implementing a MIB module is to forget about SET handling, and get the GET* stuff working first. Once you've got a read-only version of your module, then it's time to look at SET handling. The Net-SNMP agent uses a multi-pass approach, hence the various modes listed above. There's a description of these in the file "AGENT.txt" (section 8). This is actually discussing the older ucd-style form of coding, but the underlying multi-pass model is exactly the same. > - Also the documentation mentions that every request that comes/goes > enters into chain processing , what are the steps of that chain ? It depends on which mib2c template you use, and what type of objects you are implementing. Typically, for a table, the steps will be something like: - extract the index value(s) from the incoming request - identify which row(s) of the table are being referred to - retrieve (or update) the relevant columns from that row The last of these is typically handled by your MIB module handler. > And how can i inject my code into it ? This is done when you register your handler. The various "netsnmp_register_xxx()' routines will look after constructing the appropriate chain for that style of code. > (or is it the same of what handlers do ? ) The chain is a chain of handlers, yes. Most of these will be "helper handlers", which culminate in your MIB-specific handler. Dave ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders