HTTP Server Middleware Library
Macros

General Description

HTTP server preprocessor directives such as results and error codes.

Middleware APIs return results of type cy_rslt_t and are composed of three parts:

Result Format
           Module base         Type    Library specific error code
   +---------------------------+------+------------------------------+
   |CY_RSLT_MODULE_HTTP_SERVER | 0x2  |           Error Code         |
   +---------------------------+------+------------------------------+
             14-bits            2-bits            16-bits

See the macro section of this document for library-specific error codes.

The cy_rslt_t data structure is a part of cy_result.h. In ModusToolbox™ the PSoC 6 MCU target platform is located in <core_lib/include>

Module base: This base is derived from CY_RSLT_MODULE_MIDDLEWARE_BASE (defined in cy_result.h) and is an offset of the CY_RSLT_MODULE_MIDDLEWARE_BASE. The details of the offset and the middleware base are defined in cy_result_mw.h, which is part of Github connectivity-utilities For example, the HTTP server uses CY_RSLT_MODULE_HTTP_SERVER as the module base.

Type: This type is defined in cy_result.h and can be one of CY_RSLT_TYPE_FATAL, CY_RSLT_TYPE_ERROR, CY_RSLT_TYPE_WARNING or CY_RSLT_TYPE_INFO. AWS library error codes are of type CY_RSLT_TYPE_ERROR.

Library-specific error code: These error codes are library-specific and defined in the macro section.

Helper macros used for creating library-specific results are provided as part of cy_result.h.

Macros

#define CY_RSLT_MODULE_HTTP_SERVER_ERR_CODE_START   (0)
 Results returned by HTTP Server Library.
 
#define CY_RSLT_HTTP_SERVER_ERR_BASE   CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_HTTP_SERVER, CY_RSLT_MODULE_HTTP_SERVER_ERR_CODE_START)
 HTTP server error code base.
 
#define CY_RSLT_HTTP_SERVER_ERROR_NO_MEMORY   ((cy_rslt_t)(CY_RSLT_HTTP_SERVER_ERR_BASE + 1))
 Out of memory.
 
#define CY_RSLT_HTTP_SERVER_ERROR_THREAD_INIT   ((cy_rslt_t)(CY_RSLT_HTTP_SERVER_ERR_BASE + 2))
 Error initializing thread.
 
#define CY_RSLT_HTTP_SERVER_ERROR_QUEUE_INIT   ((cy_rslt_t)(CY_RSLT_HTTP_SERVER_ERR_BASE + 3))
 Error initializing queue.
 
#define CY_RSLT_HTTP_SERVER_ERROR_MUTEX_INIT   ((cy_rslt_t)(CY_RSLT_HTTP_SERVER_ERR_BASE + 4))
 Error initializing mutex.
 
#define CY_RSLT_HTTP_SERVER_ERROR_TCP_SERVER_START   ((cy_rslt_t)(CY_RSLT_HTTP_SERVER_ERR_BASE + 5))
 Failed to start TCP server.
 
#define CY_RSLT_HTTP_SERVER_ERROR_UNSUPPORTED   ((cy_rslt_t)(CY_RSLT_HTTP_SERVER_ERR_BASE + 6))
 Feature not supported.
 
#define CY_RSLT_HTTP_SERVER_ERROR_BADARG   ((cy_rslt_t)(CY_RSLT_HTTP_SERVER_ERR_BASE + 7))
 Bad argument/parameter.
 
#define CY_RSLT_HTTP_SERVER_ERROR_NOT_FOUND   ((cy_rslt_t)(CY_RSLT_HTTP_SERVER_ERR_BASE + 8))
 Resource not found.
 
#define CY_RSLT_HTTP_SERVER_ERROR_PARTIAL_RESULTS   ((cy_rslt_t)(CY_RSLT_HTTP_SERVER_ERR_BASE + 9))
 Partially processed. More...
 
#define CY_RSLT_HTTP_SERVER_PAGE_DATABASE_FULL   ((cy_rslt_t)(CY_RSLT_HTTP_SERVER_ERR_BASE + 10))
 Exceeded maximum number of resources.
 
#define CY_RSLT_ERROR   ((cy_rslt_t)(CY_RSLT_HTTP_SERVER_ERR_BASE + 11))
 HTTP server generic error.
 
#define MAX_NUMBER_OF_HTTP_SERVER_RESOURCES   (10)
 Max number of resources supported by the HTTP server. More...
 
#define HTTP_SERVER_SOCKET_RECEIVE_TIMEOUT   (10)
 Socket receive timeout in milliseconds.
 

Macro Definition Documentation

◆ CY_RSLT_HTTP_SERVER_ERROR_PARTIAL_RESULTS

#define CY_RSLT_HTTP_SERVER_ERROR_PARTIAL_RESULTS   ((cy_rslt_t)(CY_RSLT_HTTP_SERVER_ERR_BASE + 9))

Partially processed.

Returned by application's receive callback

◆ MAX_NUMBER_OF_HTTP_SERVER_RESOURCES

#define MAX_NUMBER_OF_HTTP_SERVER_RESOURCES   (10)

Max number of resources supported by the HTTP server.

Note
Change this macro to support more resources.