2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_SNMP_VARS_H
10 #define SQUID_SNMP_VARS_H
12 /**********************************************************************
14 * Copyright 1997 by Carnegie Mellon University
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.
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
34 * Author: Ryan Troll <ryan+@andrew.cmu.edu>
36 **********************************************************************/
44 struct variable_list
{
45 struct variable_list
*next_variable
; /* NULL for last variable */
46 oid
*name
; /* Object identifier of variable */
47 int name_length
; /* number of subid's in name */
48 u_char type
; /* ASN type of variable */
49 union { /* value of variable */
57 struct variable_list
*snmp_var_new(oid
*, int);
58 struct variable_list
*snmp_var_new_integer(oid
*, int, int, unsigned char);
59 struct variable_list
*snmp_var_clone(struct variable_list
*);
60 void snmp_var_free(struct variable_list
*);
62 u_char
*snmp_var_EncodeVarBind(u_char
*, int *, struct variable_list
*, int);
63 u_char
*snmp_var_DecodeVarBind(u_char
*, int *, struct variable_list
**, int);
65 #define MAX_NAME_LEN 64 /* number of subid's in a objid */
67 /* RFC 1902: Structure of Management Information for SNMPv2
71 #define SMI_INTEGER ASN_INTEGER
72 #define SMI_STRING ASN_OCTET_STR
73 #define SMI_OBJID ASN_OBJECT_ID
74 #define SMI_NULLOBJ ASN_NULL
75 #define SMI_IPADDRESS (ASN_APPLICATION | 0) /* OCTET STRING, net byte order */
76 #define SMI_COUNTER32 (ASN_APPLICATION | 1) /* INTEGER */
77 #define SMI_GAUGE32 (ASN_APPLICATION | 2) /* INTEGER */
78 #define SMI_UNSIGNED32 SMI_GAUGE32
79 #define SMI_TIMETICKS (ASN_APPLICATION | 3) /* INTEGER */
80 #define SMI_OPAQUE (ASN_APPLICATION | 4) /* OCTET STRING */
81 #define SMI_COUNTER64 (ASN_APPLICATION | 6) /* INTEGER */
83 /* constants for enums for the MIB nodes
84 * cachePeerAddressType (InetAddressType / ASN_INTEGER)
85 * cacheClientAddressType (InetAddressType / ASN_INTEGER)
89 #ifndef INETADDRESSTYPE_ENUMS
90 #define INETADDRESSTYPE_ENUMS
92 #define INETADDRESSTYPE_UNKNOWN 0
93 #define INETADDRESSTYPE_IPV4 1
94 #define INETADDRESSTYPE_IPV6 2
95 #define INETADDRESSTYPE_IPV4Z 3
96 #define INETADDRESSTYPE_IPV6Z 4
97 #define INETADDRESSTYPE_DNS 16
99 #endif /* INETADDRESSTYPE_ENUMS */
102 * RFC 1905: Protocol Operations for SNMPv2
112 * noSuchObject[0] NULL
113 * noSuchInstance[1] NULL
114 * endOfMibView[2] NULL
118 #define SMI_NOSUCHOBJECT (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* noSuchObject[0] */
119 #define SMI_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* noSuchInstance[1] */
120 #define SMI_ENDOFMIBVIEW (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* endOfMibView[2] */
121 typedef struct variable variable
;
122 typedef struct variable_list variable_list
;
128 #endif /* SQUID_SNMP_VARS_H */