]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (C) 1996-2017 The Squid Software Foundation and contributors | |
3 | * | |
4 | * Squid software is distributed under GPLv2+ license and includes | |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
9 | #ifndef SQUID_PARSE_H | |
10 | #define SQUID_PARSE_H | |
11 | ||
12 | /*********************************************************** | |
13 | Copyright 1989 by Carnegie Mellon University | |
14 | ||
15 | All Rights Reserved | |
16 | ||
17 | Permission to use, copy, modify, and distribute this software and its | |
18 | documentation for any purpose and without fee is hereby granted, | |
19 | provided that the above copyright notice appear in all copies and that | |
20 | both that copyright notice and this permission notice appear in | |
21 | supporting documentation, and that the name of CMU not be | |
22 | used in advertising or publicity pertaining to distribution of the | |
23 | software without specific, written prior permission. | |
24 | ||
25 | CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | |
26 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL | |
27 | CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR | |
28 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
29 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |
30 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
31 | SOFTWARE. | |
32 | ******************************************************************/ | |
33 | ||
34 | /* NP: we only need struct variable_list and typedef oid from SNMP library */ | |
35 | /* we use as ptrs. If this was true C++ we could pre-define their classes. */ | |
36 | #include "snmp_vars.h" | |
37 | ||
38 | /** | |
39 | * A linked list of tag-value pairs for enumerated integers. | |
40 | */ | |
41 | struct enum_list { | |
42 | struct enum_list *next; | |
43 | int value; | |
44 | char *label; | |
45 | }; | |
46 | ||
47 | /** | |
48 | * A tree in the format of the tree structure of the MIB. | |
49 | */ | |
50 | struct snmp_mib_tree { | |
51 | struct snmp_mib_tree *child_list; /* list of children of this node */ | |
52 | struct snmp_mib_tree *next_peer; /* Next node in list of peers */ | |
53 | struct snmp_mib_tree *parent; | |
54 | char label[64]; /* This node's textual name */ | |
55 | u_int subid; /* This node's integer subidentifier */ | |
56 | int type; /* This node's object type */ | |
57 | struct enum_list *enums; /* (optional) list of enumerated integers (otherwise NULL) */ | |
58 | void (*printer) (char *buf, variable_list *var, void *foo, int quiet); /* Value printing function */ | |
59 | }; | |
60 | ||
61 | /* non-aggregate types for tree end nodes */ | |
62 | #define TYPE_OTHER 0 | |
63 | #define TYPE_OBJID 1 | |
64 | #define TYPE_OCTETSTR 2 | |
65 | #define TYPE_INTEGER 3 | |
66 | #define TYPE_NETADDR 4 | |
67 | #define TYPE_IPADDR 5 | |
68 | #define TYPE_COUNTER 6 | |
69 | #define TYPE_GAUGE 7 | |
70 | #define TYPE_TIMETICKS 8 | |
71 | #define TYPE_OPAQUE 9 | |
72 | #define TYPE_NULL 10 | |
73 | ||
74 | #ifdef __cplusplus | |
75 | extern "C" { | |
76 | #endif | |
77 | ||
78 | void init_mib(char *); | |
79 | int read_objid(char *, oid *, int *); | |
80 | void print_objid(oid *, int); | |
81 | void sprint_objid(char *, oid *, int); | |
82 | void print_variable(oid *, int, struct variable_list *); | |
83 | void sprint_variable(char *, oid *, int, struct variable_list *); | |
84 | void sprint_value(char *, oid *, int, struct variable_list *); | |
85 | void print_value(oid *, int, struct variable_list *); | |
86 | ||
87 | /*void print_variable_list(struct variable_list *); */ | |
88 | /*void print_variable_list_value(struct variable_list *); */ | |
89 | /*void print_type(struct variable_list *); */ | |
90 | void print_oid_nums(oid *, int); | |
91 | ||
92 | struct snmp_mib_tree *read_mib(char *); | |
93 | ||
94 | #ifdef __cplusplus | |
95 | } | |
96 | ||
97 | #endif | |
98 | ||
99 | #endif /* SQUID_PARSE_H */ | |
100 |