]>
Commit | Line | Data |
---|---|---|
21dcbebc | 1 | /* |
1f5e0f92 | 2 | * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. |
d02b48c6 | 3 | * |
48f4ad77 | 4 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
21dcbebc RS |
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 | ||
ae4186b0 DMSP |
10 | #ifndef OPENSSL_TXT_DB_H |
11 | # define OPENSSL_TXT_DB_H | |
d86167ec DMSP |
12 | # pragma once |
13 | ||
14 | # include <openssl/macros.h> | |
936c2b9e | 15 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
d86167ec DMSP |
16 | # define HEADER_TXT_DB_H |
17 | # endif | |
d02b48c6 | 18 | |
0f113f3e | 19 | # include <openssl/opensslconf.h> |
a00ae6c4 | 20 | # include <openssl/bio.h> |
af3e5e1b | 21 | # include <openssl/safestack.h> |
0f113f3e | 22 | # include <openssl/lhash.h> |
d02b48c6 | 23 | |
0f113f3e MC |
24 | # define DB_ERROR_OK 0 |
25 | # define DB_ERROR_MALLOC 1 | |
26 | # define DB_ERROR_INDEX_CLASH 2 | |
27 | # define DB_ERROR_INDEX_OUT_OF_RANGE 3 | |
28 | # define DB_ERROR_NO_INDEX 4 | |
29 | # define DB_ERROR_INSERT_INDEX_CLASH 5 | |
51b04a61 | 30 | # define DB_ERROR_WRONG_NUM_FIELDS 6 |
d02b48c6 | 31 | |
82271cee RL |
32 | #ifdef __cplusplus |
33 | extern "C" { | |
34 | #endif | |
35 | ||
c869da88 | 36 | typedef OPENSSL_STRING *OPENSSL_PSTRING; |
85885715 | 37 | DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) |
5ce278a7 | 38 | |
0f113f3e MC |
39 | typedef struct txt_db_st { |
40 | int num_fields; | |
41 | STACK_OF(OPENSSL_PSTRING) *data; | |
42 | LHASH_OF(OPENSSL_STRING) **index; | |
43 | int (**qual) (OPENSSL_STRING *); | |
44 | long error; | |
45 | long arg1; | |
46 | long arg2; | |
47 | OPENSSL_STRING *arg_row; | |
48 | } TXT_DB; | |
d02b48c6 | 49 | |
d02b48c6 RE |
50 | TXT_DB *TXT_DB_read(BIO *in, int num); |
51 | long TXT_DB_write(BIO *out, TXT_DB *db); | |
0f113f3e | 52 | int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), |
739a1eb1 | 53 | OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp); |
d02b48c6 | 54 | void TXT_DB_free(TXT_DB *db); |
0f113f3e MC |
55 | OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, |
56 | OPENSSL_STRING *value); | |
c869da88 | 57 | int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); |
d02b48c6 | 58 | |
d02b48c6 RE |
59 | #ifdef __cplusplus |
60 | } | |
61 | #endif | |
62 | ||
63 | #endif |