ftp_server.c
Go to the documentation of this file.
1 /**
2  * @file ftp_server.c
3  * @brief FTP server (File Transfer Protocol)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2026 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @section Description
28  *
29  * File Transfer Protocol (FTP) is a standard network protocol used to
30  * transfer files from one host to another host over a TCP-based network.
31  * Refer to the following RFCs for complete details:
32  * - RFC 959: File Transfer Protocol (FTP)
33  * - RFC 3659: Extensions to FTP
34  * - RFC 2428: FTP Extensions for IPv6 and NATs
35  *
36  * @author Oryx Embedded SARL (www.oryx-embedded.com)
37  * @version 2.6.0
38  **/
39 
40 //Switch to the appropriate trace level
41 #define TRACE_LEVEL FTP_TRACE_LEVEL
42 
43 //Dependencies
44 #include "core/net.h"
45 #include "ftp/ftp_server.h"
46 #include "ftp/ftp_server_control.h"
47 #include "ftp/ftp_server_data.h"
48 #include "ftp/ftp_server_misc.h"
49 #include "path.h"
50 #include "debug.h"
51 
52 //Check TCP/IP stack configuration
53 #if (FTP_SERVER_SUPPORT == ENABLED)
54 
55 
56 /**
57  * @brief Initialize settings with default values
58  * @param[out] settings Structure that contains FTP server settings
59  **/
60 
62 {
63  //Default task parameters
64  settings->task = OS_TASK_DEFAULT_PARAMS;
66  settings->task.priority = FTP_SERVER_PRIORITY;
67 
68  //TCP/IP stack context
69  settings->netContext = NULL;
70  //The FTP server is not bound to any interface
71  settings->interface = NULL;
72 
73  //FTP command port number
74  settings->port = FTP_PORT;
75  //FTP data port number
76  settings->dataPort = FTP_DATA_PORT;
77 
78  //Passive port range
81 
82  //Public IPv4 address to be used in PASV replies
84 
85  //Default security mode (no security)
86  settings->mode = FTP_SERVER_MODE_PLAINTEXT;
87 
88  //Client connections
89  settings->maxConnections = 0;
90  settings->connections = NULL;
91 
92  //Set root directory
93  settings->rootDir = NULL;
94 
95  //Connection callback function
96  settings->connectCallback = NULL;
97  //Disconnection callback function
98  settings->disconnectCallback = NULL;
99 
100 #if (FTP_SERVER_TLS_SUPPORT == ENABLED)
101  //TLS initialization callback function
102  settings->tlsInitCallback = NULL;
103 #endif
104 
105  //User verification callback function
106  settings->checkUserCallback = NULL;
107  //Password verification callback function
108  settings->checkPasswordCallback = NULL;
109  //Callback used to retrieve file permissions
110  settings->getFilePermCallback = NULL;
111  //Unknown command callback function
112  settings->unknownCommandCallback = NULL;
113 }
114 
115 
116 /**
117  * @brief FTP server initialization
118  * @param[in] context Pointer to the FTP server context
119  * @param[in] settings FTP server specific settings
120  * @return Error code
121  **/
122 
124  const FtpServerSettings *settings)
125 {
126  error_t error;
127  uint_t i;
128 
129  //Debug message
130  TRACE_INFO("Initializing FTP server...\r\n");
131 
132  //Ensure the parameters are valid
133  if(context == NULL || settings == NULL)
135 
136  //Sanity check
137  if(settings->passivePortMax <= settings->passivePortMin)
138  {
140  }
141 
142  //Invalid number of client connections?
143  if(settings->connections == NULL || settings->maxConnections < 1 ||
145  {
147  }
148 
149  //Invalid root directory?
150  if(settings->rootDir == NULL ||
152  {
154  }
155 
156  //Initialize status code
157  error = NO_ERROR;
158 
159  //Clear the FTP server context
160  osMemset(context, 0, sizeof(FtpServerContext));
161 
162  //Initialize task parameters
163  context->taskParams = settings->task;
164  context->taskId = OS_INVALID_TASK_ID;
165 
166  //Attach TCP/IP stack context
167  if(settings->netContext != NULL)
168  {
169  context->netContext = settings->netContext;
170  }
171  else if(settings->interface != NULL)
172  {
173  context->netContext = settings->interface->netContext;
174  }
175  else
176  {
177  context->netContext = netGetDefaultContext();
178  }
179 
180  //Save user settings
181  context->interface = settings->interface;
182  context->port = settings->port;
183  context->dataPort = settings->dataPort;
184  context->passivePortMin = settings->passivePortMin;
185  context->passivePortMax = settings->passivePortMax;
186  context->publicIpv4Addr = settings->publicIpv4Addr;
187  context->mode = settings->mode;
188  context->maxConnections = settings->maxConnections;
189  context->connections = settings->connections;
190  context->connectCallback = settings->connectCallback;
191  context->disconnectCallback = settings->disconnectCallback;
192 #if (FTP_SERVER_TLS_SUPPORT == ENABLED)
193  context->tlsInitCallback = settings->tlsInitCallback;
194 #endif
195  context->checkUserCallback = settings->checkUserCallback;
196  context->checkPasswordCallback = settings->checkPasswordCallback;
197  context->getFilePermCallback = settings->getFilePermCallback;
198  context->unknownCommandCallback = settings->unknownCommandCallback;
199 
200  //Set root directory
201  osStrcpy(context->rootDir, settings->rootDir);
202 
203  //Clean the root directory path
204  pathCanonicalize(context->rootDir);
205  pathRemoveSlash(context->rootDir);
206 
207  //Loop through client connections
208  for(i = 0; i < context->maxConnections; i++)
209  {
210  //Initialize the structure representing the client connection
211  osMemset(&context->connections[i], 0, sizeof(FtpClientConnection));
212  }
213 
214  //Create an event object to poll the state of sockets
215  if(!osCreateEvent(&context->event))
216  {
217  //Failed to create event
218  error = ERROR_OUT_OF_RESOURCES;
219  }
220 
221 #if (FTP_SERVER_TLS_SUPPORT == ENABLED && TLS_TICKET_SUPPORT == ENABLED)
222  //Check status code
223  if(!error)
224  {
225  //Initialize ticket encryption context
226  error = tlsInitTicketContext(&context->tlsTicketContext);
227  }
228 #endif
229 
230  //Any error to report?
231  if(error)
232  {
233  //Clean up side effects
234  ftpServerDeinit(context);
235  }
236 
237  //Return status code
238  return error;
239 }
240 
241 
242 /**
243  * @brief Start FTP server
244  * @param[in] context Pointer to the FTP server context
245  * @return Error code
246  **/
247 
249 {
250  error_t error;
251 
252  //Make sure the FTP server context is valid
253  if(context == NULL)
255 
256  //Debug message
257  TRACE_INFO("Starting FTP server...\r\n");
258 
259  //Make sure the FTP server is not already running
260  if(context->running)
261  return ERROR_ALREADY_RUNNING;
262 
263  //Start of exception handling block
264  do
265  {
266  //Open a TCP socket
267  context->socket = socketOpenEx(context->netContext, SOCKET_TYPE_STREAM,
269  //Failed to open socket?
270  if(context->socket == NULL)
271  {
272  //Report an error
273  error = ERROR_OPEN_FAILED;
274  break;
275  }
276 
277  //Force the socket to operate in non-blocking mode
278  error = socketSetTimeout(context->socket, 0);
279  //Any error to report?
280  if(error)
281  break;
282 
283  //Adjust the size of the TX buffer
284  error = socketSetTxBufferSize(context->socket,
286  //Any error to report?
287  if(error)
288  break;
289 
290  //Adjust the size of the RX buffer
291  error = socketSetRxBufferSize(context->socket,
293  //Any error to report?
294  if(error)
295  break;
296 
297  //Associate the socket with the relevant interface
298  error = socketBindToInterface(context->socket, context->interface);
299  //Any error to report?
300  if(error)
301  break;
302 
303  //The FTP server listens for connection requests on port 21
304  error = socketBind(context->socket, &IP_ADDR_ANY, context->port);
305  //Any error to report?
306  if(error)
307  break;
308 
309  //Place socket in listening state
310  error = socketListen(context->socket, FTP_SERVER_BACKLOG);
311  //Any failure to report?
312  if(error)
313  break;
314 
315  //Start the FTP server
316  context->stop = FALSE;
317  context->running = TRUE;
318 
319  //Create a task
320  context->taskId = osCreateTask("FTP Server", (OsTaskCode) ftpServerTask,
321  context, &context->taskParams);
322 
323  //Failed to create task?
324  if(context->taskId == OS_INVALID_TASK_ID)
325  {
326  //Report an error
327  error = ERROR_OUT_OF_RESOURCES;
328  break;
329  }
330 
331  //End of exception handling block
332  } while(0);
333 
334  //Any error to report?
335  if(error)
336  {
337  //Clean up side effects
338  context->running = FALSE;
339 
340  //Close listening socket
341  socketClose(context->socket);
342  context->socket = NULL;
343  }
344 
345  //Return status code
346  return error;
347 }
348 
349 
350 /**
351  * @brief Stop FTP server
352  * @param[in] context Pointer to the FTP server context
353  * @return Error code
354  **/
355 
357 {
358  uint_t i;
359 
360  //Make sure the FTP server context is valid
361  if(context == NULL)
363 
364  //Debug message
365  TRACE_INFO("Stopping FTP server...\r\n");
366 
367  //Check whether the FTP server is running
368  if(context->running)
369  {
370 #if (NET_RTOS_SUPPORT == ENABLED)
371  //Stop the FTP server
372  context->stop = TRUE;
373  //Send a signal to the task to abort any blocking operation
374  osSetEvent(&context->event);
375 
376  //Wait for the task to terminate
377  while(context->running)
378  {
379  osDelayTask(1);
380  }
381 #endif
382 
383  //Loop through the connection table
384  for(i = 0; i < context->maxConnections; i++)
385  {
386  //Close client connection
387  ftpServerCloseConnection(&context->connections[i]);
388  }
389 
390  //Close listening socket
391  socketClose(context->socket);
392  context->socket = NULL;
393  }
394 
395  //Successful processing
396  return NO_ERROR;
397 }
398 
399 
400 /**
401  * @brief Set user's root directory
402  * @param[in] connection Pointer to the client connection
403  * @param[in] rootDir NULL-terminated string specifying the root directory
404  * @return Error code
405  **/
406 
408  const char_t *rootDir)
409 {
410  FtpServerContext *context;
411 
412  //Check parameters
413  if(connection == NULL || rootDir == NULL)
415 
416  //Point to the FTP server context
417  context = connection->context;
418 
419  //Set user's root directory
420  pathCopy(connection->rootDir, context->rootDir, FTP_SERVER_MAX_ROOT_DIR_LEN);
421  pathCombine(connection->rootDir, rootDir, FTP_SERVER_MAX_ROOT_DIR_LEN);
422 
423  //Clean the resulting path
424  pathCanonicalize(connection->rootDir);
425  pathRemoveSlash(connection->rootDir);
426 
427  //Set default user's home directory
428  pathCopy(connection->currentDir, connection->rootDir,
430 
431  //Successful processing
432  return NO_ERROR;
433 }
434 
435 
436 /**
437  * @brief Set user's home directory
438  * @param[in] connection Pointer to the client connection
439  * @param[in] homeDir NULL-terminated string specifying the home directory
440  * @return Error code
441  **/
442 
444  const char_t *homeDir)
445 {
446  FtpServerContext *context;
447 
448  //Check parameters
449  if(connection == NULL || homeDir == NULL)
451 
452  //Point to the FTP server context
453  context = connection->context;
454 
455  //Set user's home directory
456  pathCopy(connection->currentDir, context->rootDir, FTP_SERVER_MAX_PATH_LEN);
457  pathCombine(connection->currentDir, homeDir, FTP_SERVER_MAX_PATH_LEN);
458 
459  //Clean the resulting path
460  pathCanonicalize(connection->currentDir);
461  pathRemoveSlash(connection->currentDir);
462 
463  //Successful processing
464  return NO_ERROR;
465 }
466 
467 
468 /**
469  * @brief FTP server task
470  * @param[in] context Pointer to the FTP server context
471  **/
472 
474 {
475  error_t error;
476  uint_t i;
477  systime_t time;
478  systime_t timeout;
479  FtpClientConnection *connection;
480 
481 #if (NET_RTOS_SUPPORT == ENABLED)
482  //Task prologue
483  osEnterTask();
484 
485  //Process events
486  while(1)
487  {
488 #endif
489  //Set polling timeout
490  timeout = FTP_SERVER_TICK_INTERVAL;
491 
492  //Clear event descriptor set
493  osMemset(context->eventDesc, 0, sizeof(context->eventDesc));
494 
495  //Specify the events the application is interested in
496  for(i = 0; i < context->maxConnections; i++)
497  {
498  //Point to the structure describing the current connection
499  connection = &context->connections[i];
500 
501  //Check whether the control connection is active
502  if(connection->controlChannel.socket != NULL)
503  {
504  //Register the events related to the control connection
506  &context->eventDesc[2 * i]);
507 
508  //Check whether the socket is ready for I/O operation
509  if(context->eventDesc[2 * i].eventFlags != 0)
510  {
511  //No need to poll the underlying socket for incoming traffic
512  timeout = 0;
513  }
514  }
515 
516  //Check whether the data connection is active
517  if(connection->dataChannel.socket != NULL)
518  {
519  //Register the events related to the data connection
521  &context->eventDesc[2 * i + 1]);
522 
523  //Check whether the socket is ready for I/O operation
524  if(context->eventDesc[2 * i + 1].eventFlags != 0)
525  {
526  //No need to poll the underlying socket for incoming traffic
527  timeout = 0;
528  }
529  }
530  }
531 
532  //Accept connection request events
533  context->eventDesc[2 * i].socket = context->socket;
534  context->eventDesc[2 * i].eventMask = SOCKET_EVENT_RX_READY;
535 
536  //Wait for one of the set of sockets to become ready to perform I/O
537  error = socketPoll(context->eventDesc, 2 * context->maxConnections + 1,
538  &context->event, timeout);
539 
540  //Get current time
541  time = osGetSystemTime();
542 
543  //Check status code
544  if(error == NO_ERROR || error == ERROR_TIMEOUT ||
545  error == ERROR_WAIT_CANCELED)
546  {
547  //Stop request?
548  if(context->stop)
549  {
550  //Stop FTP server operation
551  context->running = FALSE;
552  //Task epilogue
553  osExitTask();
554  //Kill ourselves
556  }
557 
558  //Event-driven processing
559  for(i = 0; i < context->maxConnections; i++)
560  {
561  //Point to the structure describing the current connection
562  connection = &context->connections[i];
563 
564  //Check whether the control connection is active
565  if(connection->controlChannel.socket != NULL)
566  {
567  //Check whether the control socket is to ready to perform I/O
568  if(context->eventDesc[2 * i].eventFlags)
569  {
570  //Update time stamp
571  connection->timestamp = time;
572 
573  //Control connection event handler
575  context->eventDesc[2 * i].eventFlags);
576  }
577  }
578 
579  //Check whether the data connection is active
580  if(connection->dataChannel.socket != NULL)
581  {
582  //Check whether the data socket is ready to perform I/O
583  if(context->eventDesc[2 * i + 1].eventFlags)
584  {
585  //Update time stamp
586  connection->timestamp = time;
587 
588  //Data connection event handler
590  context->eventDesc[2 * i + 1].eventFlags);
591  }
592  }
593  }
594 
595  //Check the state of the listening socket
596  if(context->eventDesc[2 * i].eventFlags & SOCKET_EVENT_RX_READY)
597  {
598  //Accept connection request
600  }
601  }
602 
603  //Handle periodic operations
604  ftpServerTick(context);
605 
606 #if (NET_RTOS_SUPPORT == ENABLED)
607  }
608 #endif
609 }
610 
611 
612 /**
613  * @brief Release FTP server context
614  * @param[in] context Pointer to the FTP server context
615  **/
616 
618 {
619  //Make sure the FTP server context is valid
620  if(context != NULL)
621  {
622  //Free previously allocated resources
623  osDeleteEvent(&context->event);
624 
625 #if (FTP_SERVER_TLS_SUPPORT == ENABLED && TLS_TICKET_SUPPORT == ENABLED)
626  //Release ticket encryption context
627  tlsFreeTicketContext(&context->tlsTicketContext);
628 #endif
629 
630  //Clear FTP server context
631  osMemset(context, 0, sizeof(FtpServerContext));
632  }
633 }
634 
635 #endif
#define FtpServerContext
Definition: ftp_server.h:201
OsTaskId osCreateTask(const char_t *name, OsTaskCode taskCode, void *arg, const OsTaskParameters *params)
Create a task.
Path manipulation helper functions.
error_t socketBind(Socket *socket, const IpAddr *localIpAddr, uint16_t localPort)
Associate a local address with a socket.
Definition: socket.c:1344
error_t tlsInitTicketContext(TlsTicketContext *ticketContext)
Initialize ticket encryption context.
Definition: tls_ticket.c:49
error_t ftpServerInit(FtpServerContext *context, const FtpServerSettings *settings)
FTP server initialization.
Definition: ftp_server.c:123
uint16_t passivePortMin
Passive port range (lower value)
Definition: ftp_server.h:350
#define osExitTask()
FtpServerConnectCallback connectCallback
Connection callback function.
Definition: ftp_server.h:357
#define FTP_SERVER_MIN_TCP_BUFFER_SIZE
Definition: ftp_server.h:130
FTP data connection.
#define FTP_SERVER_PRIORITY
Definition: ftp_server.h:62
#define TRUE
Definition: os_port.h:50
#define OS_INVALID_TASK_ID
void socketClose(Socket *socket)
Close an existing socket.
Definition: socket.c:2094
@ ERROR_OUT_OF_RESOURCES
Definition: error.h:64
#define FTP_SERVER_MAX_PATH_LEN
Definition: ftp_server.h:123
error_t ftpServerSetHomeDir(FtpClientConnection *connection, const char_t *homeDir)
Set user's home directory.
Definition: ftp_server.c:443
NetInterface * interface
Underlying network interface.
Definition: ftp_server.h:347
uint16_t dataPort
FTP data port number.
Definition: ftp_server.h:349
#define osStrlen(s)
Definition: os_port.h:168
@ SOCKET_TYPE_STREAM
Definition: socket.h:92
#define OS_SELF_TASK_ID
#define FTP_SERVER_MAX_ROOT_DIR_LEN
Definition: ftp_server.h:109
uint_t mode
Security modes.
Definition: ftp_server.h:353
Helper functions for FTP server.
void ftpServerTick(FtpServerContext *context)
Handle periodic operations.
error_t socketSetTxBufferSize(Socket *socket, size_t size)
Specify the size of the TCP send buffer.
Definition: socket.c:1224
uint16_t passivePortMax
Passive port range (upper value)
Definition: ftp_server.h:351
FTP server settings.
Definition: ftp_server.h:344
void ftpServerTask(FtpServerContext *context)
FTP server task.
Definition: ftp_server.c:473
@ ERROR_OPEN_FAILED
Definition: error.h:75
const IpAddr IP_ADDR_ANY
Definition: ip.c:53
void pathCanonicalize(char_t *path)
Simplify a path.
Definition: path.c:162
OsTaskParameters task
Task parameters.
Definition: ftp_server.h:345
void osDeleteTask(OsTaskId taskId)
Delete a task.
NetContext * netContext
TCP/IP stack context.
Definition: ftp_server.h:346
#define FALSE
Definition: os_port.h:46
error_t socketSetRxBufferSize(Socket *socket, size_t size)
Specify the size of the TCP receive buffer.
Definition: socket.c:1261
FtpServerCheckPasswordCallback checkPasswordCallback
Password verification callback function.
Definition: ftp_server.h:363
@ ERROR_INVALID_PARAMETER
Invalid parameter.
Definition: error.h:47
FtpServerGetFilePermCallback getFilePermCallback
Callback used to retrieve file permissions.
Definition: ftp_server.h:364
error_t
Error codes.
Definition: error.h:43
void(* OsTaskCode)(void *arg)
Task routine.
Ipv4Addr publicIpv4Addr
Public IPv4 address to be used in PASV replies.
Definition: ftp_server.h:352
#define FTP_SERVER_TICK_INTERVAL
Definition: ftp_server.h:81
#define FTP_SERVER_BACKLOG
Definition: ftp_server.h:88
void ftpServerRegisterDataChannelEvents(FtpClientConnection *connection, SocketEventDesc *eventDesc)
Register data connection events.
void osDeleteEvent(OsEvent *event)
Delete an event object.
void ftpServerAcceptControlChannel(FtpServerContext *context)
Accept control connection.
void ftpServerCloseConnection(FtpClientConnection *connection)
Close client connection properly.
NetContext * netGetDefaultContext(void)
Get default TCP/IP stack context.
Definition: net.c:527
const OsTaskParameters OS_TASK_DEFAULT_PARAMS
void ftpServerGetDefaultSettings(FtpServerSettings *settings)
Initialize settings with default values.
Definition: ftp_server.c:61
#define TRACE_INFO(...)
Definition: debug.h:105
uint16_t port
FTP command port number.
Definition: ftp_server.h:348
error_t ftpServerSetRootDir(FtpClientConnection *connection, const char_t *rootDir)
Set user's root directory.
Definition: ftp_server.c:407
error_t ftpServerStop(FtpServerContext *context)
Stop FTP server.
Definition: ftp_server.c:356
#define osEnterTask()
error_t socketPoll(SocketEventDesc *eventDesc, uint_t size, OsEvent *extEvent, systime_t timeout)
Wait for one of a set of sockets to become ready to perform I/O.
Definition: socket.c:2182
#define socketBindToInterface
Definition: net_legacy.h:193
const char_t * rootDir
Root directory.
Definition: ftp_server.h:356
FtpServerTlsInitCallback tlsInitCallback
TLS initialization callback function.
Definition: ftp_server.h:360
#define FTP_SERVER_PASSIVE_PORT_MIN
Definition: ftp_server.h:165
error_t ftpServerStart(FtpServerContext *context)
Start FTP server.
Definition: ftp_server.c:248
uint32_t systime_t
System time.
@ ERROR_TIMEOUT
Definition: error.h:95
char char_t
Definition: compiler_port.h:55
#define FTP_SERVER_STACK_SIZE
Definition: ftp_server.h:55
uint32_t time
#define FTP_PORT
Definition: ftp_server.h:190
@ SOCKET_EVENT_RX_READY
Definition: socket.h:179
Socket * socketOpenEx(NetContext *context, uint_t type, uint_t protocol)
Create a socket.
Definition: socket.c:146
@ ERROR_WAIT_CANCELED
Definition: error.h:73
bool_t osCreateEvent(OsEvent *event)
Create an event object.
FtpClientConnection * connections
Client connections.
Definition: ftp_server.h:355
void ftpServerRegisterControlChannelEvents(FtpClientConnection *connection, SocketEventDesc *eventDesc)
Register control connection events.
FTP server (File Transfer Protocol)
FtpServerDisconnectCallback disconnectCallback
Disconnection callback function.
Definition: ftp_server.h:358
@ FTP_SERVER_MODE_PLAINTEXT
Definition: ftp_server.h:248
#define FtpClientConnection
Definition: ftp_server.h:205
#define FTP_SERVER_PASSIVE_PORT_MAX
Definition: ftp_server.h:172
void osDelayTask(systime_t delay)
Delay routine.
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
void ftpServerDeinit(FtpServerContext *context)
Release FTP server context.
Definition: ftp_server.c:617
FtpServerCheckUserCallback checkUserCallback
User verification callback function.
Definition: ftp_server.h:362
void pathRemoveSlash(char_t *path)
Remove the trailing slash from a given path.
Definition: path.c:376
FtpServerUnknownCommandCallback unknownCommandCallback
Unknown command callback function.
Definition: ftp_server.h:365
void tlsFreeTicketContext(TlsTicketContext *ticketContext)
Properly dispose ticket encryption context.
Definition: tls_ticket.c:448
#define FTP_SERVER_MAX_CONNECTIONS
Definition: ftp_server.h:67
uint_t maxConnections
Maximum number of client connections.
Definition: ftp_server.h:354
unsigned int uint_t
Definition: compiler_port.h:57
#define osMemset(p, value, length)
Definition: os_port.h:138
TCP/IP stack core.
#define FTP_DATA_PORT
Definition: ftp_server.h:192
#define osStrcpy(s1, s2)
Definition: os_port.h:210
@ SOCKET_IP_PROTO_TCP
Definition: socket.h:107
error_t socketSetTimeout(Socket *socket, systime_t timeout)
Set timeout value for blocking operations.
Definition: socket.c:169
void ftpServerProcessDataChannelEvents(FtpClientConnection *connection, uint_t eventFlags)
Data connection event handler.
FTP control connection.
@ ERROR_ALREADY_RUNNING
Definition: error.h:294
@ NO_ERROR
Success.
Definition: error.h:44
Debugging facilities.
#define IPV4_UNSPECIFIED_ADDR
Definition: ipv4.h:128
void pathCopy(char_t *dest, const char_t *src, size_t maxLen)
Copy a path.
Definition: path.c:141
void pathCombine(char_t *path, const char_t *more, size_t maxLen)
Concatenate two paths.
Definition: path.c:414
systime_t osGetSystemTime(void)
Retrieve system time.
void ftpServerProcessControlChannelEvents(FtpClientConnection *connection, uint_t eventFlags)
Control connection event handler.
error_t socketListen(Socket *socket, uint_t backlog)
Place a socket in the listening state.
Definition: socket.c:1441