#ifndef APPS_FTP_SERVER #define APPS_FTP_SERVER #include #include #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) /** * 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; /** * FTP server state. */ typedef struct { EthInterface * intf; // pointer to associated Ethernet interface bool passiveMode; // indicates whether the server is operating in passive mode uint16_t passiveModePort; // passive mode port once the passive mode is activated 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 ETHLIB_OS_SEM_TYPE dataConnHasOpened; // semaphore synchronizing data connection opening char lineBuffer[FTPS_LINEBUF_LEN + 1]; // line buffer } Ftps_State; void ftps_init(); #endif /* APPS_FTP_SERVER */