HTTP Client#
Functions#
Create HTTP server credentials request. Set username and password for HTTP server. This is a blocking API.
Send HTTP get request to remote HTTP server. This is a non-blocking API.
Send HTTP post request to remote HTTP server. This is a non-blocking API.
Send HTTP get request/HTTP post request to remote HTTP server based on the type selected. This is a non-blocking API.
Abort ongoing HTTP request from the client. This is a blocking API.
Create the HTTP PUT client. This is a blocking API.
Delete the created HTTP PUT client. This is a non-blocking API.
Start the HTTP client PUT process. This is a non-blocking API.
Send HTTP data to HTTP server for the created URL resource. This is a blocking API.
Send the HTTP POST data packet to remote HTTP server. This is a non-blocking API.
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.
[in] | username | - User-given username |
[in] | password | - User-given password |
Returns
0 - Success
Negative Value - Failure (Possible Error Codes - 0xfffffffd)
Note
Precondition - rsi_wireless_init() API needs to be called before this API.
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(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) http_client_response_handler #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) http_client_response_handler # endif, status, buffer, length, more_data, status_code)
Send HTTP get request to remote HTTP server. This is a non-blocking API.
[in] | flags | - Select version and security
| |||||||||||||||||||||||||||||||||
[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 | |||||||||||||||||||||||||||||||||
[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.
73
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(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) http_client_response_handler #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) http_client_response_handler # endif, status, buffer, length, moredata, status_code)
Send HTTP post request to remote HTTP server. This is a non-blocking API.
[in] | flags | - Select version and security
| |||||||||||||||||||||||||||||||||
[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 | |||||||||||||||||||||||||||||||||
[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.
158
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(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) callback #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) callback # endif, status, buffer, length, moredata, status_code)
Send HTTP get request/HTTP post request to remote HTTP server based on the type selected. This is a non-blocking API.
[in] | type | - 0 RSI_HTTP_GET, 1 RSI_HTTP_POST | ||||||||||||||||||||||||||||||||||||
[in] | flags | - Select version and security
| ||||||||||||||||||||||||||||||||||||
[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 | ||||||||||||||||||||||||||||||||||||
[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.
249
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.
[in] |
Returns
0 - Success
Negative Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
479
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.
[in] |
Returns
0 - Success
Negative Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
541
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.
[in] |
Returns
0 - Success
Negative Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
629
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(*)(uint16_t status, uint8_t type, const uint8_t *buffer, uint16_t length, const uint8_t end_of_put_pkt) callback, callback, status, type, buffer, length, end_of_put_pkt)
Start the HTTP client PUT process. This is a non-blocking API.
[in] | flags | - Select version and security
| |||||||||||||||||||||||||||||||||
[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 | |||||||||||||||||||||||||||||||||
[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
Precondition - rsi_config_ipaddress() API and rsi_http_client_put_create 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.
738
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.
[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
Precondition - rsi_config_ipaddress(), rsi_http_client_put_create() and rsi_http_client_put_start() needs to be called before this API
Refer to Error Codes for the description of above error codes.
891
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(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) rsi_http_post_data_response_handler #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) rsi_http_post_data_response_handler # endif, status, buffer, length, more_data, status_code)
Send the HTTP POST data packet to remote HTTP server. This is a non-blocking API.
[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
Precondition - rsi_config_ipaddress() API needs to be called before this API
Refer to Error Codes for the description of above error codes.
998
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(*)(uint16_t status, const uint8_t *buffer) callback, buffer, status)
Post the HTTP data for the requested URL to HTTP server. This is a non-blocking API.
[in] | type | - 0 - HTTPGET
| |||||||||||||||||||||
[in] | flags | - Select version and security:
| |||||||||||||||||||||
[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 | |||||||||||||||||||||
[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.
112
of file network/protocols/rsi_http_ota_fw_up.c