38#ifndef LWIP_HDR_APPS_HTTP_CLIENT_H
39#define LWIP_HDR_APPS_HTTP_CLIENT_H
48#if LWIP_TCP && LWIP_CALLBACK_API
60#ifndef LWIP_HTTPC_HAVE_FILE_IO
61#define LWIP_HTTPC_HAVE_FILE_IO 0
68#define HTTP_DEFAULT_PORT LWIP_IANA_PORT_HTTP
74typedef enum ehttpc_result {
78 HTTPC_RESULT_ERR_UNKNOWN = 1,
80 HTTPC_RESULT_ERR_CONNECT = 2,
82 HTTPC_RESULT_ERR_HOSTNAME = 3,
84 HTTPC_RESULT_ERR_CLOSED = 4,
86 HTTPC_RESULT_ERR_TIMEOUT = 5,
88 HTTPC_RESULT_ERR_SVR_RESP = 6,
90 HTTPC_RESULT_ERR_MEM = 7,
92 HTTPC_RESULT_LOCAL_ABORT = 8,
94 HTTPC_RESULT_ERR_CONTENT_LEN = 9
97typedef struct _httpc_state httpc_state_t;
110typedef void (*httpc_result_fn)(
void *arg, httpc_result_t httpc_result, u32_t rx_content_len, u32_t srv_res,
err_t err);
123typedef err_t (*httpc_headers_done_fn)(httpc_state_t *connection,
void *arg,
struct pbuf *hdr, u16_t hdr_len, u32_t content_len);
125typedef struct _httpc_connection {
126 ip_addr_t proxy_addr;
132 altcp_allocator_t *altcp_allocator;
136 httpc_result_fn result_fn;
139 httpc_headers_done_fn headers_done_fn;
142err_t httpc_get_file(
const ip_addr_t* server_addr, u16_t port,
const char* uri,
const httpc_connection_t *settings,
143 altcp_recv_fn recv_fn,
void* callback_arg, httpc_state_t **connection);
144err_t httpc_get_file_dns(
const char* server_name, u16_t port,
const char* uri,
const httpc_connection_t *settings,
145 altcp_recv_fn recv_fn,
void* callback_arg, httpc_state_t **connection);
147#if LWIP_HTTPC_HAVE_FILE_IO
148err_t httpc_get_file_to_disk(
const ip_addr_t* server_addr, u16_t port,
const char* uri,
const httpc_connection_t *settings,
149 void* callback_arg,
const char* local_file_name, httpc_state_t **connection);
150err_t httpc_get_file_dns_to_disk(
const char* server_name, u16_t port,
const char* uri,
const httpc_connection_t *settings,
151 void* callback_arg,
const char* local_file_name, httpc_state_t **connection);
s8_t err_t
Definition: err.h:96
OPERATE_RET httpc_get_file(IN CONST CHAR_T *url, IN CONST UINT_T mlk_buf_len, IN CONST HTTP_GW_GET_FILE_DATA_CB gfd_cb, IN PVOID_T priv_data, IN CONST UINT_T total_len, IN CONST UINT_T offset, IN CONST BYTE_T *p_key, IN CONST UINT_T key_len, INOUT BYTE_T file_hmac[32])
Download file