FTP Client API#

FTPc_Open()#

Description#

Open connection to an FTP server.

Files#

ftp_client.h/ftp_client.c

Prototype#

CPU_BOOLEAN FTPc_Open (      FTPc_CONN       *p_conn,
                       const FTPc_CFG        *p_cfg,
                       const FTPc_SECURE_CFG *p_secure_cfg,
                             CPU_CHAR        *p_host_server,
                             NET_PORT_NBR     port_nbr,
                             CPU_CHAR        *p_user,
                             CPU_CHAR        *p_pass,
                             RTOS_ERR        *p_err);

Arguments#

p_conn

Pointer to FTP Client Connection object.

p_cfg

Pointer to FTPc Configuration object. DEF_NULL to use internal default configuration.

p_secure_cfg

Pointer to a secure configuration structure if secured connection is required or DEF_NULL if secured connection is not required.

p_host_server

Pointer to hostname/IP address string of the server.

port_nbr

IP port of the server.

p_user

Pointer to account username on the server. DEF_NULL for anonymous connection.

p_pass

Pointer to account password on the server. DEF_NULL for no password.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function.

Returned Value#

  • DEF_FAIL connection failed.

  • DEF_OK connection successful.

Notes / Warnings#

None.

FTPc_Close()#

Description#

Close FTP connection.

Files#

ftp_client.h/ftp_client.c

Prototype#

CPU_BOOLEAN FTPc_Close (FTPc_CONN  *p_conn,
                        RTOS_ERR   *p_err);

Arguments#

p_conn

Pointer to FTP Client Connection object.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function.

Returned Value#

  • DEF_FAIL FTP connection close failed.

  • DEF_OK FTP connection close successful.

Notes / Warnings#

None.

FTPc_RecvBuf()#

Description#

Receive a file from an FTP server into a memory buffer.

Files#

ftp_client.h/ftp_client.c

Prototype#

CPU_BOOLEAN FTPc_RecvBuf (FTPc_CONN  *p_conn,
                          CPU_CHAR   *p_remote_file_name,
                          CPU_INT08U *p_buf,
                          CPU_INT32U  buf_len,
                          CPU_INT32U *p_file_size,
                          RTOS_ERR   *p_err);

Arguments#

p_conn

Pointer to FTP Client Connection object.

p_remote_file_name

Pointer to name of the file in FTP server.

p_buf

Pointer to memory buffer to hold received file.

buf_len

Size of the memory buffer.

port_nbr

IP port of the server.

p_file_size

Pointer to a variable that will received the size of the file received.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function.

Returned Value#

  • DEF_FAIL reception failed.

  • DEF_OK reception successful.

Notes / Warnings#

None.

FTPc_RecvFile()#

Description#

Receive a file from an FTP server to the file system.

Files#

ftp_client.h/ftp_client.c

Prototype#

CPU_BOOLEAN FTPc_RecvFile (FTPc_CONN *p_conn,
                           CPU_CHAR  *p_remote_file_name,
                           CPU_CHAR  *p_local_file_name,
                           RTOS_ERR  *p_err);

Arguments#

p_conn

Pointer to FTP Client Connection object.

p_remote_file_name

Remote File path.

p_local_file_name

Remote File path.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function.

Returned Value#

  • DEF_FAIL reception failed.

  • DEF_OK reception successful.

Notes / Warnings#

None.

FTPc_SendBuf()#

Description#

Send a memory buffer to an FTP server.

Files#

ftp_client.h/ftp_client.c

Prototype#

CPU_BOOLEAN FTPc_SendBuf (FTPc_CONN   *p_conn,
                          CPU_CHAR    *p_remote_file_name,
                          CPU_INT08U  *p_buf,
                          CPU_INT32U   buf_len,
                          CPU_BOOLEAN  append,
                          RTOS_ERR    *p_err)

Arguments#

p_conn

Pointer to FTP Client Connection object.

p_remote_file_name

File path on the server

p_buf

Pointer to memory buffer to send.

buf_len

Size of the memory buffer.

append

if DEF_YES, existing file on FTP server will be appended with memory buffer. If file doesn't exist on FTP server, it will be created.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function.

Returned Value#

  • DEF_FAIL transmission failed.

  • DEF_OK transmission successful.

Notes / Warnings#

None.

FTPc_SendFile()#

Description#

Send a file located in the file system to an FTP server.

Files#

ftp_client.h/ftp_client.c

Prototype#

CPU_BOOLEAN FTPc_SendFile (FTPc_CONN   *p_conn,
                           CPU_CHAR    *p_remote_file_name,
                           CPU_CHAR    *p_local_file_name,
                           CPU_BOOLEAN  append,
                           RTOS_ERR    *p_err);

Arguments#

p_conn

Pointer to FTP Client Connection object.

p_remote_file_name

Remote File path.

p_local_file_name

Local File path.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function.

Returned Value#

  • DEF_FAIL transmission failed.

  • DEF_OK transmission successful.

Notes / Warnings#

None.