codekingpro/portable-devtools
114k
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 use5 * this file except in compliance with the License. You can obtain a copy6 * in the file LICENSE in the source distribution or at7 * https://www.openssl.org/source/license.html8 */9 10#ifndef OPENSSL_TXT_DB_H11# define OPENSSL_TXT_DB_H12# pragma once13 14# include <openssl/macros.h>15# ifndef OPENSSL_NO_DEPRECATED_3_016# define HEADER_TXT_DB_H17# endif18 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 025# define DB_ERROR_MALLOC 126# define DB_ERROR_INDEX_CLASH 227# define DB_ERROR_INDEX_OUT_OF_RANGE 328# define DB_ERROR_NO_INDEX 429# define DB_ERROR_INSERT_INDEX_CLASH 530# define DB_ERROR_WRONG_NUM_FIELDS 631 32#ifdef __cplusplus33extern "C" {34#endif35 36typedef OPENSSL_STRING *OPENSSL_PSTRING;37DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)38 39typedef 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 50TXT_DB *TXT_DB_read(BIO *in, int num);51long TXT_DB_write(BIO *out, TXT_DB *db);52int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),53 OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp);54void TXT_DB_free(TXT_DB *db);55OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx,56 OPENSSL_STRING *value);57int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value);58 59#ifdef __cplusplus60}61#endif62 63#endif64 