HTTP Server Middleware Library
Structures & Enumerations

General Description

HTTP server data structures and type definitions.

Data Structures

struct  cy_http_message_body_t
 HTTP message structure that gets passed to dynamic URL processor functions. More...
 
struct  cy_http_response_stream_t
 Context structure for HTTP server stream Users should not access these values - they are provided here only to provide the compiler with datatype size information that allows static declarations. More...
 
struct  cy_https_server_security_info_t
 HTTP server security info. More...
 
struct  cy_resource_dynamic_data_t
 Dynamic HTTP resource info. More...
 
struct  cy_resource_static_data_t
 Static HTTP resource info. More...
 

Macros

#define EXPAND_AS_ENUMERATION(a, b)   a,
 Macro to expand the enumeration.
 
#define MIME_TABLE(ENTRY)
 MIME table. More...
 

Typedefs

typedef void * cy_http_server_t
 HTTP server handle.
 
typedef int32_t(* url_processor_t) (const char *url_path, const char *url_query_string, cy_http_response_stream_t *stream, void *arg, cy_http_message_body_t *http_data)
 Prototype for URL processor functions. More...
 

Enumerations

enum  cy_http_request_type_t {
  CY_HTTP_REQUEST_GET ,
  CY_HTTP_REQUEST_POST ,
  CY_HTTP_REQUEST_PUT ,
  CY_HTTP_REQUEST_UNDEFINED
}
 HTTP request type. More...
 
enum  cy_http_cache_t {
  CY_HTTP_CACHE_DISABLED ,
  CY_HTTP_CACHE_ENABLED
}
 HTTP cache. More...
 
enum  cy_http_mime_type_t
 HTTP MIME type. More...
 
enum  cy_http_status_codes_t {
  CY_HTTP_200_TYPE ,
  CY_HTTP_204_TYPE ,
  CY_HTTP_207_TYPE ,
  CY_HTTP_301_TYPE ,
  CY_HTTP_400_TYPE ,
  CY_HTTP_403_TYPE ,
  CY_HTTP_404_TYPE ,
  CY_HTTP_405_TYPE ,
  CY_HTTP_406_TYPE ,
  CY_HTTP_412_TYPE ,
  CY_HTTP_415_TYPE ,
  CY_HTTP_429_TYPE ,
  CY_HTTP_444_TYPE ,
  CY_HTTP_470_TYPE ,
  CY_HTTP_500_TYPE ,
  CY_HTTP_504_TYPE
}
 HTTP status code. More...
 
enum  cy_url_resource_type {
  CY_STATIC_URL_CONTENT ,
  CY_DYNAMIC_URL_CONTENT ,
  CY_RESOURCE_URL_CONTENT ,
  CY_RAW_STATIC_URL_CONTENT ,
  CY_RAW_DYNAMIC_URL_CONTENT ,
  CY_RAW_RESOURCE_URL_CONTENT
}
 HTTP server resource type. More...
 

Macro Definition Documentation

◆ MIME_TABLE

#define MIME_TABLE (   ENTRY)
Value:
ENTRY( MIME_TYPE_TLV = 0 , "application/x-tlv8" ) \
ENTRY( MIME_TYPE_APPLE_BINARY_PLIST, "application/x-apple-binary-plist" ) \
ENTRY( MIME_TYPE_APPLE_PROXY_AUTOCONFIG, "application/x-ns-proxy-autoconfig") \
ENTRY( MIME_TYPE_BINARY_DATA, "application/octet-stream" ) \
ENTRY( MIME_TYPE_JAVASCRIPT, "application/javascript" ) \
ENTRY( MIME_TYPE_JSON, "application/json" ) \
ENTRY( MIME_TYPE_HAP_JSON, "application/hap+json" ) \
ENTRY( MIME_TYPE_HAP_PAIRING, "application/pairing+tlv8" ) \
ENTRY( MIME_TYPE_HAP_VERIFY, "application/hap+verify" ) \
ENTRY( MIME_TYPE_TEXT_HTML, "text/html" ) \
ENTRY( MIME_TYPE_TEXT_PLAIN, "text/plain" ) \
ENTRY( MIME_TYPE_TEXT_EVENT_STREAM, "text/event-stream" ) \
ENTRY( MIME_TYPE_TEXT_CSS, "text/css" ) \
ENTRY( MIME_TYPE_IMAGE_PNG, "image/png" ) \
ENTRY( MIME_TYPE_IMAGE_GIF, "image/gif" ) \
ENTRY( MIME_TYPE_IMAGE_MICROSOFT, "image/vnd.microsoft.icon" ) \
ENTRY( MIME_TYPE_ALL, "*/*" ) /* This must always be the last mime*/

MIME table.

Typedef Documentation

◆ url_processor_t

typedef int32_t(* url_processor_t) (const char *url_path, const char *url_query_string, cy_http_response_stream_t *stream, void *arg, cy_http_message_body_t *http_data)

Prototype for URL processor functions.

Parameters
[in]url_path: URL path.
[in]url_query_string: NULL terminated URL query string.
[in]stream: HTTP stream on which data was received.
[in]arg: Arguments passed along with callback function.
[in]http_data: Buffer having HTTP data

Enumeration Type Documentation

◆ cy_http_request_type_t

HTTP request type.

Enumerator
CY_HTTP_REQUEST_GET 

HTTP server GET request type.

CY_HTTP_REQUEST_POST 

HTTP server POST request type.

CY_HTTP_REQUEST_PUT 

HTTP server PUT request type.

CY_HTTP_REQUEST_UNDEFINED 

HTTP server undefined request type.

◆ cy_http_cache_t

HTTP cache.

Enumerator
CY_HTTP_CACHE_DISABLED 

Do not cache previously fetched resources.

CY_HTTP_CACHE_ENABLED 

Allow caching of previously fetched resources

◆ cy_http_mime_type_t

HTTP MIME type.

Note
Refer to the 1st argument of MIME_TABLE for the list of MIME types supported. Example: MIME_TYPE_TLV.

◆ cy_http_status_codes_t

HTTP status code.

Enumerator
CY_HTTP_200_TYPE 

OK.

CY_HTTP_204_TYPE 

No Content.

CY_HTTP_207_TYPE 

Multi-Status.

CY_HTTP_301_TYPE 

Moved Permanently.

CY_HTTP_400_TYPE 

Bad Request.

CY_HTTP_403_TYPE 

Forbidden.

CY_HTTP_404_TYPE 

Not Found.

CY_HTTP_405_TYPE 

Method Not Allowed.

CY_HTTP_406_TYPE 

Not Acceptable.

CY_HTTP_412_TYPE 

Precondition Failed.

CY_HTTP_415_TYPE 

Unsupported Media Type.

CY_HTTP_429_TYPE 

Too Many Requests.

CY_HTTP_444_TYPE 

No Response.

CY_HTTP_470_TYPE 

Connection Authorization Required.

CY_HTTP_500_TYPE 

Internal Server Error.

CY_HTTP_504_TYPE 

Gateway Timeout.

◆ cy_url_resource_type

HTTP server resource type.

Enumerator
CY_STATIC_URL_CONTENT 

Page is constant data in memory-addressable area.

CY_DYNAMIC_URL_CONTENT 

Page is dynamically generated by a url_processor_t type function.

CY_RESOURCE_URL_CONTENT 

Page data is provided by a Resource which may reside off-chip.

Currently this URL type is not supported.

CY_RAW_STATIC_URL_CONTENT 

Same as CY_STATIC_URL_CONTENT, but the HTTP header must be supplied as part of the content.

CY_RAW_DYNAMIC_URL_CONTENT 

Same as CY_DYNAMIC_URL_CONTENT, but the HTTP header must be supplied as part of the content.

CY_RAW_RESOURCE_URL_CONTENT 

Same as CY_RESOURCE_URL_CONTENT, but the HTTP header must be supplied as part of the content.