VirtualBox

source: vbox/trunk/include/iprt/ftp.h@ 82673

Last change on this file since 82673 was 82673, checked in by vboxsync, 5 years ago

IPRT/FTP: First connections (via Linux ftp client) are working now. bugref:9437

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.5 KB
Line 
1/* $Id: ftp.h 82673 2020-01-08 16:19:35Z 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
35RT_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. */
44typedef R3PTRTYPE(struct RTFTPSERVERINTERNAL *) RTFTPSERVER;
45/** Pointer to a FTP server handle. */
46typedef RTFTPSERVER *PRTFTPSERVER;
47/** Nil FTP client handle. */
48#define NIL_RTFTPSERVER ((RTFTPSERVER)0)
49
50/** Maximum length (in characters) a command can have (without parameters). */
51#define RTFTPSERVER_MAX_CMD_LEN 64
52
53/**
54 * Enumeration for defining the current server connection mode.
55 */
56typedef enum RTFTPSERVER_CONNECTION_MODE
57{
58 /** Normal mode, nothing to transfer. */
59 RTFTPSERVER_CONNECTION_MODE_NORMAL = 0,
60 /** Server is in passive mode (is listening). */
61 RTFTPSERVER_CONNECTION_MODE_PASSIVE,
62 /** Server connects via port to the client. */
63 RTFTPSERVER_CONNECTION_MODE_MODE_PORT,
64 /** The usual 32-bit hack. */
65 RTFTPSERVER_CONNECTION_MODE_32BIT_HACK = 0x7fffffff
66} RTFTPSERVER_CONNECTION_MODE;
67
68/**
69 * Enumeration for defining the data transfer mode.
70 */
71typedef enum RTFTPSERVER_TRANSFER_MODE
72{
73 RTFTPSERVER_TRANSFER_MODE_UNKNOWN = 0,
74 RTFTPSERVER_TRANSFER_MODE_STREAM,
75 RTFTPSERVER_TRANSFER_MODE_BLOCK,
76 RTFTPSERVER_TRANSFER_MODE_COMPRESSED,
77 /** The usual 32-bit hack. */
78 RTFTPSERVER_DATA_MODE_32BIT_HACK = 0x7fffffff
79} RTFTPSERVER_DATA_MODE;
80
81/**
82 * Enumeration for defining the data type.
83 */
84typedef enum RTFTPSERVER_DATA_TYPE
85{
86 RTFTPSERVER_DATA_TYPE_UNKNOWN = 0,
87 RTFTPSERVER_DATA_TYPE_ASCII,
88 RTFTPSERVER_DATA_TYPE_EBCDIC,
89 RTFTPSERVER_DATA_TYPE_IMAGE,
90 RTFTPSERVER_DATA_TYPE_LOCAL,
91 /** The usual 32-bit hack. */
92 RTFTPSERVER_DATA_TYPE_32BIT_HACK = 0x7fffffff
93} RTFTPSERVER_DATA_TYPE;
94
95/**
96 * Enumeration for FTP server reply codes.
97 *
98 ** @todo Might needs more codes, not complete yet.
99 */
100typedef enum RTFTPSERVER_REPLY
101{
102 /** Invalid reply type, do not use. */
103 RTFTPSERVER_REPLY_INVALID = 0,
104 /** Command not implemented, superfluous at this site. */
105 RTFTPSERVER_REPLY_ERROR_CMD_NOT_IMPL_SUPERFLUOUS = 202,
106 /** Command okay. */
107 RTFTPSERVER_REPLY_OKAY = 200,
108 /** Service ready for new user. */
109 RTFTPSERVER_REPLY_READY_FOR_NEW_USER = 220,
110 /** Closing data connection. */
111 RTFTPSERVER_REPLY_CLOSING_DATA_CONN = 226,
112 /** User logged in, proceed. */
113 RTFTPSERVER_REPLY_LOGGED_IN_PROCEED = 230,
114 /** User name okay, need password. */
115 RTFTPSERVER_REPLY_USERNAME_OKAY_NEED_PASSWORD = 331,
116 /** Connection closed; transfer aborted. */
117 RTFTPSERVER_REPLY_CONN_CLOSED_TRANSFER_ABORTED = 426,
118 /** Syntax error, command unrecognized. */
119 RTFTPSERVER_REPLY_ERROR_CMD_NOT_RECOGNIZED = 500,
120 /** Syntax error in parameters or arguments. */
121 RTFTPSERVER_REPLY_ERROR_INVALID_PARAMETERS = 501,
122 /** Command not implemented. */
123 RTFTPSERVER_REPLY_ERROR_CMD_NOT_IMPL = 502,
124 /** Bad sequence of commands. */
125 RTFTPSERVER_REPLY_ERROR_BAD_SEQUENCE = 503,
126 /** Command not implemented for that parameter. */
127 RTFTPSERVER_REPLY_ERROR_CMD_NOT_IMPL_PARAM = 504,
128 /** Not logged in. */
129 RTFTPSERVER_REPLY_NOT_LOGGED_IN = 530,
130 /** The usual 32-bit hack. */
131 RTFTPSERVER_REPLY_32BIT_HACK = 0x7fffffff
132} RTFTPSERVER_REPLY;
133
134/**
135 * Creates a FTP server instance.
136 *
137 * @returns IPRT status code.
138 * @param phFTPServer Where to store the FTP server handle.
139 * @param pcszAddress The address for creating a listening socket.
140 * If NULL or empty string the server is bound to all interfaces.
141 * @param uPort The port for creating a listening socket.
142 * @param pcszPathRoot Root path of the FTP server serving.
143 */
144RTR3DECL(int) RTFTPServerCreate(PRTFTPSERVER phFTPServer, const char *pcszAddress, uint16_t uPort,
145 const char *pcszPathRoot);
146
147/**
148 * Destroys a FTP server instance.
149 *
150 * @returns IPRT status code.
151 * @param hFTPServer Handle to the FTP server handle.
152 */
153RTR3DECL(int) RTFTPServerDestroy(RTFTPSERVER hFTPServer);
154
155RT_C_DECLS_END
156
157#endif /* !IPRT_INCLUDED_ftp_h */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette