]> git.ipfire.org Git - thirdparty/squid.git/blame - include/snmp_vars.h
SourceFormat Enforcement
[thirdparty/squid.git] / include / snmp_vars.h
CommitLineData
5c193dec 1/*
ef57eb7b 2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
5c193dec
AJ
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
b5638623 9#ifndef SQUID_SNMP_VARS_H
10#define SQUID_SNMP_VARS_H
54f642bf 11
12/**********************************************************************
13 *
14 * Copyright 1997 by Carnegie Mellon University
c5dd4956 15 *
54f642bf 16 * All Rights Reserved
c5dd4956 17 *
54f642bf 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.
c5dd4956 25 *
54f642bf 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.
c5dd4956 33 *
54f642bf 34 * Author: Ryan Troll <ryan+@andrew.cmu.edu>
c5dd4956 35 *
54f642bf 36 **********************************************************************/
37
e1f7507e
AJ
38#include "asn1.h"
39
e6ccf245 40#ifdef __cplusplus
e1381638 41extern "C" {
e6ccf245 42#endif
43
f53969cc
SM
44struct 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 */
50 int *integer;
51 u_char *string;
52 oid *objid;
53 } val;
54 int val_len;
55};
56
57struct variable_list *snmp_var_new(oid *, int);
58struct variable_list *snmp_var_new_integer(oid *, int, int, unsigned char);
59struct variable_list *snmp_var_clone(struct variable_list *);
60void snmp_var_free(struct variable_list *);
61
62u_char *snmp_var_EncodeVarBind(u_char *, int *, struct variable_list *, int);
63u_char *snmp_var_DecodeVarBind(u_char *, int *, struct variable_list **, int);
64
65#define MAX_NAME_LEN 64 /* number of subid's in a objid */
66
67/* RFC 1902: Structure of Management Information for SNMPv2
68 *
69 * Defined Types
70 */
54f642bf 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
f53969cc
SM
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 */
43d4303e 78#define SMI_UNSIGNED32 SMI_GAUGE32
f53969cc
SM
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 */
82
83/* constants for enums for the MIB nodes
84 * cachePeerAddressType (InetAddressType / ASN_INTEGER)
85 * cacheClientAddressType (InetAddressType / ASN_INTEGER)
86 * Defined Types
87 */
cc192b50 88
89#ifndef INETADDRESSTYPE_ENUMS
90#define INETADDRESSTYPE_ENUMS
91
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
98
99#endif /* INETADDRESSTYPE_ENUMS */
100
f53969cc
SM
101/*
102 * RFC 1905: Protocol Operations for SNMPv2
103 *
104 * Variable binding.
105 *
106 * VarBind ::=
107 * SEQUENCE {
108 * name ObjectName
109 * CHOICE {
110 * value ObjectSyntax
111 * unSpecified NULL
112 * noSuchObject[0] NULL
113 * noSuchInstance[1] NULL
114 * endOfMibView[2] NULL
115 * }
116 * }
117 */
cc192b50 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] */
f53969cc
SM
121typedef struct variable variable;
122typedef struct variable_list variable_list;
54f642bf 123
e6ccf245 124#ifdef __cplusplus
125}
126#endif
127
b5638623 128#endif /* SQUID_SNMP_VARS_H */
f53969cc 129