You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

txt_db.h 1.7 kB

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