connect_utils.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright 2024 NXP
  3. * NXP Proprietary. This software is owned or controlled by NXP and may only be used strictly in
  4. * accordance with the applicable license terms. By expressly accepting such terms or by downloading, installing,
  5. * activating and/or otherwise using the software, you are agreeing that you have read, and that you agree to
  6. * comply with and are bound by, such license terms. If you do not agree to be bound by the applicable license
  7. * terms, then you may not retain, install, activate or otherwise use the software.
  8. */
  9. #ifndef CONNECT_UTILS_H
  10. #define CONNECT_UTILS_H
  11. #include <curl/curl.h>
  12. /*
  13. * @param {char*} ws_url: websocket link eg: ws://127.0.0.1:41000.
  14. * @returns {CURL* } the pointer of the curl connection.
  15. */
  16. CURL * websocket_connect(const char *ws_url);
  17. /*
  18. * @param {CURL *} ws_curl: the pointer of the curl connection.
  19. * @param {char *} parm: the request data with json string.
  20. * @returns {char *} the websocket response data with json string.
  21. */
  22. char *websocket_request(CURL *ws_curl, char *parm);
  23. /*
  24. * for close the websocket connection.
  25. * @param {CURL *} ws_curl: the pointer of the curl connection.
  26. */
  27. void websocket_close(CURL *ws_curl);
  28. /*
  29. * for http request function.
  30. * @param {const char *} url: http link eg: http://127.0.0.1:41000.
  31. * @param {const char *} parm: http post request parameters.
  32. */
  33. char *http_request(const char *url, const char *parm);
  34. #endif