]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/openssl/conf.h.in
Add .includedir pragma
[thirdparty/openssl.git] / include / openssl / conf.h.in
CommitLineData
21dcbebc 1/*
e74e562f
MC
2 * {- join("\n * ", @autowarntext) -}
3 *
33388b44 4 * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
d02b48c6 5 *
48f4ad77 6 * Licensed under the Apache License 2.0 (the "License"). You may not use
21dcbebc
RS
7 * this file except in compliance with the License. You can obtain a copy
8 * in the file LICENSE in the source distribution or at
9 * https://www.openssl.org/source/license.html
d02b48c6
RE
10 */
11
e74e562f 12{-
2ca697ce 13use OpenSSL::stackhash qw(generate_stack_macros generate_lhash_macros);
e74e562f
MC
14-}
15
ae4186b0
DMSP
16#ifndef OPENSSL_CONF_H
17# define OPENSSL_CONF_H
d86167ec
DMSP
18# pragma once
19
20# include <openssl/macros.h>
936c2b9e 21# ifndef OPENSSL_NO_DEPRECATED_3_0
d86167ec
DMSP
22# define HEADER_CONF_H
23# endif
d02b48c6 24
0f113f3e
MC
25# include <openssl/bio.h>
26# include <openssl/lhash.h>
af3e5e1b 27# include <openssl/safestack.h>
0f113f3e 28# include <openssl/e_os2.h>
50cd4768 29# include <openssl/types.h>
52df25cf 30# include <openssl/conferr.h>
9ea1b878 31
82271cee
RL
32#ifdef __cplusplus
33extern "C" {
34#endif
35
0f113f3e
MC
36typedef struct {
37 char *section;
38 char *name;
39 char *value;
40} CONF_VALUE;
d02b48c6 41
e74e562f 42{-
2ca697ce
MC
43 generate_stack_macros("CONF_VALUE")
44 .generate_lhash_macros("CONF_VALUE");
e74e562f 45-}
852c2ed2 46
d86b6915 47struct conf_st;
d86b6915
RL
48struct conf_method_st;
49typedef struct conf_method_st CONF_METHOD;
50
0f113f3e
MC
51struct conf_method_st {
52 const char *name;
53 CONF *(*create) (CONF_METHOD *meth);
54 int (*init) (CONF *conf);
55 int (*destroy) (CONF *conf);
56 int (*destroy_data) (CONF *conf);
57 int (*load_bio) (CONF *conf, BIO *bp, long *eline);
58 int (*dump) (const CONF *conf, BIO *bp);
59 int (*is_number) (const CONF *conf, char c);
60 int (*to_int) (const CONF *conf, char c);
61 int (*load) (CONF *conf, const char *name, long *eline);
62};
d86b6915 63
bc37d996
DSH
64/* Module definitions */
65
66typedef struct conf_imodule_st CONF_IMODULE;
67typedef struct conf_module_st CONF_MODULE;
68
01659135 69STACK_OF(CONF_MODULE);
852c2ed2 70STACK_OF(CONF_IMODULE);
de121164 71
bc37d996 72/* DSO module function typedefs */
0f113f3e
MC
73typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf);
74typedef void conf_finish_func (CONF_IMODULE *md);
bc37d996 75
0f113f3e
MC
76# define CONF_MFLAGS_IGNORE_ERRORS 0x1
77# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
78# define CONF_MFLAGS_SILENT 0x4
79# define CONF_MFLAGS_NO_DSO 0x8
80# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
81# define CONF_MFLAGS_DEFAULT_SECTION 0x20
bc37d996 82
d86b6915 83int CONF_set_default_method(CONF_METHOD *meth);
0f113f3e
MC
84void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
85LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
86 long *eline);
87# ifndef OPENSSL_NO_STDIO
3c1d6bbc 88LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
0f113f3e
MC
89 long *eline);
90# endif
91LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,
92 long *eline);
3c1d6bbc 93STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
0f113f3e
MC
94 const char *section);
95char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
96 const char *name);
97long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
98 const char *name);
3c1d6bbc 99void CONF_free(LHASH_OF(CONF_VALUE) *conf);
984d6c60 100#ifndef OPENSSL_NO_STDIO
3c1d6bbc 101int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
984d6c60 102#endif
3c1d6bbc 103int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
7f7c856c
RL
104#ifndef OPENSSL_NO_DEPRECATED_1_1_0
105OSSL_DEPRECATEDIN_1_1_0 void OPENSSL_config(const char *config_name);
106#endif
7253fd55 107
00db8c60 108#ifndef OPENSSL_NO_DEPRECATED_1_1_0
f672aee4
RS
109# define OPENSSL_no_config() \
110 OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL)
111#endif
cca28b29 112
0f113f3e
MC
113/*
114 * New conf code. The semantics are different from the functions above. If
115 * that wasn't the case, the above functions would have been replaced
116 */
d86b6915 117
0f113f3e
MC
118struct conf_st {
119 CONF_METHOD *meth;
120 void *meth_data;
121 LHASH_OF(CONF_VALUE) *data;
f7050588
RS
122 int flag_dollarid;
123 int flag_abspath;
124 char *includedir;
b4250010 125 OSSL_LIB_CTX *libctx;
0f113f3e 126};
d86b6915 127
b4250010 128CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth);
d86b6915 129CONF *NCONF_new(CONF_METHOD *meth);
40889b9c 130CONF_METHOD *NCONF_default(void);
7f7c856c
RL
131#ifndef OPENSSL_NO_DEPRECATED_3_0
132OSSL_DEPRECATEDIN_3_0 CONF_METHOD *NCONF_WIN32(void);
133#endif
d86b6915
RL
134void NCONF_free(CONF *conf);
135void NCONF_free_data(CONF *conf);
136
0f113f3e
MC
137int NCONF_load(CONF *conf, const char *file, long *eline);
138# ifndef OPENSSL_NO_STDIO
139int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
140# endif
141int NCONF_load_bio(CONF *conf, BIO *bp, long *eline);
142STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,
143 const char *section);
144char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
145int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
146 long *result);
984d6c60 147#ifndef OPENSSL_NO_STDIO
9dd5ae65 148int NCONF_dump_fp(const CONF *conf, FILE *out);
984d6c60 149#endif
9dd5ae65 150int NCONF_dump_bio(const CONF *conf, BIO *out);
d86b6915 151
1a5adcfb 152#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
0f113f3e 153
bc37d996
DSH
154/* Module functions */
155
9dd5ae65 156int CONF_modules_load(const CONF *cnf, const char *appname,
0f113f3e 157 unsigned long flags);
b4250010 158int CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx, const char *filename,
d8652be0 159 const char *appname, unsigned long flags);
9dd5ae65 160int CONF_modules_load_file(const char *filename, const char *appname,
0f113f3e 161 unsigned long flags);
bc37d996
DSH
162void CONF_modules_unload(int all);
163void CONF_modules_finish(void);
00db8c60 164#ifndef OPENSSL_NO_DEPRECATED_1_1_0
6457615a 165# define CONF_modules_free() while(0) continue
cbf6959f 166#endif
cca28b29 167int CONF_module_add(const char *name, conf_init_func *ifunc,
0f113f3e 168 conf_finish_func *ffunc);
bc37d996 169
9dd5ae65
BL
170const char *CONF_imodule_get_name(const CONF_IMODULE *md);
171const char *CONF_imodule_get_value(const CONF_IMODULE *md);
172void *CONF_imodule_get_usr_data(const CONF_IMODULE *md);
bc37d996 173void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);
9dd5ae65
BL
174CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);
175unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);
bc37d996
DSH
176void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);
177void *CONF_module_get_usr_data(CONF_MODULE *pmod);
178void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
ba404b5e 179
c9501c22
DSH
180char *CONF_get1_default_config_file(void);
181
f78d4a35 182int CONF_parse_list(const char *list, int sep, int nospc,
0f113f3e
MC
183 int (*list_cb) (const char *elem, int len, void *usr),
184 void *arg);
df5eaa8a 185
3647bee2
DSH
186void OPENSSL_load_builtin_modules(void);
187
957b6db3 188
0cd0a820 189# ifdef __cplusplus
d02b48c6 190}
0cd0a820 191# endif
d02b48c6 192#endif