13#ifndef ZEPHYR_INCLUDE_NET_HTTP_CLIENT_H_
14#define ZEPHYR_INCLUDE_NET_HTTP_CLIENT_H_
31#if !defined(HTTP_CRLF)
32#define HTTP_CRLF "\r\n"
35#if !defined(HTTP_STATUS_STR_SIZE)
36#define HTTP_STATUS_STR_SIZE 32
325 int32_t timeout,
void *user_data);
http_final_call
Definition: client.h:40
#define HTTP_STATUS_STR_SIZE
Definition: client.h:36
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:61
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:92
int http_client_req(int sock, struct http_request *req, int32_t timeout, void *user_data)
Do a HTTP request.
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:79
@ HTTP_DATA_MORE
Definition: client.h:41
@ HTTP_DATA_FINAL
Definition: client.h:42
http_method
HTTP Request Methods.
Definition: method.h:26
http_status
HTTP response status codes.
Definition: status.h:34
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:201
struct http_parser parser
HTTP parser context.
Definition: client.h:203
struct http_parser_settings parser_settings
HTTP parser settings.
Definition: client.h:206
void * user_data
User data.
Definition: client.h:214
int sock
HTTP socket.
Definition: client.h:217
struct http_response response
HTTP response specific data (filled by http_client_req() when data is received)
Definition: client.h:211
HTTP client request.
Definition: client.h:224
http_payload_cb_t payload_cb
User supplied callback function to call when payload needs to be sent.
Definition: client.h:279
const char * content_type_value
The value of the Content-Type header field, may be NULL.
Definition: client.h:265
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:262
const char * protocol
The HTTP protocol, for example "HTTP/1.1".
Definition: client.h:254
const char * host
Hostname to be used in the request.
Definition: client.h:268
size_t payload_len
Payload length is used to calculate Content-Length.
Definition: client.h:287
const char * url
The URL for this request, for example: /index.html.
Definition: client.h:251
size_t recv_buf_len
Length of the user supplied receive buffer.
Definition: client.h:248
const char ** optional_headers
A NULL terminated list of any optional headers that should be added to the HTTP request.
Definition: client.h:306
http_header_cb_t optional_headers_cb
User supplied callback function to call when optional headers need to be sent.
Definition: client.h:295
http_response_cb_t response
User supplied callback function to call when response is received.
Definition: client.h:236
uint8_t * recv_buf
User supplied buffer where received data is stored.
Definition: client.h:245
struct http_client_internal_data internal
HTTP client request internal data.
Definition: client.h:226
const char * port
Port number to be used in the request.
Definition: client.h:271
enum http_method method
The HTTP method: GET, HEAD, OPTIONS, POST, ...
Definition: client.h:231
const char * payload
Payload, may be NULL.
Definition: client.h:282
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:242
HTTP response from the server.
Definition: client.h:99
uint8_t cl_present
Definition: client.h:194
size_t processed
Amount of data given to the response callback so far, including the current data given to the callbac...
Definition: client.h:173
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:107
size_t data_len
Length of the data in the result buf.
Definition: client.h:161
uint8_t * body_frag_start
Start address of the body fragment contained in the recv_buf.
Definition: client.h:138
uint8_t message_complete
Definition: client.h:196
size_t body_frag_len
Length of the body fragment contained in the recv_buf.
Definition: client.h:141
size_t recv_buf_len
Response buffer maximum length.
Definition: client.h:149
uint16_t http_status_code
Numeric HTTP status code which corresponds to the textual description.
Definition: client.h:192
uint8_t * recv_buf
Where the response is stored, this is to be provided by the user.
Definition: client.h:146
uint8_t body_found
Definition: client.h:195
size_t content_length
HTTP Content-Length field value.
Definition: client.h:166
const struct http_parser_settings * http_cb
HTTP parser settings for the application usage.
Definition: client.h:101