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 by smiModulePtr
  • 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 πŸ¦‹πŸ’œ