http_tls.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef __HTTP_TLS_H__
  2. #define __HTTP_TLS_H__
  3. #if defined(CONFIG_USING_TLS)
  4. #include <transport/tls.h>
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. /**
  9. * @brief Create a new blocking TLS/SSL connection with a given "HTTP" url
  10. *
  11. * The behaviour is same as tls_conn_new() API. However this API accepts host's url.
  12. *
  13. * @param[in] url url of host.
  14. * @param[in] cfg TLS configuration as tls_cfg_t. If you wish to open
  15. * non-TLS connection, keep this NULL. For TLS connection,
  16. * a pass pointer to 'tls_cfg_t'. At a minimum, this
  17. * structure should be zero-initialized.
  18. * @return pointer to tls_t, or NULL if connection couldn't be opened.
  19. */
  20. tls_t *tls_conn_http_new(const char *url, const tls_cfg_t *cfg);
  21. /**
  22. * @brief Create a new non-blocking TLS/SSL connection with a given "HTTP" url
  23. *
  24. * The behaviour is same as tls_conn_new() API. However this API accepts host's url.
  25. *
  26. * @param[in] url url of host.
  27. * @param[in] cfg TLS configuration as tls_cfg_t.
  28. * @param[in] tls pointer to tls as tls handle.
  29. *
  30. * @return
  31. * - -1 If connection establishment fails.
  32. * - 0 If connection establishment is in progress.
  33. * - 1 If connection establishment is successful.
  34. */
  35. int tls_conn_http_new_async(const char *url, const tls_cfg_t *cfg, tls_t *tls);
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #endif
  40. #endif