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()
796 databuf_t *data = NULL; in ftp_get() local
807 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_get()
811 ftp->data = data; in ftp_get()
830 if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { in ftp_get()
834 while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) { in ftp_get()
843 char *ptr = data->buf; in ftp_get()
865 } else if (rcvd != php_stream_write(outstream, data->buf, rcvd)) { in ftp_get()
870 ftp->data = data = data_close(ftp, data); in ftp_get()
878 ftp->data = data_close(ftp, data); in ftp_get()
888 databuf_t *data = NULL; in ftp_put() local
900 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_put()
903 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()
1250 } else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) { in my_send()
1251 sent = SSL_write(ftp->data->ssl_handle, buf, size); in my_send()
1290 } else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) { in my_recv()
1291 nr_bytes = SSL_read(ftp->data->ssl_handle, buf, len); in my_recv()
1370 databuf_t *data; in ftp_getdata() local
1384 data = ecalloc(1, sizeof(*data)); in ftp_getdata()
1385 data->listener = -1; in ftp_getdata()
1386 data->fd = -1; in ftp_getdata()
1387 data->type = ftp->type; in ftp_getdata()
1411 data->fd = fd; in ftp_getdata()
1413 ftp->data = data; in ftp_getdata()
1414 return data; in ftp_getdata()
1439 data->listener = fd; in ftp_getdata()
1457 ftp->data = data; in ftp_getdata()
1458 return data; in ftp_getdata()
1474 ftp->data = data; in ftp_getdata()
1475 return data; in ftp_getdata()
1481 efree(data); in ftp_getdata()
1489 data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC) in data_accept() argument
1499 if (data->fd != -1) { in data_accept()
1503 data->fd = my_accept(ftp, data->listener, (struct sockaddr*) &addr, &size); in data_accept()
1504 closesocket(data->listener); in data_accept()
1505 data->listener = -1; in data_accept()
1507 if (data->fd == -1) { in data_accept()
1508 efree(data); in data_accept()
1528 data->ssl_handle = SSL_new(ctx); in data_accept()
1529 if (data->ssl_handle == NULL) { in data_accept()
1536 SSL_set_fd(data->ssl_handle, data->fd); in data_accept()
1539 SSL_copy_session_id(data->ssl_handle, ftp->ssl_handle); in data_accept()
1542 if (SSL_connect(data->ssl_handle) <= 0) { in data_accept()
1544 SSL_shutdown(data->ssl_handle); in data_accept()
1545 SSL_free(data->ssl_handle); in data_accept()
1549 data->ssl_active = 1; in data_accept()
1554 return data; in data_accept()
1561 data_close(ftpbuf_t *ftp, databuf_t *data) in data_close() argument
1566 if (data == NULL) { in data_close()
1569 if (data->listener != -1) { in data_close()
1571 if (data->ssl_active) { in data_close()
1573 ctx = SSL_get_SSL_CTX(data->ssl_handle); in data_close()
1576 SSL_shutdown(data->ssl_handle); in data_close()
1577 SSL_free(data->ssl_handle); in data_close()
1578 data->ssl_active = 0; in data_close()
1581 closesocket(data->listener); in data_close()
1583 if (data->fd != -1) { in data_close()
1585 if (data->ssl_active) { in data_close()
1586 ctx = SSL_get_SSL_CTX(data->ssl_handle); in data_close()
1589 SSL_shutdown(data->ssl_handle); in data_close()
1590 SSL_free(data->ssl_handle); in data_close()
1591 data->ssl_active = 0; in data_close()
1594 closesocket(data->fd); in data_close()
1597 ftp->data = NULL; in data_close()
1599 efree(data); in data_close()
1610 databuf_t *data = NULL; in ftp_genlist() local
1629 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_genlist()
1632 ftp->data = data; in ftp_genlist()
1643 ftp->data = data_close(ftp, data); in ftp_genlist()
1649 if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { in ftp_genlist()
1655 while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) { in ftp_genlist()
1660 php_stream_write(tmpstream, data->buf, rcvd); in ftp_genlist()
1663 for (ptr = data->buf; rcvd; rcvd--, ptr++) { in ftp_genlist()
1671 ftp->data = data_close(ftp, data); in ftp_genlist()
1701 ftp->data = data_close(ftp, data); in ftp_genlist()
1714 databuf_t *data = NULL; in ftp_nb_get() local
1725 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_nb_get()
1746 if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { in ftp_nb_get()
1750 ftp->data = data; in ftp_nb_get()
1758 ftp->data = data_close(ftp, data); in ftp_nb_get()
1768 databuf_t *data = NULL; in ftp_nb_continue_read() local
1774 data = ftp->data; in ftp_nb_continue_read()
1777 if (!data_available(ftp, data->fd)) { in ftp_nb_continue_read()
1784 if ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) { in ftp_nb_continue_read()
1790 for (ptr = data->buf; rcvd; rcvd--, ptr++) { in ftp_nb_continue_read()
1799 } else if (rcvd != php_stream_write(ftp->stream, data->buf, rcvd)) { in ftp_nb_continue_read()
1811 ftp->data = data = data_close(ftp, data); in ftp_nb_continue_read()
1821 ftp->data = data_close(ftp, data); in ftp_nb_continue_read()
1831 databuf_t *data = NULL; in ftp_nb_put() local
1840 if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { in ftp_nb_put()
1859 if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { in ftp_nb_put()
1862 ftp->data = data; in ftp_nb_put()
1870 ftp->data = data_close(ftp, data); in ftp_nb_put()
1886 if (!data_writeable(ftp, ftp->data->fd)) { in ftp_nb_continue_write()
1891 ptr = ftp->data->buf; in ftp_nb_continue_write()
1904 if (my_send(ftp, ftp->data->fd, ftp->data->buf, size) != size) { in ftp_nb_continue_write()
1911 if (size && my_send(ftp, ftp->data->fd, ftp->data->buf, size) != size) { in ftp_nb_continue_write()
1914 ftp->data = data_close(ftp, ftp->data); in ftp_nb_continue_write()
1922 ftp->data = data_close(ftp, ftp->data); in ftp_nb_continue_write()