EtherLib/apps/ftp_server.h
2024-04-23 23:31:41 +02:00

46 lines
1.2 KiB
C

#ifndef APPS_FTP_SERVER
#define APPS_FTP_SERVER
#include <etherlib/etherlib.h>
#include <etherlib/cbd_table.h>
#define FTPS_CTRL_PORT (21) // FTP server control connection port
#define FTPS_EVENT_QUEUE_LENGTH (8) // internal event queue length
#define FTPS_LINEBUF_LEN (63)
#define FTPS_ROOT_DIR_NAME "ftp_root"
/**
* FTP connection state machine states.
*/
typedef enum {
FTPS_IDLE, // the server is IDLE
FTPS_LOGGING_IN, // the client is logging in
FTPS_ESTABLISHED // the connection is established
} Ftps_ConnState;
/**
* FTP connection events.
*/
typedef enum {
FTPEVT_NONE, // no action
FTPEVT_NEW_CONNECTION, // a new connection was recently initiated
FTPEVT_CTRL_RECVD, // a control message has been received
} Ftps_ConnEvents;
typedef struct {
cbd connCtrlS; // control connection server
cbd connCtrl; // established control connection
cbd connDataS; // data connection server
cbd connData; // established data connection
Ftps_ConnState connState; // connection state
ETHLIB_OS_QUEUE_TYPE eventQ; // event queue
char lineBuffer[FTPS_LINEBUF_LEN + 1]; // line buffer
} Ftps_State;
void ftps_init();
#endif /* APPS_FTP_SERVER */