Microchip® Advanced Software Framework

httpd.h File Reference

Httpd server.

Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.

Data Structures

struct  BoardStatus
 

Typedefs

typedef struct BoardStatus BoardStatus
 
typedef int(* http_handler_t )(struct netconn *client, 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
}
 

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_request (void *pvParameters)
 Core HTTP server function processing the request. More...
 
void http_sendInternalErr (struct netconn *client, int content_type)
 Send HTTP internal server error code. More...
 
void http_sendOk (struct netconn *client, 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...
 

Variables

BoardStatus status
 

typedef struct BoardStatus BoardStatus
typedef int(* http_handler_t)(struct netconn *client, const char *name, char *revc_buf, size_t revc_len)

anonymous 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.

References http_decodeUrl().

void http_sendInternalErr ( struct netconn client,
int  content_type 
)

Send HTTP internal server error code.

References content, http_content_type, http_html_hdr_500, NETCONN_COPY, and netconn_write.

Referenced by http_request().

void http_sendOk ( struct netconn client,
int  content_type 
)

Send the HTTP header with the appropriated content type.

Parameters
clientSocket to send data to.
content_typeIndex in the http_content_type table.

References content, http_content_type, http_html_hdr_200, NETCONN_COPY, and netconn_write.

Referenced by cgi_chipInfo(), cgi_status(), and http_request().

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.