HTTP Client Middleware Library
Macros

General Description

HTTP Client library preprocessor directives such as results and error codes.

Cypress middleware APIs return results of type cy_rslt_t and consist of three parts:

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

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

The data structure cy_rslt_t is 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 CY_RSLT_MODULE_MIDDLEWARE_BASE. 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 Client uses CY_RSLT_MODULE_HTTP_CLIENT as the module base, which is 0x020E.

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. HTTP Client library error codes are of type CY_RSLT_TYPE_ERROR, which is 0x2.

Library-specific error codes: 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_CLIENT_ERR_CODE_START   (0)
 HTTP Client library error code start.
 
#define CY_RSLT_HTTP_CLIENT_ERR_BASE   CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_HTTP_CLIENT, CY_RSLT_MODULE_HTTP_CLIENT_ERR_CODE_START)
 HTTP Client library error base.
 
#define CY_RSLT_HTTP_CLIENT_ERROR   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 1))
 Generic HTTP Client library error.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_BADARG   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 2))
 Invalid argument.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_NOMEM   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 3))
 Out of memory.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_INIT_FAIL   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 4))
 HTTP Client library Init failed.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_DEINIT_FAIL   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 5))
 HTTP Client library Deinit failed.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_OBJ_NOT_INITIALIZED   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 6))
 HTTP Client object not initialized.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_CONNECT_FAIL   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 7))
 HTTP connect failed.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_DISCONNECT_FAIL   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 8))
 HTTP disconnect failed.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_NOT_CONNECTED   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 9))
 HTTP Client not connected.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_ALREADY_CONNECTED   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 10))
 HTTP Client already connected.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_INVALID_CREDENTIALS   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 11))
 Invalid credentials.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_HANDSHAKE_FAIL   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 12))
 TLS handshake failed.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_PARTIAL_RESPONSE   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 13))
 HTTP response was partially received.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_NO_RESPONSE   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 14))
 No HTTP response was received.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_MAX_HEADER_SIZE_EXCEEDED   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 15))
 Server sent more headers than the configured number of headers.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_INVALID_CHUNK_HEADER   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 16))
 Server sent a chunk header containing one or more invalid characters.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_INVALID_CONTENT_LENGTH   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 17))
 Response contains invalid characters in the Content-Length header.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_PARSER   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 18))
 Error occurred while parsing the response.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_NO_HEADER   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 19))
 The requested header field was not found in the response.
 
#define CY_RSLT_HTTP_CLIENT_ERROR_INVALID_RESPONSE   ((cy_rslt_t)(CY_RSLT_HTTP_CLIENT_ERR_BASE + 20))
 HTTP response is either corrupt or incomplete.