1 // Copyright 2015 The BoringSSL Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
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