Nut/OS  4.10.3
API Reference
ftpd.c File Reference

FTP server. More...

#include <sys/version.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
#include <sys/timer.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#include <memdebug.h>
#include <pro/ftpd.h>
Include dependency graph for ftpd.c:

Go to the source code of this file.

Functions

int NutFtpRespondOk (FTPSESSION *session, int code)
 Send a positive response.
int NutFtpRespondBad (FTPSESSION *session, int code)
 Send a negative response.
int NutFtpSendMode (FTPSESSION *session, int binary)
 Send a response including the specified transfer mode.
char * CreateFullPathName (char *root, char *work, char *path)
 Create an absolute path name.
TCPSOCKETNutFtpDataConnect (FTPSESSION *session)
 Establish an FTP connection for data transfer.
int NutRegisterFtpRoot (CONST char *path)
 Register the FTP server's root directory.
int NutRegisterFtpUser (CONST char *user, CONST char *pass)
 Register an FTP user.
FTPSESSIONNutFtpOpenSession (TCPSOCKET *sock)
 Open an FTP server session.
void NutFtpCloseSession (FTPSESSION *session)
 Close an FTP server session.
int NutFtpProcessCwd (FTPSESSION *session, char *path)
 Process an FTP client's CWD command.
int NutFtpProcessDelete (FTPSESSION *session, char *path)
 Process an FTP client's DELE command.
int NutFtpTransferFile (FTPSESSION *session, char *path, int mode)
 Transfer a file to or from the FTP client.
int NutFtpTransferDirectoryOptions (FTPSESSION *session, char *path, int options)
 Process an FTP client's LIST or NLST command.
int NutFtpTransferDirectory (FTPSESSION *session, char *path)
 Process an FTP client's LIST or NLST command.
int NutFtpProcessMkd (FTPSESSION *session, char *path)
 Process an FTP client's MKD command.
int NutFtpRenamePrepare (FTPSESSION *session, char *path)
int NutFtpRenameAction (FTPSESSION *session, char *path)
int NutFtpProcessPass (FTPSESSION *session, char *pass)
 Process an FTP client's PASS command.
int NutFtpProcessPassiv (FTPSESSION *session)
 Process an FTP client's PASV command.
int NutFtpProcessPort (FTPSESSION *session, char *args)
 Process an FTP client's PORT command.
int NutFtpProcessPwd (FTPSESSION *session)
 Process an FTP client's PWD command.
int NutFtpProcessRmd (FTPSESSION *session, char *path)
 Process an FTP client's RMD command.
int NutFtpProcessSystem (FTPSESSION *session)
 Process an FTP client's SYST command.
int NutFtpProcessType (FTPSESSION *session, char *typecode)
 Process an FTP client's TYPE command.
int NutFtpProcessUser (FTPSESSION *session, char *user)
 Process an FTP client's USER command.
int NutFtpProcessRequest (FTPSESSION *session, char *request)
 Process an FTP request.
int NutFtpServerSession (TCPSOCKET *sock)
 Process an FTP sever session.

FTP Server Configuration

The Nut/OS Configurator may be used to override the default values.

#define FTP_ROOTPATH   "PNUT:"
 Default FTP root path.
#define FTP_DATA_PORT   20
 Default data port.

Detailed Description

FTP server.

 *
 * By Malte Marwedel:
 *  - Adding move command (RNFR, RNTO)
 *  - (AVR) Moving strings from RAM to flash
 *  - Add support for list with -la option
 *  - Checks if file is a real file before accepting a GET
 *  - Fixing GET if network is busy
 *  - Fixing "cd foo", "cd ../bar" bug (path should be "/bar" was "//bar")
 *  - Note: Passive mode is not implemented properly, try to use active instead
 *
 * $Log$
 * Revision 1.12  2009/02/13 14:52:05  haraldkipp
 * Include memdebug.h for heap management debugging support.
 *
 * Revision 1.11  2009/02/06 15:40:29  haraldkipp
 * Using newly available strdup() and calloc().
 * Replaced NutHeap routines by standard malloc/free.
 * Replaced pointer value 0 by NULL.
 *
 * Revision 1.10  2008/08/11 07:00:35  haraldkipp
 * BSD types replaced by stdint types (feature request #1282721).
 *
 * Revision 1.9  2008/04/01 10:16:35  haraldkipp
 * Added S_ISDIR and S_ISREG macro.
 *
 * Revision 1.8  2006/10/08 16:48:22  haraldkipp
 * Documentation fixed
 *
 * Revision 1.7  2006/03/16 15:25:38  haraldkipp
 * Changed human readable strings from u_char to char to stop GCC 4 from
 * nagging about signedness.
 *
 * Revision 1.6  2006/02/23 15:48:08  haraldkipp
 * Added missing file truncation flag for overriding existing files.
 *
 * Revision 1.5  2006/01/25 18:47:42  haraldkipp
 * Fixes wrong implementation of readdir() and simplifies the code.
 * Thanks to Jesper Hansen.
 *
 * Revision 1.4  2006/01/22 17:45:29  haraldkipp
 * CreateFullPathName() partly returned double slashes or empty paths.
 *
 * Revision 1.3  2005/08/02 17:47:04  haraldkipp
 * Major API documentation update.
 *
 * Revision 1.2  2005/02/07 18:57:51  haraldkipp
 * ICCAVR compile errors fixed
 *
 * Revision 1.1  2005/02/05 20:45:38  haraldkipp
 * First release.
 *
 *
 * 

Definition in file ftpd.c.