]> git.ipfire.org Git - thirdparty/squid.git/blob - include/snmp_impl.h
Continuing SNMP debugging.
[thirdparty/squid.git] / include / snmp_impl.h
1 /*
2 * Definitions for SNMP (RFC 1067) implementation.
3 *
4 *
5 */
6 /***********************************************************
7 Copyright 1988, 1989 by Carnegie Mellon University
8
9 All Rights Reserved
10
11 Permission to use, copy, modify, and distribute this software and its
12 documentation for any purpose and without fee is hereby granted,
13 provided that the above copyright notice appear in all copies and that
14 both that copyright notice and this permission notice appear in
15 supporting documentation, and that the name of CMU not be
16 used in advertising or publicity pertaining to distribution of the
17 software without specific, written prior permission.
18
19 CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
20 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
21 CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
22 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
23 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
24 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
25 SOFTWARE.
26 ******************************************************************/
27
28 #ifndef SNMP_IMPL_H
29 #define SNMP_IMPL_H
30
31
32 #undef _ANSI_ARGS_
33 #if (defined(__STDC__) && ! defined(NO_PROTOTYPE)) || defined(USE_PROTOTYPE)
34 #define _ANSI_ARGS_(x) x
35 #else
36 #define _ANSI_ARGS_(x) ()
37 #endif
38
39
40 #if (defined vax) || (defined (mips))
41 /*
42 * This is a fairly bogus thing to do, but there seems to be no better way for
43 * compilers that don't understand void pointers.
44 */
45 #define void char
46 #endif
47
48 /*
49 * Error codes:
50 */
51 /*
52 * These must not clash with SNMP error codes (all positive).
53 */
54 #define PARSE_ERROR -1
55 #define BUILD_ERROR -2
56
57 #define SID_MAX_LEN 200
58 #define MAX_NAME_LEN 64 /* number of subid's in a objid */
59
60 #ifndef NULL
61 #define NULL 0
62 #endif
63
64 #ifndef TRUE
65 #define TRUE 1
66 #endif
67 #ifndef FALSE
68 #define FALSE 0
69 #endif
70
71 #define READ 1
72 #define WRITE 0
73
74 #define RESERVE1 0
75 #define RESERVE2 1
76 #define COMMIT 2
77 #define ACTION 3
78 #define FREE 4
79
80 #define RONLY 0xAAAA /* read access for everyone */
81 #define RWRITE 0xAABA /* add write access for community private */
82 #define NOACCESS 0x0000 /* no access for anybody */
83
84 #define INTEGER ASN_INTEGER
85 #define STRING ASN_OCTET_STR
86 #define OBJID ASN_OBJECT_ID
87 #define NULLOBJ ASN_NULL
88
89 /* defined types (from the SMI, RFC 1065) */
90 #define IPADDRESS (ASN_APPLICATION | 0)
91 #define COUNTER (ASN_APPLICATION | 1)
92 #define GAUGE (ASN_APPLICATION | 2)
93 #define TIMETICKS (ASN_APPLICATION | 3)
94 #define OPAQUE (ASN_APPLICATION | 4)
95
96 #define NSAP (ASN_APPLICATION | 5)
97 #define COUNTER64 (ASN_APPLICATION | 6)
98 #define UINTEGER (ASN_APPLICATION | 7)
99 #define DEBUG
100 #ifdef DEBUG
101 #define ERROR(string) fprintf(stderr,"%s(%d): ERROR %s\n",__FILE__, __LINE__, string);
102 #else
103 #define ERROR(string)
104 #endif
105
106 /* from snmp.c */
107 extern u_char sid[]; /* size SID_MAX_LEN */
108
109 extern u_char *snmp_parse_var_op _ANSI_ARGS_((u_char * data,
110 oid * var_name,
111 int *var_name_len,
112 u_char * var_val_type,
113 int *var_val_len,
114 u_char ** var_val,
115 int *listlength));
116
117 extern u_char *snmp_build_var_op _ANSI_ARGS_((u_char * data,
118 oid * var_name,
119 int *var_name_len,
120 u_char var_val_type,
121 int var_val_len,
122 u_char * var_val,
123 int *listlength));
124
125 extern u_char *snmp_auth_parse _ANSI_ARGS_((u_char * data,
126 int *length,
127 u_char * sid,
128 int *slen,
129 long *version));
130
131 extern u_char *snmp_auth_build _ANSI_ARGS_((u_char * data,
132 int *length,
133 struct snmp_session * session,
134 int is_agent,
135 int messagelen));
136
137 #endif