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.4
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  context->checkUserCallback = settings->checkUserCallback;
193  context->checkPasswordCallback = settings->checkPasswordCallback;
194  context->getFilePermCallback = settings->getFilePermCallback;
195  context->unknownCommandCallback = settings->unknownCommandCallback;
196 
197 #if (FTP_SERVER_TLS_SUPPORT == ENABLED)
198  //TLS initialization callback
199  context->tlsInitCallback = settings->tlsInitCallback;
200 #endif
201 
202  //Set root directory
203  osStrcpy(context->rootDir, settings->rootDir);
204 
205  //Clean the root directory path
206  pathCanonicalize(context->rootDir);
207  pathRemoveSlash(context->rootDir);
208 
209  //Loop through client connections
210  for(i = 0; i < context->maxConnections; i++)
211  {
212  //Initialize the structure representing the client connection
213  osMemset(&context->connections[i], 0, sizeof(FtpClientConnection));
214  }
215 
216  //Create an event object to poll the state of sockets
217  if(!osCreateEvent(&context->event))
218  {
219  //Failed to create event
220  error = ERROR_OUT_OF_RESOURCES;
221  }
222 
223 #if (FTP_SERVER_TLS_SUPPORT == ENABLED && TLS_TICKET_SUPPORT == ENABLED)
224  //Check status code
225  if(!error)
226  {
227  //Initialize ticket encryption context
228  error = tlsInitTicketContext(&context->tlsTicketContext);
229  }
230 #endif
231 
232  //Any error to report?
233  if(error)
234  {
235  //Clean up side effects
236  ftpServerDeinit(context);
237  }
238 
239  //Return status code
240  return error;
241 }
242 
243 
244 /**
245  * @brief Start FTP server
246  * @param[in] context Pointer to the FTP server context
247  * @return Error code
248  **/
249 
251 {
252  error_t error;
253 
254  //Make sure the FTP server context is valid
255  if(context == NULL)
257 
258  //Debug message
259  TRACE_INFO("Starting FTP server...\r\n");
260 
261  //Make sure the FTP server is not already running
262  if(context->running)
263  return ERROR_ALREADY_RUNNING;
264 
265  //Start of exception handling block
266  do
267  {
268  //Open a TCP socket
269  context->socket = socketOpenEx(context->netContext, SOCKET_TYPE_STREAM,
271  //Failed to open socket?
272  if(context->socket == NULL)
273  {
274  //Report an error
275  error = ERROR_OPEN_FAILED;
276  break;
277  }
278 
279  //Force the socket to operate in non-blocking mode
280  error = socketSetTimeout(context->socket, 0);
281  //Any error to report?
282  if(error)
283  break;
284 
285  //Adjust the size of the TX buffer
286  error = socketSetTxBufferSize(context->socket,
288  //Any error to report?
289  if(error)
290  break;
291 
292  //Adjust the size of the RX buffer
293  error = socketSetRxBufferSize(context->socket,
295  //Any error to report?
296  if(error)
297  break;
298 
299  //Associate the socket with the relevant interface
300  error = socketBindToInterface(context->socket, context->interface);
301  //Any error to report?
302  if(error)
303  break;
304 
305  //The FTP server listens for connection requests on port 21
306  error = socketBind(context->socket, &IP_ADDR_ANY, context->port);
307  //Any error to report?
308  if(error)
309  break;
310 
311  //Place socket in listening state
312  error = socketListen(context->socket, FTP_SERVER_BACKLOG);
313  //Any failure to report?
314  if(error)
315  break;
316 
317  //Start the FTP server
318  context->stop = FALSE;
319  context->running = TRUE;
320 
321  //Create a task
322  context->taskId = osCreateTask("FTP Server", (OsTaskCode) ftpServerTask,
323  context, &context->taskParams);
324 
325  //Failed to create task?
326  if(context->taskId == OS_INVALID_TASK_ID)
327  {
328  //Report an error
329  error = ERROR_OUT_OF_RESOURCES;
330  break;
331  }
332 
333  //End of exception handling block
334  } while(0);
335 
336  //Any error to report?
337  if(error)
338  {
339  //Clean up side effects
340  context->running = FALSE;
341 
342  //Close listening socket
343  socketClose(context->socket);
344  context->socket = NULL;
345  }
346 
347  //Return status code
348  return error;
349 }
350 
351 
352 /**
353  * @brief Stop FTP server
354  * @param[in] context Pointer to the FTP server context
355  * @return Error code
356  **/
357 
359 {
360  uint_t i;
361 
362  //Make sure the FTP server context is valid
363  if(context == NULL)
365 
366  //Debug message
367  TRACE_INFO("Stopping FTP server...\r\n");
368 
369  //Check whether the FTP server is running
370  if(context->running)
371  {
372 #if (NET_RTOS_SUPPORT == ENABLED)
373  //Stop the FTP server
374  context->stop = TRUE;
375  //Send a signal to the task to abort any blocking operation
376  osSetEvent(&context->event);
377 
378  //Wait for the task to terminate
379  while(context->running)
380  {
381  osDelayTask(1);
382  }
383 #endif
384 
385  //Loop through the connection table
386  for(i = 0; i < context->maxConnections; i++)
387  {
388  //Close client connection
389  ftpServerCloseConnection(&context->connections[i]);
390  }
391 
392  //Close listening socket
393  socketClose(context->socket);
394  context->socket = NULL;
395  }
396 
397  //Successful processing
398  return NO_ERROR;
399 }
400 
401 
402 /**
403  * @brief Set user's root directory
404  * @param[in] connection Pointer to the client connection
405  * @param[in] rootDir NULL-terminated string specifying the root directory
406  * @return Error code
407  **/
408 
410  const char_t *rootDir)
411 {
412  FtpServerContext *context;
413 
414  //Check parameters
415  if(connection == NULL || rootDir == NULL)
417 
418  //Point to the FTP server context
419  context = connection->context;
420 
421  //Set user's root directory
422  pathCopy(connection->rootDir, context->rootDir, FTP_SERVER_MAX_ROOT_DIR_LEN);
423  pathCombine(connection->rootDir, rootDir, FTP_SERVER_MAX_ROOT_DIR_LEN);
424 
425  //Clean the resulting path
426  pathCanonicalize(connection->rootDir);
427  pathRemoveSlash(connection->rootDir);
428 
429  //Set default user's home directory
430  pathCopy(connection->currentDir, connection->rootDir,
432 
433  //Successful processing
434  return NO_ERROR;
435 }
436 
437 
438 /**
439  * @brief Set user's home directory
440  * @param[in] connection Pointer to the client connection
441  * @param[in] homeDir NULL-terminated string specifying the home directory
442  * @return Error code
443  **/
444 
446  const char_t *homeDir)
447 {
448  FtpServerContext *context;
449 
450  //Check parameters
451  if(connection == NULL || homeDir == NULL)
453 
454  //Point to the FTP server context
455  context = connection->context;
456 
457  //Set user's home directory
458  pathCopy(connection->currentDir, context->rootDir, FTP_SERVER_MAX_PATH_LEN);
459  pathCombine(connection->currentDir, homeDir, FTP_SERVER_MAX_PATH_LEN);
460 
461  //Clean the resulting path
462  pathCanonicalize(connection->currentDir);
463  pathRemoveSlash(connection->currentDir);
464 
465  //Successful processing
466  return NO_ERROR;
467 }
468 
469 
470 /**
471  * @brief FTP server task
472  * @param[in] context Pointer to the FTP server context
473  **/
474 
476 {
477  error_t error;
478  uint_t i;
479  systime_t time;
480  systime_t timeout;
481  FtpClientConnection *connection;
482 
483 #if (NET_RTOS_SUPPORT == ENABLED)
484  //Task prologue
485  osEnterTask();
486 
487  //Process events
488  while(1)
489  {
490 #endif
491  //Set polling timeout
492  timeout = FTP_SERVER_TICK_INTERVAL;
493 
494  //Clear event descriptor set
495  osMemset(context->eventDesc, 0, sizeof(context->eventDesc));
496 
497  //Specify the events the application is interested in
498  for(i = 0; i < context->maxConnections; i++)
499  {
500  //Point to the structure describing the current connection
501  connection = &context->connections[i];
502 
503  //Check whether the control connection is active
504  if(connection->controlChannel.socket != NULL)
505  {
506  //Register the events related to the control connection
508  &context->eventDesc[2 * i]);
509 
510  //Check whether the socket is ready for I/O operation
511  if(context->eventDesc[2 * i].eventFlags != 0)
512  {
513  //No need to poll the underlying socket for incoming traffic
514  timeout = 0;
515  }
516  }
517 
518  //Check whether the data connection is active
519  if(connection->dataChannel.socket != NULL)
520  {
521  //Register the events related to the data connection
523  &context->eventDesc[2 * i + 1]);
524 
525  //Check whether the socket is ready for I/O operation
526  if(context->eventDesc[2 * i + 1].eventFlags != 0)
527  {
528  //No need to poll the underlying socket for incoming traffic
529  timeout = 0;
530  }
531  }
532  }
533 
534  //Accept connection request events
535  context->eventDesc[2 * i].socket = context->socket;
536  context->eventDesc[2 * i].eventMask = SOCKET_EVENT_RX_READY;
537 
538  //Wait for one of the set of sockets to become ready to perform I/O
539  error = socketPoll(context->eventDesc, 2 * context->maxConnections + 1,
540  &context->event, timeout);
541 
542  //Get current time
543  time = osGetSystemTime();
544 
545  //Check status code
546  if(error == NO_ERROR || error == ERROR_TIMEOUT ||
547  error == ERROR_WAIT_CANCELED)
548  {
549  //Stop request?
550  if(context->stop)
551  {
552  //Stop FTP server operation
553  context->running = FALSE;
554  //Task epilogue
555  osExitTask();
556  //Kill ourselves
558  }
559 
560  //Event-driven processing
561  for(i = 0; i < context->maxConnections; i++)
562  {
563  //Point to the structure describing the current connection
564  connection = &context->connections[i];
565 
566  //Check whether the control connection is active
567  if(connection->controlChannel.socket != NULL)
568  {
569  //Check whether the control socket is to ready to perform I/O
570  if(context->eventDesc[2 * i].eventFlags)
571  {
572  //Update time stamp
573  connection->timestamp = time;
574 
575  //Control connection event handler
577  context->eventDesc[2 * i].eventFlags);
578  }
579  }
580 
581  //Check whether the data connection is active
582  if(connection->dataChannel.socket != NULL)
583  {
584  //Check whether the data socket is ready to perform I/O
585  if(context->eventDesc[2 * i + 1].eventFlags)
586  {
587  //Update time stamp
588  connection->timestamp = time;
589 
590  //Data connection event handler
592  context->eventDesc[2 * i + 1].eventFlags);
593  }
594  }
595  }
596 
597  //Check the state of the listening socket
598  if(context->eventDesc[2 * i].eventFlags & SOCKET_EVENT_RX_READY)
599  {
600  //Accept connection request
602  }
603  }
604 
605  //Handle periodic operations
606  ftpServerTick(context);
607 
608 #if (NET_RTOS_SUPPORT == ENABLED)
609  }
610 #endif
611 }
612 
613 
614 /**
615  * @brief Release FTP server context
616  * @param[in] context Pointer to the FTP server context
617  **/
618 
620 {
621  //Make sure the FTP server context is valid
622  if(context != NULL)
623  {
624  //Free previously allocated resources
625  osDeleteEvent(&context->event);
626 
627 #if (FTP_SERVER_TLS_SUPPORT == ENABLED && TLS_TICKET_SUPPORT == ENABLED)
628  //Release ticket encryption context
629  tlsFreeTicketContext(&context->tlsTicketContext);
630 #endif
631 
632  //Clear FTP server context
633  osMemset(context, 0, sizeof(FtpServerContext));
634  }
635 }
636 
637 #endif
#define FtpServerContext
Definition: ftp_server.h:206
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:355
#define osExitTask()
FtpServerConnectCallback connectCallback
Connection callback function.
Definition: ftp_server.h:362
#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:445
NetInterface * interface
Underlying network interface.
Definition: ftp_server.h:352
uint16_t dataPort
FTP data port number.
Definition: ftp_server.h:354
#define osStrlen(s)
Definition: os_port.h:171
@ 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:358
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:356
FTP server settings.
Definition: ftp_server.h:349
void ftpServerTask(FtpServerContext *context)
FTP server task.
Definition: ftp_server.c:475
@ 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:350
void osDeleteTask(OsTaskId taskId)
Delete a task.
NetContext * netContext
TCP/IP stack context.
Definition: ftp_server.h:351
#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:368
@ ERROR_INVALID_PARAMETER
Invalid parameter.
Definition: error.h:47
FtpServerGetFilePermCallback getFilePermCallback
Callback used to retrieve file permissions.
Definition: ftp_server.h:369
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:357
#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:353
error_t ftpServerSetRootDir(FtpClientConnection *connection, const char_t *rootDir)
Set user's root directory.
Definition: ftp_server.c:409
error_t ftpServerStop(FtpServerContext *context)
Stop FTP server.
Definition: ftp_server.c:358
#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:361
FtpServerTlsInitCallback tlsInitCallback
TLS initialization callback function.
Definition: ftp_server.h:365
#define FTP_SERVER_PASSIVE_PORT_MIN
Definition: ftp_server.h:165
error_t ftpServerStart(FtpServerContext *context)
Start FTP server.
Definition: ftp_server.c:250
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:195
@ 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:360
void ftpServerRegisterControlChannelEvents(FtpClientConnection *connection, SocketEventDesc *eventDesc)
Register control connection events.
FTP server (File Transfer Protocol)
FtpServerDisconnectCallback disconnectCallback
Disconnection callback function.
Definition: ftp_server.h:363
@ FTP_SERVER_MODE_PLAINTEXT
Definition: ftp_server.h:253
#define FtpClientConnection
Definition: ftp_server.h:210
#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:619
FtpServerCheckUserCallback checkUserCallback
User verification callback function.
Definition: ftp_server.h:367
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:370
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:359
unsigned int uint_t
Definition: compiler_port.h:57
#define osMemset(p, value, length)
Definition: os_port.h:141
TCP/IP stack core.
#define FTP_DATA_PORT
Definition: ftp_server.h:197
#define osStrcpy(s1, s2)
Definition: os_port.h:213
@ 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