conf.h revision 68651
155714Skris/* crypto/conf/conf.h */ 255714Skris/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 355714Skris * All rights reserved. 455714Skris * 555714Skris * This package is an SSL implementation written 655714Skris * by Eric Young (eay@cryptsoft.com). 755714Skris * The implementation was written so as to conform with Netscapes SSL. 855714Skris * 955714Skris * This library is free for commercial and non-commercial use as long as 1055714Skris * the following conditions are aheared to. The following conditions 1155714Skris * apply to all code found in this distribution, be it the RC4, RSA, 1255714Skris * lhash, DES, etc., code; not just the SSL code. The SSL documentation 1355714Skris * included with this distribution is covered by the same copyright terms 1455714Skris * except that the holder is Tim Hudson (tjh@cryptsoft.com). 1555714Skris * 1655714Skris * Copyright remains Eric Young's, and as such any Copyright notices in 1755714Skris * the code are not to be removed. 1855714Skris * If this package is used in a product, Eric Young should be given attribution 1955714Skris * as the author of the parts of the library used. 2055714Skris * This can be in the form of a textual message at program startup or 2155714Skris * in documentation (online or textual) provided with the package. 2255714Skris * 2355714Skris * Redistribution and use in source and binary forms, with or without 2455714Skris * modification, are permitted provided that the following conditions 2555714Skris * are met: 2655714Skris * 1. Redistributions of source code must retain the copyright 2755714Skris * notice, this list of conditions and the following disclaimer. 2855714Skris * 2. Redistributions in binary form must reproduce the above copyright 2955714Skris * notice, this list of conditions and the following disclaimer in the 3055714Skris * documentation and/or other materials provided with the distribution. 3155714Skris * 3. All advertising materials mentioning features or use of this software 3255714Skris * must display the following acknowledgement: 3355714Skris * "This product includes cryptographic software written by 3455714Skris * Eric Young (eay@cryptsoft.com)" 3555714Skris * The word 'cryptographic' can be left out if the rouines from the library 3655714Skris * being used are not cryptographic related :-). 3755714Skris * 4. If you include any Windows specific code (or a derivative thereof) from 3855714Skris * the apps directory (application code) you must include an acknowledgement: 3955714Skris * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 4055714Skris * 4155714Skris * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 4255714Skris * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 4355714Skris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 4455714Skris * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 4555714Skris * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 4655714Skris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 4755714Skris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 4855714Skris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 4955714Skris * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 5055714Skris * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 5155714Skris * SUCH DAMAGE. 5255714Skris * 5355714Skris * The licence and distribution terms for any publically available version or 5455714Skris * derivative of this code cannot be changed. i.e. this code cannot simply be 5555714Skris * copied and put under another distribution licence 5655714Skris * [including the GNU Public Licence.] 5755714Skris */ 5855714Skris 5955714Skris#ifndef HEADER_CONF_H 6055714Skris#define HEADER_CONF_H 6155714Skris 6255714Skris#include <openssl/bio.h> 6355714Skris#include <openssl/lhash.h> 6455714Skris#include <openssl/stack.h> 6555714Skris#include <openssl/safestack.h> 6668651Skris#include <openssl/e_os.h> 6755714Skris 6868651Skris#ifdef __cplusplus 6968651Skrisextern "C" { 7068651Skris#endif 7168651Skris 7255714Skristypedef struct 7355714Skris { 7455714Skris char *section; 7555714Skris char *name; 7655714Skris char *value; 7755714Skris } CONF_VALUE; 7855714Skris 7955714SkrisDECLARE_STACK_OF(CONF_VALUE) 8055714Skris 8168651Skrisstruct conf_st; 8268651Skristypedef struct conf_st CONF; 8368651Skrisstruct conf_method_st; 8468651Skristypedef struct conf_method_st CONF_METHOD; 8568651Skris 8668651Skrisstruct conf_method_st 8768651Skris { 8868651Skris const char *name; 8968651Skris CONF *(MS_FAR *create)(CONF_METHOD *meth); 9068651Skris int (MS_FAR *init)(CONF *conf); 9168651Skris int (MS_FAR *destroy)(CONF *conf); 9268651Skris int (MS_FAR *destroy_data)(CONF *conf); 9368651Skris int (MS_FAR *load)(CONF *conf, BIO *bp, long *eline); 9468651Skris int (MS_FAR *dump)(CONF *conf, BIO *bp); 9568651Skris int (MS_FAR *is_number)(CONF *conf, char c); 9668651Skris int (MS_FAR *to_int)(CONF *conf, char c); 9768651Skris }; 9868651Skris 9968651Skrisint CONF_set_default_method(CONF_METHOD *meth); 10055714SkrisLHASH *CONF_load(LHASH *conf,const char *file,long *eline); 10159191Skris#ifndef NO_FP_API 10255714SkrisLHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline); 10359191Skris#endif 10455714SkrisLHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline); 10555714SkrisSTACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section); 10655714Skrischar *CONF_get_string(LHASH *conf,char *group,char *name); 10755714Skrislong CONF_get_number(LHASH *conf,char *group,char *name); 10855714Skrisvoid CONF_free(LHASH *conf); 10968651Skrisint CONF_dump_fp(LHASH *conf, FILE *out); 11068651Skrisint CONF_dump_bio(LHASH *conf, BIO *out); 11155714Skrisvoid ERR_load_CONF_strings(void ); 11255714Skris 11368651Skris/* New conf code. The semantics are different from the functions above. 11468651Skris If that wasn't the case, the above functions would have been replaced */ 11555714Skris 11668651Skrisstruct conf_st 11768651Skris { 11868651Skris CONF_METHOD *meth; 11968651Skris void *meth_data; 12068651Skris LHASH *data; 12168651Skris }; 12268651Skris 12368651SkrisCONF *NCONF_new(CONF_METHOD *meth); 12468651SkrisCONF_METHOD *NCONF_default(); 12568651SkrisCONF_METHOD *NCONF_WIN32(); 12668651Skris#if 0 /* Just to give you an idea of what I have in mind */ 12768651SkrisCONF_METHOD *NCONF_XML(); 12868651Skris#endif 12968651Skrisvoid NCONF_free(CONF *conf); 13068651Skrisvoid NCONF_free_data(CONF *conf); 13168651Skris 13268651Skrisint NCONF_load(CONF *conf,const char *file,long *eline); 13368651Skris#ifndef NO_FP_API 13468651Skrisint NCONF_load_fp(CONF *conf, FILE *fp,long *eline); 13568651Skris#endif 13668651Skrisint NCONF_load_bio(CONF *conf, BIO *bp,long *eline); 13768651SkrisSTACK_OF(CONF_VALUE) *NCONF_get_section(CONF *conf,char *section); 13868651Skrischar *NCONF_get_string(CONF *conf,char *group,char *name); 13968651Skrislong NCONF_get_number(CONF *conf,char *group,char *name); 14068651Skrisint NCONF_dump_fp(CONF *conf, FILE *out); 14168651Skrisint NCONF_dump_bio(CONF *conf, BIO *out); 14268651Skris 14368651Skris 14455714Skris/* BEGIN ERROR CODES */ 14555714Skris/* The following lines are auto generated by the script mkerr.pl. Any changes 14655714Skris * made after this point may be overwritten when the script is next run. 14755714Skris */ 14855714Skris 14955714Skris/* Error codes for the CONF functions. */ 15055714Skris 15155714Skris/* Function codes. */ 15268651Skris#define CONF_F_CONF_DUMP_FP 104 15355714Skris#define CONF_F_CONF_LOAD 100 15455714Skris#define CONF_F_CONF_LOAD_BIO 102 15555714Skris#define CONF_F_CONF_LOAD_FP 103 15668651Skris#define CONF_F_NCONF_DUMP_BIO 105 15768651Skris#define CONF_F_NCONF_DUMP_FP 106 15868651Skris#define CONF_F_NCONF_GET_NUMBER 107 15968651Skris#define CONF_F_NCONF_GET_SECTION 108 16068651Skris#define CONF_F_NCONF_GET_STRING 109 16168651Skris#define CONF_F_NCONF_LOAD_BIO 110 16268651Skris#define CONF_F_NCONF_NEW 111 16355714Skris#define CONF_F_STR_COPY 101 16455714Skris 16555714Skris/* Reason codes. */ 16655714Skris#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 16755714Skris#define CONF_R_MISSING_EQUAL_SIGN 101 16855714Skris#define CONF_R_NO_CLOSE_BRACE 102 16968651Skris#define CONF_R_NO_CONF 105 17055714Skris#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 17155714Skris#define CONF_R_VARIABLE_HAS_NO_VALUE 104 17255714Skris 17355714Skris#ifdef __cplusplus 17455714Skris} 17555714Skris#endif 17655714Skris#endif 17755714Skris 178