txt_db.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* txt_db.h
  2. *
  3. * Copyright (C) 2006-2022 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 2 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. #ifndef WOLFSSL_TXT_DB_H_
  22. #define WOLFSSL_TXT_DB_H_
  23. #include <wolfssl/openssl/ssl.h>
  24. #define WOLFSSL_TXT_DB_MAX_FIELDS 10
  25. struct WOLFSSL_TXT_DB {
  26. int num_fields;
  27. WOLF_STACK_OF(WOLFSSL_STRING) *data;
  28. long error;
  29. long arg1;
  30. long arg2;
  31. wolf_sk_compare_cb comp[WOLFSSL_TXT_DB_MAX_FIELDS];
  32. wolf_sk_hash_cb hash_fn[WOLFSSL_TXT_DB_MAX_FIELDS];
  33. };
  34. typedef struct WOLFSSL_TXT_DB WOLFSSL_TXT_DB;
  35. WOLFSSL_API WOLFSSL_TXT_DB *wolfSSL_TXT_DB_read(WOLFSSL_BIO *in, int num);
  36. WOLFSSL_API long wolfSSL_TXT_DB_write(WOLFSSL_BIO *out, WOLFSSL_TXT_DB *db);
  37. WOLFSSL_API int wolfSSL_TXT_DB_insert(WOLFSSL_TXT_DB *db, WOLFSSL_STRING *row);
  38. WOLFSSL_API void wolfSSL_TXT_DB_free(WOLFSSL_TXT_DB *db);
  39. WOLFSSL_API int wolfSSL_TXT_DB_create_index(WOLFSSL_TXT_DB *db, int field,
  40. void* qual, wolf_sk_hash_cb hash, wolf_sk_compare_cb cmp);
  41. WOLFSSL_API WOLFSSL_STRING *wolfSSL_TXT_DB_get_by_index(WOLFSSL_TXT_DB *db,
  42. int idx, WOLFSSL_STRING *value);
  43. #define TXT_DB WOLFSSL_TXT_DB
  44. #define TXT_DB_read wolfSSL_TXT_DB_read
  45. #define TXT_DB_write wolfSSL_TXT_DB_write
  46. #define TXT_DB_insert wolfSSL_TXT_DB_insert
  47. #define TXT_DB_free wolfSSL_TXT_DB_free
  48. #define TXT_DB_create_index wolfSSL_TXT_DB_create_index
  49. #define TXT_DB_get_by_index wolfSSL_TXT_DB_get_by_index
  50. #endif /* WOLFSSL_TXT_DB_H_ */