lwIP
2.1.0
Lightweight IP stack
|
Macros | |
#define | LWIP_HTTPC_HAVE_FILE_IO 0 |
#define | HTTP_DEFAULT_PORT LWIP_IANA_PORT_HTTP |
Typedefs | |
typedef enum ehttpc_result | httpc_result_t |
typedef void(* | httpc_result_fn) (void *arg, httpc_result_t httpc_result, u32_t rx_content_len, u32_t srv_res, err_t err) |
typedef err_t(* | httpc_headers_done_fn) (httpc_state_t *connection, void *arg, struct pbuf *hdr, u16_t hdr_len, u32_t content_len) |
Enumerations | |
enum | ehttpc_result { HTTPC_RESULT_OK = 0, HTTPC_RESULT_ERR_UNKNOWN = 1, HTTPC_RESULT_ERR_CONNECT = 2, HTTPC_RESULT_ERR_HOSTNAME = 3, HTTPC_RESULT_ERR_CLOSED = 4, HTTPC_RESULT_ERR_TIMEOUT = 5, HTTPC_RESULT_ERR_SVR_RESP = 6, HTTPC_RESULT_ERR_MEM = 7, HTTPC_RESULT_LOCAL_ABORT = 8, HTTPC_RESULT_ERR_CONTENT_LEN = 9 } |
Functions | |
err_t | httpc_get_file (const ip_addr_t *server_addr, u16_t port, const char *uri, const httpc_connection_t *settings, altcp_recv_fn recv_fn, void *callback_arg, httpc_state_t **connection) |
err_t | httpc_get_file_dns (const char *server_name, u16_t port, const char *uri, const httpc_connection_t *settings, altcp_recv_fn recv_fn, void *callback_arg, httpc_state_t **connection) |
#define HTTP_DEFAULT_PORT LWIP_IANA_PORT_HTTP |
The default TCP port used for HTTP
#define LWIP_HTTPC_HAVE_FILE_IO 0 |
HTTPC_HAVE_FILE_IO: define this to 1 to have functions dowloading directly to disk via fopen/fwrite. These functions are example implementations of the interface only.
typedef err_t(* httpc_headers_done_fn) (httpc_state_t *connection, void *arg, struct pbuf *hdr, u16_t hdr_len, u32_t content_len) |
Prototype of http client callback: called when the headers are received
connection | http client connection |
arg | argument specified when initiating the request |
hdr | header pbuf(s) (may contain data also) |
hdr_len | length of the heders in 'hdr' |
content_len | content length as received in the headers (-1 if not received) |
typedef void(* httpc_result_fn) (void *arg, httpc_result_t httpc_result, u32_t rx_content_len, u32_t srv_res, err_t err) |
Prototype of a http client callback function
arg | argument specified when initiating the request |
httpc_result | result of the http transfer (see enum httpc_result_t) |
rx_content_len | number of bytes received (without headers) |
srv_res | this contains the http status code received (if any) |
err | an error returned by internal lwip functions, can help to specify the source of the error but must not necessarily be != ERR_OK |
typedef enum ehttpc_result httpc_result_t |
HTTP client result codes
enum ehttpc_result |
HTTP client result codes
err_t httpc_get_file | ( | const ip_addr_t * | server_addr, |
u16_t | port, | ||
const char * | uri, | ||
const httpc_connection_t * | settings, | ||
altcp_recv_fn | recv_fn, | ||
void * | callback_arg, | ||
httpc_state_t ** | connection | ||
) |
HTTP client API: get a file by passing server IP address
server_addr | IP address of the server to connect |
port | tcp port of the server |
uri | uri to get from the server, remember leading "/"! |
settings | connection settings (callbacks, proxy, etc.) |
recv_fn | the http body (not the headers) are passed to this callback |
callback_arg | argument passed to all the callbacks |
connection | retreives the connection handle (to match in callbacks) |
err_t httpc_get_file_dns | ( | const char * | server_name, |
u16_t | port, | ||
const char * | uri, | ||
const httpc_connection_t * | settings, | ||
altcp_recv_fn | recv_fn, | ||
void * | callback_arg, | ||
httpc_state_t ** | connection | ||
) |
HTTP client API: get a file by passing server name as string (DNS name or IP address string)
server_name | server name as string (DNS name or IP address string) |
port | tcp port of the server |
uri | uri to get from the server, remember leading "/"! |
settings | connection settings (callbacks, proxy, etc.) |
recv_fn | the http body (not the headers) are passed to this callback |
callback_arg | argument passed to all the callbacks |
connection | retreives the connection handle (to match in callbacks) |