all the way up to the user interface. All code modules bug sftp.c have
been completed.
Functions that return an "int", or similar return LIBSSH2CHANNEL_EAGAIN to
indicate some part of the call would block, in non-blocking mode.
Functions that return a structure, like "LIBSSH2_CHANNEL *", return NULL
and set the libssh2 error. The error can be obtained with either
libssh2_session_last_error() or libssh2_session_last_errno(). Either of
these will return the error code of LIBSSH2_ERROR_EAGAIN if the
call would block, in non-blocking mode.
The current state of a function and some variable are keep in the
structures so that on the next call the operation that would block can
be retried again with the same data.
the recent commits converted the tabs to 4 spaces, which matched the
initial indent size. Other commits converted the tabs to 8 spaces, this
didn't match.
All the code has been converted to 4 space indents. No changes to line
lengths or actual code was performed. This is in preperation to my up
coming non-blocking work so my commits should only be code changes and
line lengths in the code I am working on.
various stuff if libssh2 was built with debug. If built without debug, the
function does nothing.
2 - configure --enable-debug is now enough to build a debug version (including
picky compiler options)
3 - internally, we no longer need/use #ifdef/#endif around all uses of the
_libssh2_debug() function/macro.
The scp.c example is the first application to test this new debug logging.
blocking way. The channel code is now responsible for enabling/disabling
blocking status and to work with it.
I've also modified indenting and fixed compiler warnings at places, and
added a bunch of new examples in example/simple that I've used to verify that
the code still runs like before.
libssh2_channel_{read|write}nb_ex() and libssh2_sftp_{read|write}nb() are the
four new functions that supposedly work non-blocking.
1 - #include <inttypes.h> and uses uint32_t (this is not very portable and
need attention as I mentioned in my separate mail)
2 - changes libssh2_blocking_read() to return ssize_t and all code that uses
this function explicitly checks its return code (better).
3 - I fixed a bunch of compiler warnings where functions got called with
unsigned char * when they expect char *. I strongly suggest we patch away
all warnings - now.
*
* "All implementations MUST be able to process packets with
* uncompressed payload length of 32768 bytes or less and
* total packet size of 35000 bytes or less (including length,
* padding length, payload, padding, and MAC.)."
*/
Protect against an improper packet from producing unreasonable values.
Credit goes to Daniel Stenberg
Speaking of which: Why wasn't it JUST a memset() call?
The encrypted version of packet_write fills in this data with OpenSSL
RAND_bytes() data, and as far as the unencrypted version goes?
Well, it's unencrypted, randomness doesn't help at that point.
alloc and free calls.
Since the cipher and mac layers aren't runtime extensible (yet)
and we know neither of these works in sizes greater than 32,
we can safely set aside a 64 byte block of data on the stack
for crypting and hashing.
This will make a big difference during quasi-non-blocking reads
where libssh2_packet_read() is polled repeatedly.
block of memory to be allocated leading to indeterminate results.
SSH-TRANS only requires implementations to handle about about 32k
compressed length per packet. Allow 40k to be safe, but no more.