diff options
Diffstat (limited to 'src/lib/libcrypto/conf/conf.h')
-rw-r--r-- | src/lib/libcrypto/conf/conf.h | 170 |
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 |
63 | extern "C" { | 69 | extern "C" { |
64 | #endif | 70 | #endif |
65 | 71 | ||
66 | #include "stack.h" | ||
67 | #include "lhash.h" | ||
68 | |||
69 | typedef struct | 72 | typedef 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 | 79 | DECLARE_STACK_OF(CONF_VALUE) |
80 | DECLARE_STACK_OF(CONF_MODULE) | ||
81 | DECLARE_STACK_OF(CONF_IMODULE) | ||
82 | |||
83 | struct conf_st; | ||
84 | typedef struct conf_st CONF; | ||
85 | struct conf_method_st; | ||
86 | typedef struct conf_method_st CONF_METHOD; | ||
87 | |||
88 | struct 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 | |||
104 | typedef struct conf_imodule_st CONF_IMODULE; | ||
105 | typedef struct conf_module_st CONF_MODULE; | ||
77 | 106 | ||
78 | LHASH *CONF_load(LHASH *conf,char *file,long *eline); | 107 | /* DSO module function typedefs */ |
79 | STACK *CONF_get_section(LHASH *conf,char *section); | 108 | typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf); |
80 | char *CONF_get_string(LHASH *conf,char *group,char *name); | 109 | typedef void conf_finish_func(CONF_IMODULE *md); |
81 | long 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 | |||
117 | int CONF_set_default_method(CONF_METHOD *meth); | ||
118 | void CONF_set_nconf(CONF *conf,LHASH *hash); | ||
119 | LHASH *CONF_load(LHASH *conf,const char *file,long *eline); | ||
120 | #ifndef OPENSSL_NO_FP_API | ||
121 | LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline); | ||
122 | #endif | ||
123 | LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline); | ||
124 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section); | ||
125 | char *CONF_get_string(LHASH *conf,const char *group,const char *name); | ||
126 | long CONF_get_number(LHASH *conf,const char *group,const char *name); | ||
82 | void CONF_free(LHASH *conf); | 127 | void CONF_free(LHASH *conf); |
83 | void ERR_load_CONF_strings(void ); | 128 | int CONF_dump_fp(LHASH *conf, FILE *out); |
129 | int CONF_dump_bio(LHASH *conf, BIO *out); | ||
84 | 130 | ||
85 | #else | 131 | void OPENSSL_config(const char *config_name); |
86 | 132 | ||
87 | LHASH *CONF_load(); | 133 | /* New conf code. The semantics are different from the functions above. |
88 | STACK *CONF_get_section(); | 134 | If that wasn't the case, the above functions would have been replaced */ |
89 | char *CONF_get_string(); | ||
90 | long CONF_get_number(); | ||
91 | void CONF_free(); | ||
92 | void ERR_load_CONF_strings(); | ||
93 | 135 | ||
136 | struct conf_st | ||
137 | { | ||
138 | CONF_METHOD *meth; | ||
139 | void *meth_data; | ||
140 | LHASH *data; | ||
141 | }; | ||
142 | |||
143 | CONF *NCONF_new(CONF_METHOD *meth); | ||
144 | CONF_METHOD *NCONF_default(); | ||
145 | CONF_METHOD *NCONF_WIN32(); | ||
146 | #if 0 /* Just to give you an idea of what I have in mind */ | ||
147 | CONF_METHOD *NCONF_XML(); | ||
94 | #endif | 148 | #endif |
149 | void NCONF_free(CONF *conf); | ||
150 | void NCONF_free_data(CONF *conf); | ||
151 | |||
152 | int NCONF_load(CONF *conf,const char *file,long *eline); | ||
153 | #ifndef OPENSSL_NO_FP_API | ||
154 | int NCONF_load_fp(CONF *conf, FILE *fp,long *eline); | ||
155 | #endif | ||
156 | int NCONF_load_bio(CONF *conf, BIO *bp,long *eline); | ||
157 | STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section); | ||
158 | char *NCONF_get_string(const CONF *conf,const char *group,const char *name); | ||
159 | int NCONF_get_number_e(const CONF *conf,const char *group,const char *name, | ||
160 | long *result); | ||
161 | int NCONF_dump_fp(const CONF *conf, FILE *out); | ||
162 | int 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 */ | ||
166 | long 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 | |||
173 | int CONF_modules_load(const CONF *cnf, const char *appname, | ||
174 | unsigned long flags); | ||
175 | int CONF_modules_load_file(const char *filename, const char *appname, | ||
176 | unsigned long flags); | ||
177 | void CONF_modules_unload(int all); | ||
178 | void CONF_modules_finish(void); | ||
179 | int CONF_module_add(const char *name, conf_init_func *ifunc, | ||
180 | conf_finish_func *ffunc); | ||
181 | |||
182 | const char *CONF_imodule_get_name(const CONF_IMODULE *md); | ||
183 | const char *CONF_imodule_get_value(const CONF_IMODULE *md); | ||
184 | void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); | ||
185 | void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); | ||
186 | CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); | ||
187 | unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); | ||
188 | void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); | ||
189 | void *CONF_module_get_usr_data(CONF_MODULE *pmod); | ||
190 | void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); | ||
191 | |||
192 | char *CONF_get1_default_config_file(void); | ||
193 | |||
194 | int CONF_parse_list(const char *list, int sep, int nospc, | ||
195 | int (*list_cb)(const char *elem, int len, void *usr), void *arg); | ||
196 | |||
197 | void 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 | */ | ||
203 | void 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 | |||