Re: [libsmi] smiLoadModule and smiInit

Hi!
Jochen> we try to use libsmi in future versions of GxSNMP and replace Jochen> the ancient related functions from CMU. Things look pretty Jochen> good so far :).
Fine. ;-)
Jochen> We want to have the possibility to configure which MIBs get Jochen> loaded by GxSNMP during startup.
Is this the management application project within the GNOME framework?
Jochen> One problem is that there is no way to override the compiled Jochen> in search path other than setting an environment variable Jochen> (GxSNMP might fork() from plugins and exec other programs whch Jochen> might be f'd by a changed SMIPATH). Would it be possible to Jochen> add a parameter to smiInit() to override the search path?
The smi.h File already contains two function declarations
extern int smiGetPath(const char *path);
extern int smiSetPath(const char *path);
(with wrong signatures ;-)) that are intended to allow an application to adjust the search path. Expect the implementation of these two functions to be implemented in the next release (probably, today or tomorrow).
Jochen> Another problem is that smiLoadModule always returns -1 when a Jochen> full path to a module is specified. The problem seems to be Jochen> that the path is not chopped off before verifying if the Jochen> module with the given name really has been loaded.
I'll check this...
Jochen> Last not least (for our MIB browser), is there an easy way to Jochen> walk though all nodes of the tree without using the data.h Jochen> internal header file?
Yes. BTW, an application shall never use the knowledge of data.h. It is not part of the API.
To get an understanding of how to retrieve definitions in a get-first/get-next style, please take a look at tools/dump-sming.c (or tools/dump-smi.c):
static void printObjects(char *modulename) { [...] SmiNode *smiNode;
for(smiNode = smiGetFirstNode(modulename, SMI_DECL_UNKNOWN); smiNode; smiNode = smiGetNextNode(smiNode, SMI_DECL_UNKNOWN)) {
[...]
} }
Note that this way to iterate through the node definitions of a module guaranties to retrieve the nodes in depth first order, not in the order they are defined in the module. This is convienent for most uses (like MIB browsers ;-)) and eliminates forward references where possible. With the second argument set to SMI_DECL_UNKNOWN, you'll retrieve any node definitions. You might also want to retrieve only a certain kind of nodes, e.g. notification types, by setting this to the appropriate value.
Frank -- !! This message is brought to you via the `libsmi' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to libsmi-request@ibr.cs.tu-bs.de. !! See http://www.ibr.cs.tu-bs.de/projects/libsmi/ for more information.

Hi Frank,
Jochen> We want to have the possibility to configure which MIBs get Jochen> loaded by GxSNMP during startup.
Is this the management application project within the GNOME framework?
Right. However, it hasn't reached 0.1.x, yet (current version is 0.0.11 or 0.0.pre-12 in CVS).
The smi.h File already contains two function declarations
extern int smiSetPath(const char *path);
That would do it :)
get-first/get-next style, please take a look at tools/dump-sming.c (or tools/dump-smi.c):
I'll give that a try.
Thanks, Jochen
-- !! This message is brought to you via the `libsmi' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to libsmi-request@ibr.cs.tu-bs.de. !! See http://www.ibr.cs.tu-bs.de/projects/libsmi/ for more information.
participants (2)
-
Frank Strauss
-
Jochen Friedrich