Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

ftp_client.c File Reference

ftp_client.c File Reference

FTP client (File Transfer Protocol) More...

Go to the source code of this file.

Functions

error_t ftpSetPort (FtpClientContext *context, const IpAddr *ipAddr, uint16_t port)
 Set the port to be used in data connection.
error_t ftpSetPassiveMode (FtpClientContext *context, uint16_t *port)
 Enter passive mode.
error_t ftpSetType (FtpClientContext *context, char_t type)
 Set representation type.
error_t ftpSetProtectionBufferSize (FtpClientContext *context, uint32_t size)
 Set protection buffer size.
error_t ftpSetDataChannelProtectionLevel (FtpClientContext *context, char_t level)
 Set data channel protection level.
error_t ftpConnect (FtpClientContext *context, NetInterface *interface, const IpAddr *serverIpAddr, uint16_t serverPort, uint_t flags)
 Establish a connection with the specified FTP server.
error_t ftpAuth (FtpClientContext *context)
 Request authentication.
error_t ftpLogin (FtpClientContext *context, const char_t *username, const char_t *password, const char_t *account)
 Login to the FTP server using the provided username and password.
error_t ftpGetWorkingDir (FtpClientContext *context, char_t *path, size_t size)
 Get the working directory from the FTP server.
error_t ftpChangeWorkingDir (FtpClientContext *context, const char_t *path)
 Change the current working directory of the FTP session.
error_t ftpChangeToParentDir (FtpClientContext *context)
 Change the current working directory to the parent directory.
error_t ftpMakeDir (FtpClientContext *context, const char_t *path)
 Create a new directory.
error_t ftpRemoveDir (FtpClientContext *context, const char_t *path)
 Remove a directory on the FTP server.
error_t ftpOpenFile (FtpClientContext *context, const char_t *path, uint_t flags)
 Open a file for reading, writing, or appending.
error_t ftpWriteFile (FtpClientContext *context, const void *data, size_t length, uint_t flags)
 Write to a remote file.
error_t ftpReadFile (FtpClientContext *context, void *data, size_t size, size_t *length, uint_t flags)
 Read from a remote file.
error_t ftpCloseFile (FtpClientContext *context)
 Close file.
error_t ftpRenameFile (FtpClientContext *context, const char_t *oldName, const char_t *newName)
 Rename a remote file.
error_t ftpDeleteFile (FtpClientContext *context, const char_t *path)
 Delete a file.
error_t ftpClose (FtpClientContext *context)
 Close the connection with the FTP server.
error_t ftpSendCommand (FtpClientContext *context, const char_t *command, uint_t *replyCode)
 Send FTP command and wait for a reply.
error_t ftpRegisterTlsInitCallback (FtpClientContext *context, FtpClientTlsInitCallback callback)
 Register SSL initialization callback function.
error_t ftpInitControlTlsContext (FtpClientContext *context)
 SSL initialization (control connection)
error_t ftpInitDataTlsContext (FtpClientContext *context)
 SSL initialization (data connection)

Detailed Description

FTP client (File Transfer Protocol)

License

Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Description

File Transfer Protocol (FTP) is a standard network protocol used to transfer files from one host to another host over a TCP-based network. Refer to the following RFCs for complete details:

  • RFC 959: File Transfer Protocol (FTP)
  • RFC 2428: FTP Extensions for IPv6 and NATs
Author:
Oryx Embedded SARL (www.oryx-embedded.com)
Version:
1.7.6

Definition in file ftp_client.c.


Function Documentation

error_t ftpAuth ( FtpClientContext *  context )

Request authentication.

Parameters:
[in]contextPointer to the FTP client context
Returns:
Error code

Definition at line 502 of file ftp_client.c.

error_t ftpChangeToParentDir ( FtpClientContext *  context )

Change the current working directory to the parent directory.

Parameters:
[in]contextPointer to the FTP client context
Returns:
Error code

Definition at line 695 of file ftp_client.c.

error_t ftpChangeWorkingDir ( FtpClientContext *  context,
const char_t *  path 
)

Change the current working directory of the FTP session.

Parameters:
[in]contextPointer to the FTP client context
[in]pathThe new current working directory
Returns:
Error code

Definition at line 662 of file ftp_client.c.

error_t ftpClose ( FtpClientContext *  context )

Close the connection with the FTP server.

Parameters:
[in]contextPointer to the FTP client context
Returns:
Error code

Definition at line 1242 of file ftp_client.c.

error_t ftpCloseFile ( FtpClientContext *  context )

Close file.

Parameters:
[in]contextPointer to the FTP client context
Returns:
Error code

Definition at line 1110 of file ftp_client.c.

error_t ftpConnect ( FtpClientContext *  context,
NetInterface *  interface,
const IpAddr serverIpAddr,
uint16_t  serverPort,
uint_t  flags 
)

Establish a connection with the specified FTP server.

Parameters:
[in]contextPointer to the FTP client context
[in]interfaceUnderlying network interface (optional parameter)
[in]serverIpAddrIP address of the FTP server
[in]serverPortPort number
[in]flagsConnection options
Returns:
Error code

Definition at line 353 of file ftp_client.c.

error_t ftpDeleteFile ( FtpClientContext *  context,
const char_t *  path 
)

Delete a file.

Parameters:
[in]contextPointer to the FTP client context
[in]pathPath to the file to be be deleted
Returns:
Error code

Definition at line 1209 of file ftp_client.c.

error_t ftpGetWorkingDir ( FtpClientContext *  context,
char_t *  path,
size_t  size 
)

Get the working directory from the FTP server.

Parameters:
[in]contextPointer to the FTP client context
[out]pathOutput buffer where to store the current directory
[in]sizeSize of the output buffer
Returns:
Error code

Definition at line 601 of file ftp_client.c.

error_t ftpInitControlTlsContext ( FtpClientContext *  context )

SSL initialization (control connection)

Parameters:
[in]contextPointer to the FTP client context
Returns:
Error code

Definition at line 1418 of file ftp_client.c.

error_t ftpInitDataTlsContext ( FtpClientContext *  context )

SSL initialization (data connection)

Parameters:
[in]contextPointer to the FTP client context
Returns:
Error code

Definition at line 1498 of file ftp_client.c.

error_t ftpLogin ( FtpClientContext *  context,
const char_t *  username,
const char_t *  password,
const char_t *  account 
)

Login to the FTP server using the provided username and password.

Parameters:
[in]contextPointer to the FTP client context
[in]usernameThe username to login under
[in]passwordThe password to use
[in]accountAccount name
Returns:
Error code

Definition at line 535 of file ftp_client.c.

error_t ftpMakeDir ( FtpClientContext *  context,
const char_t *  path 
)

Create a new directory.

Parameters:
[in]contextPointer to the FTP client context
[in]pathThe name of the new directory
Returns:
Error code

Definition at line 726 of file ftp_client.c.

error_t ftpOpenFile ( FtpClientContext *  context,
const char_t *  path,
uint_t  flags 
)

Open a file for reading, writing, or appending.

Parameters:
[in]contextPointer to the FTP client context
[in]pathPath to the file to be be opened
[in]flagsAccess mode
Returns:
Error code

Definition at line 795 of file ftp_client.c.

error_t ftpReadFile ( FtpClientContext *  context,
void *  data,
size_t  size,
size_t *  length,
uint_t  flags 
)

Read from a remote file.

Parameters:
[in]contextPointer to the FTP client context
[out]dataBuffer where to store the incoming data
[in]sizeMaximum number of bytes that can be read
[out]lengthActual number of bytes that have been read
[in]flagsSet of flags that influences the behavior of this function
Returns:
Error code

Definition at line 1077 of file ftp_client.c.

error_t ftpRegisterTlsInitCallback ( FtpClientContext *  context,
FtpClientTlsInitCallback  callback 
)

Register SSL initialization callback function.

Parameters:
[in]contextPointer to the FTP client context
[in]callbackSSL initialization callback function
Returns:
Error code

Definition at line 1397 of file ftp_client.c.

error_t ftpRemoveDir ( FtpClientContext *  context,
const char_t *  path 
)

Remove a directory on the FTP server.

Parameters:
[in]contextPointer to the FTP client context
[in]pathPath to the directory to be removed
Returns:
Error code

Definition at line 760 of file ftp_client.c.

error_t ftpRenameFile ( FtpClientContext *  context,
const char_t *  oldName,
const char_t *  newName 
)

Rename a remote file.

Parameters:
[in]contextPointer to the FTP client context
[in]oldNameThe name of the remote file to rename
[in]newNameThe new name of the remote file
Returns:
Error code

Definition at line 1161 of file ftp_client.c.

error_t ftpSendCommand ( FtpClientContext *  context,
const char_t *  command,
uint_t *  replyCode 
)

Send FTP command and wait for a reply.

Parameters:
[in]contextPointer to the FTP client context
[in]commandCommand line
[out]replyCodeResponse code from the FTP server
Returns:
Error code

Definition at line 1299 of file ftp_client.c.

error_t ftpSetDataChannelProtectionLevel ( FtpClientContext *  context,
char_t  level 
)

Set data channel protection level.

Parameters:
[in]contextPointer to the FTP client context
[in]levelCharacter specifying the data channel protection level
Returns:
Error code

Definition at line 316 of file ftp_client.c.

error_t ftpSetPassiveMode ( FtpClientContext *  context,
uint16_t *  port 
)

Enter passive mode.

Parameters:
[in]contextPointer to the FTP client context
[out]portThe port number the server is listening on
Returns:
Error code

Definition at line 137 of file ftp_client.c.

error_t ftpSetPort ( FtpClientContext *  context,
const IpAddr ipAddr,
uint16_t  port 
)

Set the port to be used in data connection.

Parameters:
[in]contextPointer to the FTP client context
[in]ipAddrHost address
[in]portPort number
Returns:
Error code

Definition at line 60 of file ftp_client.c.

error_t ftpSetProtectionBufferSize ( FtpClientContext *  context,
uint32_t  size 
)

Set protection buffer size.

Parameters:
[in]contextPointer to the FTP client context
[in]sizeProtection buffer size
Returns:
Error code

Definition at line 282 of file ftp_client.c.

error_t ftpSetType ( FtpClientContext *  context,
char_t  type 
)

Set representation type.

Parameters:
[in]contextPointer to the FTP client context
[in]typeSingle character identifying the desired type
Returns:
Error code

Definition at line 248 of file ftp_client.c.

error_t ftpWriteFile ( FtpClientContext *  context,
const void *  data,
size_t  length,
uint_t  flags 
)

Write to a remote file.

Parameters:
[in]contextPointer to the FTP client context
[in]dataPointer to a buffer containing the data to be written
[in]lengthNumber of data bytes to write
[in]flagsSet of flags that influences the behavior of this function
Returns:
Error code

Definition at line 1040 of file ftp_client.c.