forked from dagwieers/vsftpd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ftpdataio.h
102 lines (92 loc) · 3.38 KB
/
ftpdataio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef VSF_FTPDATAIO_H
#define VSF_FTPDATAIO_H
#include "filesize.h"
struct mystr;
struct vsf_sysutil_sockaddr;
struct vsf_sysutil_dir;
struct vsf_session;
/* vsf_ftpdataio_dispose_transfer_fd()
* PURPOSE
* Close down the remote data transfer file descriptor. If unsent data reamins
* on the connection, this method blocks until it is transferred (or the data
* timeout goes off, or the connection is severed).
* PARAMETERS
* p_sess - the current FTP session object
* RETURNS
* 1 on success, 0 otherwise.
*
*/
int vsf_ftpdataio_dispose_transfer_fd(struct vsf_session* p_sess);
/* vsf_ftpdataio_get_pasv_fd()
* PURPOSE
* Return a connection data file descriptor obtained by the PASV connection
* method. This includes accept()'ing a connection from the remote.
* PARAMETERS
* p_sess - the current FTP session object
* RETURNS
* The file descriptor upon success, or -1 upon error.
*/
int vsf_ftpdataio_get_pasv_fd(struct vsf_session* p_sess);
/* vsf_ftpdataio_get_pasv_fd()
* PURPOSE
* Return a connection data file descriptor obtained by the PORT connection
* method. This includes connect()'ing to the remote.
* PARAMETERS
* p_sess - the current FTP session object
* RETURNS
* The file descriptor upon success, or -1 upon error.
*/
int vsf_ftpdataio_get_port_fd(struct vsf_session* p_sess);
/* vsf_ftpdataio_post_mark_connect()
* PURPOSE
* Perform any post-150-status-mark setup on the data connection. For example,
* the negotiation of SSL.
* PARAMETERS
* p_sess - the current FTP session object
* RETURNS
* 1 on success, 0 otherwise.
*/
int vsf_ftpdataio_post_mark_connect(struct vsf_session* p_sess);
/* vsf_ftpdataio_transfer_file()
* PURPOSE
* Send data between the network and a local file. Send and receive are
* supported, as well as ASCII mangling.
* PARAMETERS
* remote_fd - the file descriptor of the remote data connection
* file_fd - the file descriptor of the local file
* is_recv - 0 for sending to the remote, otherwise receive
* is_ascii - non zero for ASCII mangling
* RETURNS
* A structure, containing
* retval - 0 for success, failure otherwise
* (-1 = local problem -2 = remote problem)
* transferred - number of bytes transferred
*/
struct vsf_transfer_ret
{
int retval;
filesize_t transferred;
};
struct vsf_transfer_ret vsf_ftpdataio_transfer_file(
struct vsf_session* p_sess,
int remote_fd, int file_fd, int is_recv, int is_ascii);
/* vsf_ftpdataio_transfer_dir()
* PURPOSE
* Send an ASCII directory lising of the requested directory to the remote
* client.
* PARAMETERS
* p_sess - the current session object
* is_control - whether to send on the control connection or data connection
* p_dir - the local directory object
* p_base_dir_str - the directory we opened relative to the current one
* p_option_str - the options list provided to "ls"
* p_filter_str - the filter string provided to "ls"
* is_verbose - set to 0 if NLST used, 1 if LIST used
*/
int vsf_ftpdataio_transfer_dir(struct vsf_session* p_sess, int is_control,
struct vsf_sysutil_dir* p_dir,
const struct mystr* p_base_dir_str,
const struct mystr* p_option_str,
const struct mystr* p_filter_str,
int is_verbose);
#endif /* VSF_FTPDATAIO_H */