comparison packages/net/snmp/lib/current/include/snmp_impl.h @ 103:95f3e12a6327 ecos-sw-2000-06-23

Merge from eCos master repository on 2000-06-23-16:41:10-BST
author jlarmour
date Fri, 23 Jun 2000 17:06:31 +0000
parents
children e0c0827131d1
comparison
equal deleted inserted replaced
102:6409b6d94dd7 103:95f3e12a6327
1 //==========================================================================
2 //
3 // ./lib/current/include/snmp_impl.h
4 //
5 //
6 //==========================================================================
7 //####COPYRIGHTBEGIN####
8 //
9 // -------------------------------------------
10 // The contents of this file are subject to the Red Hat eCos Public License
11 // Version 1.1 (the "License"); you may not use this file except in
12 // compliance with the License. You may obtain a copy of the License at
13 // http://www.redhat.com/
14 //
15 // Software distributed under the License is distributed on an "AS IS"
16 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
17 // License for the specific language governing rights and limitations under
18 // the License.
19 //
20 // The Original Code is eCos - Embedded Configurable Operating System,
21 // released September 30, 1998.
22 //
23 // The Initial Developer of the Original Code is Red Hat.
24 // Portions created by Red Hat are
25 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
26 // All Rights Reserved.
27 // -------------------------------------------
28 //
29 //####COPYRIGHTEND####
30 //####UCDSNMPCOPYRIGHTBEGIN####
31 //
32 // -------------------------------------------
33 //
34 // Portions of this software may have been derived from the UCD-SNMP
35 // project, <http://ucd-snmp.ucdavis.edu/> from the University of
36 // California at Davis, which was originally based on the Carnegie Mellon
37 // University SNMP implementation. Portions of this software are therefore
38 // covered by the appropriate copyright disclaimers included herein.
39 //
40 // The release used was version 4.1.2 of May 2000. "ucd-snmp-4.1.2"
41 // -------------------------------------------
42 //
43 //####UCDSNMPCOPYRIGHTEND####
44 //==========================================================================
45 //#####DESCRIPTIONBEGIN####
46 //
47 // Author(s): hmt
48 // Contributors: hmt
49 // Date: 2000-05-30
50 // Purpose: Port of UCD-SNMP distribution to eCos.
51 // Description:
52 //
53 //
54 //####DESCRIPTIONEND####
55 //
56 //==========================================================================
57 /********************************************************************
58 Copyright 1989, 1991, 1992 by Carnegie Mellon University
59
60 Derivative Work -
61 Copyright 1996, 1998, 1999, 2000 The Regents of the University of California
62
63 All Rights Reserved
64
65 Permission to use, copy, modify and distribute this software and its
66 documentation for any purpose and without fee is hereby granted,
67 provided that the above copyright notice appears in all copies and
68 that both that copyright notice and this permission notice appear in
69 supporting documentation, and that the name of CMU and The Regents of
70 the University of California not be used in advertising or publicity
71 pertaining to distribution of the software without specific written
72 permission.
73
74 CMU AND THE REGENTS OF THE UNIVERSITY OF CALIFORNIA DISCLAIM ALL
75 WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
76 WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL CMU OR
77 THE REGENTS OF THE UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY SPECIAL,
78 INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
79 FROM THE LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
80 CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
81 CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
82 *********************************************************************/
83 #ifndef SNMP_IMPL_H
84 #define SNMP_IMPL_H
85
86 #ifdef __cplusplus
87 extern "C" {
88 #endif
89 /*
90 * file: snmp_impl.h
91 */
92
93 /*
94 * Definitions for SNMP implementation.
95 *
96 *
97 */
98 /***********************************************************
99 Copyright 1988, 1989 by Carnegie Mellon University
100
101 All Rights Reserved
102
103 Permission to use, copy, modify, and distribute this software and its
104 documentation for any purpose and without fee is hereby granted,
105 provided that the above copyright notice appear in all copies and that
106 both that copyright notice and this permission notice appear in
107 supporting documentation, and that the name of CMU not be
108 used in advertising or publicity pertaining to distribution of the
109 software without specific, written prior permission.
110
111 CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
112 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
113 CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
114 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
115 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
116 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
117 SOFTWARE.
118 ******************************************************************/
119
120 #include<stdio.h>
121
122 #define COMMUNITY_MAX_LEN 256
123
124 /* Space for character representation of an object identifier */
125 #define SPRINT_MAX_LEN 2560
126
127
128 #ifndef NULL
129 #define NULL 0
130 #endif
131
132 #ifndef TRUE
133 #define TRUE 1
134 #endif
135 #ifndef FALSE
136 #define FALSE 0
137 #endif
138
139 #define READ 1
140 #define WRITE 0
141
142 #define RESERVE1 0
143 #define RESERVE2 1
144 #define ACTION 2
145 #define COMMIT 3
146 #define FREE 4
147 #define UNDO 5
148 #define FINISHED_SUCCESS 9
149 #define FINISHED_FAILURE 10
150
151 /* Access control statements for the agent */
152 #define RONLY 0x1 /* read access only */
153 #define RWRITE 0x2 /* read and write access (must have 0x2 bit set) */
154
155 #define NOACCESS 0x0000 /* no access for anybody */
156
157 /* defined types (from the SMI, RFC 1157) */
158 #define ASN_IPADDRESS (ASN_APPLICATION | 0)
159 #define ASN_COUNTER (ASN_APPLICATION | 1)
160 #define ASN_GAUGE (ASN_APPLICATION | 2)
161 #define ASN_UNSIGNED (ASN_APPLICATION | 2) /* RFC 1902 - same as GAUGE */
162 #define ASN_TIMETICKS (ASN_APPLICATION | 3)
163 #define ASN_OPAQUE (ASN_APPLICATION | 4) /* changed so no conflict with other includes */
164
165 /* defined types (from the SMI, RFC 1442) */
166 #define ASN_NSAP (ASN_APPLICATION | 5) /* historic - don't use */
167 #define ASN_COUNTER64 (ASN_APPLICATION | 6)
168 #define ASN_UINTEGER (ASN_APPLICATION | 7) /* historic - don't use */
169
170 #ifdef OPAQUE_SPECIAL_TYPES
171 /* defined types from draft-perkins-opaque-01.txt */
172 #define ASN_FLOAT (ASN_APPLICATION | 8)
173 #define ASN_DOUBLE (ASN_APPLICATION | 9)
174 #define ASN_INTEGER64 (ASN_APPLICATION | 10)
175 #define ASN_UNSIGNED64 (ASN_APPLICATION | 11)
176 #endif /* OPAQUE_SPECIAL_TYPES */
177
178 /* #define CMU_COMPATIBLE */
179 #ifdef CMU_COMPATIBLE
180 #define INTEGER ASN_INTEGER
181 #define STRING ASN_OCTET_STR
182 #define OBJID ASN_OBJECT_ID
183 #define NULLOBJ ASN_NULL
184 #define BITSTRING ASN_BIT_STR /* HISTORIC - don't use */
185 #define IPADDRESS ASN_IPADDRESS
186 #define COUNTER ASN_COUNTER
187 #define GAUGE ASN_GAUGE
188 #define UNSIGNED ASN_UNSIGNED
189 #define TIMETICKS ASN_TIMETICKS
190 #define ASNT_OPAQUE ASN_OPAQUE
191 #define NSAP ASN_NSAP
192 #define COUNTER64 ASN_COUNTER64
193 #define UINTEGER ASN_UINTEGER
194 #endif /* CMU_COMPATIBLE */
195
196 /* changed to ERROR_MSG to eliminate conflict with other includes */
197 #define ERROR_MSG(string) snmp_set_detail(string)
198
199 /* from snmp.c */
200 extern u_char sid[]; /* size SID_MAX_LEN */
201 extern int snmp_errno;
202
203
204 /*
205 * For calling secauth_build, FIRST_PASS is an indication that a new nonce
206 * and lastTimeStamp should be recorded. LAST_PASS is an indication that
207 * the packet should be checksummed and encrypted if applicable, in
208 * preparation for transmission.
209 * 0 means do neither, FIRST_PASS | LAST_PASS means do both.
210 * For secauth_parse, FIRST_PASS means decrypt the packet, otherwise leave it
211 * alone. LAST_PASS is ignored.
212 */
213 #define FIRST_PASS 1
214 #define LAST_PASS 2
215 u_char *snmp_comstr_parse(u_char *, size_t *, u_char *, size_t *, long *);
216 u_char *snmp_comstr_build (u_char *, size_t *, u_char *, size_t *, long *, size_t);
217
218 int has_access (u_char, int, int, int);
219 #ifdef __cplusplus
220 }
221 #endif
222
223 #endif /* SNMP_IMPL_H */