[BACK]Return to packet.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/packet.c between version 1.3 and 1.4

version 1.3, 1999/09/29 18:16:19 version 1.4, 1999/09/30 05:03:04
Line 26 
Line 26 
 #include "cipher.h"  #include "cipher.h"
 #include "getput.h"  #include "getput.h"
   
 #ifdef WITH_ZLIB  
 #include "compress.h"  #include "compress.h"
 #endif /* WITH_ZLIB */  
   
 /* This variable contains the file descriptors used for communicating with  /* This variable contains the file descriptors used for communicating with
    the other side.  connection_in is used for reading; connection_out     the other side.  connection_in is used for reading; connection_out
Line 64 
Line 62 
 /* Scratch buffer for packet compression/decompression. */  /* Scratch buffer for packet compression/decompression. */
 static Buffer compression_buffer;  static Buffer compression_buffer;
   
 #ifdef WITH_ZLIB  
 /* Flag indicating whether packet compression/decompression is enabled. */  /* Flag indicating whether packet compression/decompression is enabled. */
 static int packet_compression = 0;  static int packet_compression = 0;
 #endif /* WITH_ZLIB */  
   
 /* Flag indicating whether this module has been initialized. */  /* Flag indicating whether this module has been initialized. */
 static int initialized = 0;  static int initialized = 0;
Line 163 
Line 159 
   buffer_free(&output);    buffer_free(&output);
   buffer_free(&outgoing_packet);    buffer_free(&outgoing_packet);
   buffer_free(&incoming_packet);    buffer_free(&incoming_packet);
 #ifdef WITH_ZLIB  
   if (packet_compression)    if (packet_compression)
     {      {
       buffer_free(&compression_buffer);        buffer_free(&compression_buffer);
       buffer_compress_uninit();        buffer_compress_uninit();
     }      }
 #endif /* WITH_ZLIB */  
 }  }
   
 /* Sets remote side protocol flags. */  /* Sets remote side protocol flags. */
Line 189 
Line 183 
   return remote_protocol_flags;    return remote_protocol_flags;
 }  }
   
 #ifdef WITH_ZLIB  
 /* Starts packet compression from the next packet on in both directions.  /* Starts packet compression from the next packet on in both directions.
    Level is compression level 1 (fastest) - 9 (slow, best) as in gzip. */     Level is compression level 1 (fastest) - 9 (slow, best) as in gzip. */
   
Line 202 
Line 195 
   buffer_init(&compression_buffer);    buffer_init(&compression_buffer);
   buffer_compress_init(level);    buffer_compress_init(level);
 }  }
 #endif /* WITH_ZLIB */  
   
 /* Encrypts the given number of bytes, copying from src to dest.  /* Encrypts the given number of bytes, copying from src to dest.
    bytes is known to be a multiple of 8. */     bytes is known to be a multiple of 8. */
Line 315 
Line 307 
   unsigned long checksum;    unsigned long checksum;
   u_int32_t rand = 0;    u_int32_t rand = 0;
   
 #ifdef WITH_ZLIB  
   /* If using packet compression, compress the payload of the outgoing    /* If using packet compression, compress the payload of the outgoing
      packet. */       packet. */
   if (packet_compression)    if (packet_compression)
Line 328 
Line 319 
       buffer_append(&outgoing_packet, buffer_ptr(&compression_buffer),        buffer_append(&outgoing_packet, buffer_ptr(&compression_buffer),
                     buffer_len(&compression_buffer));                      buffer_len(&compression_buffer));
     }      }
 #endif /* WITH_ZLIB */  
   
   /* Compute packet length without padding (add checksum, remove padding). */    /* Compute packet length without padding (add checksum, remove padding). */
   len = buffer_len(&outgoing_packet) + 4 - 8;    len = buffer_len(&outgoing_packet) + 4 - 8;
Line 505 
Line 495 
     packet_disconnect("Corrupted check bytes on input.");      packet_disconnect("Corrupted check bytes on input.");
   buffer_consume_end(&incoming_packet, 4);    buffer_consume_end(&incoming_packet, 4);
   
 #ifdef WITH_ZLIB  
   /* If using packet compression, decompress the packet. */    /* If using packet compression, decompress the packet. */
   if (packet_compression)    if (packet_compression)
     {      {
Line 515 
Line 504 
       buffer_append(&incoming_packet, buffer_ptr(&compression_buffer),        buffer_append(&incoming_packet, buffer_ptr(&compression_buffer),
                     buffer_len(&compression_buffer));                      buffer_len(&compression_buffer));
     }      }
 #endif /* WITH_ZLIB */  
   
   /* Get packet type. */    /* Get packet type. */
   buffer_get(&incoming_packet, &buf[0], 1);    buffer_get(&incoming_packet, &buf[0], 1);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4