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