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.
Sets the SNI Hostname for internal socket.
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, | ||||||||||||||||||||||||||||||||||||
[out] | status_code | - HTTP response code as returned by server in HTTP header. e.g., 200, 201, 404, etc. |
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.
74
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. |
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.
160
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. | ||||||||||||||||||||||||||||||||||||
[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 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] | 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. |
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.
251
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.
481
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.
543
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.
631
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. | |||||||||||||||||||||||||||||||||
[in] | buffer | - Buffer pointer | |||||||||||||||||||||||||||||||||
[in] | length | - Length of data | |||||||||||||||||||||||||||||||||
[in] | end_of_put_pkt | - End of file or HTTP resource content. |
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.
740
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.
893
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. |
[in] | status_code | - HTTP response code as returned by server in HTTP header. e.g., 200, 201, 404, etc. |
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.
1000
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
rsi_set_sni_emb_socket#
int32_t rsi_set_sni_emb_socket (uint8_t app_protocol, uint8_t * hostname, uint16_t length)
Sets the SNI Hostname for internal socket.
[in] | app_protocol | - 1 - HTTP |
[in] | hostname | - Pointer to SNI string that needs to be used during SSL handshake |
[in] | length | - Length of SNI hostname |
Returns
Zero - Success Negative Value - Failure
Possible error codes : 0xBB51, 0xFF74
Note
Call this API before HTTP GET/POST.
4447
of file network/socket/rsi_socket.c