txt_db.h (2230B)
1 /* txt_db.h 2 * 3 * Copyright (C) 2006-2025 wolfSSL Inc. 4 * 5 * This file is part of wolfSSL. 6 * 7 * wolfSSL is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * wolfSSL is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA 20 */ 21 22 #ifndef WOLFSSL_TXT_DB_H_ 23 #define WOLFSSL_TXT_DB_H_ 24 25 #include <wolfssl/openssl/ssl.h> 26 27 #define WOLFSSL_TXT_DB_MAX_FIELDS 10 28 29 struct WOLFSSL_TXT_DB { 30 int num_fields; 31 WOLF_STACK_OF(WOLFSSL_STRING) *data; 32 long error; 33 long arg1; 34 long arg2; 35 wolf_sk_hash_cb hash_fn[WOLFSSL_TXT_DB_MAX_FIELDS]; 36 }; 37 38 typedef struct WOLFSSL_TXT_DB WOLFSSL_TXT_DB; 39 typedef int (*wolf_lh_compare_cb)(const void* a, 40 const void* b); 41 42 WOLFSSL_API WOLFSSL_TXT_DB *wolfSSL_TXT_DB_read(WOLFSSL_BIO *in, int num); 43 WOLFSSL_API long wolfSSL_TXT_DB_write(WOLFSSL_BIO *out, WOLFSSL_TXT_DB *db); 44 WOLFSSL_API int wolfSSL_TXT_DB_insert(WOLFSSL_TXT_DB *db, WOLFSSL_STRING *row); 45 WOLFSSL_API void wolfSSL_TXT_DB_free(WOLFSSL_TXT_DB *db); 46 WOLFSSL_API int wolfSSL_TXT_DB_create_index(WOLFSSL_TXT_DB *db, int field, 47 void* qual, wolf_sk_hash_cb hash, wolf_lh_compare_cb cmp); 48 WOLFSSL_API WOLFSSL_STRING *wolfSSL_TXT_DB_get_by_index(WOLFSSL_TXT_DB *db, 49 int idx, WOLFSSL_STRING *value); 50 51 #define TXT_DB WOLFSSL_TXT_DB 52 53 #define TXT_DB_read wolfSSL_TXT_DB_read 54 #define TXT_DB_write wolfSSL_TXT_DB_write 55 #define TXT_DB_insert wolfSSL_TXT_DB_insert 56 #define TXT_DB_free wolfSSL_TXT_DB_free 57 #define TXT_DB_create_index wolfSSL_TXT_DB_create_index 58 #define TXT_DB_get_by_index wolfSSL_TXT_DB_get_by_index 59 60 #endif /* WOLFSSL_TXT_DB_H_ */