Microchip® Advanced Software Framework

httpd.h File Reference

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_pcbg_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

HTTP content type enum.

Enumerator
HTTP_CONTENT_JSON 
HTTP_CONTENT_HTML 
HTTP_CONTENT_CSS 
HTTP_CONTENT_JS 
HTTP_CONTENT_PNG 
HTTP_CONTENT_JPEG 
HTTP_CONTENT_GIF 
HTTP_CONTENT_PLAIN 
HTTP_CONTENT_CNT 

const char* get_ext ( const char *  name)

Get filename extension type.

Parameters
nameString containing a filename.
Returns
Extension type on success, NULL otherwise.

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.

Parameters
tolenized_buf.
tolenized_buf_len.
key.
value
len.

References decoded_str, and http_decodeUrl().

Referenced by cgi_displayMsg(), and cgi_led().

void http_init ( void  )

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.

Parameters
content_typeHTTP 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.

Parameters
content_typeIndex 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.

Parameters
raw_bufBuffer to parse.
raw_lenBuffer length.
Returns
The number of found tokens.

Referenced by cgi_displayMsg(), and cgi_led().

void http_write ( const char *  buf,
u32_t  len 
)

struct tcp_pcb* g_pcb

Referenced by cgi_status().