Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

lwip_http_client.c File Reference

lwip_http_client.c File Reference

HTTP client. More...

Go to the source code of this file.

Functions

static err_t httpc_free_state (httpc_state_t *req)
 Free http client state and deallocate all resources within.
static err_t httpc_close (httpc_state_t *req, httpc_result_t result, u32_t server_response, err_t err)
 Close the connection: call finished callback and free the state.
static err_t http_parse_response_status (struct pbuf *p, u16_t *http_version, u16_t *http_status, u16_t *http_status_str_offset)
 Parse http header response line 1.
static err_t http_wait_headers (struct pbuf *p, u32_t *content_length, u16_t *total_header_len)
 Wait for all headers to be received, return its length and content-length (if available)
static err_t httpc_tcp_recv (void *arg, struct altcp_pcb *pcb, struct pbuf *p, err_t r)
 http client tcp recv callback
static void httpc_tcp_err (void *arg, err_t err)
 http client tcp err callback
static err_t httpc_tcp_poll (void *arg, struct altcp_pcb *pcb)
 http client tcp poll callback
static err_t httpc_tcp_sent (void *arg, struct altcp_pcb *pcb, u16_t len)
 http client tcp sent callback
static err_t httpc_tcp_connected (void *arg, struct altcp_pcb *pcb, err_t err)
 http client tcp connected callback
static err_t httpc_get_internal_addr (httpc_state_t *req, const ip_addr_t *ipaddr)
 Start the http request when the server IP addr is known.
static void httpc_dns_found (const char *hostname, const ip_addr_t *ipaddr, void *arg)
 DNS callback If ipaddr is non-NULL, resolving succeeded and the request can be sent, otherwise it failed.
static err_t httpc_get_internal_dns (httpc_state_t *req, const char *server_name)
 Start the http request after converting 'server_name' to ip address (DNS or address string)
static err_t httpc_init_connection_common (httpc_state_t **connection, const httpc_connection_t *settings, const char *server_name, u16_t server_port, const char *uri, altcp_recv_fn recv_fn, void *callback_arg, int use_host)
 Initialize the connection struct.
static err_t httpc_init_connection (httpc_state_t **connection, const httpc_connection_t *settings, const char *server_name, u16_t server_port, const char *uri, altcp_recv_fn recv_fn, void *callback_arg)
 Initialize the connection struct.
static err_t httpc_init_connection_addr (httpc_state_t **connection, const httpc_connection_t *settings, const ip_addr_t *server_addr, u16_t server_port, const char *uri, altcp_recv_fn recv_fn, void *callback_arg)
 Initialize the connection struct (from IP address)
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.
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)
static void httpc_fs_result (void *arg, httpc_result_t httpc_result, u32_t rx_content_len, u32_t srv_res, err_t err)
 Connection closed (success or error)
static err_t httpc_fs_init (httpc_filestate_t **filestate_out, const char *local_file_name, const httpc_connection_t *settings, void *callback_arg)
 Initalize http client state for download to file system.
static void httpc_fs_free (httpc_filestate_t *filestate)
 Free http client state for download to file system.
static err_t httpc_fs_tcp_recv (void *arg, struct altcp_pcb *pcb, struct pbuf *p, err_t err)
 tcp recv callback
err_t httpc_get_file_to_disk (const ip_addr_t *server_addr, u16_t port, const char *uri, const httpc_connection_t *settings, void *callback_arg, const char *local_file_name, httpc_state_t **connection)
 HTTP client API: get a file to disk by passing server IP address.
err_t httpc_get_file_dns_to_disk (const char *server_name, u16_t port, const char *uri, const httpc_connection_t *settings, void *callback_arg, const char *local_file_name, httpc_state_t **connection)
 HTTP client API: get a file to disk by passing server name as string (DNS name or IP address string)

Detailed Description

HTTP client.

Definition in file lwip_http_client.c.


Function Documentation

static err_t http_parse_response_status ( struct pbuf p,
u16_t *  http_version,
u16_t *  http_status,
u16_t *  http_status_str_offset 
) [static]

Parse http header response line 1.

Definition at line 207 of file lwip_http_client.c.

static err_t http_wait_headers ( struct pbuf p,
u32_t *  content_length,
u16_t *  total_header_len 
) [static]

Wait for all headers to be received, return its length and content-length (if available)

Definition at line 248 of file lwip_http_client.c.

static err_t httpc_close ( httpc_state_t *  req,
httpc_result_t  result,
u32_t  server_response,
err_t  err 
) [static]

Close the connection: call finished callback and free the state.

Definition at line 192 of file lwip_http_client.c.

static void httpc_dns_found ( const char *  hostname,
const ip_addr_t ipaddr,
void *  arg 
) [static]

DNS callback If ipaddr is non-NULL, resolving succeeded and the request can be sent, otherwise it failed.

Definition at line 440 of file lwip_http_client.c.

static err_t httpc_free_state ( httpc_state_t *  req ) [static]

Free http client state and deallocate all resources within.

Definition at line 157 of file lwip_http_client.c.

static void httpc_fs_free ( httpc_filestate_t *  filestate ) [static]

Free http client state for download to file system.

Definition at line 760 of file lwip_http_client.c.

static err_t httpc_fs_init ( httpc_filestate_t **  filestate_out,
const char *  local_file_name,
const httpc_connection_t *  settings,
void *  callback_arg 
) [static]

Initalize http client state for download to file system.

Definition at line 723 of file lwip_http_client.c.

static void httpc_fs_result ( void *  arg,
httpc_result_t  httpc_result,
u32_t  rx_content_len,
u32_t  srv_res,
err_t  err 
) [static]

Connection closed (success or error)

Definition at line 773 of file lwip_http_client.c.

static err_t httpc_fs_tcp_recv ( void *  arg,
struct altcp_pcb *  pcb,
struct pbuf p,
err_t  err 
) [static]

tcp recv callback

Definition at line 788 of file lwip_http_client.c.

static err_t httpc_get_internal_addr ( httpc_state_t *  req,
const ip_addr_t ipaddr 
) [static]

Start the http request when the server IP addr is known.

Definition at line 417 of file lwip_http_client.c.

static err_t httpc_get_internal_dns ( httpc_state_t *  req,
const char *  server_name 
) [static]

Start the http request after converting 'server_name' to ip address (DNS or address string)

Definition at line 466 of file lwip_http_client.c.

static err_t httpc_init_connection ( httpc_state_t **  connection,
const httpc_connection_t *  settings,
const char *  server_name,
u16_t  server_port,
const char *  uri,
altcp_recv_fn  recv_fn,
void *  callback_arg 
) [static]

Initialize the connection struct.

Definition at line 594 of file lwip_http_client.c.

static err_t httpc_init_connection_addr ( httpc_state_t **  connection,
const httpc_connection_t *  settings,
const ip_addr_t server_addr,
u16_t  server_port,
const char *  uri,
altcp_recv_fn  recv_fn,
void *  callback_arg 
) [static]

Initialize the connection struct (from IP address)

Definition at line 605 of file lwip_http_client.c.

static err_t httpc_init_connection_common ( httpc_state_t **  connection,
const httpc_connection_t *  settings,
const char *  server_name,
u16_t  server_port,
const char *  uri,
altcp_recv_fn  recv_fn,
void *  callback_arg,
int  use_host 
) [static]

Initialize the connection struct.

Definition at line 507 of file lwip_http_client.c.

static err_t httpc_tcp_connected ( void *  arg,
struct altcp_pcb *  pcb,
err_t  err 
) [static]

http client tcp connected callback

Definition at line 394 of file lwip_http_client.c.

static void httpc_tcp_err ( void *  arg,
err_t  err 
) [static]

http client tcp err callback

Definition at line 353 of file lwip_http_client.c.

static err_t httpc_tcp_poll ( void *  arg,
struct altcp_pcb *  pcb 
) [static]

http client tcp poll callback

Definition at line 365 of file lwip_http_client.c.

static err_t httpc_tcp_recv ( void *  arg,
struct altcp_pcb *  pcb,
struct pbuf p,
err_t  r 
) [static]

http client tcp recv callback

Definition at line 280 of file lwip_http_client.c.

static err_t httpc_tcp_sent ( void *  arg,
struct altcp_pcb *  pcb,
u16_t  len 
) [static]

http client tcp sent callback

Definition at line 383 of file lwip_http_client.c.