]> git.ipfire.org Git - thirdparty/squid.git/blob - include/snmp_vars.h
C++ conversion
[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: snmp_vars.h,v 1.12 2002/10/13 20:34:51 robertc Exp $
29 *
30 **********************************************************************/
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 struct variable_list {
37 struct variable_list *next_variable; /* NULL for last variable */
38 oid *name; /* Object identifier of variable */
39 int name_length; /* number of subid's in name */
40 u_char type; /* ASN type of variable */
41 union { /* value of variable */
42 int *integer;
43 u_char *string;
44 oid *objid;
45 } val;
46 int val_len;
47 };
48
49 struct variable_list *snmp_var_new(oid *, int);
50 struct variable_list *snmp_var_new_integer(oid *, int, int, unsigned char);
51 struct variable_list *snmp_var_clone(struct variable_list *);
52 void snmp_var_free(struct variable_list *);
53
54 u_char *snmp_var_EncodeVarBind(u_char *, int *, struct variable_list *, int);
55 u_char *snmp_var_DecodeVarBind(u_char *, int *, struct variable_list **, int);
56
57 #define MAX_NAME_LEN 64 /* number of subid's in a objid */
58
59 /* RFC 1902: Structure of Management Information for SNMPv2
60 *
61 * Defined Types
62 */
63 #define SMI_INTEGER ASN_INTEGER
64 #define SMI_STRING ASN_OCTET_STR
65 #define SMI_OBJID ASN_OBJECT_ID
66 #define SMI_NULLOBJ ASN_NULL
67 #define SMI_IPADDRESS (ASN_APPLICATION | 0) /* OCTET STRING, net byte order */
68 #define SMI_COUNTER32 (ASN_APPLICATION | 1) /* INTEGER */
69 #define SMI_GAUGE32 (ASN_APPLICATION | 2) /* INTEGER */
70 #define SMI_UNSIGNED32 SMI_GAUGE32
71 #define SMI_TIMETICKS (ASN_APPLICATION | 3) /* INTEGER */
72 #define SMI_OPAQUE (ASN_APPLICATION | 4) /* OCTET STRING */
73 #define SMI_COUNTER64 (ASN_APPLICATION | 6) /* INTEGER */
74 #define SMI_NOSUCHOBJECT (ASN_CONTEXT | ASN_PRIMITIVE | 0x0)
75 #define SMI_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x1)
76 #define SMI_ENDOFMIBVIEW (ASN_CONTEXT | ASN_PRIMITIVE | 0x2)
77 typedef struct variable variable;
78 typedef struct variable_list variable_list;
79
80 #ifdef __cplusplus
81 }
82 #endif
83
84 #endif /* SQUID_SNMP_VARS_H */