diff --git a/src/channel.c b/src/channel.c index 97ba4b47..6999d3bd 100644 --- a/src/channel.c +++ b/src/channel.c @@ -721,7 +721,7 @@ libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener) static LIBSSH2_CHANNEL * channel_forward_accept(LIBSSH2_LISTENER *listener) { - libssh2pack_t rc; + int rc; do { rc = _libssh2_transport_read(listener->session); @@ -1288,7 +1288,7 @@ _libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel, static const unsigned char reply_codes[3] = { SSH_MSG_CHANNEL_SUCCESS, SSH_MSG_CHANNEL_FAILURE, 0 }; unsigned long data_len; - libssh2pack_t rc; + int rc; if (channel->process_state == libssh2_NB_state_idle) { /* 10 = packet_type(1) + channel(4) + request_len(4) + want_reply(1) */ @@ -1710,7 +1710,7 @@ static ssize_t channel_read(LIBSSH2_CHANNEL *channel, int stream_id, char *buf, size_t buflen) { LIBSSH2_SESSION *session = channel->session; - libssh2pack_t rc; + int rc; int bytes_read = 0; int bytes_want; int unlink_packet; @@ -1954,7 +1954,7 @@ _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id, const char *buf, size_t buflen) { LIBSSH2_SESSION *session = channel->session; - libssh2pack_t rc; + int rc; ssize_t wrote = 0; /* counter for this specific this call */ if (channel->write_state == libssh2_NB_state_idle) { diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h index f3019d91..cfb8262f 100644 --- a/src/libssh2_priv.h +++ b/src/libssh2_priv.h @@ -865,7 +865,7 @@ struct _LIBSSH2_SESSION libssh2_nonblocking_states fullpacket_state; int fullpacket_macstate; int fullpacket_payload_len; - libssh2pack_t fullpacket_packet_type; + int fullpacket_packet_type; /* State variables used in libssh2_sftp_init() */ libssh2_nonblocking_states sftpInit_state; @@ -1166,7 +1166,7 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session); #define PACKET_FAIL LIBSSH2_ERROR_SOCKET_NONE #define PACKET_NONE LIBSSH2_ERROR_NONE -libssh2pack_t _libssh2_packet_read(LIBSSH2_SESSION * session); +int _libssh2_packet_read(LIBSSH2_SESSION * session); int _libssh2_packet_ask(LIBSSH2_SESSION * session, unsigned char packet_type, unsigned char **data, unsigned long *data_len, diff --git a/src/packet.c b/src/packet.c index e9723a0b..be50cc4a 100644 --- a/src/packet.c +++ b/src/packet.c @@ -990,7 +990,7 @@ _libssh2_packet_require(LIBSSH2_SESSION * session, unsigned char packet_type, } while (session->socket_state == LIBSSH2_SOCKET_CONNECTED) { - libssh2pack_t ret = _libssh2_transport_read(session); + int ret = _libssh2_transport_read(session); if (ret == PACKET_EAGAIN) { return PACKET_EAGAIN; } else if (ret == 0) { diff --git a/src/transport.c b/src/transport.c index 9bb592df..294293a9 100644 --- a/src/transport.c +++ b/src/transport.c @@ -95,10 +95,10 @@ debugdump(LIBSSH2_SESSION * session, /* decrypt() decrypts 'len' bytes from 'source' to 'dest'. * - * returns PACKET_NONE on success and PACKET_FAIL on failure + * returns 0 on success and negative on failure */ -static libssh2pack_t +static int decrypt(LIBSSH2_SESSION * session, unsigned char *source, unsigned char *dest, int len) { @@ -134,7 +134,7 @@ decrypt(LIBSSH2_SESSION * session, unsigned char *source, * fullpacket() gets called when a full packet has been received and properly * collected. */ -static libssh2pack_t +static int fullpacket(LIBSSH2_SESSION * session, int encrypted /* 1 or 0 */ ) { unsigned char macbuf[MAX_MACSIZE]; @@ -245,12 +245,10 @@ fullpacket(LIBSSH2_SESSION * session, int encrypted /* 1 or 0 */ ) /* * _libssh2_transport_read * - * Collect a packet into the input brigade block only controls whether or not - * to wait for a packet to start. + * Collect a packet into the input queue. * - * Returns packet type added to input brigade (PACKET_NONE if nothing added), - * or PACKET_FAIL on failure and PACKET_EAGAIN if it couldn't process a full - * packet. + * Returns packet type added to input queue (0 if nothing added), or a + * negative error number. */ /* @@ -572,7 +570,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION * session) return PACKET_FAIL; /* we never reach this point */ } -static libssh2pack_t +static int send_existing(LIBSSH2_SESSION * session, unsigned char *data, unsigned long data_len, ssize_t * ret) { @@ -665,7 +663,7 @@ _libssh2_transport_write(LIBSSH2_SESSION * session, unsigned char *data, int encrypted; int i; ssize_t ret; - libssh2pack_t rc; + int rc; unsigned char *orgdata = data; unsigned long orgdata_len = data_len;