
Henrik Nordberg writes:
Henrik> I tried looking at the documentation and searching the mailing Henrik> list but could not find the answer to this question: Is it Henrik> possible to use libsmi to get the name and description from an Henrik> OID (which is defined in a MIB that is present in the MIB Henrik> search path)?
You have to load the module first. Here is some example code:
#include <stdio.h> #include <smi.h>
int main() { int oid[] = {1,3,6,1,2,1,1,3}; SmiNode *smiNode;
smiInit(NULL); smiLoadModule("SNMPv2-MIB"); smiNode = smiGetNodeByOID(sizeof(oid)/sizeof(int), oid); if (smiNode && smiNode->name) { printf("%s\n", smiNode->name); }
smiExit(); return 0; }
Note that you can use the ~/.smirc file to preload modules in case you want to load many modules all the time.
Henrik> Thanks for any suggestions you might have. I am running on Henrik> Win2k and libsmi-0.3.1. I had to modify dump-scli.c to make it Henrik> compile, since msvc 6 does not have regexp.h.
There is already a patch for this regex problem in the CVS. Rather than adding a complete regex implementation to libsmi, we decided to just disable this option on boxes that lack regex.h.
/js