| 1 |
786 |
skrzyp |
//==========================================================================
|
| 2 |
|
|
//
|
| 3 |
|
|
// ./lib/current/include/default_store.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 Free Software Foundation, 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
|
| 15 |
|
|
// version.
|
| 16 |
|
|
//
|
| 17 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
| 18 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
| 19 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
| 20 |
|
|
// for more details.
|
| 21 |
|
|
//
|
| 22 |
|
|
// You should have received a copy of the GNU General Public License
|
| 23 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
| 24 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
| 25 |
|
|
//
|
| 26 |
|
|
// As a special exception, if other files instantiate templates or use
|
| 27 |
|
|
// macros or inline functions from this file, or you compile this file
|
| 28 |
|
|
// and link it with other works to produce a work based on this file,
|
| 29 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
| 30 |
|
|
// the GNU General Public License. However the source code for this file
|
| 31 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
| 32 |
|
|
// General Public License v2.
|
| 33 |
|
|
//
|
| 34 |
|
|
// This exception does not invalidate any other reasons why a work based
|
| 35 |
|
|
// on this file might be covered by the GNU General Public License.
|
| 36 |
|
|
// -------------------------------------------
|
| 37 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
| 38 |
|
|
//####UCDSNMPCOPYRIGHTBEGIN####
|
| 39 |
|
|
//
|
| 40 |
|
|
// -------------------------------------------
|
| 41 |
|
|
//
|
| 42 |
|
|
// Portions of this software may have been derived from the UCD-SNMP
|
| 43 |
|
|
// project, <http://ucd-snmp.ucdavis.edu/> from the University of
|
| 44 |
|
|
// California at Davis, which was originally based on the Carnegie Mellon
|
| 45 |
|
|
// University SNMP implementation. Portions of this software are therefore
|
| 46 |
|
|
// covered by the appropriate copyright disclaimers included herein.
|
| 47 |
|
|
//
|
| 48 |
|
|
// The release used was version 4.1.2 of May 2000. "ucd-snmp-4.1.2"
|
| 49 |
|
|
// -------------------------------------------
|
| 50 |
|
|
//
|
| 51 |
|
|
//####UCDSNMPCOPYRIGHTEND####
|
| 52 |
|
|
//==========================================================================
|
| 53 |
|
|
//#####DESCRIPTIONBEGIN####
|
| 54 |
|
|
//
|
| 55 |
|
|
// Author(s): hmt
|
| 56 |
|
|
// Contributors: hmt
|
| 57 |
|
|
// Date: 2000-05-30
|
| 58 |
|
|
// Purpose: Port of UCD-SNMP distribution to eCos.
|
| 59 |
|
|
// Description:
|
| 60 |
|
|
//
|
| 61 |
|
|
//
|
| 62 |
|
|
//####DESCRIPTIONEND####
|
| 63 |
|
|
//
|
| 64 |
|
|
//==========================================================================
|
| 65 |
|
|
/********************************************************************
|
| 66 |
|
|
Copyright 1989, 1991, 1992 by Carnegie Mellon University
|
| 67 |
|
|
|
| 68 |
|
|
Derivative Work -
|
| 69 |
|
|
Copyright 1996, 1998, 1999, 2000 The Regents of the University of California
|
| 70 |
|
|
|
| 71 |
|
|
All Rights Reserved
|
| 72 |
|
|
|
| 73 |
|
|
Permission to use, copy, modify and distribute this software and its
|
| 74 |
|
|
documentation for any purpose and without fee is hereby granted,
|
| 75 |
|
|
provided that the above copyright notice appears in all copies and
|
| 76 |
|
|
that both that copyright notice and this permission notice appear in
|
| 77 |
|
|
supporting documentation, and that the name of CMU and The Regents of
|
| 78 |
|
|
the University of California not be used in advertising or publicity
|
| 79 |
|
|
pertaining to distribution of the software without specific written
|
| 80 |
|
|
permission.
|
| 81 |
|
|
|
| 82 |
|
|
CMU AND THE REGENTS OF THE UNIVERSITY OF CALIFORNIA DISCLAIM ALL
|
| 83 |
|
|
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
|
| 84 |
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL CMU OR
|
| 85 |
|
|
THE REGENTS OF THE UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY SPECIAL,
|
| 86 |
|
|
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
|
| 87 |
|
|
FROM THE LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
| 88 |
|
|
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
| 89 |
|
|
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
| 90 |
|
|
*********************************************************************/
|
| 91 |
|
|
/* default_store.h: storage space for defaults */
|
| 92 |
|
|
#ifndef DEFAULT_STORE_H
|
| 93 |
|
|
#define DEFAULT_STORE_H
|
| 94 |
|
|
|
| 95 |
|
|
#ifdef __cplusplus
|
| 96 |
|
|
extern "C" {
|
| 97 |
|
|
#endif
|
| 98 |
|
|
|
| 99 |
|
|
#define DS_MAX_IDS 3
|
| 100 |
|
|
#define DS_MAX_SUBIDS 32 /* needs to be a multiple of 8 */
|
| 101 |
|
|
|
| 102 |
|
|
/* begin storage definitions */
|
| 103 |
|
|
/* These definitions correspond with the "storid" argument to the API */
|
| 104 |
|
|
#define DS_LIBRARY_ID 0
|
| 105 |
|
|
#define DS_APPLICATION_ID 1
|
| 106 |
|
|
#define DS_TOKEN_ID 2
|
| 107 |
|
|
|
| 108 |
|
|
/* These definitions correspond with the "which" argument to the API,
|
| 109 |
|
|
when the storeid argument is DS_LIBRARY_ID */
|
| 110 |
|
|
/* library booleans */
|
| 111 |
|
|
#define DS_LIB_MIB_ERRORS 0
|
| 112 |
|
|
#define DS_LIB_SAVE_MIB_DESCRS 1
|
| 113 |
|
|
#define DS_LIB_MIB_COMMENT_TERM 2
|
| 114 |
|
|
#define DS_LIB_MIB_PARSE_LABEL 3
|
| 115 |
|
|
#define DS_LIB_DUMP_PACKET 4
|
| 116 |
|
|
#define DS_LIB_LOG_TIMESTAMP 5
|
| 117 |
|
|
#define DS_LIB_DONT_READ_CONFIGS 6
|
| 118 |
|
|
#define DS_LIB_MIB_REPLACE 7 /* replace objects from latest module */
|
| 119 |
|
|
#define DS_LIB_PRINT_NUMERIC_ENUM 8 /* print only numeric enum values */
|
| 120 |
|
|
#define DS_LIB_PRINT_NUMERIC_OIDS 9 /* print only numeric enum values */
|
| 121 |
|
|
#define DS_LIB_DONT_BREAKDOWN_OIDS 10 /* dont print oid indexes specially */
|
| 122 |
|
|
#define DS_LIB_ALARM_DONT_USE_SIG 11 /* don't use the alarm() signal */
|
| 123 |
|
|
#define DS_LIB_PRINT_FULL_OID 12 /* print fully qualified oids */
|
| 124 |
|
|
#define DS_LIB_QUICK_PRINT 13 /* print very brief output for parsing */
|
| 125 |
|
|
#define DS_LIB_RANDOM_ACCESS 14 /* random access to oid labels */
|
| 126 |
|
|
#define DS_LIB_REGEX_ACCESS 15 /* regex matching to oid labels */
|
| 127 |
|
|
#define DS_LIB_DONT_CHECK_RANGE 16 /* don't check values for ranges on send*/
|
| 128 |
|
|
#define DS_LIB_NO_TOKEN_WARNINGS 17 /* no warn about unknown config tokens */
|
| 129 |
|
|
|
| 130 |
|
|
/* library integers */
|
| 131 |
|
|
#define DS_LIB_MIB_WARNINGS 0
|
| 132 |
|
|
#define DS_LIB_SECLEVEL 1
|
| 133 |
|
|
#define DS_LIB_SNMPVERSION 2
|
| 134 |
|
|
#define DS_LIB_DEFAULT_PORT 3
|
| 135 |
|
|
#define DS_LIB_PRINT_SUFFIX_ONLY 4 /* print out only a single oid node == 1.
|
| 136 |
|
|
like #1 but supply mib module too == 2. */
|
| 137 |
|
|
|
| 138 |
|
|
/* library strings */
|
| 139 |
|
|
#define DS_LIB_SECNAME 0
|
| 140 |
|
|
#define DS_LIB_CONTEXT 1
|
| 141 |
|
|
#define DS_LIB_PASSPHRASE 2
|
| 142 |
|
|
#define DS_LIB_AUTHPASSPHRASE 3
|
| 143 |
|
|
#define DS_LIB_PRIVPASSPHRASE 4
|
| 144 |
|
|
#define DS_LIB_OPTIONALCONFIG 5
|
| 145 |
|
|
#define DS_LIB_APPTYPE 6
|
| 146 |
|
|
#define DS_LIB_COMMUNITY 7
|
| 147 |
|
|
|
| 148 |
|
|
/* end storage definitions */
|
| 149 |
|
|
|
| 150 |
|
|
struct ds_read_config {
|
| 151 |
|
|
u_char type;
|
| 152 |
|
|
char *token;
|
| 153 |
|
|
int storeid;
|
| 154 |
|
|
int which;
|
| 155 |
|
|
struct ds_read_config *next;
|
| 156 |
|
|
};
|
| 157 |
|
|
|
| 158 |
|
|
int ds_set_boolean(int storeid, int which, int value);
|
| 159 |
|
|
int ds_get_boolean(int storeid, int which);
|
| 160 |
|
|
int ds_toggle_boolean(int storeid, int which);
|
| 161 |
|
|
int ds_set_int(int storeid, int which, int value);
|
| 162 |
|
|
int ds_get_int(int storeid, int which);
|
| 163 |
|
|
int ds_set_string(int storeid, int which, const char *value);
|
| 164 |
|
|
char *ds_get_string(int storeid, int which);
|
| 165 |
|
|
int ds_register_config(u_char type, const char *ftype, const char *token,
|
| 166 |
|
|
int storeid, int which);
|
| 167 |
|
|
int ds_register_premib(u_char type, const char *ftype, const char *token,
|
| 168 |
|
|
int storeid, int which);
|
| 169 |
|
|
|
| 170 |
|
|
#ifdef __cplusplus
|
| 171 |
|
|
}
|
| 172 |
|
|
#endif
|
| 173 |
|
|
|
| 174 |
|
|
#endif /* DEFAULT_STORE_H */
|