FTP Client#

Functions#

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.

int32_t

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.

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.

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.

int32_t
rsi_ftp_file_read_aysnc(int8_t *file_name, void(*call_back_handler_ptr)(uint16_t status, uint8_t *file_content, uint16_t content_length, uint8_t end_of_file))

Read the content from the specified file on the FTP server. This is a non-blocking API.

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.

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.

int32_t
rsi_ftp_directory_create(int8_t *directory_name)

Create a directory on the FTP server. This is a blocking API.

int32_t
rsi_ftp_directory_delete(int8_t *directory_name)

Delete the directory on the FTP server. This is a blocking API.

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.

int32_t
rsi_ftp_directory_list_async(int8_t *directory_path, void(*call_back_handler_ptr)(uint16_t status, uint8_t *directory_list, uint16_t length, uint8_t end_of_list))

Get the list of directories present in the specified directory on the FTP server. This is a non-blocking API.

int32_t
rsi_ftp_mode_set(uint8_t mode)

Set the FTP client mode - either in Passive mode or Active Mode. This is a blocking API.

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.

Parameters
[in]flags

- Network flags. Each bit in the flag has its own significance

Flags

Description

BIT(0) - RSI_IPV6

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

BIT(1) to BIT(15)

Reserved for future use

[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

Note

  • This API is not supported

Note

  • FTP server port is also configurable on a non-standard port

Returns

  • 0 - Success Non Zero Value - Failure If return value is less than 0 -3: Command given in wrong state -4: Buffer not available to serve the command If return value is greater than 0 0x0021,0x002C,0x0015

Note

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


Definition at line 51 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.

Parameters
N/A

Note

  • This API is not supported

Returns

  • 0 - Success Non Zero Value - Failure If return value is less than 0 -3 - Command given in wrong state -4 - Buffer not available to serve the command If return value is greater than 0 0x0021,0x002C,0x0015

Note

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


Definition at line 203 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.

Parameters
[in]file_name

- Filename or filename with the path

Note

  • This API is not supported

Returns

  • 0 - Success Non Zero Value - Failure If return value is less than 0 -3 - Command given in wrong state -4 - Buffer not available to serve the command If return value is greater than 0 0x0021,0x002C,0x0015

Note

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


Definition at line 327 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.

Parameters
[in]flags

- Network flags.

Flags

Description

BIT(0) - RSI_IPV6

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

BIT(1) to BIT(15)

Reserved for future use

[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 1 – Represent the end of content to be written into the file 0 – Extra data that is pending to write into the file

Note

  • This API is not supported

Note

  • (a) This API can be called multiple times to append data into the same file. (b) File content length should not exceed 1344 bytes in case of IPV4 and 1324 bytes in case of IPV6.If exceeds, this API will break the file content and send it in multiple packets.

Returns

  • 0 - Success Non Zero Value - Failure If return value is less than 0 -3: Command given in wrong state -4: Buffer not available to serve the command If return value is greater than 0 0x0021,0x002C,0x0015


Definition at line 432 of file network/protocols/rsi_ftp.c

rsi_ftp_file_read_aysnc#

int32_t rsi_ftp_file_read_aysnc (int8_t *file_name, void(*call_back_handler_ptr)(uint16_t status, uint8_t *file_content, uint16_t content_length, uint8_t end_of_file))

Read the content from the specified file on the FTP server. This is a non-blocking API.

Parameters
[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

- Success - RSI_SUCCESS Failure - Negative value -2 : Invalid parameter,expects call back handler -3 : Command given in wrong state -4 : Buffer not available to serve the command Other Possible error codes are: 0x0021,0x002C,0x0015 Other parameters of the callback are valid only if status is 0

[out]file_content

- File content

[out]content_length

- Length of file content

[out]end_of_file

- Indicate the end of file 1 – No more data 0 – More data present

Note

  • This API is not supported

Returns

  • Status of the call_back_handler_ptr is returned

Note

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


Definition at line 595 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.

Parameters
[in]file_name

- Filename or filename with path to delete

Note

  • This API is not supported

Returns

  • 0 - Success Non Zero Value - Failure If return value is less than zero -3 - Command given in wrong state -4 - Buffer not available to serve the command If return value is greater than 0 0x0021,0x002C,0x0015

Note

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


Definition at line 687 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.

Parameters
[in]old_file_name

- Filename or filename with path to rename

[in]new_file_name

- New filename

Note

  • This API is not supported

Returns

  • 0 - Success Negative Value - Failure If return value is less than 0 -3 - Command given in wrong state -4 - Buffer not available to serve the command If return value is greater than 0 0x0021,0x002C,0x0015

Note

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


Definition at line 779 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.

Parameters
[in]directory_name

- Directory name (with path if required) to create

Note

  • This API is not supported

Returns

  • 0 - Success Non Zero Value - Failure If return value is less than 0 -3 - Command given in wrong state -4 - Buffer not available to serve the command If return value is greater than 0 0x0021,0x002C,0x0015

Note

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


Definition at line 873 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.

Parameters
[in]directory_name

- Directory name (with path if required) to delete

Note

  • This API is not supported

Returns

  • 0 - Success Non Zero Value - Failure If return value is less than 0 -3 - Command given in wrong state -4 - Buffer not available to serve the command If return value is greater than 0 0x0021,0x002C,0x0015

Note

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


Definition at line 964 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.

Parameters
[in]directory_path

- Directory name (with path if required) to create

Note

  • This API is not supported

Returns

  • 0 - Success Non Zero Value - Failure If return value is less than 0 -3 - Command given in wrong state -4 - Buffer not available to serve the command If return value is greater than 0 0x0021,0x002C,0x0015

Note

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


Definition at line 1054 of file network/protocols/rsi_ftp.c

rsi_ftp_directory_list_async#

int32_t rsi_ftp_directory_list_async (int8_t *directory_path, void(*call_back_handler_ptr)(uint16_t status, uint8_t *directory_list, uint16_t length, uint8_t end_of_list))

Get the list of directories present in the specified directory on the FTP server. This is a non-blocking API.

Parameters
[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

- Success - RSI_SUCCESS Failure - Negative value -2 : Invalid parameter, expects call back handler -3 : Command given in wrong state -4 : Buffer not available to serve the command Other possible error codes are: 0x0021,0x002C,0x0015 Other parameters of callback are valid only if status is 0

[out]directory_list

- Stream of data with directory list as content

[out]length

- Length of content

[out]end_of_list

- Indicate end of list 1 – No more data 0 – More data present

Note

  • This API is not supported

Returns

  • Status of the call_back_handler_ptr is returned

Note

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


Definition at line 1151 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. This is a blocking API.

Parameters
[in]mode

- Used to select the mode of FTP client if FTP is enabled 0 - Active Mode 1 - Passive Mode.

Note

  • This API is not supported

Returns

  • 0 - Success Negative Value - Failure -2 - Invalid parameter -3 - Command given in wrong state -4 - Buffer not available to serve the command

Note

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


Definition at line 1243 of file network/protocols/rsi_ftp.c