1 #ifndef VSF_FTPDATAIO_H
2 #define VSF_FTPDATAIO_H
7 struct vsf_sysutil_sockaddr
;
8 struct vsf_sysutil_dir
;
11 /* vsf_ftpdataio_dispose_transfer_fd()
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).
17 * p_sess - the current FTP session object
19 * 1 on success, 0 otherwise.
22 int vsf_ftpdataio_dispose_transfer_fd(struct vsf_session
* p_sess
);
24 /* vsf_ftpdataio_get_pasv_fd()
26 * Return a connection data file descriptor obtained by the PASV connection
27 * method. This includes accept()'ing a connection from the remote.
29 * p_sess - the current FTP session object
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()
37 * Return a connection data file descriptor obtained by the PORT connection
38 * method. This includes connect()'ing to the remote.
40 * p_sess - the current FTP session object
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()
48 * Perform any post-150-status-mark setup on the data connection. For example,
49 * the negotiation of SSL.
51 * p_sess - the current FTP session object
53 * 1 on success, 0 otherwise.
55 int vsf_ftpdataio_post_mark_connect(struct vsf_session
* p_sess
);
57 /* vsf_ftpdataio_transfer_file()
59 * Send data between the network and a local file. Send and receive are
60 * supported, as well as ASCII mangling.
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
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
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()
83 * Send an ASCII directory lising of the requested directory to the remote
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
,
101 #endif /* VSF_FTPDATAIO_H */