Lines Matching refs:data

106 static databuf_t*	data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC);
109 static databuf_t* data_close(ftpbuf_t *ftp, databuf_t *data);
178 if (ftp->data) { in ftp_close()
179 data_close(ftp, ftp->data); in ftp_close()
801 databuf_t *data = NULL; in ftp_get() local
812 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_get()
816 ftp->data = data; in ftp_get()
835 if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { in ftp_get()
839 while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) { in ftp_get()
848 char *ptr = data->buf; in ftp_get()
870 } else if (rcvd != php_stream_write(outstream, data->buf, rcvd)) { in ftp_get()
875 ftp->data = data = data_close(ftp, data); in ftp_get()
883 ftp->data = data_close(ftp, data); in ftp_get()
893 databuf_t *data = NULL; in ftp_put() local
905 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_put()
908 ftp->data = data; in ftp_put()
926 if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { in ftp_put()
931 ptr = data->buf; in ftp_put()
935 if (my_send(ftp, data->fd, data->buf, size) != size) { in ftp_put()
938 ptr = data->buf; in ftp_put()
951 if (size && my_send(ftp, data->fd, data->buf, size) != size) { in ftp_put()
954 ftp->data = data = data_close(ftp, data); in ftp_put()
961 ftp->data = data_close(ftp, data); in ftp_put()
1105 char *data; in ftp_putcmd() local
1128 data = ftp->outbuf; in ftp_putcmd()
1133 if (my_send(ftp, ftp->fd, data, size) != size) { in ftp_putcmd()
1146 char *data, *eol; in ftp_readline() local
1156 data = ftp->inbuf; in ftp_readline()
1160 for (eol = data; rcvd; rcvd--, eol++) { in ftp_readline()
1182 data = eol; in ftp_readline()
1183 if ((rcvd = my_recv(ftp, ftp->fd, data, size)) < 1) { in ftp_readline()
1255 } else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) { in my_send()
1256 sent = SSL_write(ftp->data->ssl_handle, buf, size); in my_send()
1295 } else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) { in my_recv()
1296 nr_bytes = SSL_read(ftp->data->ssl_handle, buf, len); in my_recv()
1375 databuf_t *data; in ftp_getdata() local
1389 data = ecalloc(1, sizeof(*data)); in ftp_getdata()
1390 data->listener = -1; in ftp_getdata()
1391 data->fd = -1; in ftp_getdata()
1392 data->type = ftp->type; in ftp_getdata()
1416 data->fd = fd; in ftp_getdata()
1418 ftp->data = data; in ftp_getdata()
1419 return data; in ftp_getdata()
1444 data->listener = fd; in ftp_getdata()
1462 ftp->data = data; in ftp_getdata()
1463 return data; in ftp_getdata()
1479 ftp->data = data; in ftp_getdata()
1480 return data; in ftp_getdata()
1486 efree(data); in ftp_getdata()
1494 data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC) in data_accept() argument
1505 if (data->fd != -1) { in data_accept()
1509 data->fd = my_accept(ftp, data->listener, (struct sockaddr*) &addr, &size); in data_accept()
1510 closesocket(data->listener); in data_accept()
1511 data->listener = -1; in data_accept()
1513 if (data->fd == -1) { in data_accept()
1514 efree(data); in data_accept()
1529 data->ssl_handle = SSL_new(ctx); in data_accept()
1530 if (data->ssl_handle == NULL) { in data_accept()
1535 SSL_set_fd(data->ssl_handle, data->fd); in data_accept()
1538 SSL_copy_session_id(data->ssl_handle, ftp->ssl_handle); in data_accept()
1545 SSL_free(data->ssl_handle); in data_accept()
1550 result = SSL_set_session(data->ssl_handle, session); in data_accept()
1553 SSL_free(data->ssl_handle); in data_accept()
1557 if (SSL_connect(data->ssl_handle) <= 0) { in data_accept()
1559 SSL_shutdown(data->ssl_handle); in data_accept()
1560 SSL_free(data->ssl_handle); in data_accept()
1564 data->ssl_active = 1; in data_accept()
1569 return data; in data_accept()
1576 data_close(ftpbuf_t *ftp, databuf_t *data) in data_close() argument
1581 if (data == NULL) { in data_close()
1584 if (data->listener != -1) { in data_close()
1586 if (data->ssl_active) { in data_close()
1588 SSL_shutdown(data->ssl_handle); in data_close()
1589 SSL_free(data->ssl_handle); in data_close()
1590 data->ssl_active = 0; in data_close()
1593 closesocket(data->listener); in data_close()
1595 if (data->fd != -1) { in data_close()
1597 if (data->ssl_active) { in data_close()
1599 SSL_shutdown(data->ssl_handle); in data_close()
1600 SSL_free(data->ssl_handle); in data_close()
1601 data->ssl_active = 0; in data_close()
1604 closesocket(data->fd); in data_close()
1607 ftp->data = NULL; in data_close()
1609 efree(data); in data_close()
1620 databuf_t *data = NULL; in ftp_genlist() local
1639 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_genlist()
1642 ftp->data = data; in ftp_genlist()
1653 ftp->data = data_close(ftp, data); in ftp_genlist()
1659 if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { in ftp_genlist()
1665 while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) { in ftp_genlist()
1670 php_stream_write(tmpstream, data->buf, rcvd); in ftp_genlist()
1673 for (ptr = data->buf; rcvd; rcvd--, ptr++) { in ftp_genlist()
1681 ftp->data = data_close(ftp, data); in ftp_genlist()
1711 ftp->data = data_close(ftp, data); in ftp_genlist()
1724 databuf_t *data = NULL; in ftp_nb_get() local
1735 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_nb_get()
1756 if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { in ftp_nb_get()
1760 ftp->data = data; in ftp_nb_get()
1768 ftp->data = data_close(ftp, data); in ftp_nb_get()
1778 databuf_t *data = NULL; in ftp_nb_continue_read() local
1784 data = ftp->data; in ftp_nb_continue_read()
1787 if (!data_available(ftp, data->fd)) { in ftp_nb_continue_read()
1794 if ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) { in ftp_nb_continue_read()
1800 for (ptr = data->buf; rcvd; rcvd--, ptr++) { in ftp_nb_continue_read()
1809 } else if (rcvd != php_stream_write(ftp->stream, data->buf, rcvd)) { in ftp_nb_continue_read()
1821 ftp->data = data = data_close(ftp, data); in ftp_nb_continue_read()
1831 ftp->data = data_close(ftp, data); in ftp_nb_continue_read()
1841 databuf_t *data = NULL; in ftp_nb_put() local
1850 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_nb_put()
1869 if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { in ftp_nb_put()
1872 ftp->data = data; in ftp_nb_put()
1880 ftp->data = data_close(ftp, data); in ftp_nb_put()
1896 if (!data_writeable(ftp, ftp->data->fd)) { in ftp_nb_continue_write()
1901 ptr = ftp->data->buf; in ftp_nb_continue_write()
1914 if (my_send(ftp, ftp->data->fd, ftp->data->buf, size) != size) { in ftp_nb_continue_write()
1921 if (size && my_send(ftp, ftp->data->fd, ftp->data->buf, size) != size) { in ftp_nb_continue_write()
1924 ftp->data = data_close(ftp, ftp->data); in ftp_nb_continue_write()
1932 ftp->data = data_close(ftp, ftp->data); in ftp_nb_continue_write()