Rtos API example

Embed: (wiki syntax)

« Back to documentation index

lwip_httpd.c File Reference

lwip_httpd.c File Reference

LWIP HTTP server implementation. More...

Go to the source code of this file.

Functions

static struct http_ssi_state * http_ssi_state_alloc (void)
 Allocate as struct http_ssi_state.
static void http_ssi_state_free (struct http_ssi_state *ssi)
 Free a struct http_ssi_state.
static void http_state_init (struct http_state *hs)
 Initialize a struct http_state.
static struct http_state * http_state_alloc (void)
 Allocate a struct http_state.
static void http_state_eof (struct http_state *hs)
 Free a struct http_state.
static void http_state_free (struct http_state *hs)
 Free a struct http_state.
static err_t http_write (struct tcp_pcb *pcb, const void *ptr, u16_t *length, u8_t apiflags)
 Call tcp_write() in a loop trying smaller and smaller length.
static err_t http_close_or_abort_conn (struct tcp_pcb *pcb, struct http_state *hs, u8_t abort_conn)
 The connection shall be actively closed (using RST to close from fault states).
static err_t http_close_conn (struct tcp_pcb *pcb, struct http_state *hs)
 The connection shall be actively closed.
static void http_eof (struct tcp_pcb *pcb, struct http_state *hs)
 End of file: either close the connection (Connection: close) or close the file (Connection: keep-alive)
static int extract_uri_parameters (struct http_state *hs, char *params)
 Extract URI parameters from the parameter-part of an URI in the form "test.cgi?x=y".
static void get_tag_insert (struct http_state *hs)
 Insert a tag (found in an shtml in the form of "<!--#tagname-->" into the file.

Variables

static char httpd_req_buf [LWIP_HTTPD_MAX_REQ_LENGTH+1]
 HTTP request is copied here from pbufs for simple parsing.

Detailed Description

LWIP HTTP server implementation.

Definition in file lwip_httpd.c.


Function Documentation

static int extract_uri_parameters ( struct http_state *  hs,
char *  params 
) [static]

Extract URI parameters from the parameter-part of an URI in the form "test.cgi?x=y".

Parameters:
hshttp connection state
paramspointer to the NULL-terminated parameter string from the URI
Returns:
number of parameters extracted

Definition at line 674 of file lwip_httpd.c.

static err_t http_close_conn ( struct tcp_pcb pcb,
struct http_state *  hs 
) [static]

The connection shall be actively closed.

Reset the sent- and recv-callbacks.

Parameters:
pcbthe tcp pcb to reset callbacks
hsconnection state to free

Definition at line 632 of file lwip_httpd.c.

static err_t http_close_or_abort_conn ( struct tcp_pcb pcb,
struct http_state *  hs,
u8_t  abort_conn 
) [static]

The connection shall be actively closed (using RST to close from fault states).

Reset the sent- and recv-callbacks.

Parameters:
pcbthe tcp pcb to reset callbacks
hsconnection state to free

Definition at line 582 of file lwip_httpd.c.

static void http_eof ( struct tcp_pcb pcb,
struct http_state *  hs 
) [static]

End of file: either close the connection (Connection: close) or close the file (Connection: keep-alive)

Definition at line 641 of file lwip_httpd.c.

static struct http_ssi_state* http_ssi_state_alloc ( void   ) [static, read]

Allocate as struct http_ssi_state.

Definition at line 404 of file lwip_httpd.c.

static void http_ssi_state_free ( struct http_ssi_state *  ssi ) [static]

Free a struct http_ssi_state.

Definition at line 421 of file lwip_httpd.c.

static struct http_state* http_state_alloc ( void   ) [static, read]

Allocate a struct http_state.

Definition at line 444 of file lwip_httpd.c.

static void http_state_eof ( struct http_state *  hs ) [static]

Free a struct http_state.

Also frees the file data if dynamic.

Definition at line 464 of file lwip_httpd.c.

static void http_state_free ( struct http_state *  hs ) [static]

Free a struct http_state.

Also frees the file data if dynamic.

Definition at line 500 of file lwip_httpd.c.

static void http_state_init ( struct http_state *  hs ) [static]

Initialize a struct http_state.

Definition at line 432 of file lwip_httpd.c.

static err_t http_write ( struct tcp_pcb pcb,
const void *  ptr,
u16_t *  length,
u8_t  apiflags 
) [static]

Call tcp_write() in a loop trying smaller and smaller length.

Parameters:
pcbtcp_pcb to send
ptrData to send
lengthLength of data to send (in/out: on return, contains the amount of data sent)
apiflagsdirectly passed to tcp_write
Returns:
the return value of tcp_write

Definition at line 519 of file lwip_httpd.c.


Variable Documentation

char httpd_req_buf[LWIP_HTTPD_MAX_REQ_LENGTH+1] [static]

HTTP request is copied here from pbufs for simple parsing.

Definition at line 162 of file lwip_httpd.c.