1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-21 14:00:51 +03:00

transport.c: Add some comments

This commit is contained in:
Dan Fandrich
2023-01-06 13:48:37 -08:00
parent 16619a8edd
commit 1e1a74eb7e

View File

@@ -122,7 +122,8 @@ debugdump(LIBSSH2_SESSION * session,
#endif #endif
/* decrypt() decrypts 'len' bytes from 'source' to 'dest'. /* decrypt() decrypts 'len' bytes from 'source' to 'dest' in units of
* blocksize.
* *
* returns 0 on success and negative on failure * returns 0 on success and negative on failure
*/ */
@@ -274,13 +275,17 @@ int _libssh2_transport_read(LIBSSH2_SESSION * session)
{ {
int rc; int rc;
struct transportpacket *p = &session->packet; struct transportpacket *p = &session->packet;
int remainbuf; int remainpack; /* how much there is left to add to the current payload
int remainpack; package */
int numbytes; int remainbuf; /* how much data there is remaining in the buffer to deal
int numdecrypt; with before we should read more from the network */
unsigned char block[MAX_BLOCKSIZE]; int numbytes; /* how much data to deal with from the buffer on this
int blocksize; iteration through the loop */
int encrypted = 1; int numdecrypt; /* number of bytes to decrypt this iteration */
unsigned char block[MAX_BLOCKSIZE]; /* working block buffer */
int blocksize; /* minimum number of bytes we need before we can
use them */
int encrypted = 1; /* whether the packet is encrypted or not */
/* default clear the bit */ /* default clear the bit */
session->socket_block_directions &= ~LIBSSH2_SESSION_BLOCK_INBOUND; session->socket_block_directions &= ~LIBSSH2_SESSION_BLOCK_INBOUND;
@@ -400,7 +405,9 @@ int _libssh2_transport_read(LIBSSH2_SESSION * session)
numbytes = remainbuf; numbytes = remainbuf;
if(!p->total_num) { if(!p->total_num) {
size_t total_num; size_t total_num; /* the number of bytes following the initial
(5 bytes) packet length and padding length
fields */
/* No payload package area allocated yet. To know the /* No payload package area allocated yet. To know the
size of this payload, we need to decrypt the first size of this payload, we need to decrypt the first