00001 #ifndef PARSE_H
00002 #define PARSE_H
00003
00004 #ifdef __cplusplus
00005 extern "C" {
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #define MAXLABEL 64
00033 #define MAXTOKEN 128
00034 #define MAXQUOTESTR 4096
00035
00036 struct variable_list;
00037
00038
00039
00040
00041 struct enum_list {
00042 struct enum_list *next;
00043 int value;
00044 char *label;
00045 };
00046
00047
00048
00049
00050 struct range_list {
00051 struct range_list *next;
00052 int low, high;
00053 };
00054
00055
00056
00057
00058 struct index_list {
00059 struct index_list *next;
00060 char *ilabel;
00061 char isimplied;
00062 };
00063
00064
00065
00066
00067 struct varbind_list {
00068 struct varbind_list *next;
00069 char *vblabel;
00070 };
00071
00072
00073
00074
00075 struct node {
00076 struct node *next;
00077 char *label;
00078 u_long subid;
00079 int modid;
00080 char *parent;
00081 int tc_index;
00082 int type;
00083 int access;
00084 int status;
00085 struct enum_list *enums;
00086 struct range_list *ranges;
00087 struct index_list *indexes;
00088 char *augments;
00089 struct varbind_list *varbinds;
00090 char *hint;
00091 char *units;
00092 char *description;
00093 char *reference;
00094 char *defaultValue;
00095 char *filename;
00096 int lineno;
00097 };
00098
00099
00100
00101
00102 struct tree {
00103 struct tree *child_list;
00104 struct tree *next_peer;
00105 struct tree *next;
00106 struct tree *parent;
00107 char *label;
00108 u_long subid;
00109 int modid;
00110 int number_modules;
00111 int *module_list;
00112 int tc_index;
00113 int type;
00114 int access;
00115 int status;
00116 struct enum_list *enums;
00117 struct range_list *ranges;
00118 struct index_list *indexes;
00119 char *augments;
00120 struct varbind_list *varbinds;
00121 char *hint;
00122 char *units;
00123 int (*printomat) (u_char **, size_t *, size_t *, int,
00124 const netsnmp_variable_list *,
00125 const struct enum_list *, const char *,
00126 const char *);
00127 void (*printer) (char *, const netsnmp_variable_list *, const struct enum_list *, const char *, const char *);
00128 char *description;
00129 char *reference;
00130 int reported;
00131 char *defaultValue;
00132 };
00133
00134
00135
00136
00137 struct module_import {
00138 char *label;
00139 int modid;
00140 };
00141
00142 struct module {
00143 char *name;
00144 char *file;
00145 struct module_import *imports;
00146 int no_imports;
00147
00148
00149
00150 int modid;
00151 struct module *next;
00152 };
00153
00154 struct module_compatability {
00155 const char *old_module;
00156 const char *new_module;
00157 const char *tag;
00158
00159 size_t tag_len;
00160 struct module_compatability *next;
00161 };
00162
00163
00164
00165
00166
00167 #define TYPE_OTHER 0
00168 #define TYPE_OBJID 1
00169 #define TYPE_OCTETSTR 2
00170 #define TYPE_INTEGER 3
00171 #define TYPE_NETADDR 4
00172 #define TYPE_IPADDR 5
00173 #define TYPE_COUNTER 6
00174 #define TYPE_GAUGE 7
00175 #define TYPE_TIMETICKS 8
00176 #define TYPE_OPAQUE 9
00177 #define TYPE_NULL 10
00178 #define TYPE_COUNTER64 11
00179 #define TYPE_BITSTRING 12
00180 #define TYPE_NSAPADDRESS 13
00181 #define TYPE_UINTEGER 14
00182 #define TYPE_UNSIGNED32 15
00183 #define TYPE_INTEGER32 16
00184
00185 #define TYPE_SIMPLE_LAST 16
00186
00187 #define TYPE_TRAPTYPE 20
00188 #define TYPE_NOTIFTYPE 21
00189 #define TYPE_OBJGROUP 22
00190 #define TYPE_NOTIFGROUP 23
00191 #define TYPE_MODID 24
00192 #define TYPE_AGENTCAP 25
00193 #define TYPE_MODCOMP 26
00194 #define TYPE_OBJIDENTITY 27
00195
00196 #define MIB_ACCESS_READONLY 18
00197 #define MIB_ACCESS_READWRITE 19
00198 #define MIB_ACCESS_WRITEONLY 20
00199 #define MIB_ACCESS_NOACCESS 21
00200 #define MIB_ACCESS_NOTIFY 67
00201 #define MIB_ACCESS_CREATE 48
00202
00203 #define MIB_STATUS_MANDATORY 23
00204 #define MIB_STATUS_OPTIONAL 24
00205 #define MIB_STATUS_OBSOLETE 25
00206 #define MIB_STATUS_DEPRECATED 39
00207 #define MIB_STATUS_CURRENT 57
00208
00209 #define ANON "anonymous#"
00210 #define ANON_LEN strlen(ANON)
00211
00212 struct tree *netsnmp_read_module(const char *);
00213 #ifndef NETSNMP_CLEAN_NAMESPACE
00214 struct tree *read_module(const char *);
00215 #endif
00216 struct tree *read_mib(const char *);
00217 struct tree *read_all_mibs(void);
00218 int netsnmp_unload_module(const char *name);
00219 #ifndef NETSNMP_CLEAN_NAMESPACE
00220 int unload_module(const char *name);
00221 #endif
00222 void unload_all_mibs(void);
00223 void init_mib_internals(void);
00224 int add_mibfile(const char*, const char*, FILE *);
00225 int add_mibdir(const char *);
00226 void add_module_replacement(const char *, const char *,
00227 const char *, int);
00228 int which_module(const char *);
00229 char *module_name(int, char *);
00230 void print_subtree(FILE *, struct tree *, int);
00231 void print_ascii_dump_tree(FILE *, struct tree *, int);
00232 struct tree *find_tree_node(const char *, int);
00233 const char *get_tc_descriptor(int);
00234 const char *get_tc_description(int);
00235 struct tree *find_best_tree_node(const char *, struct tree *,
00236 u_int *);
00237
00238
00239
00240 struct tree *find_node(const char *, struct tree *);
00241 struct tree *find_node2(const char *, const char *);
00242 struct module *find_module(int);
00243 void adopt_orphans(void);
00244 char *snmp_mib_toggle_options(char *options);
00245 void snmp_mib_toggle_options_usage(const char *lead,
00246 FILE * outf);
00247 void print_mib(FILE *);
00248 void print_mib_tree(FILE *, struct tree *, int);
00249 int get_mib_parse_error_count(void);
00250 int snmp_get_token(FILE * fp, char *token, int maxtlen);
00251 struct tree *find_best_tree_node(const char *name,
00252 struct tree *tree_top,
00253 u_int * match);
00254
00255 #ifdef __cplusplus
00256 }
00257 #endif
00258 #endif