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-2025 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.5.2
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  //The FTP server is not bound to any interface
69  settings->interface = NULL;
70 
71  //FTP command port number
72  settings->port = FTP_PORT;
73  //FTP data port number
74  settings->dataPort = FTP_DATA_PORT;
75 
76  //Passive port range
79 
80  //Public IPv4 address to be used in PASV replies
82 
83  //Default security mode (no security)
84  settings->mode = FTP_SERVER_MODE_PLAINTEXT;
85 
86  //Client connections
87  settings->maxConnections = 0;
88  settings->connections = NULL;
89 
90  //Set root directory
91  settings->rootDir = NULL;
92 
93  //Connection callback function
94  settings->connectCallback = NULL;
95  //Disconnection callback function
96  settings->disconnectCallback = NULL;
97 
98 #if (FTP_SERVER_TLS_SUPPORT == ENABLED)
99  //TLS initialization callback function
100  settings->tlsInitCallback = NULL;
101 #endif
102 
103  //User verification callback function
104  settings->checkUserCallback = NULL;
105  //Password verification callback function
106  settings->checkPasswordCallback = NULL;
107  //Callback used to retrieve file permissions
108  settings->getFilePermCallback = NULL;
109  //Unknown command callback function
110  settings->unknownCommandCallback = NULL;
111 }
112 
113 
114 /**
115  * @brief FTP server initialization
116  * @param[in] context Pointer to the FTP server context
117  * @param[in] settings FTP server specific settings
118  * @return Error code
119  **/
120 
122  const FtpServerSettings *settings)
123 {
124  error_t error;
125  uint_t i;
126 
127  //Debug message
128  TRACE_INFO("Initializing FTP server...\r\n");
129 
130  //Ensure the parameters are valid
131  if(context == NULL || settings == NULL)
133 
134  //Sanity check
135  if(settings->passivePortMax <= settings->passivePortMin)
136  {
138  }
139 
140  //Invalid number of client connections?
141  if(settings->connections == NULL || settings->maxConnections < 1 ||
143  {
145  }
146 
147  //Invalid root directory?
148  if(settings->rootDir == NULL ||
150  {
152  }
153 
154  //Clear the FTP server context
155  osMemset(context, 0, sizeof(FtpServerContext));
156 
157  //Initialize task parameters
158  context->taskParams = settings->task;
159  context->taskId = OS_INVALID_TASK_ID;
160 
161  //Save user settings
162  context->interface = settings->interface;
163  context->port = settings->port;
164  context->dataPort = settings->dataPort;
165  context->passivePortMin = settings->passivePortMin;
166  context->passivePortMax = settings->passivePortMax;
167  context->publicIpv4Addr = settings->publicIpv4Addr;
168  context->mode = settings->mode;
169  context->maxConnections = settings->maxConnections;
170  context->connections = settings->connections;
171  context->connectCallback = settings->connectCallback;
172  context->disconnectCallback = settings->disconnectCallback;
173 #if (FTP_SERVER_TLS_SUPPORT == ENABLED)
174  context->tlsInitCallback = settings->tlsInitCallback;
175 #endif
176  context->checkUserCallback = settings->checkUserCallback;
177  context->checkPasswordCallback = settings->checkPasswordCallback;
178  context->getFilePermCallback = settings->getFilePermCallback;
179  context->unknownCommandCallback = settings->unknownCommandCallback;
180 
181  //Set root directory
182  osStrcpy(context->rootDir, settings->rootDir);
183 
184  //Clean the root directory path
185  pathCanonicalize(context->rootDir);
186  pathRemoveSlash(context->rootDir);
187 
188  //Loop through client connections
189  for(i = 0; i < context->maxConnections; i++)
190  {
191  //Initialize the structure representing the client connection
192  osMemset(&context->connections[i], 0, sizeof(FtpClientConnection));
193  }
194 
195  //Initialize status code
196  error = NO_ERROR;
197 
198  //Create an event object to poll the state of sockets
199  if(!osCreateEvent(&context->event))
200  {
201  //Failed to create event
202  error = ERROR_OUT_OF_RESOURCES;
203  }
204 
205 #if (FTP_SERVER_TLS_SUPPORT == ENABLED && TLS_TICKET_SUPPORT == ENABLED)
206  //Check status code
207  if(!error)
208  {
209  //Initialize ticket encryption context
210  error = tlsInitTicketContext(&context->tlsTicketContext);
211  }
212 #endif
213 
214  //Any error to report?
215  if(error)
216  {
217  //Clean up side effects
218  ftpServerDeinit(context);
219  }
220 
221  //Return status code
222  return error;
223 }
224 
225 
226 /**
227  * @brief Start FTP server
228  * @param[in] context Pointer to the FTP server context
229  * @return Error code
230  **/
231 
233 {
234  error_t error;
235 
236  //Make sure the FTP server context is valid
237  if(context == NULL)
239 
240  //Debug message
241  TRACE_INFO("Starting FTP server...\r\n");
242 
243  //Make sure the FTP server is not already running
244  if(context->running)
245  return ERROR_ALREADY_RUNNING;
246 
247  //Start of exception handling block
248  do
249  {
250  //Open a TCP socket
252  //Failed to open socket?
253  if(context->socket == NULL)
254  {
255  //Report an error
256  error = ERROR_OPEN_FAILED;
257  break;
258  }
259 
260  //Force the socket to operate in non-blocking mode
261  error = socketSetTimeout(context->socket, 0);
262  //Any error to report?
263  if(error)
264  break;
265 
266  //Adjust the size of the TX buffer
267  error = socketSetTxBufferSize(context->socket,
269  //Any error to report?
270  if(error)
271  break;
272 
273  //Adjust the size of the RX buffer
274  error = socketSetRxBufferSize(context->socket,
276  //Any error to report?
277  if(error)
278  break;
279 
280  //Associate the socket with the relevant interface
281  error = socketBindToInterface(context->socket, context->interface);
282  //Any error to report?
283  if(error)
284  break;
285 
286  //The FTP server listens for connection requests on port 21
287  error = socketBind(context->socket, &IP_ADDR_ANY, context->port);
288  //Any error to report?
289  if(error)
290  break;
291 
292  //Place socket in listening state
293  error = socketListen(context->socket, FTP_SERVER_BACKLOG);
294  //Any failure to report?
295  if(error)
296  break;
297 
298  //Start the FTP server
299  context->stop = FALSE;
300  context->running = TRUE;
301 
302  //Create a task
303  context->taskId = osCreateTask("FTP Server", (OsTaskCode) ftpServerTask,
304  context, &context->taskParams);
305 
306  //Failed to create task?
307  if(context->taskId == OS_INVALID_TASK_ID)
308  {
309  //Report an error
310  error = ERROR_OUT_OF_RESOURCES;
311  break;
312  }
313 
314  //End of exception handling block
315  } while(0);
316 
317  //Any error to report?
318  if(error)
319  {
320  //Clean up side effects
321  context->running = FALSE;
322 
323  //Close listening socket
324  socketClose(context->socket);
325  context->socket = NULL;
326  }
327 
328  //Return status code
329  return error;
330 }
331 
332 
333 /**
334  * @brief Stop FTP server
335  * @param[in] context Pointer to the FTP server context
336  * @return Error code
337  **/
338 
340 {
341  uint_t i;
342 
343  //Make sure the FTP server context is valid
344  if(context == NULL)
346 
347  //Debug message
348  TRACE_INFO("Stopping FTP server...\r\n");
349 
350  //Check whether the FTP server is running
351  if(context->running)
352  {
353 #if (NET_RTOS_SUPPORT == ENABLED)
354  //Stop the FTP server
355  context->stop = TRUE;
356  //Send a signal to the task to abort any blocking operation
357  osSetEvent(&context->event);
358 
359  //Wait for the task to terminate
360  while(context->running)
361  {
362  osDelayTask(1);
363  }
364 #endif
365 
366  //Loop through the connection table
367  for(i = 0; i < context->maxConnections; i++)
368  {
369  //Close client connection
370  ftpServerCloseConnection(&context->connections[i]);
371  }
372 
373  //Close listening socket
374  socketClose(context->socket);
375  context->socket = NULL;
376  }
377 
378  //Successful processing
379  return NO_ERROR;
380 }
381 
382 
383 /**
384  * @brief Set user's root directory
385  * @param[in] connection Pointer to the client connection
386  * @param[in] rootDir NULL-terminated string specifying the root directory
387  * @return Error code
388  **/
389 
391  const char_t *rootDir)
392 {
393  FtpServerContext *context;
394 
395  //Check parameters
396  if(connection == NULL || rootDir == NULL)
398 
399  //Point to the FTP server context
400  context = connection->context;
401 
402  //Set user's root directory
403  pathCopy(connection->rootDir, context->rootDir, FTP_SERVER_MAX_ROOT_DIR_LEN);
404  pathCombine(connection->rootDir, rootDir, FTP_SERVER_MAX_ROOT_DIR_LEN);
405 
406  //Clean the resulting path
407  pathCanonicalize(connection->rootDir);
408  pathRemoveSlash(connection->rootDir);
409 
410  //Set default user's home directory
411  pathCopy(connection->currentDir, connection->rootDir,
413 
414  //Successful processing
415  return NO_ERROR;
416 }
417 
418 
419 /**
420  * @brief Set user's home directory
421  * @param[in] connection Pointer to the client connection
422  * @param[in] homeDir NULL-terminated string specifying the home directory
423  * @return Error code
424  **/
425 
427  const char_t *homeDir)
428 {
429  FtpServerContext *context;
430 
431  //Check parameters
432  if(connection == NULL || homeDir == NULL)
434 
435  //Point to the FTP server context
436  context = connection->context;
437 
438  //Set user's home directory
439  pathCopy(connection->currentDir, context->rootDir, FTP_SERVER_MAX_PATH_LEN);
440  pathCombine(connection->currentDir, homeDir, FTP_SERVER_MAX_PATH_LEN);
441 
442  //Clean the resulting path
443  pathCanonicalize(connection->currentDir);
444  pathRemoveSlash(connection->currentDir);
445 
446  //Successful processing
447  return NO_ERROR;
448 }
449 
450 
451 /**
452  * @brief FTP server task
453  * @param[in] context Pointer to the FTP server context
454  **/
455 
457 {
458  error_t error;
459  uint_t i;
460  systime_t time;
461  systime_t timeout;
462  FtpClientConnection *connection;
463 
464 #if (NET_RTOS_SUPPORT == ENABLED)
465  //Task prologue
466  osEnterTask();
467 
468  //Process events
469  while(1)
470  {
471 #endif
472  //Set polling timeout
473  timeout = FTP_SERVER_TICK_INTERVAL;
474 
475  //Clear event descriptor set
476  osMemset(context->eventDesc, 0, sizeof(context->eventDesc));
477 
478  //Specify the events the application is interested in
479  for(i = 0; i < context->maxConnections; i++)
480  {
481  //Point to the structure describing the current connection
482  connection = &context->connections[i];
483 
484  //Check whether the control connection is active
485  if(connection->controlChannel.socket != NULL)
486  {
487  //Register the events related to the control connection
489  &context->eventDesc[2 * i]);
490 
491  //Check whether the socket is ready for I/O operation
492  if(context->eventDesc[2 * i].eventFlags != 0)
493  {
494  //No need to poll the underlying socket for incoming traffic
495  timeout = 0;
496  }
497  }
498 
499  //Check whether the data connection is active
500  if(connection->dataChannel.socket != NULL)
501  {
502  //Register the events related to the data connection
504  &context->eventDesc[2 * i + 1]);
505 
506  //Check whether the socket is ready for I/O operation
507  if(context->eventDesc[2 * i + 1].eventFlags != 0)
508  {
509  //No need to poll the underlying socket for incoming traffic
510  timeout = 0;
511  }
512  }
513  }
514 
515  //Accept connection request events
516  context->eventDesc[2 * i].socket = context->socket;
517  context->eventDesc[2 * i].eventMask = SOCKET_EVENT_RX_READY;
518 
519  //Wait for one of the set of sockets to become ready to perform I/O
520  error = socketPoll(context->eventDesc, 2 * context->maxConnections + 1,
521  &context->event, timeout);
522 
523  //Get current time
524  time = osGetSystemTime();
525 
526  //Check status code
527  if(error == NO_ERROR || error == ERROR_TIMEOUT ||
528  error == ERROR_WAIT_CANCELED)
529  {
530  //Stop request?
531  if(context->stop)
532  {
533  //Stop FTP server operation
534  context->running = FALSE;
535  //Task epilogue
536  osExitTask();
537  //Kill ourselves
539  }
540 
541  //Event-driven processing
542  for(i = 0; i < context->maxConnections; i++)
543  {
544  //Point to the structure describing the current connection
545  connection = &context->connections[i];
546 
547  //Check whether the control connection is active
548  if(connection->controlChannel.socket != NULL)
549  {
550  //Check whether the control socket is to ready to perform I/O
551  if(context->eventDesc[2 * i].eventFlags)
552  {
553  //Update time stamp
554  connection->timestamp = time;
555 
556  //Control connection event handler
558  context->eventDesc[2 * i].eventFlags);
559  }
560  }
561 
562  //Check whether the data connection is active
563  if(connection->dataChannel.socket != NULL)
564  {
565  //Check whether the data socket is ready to perform I/O
566  if(context->eventDesc[2 * i + 1].eventFlags)
567  {
568  //Update time stamp
569  connection->timestamp = time;
570 
571  //Data connection event handler
573  context->eventDesc[2 * i + 1].eventFlags);
574  }
575  }
576  }
577 
578  //Check the state of the listening socket
579  if(context->eventDesc[2 * i].eventFlags & SOCKET_EVENT_RX_READY)
580  {
581  //Accept connection request
583  }
584  }
585 
586  //Handle periodic operations
587  ftpServerTick(context);
588 
589 #if (NET_RTOS_SUPPORT == ENABLED)
590  }
591 #endif
592 }
593 
594 
595 /**
596  * @brief Release FTP server context
597  * @param[in] context Pointer to the FTP server context
598  **/
599 
601 {
602  //Make sure the FTP server context is valid
603  if(context != NULL)
604  {
605  //Free previously allocated resources
606  osDeleteEvent(&context->event);
607 
608 #if (FTP_SERVER_TLS_SUPPORT == ENABLED && TLS_TICKET_SUPPORT == ENABLED)
609  //Release ticket encryption context
610  tlsFreeTicketContext(&context->tlsTicketContext);
611 #endif
612 
613  //Clear FTP server context
614  osMemset(context, 0, sizeof(FtpServerContext));
615  }
616 }
617 
618 #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:1321
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:121
uint16_t passivePortMin
Passive port range (lower value)
Definition: ftp_server.h:349
#define osExitTask()
FtpServerConnectCallback connectCallback
Connection callback function.
Definition: ftp_server.h:356
#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:2071
@ 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:426
NetInterface * interface
Underlying network interface.
Definition: ftp_server.h:346
uint16_t dataPort
FTP data port number.
Definition: ftp_server.h:348
#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:352
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:1201
uint16_t passivePortMax
Passive port range (upper value)
Definition: ftp_server.h:350
FTP server settings.
Definition: ftp_server.h:344
void ftpServerTask(FtpServerContext *context)
FTP server task.
Definition: ftp_server.c:456
@ 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.
#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:1238
FtpServerCheckPasswordCallback checkPasswordCallback
Password verification callback function.
Definition: ftp_server.h:362
@ ERROR_INVALID_PARAMETER
Invalid parameter.
Definition: error.h:47
FtpServerGetFilePermCallback getFilePermCallback
Callback used to retrieve file permissions.
Definition: ftp_server.h:363
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:351
#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.
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:347
Socket * socketOpen(uint_t type, uint_t protocol)
Create a socket (UDP or TCP)
Definition: socket.c:125
error_t ftpServerSetRootDir(FtpClientConnection *connection, const char_t *rootDir)
Set user's root directory.
Definition: ftp_server.c:390
error_t ftpServerStop(FtpServerContext *context)
Stop FTP server.
Definition: ftp_server.c:339
#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:2158
#define socketBindToInterface
Definition: net_legacy.h:193
const char_t * rootDir
Root directory.
Definition: ftp_server.h:355
FtpServerTlsInitCallback tlsInitCallback
TLS initialization callback function.
Definition: ftp_server.h:359
#define FTP_SERVER_PASSIVE_PORT_MIN
Definition: ftp_server.h:165
error_t ftpServerStart(FtpServerContext *context)
Start FTP server.
Definition: ftp_server.c:232
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
@ ERROR_WAIT_CANCELED
Definition: error.h:73
bool_t osCreateEvent(OsEvent *event)
Create an event object.
FtpClientConnection * connections
Client connections.
Definition: ftp_server.h:354
void ftpServerRegisterControlChannelEvents(FtpClientConnection *connection, SocketEventDesc *eventDesc)
Register control connection events.
FTP server (File Transfer Protocol)
FtpServerDisconnectCallback disconnectCallback
Disconnection callback function.
Definition: ftp_server.h:357
@ 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:600
FtpServerCheckUserCallback checkUserCallback
User verification callback function.
Definition: ftp_server.h:361
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:364
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:353
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:148
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:117
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:1418