]> git.ipfire.org Git - thirdparty/squid.git/blob - include/snmp_vars.h
Author: Francesco Chemolli <kinkie@squid-cache.org>
[thirdparty/squid.git] / include / snmp_vars.h
1 #ifndef SQUID_SNMP_VARS_H
2 #define SQUID_SNMP_VARS_H
3
4 /**********************************************************************
5 *
6 * Copyright 1997 by Carnegie Mellon University
7 *
8 * All Rights Reserved
9 *
10 * Permission to use, copy, modify, and distribute this software and its
11 * documentation for any purpose and without fee is hereby granted,
12 * provided that the above copyright notice appear in all copies and that
13 * both that copyright notice and this permission notice appear in
14 * supporting documentation, and that the name of CMU not be
15 * used in advertising or publicity pertaining to distribution of the
16 * software without specific, written prior permission.
17 *
18 * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
19 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
20 * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
21 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
22 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
23 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
24 * SOFTWARE.
25 *
26 * Author: Ryan Troll <ryan+@andrew.cmu.edu>
27 *
28 * $Id$
29 *
30 **********************************************************************/
31
32 #include "asn1.h"
33
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38
39 struct variable_list {
40 struct variable_list *next_variable; /* NULL for last variable */
41 oid *name; /* Object identifier of variable */
42 int name_length; /* number of subid's in name */
43 u_char type; /* ASN type of variable */
44 union { /* value of variable */
45 int *integer;
46 u_char *string;
47 oid *objid;
48 } val;
49 int val_len;
50 };
51
52 struct variable_list *snmp_var_new(oid *, int);
53 struct variable_list *snmp_var_new_integer(oid *, int, int, unsigned char);
54 struct variable_list *snmp_var_clone(struct variable_list *);
55 void snmp_var_free(struct variable_list *);
56
57 u_char *snmp_var_EncodeVarBind(u_char *, int *, struct variable_list *, int);
58 u_char *snmp_var_DecodeVarBind(u_char *, int *, struct variable_list **, int);
59
60 #define MAX_NAME_LEN 64 /* number of subid's in a objid */
61
62 /* RFC 1902: Structure of Management Information for SNMPv2
63 *
64 * Defined Types
65 */
66 #define SMI_INTEGER ASN_INTEGER
67 #define SMI_STRING ASN_OCTET_STR
68 #define SMI_OBJID ASN_OBJECT_ID
69 #define SMI_NULLOBJ ASN_NULL
70 #define SMI_IPADDRESS (ASN_APPLICATION | 0) /* OCTET STRING, net byte order */
71 #define SMI_COUNTER32 (ASN_APPLICATION | 1) /* INTEGER */
72 #define SMI_GAUGE32 (ASN_APPLICATION | 2) /* INTEGER */
73 #define SMI_UNSIGNED32 SMI_GAUGE32
74 #define SMI_TIMETICKS (ASN_APPLICATION | 3) /* INTEGER */
75 #define SMI_OPAQUE (ASN_APPLICATION | 4) /* OCTET STRING */
76 #define SMI_COUNTER64 (ASN_APPLICATION | 6) /* INTEGER */
77
78
79 /* constants for enums for the MIB nodes
80 * cachePeerAddressType (InetAddressType / ASN_INTEGER)
81 * cacheClientAddressType (InetAddressType / ASN_INTEGER)
82 * Defined Types
83 */
84
85 #ifndef INETADDRESSTYPE_ENUMS
86 #define INETADDRESSTYPE_ENUMS
87
88 #define INETADDRESSTYPE_UNKNOWN 0
89 #define INETADDRESSTYPE_IPV4 1
90 #define INETADDRESSTYPE_IPV6 2
91 #define INETADDRESSTYPE_IPV4Z 3
92 #define INETADDRESSTYPE_IPV6Z 4
93 #define INETADDRESSTYPE_DNS 16
94
95 #endif /* INETADDRESSTYPE_ENUMS */
96
97
98 /*
99 * RFC 1905: Protocol Operations for SNMPv2
100 *
101 * Variable binding.
102 *
103 * VarBind ::=
104 * SEQUENCE {
105 * name ObjectName
106 * CHOICE {
107 * value ObjectSyntax
108 * unSpecified NULL
109 * noSuchObject[0] NULL
110 * noSuchInstance[1] NULL
111 * endOfMibView[2] NULL
112 * }
113 * }
114 */
115 #define SMI_NOSUCHOBJECT (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* noSuchObject[0] */
116 #define SMI_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* noSuchInstance[1] */
117 #define SMI_ENDOFMIBVIEW (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* endOfMibView[2] */
118 typedef struct variable variable;
119 typedef struct variable_list variable_list;
120
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif /* SQUID_SNMP_VARS_H */