/usr/include/smi.h is in libsmi2-dev 0.4.8+dfsg2-15.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | /*
* smi.h --
*
* Interface Definition of libsmi (version 2:27:0).
*
* Copyright (c) 1999,2000 Frank Strauss, Technical University of Braunschweig.
*
* See the file "COPYING" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* @(#) $Id: smi.h.in 8090 2008-04-18 12:56:29Z strauss $
*/
#ifndef _SMI_H
#define _SMI_H
#include <stdlib.h>
#include <stdarg.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_LIMITS_H
#include "limits.h"
#endif
#include <time.h>
#ifdef __cplusplus
extern "C" {
#endif
#define SMI_LIBRARY_VERSION "2:27:0"
extern const char *smi_library_version;
#define SMI_VERSION_MAJOR 0
#define SMI_VERSION_MINOR 4
#define SMI_VERSION_PATCHLEVEL 8
#define SMI_VERSION_STRING "0.4.8"
extern const char *smi_version_string;
#define SMI_FLAG_NODESCR 0x0800 /* do not load descriptions/references. */
#define SMI_FLAG_VIEWALL 0x1000 /* all modules are `known', need no views. */
#define SMI_FLAG_ERRORS 0x2000 /* print parser errors. */
#define SMI_FLAG_RECURSIVE 0x4000 /* recursively parse imported modules. */
#define SMI_FLAG_STATS 0x8000 /* print statistics after parsing module. */
#define SMI_FLAG_MASK (SMI_FLAG_NODESCR|SMI_FLAG_VIEWALL|SMI_FLAG_STATS|\
SMI_FLAG_RECURSIVE|SMI_FLAG_ERRORS)
/* misc mappings of SMI types to C types */
typedef char *SmiIdentifier;
typedef unsigned long SmiUnsigned32;
typedef long SmiInteger32;
#ifdef _MSC_VER /* if using MSVC and not configure */
typedef __int64 SmiInteger64;
typedef unsigned __int64 SmiUnsigned64;
#else
typedef unsigned long long SmiUnsigned64;
typedef long long SmiInteger64;
#endif
typedef unsigned int SmiSubid;
typedef float SmiFloat32;
typedef double SmiFloat64;
typedef long double SmiFloat128;
/* SmiLanguage -- language of an actual MIB module */
typedef enum SmiLanguage {
SMI_LANGUAGE_UNKNOWN = 0, /* should not occur */
SMI_LANGUAGE_SMIV1 = 1,
SMI_LANGUAGE_SMIV2 = 2,
SMI_LANGUAGE_SMING = 3,
SMI_LANGUAGE_SPPI = 4
} SmiLanguage;
/* SmiBasetype -- base types of all languages */
typedef enum SmiBasetype {
SMI_BASETYPE_UNKNOWN = 0, /* should not occur */
SMI_BASETYPE_INTEGER32 = 1, /* also SMIv1/v2 INTEGER */
SMI_BASETYPE_OCTETSTRING = 2,
SMI_BASETYPE_OBJECTIDENTIFIER = 3,
SMI_BASETYPE_UNSIGNED32 = 4,
SMI_BASETYPE_INTEGER64 = 5, /* SMIng and SPPI */
SMI_BASETYPE_UNSIGNED64 = 6, /* SMIv2, SMIng and SPPI */
SMI_BASETYPE_FLOAT32 = 7, /* only SMIng */
SMI_BASETYPE_FLOAT64 = 8, /* only SMIng */
SMI_BASETYPE_FLOAT128 = 9, /* only SMIng */
SMI_BASETYPE_ENUM = 10,
SMI_BASETYPE_BITS = 11, /* SMIv2, SMIng and SPPI */
SMI_BASETYPE_POINTER = 12 /* only SMIng */
} SmiBasetype;
#ifdef INT32_MIN
#define SMI_BASETYPE_INTEGER32_MIN INT32_MIN
#else
#define SMI_BASETYPE_INTEGER32_MIN INT_MIN
#endif
#ifdef INT32_MAX
#define SMI_BASETYPE_INTEGER32_MAX INT32_MAX
#else
#define SMI_BASETYPE_INTEGER32_MAX INT_MAX
#endif
#define SMI_BASETYPE_INTEGER64_MIN LIBSMI_INT64_MIN
#define SMI_BASETYPE_INTEGER64_MAX LIBSMI_INT64_MAX
#define SMI_BASETYPE_UNSIGNED32_MIN 0
#ifdef UINT32_MAX
#define SMI_BASETYPE_UNSIGNED32_MAX UINT32_MAX
#else
#define SMI_BASETYPE_UNSIGNED32_MAX UINT_MAX
#endif
#define SMI_BASETYPE_UNSIGNED64_MIN 0
#define SMI_BASETYPE_UNSIGNED64_MAX LIBSMI_UINT64_MAX
/* SmiStatus -- values of status levels */
typedef enum SmiStatus {
SMI_STATUS_UNKNOWN = 0, /* should not occur */
SMI_STATUS_CURRENT = 1, /* only SMIv2, SMIng and SPPI */
SMI_STATUS_DEPRECATED = 2, /* SMIv1, SMIv2, SMIng and SPPI */
SMI_STATUS_MANDATORY = 3, /* only SMIv1 */
SMI_STATUS_OPTIONAL = 4, /* only SMIv1 */
SMI_STATUS_OBSOLETE = 5 /* SMIv1, SMIv2, SMIng and SPPI */
} SmiStatus;
/* SmiAccess -- values of access levels */
typedef enum SmiAccess {
SMI_ACCESS_UNKNOWN = 0, /* should not occur */
SMI_ACCESS_NOT_IMPLEMENTED = 1, /* only for agent capability variations */
SMI_ACCESS_NOT_ACCESSIBLE = 2, /* the values 2 to 5 are allowed to be */
SMI_ACCESS_NOTIFY = 3, /* compared by relational operators. */
SMI_ACCESS_READ_ONLY = 4,
SMI_ACCESS_READ_WRITE = 5,
SMI_ACCESS_INSTALL = 6, /* these three entries are only valid */
SMI_ACCESS_INSTALL_NOTIFY = 7, /* for SPPI */
SMI_ACCESS_REPORT_ONLY = 8,
SMI_ACCESS_EVENT_ONLY = 9 /* this entry is valid only for SMIng */
} SmiAccess;
/* SmiNodekind -- type or statement that leads to a definition */
typedef unsigned int SmiNodekind;
#define SMI_NODEKIND_UNKNOWN 0x0000 /* should not occur */
#define SMI_NODEKIND_NODE 0x0001
#define SMI_NODEKIND_SCALAR 0x0002
#define SMI_NODEKIND_TABLE 0x0004
#define SMI_NODEKIND_ROW 0x0008
#define SMI_NODEKIND_COLUMN 0x0010
#define SMI_NODEKIND_NOTIFICATION 0x0020
#define SMI_NODEKIND_GROUP 0x0040
#define SMI_NODEKIND_COMPLIANCE 0x0080
#define SMI_NODEKIND_CAPABILITIES 0x0100
#define SMI_NODEKIND_ANY 0xffff
/* SmiDecl -- type or statement that leads to a definition */
typedef enum SmiDecl {
SMI_DECL_UNKNOWN = 0, /* should not occur */
/* SMIv1/v2 ASN.1 statements and macros */
SMI_DECL_IMPLICIT_TYPE = 1,
SMI_DECL_TYPEASSIGNMENT = 2,
SMI_DECL_IMPL_SEQUENCEOF = 4, /* this will go away */
SMI_DECL_VALUEASSIGNMENT = 5,
SMI_DECL_OBJECTTYPE = 6, /* values >= 6 are assumed to be */
SMI_DECL_OBJECTIDENTITY = 7, /* registering an OID, see check.c */
SMI_DECL_MODULEIDENTITY = 8,
SMI_DECL_NOTIFICATIONTYPE = 9,
SMI_DECL_TRAPTYPE = 10,
SMI_DECL_OBJECTGROUP = 11,
SMI_DECL_NOTIFICATIONGROUP = 12,
SMI_DECL_MODULECOMPLIANCE = 13,
SMI_DECL_AGENTCAPABILITIES = 14,
SMI_DECL_TEXTUALCONVENTION = 15,
SMI_DECL_MACRO = 16,
SMI_DECL_COMPL_GROUP = 17,
SMI_DECL_COMPL_OBJECT = 18,
SMI_DECL_IMPL_OBJECT = 19, /* object label in sth like "iso(1)" */
/* SMIng statements */
SMI_DECL_MODULE = 33,
SMI_DECL_EXTENSION = 34,
SMI_DECL_TYPEDEF = 35,
SMI_DECL_NODE = 36,
SMI_DECL_SCALAR = 37,
SMI_DECL_TABLE = 38,
SMI_DECL_ROW = 39,
SMI_DECL_COLUMN = 40,
SMI_DECL_NOTIFICATION = 41,
SMI_DECL_GROUP = 42,
SMI_DECL_COMPLIANCE = 43,
SMI_DECL_IDENTITY = 44,
SMI_DECL_CLASS = 45,
SMI_DECL_ATTRIBUTE = 46,
SMI_DECL_EVENT = 47
} SmiDecl;
/* SmiIndexkind -- actual kind of a table row's index method */
typedef enum SmiIndexkind {
SMI_INDEX_UNKNOWN = 0,
SMI_INDEX_INDEX = 1,
SMI_INDEX_AUGMENT = 2,
SMI_INDEX_REORDER = 3,
SMI_INDEX_SPARSE = 4,
SMI_INDEX_EXPAND = 5
} SmiIndexkind;
/* SmiValue -- any single value; for use in default values and subtyping */
typedef struct SmiValue {
SmiBasetype basetype;
unsigned int len; /* OID, OctetString, Bits */
union {
SmiUnsigned64 unsigned64;
SmiInteger64 integer64;
SmiUnsigned32 unsigned32;
SmiInteger32 integer32;
SmiFloat32 float32;
SmiFloat64 float64;
SmiFloat128 float128;
SmiSubid *oid;
char *ptr; /* OctetString, Bits */
} value;
} SmiValue;
/* SmiNamedNumber -- a named number; for enumeration and bitset types */
typedef struct SmiNamedNumber {
SmiIdentifier name;
SmiValue value;
} SmiNamedNumber;
/* SmiRange -- a min-max value range; for subtyping of sizes or numbers */
typedef struct SmiRange {
SmiValue minValue;
SmiValue maxValue;
} SmiRange;
/* SmiModule -- the main structure of a module */
typedef struct SmiModule {
SmiIdentifier name;
char *path;
char *organization;
char *contactinfo;
char *description;
char *reference;
SmiLanguage language;
int conformance;
} SmiModule;
/* SmiRevision -- content of a single module's revision clause */
typedef struct SmiRevision {
time_t date;
char *description;
} SmiRevision;
/* SmiImport -- an imported descriptor */
typedef struct SmiImport {
SmiIdentifier module;
SmiIdentifier name;
} SmiImport;
/* SmiMacro -- the main structure of a SMIv1/v2 macro or SMIng extension */
typedef struct SmiMacro {
SmiIdentifier name;
SmiDecl decl;
SmiStatus status;
char *description;
char *reference;
char *abnf; /* only for SMIng */
} SmiMacro;
/* SmiIdentity -- the main structure of a SMIng Identity. */
/* NOTE: Not to be confused with SMIv2 MODULE-IDENTITY */
typedef struct SmiIdentity {
SmiIdentifier name;
SmiDecl decl;
SmiStatus status;
char *description;
char *reference;
} SmiIdentity;
/* SmiType -- the main structure of a type definition (also base types) */
/* also SMIng attributes */
typedef struct SmiType {
SmiIdentifier name;
SmiBasetype basetype;
SmiDecl decl;
char *format;
SmiValue value;
char *units;
SmiStatus status;
char *description;
char *reference;
} SmiType;
/* SmiNode -- the main structure of any clause that defines a node */
typedef struct SmiNode {
SmiIdentifier name;
unsigned int oidlen;
SmiSubid *oid; /* array of length oidlen */
SmiDecl decl;
SmiAccess access;
SmiStatus status;
char *format;
SmiValue value;
char *units;
char *description;
char *reference;
SmiIndexkind indexkind; /* only valid for rows */
int implied; /* only valid for rows */
int create; /* only valid for rows */
SmiNodekind nodekind;
} SmiNode;
/* SmiElement -- an item in a list (row index column, notification object) */
typedef struct SmiElement {
#ifndef __GNUC__
char dummy; /* many compilers are unhappy with empty structures. */
#endif
/* no visible attributes */
} SmiElement;
/* SmiOption -- an optional group in a compliance statement */
typedef struct SmiOption {
char *description;
} SmiOption;
/* SmiRefinement -- a refined object in a compliance statement */
typedef struct SmiRefinement {
SmiAccess access;
char *description;
} SmiRefinement;
/* SmiClass -- main structure for SMIng class statement */
typedef struct SmiClass {
SmiIdentifier name;
SmiDecl decl;
SmiStatus status;
char *description;
char *reference;
} SmiClass;
/* SmiClass -- main structure for class attribute */
typedef struct SmiAttribute {
SmiIdentifier name;
SmiBasetype basetype;
SmiDecl decl;
char *format;
SmiValue value;
char *units;
SmiStatus status;
char *description;
char *reference;
SmiAccess access;
} SmiAttribute;
/* SmiEvent -- the main structure of a SMIng Event(part of class definition).*/
typedef struct SmiEvent {
SmiIdentifier name;
SmiDecl decl;
SmiStatus status;
char *description;
char *reference;
} SmiEvent;
extern int smiInit(const char *tag);
extern void smiExit(void);
extern void smiSetErrorLevel(int level);
extern int smiGetFlags(void);
extern void smiSetFlags(int userflags);
extern char *smiGetPath(void);
extern int smiSetPath(const char *path);
extern void smiSetSeverity(char *pattern, int severity);
extern int smiReadConfig(const char *filename, const char *tag);
extern char *smiLoadModule(const char *module);
extern int smiIsLoaded(const char *module);
typedef void (SmiErrorHandler) (char *path, int line, int severity, char *msg, char *tag);
extern void smiSetErrorHandler(SmiErrorHandler smiErrorHandler);
extern SmiModule *smiGetModule(const char *module);
extern SmiModule *smiGetFirstModule(void);
extern SmiModule *smiGetNextModule(SmiModule *smiModulePtr);
extern SmiNode *smiGetModuleIdentityNode(SmiModule *smiModulePtr);
extern SmiImport *smiGetFirstImport(SmiModule *smiModulePtr);
extern SmiImport *smiGetNextImport(SmiImport *smiImportPtr);
extern int smiIsImported(SmiModule *smiModulePtr,
SmiModule *importedModulePtr, char *importedName);
extern SmiRevision *smiGetFirstRevision(SmiModule *smiModulePtr);
extern SmiRevision *smiGetNextRevision(SmiRevision *smiRevisionPtr);
extern int smiGetRevisionLine(SmiRevision *smiRevisionPtr);
extern SmiIdentity *smiGetFirstIdentity(SmiModule *smiModulePtr);
extern SmiIdentity *smiGetNextIdentity(SmiIdentity *smiIdentityPtr);
extern SmiIdentity *smiGetParentIdentity(SmiIdentity *smiIdentityPtr);
extern int smiGetIdentityLine(SmiIdentity *smiIdentityPtr);
extern SmiModule *smiGetIdentityModule(SmiIdentity *smiIdentityPtr);
extern SmiIdentity *smiGetIdentity(SmiModule *smiModulePtr,char *identity);
extern SmiType *smiGetType(SmiModule *smiModulePtr, char *type);
extern SmiType *smiGetFirstType(SmiModule *smiModulePtr);
extern SmiType *smiGetNextType(SmiType *smiTypePtr);
extern SmiType *smiGetParentType(SmiType *smiTypePtr);
extern SmiModule *smiGetTypeModule(SmiType *smiTypePtr);
extern int smiGetTypeLine(SmiType *smiTypePtr);
extern SmiRange *smiGetFirstRange(SmiType *smiTypePtr);
extern SmiRange *smiGetNextRange(SmiRange *smiRangePtr);
extern int smiGetMinMaxRange(SmiType *smiType, SmiValue *min, SmiValue *max);
extern SmiNamedNumber *smiGetFirstNamedNumber(SmiType *smiTypePtr);
extern SmiNamedNumber *smiGetNextNamedNumber(SmiNamedNumber
*smiNamedNumberPtr);
extern SmiClass *smiGetFirstClass(SmiModule *smiModulePtr);
extern SmiClass *smiGetNextClass(SmiClass *smiClassPtr);
extern SmiClass *smiGetParentClass(SmiClass *smiClassPtr);
extern SmiModule *smiGetClassModule(SmiClass *smiClassPtr);
extern SmiClass *smiGetClass(SmiModule *smiModulePtr,char *class);
extern int smiGetClassLine(SmiClass *smiClassPtr);
extern SmiAttribute *smiGetAttribute(SmiClass *smiClassPtr, char *attribute);
extern SmiAttribute *smiGetFirstAttribute(SmiClass *smiClassPtr);
extern SmiAttribute *smiGetNextAttribute(SmiAttribute *smiAtrributePtr);
extern SmiType *smiGetAttributeParentType(SmiAttribute *smiAtrributePtr);
extern SmiClass *smiGetAttributeParentClass(SmiAttribute *smiAtrributePtr);
extern SmiAttribute *smiGetFirstUniqueAttribute(SmiClass *smiClassPtr);
extern SmiAttribute *smiGetNextUniqueAttribute(SmiAttribute *smiTypePtr);
extern int smiIsClassScalar(SmiClass *smiClassPtr);
extern SmiNamedNumber *smiGetAttributeFirstNamedNumber(SmiAttribute *smiAttributePtr);
extern SmiNamedNumber *smiGetAttributeNextNamedNumber(SmiNamedNumber
*smiNamedNumberPtr);
extern SmiRange *smiGetAttributeFirstRange(SmiAttribute *smiAttributePtr);
extern SmiRange *smiGetAttributeNextRange(SmiRange *smiRangePtr);
extern int smiGetAttributeLine(SmiAttribute *smiAttributePtr);
extern SmiEvent *smiGetEvent(SmiClass *smiClassPtr, char *attribute);
extern SmiEvent *smiGetFirstEvent(SmiClass *smiClassPtr);
extern SmiEvent *smiGetNextEvent(SmiEvent *smiEventPtr);
extern int smiGetEventLine(SmiEvent *smiEventPtr);
extern SmiMacro *smiGetMacro(SmiModule *smiModulePtr, char *macro);
extern SmiMacro *smiGetFirstMacro(SmiModule *smiModulePtr);
extern SmiMacro *smiGetNextMacro(SmiMacro *smiMacroPtr);
extern SmiModule *smiGetMacroModule(SmiMacro *smiMacroPtr);
extern int smiGetMacroLine(SmiMacro *smiMacroPtr);
extern SmiNode *smiGetNode(SmiModule *smiModulePtr, const char *name);
extern SmiNode *smiGetNodeByOID(unsigned int oidlen, SmiSubid oid[]);
extern SmiNode *smiGetFirstNode(SmiModule *smiModulePtr, SmiNodekind nodekind);
extern SmiNode *smiGetNextNode(SmiNode *smiNodePtr, SmiNodekind nodekind);
extern SmiNode *smiGetParentNode(SmiNode *smiNodePtr);
extern SmiNode *smiGetRelatedNode(SmiNode *smiNodePtr);
extern SmiNode *smiGetFirstChildNode(SmiNode *smiNodePtr);
extern SmiNode *smiGetNextChildNode(SmiNode *smiNodePtr);
extern SmiModule *smiGetNodeModule(SmiNode *smiNodePtr);
extern SmiType *smiGetNodeType(SmiNode *smiNodePtr);
extern int smiGetNodeLine(SmiNode *smiNodePtr);
extern SmiElement *smiGetFirstElement(SmiNode *smiNodePtr);
extern SmiElement *smiGetNextElement(SmiElement *smiElementPtr);
extern SmiNode *smiGetElementNode(SmiElement *smiElementPtr);
extern SmiOption *smiGetFirstOption(SmiNode *smiComplianceNodePtr);
extern SmiOption *smiGetNextOption(SmiOption *smiOptionPtr);
extern SmiNode *smiGetOptionNode(SmiOption *smiOptionPtr);
extern int smiGetOptionLine(SmiOption *smiOptionPtr);
extern SmiRefinement *smiGetFirstRefinement(SmiNode *smiComplianceNodePtr);
extern SmiRefinement *smiGetNextRefinement(SmiRefinement *smiRefinementPtr);
extern SmiNode *smiGetRefinementNode(SmiRefinement *smiRefinementPtr);
extern SmiType *smiGetRefinementType(SmiRefinement *smiRefinementPtr);
extern SmiType *smiGetRefinementWriteType(SmiRefinement *smiRefinementPtr);
extern int smiGetRefinementLine(SmiRefinement *smiRefinementPtr);
extern SmiElement *smiGetFirstUniquenessElement(SmiNode *smiNodePtr);
#define smiGetNextUniquenessElement(p) smiGetNextElement(p)
extern char *smiRenderOID(unsigned int oidlen, SmiSubid *oid, int flags);
extern char *smiRenderValue(SmiValue *smiValuePtr, SmiType *smiTypePtr,
int flags);
extern char *smiRenderNode(SmiNode *smiNodePtr, int flags);
extern char *smiRenderType(SmiType *smiTypePtr, int flags);
#define SMI_RENDER_NUMERIC 0x01 /* render as numeric values */
#define SMI_RENDER_NAME 0x02 /* render as names */
#define SMI_RENDER_QUALIFIED 0x04 /* render names with module prefix */
#define SMI_RENDER_FORMAT 0x08 /* render by applying the type's format if
type is given and format is present */
#define SMI_RENDER_PRINTABLE 0x10 /* render string values as a printable
string if all octets are isprint() */
#define SMI_RENDER_UNKNOWN 0x20 /* render even unknown items as strings
("<unknown>") so that we never get NULL */
#define SMI_RENDER_ALL 0xff /* render as `human friendly' as possible */
#define SMI_UNKNOWN_LABEL "<unknown>"
/*
* The functions smiGetMaxSize() and smiGetMinSize() compute the
* max size constraint on a given BITS, OCTET STRING or OBJECT
* IDENTIFIER type. The functions recurse towards the top of the
* type derivation tree.
*/
extern unsigned int smiGetMinSize(SmiType *smiType);
extern unsigned int smiGetMaxSize(SmiType *smiType);
/*
* Two utility functions to pack and unpack instance identifiers.
* The smiUnpack() function allocates the array of SmiValues and
* the smiPack() function allocates the array of SmiSubids.
*/
extern int smiUnpack(SmiNode *row, SmiSubid *oid, unsigned int oidlen,
SmiValue **vals, int *valslen);
extern int smiPack(SmiNode *row, SmiValue *vals, int valslen,
SmiSubid **oid, unsigned int *oidlen);
/*
* Two printf functions that allocate memory dynamically. The call has
* to free the allocated memory.
*/
extern int smiAsprintf(char **strp, const char *format, ...);
extern int smiVasprintf(char **strp, const char *format, va_list ap);
/*
* The functions smiMalloc() and friends are used within the library
* for all memory allocations and deallocations. These functions are
* simple wrappers around the standard malloc() and friends functions,
* sometimes with some additional checking. We export these functions
* because on some systems (e.g. Windows) it is necessary to allocate
* / deallocate memory with the 'right' version of malloc() and
* friends.
*/
#ifdef HAVE_DMALLOC_H
extern void *_smiMalloc(char *, int, size_t);
extern void *_smiRealloc(char *, int, void *ptr, size_t size);
extern char *_smiStrdup(char *, int, const char *s1);
extern char *_smiStrndup(char *, int, const char *s1, size_t n);
extern void _smiFree(char *, int, void *ptr);
#define smiMalloc(s) _smiMalloc(__FILE__, __LINE__, s)
#define smiRealloc(p,s) _smiRealloc(__FILE__, __LINE__, p, s)
#define smiStrdup(s) _smiStrdup(__FILE__, __LINE__, s)
#define smiStrndup(s,n) _smiStrndup(__FILE__, __LINE__, s, n)
#define smiFree(p) _smiFree(__FILE__, __LINE__, p)
#else
extern void *smiMalloc(size_t size);
extern void *smiRealloc(void *ptr, size_t size);
extern char *smiStrdup(const char *s1);
extern char *smiStrndup(const char *s1, size_t n);
extern void smiFree(void *ptr);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SMI_H */
|