1 |
27 |
unneback |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// ./lib/current/include/vacm.h
|
4 |
|
|
//
|
5 |
|
|
//
|
6 |
|
|
//==========================================================================
|
7 |
|
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
8 |
|
|
// -------------------------------------------
|
9 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
10 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
11 |
|
|
//
|
12 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
13 |
|
|
// the terms of the GNU General Public License as published by the Free
|
14 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
15 |
|
|
//
|
16 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
17 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
18 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
19 |
|
|
// for more details.
|
20 |
|
|
//
|
21 |
|
|
// You should have received a copy of the GNU General Public License along
|
22 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
23 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
24 |
|
|
//
|
25 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
26 |
|
|
// or inline functions from this file, or you compile this file and link it
|
27 |
|
|
// with other works to produce a work based on this file, this file does not
|
28 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
29 |
|
|
// License. However the source code for this file must still be made available
|
30 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
31 |
|
|
//
|
32 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
33 |
|
|
// this file might be covered by the GNU General Public License.
|
34 |
|
|
//
|
35 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
36 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
37 |
|
|
// -------------------------------------------
|
38 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
//####UCDSNMPCOPYRIGHTBEGIN####
|
40 |
|
|
//
|
41 |
|
|
// -------------------------------------------
|
42 |
|
|
//
|
43 |
|
|
// Portions of this software may have been derived from the UCD-SNMP
|
44 |
|
|
// project, <http://ucd-snmp.ucdavis.edu/> from the University of
|
45 |
|
|
// California at Davis, which was originally based on the Carnegie Mellon
|
46 |
|
|
// University SNMP implementation. Portions of this software are therefore
|
47 |
|
|
// covered by the appropriate copyright disclaimers included herein.
|
48 |
|
|
//
|
49 |
|
|
// The release used was version 4.1.2 of May 2000. "ucd-snmp-4.1.2"
|
50 |
|
|
// -------------------------------------------
|
51 |
|
|
//
|
52 |
|
|
//####UCDSNMPCOPYRIGHTEND####
|
53 |
|
|
//==========================================================================
|
54 |
|
|
//#####DESCRIPTIONBEGIN####
|
55 |
|
|
//
|
56 |
|
|
// Author(s): hmt
|
57 |
|
|
// Contributors: hmt
|
58 |
|
|
// Date: 2000-05-30
|
59 |
|
|
// Purpose: Port of UCD-SNMP distribution to eCos.
|
60 |
|
|
// Description:
|
61 |
|
|
//
|
62 |
|
|
//
|
63 |
|
|
//####DESCRIPTIONEND####
|
64 |
|
|
//
|
65 |
|
|
//==========================================================================
|
66 |
|
|
/********************************************************************
|
67 |
|
|
Copyright 1989, 1991, 1992 by Carnegie Mellon University
|
68 |
|
|
|
69 |
|
|
Derivative Work -
|
70 |
|
|
Copyright 1996, 1998, 1999, 2000 The Regents of the University of California
|
71 |
|
|
|
72 |
|
|
All Rights Reserved
|
73 |
|
|
|
74 |
|
|
Permission to use, copy, modify and distribute this software and its
|
75 |
|
|
documentation for any purpose and without fee is hereby granted,
|
76 |
|
|
provided that the above copyright notice appears in all copies and
|
77 |
|
|
that both that copyright notice and this permission notice appear in
|
78 |
|
|
supporting documentation, and that the name of CMU and The Regents of
|
79 |
|
|
the University of California not be used in advertising or publicity
|
80 |
|
|
pertaining to distribution of the software without specific written
|
81 |
|
|
permission.
|
82 |
|
|
|
83 |
|
|
CMU AND THE REGENTS OF THE UNIVERSITY OF CALIFORNIA DISCLAIM ALL
|
84 |
|
|
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
|
85 |
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL CMU OR
|
86 |
|
|
THE REGENTS OF THE UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY SPECIAL,
|
87 |
|
|
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
|
88 |
|
|
FROM THE LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
89 |
|
|
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
90 |
|
|
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
91 |
|
|
*********************************************************************/
|
92 |
|
|
/*
|
93 |
|
|
* vacm.h
|
94 |
|
|
*
|
95 |
|
|
* SNMPv3 View-based Access Control Model
|
96 |
|
|
*/
|
97 |
|
|
|
98 |
|
|
#ifndef VACM_H
|
99 |
|
|
#define VACM_H
|
100 |
|
|
|
101 |
|
|
#ifdef __cplusplus
|
102 |
|
|
extern "C" {
|
103 |
|
|
#endif
|
104 |
|
|
|
105 |
|
|
#define SECURITYMODEL 1
|
106 |
|
|
#define SECURITYNAME 2
|
107 |
|
|
#define SECURITYGROUP 3
|
108 |
|
|
#define SECURITYSTORAGE 4
|
109 |
|
|
#define SECURITYSTATUS 5
|
110 |
|
|
|
111 |
|
|
#define ACCESSPREFIX 1
|
112 |
|
|
#define ACCESSMODEL 2
|
113 |
|
|
#define ACCESSLEVEL 3
|
114 |
|
|
#define ACCESSMATCH 4
|
115 |
|
|
#define ACCESSREAD 5
|
116 |
|
|
#define ACCESSWRITE 6
|
117 |
|
|
#define ACCESSNOTIFY 7
|
118 |
|
|
#define ACCESSSTORAGE 8
|
119 |
|
|
#define ACCESSSTATUS 9
|
120 |
|
|
|
121 |
|
|
#define VIEWNAME 1
|
122 |
|
|
#define VIEWSUBTREE 2
|
123 |
|
|
#define VIEWMASK 3
|
124 |
|
|
#define VIEWTYPE 4
|
125 |
|
|
#define VIEWSTORAGE 5
|
126 |
|
|
#define VIEWSTATUS 6
|
127 |
|
|
|
128 |
|
|
#define VACM_MAX_STRING 32
|
129 |
|
|
#define VACMSTRINGLEN 34 /* VACM_MAX_STRING + 2 */
|
130 |
|
|
|
131 |
|
|
struct vacm_securityEntry {
|
132 |
|
|
char securityName[VACMSTRINGLEN];
|
133 |
|
|
snmp_ipaddr sourceIp;
|
134 |
|
|
snmp_ipaddr sourceMask;
|
135 |
|
|
char community[VACMSTRINGLEN];
|
136 |
|
|
struct vacm_securityEntry *next;
|
137 |
|
|
};
|
138 |
|
|
|
139 |
|
|
struct vacm_groupEntry {
|
140 |
|
|
int securityModel;
|
141 |
|
|
char securityName[VACMSTRINGLEN];
|
142 |
|
|
char groupName[VACMSTRINGLEN];
|
143 |
|
|
int storageType;
|
144 |
|
|
int status;
|
145 |
|
|
|
146 |
|
|
u_long bitMask;
|
147 |
|
|
struct vacm_groupEntry *reserved;
|
148 |
|
|
struct vacm_groupEntry *next;
|
149 |
|
|
};
|
150 |
|
|
|
151 |
|
|
struct vacm_accessEntry {
|
152 |
|
|
char groupName[VACMSTRINGLEN];
|
153 |
|
|
char contextPrefix[VACMSTRINGLEN];
|
154 |
|
|
int securityModel;
|
155 |
|
|
int securityLevel;
|
156 |
|
|
int contextMatch;
|
157 |
|
|
char readView[VACMSTRINGLEN];
|
158 |
|
|
char writeView[VACMSTRINGLEN];
|
159 |
|
|
char notifyView[VACMSTRINGLEN];
|
160 |
|
|
int storageType;
|
161 |
|
|
int status;
|
162 |
|
|
|
163 |
|
|
u_long bitMask;
|
164 |
|
|
struct vacm_accessEntry *reserved;
|
165 |
|
|
struct vacm_accessEntry *next;
|
166 |
|
|
};
|
167 |
|
|
|
168 |
|
|
struct vacm_viewEntry {
|
169 |
|
|
char viewName[VACMSTRINGLEN];
|
170 |
|
|
oid viewSubtree[MAX_OID_LEN];
|
171 |
|
|
size_t viewSubtreeLen;
|
172 |
|
|
u_char viewMask[VACMSTRINGLEN];
|
173 |
|
|
size_t viewMaskLen;
|
174 |
|
|
int viewType;
|
175 |
|
|
int viewStorageType;
|
176 |
|
|
int viewStatus;
|
177 |
|
|
|
178 |
|
|
u_long bitMask;
|
179 |
|
|
|
180 |
|
|
struct vacm_viewEntry *reserved;
|
181 |
|
|
struct vacm_viewEntry *next;
|
182 |
|
|
};
|
183 |
|
|
|
184 |
|
|
void vacm_destroyViewEntry (const char *, oid *, size_t);
|
185 |
|
|
void vacm_destroyAllViewEntries (void);
|
186 |
|
|
|
187 |
|
|
struct vacm_viewEntry *
|
188 |
|
|
vacm_getViewEntry (const char *, oid *, size_t);
|
189 |
|
|
/*
|
190 |
|
|
* Returns a pointer to the viewEntry with the
|
191 |
|
|
* same viewName and viewSubtree
|
192 |
|
|
* Returns NULL if that entry does not exist.
|
193 |
|
|
*/
|
194 |
|
|
|
195 |
|
|
void
|
196 |
|
|
vacm_scanViewInit (void);
|
197 |
|
|
/*
|
198 |
|
|
* Initialized the scan routines so that they will begin at the
|
199 |
|
|
* beginning of the list of viewEntries.
|
200 |
|
|
*
|
201 |
|
|
*/
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
struct vacm_viewEntry *
|
205 |
|
|
vacm_scanViewNext (void);
|
206 |
|
|
/*
|
207 |
|
|
* Returns a pointer to the next viewEntry.
|
208 |
|
|
* These entries are returned in no particular order,
|
209 |
|
|
* but if N entries exist, N calls to view_scanNext() will
|
210 |
|
|
* return all N entries once.
|
211 |
|
|
* Returns NULL if all entries have been returned.
|
212 |
|
|
* view_scanInit() starts the scan over.
|
213 |
|
|
*/
|
214 |
|
|
|
215 |
|
|
struct vacm_viewEntry *
|
216 |
|
|
vacm_createViewEntry (const char *, oid *, size_t);
|
217 |
|
|
/*
|
218 |
|
|
* Creates a viewEntry with the given index
|
219 |
|
|
* and returns a pointer to it.
|
220 |
|
|
* The status of this entry is created as invalid.
|
221 |
|
|
*/
|
222 |
|
|
|
223 |
|
|
void vacm_destroyGroupEntry (int, const char *);
|
224 |
|
|
void vacm_destroyAllGroupEntries (void);
|
225 |
|
|
struct vacm_groupEntry *vacm_createGroupEntry (int, const char *);
|
226 |
|
|
struct vacm_groupEntry *vacm_getGroupEntry (int, const char *);
|
227 |
|
|
void vacm_scanGroupInit (void);
|
228 |
|
|
struct vacm_groupEntry *vacm_scanGroupNext (void);
|
229 |
|
|
|
230 |
|
|
void vacm_destroyAccessEntry (const char *, const char *, int, int);
|
231 |
|
|
void vacm_destroyAllAccessEntries (void);
|
232 |
|
|
struct vacm_accessEntry *vacm_createAccessEntry (const char *, const char *, int, int);
|
233 |
|
|
struct vacm_accessEntry *vacm_getAccessEntry (const char *, const char *, int, int);
|
234 |
|
|
void vacm_scanAccessInit (void);
|
235 |
|
|
struct vacm_accessEntry *vacm_scanAccessNext (void);
|
236 |
|
|
|
237 |
|
|
void vacm_destroySecurityEntry (const char *);
|
238 |
|
|
struct vacm_securityEntry *vacm_createSecurityEntry (const char *);
|
239 |
|
|
struct vacm_securityEntry *vacm_getSecurityEntry (const char *);
|
240 |
|
|
void vacm_scanSecurityInit (void);
|
241 |
|
|
struct vacm_securityEntry *vacm_scanSecurityEntry (void);
|
242 |
|
|
int vacm_is_configured(void);
|
243 |
|
|
|
244 |
|
|
#ifdef __cplusplus
|
245 |
|
|
}
|
246 |
|
|
#endif
|
247 |
|
|
|
248 |
|
|
#endif /* VACM_H */
|