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