smi_type(3)
β¨ smi_type β SMI type information routines β¨
okay bestie, sit DOWN because this is the smi_type(3) page from the SMI Management Information Library and it's literally all about getting your type info out of SMI modules π
πΈ NAME πΈ
smiGetType, smiGetFirstType, smiGetNextType, smiGetParentType, smiGetTypeLine, smiGetFirstRange, smiGetNextRange, smiGetFirstNamedNumber, smiGetNextNamedNumber, smiGetTypeModule β the SMI type information routines, aka the whole girl squad that hands you type data π
π SYNOPSIS π
#include <smi.h>
SmiType *smiGetType(SmiModule *smiModulePtr, char *type);
SmiType *smiGetFirstType(SmiModule *smiModulePtr);
SmiType *smiGetNextType(SmiType *smiTypePtr);
SmiType *smiGetParentType(SmiType *smiTypePtr);
int smiGetTypeLine(SmiType *smiTypePtr);
SmiRange *smiGetFirstRange(SmiType *smiTypePtr);
SmiRange *smiGetNextRange(SmiRange *smiRangePtr);
SmiNamedNumber *smiGetFirstNamedNumber(SmiType *smiTypePtr);
SmiNamedNumber *smiGetNextNamedNumber(SmiNamedNumber *smiNamedNumberPtr);
SmiModule *smiGetTypeModule(SmiType *smiTypePtr);
typedef struct SmiType {
SmiIdentifier name;
SmiBasetype basetype;
SmiDecl decl;
char *format;
SmiValue value;
char *units;
SmiStatus status;
char *description;
char *reference;
} SmiType;
typedef struct SmiNamedNumber {
SmiIdentifier name;
SmiValue value;
} SmiNamedNumber;
typedef struct SmiRange {
SmiValue minValue;
SmiValue maxValue;
} SmiRange;
π¦ DESCRIPTION π¦
These functions pull information about a type definition (SMIng) or a simple ASN.1 type definition (SMIv1/v2) or a TEXTUAL-CONVENTION definition (SMIv2). and yes, base types can get retrieved by these too, no cap π
π smiGetType()
grabs you a struct SmiType that represents a type. type can be either a fully qualified descriptor OR just a simple type name, either one is fine bestie π«Ά
If smiModulePtr is not NULL it gets used to limit the search to that given module. and if the type is nowhere to be found? smiGetType() returns NULL. tragic. π
π smiGetFirstType() and smiGetNextType()
the iteration duo!! they walk through struct SmiTypes one at a time.
smiGetFirstType()returns the first one defined in the module specified bysmiModulePtr- then every subsequent call to
smiGetNextType()returns the following ones
and when there are no more type definitions left in that module? NULL. that's the end of the list, periodt β¨
π smiGetParentType()
returns a struct SmiType of the type that your type (specified by smiTypePtr) is derived from β the parent, the origin, the mother if you will π
but if there is no parent type (meaning the type in smiTypePtr IS a base type, main character with no ancestors), smiGetParentType() returns NULL.
π smiGetFirstRange() and smiGetNextRange()
same energy as the type iteration bestie β they iteratively retrieve struct SmiRanges that represent the range restrictions of the type specified by smiTypePtr. that's either:
- size ranges of an octet string type, or
- value ranges in case of a numeric type
π smiGetFirstNamedNumber() and smiGetNextNamedNumber()
yep, another iteration duo, we love consistency β¨ these iteratively retrieve struct SmiNamedNumbers that represent the named numbers of the type specified by smiTypePtr β and heads up, that type has to be either a bit set or an enumeration type. no exceptions, iykyk.
π smiGetTypeModule()
returns the module that defines the type given by struct SmiTypePtr. that's it, that's the whole vibe π
π smiGetTypeLine()
returns the line number within the module where the type specified by smiTypePtr is defined. so you always know exactly where it lives π
π FILES π
${prefix}/include/smi.hβ the SMI library header file π
β SEE ALSO β
libsmi(3), smi_module(3), smi.h
π AUTHOR π
(C) 1999-2001 Frank Strauss, TU Braunschweig, Germany <strauss@ibr.cs.tu-bs.de>
and that's the whole page bestie, you ate it up fr fr π
β¨ this was IBR, from August 16, 2001, and yeah it's still smi_type(3) β go forth and retrieve those types, you got this π¦π
π¦ where this page comes from
- debian bookworm: libsmi2-dev 0.4.8+dfsg2-16
- debian trixie: libsmi2-dev 0.4.8+dfsg2-17+b1
- ubuntu jammy: libsmi2-dev 0.4.8+dfsg2-16
- ubuntu noble: libsmi2-dev 0.4.8+dfsg2-16.1build1
- ubuntu questing: libsmi2-dev 0.4.8+dfsg2-17
- ubuntu resolute: libsmi2-dev 0.4.8+dfsg2-18
- ubuntu stonking: libsmi2-dev 0.4.8+dfsg2-18
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms