NetBurner 3.5.0
PDF Version
 
ftpd.h File Reference

NetBurner FTP Server Core API. More...

#include <nettypes.h>

Go to the source code of this file.

Macros

#define FTPD_FAIL   (0)
 Operation failed.
 
#define FTPD_OK   (1)
 Operation succeeded.
 
#define FTPD_RUNNING   (2)
 FTP Server running.
 
#define FTPD_NOT_RUNNING   (3)
 FTP Server not running.
 
#define FTPD_LISTEN_ERR   (4)
 FTP listen socket could not be opened, or is not open.
 
#define FTPD_FILE_SIZE_NOSUCH_FILE   (-1)
 No such file.
 
#define FTPD_FILE_SIZE_UNKNOWN   (0)
 File size unknown.
 

Functions

FTP Session callback functions that must be implemented by the programmer
void * FTPDSessionStart (const char *user, const char *passwd, const IPADDR4 hi_ip)
 Start an FTP user session (User) This function is called following the creation of a new FTP session. The function needs to determine the validity of the user/password pair. The returned void pointer will be passed to all access functions, which will be asked to determine the validity of the operation based on the permissions associated with the return value.
 
void FTPDSessionEnd (void *pSession)
 Indicate an FTP user session will be terminated. This callback function gives the user program the opportunity to clean up any storage associated with the void pointer returned from the FTPBSessionStart( ) call.
 
FTP Directory callback functions that must be implemented by the programmer
int FTPD_DirectoryExists (const char *full_directory, void *pSession)
 Called by the FTP Server to test for the existence of a directory Called by the FTP Server as the result of an attempt to change to a new directory. This function can also be used to validate the permissions of the session. This function must be implemented by the programmer.
 
int FTPD_CreateSubDirectory (const char *current_directory, const char *new_dir, void *pSession)
 Called by the FTP Server to create a directory Called by the FTP Server as the result of an attempt to create a new directory. This function can also be used to validate the permissions of the session. This function must be implemented by the programmer.
 
int FTPD_DeleteSubDirectory (const char *current_directory, const char *sub_dir, void *pSession)
 Called by the FTP Server to delete a directory Called by the FTP Server as the result of an attempt to delete a subdirectory. This function call can be used to validate the permissions of this session. This function must be implemented by the programmer.
 
int FTPD_ListSubDirectories (const char *current_directory, void *pSession, FTPDCallBackReportFunct *pFunc, int handle)
 Called by the FTP Server to list all subdirectories under the current directory Called by the FTP Server as the result of a client's attempt to list the contents of a directory. This function must be implemented by the programmer.
 
FTP file callback functions that must be implemented by the programmer
int FTPD_FileExists (const char *full_directory, const char *file_name, void *pSession)
 Report on the whether or not a file exists Check for the existence of a file, usually just before an attempt is made to download the file. This function must be implemented by the programmer.
 
int FTPD_GetFileSize (const char *full_directory, const char *file_name)
 Returns the size of a specific file.
 
int FTPD_SendFileToClient (const char *full_directory, const char *file_name, void *pSession, int fd)
 Send the contents of a file to a file descriptor Send a file to a FTP client. This function must be implemented by the programmer.
 
int FTPD_AbleToCreateFile (const char *full_directory, const char *file_name, void *pSession)
 Report on the ability to create/receive a file Determine if a file can be created. This function must be implemented by the programmer.
 
int FTPD_GetFileFromClient (const char *full_directory, const char *file_name, void *pSession, int fd)
 Create/get a file Receive a file from the FTP client. This function must be implemented by the programmer.
 
int FTPD_DeleteFile (const char *current_directory, const char *file_name, void *pSession)
 Delete a file Delete a file. This function must be implemented by the programmer.
 
int FTPD_Rename (const char *current_directory, const char *cur_file_name, const char *new_file_name, void *pSession)
 Rename a file Rename a file. This function must be implemented by the programmer.
 
int FTPD_ListFile (const char *current_directory, void *pSession, FTPDCallBackReportFunct *pFunc, int handle)
 Lists all files in the current directory List all files in the current directory. This function must be implemented by the programmer.
 

Initialization functions

typedef void FTPDCallBackReportFunct(int handle, const char *name_to_report)
 FTP Session callback typedef Typedef for all directory reporting callbacks This callback type definition is used by the directory reporting functions.
 
int FTPDStartSSL (uint16_t port, uint8_t server_priority, bool enableFTPS=false, bool encryptData=false)
 Starts the FTP Server task (SSL) Listens for incoming connections. Only one instance of the FTPD is allowed.
 
int FTPDStart (uint16_t port, uint8_t server_priority)
 Starts the FTP Server task (non-SSL/TLS) Listens for incoming connections. Only one instance of the FTPD is allowed. If FTPD SSL support exists, FTPDStartSSL() may be used instead.
 
int FTPDStopReq ()
 Stops the FTP Server task Sends a stop request to the currently running FTPD.
 

Detailed Description

NetBurner FTP Server Core API.