summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/conf/conf.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/conf/conf.h')
-rw-r--r--src/lib/libcrypto/conf/conf.h170
1 files changed, 152 insertions, 18 deletions
diff --git a/src/lib/libcrypto/conf/conf.h b/src/lib/libcrypto/conf/conf.h
index 1446226a16..3c03fb19c0 100644
--- a/src/lib/libcrypto/conf/conf.h
+++ b/src/lib/libcrypto/conf/conf.h
@@ -59,13 +59,16 @@
59#ifndef HEADER_CONF_H 59#ifndef HEADER_CONF_H
60#define HEADER_CONF_H 60#define HEADER_CONF_H
61 61
62#include <openssl/bio.h>
63#include <openssl/lhash.h>
64#include <openssl/stack.h>
65#include <openssl/safestack.h>
66#include <openssl/e_os2.h>
67
62#ifdef __cplusplus 68#ifdef __cplusplus
63extern "C" { 69extern "C" {
64#endif 70#endif
65 71
66#include "stack.h"
67#include "lhash.h"
68
69typedef struct 72typedef struct
70 { 73 {
71 char *section; 74 char *section;
@@ -73,42 +76,173 @@ typedef struct
73 char *value; 76 char *value;
74 } CONF_VALUE; 77 } CONF_VALUE;
75 78
76#ifndef NOPROTO 79DECLARE_STACK_OF(CONF_VALUE)
80DECLARE_STACK_OF(CONF_MODULE)
81DECLARE_STACK_OF(CONF_IMODULE)
82
83struct conf_st;
84typedef struct conf_st CONF;
85struct conf_method_st;
86typedef struct conf_method_st CONF_METHOD;
87
88struct conf_method_st
89 {
90 const char *name;
91 CONF *(*create)(CONF_METHOD *meth);
92 int (*init)(CONF *conf);
93 int (*destroy)(CONF *conf);
94 int (*destroy_data)(CONF *conf);
95 int (*load_bio)(CONF *conf, BIO *bp, long *eline);
96 int (*dump)(const CONF *conf, BIO *bp);
97 int (*is_number)(const CONF *conf, char c);
98 int (*to_int)(const CONF *conf, char c);
99 int (*load)(CONF *conf, const char *name, long *eline);
100 };
101
102/* Module definitions */
103
104typedef struct conf_imodule_st CONF_IMODULE;
105typedef struct conf_module_st CONF_MODULE;
77 106
78LHASH *CONF_load(LHASH *conf,char *file,long *eline); 107/* DSO module function typedefs */
79STACK *CONF_get_section(LHASH *conf,char *section); 108typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf);
80char *CONF_get_string(LHASH *conf,char *group,char *name); 109typedef void conf_finish_func(CONF_IMODULE *md);
81long CONF_get_number(LHASH *conf,char *group,char *name); 110
111#define CONF_MFLAGS_IGNORE_ERRORS 0x1
112#define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
113#define CONF_MFLAGS_SILENT 0x4
114#define CONF_MFLAGS_NO_DSO 0x8
115#define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
116
117int CONF_set_default_method(CONF_METHOD *meth);
118void CONF_set_nconf(CONF *conf,LHASH *hash);
119LHASH *CONF_load(LHASH *conf,const char *file,long *eline);
120#ifndef OPENSSL_NO_FP_API
121LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline);
122#endif
123LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline);
124STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section);
125char *CONF_get_string(LHASH *conf,const char *group,const char *name);
126long CONF_get_number(LHASH *conf,const char *group,const char *name);
82void CONF_free(LHASH *conf); 127void CONF_free(LHASH *conf);
83void ERR_load_CONF_strings(void ); 128int CONF_dump_fp(LHASH *conf, FILE *out);
129int CONF_dump_bio(LHASH *conf, BIO *out);
84 130
85#else 131void OPENSSL_config(const char *config_name);
86 132
87LHASH *CONF_load(); 133/* New conf code. The semantics are different from the functions above.
88STACK *CONF_get_section(); 134 If that wasn't the case, the above functions would have been replaced */
89char *CONF_get_string();
90long CONF_get_number();
91void CONF_free();
92void ERR_load_CONF_strings();
93 135
136struct conf_st
137 {
138 CONF_METHOD *meth;
139 void *meth_data;
140 LHASH *data;
141 };
142
143CONF *NCONF_new(CONF_METHOD *meth);
144CONF_METHOD *NCONF_default();
145CONF_METHOD *NCONF_WIN32();
146#if 0 /* Just to give you an idea of what I have in mind */
147CONF_METHOD *NCONF_XML();
94#endif 148#endif
149void NCONF_free(CONF *conf);
150void NCONF_free_data(CONF *conf);
151
152int NCONF_load(CONF *conf,const char *file,long *eline);
153#ifndef OPENSSL_NO_FP_API
154int NCONF_load_fp(CONF *conf, FILE *fp,long *eline);
155#endif
156int NCONF_load_bio(CONF *conf, BIO *bp,long *eline);
157STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section);
158char *NCONF_get_string(const CONF *conf,const char *group,const char *name);
159int NCONF_get_number_e(const CONF *conf,const char *group,const char *name,
160 long *result);
161int NCONF_dump_fp(const CONF *conf, FILE *out);
162int NCONF_dump_bio(const CONF *conf, BIO *out);
163
164#if 0 /* The following function has no error checking,
165 and should therefore be avoided */
166long NCONF_get_number(CONF *conf,char *group,char *name);
167#else
168#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
169#endif
170
171/* Module functions */
172
173int CONF_modules_load(const CONF *cnf, const char *appname,
174 unsigned long flags);
175int CONF_modules_load_file(const char *filename, const char *appname,
176 unsigned long flags);
177void CONF_modules_unload(int all);
178void CONF_modules_finish(void);
179int CONF_module_add(const char *name, conf_init_func *ifunc,
180 conf_finish_func *ffunc);
181
182const char *CONF_imodule_get_name(const CONF_IMODULE *md);
183const char *CONF_imodule_get_value(const CONF_IMODULE *md);
184void *CONF_imodule_get_usr_data(const CONF_IMODULE *md);
185void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);
186CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);
187unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);
188void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);
189void *CONF_module_get_usr_data(CONF_MODULE *pmod);
190void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
191
192char *CONF_get1_default_config_file(void);
193
194int CONF_parse_list(const char *list, int sep, int nospc,
195 int (*list_cb)(const char *elem, int len, void *usr), void *arg);
196
197void OPENSSL_load_builtin_modules(void);
95 198
96/* BEGIN ERROR CODES */ 199/* BEGIN ERROR CODES */
200/* The following lines are auto generated by the script mkerr.pl. Any changes
201 * made after this point may be overwritten when the script is next run.
202 */
203void ERR_load_CONF_strings(void);
204
97/* Error codes for the CONF functions. */ 205/* Error codes for the CONF functions. */
98 206
99/* Function codes. */ 207/* Function codes. */
208#define CONF_F_CONF_DUMP_FP 104
100#define CONF_F_CONF_LOAD 100 209#define CONF_F_CONF_LOAD 100
210#define CONF_F_CONF_LOAD_BIO 102
211#define CONF_F_CONF_LOAD_FP 103
212#define CONF_F_CONF_MODULES_LOAD 116
213#define CONF_F_MODULE_INIT 115
214#define CONF_F_MODULE_LOAD_DSO 117
215#define CONF_F_MODULE_RUN 118
216#define CONF_F_NCONF_DUMP_BIO 105
217#define CONF_F_NCONF_DUMP_FP 106
218#define CONF_F_NCONF_GET_NUMBER 107
219#define CONF_F_NCONF_GET_NUMBER_E 112
220#define CONF_F_NCONF_GET_SECTION 108
221#define CONF_F_NCONF_GET_STRING 109
222#define CONF_F_NCONF_LOAD 113
223#define CONF_F_NCONF_LOAD_BIO 110
224#define CONF_F_NCONF_LOAD_FP 114
225#define CONF_F_NCONF_NEW 111
101#define CONF_F_STR_COPY 101 226#define CONF_F_STR_COPY 101
102 227
103/* Reason codes. */ 228/* Reason codes. */
229#define CONF_R_ERROR_LOADING_DSO 110
104#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 230#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100
105#define CONF_R_MISSING_EQUAL_SIGN 101 231#define CONF_R_MISSING_EQUAL_SIGN 101
232#define CONF_R_MISSING_FINISH_FUNCTION 111
233#define CONF_R_MISSING_INIT_FUNCTION 112
234#define CONF_R_MODULE_INITIALIZATION_ERROR 109
106#define CONF_R_NO_CLOSE_BRACE 102 235#define CONF_R_NO_CLOSE_BRACE 102
236#define CONF_R_NO_CONF 105
237#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106
238#define CONF_R_NO_SECTION 107
239#define CONF_R_NO_SUCH_FILE 114
240#define CONF_R_NO_VALUE 108
107#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 241#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
242#define CONF_R_UNKNOWN_MODULE_NAME 113
108#define CONF_R_VARIABLE_HAS_NO_VALUE 104 243#define CONF_R_VARIABLE_HAS_NO_VALUE 104
109 244
110#ifdef __cplusplus 245#ifdef __cplusplus
111} 246}
112#endif 247#endif
113#endif 248#endif
114