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