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