00001 #ifndef PARSE_H 00002 #define PARSE_H 00003 00004 #ifdef __cplusplus 00005 extern "C" { 00006 #endif 00007 00008 #include <net-snmp/mib_api.h> 00009 00010 /* 00011 * parse.h 00012 */ 00013 /*********************************************************** 00014 Copyright 1989 by Carnegie Mellon University 00015 00016 All Rights Reserved 00017 00018 Permission to use, copy, modify, and distribute this software and its 00019 documentation for any purpose and without fee is hereby granted, 00020 provided that the above copyright notice appear in all copies and that 00021 both that copyright notice and this permission notice appear in 00022 supporting documentation, and that the name of CMU not be 00023 used in advertising or publicity pertaining to distribution of the 00024 software without specific, written prior permission. 00025 00026 CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 00027 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 00028 CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 00029 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 00030 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 00031 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 00032 SOFTWARE. 00033 ******************************************************************/ 00034 00035 #define MAXLABEL 64 /* maximum characters in a label */ 00036 #define MAXTOKEN 128 /* maximum characters in a token */ 00037 #define MAXQUOTESTR 4096 /* maximum characters in a quoted string */ 00038 00039 struct variable_list; 00040 00041 /* 00042 * A linked list of tag-value pairs for enumerated integers. 00043 */ 00044 struct enum_list { 00045 struct enum_list *next; 00046 int value; 00047 char *label; 00048 }; 00049 00050 /* 00051 * A linked list of ranges 00052 */ 00053 struct range_list { 00054 struct range_list *next; 00055 int low, high; 00056 }; 00057 00058 /* 00059 * A linked list of indexes 00060 */ 00061 struct index_list { 00062 struct index_list *next; 00063 char *ilabel; 00064 char isimplied; 00065 }; 00066 00067 /* 00068 * A linked list of varbinds 00069 */ 00070 struct varbind_list { 00071 struct varbind_list *next; 00072 char *vblabel; 00073 }; 00074 00075 /* 00076 * A tree in the format of the tree structure of the MIB. 00077 */ 00078 struct tree { 00079 struct tree *child_list; /* list of children of this node */ 00080 struct tree *next_peer; /* Next node in list of peers */ 00081 struct tree *next; /* Next node in hashed list of names */ 00082 struct tree *parent; 00083 char *label; /* This node's textual name */ 00084 u_long subid; /* This node's integer subidentifier */ 00085 int modid; /* The module containing this node */ 00086 int number_modules; 00087 int *module_list; /* To handle multiple modules */ 00088 int tc_index; /* index into tclist (-1 if NA) */ 00089 int type; /* This node's object type */ 00090 int access; /* This nodes access */ 00091 int status; /* This nodes status */ 00092 struct enum_list *enums; /* (optional) list of enumerated integers */ 00093 struct range_list *ranges; 00094 struct index_list *indexes; 00095 char *augments; 00096 struct varbind_list *varbinds; 00097 char *hint; 00098 char *units; 00099 int (*printomat) (u_char **, size_t *, size_t *, int, 00100 const netsnmp_variable_list *, 00101 const struct enum_list *, const char *, 00102 const char *); 00103 void (*printer) (char *, const netsnmp_variable_list *, const struct enum_list *, const char *, const char *); /* Value printing function */ 00104 char *description; /* description (a quoted string) */ 00105 char *reference; /* references (a quoted string) */ 00106 int reported; /* 1=report started in print_subtree... */ 00107 char *defaultValue; 00108 }; 00109 00110 /* 00111 * Information held about each MIB module 00112 */ 00113 struct module_import { 00114 char *label; /* The descriptor being imported */ 00115 int modid; /* The module imported from */ 00116 }; 00117 00118 struct module { 00119 char *name; /* This module's name */ 00120 char *file; /* The file containing the module */ 00121 struct module_import *imports; /* List of descriptors being imported */ 00122 int no_imports; /* The number of such import descriptors */ 00123 /* 00124 * -1 implies the module hasn't been read in yet 00125 */ 00126 int modid; /* The index number of this module */ 00127 struct module *next; /* Linked list pointer */ 00128 }; 00129 00130 struct module_compatability { 00131 const char *old_module; 00132 const char *new_module; 00133 const char *tag; /* NULL implies unconditional replacement, 00134 * otherwise node identifier or prefix */ 00135 size_t tag_len; /* 0 implies exact match (or unconditional) */ 00136 struct module_compatability *next; /* linked list */ 00137 }; 00138 00139 00140 /* 00141 * non-aggregate types for tree end nodes 00142 */ 00143 #define TYPE_OTHER 0 00144 #define TYPE_OBJID 1 00145 #define TYPE_OCTETSTR 2 00146 #define TYPE_INTEGER 3 00147 #define TYPE_NETADDR 4 00148 #define TYPE_IPADDR 5 00149 #define TYPE_COUNTER 6 00150 #define TYPE_GAUGE 7 00151 #define TYPE_TIMETICKS 8 00152 #define TYPE_OPAQUE 9 00153 #define TYPE_NULL 10 00154 #define TYPE_COUNTER64 11 00155 #define TYPE_BITSTRING 12 00156 #define TYPE_NSAPADDRESS 13 00157 #define TYPE_UINTEGER 14 00158 #define TYPE_UNSIGNED32 15 00159 #define TYPE_INTEGER32 16 00160 00161 #define TYPE_SIMPLE_LAST 16 00162 00163 #define TYPE_TRAPTYPE 20 00164 #define TYPE_NOTIFTYPE 21 00165 #define TYPE_OBJGROUP 22 00166 #define TYPE_NOTIFGROUP 23 00167 #define TYPE_MODID 24 00168 #define TYPE_AGENTCAP 25 00169 #define TYPE_MODCOMP 26 00170 #define TYPE_OBJIDENTITY 27 00171 00172 #define MIB_ACCESS_READONLY 18 00173 #define MIB_ACCESS_READWRITE 19 00174 #define MIB_ACCESS_WRITEONLY 20 00175 #define MIB_ACCESS_NOACCESS 21 00176 #define MIB_ACCESS_NOTIFY 67 00177 #define MIB_ACCESS_CREATE 48 00178 00179 #define MIB_STATUS_MANDATORY 23 00180 #define MIB_STATUS_OPTIONAL 24 00181 #define MIB_STATUS_OBSOLETE 25 00182 #define MIB_STATUS_DEPRECATED 39 00183 #define MIB_STATUS_CURRENT 57 00184 00185 #define ANON "anonymous#" 00186 #define ANON_LEN strlen(ANON) 00187 00188 int netsnmp_unload_module(const char *name); 00189 #ifndef NETSNMP_NO_LEGACY_DEFINITIONS 00190 int unload_module(const char *name); 00191 #endif 00192 void netsnmp_init_mib_internals(void); 00193 void unload_all_mibs(void); 00194 int add_mibfile(const char*, const char*, FILE *); 00195 int which_module(const char *); 00196 char *module_name(int, char *); 00197 void print_subtree(FILE *, struct tree *, int); 00198 void print_ascii_dump_tree(FILE *, struct tree *, int); 00199 struct tree *find_tree_node(const char *, int); 00200 const char *get_tc_descriptor(int); 00201 const char *get_tc_description(int); 00202 struct tree *find_best_tree_node(const char *, struct tree *, 00203 u_int *); 00204 /* 00205 * backwards compatability 00206 */ 00207 struct tree *find_node(const char *, struct tree *); 00208 struct tree *find_node2(const char *, const char *); 00209 struct module *find_module(int); 00210 void adopt_orphans(void); 00211 char *snmp_mib_toggle_options(char *options); 00212 void snmp_mib_toggle_options_usage(const char *lead, 00213 FILE * outf); 00214 void print_mib(FILE *); 00215 void print_mib_tree(FILE *, struct tree *, int); 00216 int get_mib_parse_error_count(void); 00217 int snmp_get_token(FILE * fp, char *token, int maxtlen); 00218 struct tree *find_best_tree_node(const char *name, 00219 struct tree *tree_top, 00220 u_int * match); 00221 00222 #ifdef __cplusplus 00223 } 00224 #endif 00225 #endif /* PARSE_H */
1.5.7.1
Last modified: Tuesday, 23-Dec-2025 17:22:04 UTC
For questions regarding web content and site functionality, please write to the net-snmp-users mail list.