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
74 typedef 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
97 typedef struct _httpc_state httpc_state_t;
110 typedef void (*httpc_result_fn)(
void *arg, httpc_result_t httpc_result,
u32_t rx_content_len,
u32_t srv_res,
err_t err);
123 typedef err_t (*httpc_headers_done_fn)(httpc_state_t *connection,
void *arg,
struct pbuf *hdr,
u16_t hdr_len,
u32_t content_len);
125 typedef struct _httpc_connection {
132 altcp_allocator_t *altcp_allocator;
136 httpc_result_fn result_fn;
139 httpc_headers_done_fn headers_done_fn;
140 } httpc_connection_t;
142 err_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);
144 err_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
148 err_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);
150 err_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);
#define altcp_recv_fn
Definition: altcp.h:148
uint32_t u32_t
Definition: arch.h:129
uint8_t u8_t
Definition: arch.h:125
uint16_t u16_t
Definition: arch.h:127
s8_t err_t
Definition: err.h:96
ip6_addr_t ip_addr_t
Definition: ip_addr.h:318