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