Httpd server.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
Data Structures | |
struct | BoardStatus |
Typedefs | |
typedef struct BoardStatus | BoardStatus |
typedef int(* | http_handler_t )(const char *name, char *revc_buf, size_t revc_len) |
Enumerations | |
enum | { HTTP_CONTENT_JSON = 0, HTTP_CONTENT_HTML, HTTP_CONTENT_CSS, HTTP_CONTENT_JS, HTTP_CONTENT_PNG, HTTP_CONTENT_JPEG, HTTP_CONTENT_GIF, HTTP_CONTENT_PLAIN, HTTP_CONTENT_CNT } |
HTTP content type enum. More... | |
Functions | |
const char * | get_ext (const char *name) |
Get filename extension type. More... | |
int | http_getValue (char *tolenized_buf, size_t tolenized_buf_len, const char *key, char *value, size_t len) |
Get key value from tokenized buffer. More... | |
void | http_init (void) |
HTTP server init. More... | |
void | http_sendInternalErr (int content_type) |
Send HTTP internal server error code. More... | |
void | http_sendOk (int content_type) |
Send the HTTP header with the appropriated content type. More... | |
int | http_tokenizeGetRequest (char *raw_buf, size_t raw_len) |
Tokenize a buffer. More... | |
void | http_write (const char *buf, u32_t len) |
Write HTTP data. More... | |
Variables | |
struct tcp_pcb * | g_pcb |
BoardStatus | status |
board status info More... | |
typedef struct BoardStatus BoardStatus |
typedef int(* http_handler_t)(const char *name, char *revc_buf, size_t revc_len) |
anonymous enum |
const char* get_ext | ( | const char * | name | ) |
Get filename extension type.
name | String containing a filename. |
References NULL.
Referenced by cgi_search(), and http_searchContentType().
int http_getValue | ( | char * | tolenized_buf, |
size_t | tolenized_buf_len, | ||
const char * | key, | ||
char * | value, | ||
size_t | len | ||
) |
Get key value from tokenized buffer.
tolenized_buf | . |
tolenized_buf_len | . |
key | . |
value | |
len | . |
References decoded_str, and http_decodeUrl().
Referenced by cgi_displayMsg(), and cgi_led().
HTTP server init.
References http_accept(), IP_ADDR_ANY, tcp_accept(), tcp_bind(), tcp_listen, and tcp_new().
Referenced by init_ethernet().
void http_sendInternalErr | ( | int | content_type | ) |
Send HTTP internal server error code.
content_type | HTTP content type. |
References content, http_content_type, http_html_hdr_500, and http_write().
Referenced by cgi_displayMsg(), cgi_led(), and http_recv().
void http_sendOk | ( | int | content_type | ) |
Send the HTTP header with the appropriated content type.
content_type | Index in the http_content_type table. |
References content, http_content_type, http_html_hdr_200, and http_write().
Referenced by cgi_chipInfo(), cgi_displayMsg(), cgi_echo(), cgi_led(), cgi_ledStatus(), cgi_resistor(), cgi_status(), cgi_temp(), cgi_uptime(), and http_recv().
int http_tokenizeGetRequest | ( | char * | raw_buf, |
size_t | raw_len | ||
) |
Tokenize a buffer.
raw_buf | Buffer to parse. |
raw_len | Buffer length. |
Referenced by cgi_displayMsg(), and cgi_led().
Write HTTP data.
buf | Buffer to write. |
len | Buffer length. |
References http_state::file, http_send_data(), http_sent(), http_state::left, and tcp_sent().
Referenced by cgi_chipInfo(), cgi_echo(), cgi_led(), cgi_ledStatus(), cgi_resistor(), cgi_status(), cgi_temp(), cgi_uptime(), http_recv(), http_sendInternalErr(), and http_sendOk().
struct tcp_pcb* g_pcb |
Referenced by cgi_status().
BoardStatus status |
board status info
Referenced by afec_process_callback(), cgi_led(), cgi_ledStatus(), cgi_status(), cgi_temp(), cgi_uptime(), pio_handler_process(), twi_master_init(), twi_master_read(), twi_master_write(), twi_slave_read(), and twi_slave_write().