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