net-snmp 5.7
mib.h
00001 #ifndef MIB_H
00002 #define MIB_H
00003 
00004 #ifdef __cplusplus
00005 extern          "C" {
00006 #endif
00007     /*
00008      * mib.h - Definitions for the variables as defined in the MIB
00009      *
00010      * Update: 1998-07-17 <jhy@gsu.edu>
00011      * Added prototypes for print_oid_report* functions.
00012      */
00013 /***********************************************************
00014         Copyright 1988, 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 #include <stdio.h>              /* for FILE */
00036 
00037 #include <net-snmp/mib_api.h>
00038 
00039 #define NETSNMP_MIB2_OID 1, 3, 6, 1, 2, 1
00040 
00041 #ifndef NETSNMP_NO_LEGACY_DEFINITIONS
00042 #define MIB NETSNMP_MIB2_OID
00043 #endif
00044 
00045 #define MIB_IFTYPE_OTHER                    1
00046 #define MIB_IFTYPE_REGULAR1822              2
00047 #define MIB_IFTYPE_HDH1822                  3
00048 #define MIB_IFTYPE_DDNX25                   4
00049 #define MIB_IFTYPE_RFC877X25                5
00050 #define MIB_IFTYPE_ETHERNETCSMACD           6
00051 #define MIB_IFTYPE_ISO88023CSMACD           7
00052 #define MIB_IFTYPE_ISO88024TOKENBUS         8
00053 #define MIB_IFTYPE_ISO88025TOKENRING        9
00054 #define MIB_IFTYPE_ISO88026MAN              10
00055 #define MIB_IFTYPE_STARLAN                  11
00056 #define MIB_IFTYPE_PROTEON10MBIT            12
00057 #define MIB_IFTYPE_PROTEON80MBIT            13
00058 #define MIB_IFTYPE_HYPERCHANNEL             14
00059 #define MIB_IFTYPE_FDDI                     15
00060 #define MIB_IFTYPE_LAPB                     16
00061 #define MIB_IFTYPE_SDLC                     17
00062 #define MIB_IFTYPE_T1CARRIER                18
00063 #define MIB_IFTYPE_CEPT                     19
00064 #define MIB_IFTYPE_BASICISDN                20
00065 #define MIB_IFTYPE_PRIMARYISDN              21
00066 #define MIB_IFTYPE_PROPPOINTTOPOINTSERIAL   22
00067 
00068 #define MIB_IFSTATUS_UP         1
00069 #define MIB_IFSTATUS_DOWN       2
00070 #define MIB_IFSTATUS_TESTING    3
00071 
00072 #define MIB_FORWARD_GATEWAY     1
00073 #define MIB_FORWARD_HOST        2
00074 
00075 #define MIB_IPROUTETYPE_OTHER   1
00076 #define MIB_IPROUTETYPE_INVALID 2
00077 #define MIB_IPROUTETYPE_DIRECT  3
00078 #define MIB_IPROUTETYPE_REMOTE  4
00079 
00080 #define MIB_IPROUTEPROTO_OTHER      1
00081 #define MIB_IPROUTEPROTO_LOCAL      2
00082 #define MIB_IPROUTEPROTO_NETMGMT    3
00083 #define MIB_IPROUTEPROTO_ICMP       4
00084 #define MIB_IPROUTEPROTO_EGP        5
00085 #define MIB_IPROUTEPROTO_GGP        6
00086 #define MIB_IPROUTEPROTO_HELLO      7
00087 #define MIB_IPROUTEPROTO_RIP        8
00088 #define MIB_IPROUTEPROTO_ISIS       9
00089 #define MIB_IPROUTEPROTO_ESIS       10
00090 #define MIB_IPROUTEPROTO_CISCOIGRP  11
00091 #define MIB_IPROUTEPROTO_BBNSPFIGP  12
00092 #define MIB_IPROUTEPROTO_OIGP       13
00093 
00094 #define MIB_TCPRTOALG_OTHER     1
00095 #define MIB_TCPRTOALG_CONSTANT  2
00096 #define MIB_TCPRTOALG_RSRE      3
00097 #define MIB_TCPRTOALG_VANJ      4
00098 
00099 #define MIB_TCPCONNSTATE_CLOSED         1
00100 #define MIB_TCPCONNSTATE_LISTEN         2
00101 #define MIB_TCPCONNSTATE_SYNSENT        3
00102 #define MIB_TCPCONNSTATE_SYNRECEIVED    4
00103 #define MIB_TCPCONNSTATE_ESTABLISHED    5
00104 #define MIB_TCPCONNSTATE_FINWAIT1       6
00105 #define MIB_TCPCONNSTATE_FINWAIT2       7
00106 #define MIB_TCPCONNSTATE_CLOSEWAIT      8
00107 #define MIB_TCPCONNSTATE_LASTACK        9
00108 #define MIB_TCPCONNSTATE_CLOSING        10
00109 #define MIB_TCPCONNSTATE_TIMEWAIT       11
00110 
00111 #define MIB_EGPNEIGHSTATE_IDLE          1
00112 #define MIB_EGPNEIGHSTATE_AQUISITION    2
00113 #define MIB_EGPNEIGHSTATE_DOWN          3
00114 #define MIB_EGPNEIGHSTATE_UP            4
00115 #define MIB_EGPNEIGHSTATE_CEASE         5
00116 
00117     struct variable_list;
00118     struct enum_list;
00119 
00120     NETSNMP_IMPORT
00121     void            print_ascii_dump(FILE *);
00122     void            register_mib_handlers(void);
00123     void            netsnmp_set_mib_directory(const char *dir);
00124     NETSNMP_IMPORT
00125     char            *netsnmp_get_mib_directory(void);
00126     void            netsnmp_fixup_mib_directory(void);
00127     void            netsnmp_mibindex_load( void );
00128     char *          netsnmp_mibindex_lookup( const char * );
00129     FILE *          netsnmp_mibindex_new( const char * );
00130     int             sprint_realloc_description(u_char ** buf, size_t * buf_len,
00131                                 size_t * out_len, int allow_realloc,
00132                                 oid * objid, size_t objidlen, int width);
00133     NETSNMP_IMPORT
00134     int             get_wild_node(const char *, oid *, size_t *);
00135     NETSNMP_IMPORT
00136     int             get_node(const char *, oid *, size_t *);
00137     NETSNMP_IMPORT
00138     struct tree    *get_tree(const oid *, size_t, struct tree *);
00139     NETSNMP_IMPORT
00140     struct tree    *get_tree_head(void);
00141     void            set_function(struct tree *);
00142 
00143     NETSNMP_IMPORT
00144     int             parse_one_oid_index(oid ** oidStart, size_t * oidLen,
00145                                         netsnmp_variable_list * data,
00146                                         int complete);
00147     NETSNMP_IMPORT
00148     int             parse_oid_indexes(oid * oidIndex, size_t oidLen,
00149                                       netsnmp_variable_list * data);
00150     NETSNMP_IMPORT
00151     int             build_oid_noalloc(oid * in, size_t in_len,
00152                                       size_t * out_len, oid * prefix,
00153                                       size_t prefix_len,
00154                                       netsnmp_variable_list * indexes);
00155     NETSNMP_IMPORT
00156     int             build_oid(oid ** out, size_t * out_len, oid * prefix,
00157                               size_t prefix_len,
00158                               netsnmp_variable_list * indexes);
00159     int             build_oid_segment(netsnmp_variable_list * var);
00160 
00161     NETSNMP_IMPORT
00162     int             sprint_realloc_variable(u_char ** buf, size_t * buf_len,
00163                                    size_t * out_len, int allow_realloc,
00164                                    const oid * objid, size_t objidlen,
00165                                    const netsnmp_variable_list * variable);
00166 
00167     NETSNMP_IMPORT
00168 #ifndef NETSNMP_DISABLE_MIB_LOADING
00169     struct tree    *
00170 #else
00171     void
00172 #endif
00173                     netsnmp_sprint_realloc_objid_tree(u_char ** buf,
00174                                                       size_t * buf_len,
00175                                                       size_t * out_len,
00176                                                       int allow_realloc,
00177                                                       int *buf_overflow,
00178                                                       const oid * objid,
00179                                                       size_t objidlen);
00180 
00181     NETSNMP_IMPORT
00182     void
00183                     netsnmp_sprint_realloc_objid(u_char ** buf,
00184                                                  size_t * buf_len,
00185                                                  size_t * out_len,
00186                                                  int allow_realloc,
00187                                                  int *buf_overflow,
00188                                                  const oid * objid,
00189                                                  size_t objidlen);
00190 
00191     NETSNMP_IMPORT
00192     int             sprint_realloc_value(u_char ** buf, size_t * buf_len,
00193                                  size_t * out_len, int allow_realloc,
00194                                  const oid * objid, size_t objidlen,
00195                                  const netsnmp_variable_list * variable);
00196 
00197     NETSNMP_IMPORT
00198     int             sprint_realloc_objid(u_char ** buf, size_t * buf_len,
00199                                  size_t * out_len, int allow_realloc,
00200                                  const oid * objid, size_t objidlen);
00201 
00202     NETSNMP_IMPORT
00203     int             sprint_realloc_by_type(u_char ** buf, size_t * buf_len,
00204                                            size_t * out_len,
00205                                            int allow_realloc,
00206                                            const netsnmp_variable_list * var,
00207                                            const struct enum_list *enums,
00208                                            const char *hint,
00209                                            const char *units);
00210 
00211     NETSNMP_IMPORT
00212     int             sprint_realloc_hexstring(u_char ** buf,
00213                                              size_t * buf_len,
00214                                              size_t * out_len,
00215                                              int allow_realloc,
00216                                              const u_char *, size_t);
00217 
00218     NETSNMP_IMPORT
00219     int             sprint_realloc_asciistring(u_char ** buf,
00220                                                size_t * buf_len,
00221                                                size_t * out_len,
00222                                                int allow_realloc,
00223                                                const u_char * cp,
00224                                                size_t len);
00225 
00226     int             sprint_realloc_octet_string(u_char ** buf,
00227                                                 size_t * buf_len,
00228                                                 size_t * out_len,
00229                                                 int allow_realloc,
00230                                                 const netsnmp_variable_list *,
00231                                                 const struct enum_list *,
00232                                                 const char *,
00233                                                 const char *);
00234 
00235     int             sprint_realloc_opaque(u_char ** buf, size_t * buf_len,
00236                                           size_t * out_len,
00237                                           int allow_realloc,
00238                                           const netsnmp_variable_list *,
00239                                           const struct enum_list *, const char *,
00240                                           const char *);
00241 
00242     int             sprint_realloc_object_identifier(u_char ** buf,
00243                                                      size_t * buf_len,
00244                                                      size_t * out_len,
00245                                                      int allow_realloc,
00246                                                      const netsnmp_variable_list
00247                                                      *, const struct enum_list *,
00248                                                      const char *,
00249                                                      const char *);
00250 
00251     int             sprint_realloc_timeticks(u_char ** buf,
00252                                              size_t * buf_len,
00253                                              size_t * out_len,
00254                                              int allow_realloc,
00255                                              const netsnmp_variable_list *,
00256                                              const struct enum_list *,
00257                                              const char *, const char *);
00258 
00259     int             sprint_realloc_hinted_integer(u_char ** buf,
00260                                                   size_t * buf_len,
00261                                                   size_t * out_len,
00262                                                   int allow_realloc, long,
00263                                                   const char, const char *,
00264                                                   const char *);
00265 
00266     int             sprint_realloc_integer(u_char ** buf, size_t * buf_len,
00267                                            size_t * out_len,
00268                                            int allow_realloc,
00269                                            const netsnmp_variable_list *,
00270                                            const struct enum_list *,
00271                                            const char *, const char *);
00272 
00273     int             sprint_realloc_uinteger(u_char ** buf,
00274                                             size_t * buf_len,
00275                                             size_t * out_len,
00276                                             int allow_realloc,
00277                                             const netsnmp_variable_list *,
00278                                             const struct enum_list *,
00279                                             const char *, const char *);
00280 
00281     int             sprint_realloc_gauge(u_char ** buf, size_t * buf_len,
00282                                          size_t * out_len,
00283                                          int allow_realloc,
00284                                          const netsnmp_variable_list *,
00285                                          const struct enum_list *, const char *,
00286                                          const char *);
00287 
00288     int             sprint_realloc_counter(u_char ** buf, size_t * buf_len,
00289                                            size_t * out_len,
00290                                            int allow_realloc,
00291                                            const netsnmp_variable_list *,
00292                                            const struct enum_list *,
00293                                            const char *, const char *);
00294 
00295     int             sprint_realloc_networkaddress(u_char ** buf,
00296                                                   size_t * buf_len,
00297                                                   size_t * out_len,
00298                                                   int allow_realloc,
00299                                                   const netsnmp_variable_list *,
00300                                                   const struct enum_list *,
00301                                                   const char *,
00302                                                   const char *);
00303 
00304     int             sprint_realloc_ipaddress(u_char ** buf,
00305                                              size_t * buf_len,
00306                                              size_t * out_len,
00307                                              int allow_realloc,
00308                                              const netsnmp_variable_list *,
00309                                              const struct enum_list *,
00310                                              const char *, const char *);
00311 
00312     int             sprint_realloc_null(u_char ** buf, size_t * buf_len,
00313                                         size_t * out_len,
00314                                         int allow_realloc,
00315                                         const netsnmp_variable_list *,
00316                                         const struct enum_list *, const char *,
00317                                         const char *);
00318 
00319     int             sprint_realloc_bitstring(u_char ** buf,
00320                                              size_t * buf_len,
00321                                              size_t * out_len,
00322                                              int allow_realloc,
00323                                              const netsnmp_variable_list *,
00324                                              const struct enum_list *,
00325                                              const char *, const char *);
00326 
00327     int             sprint_realloc_nsapaddress(u_char ** buf,
00328                                                size_t * buf_len,
00329                                                size_t * out_len,
00330                                                int allow_realloc,
00331                                                const netsnmp_variable_list *,
00332                                                const struct enum_list *,
00333                                                const char *, const char *);
00334 
00335     int             sprint_realloc_counter64(u_char ** buf,
00336                                              size_t * buf_len,
00337                                              size_t * out_len,
00338                                              int allow_realloc,
00339                                              const netsnmp_variable_list *,
00340                                              const struct enum_list *,
00341                                              const char *, const char *);
00342 
00343     int             sprint_realloc_badtype(u_char ** buf, size_t * buf_len,
00344                                            size_t * out_len,
00345                                            int allow_realloc,
00346                                            const netsnmp_variable_list *,
00347                                            const struct enum_list *,
00348                                            const char *, const char *);
00349 
00350 #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
00351     int             sprint_realloc_float(u_char ** buf, size_t * buf_len,
00352                                          size_t * out_len,
00353                                          int allow_realloc,
00354                                          const netsnmp_variable_list *,
00355                                          const struct enum_list *, const char *,
00356                                          const char *);
00357 
00358     int             sprint_realloc_double(u_char ** buf, size_t * buf_len,
00359                                           size_t * out_len,
00360                                           int allow_realloc,
00361                                           const netsnmp_variable_list *,
00362                                           const struct enum_list *, const char *,
00363                                           const char *);
00364 #endif
00365 
00366 
00367     int             snprint_by_type(char *buf, size_t buf_len,
00368                                     netsnmp_variable_list * var,
00369                                     const struct enum_list *enums,
00370                                     const char *hint, const char *units);
00371 
00372     int             snprint_hexstring(char *buf, size_t buf_len,
00373                                       const u_char *, size_t);
00374 
00375     int             snprint_asciistring(char *buf, size_t buf_len,
00376                                         const u_char * cp, size_t len);
00377 
00378     int             snprint_octet_string(char *buf, size_t buf_len,
00379                                          const netsnmp_variable_list *,
00380                                          const struct enum_list *, const char *,
00381                                          const char *);
00382 
00383     int             snprint_opaque(char *buf, size_t buf_len,
00384                                    const netsnmp_variable_list *,
00385                                    const struct enum_list *, const char *,
00386                                    const char *);
00387 
00388     int             snprint_object_identifier(char *buf, size_t buf_len,
00389                                               const netsnmp_variable_list *,
00390                                               const struct enum_list *,
00391                                               const char *, const char *);
00392 
00393     int             snprint_timeticks(char *buf, size_t buf_len,
00394                                       const netsnmp_variable_list *,
00395                                       const struct enum_list *, const char *,
00396                                       const char *);
00397 
00398     int             snprint_hinted_integer(char *buf, size_t buf_len,
00399                                            long, const char *,
00400                                            const char *);
00401 
00402     int             snprint_integer(char *buf, size_t buf_len,
00403                                     const netsnmp_variable_list *,
00404                                     const struct enum_list *, const char *,
00405                                     const char *);
00406 
00407     int             snprint_uinteger(char *buf, size_t buf_len,
00408                                      const netsnmp_variable_list *,
00409                                      const struct enum_list *, const char *,
00410                                      const char *);
00411 
00412     int             snprint_gauge(char *buf, size_t buf_len,
00413                                   const netsnmp_variable_list *,
00414                                   const struct enum_list *, const char *,
00415                                   const char *);
00416 
00417     int             snprint_counter(char *buf, size_t buf_len,
00418                                     const netsnmp_variable_list *,
00419                                     const struct enum_list *, const char *,
00420                                     const char *);
00421 
00422     int             snprint_networkaddress(char *buf, size_t buf_len,
00423                                            const netsnmp_variable_list *,
00424                                            const struct enum_list *,
00425                                            const char *, const char *);
00426 
00427     int             snprint_ipaddress(char *buf, size_t buf_len,
00428                                       const netsnmp_variable_list *,
00429                                       const struct enum_list *, const char *,
00430                                       const char *);
00431 
00432     int             snprint_null(char *buf, size_t buf_len,
00433                                  const netsnmp_variable_list *,
00434                                  const struct enum_list *, const char *,
00435                                  const char *);
00436 
00437     NETSNMP_IMPORT
00438     int             snprint_bitstring(char *buf, size_t buf_len,
00439                                       const netsnmp_variable_list *,
00440                                       const struct enum_list *, const char *,
00441                                       const char *);
00442 
00443     int             snprint_nsapaddress(char *buf, size_t buf_len,
00444                                         const netsnmp_variable_list *,
00445                                         const struct enum_list *, const char *,
00446                                         const char *);
00447 
00448     int             snprint_counter64(char *buf, size_t buf_len,
00449                                       const netsnmp_variable_list *,
00450                                       const struct enum_list *, const char *,
00451                                       const char *);
00452 
00453     int             snprint_badtype(char *buf, size_t buf_len,
00454                                     const netsnmp_variable_list *,
00455                                     const struct enum_list *, const char *,
00456                                     const char *);
00457 
00458 #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
00459     int             snprint_float(char *buf, size_t buf_len,
00460                                   const netsnmp_variable_list *,
00461                                   const struct enum_list *, const char *,
00462                                   const char *);
00463 
00464     int             snprint_double(char *buf, size_t buf_len,
00465                                    const netsnmp_variable_list *,
00466                                    const struct enum_list *, const char *,
00467                                    const char *);
00468 #endif
00469 
00470     NETSNMP_IMPORT
00471     void            print_oid_report(FILE *);
00472     NETSNMP_IMPORT
00473     void            print_oid_report_enable_labeledoid(void);
00474     NETSNMP_IMPORT
00475     void            print_oid_report_enable_oid(void);
00476     NETSNMP_IMPORT
00477     void            print_oid_report_enable_suffix(void);
00478     NETSNMP_IMPORT
00479     void            print_oid_report_enable_symbolic(void);
00480     NETSNMP_IMPORT
00481     void            print_oid_report_enable_mibchildoid(void);
00482 
00483     const char     *parse_octet_hint(const char *hint, const char *value,
00484                                      unsigned char **new_val, int *new_val_len);
00485 
00486     NETSNMP_IMPORT
00487     void            clear_tree_flags(register struct tree *tp);
00488 
00489     NETSNMP_IMPORT
00490     char           *snmp_out_toggle_options(char *);
00491     NETSNMP_IMPORT
00492     void            snmp_out_toggle_options_usage(const char *, FILE *);
00493     NETSNMP_IMPORT
00494     char           *snmp_in_toggle_options(char *);
00495     char           *snmp_in_options(char *, int, char * const *);
00496     NETSNMP_IMPORT
00497     void            snmp_in_toggle_options_usage(const char *, FILE *);
00498     NETSNMP_IMPORT
00499     u_char          mib_to_asn_type(int mib_type);
00500 
00501 
00502     int             netsnmp_str2oid(const char *S, oid * O, int L);
00503 
00504 
00505 #define NETSNMP_STRING_OUTPUT_GUESS  1
00506 #define NETSNMP_STRING_OUTPUT_ASCII  2
00507 #define NETSNMP_STRING_OUTPUT_HEX    3
00508 
00509 #define NETSNMP_OID_OUTPUT_SUFFIX  1
00510 #define NETSNMP_OID_OUTPUT_MODULE  2
00511 #define NETSNMP_OID_OUTPUT_FULL    3
00512 #define NETSNMP_OID_OUTPUT_NUMERIC 4
00513 #define NETSNMP_OID_OUTPUT_UCD     5
00514 #define NETSNMP_OID_OUTPUT_NONE    6
00515 #ifdef __cplusplus
00516 }
00517 #endif
00518 #endif                          /* MIB_H */