sl@0: /* crypto/conf/conf.h */ sl@0: /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) sl@0: * All rights reserved. sl@0: * sl@0: * This package is an SSL implementation written sl@0: * by Eric Young (eay@cryptsoft.com). sl@0: * The implementation was written so as to conform with Netscapes SSL. sl@0: * sl@0: * This library is free for commercial and non-commercial use as long as sl@0: * the following conditions are aheared to. The following conditions sl@0: * apply to all code found in this distribution, be it the RC4, RSA, sl@0: * lhash, DES, etc., code; not just the SSL code. The SSL documentation sl@0: * included with this distribution is covered by the same copyright terms sl@0: * except that the holder is Tim Hudson (tjh@cryptsoft.com). sl@0: * sl@0: * Copyright remains Eric Young's, and as such any Copyright notices in sl@0: * the code are not to be removed. sl@0: * If this package is used in a product, Eric Young should be given attribution sl@0: * as the author of the parts of the library used. sl@0: * This can be in the form of a textual message at program startup or sl@0: * in documentation (online or textual) provided with the package. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * 3. All advertising materials mentioning features or use of this software sl@0: * must display the following acknowledgement: sl@0: * "This product includes cryptographic software written by sl@0: * Eric Young (eay@cryptsoft.com)" sl@0: * The word 'cryptographic' can be left out if the rouines from the library sl@0: * being used are not cryptographic related :-). sl@0: * 4. If you include any Windows specific code (or a derivative thereof) from sl@0: * the apps directory (application code) you must include an acknowledgement: sl@0: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND sl@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE sl@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE sl@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL sl@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS sl@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT sl@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY sl@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF sl@0: * SUCH DAMAGE. sl@0: * sl@0: * The licence and distribution terms for any publically available version or sl@0: * derivative of this code cannot be changed. i.e. this code cannot simply be sl@0: * copied and put under another distribution licence sl@0: * [including the GNU Public Licence.] sl@0: */ sl@0: /* sl@0: © Portions copyright (c) 2006 Nokia Corporation. All rights reserved. sl@0: */ sl@0: sl@0: #ifndef HEADER_CONF_H sl@0: #define HEADER_CONF_H sl@0: sl@0: #if (defined(__SYMBIAN32__) && !defined(SYMBIAN)) sl@0: #define SYMBIAN sl@0: #endif sl@0: sl@0: #ifdef SYMBIAN sl@0: #include sl@0: #endif sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include sl@0: sl@0: #ifdef __cplusplus sl@0: extern "C" { sl@0: #endif sl@0: sl@0: typedef struct sl@0: { sl@0: char *section; sl@0: char *name; sl@0: char *value; sl@0: } CONF_VALUE; sl@0: sl@0: DECLARE_STACK_OF(CONF_VALUE) sl@0: DECLARE_STACK_OF(CONF_MODULE) sl@0: DECLARE_STACK_OF(CONF_IMODULE) sl@0: sl@0: struct conf_st; sl@0: struct conf_method_st; sl@0: typedef struct conf_method_st CONF_METHOD; sl@0: sl@0: struct conf_method_st sl@0: { sl@0: const char *name; sl@0: CONF *(*create)(CONF_METHOD *meth); sl@0: int (*init)(CONF *conf); sl@0: int (*destroy)(CONF *conf); sl@0: int (*destroy_data)(CONF *conf); sl@0: int (*load_bio)(CONF *conf, BIO *bp, long *eline); sl@0: int (*dump)(const CONF *conf, BIO *bp); sl@0: int (*is_number)(const CONF *conf, char c); sl@0: int (*to_int)(const CONF *conf, char c); sl@0: int (*load)(CONF *conf, const char *name, long *eline); sl@0: }; sl@0: sl@0: /* Module definitions */ sl@0: sl@0: typedef struct conf_imodule_st CONF_IMODULE; sl@0: typedef struct conf_module_st CONF_MODULE; sl@0: sl@0: /* DSO module function typedefs */ sl@0: typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf); sl@0: typedef void conf_finish_func(CONF_IMODULE *md); sl@0: sl@0: #define CONF_MFLAGS_IGNORE_ERRORS 0x1 sl@0: #define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 sl@0: #define CONF_MFLAGS_SILENT 0x4 sl@0: #define CONF_MFLAGS_NO_DSO 0x8 sl@0: #define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 sl@0: #define CONF_MFLAGS_DEFAULT_SECTION 0x20 sl@0: sl@0: IMPORT_C int CONF_set_default_method(CONF_METHOD *meth); sl@0: IMPORT_C void CONF_set_nconf(CONF *conf,LHASH *hash); sl@0: IMPORT_C LHASH *CONF_load(LHASH *conf,const char *file,long *eline); sl@0: #ifndef OPENSSL_NO_FP_API sl@0: IMPORT_C LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline); sl@0: #endif sl@0: IMPORT_C LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline); sl@0: IMPORT_C STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section); sl@0: IMPORT_C char *CONF_get_string(LHASH *conf,const char *group,const char *name); sl@0: IMPORT_C long CONF_get_number(LHASH *conf,const char *group,const char *name); sl@0: IMPORT_C void CONF_free(LHASH *conf); sl@0: IMPORT_C int CONF_dump_fp(LHASH *conf, FILE *out); sl@0: IMPORT_C int CONF_dump_bio(LHASH *conf, BIO *out); sl@0: sl@0: IMPORT_C void OPENSSL_config(const char *config_name); sl@0: IMPORT_C void OPENSSL_no_config(void); sl@0: sl@0: /* New conf code. The semantics are different from the functions above. sl@0: If that wasn't the case, the above functions would have been replaced */ sl@0: sl@0: struct conf_st sl@0: { sl@0: CONF_METHOD *meth; sl@0: void *meth_data; sl@0: LHASH *data; sl@0: }; sl@0: sl@0: IMPORT_C CONF *NCONF_new(CONF_METHOD *meth); sl@0: IMPORT_C CONF_METHOD *NCONF_default(void); sl@0: sl@0: #if 0 /* Just to give you an idea of what I have in mind */ sl@0: IMPORT_C CONF_METHOD *NCONF_XML(void); sl@0: #endif sl@0: IMPORT_C void NCONF_free(CONF *conf); sl@0: IMPORT_C void NCONF_free_data(CONF *conf); sl@0: sl@0: IMPORT_C int NCONF_load(CONF *conf,const char *file,long *eline); sl@0: #ifndef OPENSSL_NO_FP_API sl@0: IMPORT_C int NCONF_load_fp(CONF *conf, FILE *fp,long *eline); sl@0: #endif sl@0: IMPORT_C int NCONF_load_bio(CONF *conf, BIO *bp,long *eline); sl@0: IMPORT_C STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section); sl@0: IMPORT_C char *NCONF_get_string(const CONF *conf,const char *group,const char *name); sl@0: IMPORT_C int NCONF_get_number_e(const CONF *conf,const char *group,const char *name, sl@0: long *result); sl@0: IMPORT_C int NCONF_dump_fp(const CONF *conf, FILE *out); sl@0: IMPORT_C int NCONF_dump_bio(const CONF *conf, BIO *out); sl@0: sl@0: #if 0 /* The following function has no error checking, sl@0: and should therefore be avoided */ sl@0: IMPORT_C long NCONF_get_number(CONF *conf,char *group,char *name); sl@0: #else sl@0: #define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) sl@0: #endif sl@0: sl@0: /* Module functions */ sl@0: sl@0: IMPORT_C int CONF_modules_load(const CONF *cnf, const char *appname, sl@0: unsigned long flags); sl@0: IMPORT_C int CONF_modules_load_file(const char *filename, const char *appname, sl@0: unsigned long flags); sl@0: IMPORT_C void CONF_modules_unload(int all); sl@0: IMPORT_C void CONF_modules_finish(void); sl@0: IMPORT_C void CONF_modules_free(void); sl@0: IMPORT_C int CONF_module_add(const char *name, conf_init_func *ifunc, sl@0: conf_finish_func *ffunc); sl@0: sl@0: IMPORT_C const char *CONF_imodule_get_name(const CONF_IMODULE *md); sl@0: IMPORT_C const char *CONF_imodule_get_value(const CONF_IMODULE *md); sl@0: IMPORT_C void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); sl@0: IMPORT_C void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); sl@0: CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); sl@0: unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); sl@0: IMPORT_C void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); sl@0: IMPORT_C void *CONF_module_get_usr_data(CONF_MODULE *pmod); sl@0: IMPORT_C void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); sl@0: sl@0: IMPORT_C char *CONF_get1_default_config_file(void); sl@0: sl@0: IMPORT_C int CONF_parse_list(const char *list, int sep, int nospc, sl@0: int (*list_cb)(const char *elem, int len, void *usr), void *arg); sl@0: sl@0: IMPORT_C void OPENSSL_load_builtin_modules(void); sl@0: sl@0: /* BEGIN ERROR CODES */ sl@0: /* The following lines are auto generated by the script mkerr.pl. Any changes sl@0: * made after this point may be overwritten when the script is next run. sl@0: */ sl@0: IMPORT_C void ERR_load_CONF_strings(void); sl@0: sl@0: /* Error codes for the CONF functions. */ sl@0: sl@0: /* Function codes. */ sl@0: #define CONF_F_CONF_DUMP_FP 104 sl@0: #define CONF_F_CONF_LOAD 100 sl@0: #define CONF_F_CONF_LOAD_BIO 102 sl@0: #define CONF_F_CONF_LOAD_FP 103 sl@0: #define CONF_F_CONF_MODULES_LOAD 116 sl@0: #define CONF_F_DEF_LOAD 120 sl@0: #define CONF_F_DEF_LOAD_BIO 121 sl@0: #define CONF_F_MODULE_INIT 115 sl@0: #define CONF_F_MODULE_LOAD_DSO 117 sl@0: #define CONF_F_MODULE_RUN 118 sl@0: #define CONF_F_NCONF_DUMP_BIO 105 sl@0: #define CONF_F_NCONF_DUMP_FP 106 sl@0: #define CONF_F_NCONF_GET_NUMBER 107 sl@0: #define CONF_F_NCONF_GET_NUMBER_E 112 sl@0: #define CONF_F_NCONF_GET_SECTION 108 sl@0: #define CONF_F_NCONF_GET_STRING 109 sl@0: #define CONF_F_NCONF_LOAD 113 sl@0: #define CONF_F_NCONF_LOAD_BIO 110 sl@0: #define CONF_F_NCONF_LOAD_FP 114 sl@0: #define CONF_F_NCONF_NEW 111 sl@0: #define CONF_F_STR_COPY 101 sl@0: sl@0: /* Reason codes. */ sl@0: #define CONF_R_ERROR_LOADING_DSO 110 sl@0: #define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 sl@0: #define CONF_R_MISSING_EQUAL_SIGN 101 sl@0: #define CONF_R_MISSING_FINISH_FUNCTION 111 sl@0: #define CONF_R_MISSING_INIT_FUNCTION 112 sl@0: #define CONF_R_MODULE_INITIALIZATION_ERROR 109 sl@0: #define CONF_R_NO_CLOSE_BRACE 102 sl@0: #define CONF_R_NO_CONF 105 sl@0: #define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 sl@0: #define CONF_R_NO_SECTION 107 sl@0: #define CONF_R_NO_SUCH_FILE 114 sl@0: #define CONF_R_NO_VALUE 108 sl@0: #define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 sl@0: #define CONF_R_UNKNOWN_MODULE_NAME 113 sl@0: #define CONF_R_VARIABLE_HAS_NO_VALUE 104 sl@0: sl@0: #ifdef __cplusplus sl@0: } sl@0: #endif sl@0: #endif