transport_ssl.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2015-2018 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 _TRANSPORT_SSL_H_
  14. #define _TRANSPORT_SSL_H_
  15. #include "transport.h"
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /**
  20. * @brief Create new SSL transport, the transport handle must be release transport_destroy callback
  21. *
  22. * @return the allocated transport_handle_t, or NULL if the handle can not be allocated
  23. */
  24. transport_handle_t transport_ssl_init();
  25. /**
  26. * @brief Set SSL certificate data (as PEM format).
  27. * Note that, this function stores the pointer to data, rather than making a copy.
  28. * So we need to make sure to keep the data lifetime before cleanup the connection
  29. *
  30. * @param t ssl transport
  31. * @param[in] data The pem data
  32. * @param[in] len The length
  33. */
  34. void transport_ssl_set_cert_data(transport_handle_t t, const char *data, int len);
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif