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