SDK3.5
This document shows Ameba SDK 3.5 APIs
Data Structures | Functions
httpd.h File Reference

This file provides user interface for HTTP/HTTPS server. More...

Data Structures

struct  http_request
 The structure is the context used for HTTP request header parsing. More...
 
struct  httpd_conn
 The structure is the context used for client connection. More...
 

Functions

int httpd_start (uint16_t port, uint8_t max_conn, uint32_t stack_bytes, uint8_t thread_mode, uint8_t secure)
 This function is used to start an HTTP or HTTPS server. More...
 
void httpd_stop (void)
 This function is used to stop a running server. More...
 
int httpd_reg_page_callback (char *path, void(*callback)(struct httpd_conn *conn))
 This function is used to register a callback function for a Web page request handling. More...
 
void httpd_clear_page_callbacks (void)
 This function is used to clear all registered page callback functions. More...
 
void httpd_setup_debug (uint8_t debug)
 This function is used to setup httpd debug. More...
 
int httpd_setup_cert (const char *server_cert, const char *server_key, const char *ca_certs)
 This function is used to setup certificate and key for server before starting with HTTPS. More...
 
int httpd_setup_user_password (char *user, char *password)
 This function is used to setup authorization for server. More...
 
void httpd_free (void *ptr)
 This function is used to free memory allocated by httpd API, such as httpd_request_get_header_field() and httpd_request_get_query_key(). More...
 
void httpd_conn_close (struct httpd_conn *conn)
 This function is used to close a client connection and release context resource. More...
 
void httpd_conn_dump_header (struct httpd_conn *conn)
 This function is used to dump the parsed HTTP header of request in connection context. More...
 
int httpd_request_is_method (struct httpd_conn *conn, char *method)
 This function is used to check HTTP method of request in connection context. More...
 
int httpd_request_read_header (struct httpd_conn *conn)
 This function is used to read HTTP header from client socket descriptor and parse content to connection context. More...
 
int httpd_request_read_data (struct httpd_conn *conn, uint8_t *data, size_t data_len)
 This function is used to read data from HTTP/HTTPS connection. More...
 
int httpd_request_get_header_field (struct httpd_conn *conn, char *field, char **value)
 This function is used to get a header field from HTTP header of connection context. More...
 
int httpd_request_get_query_key (struct httpd_conn *conn, char *key, char **value)
 This function is used to get a key value from query string in HTTP header of connection context. More...
 
int httpd_response_write_header_start (struct httpd_conn *conn, char *status, char *content_type, size_t content_len)
 This function is used to start a HTTP response in connection. More...
 
int httpd_response_write_header (struct httpd_conn *conn, char *name, char *value)
 This function is used to add an HTTP header field to HTTP response. More...
 
int httpd_response_write_header_finish (struct httpd_conn *conn)
 This function is used to write HTTP response header data to connection. More...
 
int httpd_response_write_data (struct httpd_conn *conn, uint8_t *data, size_t data_len)
 This function is used to write HTTP response body data to connection. More...
 
void httpd_response_bad_request (struct httpd_conn *conn, char *msg)
 This function is used to write a default HTTP response for error of 400 Bad Request. More...
 
void httpd_response_unauthorized (struct httpd_conn *conn, char *msg)
 This function is used to write a default HTTP response for error of 401 Unauthorized. More...
 
void httpd_response_not_found (struct httpd_conn *conn, char *msg)
 This function is used to write a default HTTP response for error of 404 Not Found. More...
 
void httpd_response_method_not_allowed (struct httpd_conn *conn, char *msg)
 This function is used to write a default HTTP response for error of 405 Method Not Allowed. More...
 
void httpd_response_too_many_requests (struct httpd_conn *conn, char *msg)
 This function is used to write a default HTTP response for error of 429 Too Many Requests. More...
 
void httpd_response_internal_server_error (struct httpd_conn *conn, char *msg)
 This function is used to write a default HTTP response for error of 500 Internal Server Error. More...
 

Detailed Description

This file provides user interface for HTTP/HTTPS server.

Author
Version
Attention

This module is a confidential and proprietary property of RealTek and possession or use of this module requires written permission of RealTek.

Copyright(c) 2016, Realtek Semiconductor Corporation. All rights reserved.