diff --git a/include/libssh2.h b/include/libssh2.h index 8c97dc60..8274eda5 100644 --- a/include/libssh2.h +++ b/include/libssh2.h @@ -356,6 +356,9 @@ typedef struct _LIBSSH2_POLLFD { #define LIBSSH2_ERROR_PUBLICKEY_PROTOCOL -36 #define LIBSSH2_ERROR_EAGAIN -37 #define LIBSSH2_ERROR_BUFFER_TOO_SMALL -38 +#define LIBSSH2_ERROR_BAD_USE -39 +#define LIBSSH2_ERROR_COMPRESS -40 +#define LIBSSH2_ERROR_OUT_OF_BOUNDARY -41 /* Session API */ LIBSSH2_API LIBSSH2_SESSION * diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h index d845d286..7dedfe29 100644 --- a/src/libssh2_priv.h +++ b/src/libssh2_priv.h @@ -1154,18 +1154,19 @@ ssize_t _libssh2_send(libssh2_socket_t socket, const void *buffer, size_t length int _libssh2_wait_socket(LIBSSH2_SESSION *session); -/* CAUTION: some of these error codes are returned in the public API and is - there known with other #defined names from the public header file. They - should not be changed. */ +/* These started out as private return codes for the transport layer, but was + converted to using the library-wide return codes to easy propagation of the + error reasons all over etc without risking mixups. The PACKET_* names are + left only to reduce the impact of changing the code all over.*/ -#define PACKET_TIMEOUT -7 -#define PACKET_BADUSE -6 -#define PACKET_COMPRESS -5 -#define PACKET_TOOBIG -4 -#define PACKET_ENOMEM -3 +#define PACKET_TIMEOUT LIBSSH2_ERROR_TIMEOUT +#define PACKET_BADUSE LIBSSH2_ERROR_BAD_USE +#define PACKET_COMPRESS LIBSSH2_ERROR_COMPRESS +#define PACKET_TOOBIG LIBSSH2_ERROR_OUT_OF_BOUNDARY +#define PACKET_ENOMEM LIBSSH2_ERROR_ALLOC #define PACKET_EAGAIN LIBSSH2_ERROR_EAGAIN -#define PACKET_FAIL -1 -#define PACKET_NONE 0 +#define PACKET_FAIL LIBSSH2_ERROR_SOCKET_NONE +#define PACKET_NONE LIBSSH2_ERROR_NONE libssh2pack_t _libssh2_packet_read(LIBSSH2_SESSION * session);