smi_module(3)

✨ smi_module β€” SMI module info routines ✨

okay bestie, so this is smi_module(3) from the SMI Management Information Library (that's the manual name, iykyk 🫢). It's the whole squad of functions that go digging through MIB modules and hand you back all the meta info. no cap.


🌸 NAME 🌸

smiGetModule, smiGetFirstModule, smiGetNextModule, smiGetModuleIdentityNode, smiGetFirstImport, smiGetNextImport, smiIsImported, smiGetFirstRevision, smiGetNextRevision β€” the SMI module information routines πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <time.h>
#include <smi.h>

SmiModule *smiGetModule(char *module);

SmiModule *smiGetFirstModule();

SmiModule *smiGetNextModule(SmiModule *smiModulePtr);

SmiNode *smiGetModuleIdentityNode(SmiModule *smiModulePtr);

SmiImport *smiGetFirstImport(SmiModule *smiModulePtr);

SmiImport *smiGetNextImport(SmiImport *smiImportPtr);

int smiIsImported(SmiModule *smiModulePtr, SmiModule *importedModulePtr, char *importedName);

SmiRevision *smiGetFirstRevision(SmiModule *smiModulePtr);

SmiRevision *smiGetNextRevision(SmiRevision *smiRevisionPtr);

typedef struct SmiModule {
    SmiIdentifier       name;
    char                *path;
    char                *organization;
    char                *contactinfo;
    char                *description;
    char                *reference;
    SmiLanguage         language;
    int                 conformance;
} SmiModule;

typedef struct SmiRevision {
    time_t              date;
    char                *description;
} SmiRevision;

typedef struct SmiImport {
    SmiIdentifier       module;
    SmiIdentifier       name;
} SmiImport;

like, look at all those structs. gorgeous. iconic. 😌


πŸ’– DESCRIPTION πŸ’–

So these functions pull up all kinds of meta info about MIB modules. and if you're looking for the functions that get you the actual definitions inside a module, those live over in smi_type(3), smi_node(3), and smi_macro(3) β€” go check those out too, bestie πŸ¦‹

  • smiGetModule() β€” hands you a struct SmiModule that represents the SMI module named module. Anything that's not available or not present for that module is just NULL. and if the module isn't found at all? smiGetModule() returns NULL. periodt. πŸ’€
  • smiGetFirstModule() and smiGetNextModule() β€” these two are a duo, they let you loop through struct SmiModules of every known module, one by one. smiGetFirstModule() gives you the first known module, and then every call to smiGetNextModule() after that gives you the next one. when there's nothing left? NULL. that's it, that's the end of the list 🌈
  • smiGetModuleIdentityNode() β€” returns a struct SmiNode representing the node used to identify the containing MIB module specified by smiModulePtr. but lowkey if there's no such identity node β€” like if this isn't an SMIv2 module or an SMIng module converted from SMIv2 β€” you get NULL. πŸ™ˆ
  • smiGetFirstImport() and smiGetNextImport() β€” iterative besties for struct SmiImports of a given module. smiGetFirstImport() returns the first identifier imported by the module specified by smiModulePtr, then each smiGetNextImport() call returns the next one. no more imported identifiers? NULL. simple as πŸ’…
  • smiIsImported() β€” returns a positive value if the identifier importedName, defined in the module specified by importedModulePtr, is imported in the module specified by smiModulePtr. otherwise it returns zero. yes bestie, it's giving "are they imported or not" energy ✨
  • smiGetFirstRevision() and smiGetNextRevision() β€” another iteration duo, this time for struct SmiRevisions of a given module. smiGetFirstRevision() returns the first revision info β€” and yes, "first" here means most recent β€” of the module specified by smiModulePtr. then subsequent smiGetNextRevision() calls return the revision after that one (i.e. timely before it, going backwards in time πŸ•°οΈ). when there are no more revisions, NULL. mwah. πŸ‘‘

πŸ“ FILES πŸ“

  • ${prefix}/include/smi.h β€” the SMI library header file πŸ“

🧚 SEE ALSO 🧚

libsmi(3), smi_config(3), smi_node(3), smi.h β€” go read these next, bestie, they're the rest of the lore 🌸


πŸ‘‘ AUTHOR πŸ‘‘

(C) 1999-2001 Frank Strauss, TU Braunschweig, Germany
<strauss@ibr.cs.tu-bs.de>

and that's the whole page, angel πŸ’œ this little masterpiece came from IBR, dated August 16, 2001, and it's smi_module(3) β€” go forth and slay your MIB modules fr fr πŸ’–βœ¨πŸŽ€