David Benjamin | b25a899 | 2017-10-01 21:47:07 -0400 | [diff] [blame] | 1 | /* Copyright (c) 2017, Google Inc. |
| 2 | * |
| 3 | * Permission to use, copy, modify, and/or distribute this software for any |
| 4 | * purpose with or without fee is hereby granted, provided that the above |
| 5 | * copyright notice and this permission notice appear in all copies. |
| 6 | * |
| 7 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 8 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 9 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 10 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 11 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
| 12 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 13 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ |
| 14 | |
| 15 | #ifndef OPENSSL_HEADER_CRYPTO_ERR_INTERNAL_H |
| 16 | #define OPENSSL_HEADER_CRYPTO_ERR_INTERNAL_H |
| 17 | |
| 18 | #include <openssl/err.h> |
| 19 | |
| 20 | #if defined(__cplusplus) |
| 21 | extern "C" { |
| 22 | #endif |
| 23 | |
| 24 | |
| 25 | // Private error queue functions. |
| 26 | |
| 27 | // ERR_SAVE_STATE contains a saved representation of the error queue. It is |
| 28 | // slightly more compact than |ERR_STATE| as the error queue will typically not |
| 29 | // contain |ERR_NUM_ERRORS| entries. |
| 30 | typedef struct err_save_state_st ERR_SAVE_STATE; |
| 31 | |
| 32 | // ERR_SAVE_STATE_free releases all memory associated with |state|. |
| 33 | OPENSSL_EXPORT void ERR_SAVE_STATE_free(ERR_SAVE_STATE *state); |
| 34 | |
| 35 | // ERR_save_state returns a newly-allocated |ERR_SAVE_STATE| structure |
| 36 | // containing the current state of the error queue or NULL on allocation |
| 37 | // error. It should be released with |ERR_SAVE_STATE_free|. |
| 38 | OPENSSL_EXPORT ERR_SAVE_STATE *ERR_save_state(void); |
| 39 | |
| 40 | // ERR_restore_state clears the error queue and replaces it with |state|. |
| 41 | OPENSSL_EXPORT void ERR_restore_state(const ERR_SAVE_STATE *state); |
| 42 | |
| 43 | |
| 44 | #if defined(__cplusplus) |
| 45 | } // extern C |
| 46 | |
| 47 | extern "C++" { |
| 48 | |
Joshua Liebow-Feeser | 8c7c635 | 2018-08-26 18:53:36 -0700 | [diff] [blame] | 49 | BSSL_NAMESPACE_BEGIN |
David Benjamin | b25a899 | 2017-10-01 21:47:07 -0400 | [diff] [blame] | 50 | |
| 51 | BORINGSSL_MAKE_DELETER(ERR_SAVE_STATE, ERR_SAVE_STATE_free) |
| 52 | |
Joshua Liebow-Feeser | 8c7c635 | 2018-08-26 18:53:36 -0700 | [diff] [blame] | 53 | BSSL_NAMESPACE_END |
David Benjamin | b25a899 | 2017-10-01 21:47:07 -0400 | [diff] [blame] | 54 | |
| 55 | } // extern C++ |
| 56 | #endif |
| 57 | |
| 58 | #endif // OPENSSL_HEADER_CRYPTO_ERR_INTERNAL_H |