00001 #ifndef VSF_FTPDATAIO_H 00002 #define VSF_FTPDATAIO_H 00003 00004 #include "filesize.h" 00005 00006 struct mystr; 00007 struct vsf_sysutil_sockaddr; 00008 struct vsf_sysutil_dir; 00009 struct vsf_session; 00010 00011 /* vsf_ftpdataio_dispose_transfer_fd() 00012 * PURPOSE 00013 * Close down the remote data transfer file descriptor. If unsent data reamins 00014 * on the connection, this method blocks until it is transferred (or the data 00015 * timeout goes off, or the connection is severed). 00016 * PARAMETERS 00017 * p_sess - the current FTP session object 00018 */ 00019 void vsf_ftpdataio_dispose_transfer_fd(struct vsf_session* p_sess); 00020 00021 /* vsf_ftpdataio_get_pasv_fd() 00022 * PURPOSE 00023 * Return a connection data file descriptor obtained by the PASV connection 00024 * method. This includes accept()'ing a connection from the remote. 00025 * PARAMETERS 00026 * p_sess - the current FTP session object 00027 * RETURNS 00028 * The file descriptor upon success, or -1 upon error. 00029 */ 00030 int vsf_ftpdataio_get_pasv_fd(struct vsf_session* p_sess); 00031 00032 /* vsf_ftpdataio_get_pasv_fd() 00033 * PURPOSE 00034 * Return a connection data file descriptor obtained by the PORT connection 00035 * method. This includes connect()'ing to the remote. 00036 * PARAMETERS 00037 * p_sess - the current FTP session object 00038 * RETURNS 00039 * The file descriptor upon success, or -1 upon error. 00040 */ 00041 int vsf_ftpdataio_get_port_fd(struct vsf_session* p_sess); 00042 00043 /* vsf_ftpdataio_post_mark_connect() 00044 * PURPOSE 00045 * Perform any post-150-status-mark setup on the data connection. For example, 00046 * the negotiation of SSL. 00047 * PARAMETERS 00048 * p_sess - the current FTP session object 00049 * RETURNS 00050 * 1 on success, 0 otherwise. 00051 */ 00052 int vsf_ftpdataio_post_mark_connect(struct vsf_session* p_sess); 00053 00054 /* vsf_ftpdataio_transfer_file() 00055 * PURPOSE 00056 * Send data between the network and a local file. Send and receive are 00057 * supported, as well as ASCII mangling. 00058 * PARAMETERS 00059 * remote_fd - the file descriptor of the remote data connection 00060 * file_fd - the file descriptor of the local file 00061 * is_recv - 0 for sending to the remote, otherwise receive 00062 * is_ascii - non zero for ASCII mangling 00063 * RETURNS 00064 * A structure, containing 00065 * retval - 0 for success, failure otherwise 00066 * (-1 = local problem -2 = remote problem) 00067 * transferred - number of bytes transferred 00068 */ 00069 struct vsf_transfer_ret 00070 { 00071 int retval; 00072 filesize_t transferred; 00073 }; 00074 struct vsf_transfer_ret vsf_ftpdataio_transfer_file( 00075 struct vsf_session* p_sess, 00076 int remote_fd, int file_fd, int is_recv, int is_ascii); 00077 00078 /* vsf_ftpdataio_transfer_dir() 00079 * PURPOSE 00080 * Send an ASCII directory lising of the requested directory to the remote 00081 * client. 00082 * PARAMETERS 00083 * p_sess - the current session object 00084 * is_control - whether to send on the control connection or data connection 00085 * p_dir - the local directory object 00086 * p_base_dir_str - the directory we opened relative to the current one 00087 * p_option_str - the options list provided to "ls" 00088 * p_filter_str - the filter string provided to "ls" 00089 * is_verbose - set to 0 if NLST used, 1 if LIST used 00090 */ 00091 int vsf_ftpdataio_transfer_dir(struct vsf_session* p_sess, int is_control, 00092 struct vsf_sysutil_dir* p_dir, 00093 const struct mystr* p_base_dir_str, 00094 const struct mystr* p_option_str, 00095 const struct mystr* p_filter_str, 00096 int is_verbose); 00097 00098 #endif /* VSF_FTPDATAIO_H */ 00099