tfFtpdSslUserStart

Jump to: navigation, search

Table of Contents >> Application Reference >> FTPD API


#include <trsocket.h>


int tfFtpdSslUserStart (
int fileFlags,
int maxConnections,
int maxBackLog,
int idleTimeout,
int blockingState,
ttUser32Bit flags,
int sslCtrlPermissions,
int sslDataPermissions,
int ftpdSslSessionId,
ttUserGenericUnion reserved
);


Function Description

This function opens an FTP server socket, sets FTPS global parameters, and starts listening for incoming connections. tfFtpdSslUserStart can be either blocking or non-blocking as specified by its blockingState parameter. This function should not be called until SSL has been initialized and certificates have been added.

Usage in Blocking Mode

In blocking mode, tfFtpdSslUserStart() should be called from a task. tfFtpdSslUserStart() will not return unless an error occurs. It will block and wait for incoming connections, and execute the FTP server code in the context of the calling task. Choose the blocking mode if you are using an RTOS/Kernel.

Usage in Non-Blocking Mode

In non-blocking mode, tfFtpdSslUserStart() will return immediately after listening for incoming connections. It is the user's responsibility to then call tfFtpdUserExecute() periodically to execute the FTP server code. Choose the non-blocking mode if you do not have an RTOS/Kernel.


Parameters

  • fileFlags
    Indicates which FTP file commands are supported by the file system. It is the result of ORing together the file system flags described below.
  • maxConnections
    Maximum number of concurrent accepted incoming FTP connections allowed. If zero, then the FTP server will accept as many connections as there are available sockets.
  • maxBackLog
    Maximum number of concurrent pending (before being accepted) incoming FTP connections allowed.
  • idleTimeout
    Amount of time in seconds that a connection can sit idle before the server closes that connection. The idle Timeout value cannot be less than 300 seconds (5 minutes).
  • blockingState
    TM_BLOCKING_ON for blocking mode, TM_BLOCKING_OFF for nonblocking mode.
  • flags
    The flags that will be passed to tfNgFtpdUserStart().
  • sslCtrlPermissions
0 indicates no securities are allowed
1 indicates that securities are allowed if requested by client.
2 indicates that securities are required to interact with the server
  • sslDataPermissions
0 indicates no securities are allowed
1 indicates that securities are allowed if requested by client.
2 indicates that securities are required to interact with the server
  • ftpdSslSessionId
    Server SSL session ID returned by tfSslNewSession().
  • sslServerCert
    The current server certificate
  • authOpts
    Whether or not clients are required to authenticate with a valid SSL certificate.
  • reserved
    An unused parameter for future backwards compatibility


File System Flags

Flag Description
TM_FS_CWD_FLAG Supports change working directory.
TM_FS_SMNT_FLAG Supports structure mount.
TM_FS_RETR_FLAG Supports reading from a file.
TM_FS_STOR_FLAG Supports writing to a file.
TM_FS_STORU_FLAG Supports writing to a file, making up a new name, if the file name already exists.
TM_FS_APPEND_FLAG Supports append to a file.
TM_FS_RENAME_FLAG Supports renaming of file name.
TM_FS_DELETE_FLAG Supports deletion of file.
TM_FS_RMD_FLAG Supports removing directory.
TM_FS_MKD_FLAG Supports making directory.
TM_FS_PWD_FLAG Supports retrieving the current working directory.
TM_FS_LIST_FLAG Supports long listing of directory (file names, volume, and directories)
TM_FS_NLST_FLAG Supports short listing of directory (file names only)
TM_FS_CR_LF_FLAG The file system end of line is CR, LF
TM_FS_RECORD_FLAG The file system supports record structures. If this flag is set the FTP server will interpret the FTP record bytes if the FTP client transfers data with record structure.
TM_FS_ALLCMND_MASK ORing of all above command flags.


Returns

  • TM_ENOERROR
    Success.
  • TM_EINVAL
    Incorrect file flag specified.
  • TM_EINVAL
    maxConnections is either negative, or if non zero exceeds or equals the current number of available FTP connections.
  • TM_EINVAL
    maxBackLog is either negative or null, or exceeds or equals the current number of available FTP connections.
  • TM_EINVAL
    The idle timeout is less than 300 seconds.
  • TM_EINVAL
    blockingState is neither TM_BLOCKING_ON, nor TM_BLOCKING_OFF.
  • TM_EALREADY
    tfFtpdUserStart() has already been called.
  • TM_EMFILE
    No more socket available to open the FTPD listening socket.
  • TM_ENOBUFS
    Insufficient user memory available to complete the operation.
  • TM_EADDRINUSE
    The FTP server port is already in use.
  • TM_ENOMEM
    Could not obtain a counting semaphore to be used for blocking the FTP server (blocking mode only).


Table of Contents >> Application Reference >> FTPD API