xref: /aosp_15_r20/external/boringssl/src/crypto/conf/internal.h (revision 8fb009dc861624b67b6cdb62ea21f0f22d0c584b)
1 /* Copyright (c) 2015, Google Inc.
2  *
3  * Permission to use, copy, modify, and/or distribute this software for any
4  * purpose with or without fee is hereby granted, provided that the above
5  * copyright notice and this permission notice appear in all copies.
6  *
7  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14 
15 #ifndef OPENSSL_HEADER_CRYPTO_CONF_INTERNAL_H
16 #define OPENSSL_HEADER_CRYPTO_CONF_INTERNAL_H
17 
18 #include <openssl/base.h>
19 
20 #include "../lhash/internal.h"
21 
22 #if defined(__cplusplus)
23 extern "C" {
24 #endif
25 
26 
27 typedef struct conf_section_st CONF_SECTION;
28 
29 DEFINE_LHASH_OF(CONF_SECTION)
30 DEFINE_LHASH_OF(CONF_VALUE)
31 
32 struct conf_st {
33   LHASH_OF(CONF_VALUE) *values;
34   LHASH_OF(CONF_SECTION) *sections;
35 };
36 
37 // CONF_VALUE_new returns a freshly allocated and zeroed |CONF_VALUE|.
38 CONF_VALUE *CONF_VALUE_new(void);
39 
40 // CONF_parse_list takes a list separated by 'sep' and calls |list_cb| giving
41 // the start and length of each member, optionally stripping leading and
42 // trailing whitespace. This can be used to parse comma separated lists for
43 // example. If |list_cb| returns <= 0, then the iteration is halted and that
44 // value is returned immediately. Otherwise it returns one. Note that |list_cb|
45 // may be called on an empty member.
46 OPENSSL_EXPORT int CONF_parse_list(
47     const char *list, char sep, int remove_whitespace,
48     int (*list_cb)(const char *elem, size_t len, void *usr), void *arg);
49 
50 
51 #if defined(__cplusplus)
52 }  // extern C
53 #endif
54 
55 #endif  // OPENSSL_HEADER_CRYPTO_CONF_INTERNAL_H
56