stack.h 3.0 KB

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