1 #ifndef MIB_H 2 #define MIB_H 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 /* 8 * mib.h - Definitions for the variables as defined in the MIB 9 * 10 * Update: 1998-07-17 <jhy@gsu.edu> 11 * Added prototypes for print_oid_report* functions. 12 */ 13 /*********************************************************** 14 Copyright 1988, 1989 by Carnegie Mellon University 15 16 All Rights Reserved 17 18 Permission to use, copy, modify, and distribute this software and its 19 documentation for any purpose and without fee is hereby granted, 20 provided that the above copyright notice appear in all copies and that 21 both that copyright notice and this permission notice appear in 22 supporting documentation, and that the name of CMU not be 23 used in advertising or publicity pertaining to distribution of the 24 software without specific, written prior permission. 25 26 CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 27 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 28 CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 29 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 30 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 31 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 32 SOFTWARE. 33 ******************************************************************/ 34 35 #include <stdio.h> /* for FILE */ 36 37 #include <net-snmp/mib_api.h> 38 39 #define NETSNMP_MIB2_OID 1, 3, 6, 1, 2, 1 40 41 #ifndef NETSNMP_NO_LEGACY_DEFINITIONS 42 #define MIB NETSNMP_MIB2_OID 43 #endif 44 45 #define MIB_IFTYPE_OTHER 1 46 #define MIB_IFTYPE_REGULAR1822 2 47 #define MIB_IFTYPE_HDH1822 3 48 #define MIB_IFTYPE_DDNX25 4 49 #define MIB_IFTYPE_RFC877X25 5 50 #define MIB_IFTYPE_ETHERNETCSMACD 6 51 #define MIB_IFTYPE_ISO88023CSMACD 7 52 #define MIB_IFTYPE_ISO88024TOKENBUS 8 53 #define MIB_IFTYPE_ISO88025TOKENRING 9 54 #define MIB_IFTYPE_ISO88026MAN 10 55 #define MIB_IFTYPE_STARLAN 11 56 #define MIB_IFTYPE_PROTEON10MBIT 12 57 #define MIB_IFTYPE_PROTEON80MBIT 13 58 #define MIB_IFTYPE_HYPERCHANNEL 14 59 #define MIB_IFTYPE_FDDI 15 60 #define MIB_IFTYPE_LAPB 16 61 #define MIB_IFTYPE_SDLC 17 62 #define MIB_IFTYPE_T1CARRIER 18 63 #define MIB_IFTYPE_CEPT 19 64 #define MIB_IFTYPE_BASICISDN 20 65 #define MIB_IFTYPE_PRIMARYISDN 21 66 #define MIB_IFTYPE_PROPPOINTTOPOINTSERIAL 22 67 68 #define MIB_IFSTATUS_UP 1 69 #define MIB_IFSTATUS_DOWN 2 70 #define MIB_IFSTATUS_TESTING 3 71 72 #define MIB_FORWARD_GATEWAY 1 73 #define MIB_FORWARD_HOST 2 74 75 #define MIB_IPROUTETYPE_OTHER 1 76 #define MIB_IPROUTETYPE_INVALID 2 77 #define MIB_IPROUTETYPE_DIRECT 3 78 #define MIB_IPROUTETYPE_REMOTE 4 79 80 #define MIB_IPROUTEPROTO_OTHER 1 81 #define MIB_IPROUTEPROTO_LOCAL 2 82 #define MIB_IPROUTEPROTO_NETMGMT 3 83 #define MIB_IPROUTEPROTO_ICMP 4 84 #define MIB_IPROUTEPROTO_EGP 5 85 #define MIB_IPROUTEPROTO_GGP 6 86 #define MIB_IPROUTEPROTO_HELLO 7 87 #define MIB_IPROUTEPROTO_RIP 8 88 #define MIB_IPROUTEPROTO_ISIS 9 89 #define MIB_IPROUTEPROTO_ESIS 10 90 #define MIB_IPROUTEPROTO_CISCOIGRP 11 91 #define MIB_IPROUTEPROTO_BBNSPFIGP 12 92 #define MIB_IPROUTEPROTO_OIGP 13 93 94 #define MIB_TCPRTOALG_OTHER 1 95 #define MIB_TCPRTOALG_CONSTANT 2 96 #define MIB_TCPRTOALG_RSRE 3 97 #define MIB_TCPRTOALG_VANJ 4 98 99 #define MIB_TCPCONNSTATE_CLOSED 1 100 #define MIB_TCPCONNSTATE_LISTEN 2 101 #define MIB_TCPCONNSTATE_SYNSENT 3 102 #define MIB_TCPCONNSTATE_SYNRECEIVED 4 103 #define MIB_TCPCONNSTATE_ESTABLISHED 5 104 #define MIB_TCPCONNSTATE_FINWAIT1 6 105 #define MIB_TCPCONNSTATE_FINWAIT2 7 106 #define MIB_TCPCONNSTATE_CLOSEWAIT 8 107 #define MIB_TCPCONNSTATE_LASTACK 9 108 #define MIB_TCPCONNSTATE_CLOSING 10 109 #define MIB_TCPCONNSTATE_TIMEWAIT 11 110 111 #define MIB_EGPNEIGHSTATE_IDLE 1 112 #define MIB_EGPNEIGHSTATE_AQUISITION 2 113 #define MIB_EGPNEIGHSTATE_DOWN 3 114 #define MIB_EGPNEIGHSTATE_UP 4 115 #define MIB_EGPNEIGHSTATE_CEASE 5 116 117 struct variable_list; 118 struct enum_list; 119 120 NETSNMP_IMPORT 121 void print_ascii_dump(FILE *); 122 void register_mib_handlers(void); 123 void netsnmp_set_mib_directory(const char *dir); 124 NETSNMP_IMPORT 125 char *netsnmp_get_mib_directory(void); 126 void netsnmp_fixup_mib_directory(void); 127 int sprint_realloc_description(u_char ** buf, size_t * buf_len, 128 size_t * out_len, int allow_realloc, 129 oid * objid, size_t objidlen, int width); 130 NETSNMP_IMPORT 131 int get_wild_node(const char *, oid *, size_t *); 132 NETSNMP_IMPORT 133 int get_node(const char *, oid *, size_t *); 134 NETSNMP_IMPORT 135 struct tree *get_tree(const oid *, size_t, struct tree *); 136 NETSNMP_IMPORT 137 struct tree *get_tree_head(void); 138 void set_function(struct tree *); 139 140 NETSNMP_IMPORT 141 int parse_one_oid_index(oid ** oidStart, size_t * oidLen, 142 netsnmp_variable_list * data, 143 int complete); 144 NETSNMP_IMPORT 145 int parse_oid_indexes(oid * oidIndex, size_t oidLen, 146 netsnmp_variable_list * data); 147 NETSNMP_IMPORT 148 int build_oid_noalloc(oid * in, size_t in_len, 149 size_t * out_len, const oid * prefix, 150 size_t prefix_len, 151 netsnmp_variable_list * indexes); 152 NETSNMP_IMPORT 153 int build_oid(oid ** out, size_t * out_len, oid * prefix, 154 size_t prefix_len, 155 netsnmp_variable_list * indexes); 156 int build_oid_segment(netsnmp_variable_list * var); 157 158 NETSNMP_IMPORT 159 int sprint_realloc_variable(u_char ** buf, size_t * buf_len, 160 size_t * out_len, int allow_realloc, 161 const oid * objid, size_t objidlen, 162 const netsnmp_variable_list * variable); 163 164 NETSNMP_IMPORT 165 #ifndef NETSNMP_DISABLE_MIB_LOADING 166 struct tree * 167 #else 168 void 169 #endif 170 netsnmp_sprint_realloc_objid_tree(u_char ** buf, 171 size_t * buf_len, 172 size_t * out_len, 173 int allow_realloc, 174 int *buf_overflow, 175 const oid * objid, 176 size_t objidlen); 177 178 NETSNMP_IMPORT 179 void 180 netsnmp_sprint_realloc_objid(u_char ** buf, 181 size_t * buf_len, 182 size_t * out_len, 183 int allow_realloc, 184 int *buf_overflow, 185 const oid * objid, 186 size_t objidlen); 187 188 NETSNMP_IMPORT 189 int sprint_realloc_value(u_char ** buf, size_t * buf_len, 190 size_t * out_len, int allow_realloc, 191 const oid * objid, size_t objidlen, 192 const netsnmp_variable_list * variable); 193 194 NETSNMP_IMPORT 195 int sprint_realloc_objid(u_char ** buf, size_t * buf_len, 196 size_t * out_len, int allow_realloc, 197 const oid * objid, size_t objidlen); 198 199 NETSNMP_IMPORT 200 int sprint_realloc_by_type(u_char ** buf, size_t * buf_len, 201 size_t * out_len, 202 int allow_realloc, 203 const netsnmp_variable_list * var, 204 const struct enum_list *enums, 205 const char *hint, 206 const char *units); 207 208 NETSNMP_IMPORT 209 int sprint_realloc_hexstring(u_char ** buf, 210 size_t * buf_len, 211 size_t * out_len, 212 int allow_realloc, 213 const u_char *, size_t); 214 215 NETSNMP_IMPORT 216 int sprint_realloc_asciistring(u_char ** buf, 217 size_t * buf_len, 218 size_t * out_len, 219 int allow_realloc, 220 const u_char * cp, 221 size_t len); 222 223 int sprint_realloc_octet_string(u_char ** buf, 224 size_t * buf_len, 225 size_t * out_len, 226 int allow_realloc, 227 const netsnmp_variable_list *, 228 const struct enum_list *, 229 const char *, 230 const char *); 231 232 int sprint_realloc_opaque(u_char ** buf, size_t * buf_len, 233 size_t * out_len, 234 int allow_realloc, 235 const netsnmp_variable_list *, 236 const struct enum_list *, const char *, 237 const char *); 238 239 int sprint_realloc_object_identifier(u_char ** buf, 240 size_t * buf_len, 241 size_t * out_len, 242 int allow_realloc, 243 const netsnmp_variable_list 244 *, const struct enum_list *, 245 const char *, 246 const char *); 247 248 int sprint_realloc_timeticks(u_char ** buf, 249 size_t * buf_len, 250 size_t * out_len, 251 int allow_realloc, 252 const netsnmp_variable_list *, 253 const struct enum_list *, 254 const char *, const char *); 255 256 int sprint_realloc_hinted_integer(u_char ** buf, 257 size_t * buf_len, 258 size_t * out_len, 259 int allow_realloc, long, 260 const char, const char *, 261 const char *); 262 263 int sprint_realloc_integer(u_char ** buf, size_t * buf_len, 264 size_t * out_len, 265 int allow_realloc, 266 const netsnmp_variable_list *, 267 const struct enum_list *, 268 const char *, const char *); 269 270 int sprint_realloc_uinteger(u_char ** buf, 271 size_t * buf_len, 272 size_t * out_len, 273 int allow_realloc, 274 const netsnmp_variable_list *, 275 const struct enum_list *, 276 const char *, const char *); 277 278 int sprint_realloc_gauge(u_char ** buf, size_t * buf_len, 279 size_t * out_len, 280 int allow_realloc, 281 const netsnmp_variable_list *, 282 const struct enum_list *, const char *, 283 const char *); 284 285 int sprint_realloc_counter(u_char ** buf, size_t * buf_len, 286 size_t * out_len, 287 int allow_realloc, 288 const netsnmp_variable_list *, 289 const struct enum_list *, 290 const char *, const char *); 291 292 int sprint_realloc_networkaddress(u_char ** buf, 293 size_t * buf_len, 294 size_t * out_len, 295 int allow_realloc, 296 const netsnmp_variable_list *, 297 const struct enum_list *, 298 const char *, 299 const char *); 300 301 int sprint_realloc_ipaddress(u_char ** buf, 302 size_t * buf_len, 303 size_t * out_len, 304 int allow_realloc, 305 const netsnmp_variable_list *, 306 const struct enum_list *, 307 const char *, const char *); 308 309 int sprint_realloc_null(u_char ** buf, size_t * buf_len, 310 size_t * out_len, 311 int allow_realloc, 312 const netsnmp_variable_list *, 313 const struct enum_list *, const char *, 314 const char *); 315 316 int sprint_realloc_bitstring(u_char ** buf, 317 size_t * buf_len, 318 size_t * out_len, 319 int allow_realloc, 320 const netsnmp_variable_list *, 321 const struct enum_list *, 322 const char *, const char *); 323 324 int sprint_realloc_nsapaddress(u_char ** buf, 325 size_t * buf_len, 326 size_t * out_len, 327 int allow_realloc, 328 const netsnmp_variable_list *, 329 const struct enum_list *, 330 const char *, const char *); 331 332 int sprint_realloc_counter64(u_char ** buf, 333 size_t * buf_len, 334 size_t * out_len, 335 int allow_realloc, 336 const netsnmp_variable_list *, 337 const struct enum_list *, 338 const char *, const char *); 339 340 int sprint_realloc_badtype(u_char ** buf, size_t * buf_len, 341 size_t * out_len, 342 int allow_realloc, 343 const netsnmp_variable_list *, 344 const struct enum_list *, 345 const char *, const char *); 346 347 #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES 348 int sprint_realloc_float(u_char ** buf, size_t * buf_len, 349 size_t * out_len, 350 int allow_realloc, 351 const netsnmp_variable_list *, 352 const struct enum_list *, const char *, 353 const char *); 354 355 int sprint_realloc_double(u_char ** buf, size_t * buf_len, 356 size_t * out_len, 357 int allow_realloc, 358 const netsnmp_variable_list *, 359 const struct enum_list *, const char *, 360 const char *); 361 #endif 362 363 364 int snprint_by_type(char *buf, size_t buf_len, 365 netsnmp_variable_list * var, 366 const struct enum_list *enums, 367 const char *hint, const char *units); 368 369 int snprint_hexstring(char *buf, size_t buf_len, 370 const u_char *, size_t); 371 372 int snprint_asciistring(char *buf, size_t buf_len, 373 const u_char * cp, size_t len); 374 375 int snprint_octet_string(char *buf, size_t buf_len, 376 const netsnmp_variable_list *, 377 const struct enum_list *, const char *, 378 const char *); 379 380 int snprint_opaque(char *buf, size_t buf_len, 381 const netsnmp_variable_list *, 382 const struct enum_list *, const char *, 383 const char *); 384 385 int snprint_object_identifier(char *buf, size_t buf_len, 386 const netsnmp_variable_list *, 387 const struct enum_list *, 388 const char *, const char *); 389 390 int snprint_timeticks(char *buf, size_t buf_len, 391 const netsnmp_variable_list *, 392 const struct enum_list *, const char *, 393 const char *); 394 395 int snprint_hinted_integer(char *buf, size_t buf_len, 396 long, const char *, 397 const char *); 398 399 int snprint_integer(char *buf, size_t buf_len, 400 const netsnmp_variable_list *, 401 const struct enum_list *, const char *, 402 const char *); 403 404 int snprint_uinteger(char *buf, size_t buf_len, 405 const netsnmp_variable_list *, 406 const struct enum_list *, const char *, 407 const char *); 408 409 int snprint_gauge(char *buf, size_t buf_len, 410 const netsnmp_variable_list *, 411 const struct enum_list *, const char *, 412 const char *); 413 414 int snprint_counter(char *buf, size_t buf_len, 415 const netsnmp_variable_list *, 416 const struct enum_list *, const char *, 417 const char *); 418 419 int snprint_networkaddress(char *buf, size_t buf_len, 420 const netsnmp_variable_list *, 421 const struct enum_list *, 422 const char *, const char *); 423 424 int snprint_ipaddress(char *buf, size_t buf_len, 425 const netsnmp_variable_list *, 426 const struct enum_list *, const char *, 427 const char *); 428 429 int snprint_null(char *buf, size_t buf_len, 430 const netsnmp_variable_list *, 431 const struct enum_list *, const char *, 432 const char *); 433 434 NETSNMP_IMPORT 435 int snprint_bitstring(char *buf, size_t buf_len, 436 const netsnmp_variable_list *, 437 const struct enum_list *, const char *, 438 const char *); 439 440 int snprint_nsapaddress(char *buf, size_t buf_len, 441 const netsnmp_variable_list *, 442 const struct enum_list *, const char *, 443 const char *); 444 445 int snprint_counter64(char *buf, size_t buf_len, 446 const netsnmp_variable_list *, 447 const struct enum_list *, const char *, 448 const char *); 449 450 int snprint_badtype(char *buf, size_t buf_len, 451 const netsnmp_variable_list *, 452 const struct enum_list *, const char *, 453 const char *); 454 455 #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES 456 int snprint_float(char *buf, size_t buf_len, 457 const netsnmp_variable_list *, 458 const struct enum_list *, const char *, 459 const char *); 460 461 int snprint_double(char *buf, size_t buf_len, 462 const netsnmp_variable_list *, 463 const struct enum_list *, const char *, 464 const char *); 465 #endif 466 467 NETSNMP_IMPORT 468 void print_oid_report(FILE *); 469 NETSNMP_IMPORT 470 void print_oid_report_enable_labeledoid(void); 471 NETSNMP_IMPORT 472 void print_oid_report_enable_oid(void); 473 NETSNMP_IMPORT 474 void print_oid_report_enable_suffix(void); 475 NETSNMP_IMPORT 476 void print_oid_report_enable_symbolic(void); 477 NETSNMP_IMPORT 478 void print_oid_report_enable_mibchildoid(void); 479 480 const char *parse_octet_hint(const char *hint, const char *value, 481 unsigned char **new_val, int *new_val_len); 482 483 NETSNMP_IMPORT 484 void clear_tree_flags(struct tree *tp); 485 486 NETSNMP_IMPORT 487 char *snmp_out_toggle_options(char *); 488 NETSNMP_IMPORT 489 char *snmp_out_options(char *, int, char * const *); 490 NETSNMP_IMPORT 491 void snmp_out_toggle_options_usage(const char *, FILE *); 492 NETSNMP_IMPORT 493 char *snmp_in_toggle_options(char *); 494 NETSNMP_IMPORT 495 char *snmp_in_options(char *, int, char * const *); 496 NETSNMP_IMPORT 497 void snmp_in_toggle_options_usage(const char *, FILE *); 498 NETSNMP_IMPORT 499 u_char mib_to_asn_type(int mib_type); 500 501 502 int netsnmp_str2oid(const char *S, oid * O, int L); 503 char *make_printf_format_string(const char *); 504 505 506 #define NETSNMP_STRING_OUTPUT_GUESS 1 507 #define NETSNMP_STRING_OUTPUT_ASCII 2 508 #define NETSNMP_STRING_OUTPUT_HEX 3 509 510 #define NETSNMP_OID_OUTPUT_SUFFIX 1 511 #define NETSNMP_OID_OUTPUT_MODULE 2 512 #define NETSNMP_OID_OUTPUT_FULL 3 513 #define NETSNMP_OID_OUTPUT_NUMERIC 4 514 #define NETSNMP_OID_OUTPUT_UCD 5 515 #define NETSNMP_OID_OUTPUT_NONE 6 516 #ifdef __cplusplus 517 } 518 #endif 519 #endif /* MIB_H */ 520