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()
786 databuf_t *data = NULL; in ftp_get() local
798 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_get()
802 ftp->data = data; in ftp_get()
825 if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { in ftp_get()
830 while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) { in ftp_get()
839 char *ptr = data->buf; in ftp_get()
861 } else if (rcvd != php_stream_write(outstream, data->buf, rcvd)) { in ftp_get()
866 ftp->data = data = data_close(ftp, data); in ftp_get()
874 ftp->data = data_close(ftp, data); in ftp_get()
884 databuf_t *data = NULL; in ftp_put() local
896 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_put()
899 ftp->data = data; in ftp_put()
921 if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { in ftp_put()
926 ptr = data->buf; in ftp_put()
930 if (my_send(ftp, data->fd, data->buf, size) != size) { in ftp_put()
933 ptr = data->buf; in ftp_put()
946 if (size && my_send(ftp, data->fd, data->buf, size) != size) { in ftp_put()
949 ftp->data = data = data_close(ftp, data); in ftp_put()
956 ftp->data = data_close(ftp, data); in ftp_put()
1100 char *data; in ftp_putcmd() local
1123 data = ftp->outbuf; in ftp_putcmd()
1128 if (my_send(ftp, ftp->fd, data, size) != size) { in ftp_putcmd()
1141 char *data, *eol; in ftp_readline() local
1151 data = ftp->inbuf; in ftp_readline()
1155 for (eol = data; rcvd; rcvd--, eol++) { in ftp_readline()
1177 data = eol; in ftp_readline()
1178 if ((rcvd = my_recv(ftp, ftp->fd, data, size)) < 1) { in ftp_readline()
1252 } else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) { in my_send()
1253 sent = SSL_write(ftp->data->ssl_handle, buf, size); in my_send()
1292 } else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) { in my_recv()
1293 nr_bytes = SSL_read(ftp->data->ssl_handle, buf, len); in my_recv()
1372 databuf_t *data; in ftp_getdata() local
1386 data = ecalloc(1, sizeof(*data)); in ftp_getdata()
1387 data->listener = -1; in ftp_getdata()
1388 data->fd = -1; in ftp_getdata()
1389 data->type = ftp->type; in ftp_getdata()
1413 data->fd = fd; in ftp_getdata()
1415 ftp->data = data; in ftp_getdata()
1416 return data; in ftp_getdata()
1441 data->listener = fd; in ftp_getdata()
1459 ftp->data = data; in ftp_getdata()
1460 return data; in ftp_getdata()
1476 ftp->data = data; in ftp_getdata()
1477 return data; in ftp_getdata()
1483 efree(data); in ftp_getdata()
1491 data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC) in data_accept() argument
1500 if (data->fd != -1) { in data_accept()
1504 data->fd = my_accept(ftp, data->listener, (struct sockaddr*) &addr, &size); in data_accept()
1505 closesocket(data->listener); in data_accept()
1506 data->listener = -1; in data_accept()
1508 if (data->fd == -1) { in data_accept()
1509 efree(data); in data_accept()
1526 data->ssl_handle = SSL_new(ctx); in data_accept()
1527 if (data->ssl_handle == NULL) { in data_accept()
1534 SSL_set_fd(data->ssl_handle, data->fd); in data_accept()
1537 SSL_copy_session_id(data->ssl_handle, ftp->ssl_handle); in data_accept()
1540 if (SSL_connect(data->ssl_handle) <= 0) { in data_accept()
1542 SSL_shutdown(data->ssl_handle); in data_accept()
1546 data->ssl_active = 1; in data_accept()
1551 return data; in data_accept()
1558 data_close(ftpbuf_t *ftp, databuf_t *data) in data_close() argument
1560 if (data == NULL) { in data_close()
1563 if (data->listener != -1) { in data_close()
1565 if (data->ssl_active) { in data_close()
1566 SSL_shutdown(data->ssl_handle); in data_close()
1567 data->ssl_active = 0; in data_close()
1570 closesocket(data->listener); in data_close()
1572 if (data->fd != -1) { in data_close()
1574 if (data->ssl_active) { in data_close()
1575 SSL_shutdown(data->ssl_handle); in data_close()
1576 data->ssl_active = 0; in data_close()
1579 closesocket(data->fd); in data_close()
1582 ftp->data = NULL; in data_close()
1584 efree(data); in data_close()
1595 databuf_t *data = NULL; in ftp_genlist() local
1614 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_genlist()
1617 ftp->data = data; in ftp_genlist()
1628 ftp->data = data_close(ftp, data); in ftp_genlist()
1634 if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { in ftp_genlist()
1640 while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) { in ftp_genlist()
1645 php_stream_write(tmpstream, data->buf, rcvd); in ftp_genlist()
1648 for (ptr = data->buf; rcvd; rcvd--, ptr++) { in ftp_genlist()
1658 ftp->data = data = data_close(ftp, data); in ftp_genlist()
1688 ftp->data = data_close(ftp, data); in ftp_genlist()
1701 databuf_t *data = NULL; in ftp_nb_get() local
1712 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_nb_get()
1740 if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { in ftp_nb_get()
1744 ftp->data = data; in ftp_nb_get()
1752 ftp->data = data_close(ftp, data); in ftp_nb_get()
1762 databuf_t *data = NULL; in ftp_nb_continue_read() local
1768 data = ftp->data; in ftp_nb_continue_read()
1771 if (!data_available(ftp, data->fd)) { in ftp_nb_continue_read()
1778 if ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) { in ftp_nb_continue_read()
1784 for (ptr = data->buf; rcvd; rcvd--, ptr++) { in ftp_nb_continue_read()
1793 } else if (rcvd != php_stream_write(ftp->stream, data->buf, rcvd)) { in ftp_nb_continue_read()
1805 ftp->data = data = data_close(ftp, data); in ftp_nb_continue_read()
1815 ftp->data = data_close(ftp, data); in ftp_nb_continue_read()
1825 databuf_t *data = NULL; in ftp_nb_put() local
1834 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_nb_put()
1857 if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { in ftp_nb_put()
1860 ftp->data = data; in ftp_nb_put()
1868 ftp->data = data_close(ftp, data); in ftp_nb_put()
1884 if (!data_writeable(ftp, ftp->data->fd)) { in ftp_nb_continue_write()
1889 ptr = ftp->data->buf; in ftp_nb_continue_write()
1902 if (my_send(ftp, ftp->data->fd, ftp->data->buf, size) != size) { in ftp_nb_continue_write()
1909 if (size && my_send(ftp, ftp->data->fd, ftp->data->buf, size) != size) { in ftp_nb_continue_write()
1912 ftp->data = data_close(ftp, ftp->data); in ftp_nb_continue_write()
1920 ftp->data = data_close(ftp, ftp->data); in ftp_nb_continue_write()