FTP Client#
Functions#
Create FTP objects and connect to the FTP server on the given server port. This should be the first command for accessing FTP server.
This is a blocking API.
Disconnect from the FTP server and destroy the FTP objects. Once the FTP objects are destroyed, FTP server cannot be accessed.
For further accessing, FTP objects should be created again. This is a blocking API.
Open a file in the specified path on the FTP server. This is a blocking API.
Write the content into the file that was opened using rsi_ftp_file_write() API. This is a blocking API.
Read the content from the specified file on the FTP server. This is a non-blocking API.
Delete the file that is present in the specified path on the FTP server. This is a blocking API.
Rename the file with a new name on the FTP server. This is a blocking API.
Create a directory on the FTP server. This is a blocking API.
Delete the directory on the FTP server. This is a blocking API.
Change the current working directory to the specified directory path on the FTP server. This is a blocking API.
Get the list of directories present in the specified directory on the FTP server. This is a non-blocking API.
Set the FTP client mode - either in Passive mode or Active Mode.
In active mode, FTP client establishes the command channel, and the server establishes the data channel.
In passive mode, both the command channel and the data channel are established by the client.
This is a blocking API.
Set the file size.
Function Documentation#
rsi_ftp_connect#
int32_t rsi_ftp_connect (uint16_t flags, int8_t * server_ip, int8_t * username, int8_t * password, uint32_t server_port)
Create FTP objects and connect to the FTP server on the given server port. This should be the first command for accessing FTP server.
This is a blocking API.
[in] | flags | - Network flags. Each bit in the flag has its own significance
| ||||||
[in] | server_ip | - FTP server IP address to connect | ||||||
[in] | username | - Username for server authentication | ||||||
[in] | password | - Password for server authentication | ||||||
[in] | server_port | - Port number of FTP server |
Returns
0 - Success
Non Zero Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
FTP server port is also configurable on a non-standard port
Refer to Error Codes for the description of above error codes.
45
of file network/protocols/rsi_ftp.c
rsi_ftp_disconnect#
int32_t rsi_ftp_disconnect (void )
Disconnect from the FTP server and destroy the FTP objects. Once the FTP objects are destroyed, FTP server cannot be accessed.
For further accessing, FTP objects should be created again. This is a blocking API.
N/A |
Returns
0 - Success
Non Zero Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
197
of file network/protocols/rsi_ftp.c
rsi_ftp_file_write#
int32_t rsi_ftp_file_write (int8_t * file_name)
Open a file in the specified path on the FTP server. This is a blocking API.
[in] | file_name | - Filename or filename with the path |
Returns
0 - Success
Non Zero Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
319
of file network/protocols/rsi_ftp.c
rsi_ftp_file_write_content#
int32_t rsi_ftp_file_write_content (uint16_t flags, int8_t * file_content, int16_t content_length, uint8_t end_of_file)
Write the content into the file that was opened using rsi_ftp_file_write() API. This is a blocking API.
[in] | flags | - Network flags.
| ||||||
[in] | file_content | - Data stream to be written into the file | ||||||
[in] | content_length | - File content length | ||||||
[in] | end_of_file | - Flag that indicates the end of file. |
Returns
0 - Success
Non Zero Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
This API can be called multiple times to append data into the same file.
File content length should not exceed 1344 bytes in case of IPV4 and 1324 bytes in case of IPV6.
If exceeded, this API will break the file content and send it in multiple packets.Refer to Error Codes for the description of above error codes.
422
of file network/protocols/rsi_ftp.c
rsi_ftp_file_read_aysnc#
int32_t rsi_ftp_file_read_aysnc (int8_t * file_name, void(*)(uint16_t status, uint8_t *file_content, uint16_t content_length, uint8_t end_of_file) call_back_handler_ptr, status, file_content, content_length, end_of_file)
Read the content from the specified file on the FTP server. This is a non-blocking API.
[in] | file_name | - Filename or filename with path |
[in] | call_back_handler_ptr | - Called when asynchronous response is received from module for file read request |
[out] | status | - Status code |
[out] | file_content | - File content |
[out] | content_length | - Length of file content |
[out] | end_of_file | - Indicate the end of file. |
Returns
0 - Success
Non Zero Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
585
of file network/protocols/rsi_ftp.c
rsi_ftp_file_delete#
int32_t rsi_ftp_file_delete (int8_t * file_name)
Delete the file that is present in the specified path on the FTP server. This is a blocking API.
[in] | file_name | - Filename or filename with path to delete |
rsi_config_ipaddress() API needs to be called before this API.
Returns
0 - Success
Non Zero Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
677
of file network/protocols/rsi_ftp.c
rsi_ftp_file_rename#
int32_t rsi_ftp_file_rename (int8_t * old_file_name, int8_t * new_file_name)
Rename the file with a new name on the FTP server. This is a blocking API.
[in] | old_file_name | - Filename or filename with path to rename |
[in] | new_file_name | - New filename |
Returns
0 - Success
Non Zero Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
767
of file network/protocols/rsi_ftp.c
rsi_ftp_directory_create#
int32_t rsi_ftp_directory_create (int8_t * directory_name)
Create a directory on the FTP server. This is a blocking API.
[in] | directory_name | - Directory name (with path if required) to create |
Returns
0 - Success
Non Zero Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
859
of file network/protocols/rsi_ftp.c
rsi_ftp_directory_delete#
int32_t rsi_ftp_directory_delete (int8_t * directory_name)
Delete the directory on the FTP server. This is a blocking API.
[in] | directory_name | - Directory name (with path if required) to delete |
Returns
0 - Success
Non Zero Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
948
of file network/protocols/rsi_ftp.c
rsi_ftp_directory_set#
int32_t rsi_ftp_directory_set (int8_t * directory_path)
Change the current working directory to the specified directory path on the FTP server. This is a blocking API.
[in] | directory_path | - Directory name (with path if required) to create |
Returns
0 - Success
Non Zero Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
1036
of file network/protocols/rsi_ftp.c
rsi_ftp_directory_list_async#
int32_t rsi_ftp_directory_list_async (int8_t * directory_path, void(*)(uint16_t status, uint8_t *directory_list, uint16_t length, uint8_t end_of_list) call_back_handler_ptr, status, directory_list, length, end_of_list)
Get the list of directories present in the specified directory on the FTP server. This is a non-blocking API.
[in] | directory_path | - Directory path(with path if required) to list |
[in] | call_back_handler_ptr | - Called when asynchronous response is received from module for directory list request |
[out] | status | - Status code |
[out] | directory_list | - Stream of data with directory list as content |
[out] | length | - Length of content |
[out] | end_of_list | - Indicate end of list. |
Returns
0 - Success
Non Zero Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
1132
of file network/protocols/rsi_ftp.c
rsi_ftp_mode_set#
int32_t rsi_ftp_mode_set (uint8_t mode)
Set the FTP client mode - either in Passive mode or Active Mode.
In active mode, FTP client establishes the command channel, and the server establishes the data channel.
In passive mode, both the command channel and the data channel are established by the client.
This is a blocking API.
[in] | mode | - Used to select the mode of FTP client if FTP is enabled. |
Returns
0 - Success
Non Zero Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
1233
of file network/protocols/rsi_ftp.c
rsi_ftp_file_size_set#
int32_t rsi_ftp_file_size_set (uint32_t file_size)
Set the file size.
[in] | file_size | - represents the size of the file in bytes that is to be transferred. |
Returns
0 - Success
Non Zero Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
This API is supported only in 9117
This API should called before every rsi_ftp_file_write_content() when the Block transfer mode is in use
Refer to Error Codes for the description of above error codes.
1321
of file network/protocols/rsi_ftp.c