]>
Commit | Line | Data |
---|---|---|
21dcbebc RS |
1 | /* |
2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. | |
d02b48c6 | 3 | * |
21dcbebc RS |
4 | * Licensed under the OpenSSL license (the "License"). You may not use |
5 | * this file except in compliance with the License. You can obtain a copy | |
6 | * in the file LICENSE in the source distribution or at | |
7 | * https://www.openssl.org/source/license.html | |
d02b48c6 RE |
8 | */ |
9 | ||
10 | #ifndef HEADER_TXT_DB_H | |
0f113f3e | 11 | # define HEADER_TXT_DB_H |
d02b48c6 | 12 | |
0f113f3e | 13 | # include <openssl/opensslconf.h> |
a00ae6c4 | 14 | # include <openssl/bio.h> |
0f113f3e MC |
15 | # include <openssl/stack.h> |
16 | # include <openssl/lhash.h> | |
d02b48c6 | 17 | |
0f113f3e MC |
18 | # define DB_ERROR_OK 0 |
19 | # define DB_ERROR_MALLOC 1 | |
20 | # define DB_ERROR_INDEX_CLASH 2 | |
21 | # define DB_ERROR_INDEX_OUT_OF_RANGE 3 | |
22 | # define DB_ERROR_NO_INDEX 4 | |
23 | # define DB_ERROR_INSERT_INDEX_CLASH 5 | |
51b04a61 | 24 | # define DB_ERROR_WRONG_NUM_FIELDS 6 |
d02b48c6 | 25 | |
82271cee RL |
26 | #ifdef __cplusplus |
27 | extern "C" { | |
28 | #endif | |
29 | ||
c869da88 | 30 | typedef OPENSSL_STRING *OPENSSL_PSTRING; |
85885715 | 31 | DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) |
5ce278a7 | 32 | |
0f113f3e MC |
33 | typedef struct txt_db_st { |
34 | int num_fields; | |
35 | STACK_OF(OPENSSL_PSTRING) *data; | |
36 | LHASH_OF(OPENSSL_STRING) **index; | |
37 | int (**qual) (OPENSSL_STRING *); | |
38 | long error; | |
39 | long arg1; | |
40 | long arg2; | |
41 | OPENSSL_STRING *arg_row; | |
42 | } TXT_DB; | |
d02b48c6 | 43 | |
d02b48c6 RE |
44 | TXT_DB *TXT_DB_read(BIO *in, int num); |
45 | long TXT_DB_write(BIO *out, TXT_DB *db); | |
0f113f3e MC |
46 | int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), |
47 | LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp); | |
d02b48c6 | 48 | void TXT_DB_free(TXT_DB *db); |
0f113f3e MC |
49 | OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, |
50 | OPENSSL_STRING *value); | |
c869da88 | 51 | int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); |
d02b48c6 | 52 | |
d02b48c6 RE |
53 | #ifdef __cplusplus |
54 | } | |
55 | #endif | |
56 | ||
57 | #endif |