Mercurial > flash_v2
comparison packages/net/snmp/lib/current/include/snmpusm.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 | 0d0f03f76f6a |
comparison
equal
deleted
inserted
replaced
| 102:6409b6d94dd7 | 103:95f3e12a6327 |
|---|---|
| 1 //========================================================================== | |
| 2 // | |
| 3 // ./lib/current/include/snmpusm.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 /* | |
| 84 * snmpusm.h | |
| 85 * | |
| 86 * Header file for USM support. | |
| 87 */ | |
| 88 | |
| 89 #ifndef SNMPUSM_H | |
| 90 #define SNMPUSM_H | |
| 91 | |
| 92 #ifdef __cplusplus | |
| 93 extern "C" { | |
| 94 #endif | |
| 95 | |
| 96 #define WILDCARDSTRING "*" | |
| 97 | |
| 98 /* | |
| 99 * General. | |
| 100 */ | |
| 101 #define USM_MAX_ID_LENGTH 1024 /* In bytes. */ | |
| 102 #define USM_MAX_SALT_LENGTH 64 /* In BITS. */ | |
| 103 #define USM_MAX_KEYEDHASH_LENGTH 128 /* In BITS. */ | |
| 104 | |
| 105 #define USM_TIME_WINDOW 150 | |
| 106 | |
| 107 | |
| 108 /* | |
| 109 * Structures. | |
| 110 */ | |
| 111 struct usmStateReference { | |
| 112 char *usr_name; | |
| 113 size_t usr_name_length; | |
| 114 u_char *usr_engine_id; | |
| 115 size_t usr_engine_id_length; | |
| 116 oid *usr_auth_protocol; | |
| 117 size_t usr_auth_protocol_length; | |
| 118 u_char *usr_auth_key; | |
| 119 size_t usr_auth_key_length; | |
| 120 oid *usr_priv_protocol; | |
| 121 size_t usr_priv_protocol_length; | |
| 122 u_char *usr_priv_key; | |
| 123 size_t usr_priv_key_length; | |
| 124 u_int usr_sec_level; | |
| 125 }; | |
| 126 | |
| 127 | |
| 128 /* struct usmUser: a structure to represent a given user in a list */ | |
| 129 /* Note: Any changes made to this structure need to be reflected in | |
| 130 the following functions: */ | |
| 131 | |
| 132 struct usmUser; | |
| 133 struct usmUser { | |
| 134 u_char *engineID; | |
| 135 size_t engineIDLen; | |
| 136 char *name; | |
| 137 char *secName; | |
| 138 oid *cloneFrom; | |
| 139 size_t cloneFromLen; | |
| 140 oid *authProtocol; | |
| 141 size_t authProtocolLen; | |
| 142 u_char *authKey; | |
| 143 size_t authKeyLen; | |
| 144 oid *privProtocol; | |
| 145 size_t privProtocolLen; | |
| 146 u_char *privKey; | |
| 147 size_t privKeyLen; | |
| 148 u_char *userPublicString; | |
| 149 int userStatus; | |
| 150 int userStorageType; | |
| 151 struct usmUser *next; | |
| 152 struct usmUser *prev; | |
| 153 }; | |
| 154 | |
| 155 | |
| 156 | |
| 157 /* | |
| 158 * Prototypes. | |
| 159 */ | |
| 160 void usm_set_reportErrorOnUnknownID (int value); | |
| 161 | |
| 162 struct usmStateReference * | |
| 163 usm_malloc_usmStateReference (void); | |
| 164 | |
| 165 void usm_free_usmStateReference (void *old); | |
| 166 | |
| 167 int usm_set_usmStateReference_name ( | |
| 168 struct usmStateReference *ref, | |
| 169 char *name, | |
| 170 size_t name_len); | |
| 171 | |
| 172 int usm_set_usmStateReference_engine_id ( | |
| 173 struct usmStateReference *ref, | |
| 174 u_char *engine_id, | |
| 175 size_t engine_id_len); | |
| 176 | |
| 177 int usm_set_usmStateReference_auth_protocol ( | |
| 178 struct usmStateReference *ref, | |
| 179 oid *auth_protocol, | |
| 180 size_t auth_protocol_len); | |
| 181 | |
| 182 int usm_set_usmStateReference_auth_key ( | |
| 183 struct usmStateReference *ref, | |
| 184 u_char *auth_key, | |
| 185 size_t auth_key_len); | |
| 186 | |
| 187 int usm_set_usmStateReference_priv_protocol ( | |
| 188 struct usmStateReference *ref, | |
| 189 oid *priv_protocol, | |
| 190 size_t priv_protocol_len); | |
| 191 | |
| 192 int usm_set_usmStateReference_priv_key ( | |
| 193 struct usmStateReference *ref, | |
| 194 u_char *priv_key, | |
| 195 size_t priv_key_len); | |
| 196 | |
| 197 int usm_set_usmStateReference_sec_level ( | |
| 198 struct usmStateReference *ref, | |
| 199 int sec_level); | |
| 200 | |
| 201 #ifdef SNMP_TESTING_CODE | |
| 202 void emergency_print (u_char *field, u_int length); | |
| 203 #endif | |
| 204 | |
| 205 int asn_predict_int_length (int type, long number, size_t len); | |
| 206 | |
| 207 int asn_predict_length (int type, u_char *ptr, size_t u_char_len); | |
| 208 | |
| 209 int usm_set_salt ( | |
| 210 u_char *iv, | |
| 211 size_t *iv_length, | |
| 212 u_char *priv_salt, | |
| 213 size_t priv_salt_length, | |
| 214 u_char *msgSalt ); | |
| 215 | |
| 216 int usm_parse_security_parameters ( | |
| 217 u_char *secParams, | |
| 218 size_t remaining, | |
| 219 u_char *secEngineID, | |
| 220 size_t *secEngineIDLen, | |
| 221 u_int *boots_uint, | |
| 222 u_int *time_uint, | |
| 223 char *secName, | |
| 224 size_t *secNameLen, | |
| 225 u_char *signature, | |
| 226 size_t *signature_length, | |
| 227 u_char *salt, | |
| 228 size_t *salt_length, | |
| 229 u_char **data_ptr); | |
| 230 | |
| 231 int usm_check_and_update_timeliness ( | |
| 232 u_char *secEngineID, | |
| 233 size_t secEngineIDLen, | |
| 234 u_int boots_uint, | |
| 235 u_int time_uint, | |
| 236 int *error); | |
| 237 | |
| 238 int usm_generate_out_msg (int, u_char *, size_t, int, int, u_char *, size_t, | |
| 239 char *, size_t, int, u_char *, size_t, void *, | |
| 240 u_char *, size_t *, u_char **, size_t *); | |
| 241 | |
| 242 int usm_process_in_msg (int, size_t, u_char *, int, int, u_char *, size_t, | |
| 243 u_char *, size_t *, char *, size_t *, u_char **, size_t *, | |
| 244 size_t *, void **); | |
| 245 | |
| 246 int usm_check_secLevel(int level, struct usmUser *user); | |
| 247 struct usmUser *usm_get_userList(void); | |
| 248 struct usmUser *usm_get_user(u_char *engineID, size_t engineIDLen, char *name); | |
| 249 struct usmUser *usm_get_user_from_list(u_char *engineID, size_t engineIDLen, | |
| 250 char *name, struct usmUser *userList, | |
| 251 int use_default); | |
| 252 struct usmUser *usm_add_user(struct usmUser *user); | |
| 253 struct usmUser *usm_add_user_to_list(struct usmUser *user, | |
| 254 struct usmUser *userList); | |
| 255 struct usmUser *usm_free_user(struct usmUser *user); | |
| 256 struct usmUser *usm_create_user(void); | |
| 257 struct usmUser *usm_create_initial_user(const char *name, | |
| 258 oid *authProtocol, size_t authProtocolLen, | |
| 259 oid *privProtocol, size_t privProtocolLen); | |
| 260 struct usmUser *usm_cloneFrom_user(struct usmUser *from, struct usmUser *to); | |
| 261 struct usmUser *usm_remove_user(struct usmUser *user); | |
| 262 struct usmUser *usm_remove_user_from_list(struct usmUser *user, | |
| 263 struct usmUser **userList); | |
| 264 char *get_objid(char *line, oid **optr, size_t *len); | |
| 265 void usm_save_users(const char *token, const char *type); | |
| 266 void usm_save_users_from_list(struct usmUser *user, const char *token, | |
| 267 const char *type); | |
| 268 void usm_save_user(struct usmUser *user, const char *token, const char *type); | |
| 269 SNMPCallback usm_store_users; | |
| 270 struct usmUser *usm_read_user(char *line); | |
| 271 void usm_parse_config_usmUser(const char *token, char *line); | |
| 272 | |
| 273 void usm_set_password(const char *token, char *line); | |
| 274 void usm_set_user_password(struct usmUser *user, const char *token, | |
| 275 char *line); | |
| 276 void init_usm(void); | |
| 277 int init_usm_post_config(int majorid, int minorid, void *serverarg, | |
| 278 void *clientarg); | |
| 279 | |
| 280 #ifdef __cplusplus | |
| 281 } | |
| 282 #endif | |
| 283 | |
| 284 #endif /* SNMPUSM_H */ |
