1 | /*
|
---|
2 | * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License 2.0 (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
|
---|
8 | */
|
---|
9 |
|
---|
10 | #ifndef OPENSSL_TXT_DB_H
|
---|
11 | # define OPENSSL_TXT_DB_H
|
---|
12 | # pragma once
|
---|
13 |
|
---|
14 | # include <openssl/macros.h>
|
---|
15 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
16 | # define HEADER_TXT_DB_H
|
---|
17 | # endif
|
---|
18 |
|
---|
19 | # include <openssl/opensslconf.h>
|
---|
20 | # include <openssl/bio.h>
|
---|
21 | # include <openssl/safestack.h>
|
---|
22 | # include <openssl/lhash.h>
|
---|
23 |
|
---|
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
|
---|
30 | # define DB_ERROR_WRONG_NUM_FIELDS 6
|
---|
31 |
|
---|
32 | #ifdef __cplusplus
|
---|
33 | extern "C" {
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | typedef OPENSSL_STRING *OPENSSL_PSTRING;
|
---|
37 | DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)
|
---|
38 |
|
---|
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;
|
---|
49 |
|
---|
50 | TXT_DB *TXT_DB_read(BIO *in, int num);
|
---|
51 | long TXT_DB_write(BIO *out, TXT_DB *db);
|
---|
52 | int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),
|
---|
53 | OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp);
|
---|
54 | void TXT_DB_free(TXT_DB *db);
|
---|
55 | OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx,
|
---|
56 | OPENSSL_STRING *value);
|
---|
57 | int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value);
|
---|
58 |
|
---|
59 | #ifdef __cplusplus
|
---|
60 | }
|
---|
61 | #endif
|
---|
62 |
|
---|
63 | #endif
|
---|