NCONF_new_ex.3ossl 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "NCONF_NEW_EX 3ossl"
  58. .TH NCONF_NEW_EX 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. NCONF_new_ex, NCONF_new, NCONF_free, NCONF_default, NCONF_load,
  65. NCONF_get0_libctx, NCONF_get_section, NCONF_get_section_names
  66. \&\- functionality to Load and parse configuration files manually
  67. .SH SYNOPSIS
  68. .IX Header "SYNOPSIS"
  69. .Vb 1
  70. \& #include <openssl/conf.h>
  71. \&
  72. \& typedef struct {
  73. \& char *section;
  74. \& char *name;
  75. \& char *value;
  76. \& } CONF_VALUE;
  77. \&
  78. \& CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth);
  79. \& CONF *NCONF_new(CONF_METHOD *meth);
  80. \& void NCONF_free(CONF *conf);
  81. \& CONF_METHOD *NCONF_default(void);
  82. \& int NCONF_load(CONF *conf, const char *file, long *eline);
  83. \& OSSL_LIB_CTX *NCONF_get0_libctx(const CONF *conf);
  84. \&
  85. \& STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *name);
  86. \& STACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(const CONF *conf);
  87. .Ve
  88. .SH DESCRIPTION
  89. .IX Header "DESCRIPTION"
  90. \&\fBNCONF_new_ex()\fR creates a new CONF object in heap memory and assigns to
  91. it a context \fIlibctx\fR that can be used during loading. If the method table
  92. \&\fImeth\fR is set to NULL then the default value of \fBNCONF_default()\fR is used.
  93. .PP
  94. \&\fBNCONF_new()\fR is similar to \fBNCONF_new_ex()\fR but sets the \fIlibctx\fR to NULL.
  95. .PP
  96. \&\fBNCONF_free()\fR frees the data associated with \fIconf\fR and then frees the \fIconf\fR
  97. object. If the argument is NULL, nothing is done.
  98. .PP
  99. \&\fBNCONF_load()\fR parses the file named \fIfilename\fR and adds the values found to
  100. \&\fIconf\fR. If an error occurs \fIfile\fR and \fIeline\fR list the file and line that
  101. the load failed on if they are not NULL.
  102. .PP
  103. \&\fBNCONF_default()\fR gets the default method table for processing a configuration file.
  104. .PP
  105. \&\fBNCONF_get0_libctx()\fR gets the library context associated with the \fIconf\fR
  106. parameter.
  107. .PP
  108. \&\fBNCONF_get_section_names()\fR gets the names of the sections associated with
  109. the \fIconf\fR as \fBSTACK_OF(OPENSSL_CSTRING)\fR strings. The individual strings
  110. are associated with the \fIconf\fR and will be invalid after \fIconf\fR is
  111. freed. The returned stack must be freed with \fBsk_OPENSSL_CSTRING_free()\fR.
  112. .PP
  113. \&\fBNCONF_get_section()\fR gets the config values associated with the \fIconf\fR from
  114. the config section \fIname\fR as \fBSTACK_OF(CONF_VALUE)\fR structures. The returned
  115. stack is associated with the \fIconf\fR and will be invalid after \fIconf\fR
  116. is freed. It must not be freed by the caller.
  117. .SH "RETURN VALUES"
  118. .IX Header "RETURN VALUES"
  119. \&\fBNCONF_load()\fR returns 1 on success or 0 on error.
  120. .PP
  121. \&\fBNCONF_new_ex()\fR and \fBNCONF_new()\fR return a newly created \fICONF\fR object
  122. or NULL if an error occurs.
  123. .SH "SEE ALSO"
  124. .IX Header "SEE ALSO"
  125. \&\fBCONF_modules_load_file\fR\|(3),
  126. .SH HISTORY
  127. .IX Header "HISTORY"
  128. \&\fBNCONF_new_ex()\fR, \fBNCONF_get0_libctx()\fR, and \fBNCONF_get_section_names()\fR were added
  129. in OpenSSL 3.0.
  130. .SH COPYRIGHT
  131. .IX Header "COPYRIGHT"
  132. Copyright 2020\-2024 The OpenSSL Project Authors. All Rights Reserved.
  133. .PP
  134. Licensed under the Apache License 2.0 (the "License"). You may not use
  135. this file except in compliance with the License. You can obtain a copy
  136. in the file LICENSE in the source distribution or at
  137. <https://www.openssl.org/source/license.html>.