williamr@2
|
1 |
/* crypto/conf/conf.h */
|
williamr@2
|
2 |
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
*
|
williamr@2
|
5 |
* This package is an SSL implementation written
|
williamr@2
|
6 |
* by Eric Young (eay@cryptsoft.com).
|
williamr@2
|
7 |
* The implementation was written so as to conform with Netscapes SSL.
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* This library is free for commercial and non-commercial use as long as
|
williamr@2
|
10 |
* the following conditions are aheared to. The following conditions
|
williamr@2
|
11 |
* apply to all code found in this distribution, be it the RC4, RSA,
|
williamr@2
|
12 |
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
williamr@2
|
13 |
* included with this distribution is covered by the same copyright terms
|
williamr@2
|
14 |
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
* Copyright remains Eric Young's, and as such any Copyright notices in
|
williamr@2
|
17 |
* the code are not to be removed.
|
williamr@2
|
18 |
* If this package is used in a product, Eric Young should be given attribution
|
williamr@2
|
19 |
* as the author of the parts of the library used.
|
williamr@2
|
20 |
* This can be in the form of a textual message at program startup or
|
williamr@2
|
21 |
* in documentation (online or textual) provided with the package.
|
williamr@2
|
22 |
*
|
williamr@2
|
23 |
* Redistribution and use in source and binary forms, with or without
|
williamr@2
|
24 |
* modification, are permitted provided that the following conditions
|
williamr@2
|
25 |
* are met:
|
williamr@2
|
26 |
* 1. Redistributions of source code must retain the copyright
|
williamr@2
|
27 |
* notice, this list of conditions and the following disclaimer.
|
williamr@2
|
28 |
* 2. Redistributions in binary form must reproduce the above copyright
|
williamr@2
|
29 |
* notice, this list of conditions and the following disclaimer in the
|
williamr@2
|
30 |
* documentation and/or other materials provided with the distribution.
|
williamr@2
|
31 |
* 3. All advertising materials mentioning features or use of this software
|
williamr@2
|
32 |
* must display the following acknowledgement:
|
williamr@2
|
33 |
* "This product includes cryptographic software written by
|
williamr@2
|
34 |
* Eric Young (eay@cryptsoft.com)"
|
williamr@2
|
35 |
* The word 'cryptographic' can be left out if the rouines from the library
|
williamr@2
|
36 |
* being used are not cryptographic related :-).
|
williamr@2
|
37 |
* 4. If you include any Windows specific code (or a derivative thereof) from
|
williamr@2
|
38 |
* the apps directory (application code) you must include an acknowledgement:
|
williamr@2
|
39 |
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
williamr@2
|
40 |
*
|
williamr@2
|
41 |
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
williamr@2
|
42 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
williamr@2
|
43 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
williamr@2
|
44 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
williamr@2
|
45 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
williamr@2
|
46 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
williamr@2
|
47 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
williamr@2
|
48 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
williamr@2
|
49 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
williamr@2
|
50 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
williamr@2
|
51 |
* SUCH DAMAGE.
|
williamr@2
|
52 |
*
|
williamr@2
|
53 |
* The licence and distribution terms for any publically available version or
|
williamr@2
|
54 |
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
williamr@2
|
55 |
* copied and put under another distribution licence
|
williamr@2
|
56 |
* [including the GNU Public Licence.]
|
williamr@2
|
57 |
*/
|
williamr@2
|
58 |
/*
|
williamr@2
|
59 |
© Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
|
williamr@2
|
60 |
*/
|
williamr@2
|
61 |
|
williamr@2
|
62 |
#ifndef HEADER_CONF_H
|
williamr@2
|
63 |
#define HEADER_CONF_H
|
williamr@2
|
64 |
|
williamr@2
|
65 |
#if (defined(__SYMBIAN32__) && !defined(SYMBIAN))
|
williamr@2
|
66 |
#define SYMBIAN
|
williamr@2
|
67 |
#endif
|
williamr@2
|
68 |
|
williamr@2
|
69 |
#ifdef SYMBIAN
|
williamr@2
|
70 |
#include <e32def.h>
|
williamr@2
|
71 |
#endif
|
williamr@2
|
72 |
#include <openssl/bio.h>
|
williamr@2
|
73 |
#include <openssl/lhash.h>
|
williamr@2
|
74 |
#include <openssl/stack.h>
|
williamr@2
|
75 |
#include <openssl/safestack.h>
|
williamr@2
|
76 |
#include <openssl/e_os2.h>
|
williamr@2
|
77 |
|
williamr@2
|
78 |
#include <openssl/ossl_typ.h>
|
williamr@2
|
79 |
|
williamr@2
|
80 |
#ifdef __cplusplus
|
williamr@2
|
81 |
extern "C" {
|
williamr@2
|
82 |
#endif
|
williamr@2
|
83 |
|
williamr@2
|
84 |
typedef struct
|
williamr@2
|
85 |
{
|
williamr@2
|
86 |
char *section;
|
williamr@2
|
87 |
char *name;
|
williamr@2
|
88 |
char *value;
|
williamr@2
|
89 |
} CONF_VALUE;
|
williamr@2
|
90 |
|
williamr@2
|
91 |
DECLARE_STACK_OF(CONF_VALUE)
|
williamr@2
|
92 |
DECLARE_STACK_OF(CONF_MODULE)
|
williamr@2
|
93 |
DECLARE_STACK_OF(CONF_IMODULE)
|
williamr@2
|
94 |
|
williamr@2
|
95 |
struct conf_st;
|
williamr@2
|
96 |
struct conf_method_st;
|
williamr@2
|
97 |
typedef struct conf_method_st CONF_METHOD;
|
williamr@2
|
98 |
|
williamr@2
|
99 |
struct conf_method_st
|
williamr@2
|
100 |
{
|
williamr@2
|
101 |
const char *name;
|
williamr@2
|
102 |
CONF *(*create)(CONF_METHOD *meth);
|
williamr@2
|
103 |
int (*init)(CONF *conf);
|
williamr@2
|
104 |
int (*destroy)(CONF *conf);
|
williamr@2
|
105 |
int (*destroy_data)(CONF *conf);
|
williamr@2
|
106 |
int (*load_bio)(CONF *conf, BIO *bp, long *eline);
|
williamr@2
|
107 |
int (*dump)(const CONF *conf, BIO *bp);
|
williamr@2
|
108 |
int (*is_number)(const CONF *conf, char c);
|
williamr@2
|
109 |
int (*to_int)(const CONF *conf, char c);
|
williamr@2
|
110 |
int (*load)(CONF *conf, const char *name, long *eline);
|
williamr@2
|
111 |
};
|
williamr@2
|
112 |
|
williamr@2
|
113 |
/* Module definitions */
|
williamr@2
|
114 |
|
williamr@2
|
115 |
typedef struct conf_imodule_st CONF_IMODULE;
|
williamr@2
|
116 |
typedef struct conf_module_st CONF_MODULE;
|
williamr@2
|
117 |
|
williamr@2
|
118 |
/* DSO module function typedefs */
|
williamr@2
|
119 |
typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf);
|
williamr@2
|
120 |
typedef void conf_finish_func(CONF_IMODULE *md);
|
williamr@2
|
121 |
|
williamr@2
|
122 |
#define CONF_MFLAGS_IGNORE_ERRORS 0x1
|
williamr@2
|
123 |
#define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
|
williamr@2
|
124 |
#define CONF_MFLAGS_SILENT 0x4
|
williamr@2
|
125 |
#define CONF_MFLAGS_NO_DSO 0x8
|
williamr@2
|
126 |
#define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
|
williamr@2
|
127 |
#define CONF_MFLAGS_DEFAULT_SECTION 0x20
|
williamr@2
|
128 |
|
williamr@2
|
129 |
IMPORT_C int CONF_set_default_method(CONF_METHOD *meth);
|
williamr@2
|
130 |
IMPORT_C void CONF_set_nconf(CONF *conf,LHASH *hash);
|
williamr@2
|
131 |
IMPORT_C LHASH *CONF_load(LHASH *conf,const char *file,long *eline);
|
williamr@2
|
132 |
#ifndef OPENSSL_NO_FP_API
|
williamr@2
|
133 |
IMPORT_C LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline);
|
williamr@2
|
134 |
#endif
|
williamr@2
|
135 |
IMPORT_C LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline);
|
williamr@2
|
136 |
IMPORT_C STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section);
|
williamr@2
|
137 |
IMPORT_C char *CONF_get_string(LHASH *conf,const char *group,const char *name);
|
williamr@2
|
138 |
IMPORT_C long CONF_get_number(LHASH *conf,const char *group,const char *name);
|
williamr@2
|
139 |
IMPORT_C void CONF_free(LHASH *conf);
|
williamr@2
|
140 |
IMPORT_C int CONF_dump_fp(LHASH *conf, FILE *out);
|
williamr@2
|
141 |
IMPORT_C int CONF_dump_bio(LHASH *conf, BIO *out);
|
williamr@2
|
142 |
|
williamr@2
|
143 |
IMPORT_C void OPENSSL_config(const char *config_name);
|
williamr@2
|
144 |
IMPORT_C void OPENSSL_no_config(void);
|
williamr@2
|
145 |
|
williamr@2
|
146 |
/* New conf code. The semantics are different from the functions above.
|
williamr@2
|
147 |
If that wasn't the case, the above functions would have been replaced */
|
williamr@2
|
148 |
|
williamr@2
|
149 |
struct conf_st
|
williamr@2
|
150 |
{
|
williamr@2
|
151 |
CONF_METHOD *meth;
|
williamr@2
|
152 |
void *meth_data;
|
williamr@2
|
153 |
LHASH *data;
|
williamr@2
|
154 |
};
|
williamr@2
|
155 |
|
williamr@2
|
156 |
IMPORT_C CONF *NCONF_new(CONF_METHOD *meth);
|
williamr@2
|
157 |
IMPORT_C CONF_METHOD *NCONF_default(void);
|
williamr@2
|
158 |
|
williamr@2
|
159 |
#if 0 /* Just to give you an idea of what I have in mind */
|
williamr@2
|
160 |
IMPORT_C CONF_METHOD *NCONF_XML(void);
|
williamr@2
|
161 |
#endif
|
williamr@2
|
162 |
IMPORT_C void NCONF_free(CONF *conf);
|
williamr@2
|
163 |
IMPORT_C void NCONF_free_data(CONF *conf);
|
williamr@2
|
164 |
|
williamr@2
|
165 |
IMPORT_C int NCONF_load(CONF *conf,const char *file,long *eline);
|
williamr@2
|
166 |
#ifndef OPENSSL_NO_FP_API
|
williamr@2
|
167 |
IMPORT_C int NCONF_load_fp(CONF *conf, FILE *fp,long *eline);
|
williamr@2
|
168 |
#endif
|
williamr@2
|
169 |
IMPORT_C int NCONF_load_bio(CONF *conf, BIO *bp,long *eline);
|
williamr@2
|
170 |
IMPORT_C STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section);
|
williamr@2
|
171 |
IMPORT_C char *NCONF_get_string(const CONF *conf,const char *group,const char *name);
|
williamr@2
|
172 |
IMPORT_C int NCONF_get_number_e(const CONF *conf,const char *group,const char *name,
|
williamr@2
|
173 |
long *result);
|
williamr@2
|
174 |
IMPORT_C int NCONF_dump_fp(const CONF *conf, FILE *out);
|
williamr@2
|
175 |
IMPORT_C int NCONF_dump_bio(const CONF *conf, BIO *out);
|
williamr@2
|
176 |
|
williamr@2
|
177 |
#if 0 /* The following function has no error checking,
|
williamr@2
|
178 |
and should therefore be avoided */
|
williamr@2
|
179 |
IMPORT_C long NCONF_get_number(CONF *conf,char *group,char *name);
|
williamr@2
|
180 |
#else
|
williamr@2
|
181 |
#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
|
williamr@2
|
182 |
#endif
|
williamr@2
|
183 |
|
williamr@2
|
184 |
/* Module functions */
|
williamr@2
|
185 |
|
williamr@2
|
186 |
IMPORT_C int CONF_modules_load(const CONF *cnf, const char *appname,
|
williamr@2
|
187 |
unsigned long flags);
|
williamr@2
|
188 |
IMPORT_C int CONF_modules_load_file(const char *filename, const char *appname,
|
williamr@2
|
189 |
unsigned long flags);
|
williamr@2
|
190 |
IMPORT_C void CONF_modules_unload(int all);
|
williamr@2
|
191 |
IMPORT_C void CONF_modules_finish(void);
|
williamr@2
|
192 |
IMPORT_C void CONF_modules_free(void);
|
williamr@2
|
193 |
IMPORT_C int CONF_module_add(const char *name, conf_init_func *ifunc,
|
williamr@2
|
194 |
conf_finish_func *ffunc);
|
williamr@2
|
195 |
|
williamr@2
|
196 |
IMPORT_C const char *CONF_imodule_get_name(const CONF_IMODULE *md);
|
williamr@2
|
197 |
IMPORT_C const char *CONF_imodule_get_value(const CONF_IMODULE *md);
|
williamr@2
|
198 |
IMPORT_C void *CONF_imodule_get_usr_data(const CONF_IMODULE *md);
|
williamr@2
|
199 |
IMPORT_C void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);
|
williamr@2
|
200 |
CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);
|
williamr@2
|
201 |
unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);
|
williamr@2
|
202 |
IMPORT_C void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);
|
williamr@2
|
203 |
IMPORT_C void *CONF_module_get_usr_data(CONF_MODULE *pmod);
|
williamr@2
|
204 |
IMPORT_C void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
|
williamr@2
|
205 |
|
williamr@2
|
206 |
IMPORT_C char *CONF_get1_default_config_file(void);
|
williamr@2
|
207 |
|
williamr@2
|
208 |
IMPORT_C int CONF_parse_list(const char *list, int sep, int nospc,
|
williamr@2
|
209 |
int (*list_cb)(const char *elem, int len, void *usr), void *arg);
|
williamr@2
|
210 |
|
williamr@2
|
211 |
IMPORT_C void OPENSSL_load_builtin_modules(void);
|
williamr@2
|
212 |
|
williamr@2
|
213 |
/* BEGIN ERROR CODES */
|
williamr@2
|
214 |
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
williamr@2
|
215 |
* made after this point may be overwritten when the script is next run.
|
williamr@2
|
216 |
*/
|
williamr@2
|
217 |
IMPORT_C void ERR_load_CONF_strings(void);
|
williamr@2
|
218 |
|
williamr@2
|
219 |
/* Error codes for the CONF functions. */
|
williamr@2
|
220 |
|
williamr@2
|
221 |
/* Function codes. */
|
williamr@2
|
222 |
#define CONF_F_CONF_DUMP_FP 104
|
williamr@2
|
223 |
#define CONF_F_CONF_LOAD 100
|
williamr@2
|
224 |
#define CONF_F_CONF_LOAD_BIO 102
|
williamr@2
|
225 |
#define CONF_F_CONF_LOAD_FP 103
|
williamr@2
|
226 |
#define CONF_F_CONF_MODULES_LOAD 116
|
williamr@2
|
227 |
#define CONF_F_DEF_LOAD 120
|
williamr@2
|
228 |
#define CONF_F_DEF_LOAD_BIO 121
|
williamr@2
|
229 |
#define CONF_F_MODULE_INIT 115
|
williamr@2
|
230 |
#define CONF_F_MODULE_LOAD_DSO 117
|
williamr@2
|
231 |
#define CONF_F_MODULE_RUN 118
|
williamr@2
|
232 |
#define CONF_F_NCONF_DUMP_BIO 105
|
williamr@2
|
233 |
#define CONF_F_NCONF_DUMP_FP 106
|
williamr@2
|
234 |
#define CONF_F_NCONF_GET_NUMBER 107
|
williamr@2
|
235 |
#define CONF_F_NCONF_GET_NUMBER_E 112
|
williamr@2
|
236 |
#define CONF_F_NCONF_GET_SECTION 108
|
williamr@2
|
237 |
#define CONF_F_NCONF_GET_STRING 109
|
williamr@2
|
238 |
#define CONF_F_NCONF_LOAD 113
|
williamr@2
|
239 |
#define CONF_F_NCONF_LOAD_BIO 110
|
williamr@2
|
240 |
#define CONF_F_NCONF_LOAD_FP 114
|
williamr@2
|
241 |
#define CONF_F_NCONF_NEW 111
|
williamr@2
|
242 |
#define CONF_F_STR_COPY 101
|
williamr@2
|
243 |
|
williamr@2
|
244 |
/* Reason codes. */
|
williamr@2
|
245 |
#define CONF_R_ERROR_LOADING_DSO 110
|
williamr@2
|
246 |
#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100
|
williamr@2
|
247 |
#define CONF_R_MISSING_EQUAL_SIGN 101
|
williamr@2
|
248 |
#define CONF_R_MISSING_FINISH_FUNCTION 111
|
williamr@2
|
249 |
#define CONF_R_MISSING_INIT_FUNCTION 112
|
williamr@2
|
250 |
#define CONF_R_MODULE_INITIALIZATION_ERROR 109
|
williamr@2
|
251 |
#define CONF_R_NO_CLOSE_BRACE 102
|
williamr@2
|
252 |
#define CONF_R_NO_CONF 105
|
williamr@2
|
253 |
#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106
|
williamr@2
|
254 |
#define CONF_R_NO_SECTION 107
|
williamr@2
|
255 |
#define CONF_R_NO_SUCH_FILE 114
|
williamr@2
|
256 |
#define CONF_R_NO_VALUE 108
|
williamr@2
|
257 |
#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
|
williamr@2
|
258 |
#define CONF_R_UNKNOWN_MODULE_NAME 113
|
williamr@2
|
259 |
#define CONF_R_VARIABLE_HAS_NO_VALUE 104
|
williamr@2
|
260 |
|
williamr@2
|
261 |
#ifdef __cplusplus
|
williamr@2
|
262 |
}
|
williamr@2
|
263 |
#endif
|
williamr@2
|
264 |
#endif
|