Lines Matching refs:data
96 static databuf_t* data_accept(databuf_t *data, ftpbuf_t *ftp);
99 static databuf_t* data_close(ftpbuf_t *ftp, databuf_t *data);
173 if (ftp->data) { in ftp_close()
174 data_close(ftp, ftp->data); in ftp_close()
892 databuf_t *data = NULL; in ftp_get() local
903 if ((data = ftp_getdata(ftp)) == NULL) { in ftp_get()
907 ftp->data = data; in ftp_get()
930 if ((data = data_accept(data, ftp)) == NULL) { in ftp_get()
934 while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) { in ftp_get()
943 char *ptr = data->buf; in ftp_get()
965 } else if (rcvd != php_stream_write(outstream, data->buf, rcvd)) { in ftp_get()
970 ftp->data = data = data_close(ftp, data); in ftp_get()
978 ftp->data = data_close(ftp, data); in ftp_get()
988 databuf_t *data = NULL; in ftp_put() local
1000 if ((data = ftp_getdata(ftp)) == NULL) { in ftp_put()
1003 ftp->data = data; in ftp_put()
1025 if ((data = data_accept(data, ftp)) == NULL) { in ftp_put()
1030 ptr = data->buf; in ftp_put()
1034 if (my_send(ftp, data->fd, data->buf, size) != size) { in ftp_put()
1037 ptr = data->buf; in ftp_put()
1050 if (size && my_send(ftp, data->fd, data->buf, size) != size) { in ftp_put()
1053 ftp->data = data = data_close(ftp, data); in ftp_put()
1060 ftp->data = data_close(ftp, data); in ftp_put()
1071 databuf_t *data = NULL; in ftp_append() local
1082 if ((data = ftp_getdata(ftp)) == NULL) { in ftp_append()
1085 ftp->data = data; in ftp_append()
1093 if ((data = data_accept(data, ftp)) == NULL) { in ftp_append()
1098 ptr = data->buf; in ftp_append()
1102 if (my_send(ftp, data->fd, data->buf, size) != size) { in ftp_append()
1105 ptr = data->buf; in ftp_append()
1118 if (size && my_send(ftp, data->fd, data->buf, size) != size) { in ftp_append()
1121 ftp->data = data = data_close(ftp, data); in ftp_append()
1128 ftp->data = data_close(ftp, data); in ftp_append()
1272 char *data; in ftp_putcmd() local
1295 data = ftp->outbuf; in ftp_putcmd()
1300 if (my_send(ftp, ftp->fd, data, size) != size) { in ftp_putcmd()
1313 char *data, *eol; in ftp_readline() local
1323 data = ftp->inbuf; in ftp_readline()
1327 for (eol = data; rcvd; rcvd--, eol++) { in ftp_readline()
1349 data = eol; in ftp_readline()
1350 if ((rcvd = my_recv(ftp, ftp->fd, data, size)) < 1) { in ftp_readline()
1433 } else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) { in my_send()
1434 handle = ftp->data->ssl_handle; in my_send()
1435 fd = ftp->data->fd; in my_send()
1522 } else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) { in my_recv()
1523 handle = ftp->data->ssl_handle; in my_recv()
1524 fd = ftp->data->fd; in my_recv()
1652 databuf_t *data; in ftp_getdata() local
1667 data = ecalloc(1, sizeof(*data)); in ftp_getdata()
1668 data->listener = -1; in ftp_getdata()
1669 data->fd = -1; in ftp_getdata()
1670 data->type = ftp->type; in ftp_getdata()
1694 data->fd = fd; in ftp_getdata()
1696 ftp->data = data; in ftp_getdata()
1697 return data; in ftp_getdata()
1722 data->listener = fd; in ftp_getdata()
1745 ftp->data = data; in ftp_getdata()
1746 return data; in ftp_getdata()
1765 ftp->data = data; in ftp_getdata()
1766 return data; in ftp_getdata()
1772 efree(data); in ftp_getdata()
1780 data_accept(databuf_t *data, ftpbuf_t *ftp) in data_accept() argument
1792 if (data->fd != -1) { in data_accept()
1796 data->fd = my_accept(ftp, data->listener, (struct sockaddr*) &addr, &size); in data_accept()
1797 closesocket(data->listener); in data_accept()
1798 data->listener = -1; in data_accept()
1800 if (data->fd == -1) { in data_accept()
1801 efree(data); in data_accept()
1816 data->ssl_handle = SSL_new(ctx); in data_accept()
1817 if (data->ssl_handle == NULL) { in data_accept()
1822 SSL_set_fd(data->ssl_handle, data->fd); in data_accept()
1825 SSL_copy_session_id(data->ssl_handle, ftp->ssl_handle); in data_accept()
1832 SSL_free(data->ssl_handle); in data_accept()
1837 res = SSL_set_session(data->ssl_handle, session); in data_accept()
1840 SSL_free(data->ssl_handle); in data_accept()
1845 res = SSL_connect(data->ssl_handle); in data_accept()
1846 err = SSL_get_error(data->ssl_handle, res); in data_accept()
1855 SSL_shutdown(data->ssl_handle); in data_accept()
1863 p.fd = data->fd; in data_accept()
1875 SSL_shutdown(data->ssl_handle); in data_accept()
1876 SSL_free(data->ssl_handle); in data_accept()
1881 data->ssl_active = 1; in data_accept()
1886 return data; in data_accept()
1951 data_close(ftpbuf_t *ftp, databuf_t *data) in data_close() argument
1953 if (data == NULL) { in data_close()
1956 if (data->listener != -1) { in data_close()
1958 if (data->ssl_active) { in data_close()
1960 ftp_ssl_shutdown(ftp, data->listener, data->ssl_handle); in data_close()
1961 data->ssl_active = 0; in data_close()
1964 closesocket(data->listener); in data_close()
1966 if (data->fd != -1) { in data_close()
1968 if (data->ssl_active) { in data_close()
1970 ftp_ssl_shutdown(ftp, data->fd, data->ssl_handle); in data_close()
1971 data->ssl_active = 0; in data_close()
1974 closesocket(data->fd); in data_close()
1977 ftp->data = NULL; in data_close()
1979 efree(data); in data_close()
1990 databuf_t *data = NULL; in ftp_genlist() local
2009 if ((data = ftp_getdata(ftp)) == NULL) { in ftp_genlist()
2012 ftp->data = data; in ftp_genlist()
2023 ftp->data = data_close(ftp, data); in ftp_genlist()
2029 if ((data = data_accept(data, ftp)) == NULL) { in ftp_genlist()
2035 while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) { in ftp_genlist()
2040 php_stream_write(tmpstream, data->buf, rcvd); in ftp_genlist()
2043 for (ptr = data->buf; rcvd; rcvd--, ptr++) { in ftp_genlist()
2051 ftp->data = data_close(ftp, data); in ftp_genlist()
2081 ftp->data = data_close(ftp, data); in ftp_genlist()
2094 databuf_t *data = NULL; in ftp_nb_get() local
2105 if ((data = ftp_getdata(ftp)) == NULL) { in ftp_nb_get()
2130 if ((data = data_accept(data, ftp)) == NULL) { in ftp_nb_get()
2134 ftp->data = data; in ftp_nb_get()
2142 ftp->data = data_close(ftp, data); in ftp_nb_get()
2152 databuf_t *data = NULL; in ftp_nb_continue_read() local
2158 data = ftp->data; in ftp_nb_continue_read()
2161 if (!data_available(ftp, data->fd)) { in ftp_nb_continue_read()
2168 if ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) { in ftp_nb_continue_read()
2174 for (ptr = data->buf; rcvd; rcvd--, ptr++) { in ftp_nb_continue_read()
2183 } else if (rcvd != php_stream_write(ftp->stream, data->buf, rcvd)) { in ftp_nb_continue_read()
2195 ftp->data = data = data_close(ftp, data); in ftp_nb_continue_read()
2205 ftp->data = data_close(ftp, data); in ftp_nb_continue_read()
2215 databuf_t *data = NULL; in ftp_nb_put() local
2224 if ((data = ftp_getdata(ftp)) == NULL) { in ftp_nb_put()
2247 if ((data = data_accept(data, ftp)) == NULL) { in ftp_nb_put()
2250 ftp->data = data; in ftp_nb_put()
2258 ftp->data = data_close(ftp, data); in ftp_nb_put()
2274 if (!data_writeable(ftp, ftp->data->fd)) { in ftp_nb_continue_write()
2279 ptr = ftp->data->buf; in ftp_nb_continue_write()
2292 if (my_send(ftp, ftp->data->fd, ftp->data->buf, size) != size) { in ftp_nb_continue_write()
2299 if (size && my_send(ftp, ftp->data->fd, ftp->data->buf, size) != size) { in ftp_nb_continue_write()
2302 ftp->data = data_close(ftp, ftp->data); in ftp_nb_continue_write()
2310 ftp->data = data_close(ftp, ftp->data); in ftp_nb_continue_write()