Structures and Enumerations

group http_client_struct

HTTP Client library data structures and type definitions.

Typedefs

typedef void *cy_http_client_t

HTTP Client handle.

typedef void (*cy_http_disconnect_callback_t)(cy_http_client_t handle, cy_http_client_disconn_type_t type, void *user_data)

Disconnect notification callback function.

Return

: void

Parameters
  • handle: [in] : Handle for which disconnection has occurred.

  • type: [in] : Disconnect type.

  • user_data: [in] : User data provided by the caller while invoking /ref cy_http_client_create.

Enums

enum cy_http_client_method_t

cy_http_client_method_t: HTTP Client supported methods.

Values:

enumerator CY_HTTP_CLIENT_METHOD_GET

HTTP GET Method.

enumerator CY_HTTP_CLIENT_METHOD_PUT

HTTP PUT Method.

enumerator CY_HTTP_CLIENT_METHOD_POST

HTTP POST Method.

enumerator CY_HTTP_CLIENT_METHOD_HEAD

HTTP HEAD Method.

enumerator CY_HTTP_CLIENT_METHOD_DELETE

HTTP DELETE Method.

enumerator CY_HTTP_CLIENT_METHOD_PATCH

HTTP PATCH Method.

enumerator CY_HTTP_CLIENT_METHOD_CONNECT

HTTP CONNECT Method.

enumerator CY_HTTP_CLIENT_METHOD_OPTIONS

HTTP OPTIONS Method.

enumerator CY_HTTP_CLIENT_METHOD_TRACE

HTTP TRACE Method.

enum cy_http_client_disconn_type_t

cy_http_client_disconn_type_t: HTTP Client disconnect type.

Values:

enumerator CY_HTTP_CLIENT_DISCONN_TYPE_SERVER_INITIATED

Server initiated disconnect.

enumerator CY_HTTP_CLIENT_DISCONN_TYPE_NETWORK_DOWN

Network is disconnected.

struct cy_http_client_header_t
#include <cy_http_client_api.h>

HTTP structure containing the HTTP header fields.

Public Members

char *field

HTTP header field such as host, date, content_length, etc.

size_t field_len

HTTP field length.

char *value

HTTP header value corresponding to the field.

size_t value_len

HTTP header value length.

struct cy_http_client_request_header_t
#include <cy_http_client_api.h>

HTTP structure containing the fields required for the request header.

Public Members

cy_http_client_method_t method

Method for which the HTTP Client request has to be sent.

const char *resource_path

Path to which HTTP Client request has to be sent; NULL terminated.

uint8_t *buffer

Pointer to the buffer to store HTTP request and the HTTP response received from the server.

This buffer needs to be allocated by the caller and should not be freed before cy_http_client_send returns.

size_t buffer_len

Length of the buffer in bytes.

size_t headers_len

Length of the request header updated in cy_http_client_write_header, or the user has to update this field if the header is generated by the application and passed to cy_http_client_send.

int32_t range_start

Indicates the Start Range from where the server should return.

If the range header is not required, set this value to -1.

int32_t range_end

Indicates the End Range until where the data is expected.

Set this to -1 if requested range is all bytes from the starting range byte to the end of file or the requested range is for the last N bytes of the file.

struct cy_http_client_response_t
#include <cy_http_client_api.h>

HTTP structure containing the fields required for response header and body.

Public Members

uint16_t status_code

Standard HTTP response status code.

uint8_t *buffer

Pointer to the buffer containing the HTTP response.

This buffer is the same as the buffer provided in cy_http_client_request_header_t.

size_t buffer_len

Length of the buffer in bytes.

const uint8_t *header

The starting location of the response headers in the buffer.

size_t headers_len

Byte length of the response headers in the buffer.

size_t header_count

Count of the headers sent by the server.

const uint8_t *body

The starting location of the response body in the buffer.

size_t body_len

Byte length of the body in the buffer.

size_t content_len

The value in the “Content-Length” header is updated here.