stack.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright 1995-2021 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_STACK_H
  10. # define OPENSSL_STACK_H
  11. # pragma once
  12. # include <openssl/macros.h>
  13. # ifndef OPENSSL_NO_DEPRECATED_3_0
  14. # define HEADER_STACK_H
  15. # endif
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. typedef struct stack_st OPENSSL_STACK; /* Use STACK_OF(...) instead */
  20. typedef int (*OPENSSL_sk_compfunc)(const void *, const void *);
  21. typedef void (*OPENSSL_sk_freefunc)(void *);
  22. typedef void *(*OPENSSL_sk_copyfunc)(const void *);
  23. int OPENSSL_sk_num(const OPENSSL_STACK *);
  24. void *OPENSSL_sk_value(const OPENSSL_STACK *, int);
  25. void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data);
  26. OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc cmp);
  27. OPENSSL_STACK *OPENSSL_sk_new_null(void);
  28. OPENSSL_STACK *OPENSSL_sk_new_reserve(OPENSSL_sk_compfunc c, int n);
  29. int OPENSSL_sk_reserve(OPENSSL_STACK *st, int n);
  30. void OPENSSL_sk_free(OPENSSL_STACK *);
  31. void OPENSSL_sk_pop_free(OPENSSL_STACK *st, void (*func) (void *));
  32. OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *,
  33. OPENSSL_sk_copyfunc c,
  34. OPENSSL_sk_freefunc f);
  35. int OPENSSL_sk_insert(OPENSSL_STACK *sk, const void *data, int where);
  36. void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc);
  37. void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p);
  38. int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data);
  39. int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data);
  40. int OPENSSL_sk_find_all(OPENSSL_STACK *st, const void *data, int *pnum);
  41. int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data);
  42. int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data);
  43. void *OPENSSL_sk_shift(OPENSSL_STACK *st);
  44. void *OPENSSL_sk_pop(OPENSSL_STACK *st);
  45. void OPENSSL_sk_zero(OPENSSL_STACK *st);
  46. OPENSSL_sk_compfunc OPENSSL_sk_set_cmp_func(OPENSSL_STACK *sk,
  47. OPENSSL_sk_compfunc cmp);
  48. OPENSSL_STACK *OPENSSL_sk_dup(const OPENSSL_STACK *st);
  49. void OPENSSL_sk_sort(OPENSSL_STACK *st);
  50. int OPENSSL_sk_is_sorted(const OPENSSL_STACK *st);
  51. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  52. # define _STACK OPENSSL_STACK
  53. # define sk_num OPENSSL_sk_num
  54. # define sk_value OPENSSL_sk_value
  55. # define sk_set OPENSSL_sk_set
  56. # define sk_new OPENSSL_sk_new
  57. # define sk_new_null OPENSSL_sk_new_null
  58. # define sk_free OPENSSL_sk_free
  59. # define sk_pop_free OPENSSL_sk_pop_free
  60. # define sk_deep_copy OPENSSL_sk_deep_copy
  61. # define sk_insert OPENSSL_sk_insert
  62. # define sk_delete OPENSSL_sk_delete
  63. # define sk_delete_ptr OPENSSL_sk_delete_ptr
  64. # define sk_find OPENSSL_sk_find
  65. # define sk_find_ex OPENSSL_sk_find_ex
  66. # define sk_push OPENSSL_sk_push
  67. # define sk_unshift OPENSSL_sk_unshift
  68. # define sk_shift OPENSSL_sk_shift
  69. # define sk_pop OPENSSL_sk_pop
  70. # define sk_zero OPENSSL_sk_zero
  71. # define sk_set_cmp_func OPENSSL_sk_set_cmp_func
  72. # define sk_dup OPENSSL_sk_dup
  73. # define sk_sort OPENSSL_sk_sort
  74. # define sk_is_sorted OPENSSL_sk_is_sorted
  75. # endif
  76. #ifdef __cplusplus
  77. }
  78. #endif
  79. #endif