libssh2_sftp_readdir_ex.3 (2681B)
1.TH libssh2_sftp_readdir_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2" 2.SH NAME 3libssh2_sftp_readdir_ex - read directory data from an SFTP handle 4.SH SYNOPSIS 5.nf 6#include <libssh2.h> 7#include <libssh2_sftp.h> 8 9int 10libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *handle, 11 char *buffer, size_t buffer_maxlen, 12 char *longentry, size_t longentry_maxlen, 13 LIBSSH2_SFTP_ATTRIBUTES *attrs); 14.fi 15.SH DESCRIPTION 16Reads a block of data from a LIBSSH2_SFTP_HANDLE and returns file entry 17information for the next entry, if any. 18 19\fIhandle\fP - is the SFTP File Handle as returned by 20.BR libssh2_sftp_open_ex(3) 21 22\fIbuffer\fP - is a pointer to a pre-allocated buffer of at least 23\fIbuffer_maxlen\fP bytes to read data into. 24 25\fIbuffer_maxlen\fP - is the length of buffer in bytes. If the length of the 26filename is longer than the space provided by buffer_maxlen it will be 27truncated to fit. 28 29\fIlongentry\fP - is a pointer to a pre-allocated buffer of at least 30\fIlongentry_maxlen\fP bytes to read data into. The format of the `longname' 31field is unspecified by SFTP protocol. It MUST be suitable for use in the 32output of a directory listing command (in fact, the recommended operation for 33a directory listing command is to display this data). 34 35\fIlongentry_maxlen\fP - is the length of longentry in bytes. If the length of 36the full directory entry is longer than the space provided by 37\fIlongentry_maxlen\fP it will be truncated to fit. 38 39\fIattrs\fP - is a pointer to LIBSSH2_SFTP_ATTRIBUTES storage to populate 40statbuf style data into. 41.SH RETURN VALUE 42Number of bytes actually populated into buffer (not counting the terminating 43zero), or negative on failure. It returns LIBSSH2_ERROR_EAGAIN when it would 44otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative number, it is not 45really a failure per se. 46.SH BUG 47Passing in a too small buffer for 'buffer' or 'longentry' when receiving data 48only results in libssh2 1.2.7 or earlier to not copy the entire data amount, 49and it is not possible for the application to tell when it happens! 50.SH ERRORS 51\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. 52 53\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket. 54 55\fILIBSSH2_ERROR_SOCKET_TIMEOUT\fP - 56 57\fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was 58received on the socket, or an SFTP operation caused an errorcode to be 59returned by the server. 60 61From 1.2.8, LIBSSH2_ERROR_BUFFER_TOO_SMALL is returned if any of the 62given 'buffer' or 'longentry' buffers are too small to fit the requested 63object name. 64.SH SEE ALSO 65.BR libssh2_sftp_open_ex(3), 66.BR libssh2_sftp_close_handle(3)