1libssh2_sftp_readdir_ex(3) libssh2 manual libssh2_sftp_readdir_ex(3)
2
3
4
6 libssh2_sftp_readdir_ex - read directory data from an SFTP handle
7
9 #include <libssh2.h>
10 #include <libssh2_sftp.h>
11
12 int
13 libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *handle,
14 char *buffer, size_t buffer_maxlen,
15 char *longentry, size_t longentry_maxlen,
16 LIBSSH2_SFTP_ATTRIBUTES *attrs);
17
19 Reads a block of data from a LIBSSH2_SFTP_HANDLE and returns file entry
20 information for the next entry, if any.
21
22 handle - is the SFTP File Handle as returned by libssh2_sftp_open_ex(3)
23
24 buffer - is a pointer to a pre-allocated buffer of at least buf‐
25 fer_maxlen bytes to read data into.
26
27 buffer_maxlen - 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
29 truncated to fit.
30
31 longentry - is a pointer to a pre-allocated buffer of at least longen‐
32 try_maxlen bytes to read data into. The format of the `longname' field
33 is unspecified by SFTP protocol. It MUST be suitable for use in the
34 output of a directory listing command (in fact, the recommended opera‐
35 tion for a directory listing command is to simply display this data).
36
37 longentry_maxlen - is the length of longentry in bytes. If the length
38 of the full directory entry is longer than the space provided by lon‐
39 gentry_maxlen it will be truncated to fit.
40
41 attrs - is a pointer to LIBSSH2_SFTP_ATTRIBUTES storage to populate
42 statbuf style data into.
43
45 Number of bytes actually populated into buffer (not counting the termi‐
46 nating zero), or negative on failure. It returns LIBSSH2_ERROR_EAGAIN
47 when it would otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative
48 number, it isn't really a failure per se.
49
51 Passing in a too small buffer for 'buffer' or 'longentry' when receiv‐
52 ing data only results in libssh2 1.2.7 or earlier to not copy the
53 entire data amount, and it is not possible for the application to tell
54 when it happens!
55
57 LIBSSH2_ERROR_ALLOC - An internal memory allocation call failed.
58
59 LIBSSH2_ERROR_SOCKET_SEND - Unable to send data on socket.
60
61 LIBSSH2_ERROR_SOCKET_TIMEOUT -
62
63 LIBSSH2_ERROR_SFTP_PROTOCOL - An invalid SFTP protocol response was
64 received on the socket, or an SFTP operation caused an errorcode to be
65 returned by the server.
66
67 From 1.2.8, LIBSSH2_ERROR_BUFFER_TOO_SMALL is returned if any of the
68 given 'buffer' or 'longentry' buffers are too small to fit the
69 requested object name.
70
72 libssh2_sftp_open_ex(3), libssh2_sftp_close_handle(3)
73
74
75
76libssh2 0.15 1 Jun 2007 libssh2_sftp_readdir_ex(3)