conf.h revision 89837
1114902Sscottl/* crypto/conf/conf.h */ 2119418Sobrien/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3114902Sscottl * All rights reserved. 4114902Sscottl * 5114902Sscottl * This package is an SSL implementation written 6114902Sscottl * by Eric Young (eay@cryptsoft.com). 7114902Sscottl * The implementation was written so as to conform with Netscapes SSL. 8114902Sscottl * 9114902Sscottl * This library is free for commercial and non-commercial use as long as 10114902Sscottl * the following conditions are aheared to. The following conditions 11114902Sscottl * apply to all code found in this distribution, be it the RC4, RSA, 12114902Sscottl * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13114902Sscottl * included with this distribution is covered by the same copyright terms 14114902Sscottl * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15114902Sscottl * 16114902Sscottl * Copyright remains Eric Young's, and as such any Copyright notices in 17114902Sscottl * the code are not to be removed. 18114902Sscottl * If this package is used in a product, Eric Young should be given attribution 19114902Sscottl * as the author of the parts of the library used. 20114902Sscottl * This can be in the form of a textual message at program startup or 21114902Sscottl * in documentation (online or textual) provided with the package. 22114902Sscottl * 23114902Sscottl * Redistribution and use in source and binary forms, with or without 24114902Sscottl * modification, are permitted provided that the following conditions 25114902Sscottl * are met: 26114902Sscottl * 1. Redistributions of source code must retain the copyright 27114902Sscottl * notice, this list of conditions and the following disclaimer. 28119418Sobrien * 2. Redistributions in binary form must reproduce the above copyright 29119418Sobrien * notice, this list of conditions and the following disclaimer in the 30114902Sscottl * documentation and/or other materials provided with the distribution. 31152919Sscottl * 3. All advertising materials mentioning features or use of this software 32114902Sscottl * must display the following acknowledgement: 33114902Sscottl * "This product includes cryptographic software written by 34114902Sscottl * Eric Young (eay@cryptsoft.com)" 35114902Sscottl * The word 'cryptographic' can be left out if the rouines from the library 36114902Sscottl * being used are not cryptographic related :-). 37114902Sscottl * 4. If you include any Windows specific code (or a derivative thereof) from 38114902Sscottl * the apps directory (application code) you must include an acknowledgement: 39114902Sscottl * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40129859Sscottl * 41129859Sscottl * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42114902Sscottl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43126080Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44126080Sphk * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45125808Sphk * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46125808Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47125808Sphk * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48125808Sphk * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49114902Sscottl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50114902Sscottl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51122999Smbr * SUCH DAMAGE. 52122999Smbr * 53122999Smbr * The licence and distribution terms for any publically available version or 54122999Smbr * derivative of this code cannot be changed. i.e. this code cannot simply be 55122999Smbr * copied and put under another distribution licence 56122999Smbr * [including the GNU Public Licence.] 57122999Smbr */ 58122999Smbr 59122999Smbr#ifndef HEADER_CONF_H 60122999Smbr#define HEADER_CONF_H 61122999Smbr 62122999Smbr#include <openssl/bio.h> 63122999Smbr#include <openssl/lhash.h> 64122999Smbr#include <openssl/stack.h> 65122999Smbr#include <openssl/safestack.h> 66122999Smbr#include <openssl/e_os.h> 67163024Smaxim 68163024Smaxim#ifdef __cplusplus 69163024Smaximextern "C" { 70163024Smaxim#endif 71122999Smbr 72114902Sscottltypedef struct 73122999Smbr { 74130585Sphk char *section; 75114902Sscottl char *name; 76114902Sscottl char *value; 77114902Sscottl } CONF_VALUE; 78114902Sscottl 79114902SscottlDECLARE_STACK_OF(CONF_VALUE) 80114902Sscottl 81130585Sphkstruct conf_st; 82114902Sscottltypedef struct conf_st CONF; 83114902Sscottlstruct conf_method_st; 84114902Sscottltypedef struct conf_method_st CONF_METHOD; 85114902Sscottl 86114902Sscottlstruct conf_method_st 87114902Sscottl { 88114902Sscottl const char *name; 89130585Sphk CONF *(MS_FAR *create)(CONF_METHOD *meth); 90114902Sscottl int (MS_FAR *init)(CONF *conf); 91114902Sscottl int (MS_FAR *destroy)(CONF *conf); 92114902Sscottl int (MS_FAR *destroy_data)(CONF *conf); 93114902Sscottl int (MS_FAR *load)(CONF *conf, BIO *bp, long *eline); 94114902Sscottl int (MS_FAR *dump)(CONF *conf, BIO *bp); 95114902Sscottl int (MS_FAR *is_number)(CONF *conf, char c); 96114902Sscottl int (MS_FAR *to_int)(CONF *conf, char c); 97114902Sscottl }; 98114902Sscottl 99114902Sscottlint CONF_set_default_method(CONF_METHOD *meth); 100114902SscottlLHASH *CONF_load(LHASH *conf,const char *file,long *eline); 101114902Sscottl#ifndef NO_FP_API 102114902SscottlLHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline); 103114902Sscottl#endif 104114902SscottlLHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline); 105114902SscottlSTACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section); 106114902Sscottlchar *CONF_get_string(LHASH *conf,char *group,char *name); 107140923Sscottllong CONF_get_number(LHASH *conf,char *group,char *name); 108114902Sscottlvoid CONF_free(LHASH *conf); 109114902Sscottlint CONF_dump_fp(LHASH *conf, FILE *out); 110126364Sscottlint CONF_dump_bio(LHASH *conf, BIO *out); 111126364Sscottl 112114902Sscottl/* New conf code. The semantics are different from the functions above. 113114902Sscottl If that wasn't the case, the above functions would have been replaced */ 114126364Sscottl 115126364Sscottlstruct conf_st 116126364Sscottl { 117126364Sscottl CONF_METHOD *meth; 118114902Sscottl void *meth_data; 119114902Sscottl LHASH *data; 120126364Sscottl }; 121114902Sscottl 122126364SscottlCONF *NCONF_new(CONF_METHOD *meth); 123126364SscottlCONF_METHOD *NCONF_default(); 124140923SscottlCONF_METHOD *NCONF_WIN32(); 125140923Sscottl#if 0 /* Just to give you an idea of what I have in mind */ 126140923SscottlCONF_METHOD *NCONF_XML(); 127114902Sscottl#endif 128114902Sscottlvoid NCONF_free(CONF *conf); 129114902Sscottlvoid NCONF_free_data(CONF *conf); 130114902Sscottl 131140923Sscottlint NCONF_load(CONF *conf,const char *file,long *eline); 132140923Sscottl#ifndef NO_FP_API 133114902Sscottlint NCONF_load_fp(CONF *conf, FILE *fp,long *eline); 134114902Sscottl#endif 135114902Sscottlint NCONF_load_bio(CONF *conf, BIO *bp,long *eline); 136114902SscottlSTACK_OF(CONF_VALUE) *NCONF_get_section(CONF *conf,char *section); 137114902Sscottlchar *NCONF_get_string(CONF *conf,char *group,char *name); 138140923Sscottllong NCONF_get_number(CONF *conf,char *group,char *name); 139114902Sscottlint NCONF_dump_fp(CONF *conf, FILE *out); 140114902Sscottlint NCONF_dump_bio(CONF *conf, BIO *out); 141114902Sscottl 142140923Sscottl 143140923Sscottl/* BEGIN ERROR CODES */ 144140923Sscottl/* The following lines are auto generated by the script mkerr.pl. Any changes 145140923Sscottl * made after this point may be overwritten when the script is next run. 146140923Sscottl */ 147140923Sscottlvoid ERR_load_CONF_strings(void); 148114902Sscottl 149114902Sscottl/* Error codes for the CONF functions. */ 150114902Sscottl 151126364Sscottl/* Function codes. */ 152126364Sscottl#define CONF_F_CONF_DUMP_FP 104 153126364Sscottl#define CONF_F_CONF_LOAD 100 154114902Sscottl#define CONF_F_CONF_LOAD_BIO 102 155114902Sscottl#define CONF_F_CONF_LOAD_FP 103 156114902Sscottl#define CONF_F_NCONF_DUMP_BIO 105 157114902Sscottl#define CONF_F_NCONF_DUMP_FP 106 158114902Sscottl#define CONF_F_NCONF_GET_NUMBER 107 159114902Sscottl#define CONF_F_NCONF_GET_SECTION 108 160114902Sscottl#define CONF_F_NCONF_GET_STRING 109 161114902Sscottl#define CONF_F_NCONF_LOAD_BIO 110 162114902Sscottl#define CONF_F_NCONF_NEW 111 163114902Sscottl#define CONF_F_STR_COPY 101 164114902Sscottl 165126364Sscottl/* Reason codes. */ 166140923Sscottl#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 167140923Sscottl#define CONF_R_MISSING_EQUAL_SIGN 101 168140923Sscottl#define CONF_R_NO_CLOSE_BRACE 102 169140923Sscottl#define CONF_R_NO_CONF 105 170140923Sscottl#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 171140923Sscottl#define CONF_R_NO_SECTION 107 172140923Sscottl#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 173140923Sscottl#define CONF_R_VARIABLE_HAS_NO_VALUE 104 174114902Sscottl 175114902Sscottl#ifdef __cplusplus 176114902Sscottl} 177114902Sscottl#endif 178126364Sscottl#endif 179126364Sscottl