Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
|
HTTP client API . More...
Data Structures | |
struct | http_response |
HTTP response from the server. More... | |
struct | http_client_internal_data |
HTTP client internal data that the application should not touch. More... | |
struct | http_request |
HTTP client request. More... | |
Typedefs | |
typedef int(* | http_payload_cb_t) (int sock, struct http_request *req, void *user_data) |
Callback used when data needs to be sent to the server. | |
typedef int(* | http_header_cb_t) (int sock, struct http_request *req, void *user_data) |
Callback can be used if application wants to construct additional HTTP headers when the HTTP request is sent. | |
typedef void(* | http_response_cb_t) (struct http_response *rsp, enum http_final_call final_data, void *user_data) |
Callback used when data is received from the server. | |
Enumerations | |
enum | http_final_call { HTTP_DATA_MORE = 0 , HTTP_DATA_FINAL = 1 } |
Is there more data to come. More... | |
Functions | |
int | http_client_req (int sock, struct http_request *req, int32_t timeout, void *user_data) |
Do a HTTP request. | |
HTTP client API .
typedef int(* http_header_cb_t) (int sock, struct http_request *req, void *user_data) |
#include <zephyr/net/http/client.h>
Callback can be used if application wants to construct additional HTTP headers when the HTTP request is sent.
Usage of this is optional.
sock | Socket id of the connection |
req | HTTP request information |
user_data | User specified data specified in http_client_req() |
typedef int(* http_payload_cb_t) (int sock, struct http_request *req, void *user_data) |
#include <zephyr/net/http/client.h>
Callback used when data needs to be sent to the server.
sock | Socket id of the connection |
req | HTTP request information |
user_data | User specified data specified in http_client_req() |
typedef void(* http_response_cb_t) (struct http_response *rsp, enum http_final_call final_data, void *user_data) |
#include <zephyr/net/http/client.h>
Callback used when data is received from the server.
rsp | HTTP response information |
final_data | Does this data buffer contain all the data or is there still more data to come. |
user_data | User specified data specified in http_client_req() |
enum http_final_call |
#include <zephyr/net/http/client.h>
Is there more data to come.
Enumerator | |
---|---|
HTTP_DATA_MORE | More data will come. |
HTTP_DATA_FINAL | End of data. |
int http_client_req | ( | int | sock, |
struct http_request * | req, | ||
int32_t | timeout, | ||
void * | user_data ) |
#include <zephyr/net/http/client.h>
Do a HTTP request.
The callback is called when data is received from the HTTP server. The caller must have created a connection to the server before calling this function so connect() call must have be done successfully for the socket.
sock | Socket id of the connection. |
req | HTTP request information |
timeout | Max timeout to wait for the data. The timeout value cannot be 0 as there would be no time to receive the data. The timeout value is in milliseconds. |
user_data | User specified data that is passed to the callback. |