HTTP Client#

Functions#

int32_t
rsi_http_credentials(int8_t *username, int8_t *password)

Create HTTP server credentials request. Set username and password for HTTP server. This is a blocking API.

int32_t
rsi_http_client_get_async(uint16_t flags, uint8_t *ip_address, uint16_t port, uint8_t *resource, uint8_t *host_name, uint8_t *extended_header, uint8_t *user_name, uint8_t *password, #if RSI_HTTP_STATUS_INDICATION_EN void(*http_client_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) #else void(*http_client_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) #endif)

Send HTTP get request to remote HTTP server. This is a non-blocking API.

int32_t
rsi_http_client_post_async(uint16_t flags, uint8_t *ip_address, uint16_t port, uint8_t *resource, uint8_t *host_name, uint8_t *extended_header, uint8_t *user_name, uint8_t *password, uint8_t *post_data, uint32_t post_data_length, #if RSI_HTTP_STATUS_INDICATION_EN void(*http_client_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) #else void(*http_client_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) #endif)

Send HTTP post request to remote HTTP server. This is a non-blocking API.

int32_t
rsi_http_client_async(uint8_t type, uint16_t flags, uint8_t *ip_address, uint16_t port, uint8_t *resource, uint8_t *host_name, uint8_t *extended_header, uint8_t *user_name, uint8_t *password, uint8_t *post_data, uint32_t post_data_length, #if RSI_HTTP_STATUS_INDICATION_EN void(*callback)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) #else void(*callback)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) #endif)

Send HTTP get request/HTTP post request to remote HTTP server based on the type selected. This is a non-blocking API.

int32_t

Abort ongoing HTTP request from the client. This is a blocking API.

int32_t

Create the HTTP PUT client. This is a blocking API.

int32_t

Delete the created HTTP PUT client. This is a non-blocking API.

int32_t
rsi_http_client_put_start(uint16_t flags, uint8_t *ip_address, uint32_t port_number, uint8_t *resource, uint8_t *host_name, uint8_t *extended_header, uint8_t *user_name, uint8_t *password, uint32_t content_length, void(*callback)(uint16_t status, uint8_t type, const uint8_t *buffer, uint16_t length, const uint8_t end_of_put_pkt))

Start the HTTP client PUT process. This is a non-blocking API.

int32_t
rsi_http_client_put_pkt(uint8_t *file_content, uint16_t current_chunk_length)

Send HTTP data to HTTP server for the created URL resource. This is a blocking API.

int32_t
rsi_http_client_post_data(uint8_t *file_content, uint16_t current_chunk_length, #if RSI_HTTP_STATUS_INDICATION_EN void(*rsi_http_post_data_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) #else void(*rsi_http_post_data_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) #endif)

Send the HTTP POST data packet to remote HTTP server. This is a non-blocking API.

int32_t
rsi_http_otaf_async(uint8_t type, uint8_t flags, uint8_t *ip_address, uint16_t port, uint8_t *resource, uint8_t *host_name, uint8_t *extended_header, uint8_t *user_name, uint8_t *password, uint8_t *post_data, uint32_t post_data_length, void(*callback)(uint16_t status, const uint8_t *buffer))

Post the HTTP data for the requested URL to HTTP server. This is a non-blocking API.

Function Documentation#

rsi_http_credentials#

int32_t rsi_http_credentials (int8_t *username, int8_t *password)

Create HTTP server credentials request. Set username and password for HTTP server. This is a blocking API.

Parameters
[in]username

- User-given username

[in]password

- User-given password

Returns

  • 0 - Success

  • Negative Value - Failure (Possible Error Codes - 0xfffffffd)

Note


Definition at line 671 of file network/protocols/http_server/rsi_http_server.c

rsi_http_client_get_async#

int32_t rsi_http_client_get_async (uint16_t flags, uint8_t *ip_address, uint16_t port, uint8_t *resource, uint8_t *host_name, uint8_t *extended_header, uint8_t *user_name, uint8_t *password, #if RSI_HTTP_STATUS_INDICATION_EN void(*http_client_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) #else void(*http_client_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) #endif)

Send HTTP get request to remote HTTP server. This is a non-blocking API.

Parameters
[in]flags

- Select version and security

Flags

Macro

Description

BIT(0)

RSI_IPV6

Set this bit to enable IPv6, by default it is configured to IPv4

BIT(1)

RSI_SSL_ENABLE

Set this bit to enable SSL featuree

BIT(2)

RSI_SSL_V_1_0

Set this bit to support SSL TLS Version 1.0 if HTTPS is enabled

BIT(3)

RSI_SSL_V_1_2

Set this bit to support SSL_TLS Version 1.2 if HTTPS is enabled

BIT(4)

RSI_SSL_V_1_1

Set this bit to support SSL_TLS Version 1.1 if HTTPS is enabled

BIT(5)

HTTP_POST_DATA

Set this bit to enable Http_post large data feature

BIT(6)

HTTP_V_1_1

Set this bit to use HTTP version 1.1

BIT(9)

HTTPS_CERT_INDEX_1

Set this bit to indicate certificate at index 1 to be used for HTTPS

BIT(10)

HTTPS_CERT_INDEX_2

Set this bit to indicate certificate at index 2 to be used for HTTPS

[in]ip_address

- Server IP address

[in]port

- Port number of HTTP server

[in]resource

- URL string for requested resource

[in]host_name

- Host name

[in]extended_header

- User-defined extended header, each member header should end by \r\n

[in]user_name

- Username for server authentication

[in]password

- Password for server authentication

[in]endif

- Callback when asynchronous response comes for the request

[out]status

- Status of response from module. This will return failure upon an internal error only.

[out]buffer

- Buffer pointer

[out]length

- Length of data

[out]more_data

- 1 No more data, 0 More data present

[out]status_code

- HTTP response code as returned by server in HTTP header. e.g., 200, 201, 404, etc. This field is valid only when status field (first argument) is successful, indicating a response is received from HTTP server. A status_code equal to 0 indicates that there was no HTTP header in the received packet, probably a continuation of the frame body received in the previous chunk. This field is available, if the feature RSI_HTTP_STATUS_INDICATION_EN is enabled in rsi_wlan_config.h

Returns

  • 0 - Success

  • Negative value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc)

Note

  • Precondition - rsi_config_ipaddress() API needs to be called before this API.

  • HTTP server port is configurable on non-standard port.

  • Leave both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 unset for certificate index 0.

  • Refer to Error Codes for the description of above error codes.


Definition at line 72 of file network/protocols/rsi_http_client.c

rsi_http_client_post_async#

int32_t rsi_http_client_post_async (uint16_t flags, uint8_t *ip_address, uint16_t port, uint8_t *resource, uint8_t *host_name, uint8_t *extended_header, uint8_t *user_name, uint8_t *password, uint8_t *post_data, uint32_t post_data_length, #if RSI_HTTP_STATUS_INDICATION_EN void(*http_client_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) #else void(*http_client_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) #endif)

Send HTTP post request to remote HTTP server. This is a non-blocking API.

Parameters
[in]flags

- Select version and security

Flags

Macro

Description

BIT(0)

RSI_IPV6

Set this bit to enable IPv6, by default, it is configured to IPv4

BIT(1)

RSI_SSL_ENABLE

Set this bit to enable SSL feature

BIT(2)

RSI_SSL_V_1_0

Set this bit to support SSL TLS Version 1.0 if HTTPS is enabled

BIT(3)

RSI_SSL_V_1_2

Set this bit to support SSL_TLS Version 1.2 if HTTPS is enabled

BIT(4)

RSI_SSL_V_1_1

Set this bit to support SSL_TLS Version 1.1 if HTTPS is enabled

BIT(5)

HTTP_POST_DATA

Set this bit to enable Http_post large data feature

BIT(6)

HTTP_V_1_1

Set this bit to use HTTP version 1.1

BIT(9)

HTTPS_CERT_INDEX_1

Set this bit to indicate certificate at index 1 to be used for HTTPS

BIT(10)

HTTPS_CERT_INDEX_2

Set this bit to indicate certificate at index 2 to be used for HTTPS

[in]ip_address

- Server IP address

[in]port

- Port number of HTTP server

[in]resource

- URL string for requested resource

[in]host_name

- Host name

[in]extended_header

- User-defined extended header, each member header should end by \r\n

[in]user_name

- Username for server authentication

[in]password

- Password for server authentication

[in]post_data

- HTTP data to be posted to server

[in]post_data_length

- Post data length

[in]endif

- Callback when asynchronous response comes for the request

[in]status

- Status of response from module. This will return failure upon an internal error only.

[in]buffer

- Buffer pointer

[in]length

- Length of data

[in]moredata

- 1 No more data, 0 More data present, 2 HTTP post success response

[in]status_code

HTTP response code as returned by server in HTTP header. e.g., 200, 201, 404, etc. This field is valid only when status field (first argument) is successful, indicating a response is received from HTTP server. A status_code equal to 0 indicates that there was no HTTP header in the received packet, probably a continuation of the frame body received in the previous chunk. This field is available, if the feature RSI_HTTP_STATUS_INDICATION_EN is enabled in rsi_wlan_config.h

Returns

  • 0 - Success

  • Negative value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc)

Note

  • Precondition - rsi_config_ipaddress() API needs to be called before this API.

  • Leave both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 unset for certificate index 0.

  • Refer to Error Codes for the description of above error codes.


Definition at line 156 of file network/protocols/rsi_http_client.c

rsi_http_client_async#

int32_t rsi_http_client_async (uint8_t type, uint16_t flags, uint8_t *ip_address, uint16_t port, uint8_t *resource, uint8_t *host_name, uint8_t *extended_header, uint8_t *user_name, uint8_t *password, uint8_t *post_data, uint32_t post_data_length, #if RSI_HTTP_STATUS_INDICATION_EN void(*callback)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) #else void(*callback)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) #endif)

Send HTTP get request/HTTP post request to remote HTTP server based on the type selected. This is a non-blocking API.

Parameters
[in]type

- 0 RSI_HTTP_GET, 1 RSI_HTTP_POST

[in]flags

- Select version and security

Flags

Macro

Description

BIT(0)

RSI_IPV6

Set this bit to enable IPv6, by default, it is configured to IPv4

BIT(1)

RSI_SSL_ENABLE

Set this bit to enable SSL feature

BIT(2)

RSI_SSL_V_1_0

Set this bit to support SSL TLS Version 1.0 if HTTPS is enabled

BIT(3)

RSI_SSL_V_1_2

Set this bit to support SSL_TLS Version 1.2 if HTTPS is enabled

BIT(4)

RSI_SSL_V_1_1

Set this bit to support SSL_TLS Version 1.1 if HTTPS is enabled

BIT(5)

HTTP_POST_DATA

Set this bit to enable Http_post large data feature

BIT(6)

HTTP_V_1_1

Set this bit to use HTTP version 1.1

BIT(9)

HTTPS_CERT_INDEX_1

Set this bit to indicate certificate at index 1 to be used for HTTPS

BIT(10)

HTTPS_CERT_INDEX_2

Set this bit to indicate certificate at index 2 to be used for HTTPS

[in]ip_address

- Server IP address

[in]port

- Port number of HTTP server

[in]resource

- URL string for requested resource. Note: HTTP server port is also configurable on a non-standard port

[in]host_name

- Host name

[in]extended_header

- User-defined extended header, each member header should end by \r\n

[in]user_name

- Username for server authentication

[in]password

- Password for server authentication

[in]post_data

- HTTP data to be posted to server

[in]post_data_length

- This is the post data length

[in]endif

- Callback when asyncronous response comes for the request

[out]status

- Status of response from module. This will return failure upon an internal error only.

[out]buffer

- Buffer pointer

[out]length

- Length of data

[out]moredata

- 1 - No more data, 0 - More data present

[in]status_code

HTTP response code as returned by server in HTTP header. e.g., 200, 201, 404, etc. This field is valid only when status field (first argument) is successful, indicating a response is received from HTTP server. A status_code equal to 0 indicates that there was no HTTP header in the received packet, probably a continuation of the frame body received in the previous chunk. This field is available, if the feature RSI_HTTP_STATUS_INDICATION_EN is enabled in rsi_wlan_config.h.

Returns

  • 0 - Success

  • Negative value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc)

Note

  • Precondition - rsi_config_ipaddress() API needs to be called before this API.

  • Leave both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 unset for certificate index 0.

  • Refer to Error Codes for the description of above error codes.


Definition at line 246 of file network/protocols/rsi_http_client.c

rsi_http_client_abort#

int32_t rsi_http_client_abort (void)

Abort ongoing HTTP request from the client. This is a blocking API.

Parameters
[in]

Returns

  • 0 - Success

  • Negative Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc)

Note


Definition at line 464 of file network/protocols/rsi_http_client.c

rsi_http_client_put_create#

int32_t rsi_http_client_put_create (void)

Create the HTTP PUT client. This is a blocking API.

Parameters
[in]

Returns

  • 0 - Success

  • Negative Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc)

Note


Definition at line 526 of file network/protocols/rsi_http_client.c

rsi_http_client_put_delete#

int32_t rsi_http_client_put_delete (void)

Delete the created HTTP PUT client. This is a non-blocking API.

Parameters
[in]

Returns

  • 0 - Success

  • Negative Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc)

Note


Definition at line 614 of file network/protocols/rsi_http_client.c

rsi_http_client_put_start#

int32_t rsi_http_client_put_start (uint16_t flags, uint8_t *ip_address, uint32_t port_number, uint8_t *resource, uint8_t *host_name, uint8_t *extended_header, uint8_t *user_name, uint8_t *password, uint32_t content_length, void(*callback)(uint16_t status, uint8_t type, const uint8_t *buffer, uint16_t length, const uint8_t end_of_put_pkt))

Start the HTTP client PUT process. This is a non-blocking API.

Parameters
[in]flags

- Select version and security

Flags

Macro

Description

BIT(0)

RSI_IPV6

Set this bit to enable IPv6, by default, it is configured to IPv4

BIT(1)

RSI_SSL_ENABLE

Set this bit to enable SSL feature

BIT(2)

RSI_SSL_V_1_0

Set this bit to support SSL TLS Version 1.0 if HTTPS is enabled

BIT(3)

RSI_SSL_V_1_2

Set this bit to support SSL_TLS Version 1.2 if HTTPS is enabled

BIT(4)

RSI_SSL_V_1_1

Set this bit to support SSL_TLS Version 1.1 if HTTPS is enabled

BIT(5)

HTTP_POST_DATA

Set this bit to enable Http_post large data feature

BIT(6)

HTTP_V_1_1

Set this bit to use HTTP version 1.1

BIT(7)

HTTP_USER_DEFINED_CONTENT_TYPE

Set this bit to enable user defined http_content type

BIT(9)

HTTPS_CERT_INDEX_1

Set this bit to indicate certificate at index 1 to be used for HTTPS

BIT(10)

HTTPS_CERT_INDEX_2

Set this bit to indicate certificate at index 2 to be used for HTTPS

[in]ip_address

- Server IP address

[in]port_number

- Port number of HTTP server

[in]resource

- URL string for requested resource

[in]host_name

- Host name

[in]extended_header

- User-defined extended header, each member header should end by \r\n

[in]user_name

- Username for server authentication

[in]password

- Password for server authentication

[in]content_length

- Total length of HTTP data

[in]callback

- HTTP data length to be posted to server

[in]callback

- Callback when asyncronous response comes for the request

[in]status

- Status code

[in]type

- HTTP Client PUT command type. 2 - Put start response, 3 - Put packet response, 4 - Put delete response, 5 - Data from HTTP server

[in]buffer

- Buffer pointer

[in]length

- Length of data

[in]end_of_put_pkt

- End of file or HTTP resource content. 0 - More data is pending from host, 1 - End of HTTP file/resource content, 8 - More data pending from server, 9 - End of HTTP file from server

Returns

  • 0 - Success

  • Negative Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc)

Note


Definition at line 723 of file network/protocols/rsi_http_client.c

rsi_http_client_put_pkt#

int32_t rsi_http_client_put_pkt (uint8_t *file_content, uint16_t current_chunk_length)

Send HTTP data to HTTP server for the created URL resource. This is a blocking API.

Parameters
[in]file_content

- HTTP data content

[in]current_chunk_length

- HTTP data current chunk length

Returns

  • 0 - Success

  • Negative Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc)

Note


Definition at line 876 of file network/protocols/rsi_http_client.c

rsi_http_client_post_data#

int32_t rsi_http_client_post_data (uint8_t *file_content, uint16_t current_chunk_length, #if RSI_HTTP_STATUS_INDICATION_EN void(*rsi_http_post_data_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) #else void(*rsi_http_post_data_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) #endif)

Send the HTTP POST data packet to remote HTTP server. This is a non-blocking API.

Parameters
[in]file_content

- User given http file content

[in]current_chunk_length

- Length of the current HTTP data

[in]endif

- Callback when asynchronous response comes for the request.

[in]status

- Status of response from module. This will return failure upon an internal error only.

[in]buffer

- Buffer pointer

[in]length

- Length of data

[in]more_data

- 4 - More data is pending from host. 5 - End of HTTP data from host(Host sent total data content length). 8 – More data is pending from module to host. Further interrupts may be raised by the module till all the data is transferred to the Host. 9 – End of HTTP data from module to host.

[in]status_code

- HTTP response code as returned by server in HTTP header. e.g., 200, 201, 404, etc. This field is valid only when status field (first argument) is successful, indicating a response is received from HTTP server. A status_code equal to 0 indicates that there was no HTTP header in the received packet, probably a continuation of the frame body received in the previous chunk. This field is available, if the feature RSI_HTTP_STATUS_INDICATION_EN is enabled in rsi_wlan_config.h

Returns

  • 0 - Success

  • Negative Value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc)

Note


Definition at line 983 of file network/protocols/rsi_http_client.c

rsi_http_otaf_async#

int32_t rsi_http_otaf_async (uint8_t type, uint8_t flags, uint8_t *ip_address, uint16_t port, uint8_t *resource, uint8_t *host_name, uint8_t *extended_header, uint8_t *user_name, uint8_t *password, uint8_t *post_data, uint32_t post_data_length, void(*callback)(uint16_t status, const uint8_t *buffer))

Post the HTTP data for the requested URL to HTTP server. This is a non-blocking API.

Parameters
[in]type

- 0 - HTTPGET

  • 1 - HTTPPOST

[in]flags

- Select version and security:

Flags

Macro

Description

BIT(0)

RSI_IPV6

Set this bit to enable IPv6 , by default it is configured to IPv4

BIT(1)

RSI_SSL_ENABLE

Set this bit to enable SSL feature

BIT(2)

RSI_SSL_V_1_0

Set this bit to support SSL TLS Version 1.0 if HTTPS is enabled

BIT(3)

RSI_SSL_V_1_2

Set this bit to support SSL_TLS Version 1.2 if HTTPS is enabled

BIT(4)

RSI_SSL_V_1_1

Set this bit to support SSL_TLS Version 1.1 if HTTPS is enabled

BIT(6)

HTTP_V_1_1

Set this bit to use HTTP version 1.1

[in]ip_address

- Server IP address

[in]port

- Port number, default : 80 - HTTP, 443 - HTTPS

[in]resource

- URL string for requested resource

[in]host_name

- Post name

[in]extended_header

- Extender header if present, after each header member append \r\n

[in]user_name

- Username for server Authentication

[in]password

- Password for server Authentication

[in]post_data

- HTTP data to be posted to server

[in]post_data_length

- HTTP data length to be posted to server

[in]callback

- Callback is called when asynchronous response is received from module for HTTP firmware update request

[out]buffer

- NULL

[out]status

- This is the status response from module. This returns failure upon an internal error only.

Returns

  • 0 - Success

  • Negative Value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc)

Note

  • Refer to Error Codes for the description of above error codes.


Definition at line 112 of file network/protocols/rsi_http_ota_fw_up.c