1b077aed3SPierre Pronchery=pod 2b077aed3SPierre Pronchery 3b077aed3SPierre Pronchery=head1 NAME 4b077aed3SPierre Pronchery 5b077aed3SPierre ProncheryNCONF_new_ex, NCONF_new, NCONF_free, NCONF_default, NCONF_load, 6b077aed3SPierre ProncheryNCONF_get0_libctx, NCONF_get_section, NCONF_get_section_names 7b077aed3SPierre Pronchery- functionality to Load and parse configuration files manually 8b077aed3SPierre Pronchery 9b077aed3SPierre Pronchery=head1 SYNOPSIS 10b077aed3SPierre Pronchery 11b077aed3SPierre Pronchery #include <openssl/conf.h> 12b077aed3SPierre Pronchery 13b077aed3SPierre Pronchery typedef struct { 14b077aed3SPierre Pronchery char *section; 15b077aed3SPierre Pronchery char *name; 16b077aed3SPierre Pronchery char *value; 17b077aed3SPierre Pronchery } CONF_VALUE; 18b077aed3SPierre Pronchery 19b077aed3SPierre Pronchery CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth); 20b077aed3SPierre Pronchery CONF *NCONF_new(CONF_METHOD *meth); 21b077aed3SPierre Pronchery void NCONF_free(CONF *conf); 22b077aed3SPierre Pronchery CONF_METHOD *NCONF_default(void); 23b077aed3SPierre Pronchery int NCONF_load(CONF *conf, const char *file, long *eline); 24b077aed3SPierre Pronchery OSSL_LIB_CTX *NCONF_get0_libctx(const CONF *conf); 25b077aed3SPierre Pronchery 26b077aed3SPierre Pronchery STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *name); 27b077aed3SPierre Pronchery STACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(const CONF *conf); 28b077aed3SPierre Pronchery 29b077aed3SPierre Pronchery=head1 DESCRIPTION 30b077aed3SPierre Pronchery 31b077aed3SPierre ProncheryNCONF_new_ex() creates a new CONF object in heap memory and assigns to 32b077aed3SPierre Proncheryit a context I<libctx> that can be used during loading. If the method table 33b077aed3SPierre ProncheryI<meth> is set to NULL then the default value of NCONF_default() is used. 34b077aed3SPierre Pronchery 35b077aed3SPierre ProncheryNCONF_new() is similar to NCONF_new_ex() but sets the I<libctx> to NULL. 36b077aed3SPierre Pronchery 37b077aed3SPierre ProncheryNCONF_free() frees the data associated with I<conf> and then frees the I<conf> 38*a7148ab3SEnji Cooperobject. If the argument is NULL, nothing is done. 39b077aed3SPierre Pronchery 40b077aed3SPierre ProncheryNCONF_load() parses the file named I<filename> and adds the values found to 41b077aed3SPierre ProncheryI<conf>. If an error occurs I<file> and I<eline> list the file and line that 42b077aed3SPierre Proncherythe load failed on if they are not NULL. 43b077aed3SPierre Pronchery 44b077aed3SPierre ProncheryNCONF_default() gets the default method table for processing a configuration file. 45b077aed3SPierre Pronchery 46b077aed3SPierre ProncheryNCONF_get0_libctx() gets the library context associated with the I<conf> 47b077aed3SPierre Proncheryparameter. 48b077aed3SPierre Pronchery 49b077aed3SPierre ProncheryNCONF_get_section_names() gets the names of the sections associated with 50b077aed3SPierre Proncherythe I<conf> as B<STACK_OF(OPENSSL_CSTRING)> strings. The individual strings 51b077aed3SPierre Proncheryare associated with the I<conf> and will be invalid after I<conf> is 52b077aed3SPierre Proncheryfreed. The returned stack must be freed with sk_OPENSSL_CSTRING_free(). 53b077aed3SPierre Pronchery 54b077aed3SPierre ProncheryNCONF_get_section() gets the config values associated with the I<conf> from 55b077aed3SPierre Proncherythe config section I<name> as B<STACK_OF(CONF_VALUE)> structures. The returned 56b077aed3SPierre Proncherystack is associated with the I<conf> and will be invalid after I<conf> 57b077aed3SPierre Proncheryis freed. It must not be freed by the caller. 58b077aed3SPierre Pronchery 59b077aed3SPierre Pronchery=head1 RETURN VALUES 60b077aed3SPierre Pronchery 61b077aed3SPierre ProncheryNCONF_load() returns 1 on success or 0 on error. 62b077aed3SPierre Pronchery 63b077aed3SPierre ProncheryNCONF_new_ex() and NCONF_new() return a newly created I<CONF> object 64b077aed3SPierre Proncheryor NULL if an error occurs. 65b077aed3SPierre Pronchery 66b077aed3SPierre Pronchery=head1 SEE ALSO 67b077aed3SPierre Pronchery 68b077aed3SPierre ProncheryL<CONF_modules_load_file(3)>, 69b077aed3SPierre Pronchery 70b077aed3SPierre Pronchery=head1 HISTORY 71b077aed3SPierre Pronchery 72b077aed3SPierre ProncheryNCONF_new_ex(), NCONF_get0_libctx(), and NCONF_get_section_names() were added 73b077aed3SPierre Proncheryin OpenSSL 3.0. 74b077aed3SPierre Pronchery 75b077aed3SPierre Pronchery=head1 COPYRIGHT 76b077aed3SPierre Pronchery 77*a7148ab3SEnji CooperCopyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. 78b077aed3SPierre Pronchery 79b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 80b077aed3SPierre Proncherythis file except in compliance with the License. You can obtain a copy 81b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at 82b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>. 83b077aed3SPierre Pronchery 84b077aed3SPierre Pronchery=cut 85