NCONF_new_ex.pod 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. =pod
  2. =head1 NAME
  3. NCONF_new_ex, NCONF_new, NCONF_free, NCONF_default, NCONF_load,
  4. NCONF_get0_libctx, NCONF_get_section, NCONF_get_section_names
  5. - functionality to Load and parse configuration files manually
  6. =head1 SYNOPSIS
  7. #include <openssl/conf.h>
  8. typedef struct {
  9. char *section;
  10. char *name;
  11. char *value;
  12. } CONF_VALUE;
  13. CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth);
  14. CONF *NCONF_new(CONF_METHOD *meth);
  15. void NCONF_free(CONF *conf);
  16. CONF_METHOD *NCONF_default(void);
  17. int NCONF_load(CONF *conf, const char *file, long *eline);
  18. OSSL_LIB_CTX *NCONF_get0_libctx(const CONF *conf);
  19. STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *name);
  20. STACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(const CONF *conf);
  21. =head1 DESCRIPTION
  22. NCONF_new_ex() creates a new CONF object in heap memory and assigns to
  23. it a context I<libctx> that can be used during loading. If the method table
  24. I<meth> is set to NULL then the default value of NCONF_default() is used.
  25. NCONF_new() is similar to NCONF_new_ex() but sets the I<libctx> to NULL.
  26. NCONF_free() frees the data associated with I<conf> and then frees the I<conf>
  27. object.
  28. NCONF_load() parses the file named I<filename> and adds the values found to
  29. I<conf>. If an error occurs I<file> and I<eline> list the file and line that
  30. the load failed on if they are not NULL.
  31. NCONF_default() gets the default method table for processing a configuration file.
  32. NCONF_get0_libctx() gets the library context associated with the I<conf>
  33. parameter.
  34. NCONF_get_section_names() gets the names of the sections associated with
  35. the I<conf> as B<STACK_OF(OPENSSL_CSTRING)> strings. The individual strings
  36. are associated with the I<conf> and will be invalid after I<conf> is
  37. freed. The returned stack must be freed with sk_OPENSSL_CSTRING_free().
  38. NCONF_get_section() gets the config values associated with the I<conf> from
  39. the config section I<name> as B<STACK_OF(CONF_VALUE)> structures. The returned
  40. stack is associated with the I<conf> and will be invalid after I<conf>
  41. is freed. It must not be freed by the caller.
  42. =head1 RETURN VALUES
  43. NCONF_load() returns 1 on success or 0 on error.
  44. NCONF_new_ex() and NCONF_new() return a newly created I<CONF> object
  45. or NULL if an error occurs.
  46. =head1 SEE ALSO
  47. L<CONF_modules_load_file(3)>,
  48. =head1 HISTORY
  49. NCONF_new_ex(), NCONF_get0_libctx(), and NCONF_get_section_names() were added
  50. in OpenSSL 3.0.
  51. =head1 COPYRIGHT
  52. Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
  53. Licensed under the Apache License 2.0 (the "License"). You may not use
  54. this file except in compliance with the License. You can obtain a copy
  55. in the file LICENSE in the source distribution or at
  56. L<https://www.openssl.org/source/license.html>.
  57. =cut