1 | /* $Id: ftp.h 82670 2020-01-08 11:35:48Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Header file for FTP client / server implementations.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2020 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef IPRT_INCLUDED_ftp_h
|
---|
28 | #define IPRT_INCLUDED_ftp_h
|
---|
29 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
30 | # pragma once
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #include <iprt/types.h>
|
---|
34 |
|
---|
35 | RT_C_DECLS_BEGIN
|
---|
36 |
|
---|
37 | /** @defgroup grp_rt_ftp RTFTPServer - FTP server implementation.
|
---|
38 | * @ingroup grp_rt
|
---|
39 | * @{
|
---|
40 | */
|
---|
41 |
|
---|
42 | /** @todo the following three definitions may move the iprt/types.h later. */
|
---|
43 | /** FTP server handle. */
|
---|
44 | typedef R3PTRTYPE(struct RTFTPSERVERINTERNAL *) RTFTPSERVER;
|
---|
45 | /** Pointer to a FTP server handle. */
|
---|
46 | typedef RTFTPSERVER *PRTFTPSERVER;
|
---|
47 | /** Nil FTP client handle. */
|
---|
48 | #define NIL_RTFTPSERVER ((RTFTPSERVER)0)
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Enumeration for FTP server reply codes.
|
---|
52 | *
|
---|
53 | ** @todo Might needs more codes, not complete yet.
|
---|
54 | */
|
---|
55 | typedef enum RTFTPSERVER_REPLY
|
---|
56 | {
|
---|
57 | /** Invalid reply type, do not use. */
|
---|
58 | RTFTPSERVER_REPLY_INVALID = 0,
|
---|
59 | /** Command not implemented, superfluous at this site. */
|
---|
60 | RTFTPSERVER_REPLY_ERROR_CMD_NOT_IMPL_SUPERFLUOUS = 202,
|
---|
61 | /** Command okay. */
|
---|
62 | RTFTPSERVER_REPLY_OKAY = 200,
|
---|
63 | /** Service ready for new user. */
|
---|
64 | RTFTPSERVER_REPLY_READY_FOR_NEW_USER = 220,
|
---|
65 | /** Closing data connection. */
|
---|
66 | RTFTPSERVER_REPLY_CLOSING_DATA_CONN = 226,
|
---|
67 | /** User logged in, proceed. */
|
---|
68 | RTFTPSERVER_REPLY_LOGGED_IN_PROCEED = 230,
|
---|
69 | /** User name okay, need password. */
|
---|
70 | RTFTPSERVER_REPLY_USERNAME_OKAY_NEED_PASSWORD = 331,
|
---|
71 | /** Connection closed; transfer aborted. */
|
---|
72 | RTFTPSERVER_REPLY_CONN_CLOSED_TRANSFER_ABORTED = 426,
|
---|
73 | /** Syntax error, command unrecognized. */
|
---|
74 | RTFTPSERVER_REPLY_ERROR_CMD_NOT_RECOGNIZED = 500,
|
---|
75 | /** Syntax error in parameters or arguments. */
|
---|
76 | RTFTPSERVER_REPLY_ERROR_INVALID_PARAMETERS = 501,
|
---|
77 | /** Command not implemented. */
|
---|
78 | RTFTPSERVER_REPLY_ERROR_CMD_NOT_IMPL = 502,
|
---|
79 | /** Bad sequence of commands. */
|
---|
80 | RTFTPSERVER_REPLY_ERROR_BAD_SEQUENCE = 503,
|
---|
81 | /** Command not implemented for that parameter. */
|
---|
82 | RTFTPSERVER_REPLY_ERROR_CMD_NOT_IMPL_PARAM = 504,
|
---|
83 | /** Not logged in. */
|
---|
84 | RTFTPSERVER_REPLY_NOT_LOGGED_IN = 530,
|
---|
85 | /** The usual 32-bit hack. */
|
---|
86 | RTFTPSERVER_REPLY_32BIT_HACK = 0x7fffffff
|
---|
87 | } RTFTPSERVER_REPLY;
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Creates a FTP server instance.
|
---|
91 | *
|
---|
92 | * @returns IPRT status code.
|
---|
93 | * @param phFTPServer Where to store the FTP server handle.
|
---|
94 | * @param pcszAddress The address for creating a listening socket.
|
---|
95 | * If NULL or empty string the server is bound to all interfaces.
|
---|
96 | * @param uPort The port for creating a listening socket.
|
---|
97 | * @param pcszPathRoot Root path of the FTP server serving.
|
---|
98 | */
|
---|
99 | RTR3DECL(int) RTFTPServerCreate(PRTFTPSERVER phFTPServer, const char *pcszAddress, uint16_t uPort,
|
---|
100 | const char *pcszPathRoot);
|
---|
101 |
|
---|
102 | /**
|
---|
103 | * Destroys a FTP server instance.
|
---|
104 | *
|
---|
105 | * @returns IPRT status code.
|
---|
106 | * @param hFTPServer Handle to the FTP server handle.
|
---|
107 | */
|
---|
108 | RTR3DECL(int) RTFTPServerDestroy(RTFTPSERVER hFTPServer);
|
---|
109 |
|
---|
110 | RT_C_DECLS_END
|
---|
111 |
|
---|
112 | #endif /* !IPRT_INCLUDED_ftp_h */
|
---|