esp_tls_error_capture_internal.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #ifndef __ESP_TLS_ERROR_CAPTURE_INTERNAL_H__
  14. #define __ESP_TLS_ERROR_CAPTURE_INTERNAL_H__
  15. /**
  16. * Note: this is an implementation placeholder for error logger.
  17. * This version is internal to esp-tls component and only saves single esp_err of last occurred error
  18. */
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. /**
  23. * Error tracker logging macro to enable mapping tracking errors internally
  24. * or using an external/global implementation
  25. */
  26. #define ESP_INT_EVENT_TRACKER_CAPTURE(h, type, code) esp_tls_internal_event_tracker_capture(h, type, code)
  27. /**
  28. * @brief Internal tracker capture error
  29. *
  30. * This implementation saves latest errors of available types
  31. *
  32. * @param[in] h esp-tls error handle
  33. * @param[in] err_type Specific error type
  34. * @param[int] code Error code to capture
  35. *
  36. */
  37. void esp_tls_internal_event_tracker_capture(esp_tls_error_handle_t h, uint32_t type, int code);
  38. /**
  39. * @brief Create internal tracker storage
  40. *
  41. * @return Error tracker handle if success or NULL if allocation error
  42. */
  43. esp_tls_error_handle_t esp_tls_internal_event_tracker_create(void);
  44. /**
  45. * @brief Destroy internal tracker storage
  46. *
  47. * @param[in] h esp-tls error handle
  48. */
  49. void esp_tls_internal_event_tracker_destroy(esp_tls_error_handle_t h);
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53. #endif //__ESP_TLS_ERROR_CAPTURE_INTERNAL_H__