13#ifndef ZEPHYR_INCLUDE_NET_HTTP_CLIENT_H_
14#define ZEPHYR_INCLUDE_NET_HTTP_CLIENT_H_
35#if !defined(HTTP_CRLF)
36#define HTTP_CRLF "\r\n"
39#if !defined(HTTP_STATUS_STR_SIZE)
40#define HTTP_STATUS_STR_SIZE 32
331 int32_t timeout,
void *user_data);
http_final_call
Is there more data to come.
Definition client.h:46
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 ...
Definition client.h:85
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.
Definition client.h:98
int http_client_req(int sock, struct http_request *req, int32_t timeout, void *user_data)
Do a HTTP request.
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.
Definition client.h:67
@ HTTP_DATA_MORE
More data will come.
Definition client.h:47
@ HTTP_DATA_FINAL
End of data.
Definition client.h:48
http_method
HTTP Request Methods.
Definition method.h:28
http_status
HTTP response status codes.
Definition status.h:36
IPv6 and IPv4 definitions.
__INT32_TYPE__ int32_t
Definition stdint.h:74
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
HTTP client internal data that the application should not touch.
Definition client.h:207
struct http_parser parser
HTTP parser context.
Definition client.h:209
struct http_parser_settings parser_settings
HTTP parser settings.
Definition client.h:212
void * user_data
User data.
Definition client.h:220
int sock
HTTP socket.
Definition client.h:223
struct http_response response
HTTP response specific data (filled by http_client_req() when data is received)
Definition client.h:217
HTTP client request.
Definition client.h:230
http_payload_cb_t payload_cb
User supplied callback function to call when payload needs to be sent.
Definition client.h:285
const char * content_type_value
The value of the Content-Type header field, may be NULL.
Definition client.h:271
const char ** header_fields
The HTTP header fields (application specific) The Content-Type may be specified here or in the next f...
Definition client.h:268
const char * protocol
The HTTP protocol, for example "HTTP/1.1".
Definition client.h:260
const char * host
Hostname to be used in the request.
Definition client.h:274
size_t payload_len
Payload length is used to calculate Content-Length.
Definition client.h:293
const char * url
The URL for this request, for example: /index.html.
Definition client.h:257
size_t recv_buf_len
Length of the user supplied receive buffer.
Definition client.h:254
const char ** optional_headers
A NULL terminated list of any optional headers that should be added to the HTTP request.
Definition client.h:312
http_header_cb_t optional_headers_cb
User supplied callback function to call when optional headers need to be sent.
Definition client.h:301
http_response_cb_t response
User supplied callback function to call when response is received.
Definition client.h:242
uint8_t * recv_buf
User supplied buffer where received data is stored.
Definition client.h:251
struct http_client_internal_data internal
HTTP client request internal data.
Definition client.h:232
const char * port
Port number to be used in the request.
Definition client.h:277
enum http_method method
The HTTP method: GET, HEAD, OPTIONS, POST, ...
Definition client.h:237
const char * payload
Payload, may be NULL.
Definition client.h:288
const struct http_parser_settings * http_cb
User supplied list of HTTP callback functions if the calling application wants to know the parsing st...
Definition client.h:248
HTTP response from the server.
Definition client.h:105
uint8_t cl_present
Is Content-Length field present.
Definition client.h:200
size_t processed
Amount of data given to the response callback so far, including the current data given to the callbac...
Definition client.h:179
http_response_cb_t cb
User provided HTTP response callback which is called when a response is received to a sent HTTP reque...
Definition client.h:113
size_t data_len
Length of the data in the result buf.
Definition client.h:167
uint8_t * body_frag_start
Start address of the body fragment contained in the recv_buf.
Definition client.h:144
uint8_t message_complete
Is HTTP message parsing complete.
Definition client.h:202
size_t body_frag_len
Length of the body fragment contained in the recv_buf.
Definition client.h:147
size_t recv_buf_len
Response buffer maximum length.
Definition client.h:155
uint16_t http_status_code
Numeric HTTP status code which corresponds to the textual description.
Definition client.h:198
uint8_t * recv_buf
Where the response is stored, this is to be provided by the user.
Definition client.h:152
uint8_t body_found
Is message body found.
Definition client.h:201
size_t content_length
HTTP Content-Length field value.
Definition client.h:172
const struct http_parser_settings * http_cb
HTTP parser settings for the application usage.
Definition client.h:107