Home | History | Annotate | Download | only in openssh

Lines Matching full:packet

1 /* $OpenBSD: packet.c,v 1.173 2011/05/06 21:14:05 djm Exp $ */
6 * This file contains code implementing the packet protocol and communication
16 * SSH2 packet format added by Markus Friedl.
64 #include "packet.h"
97 struct packet {
98 TAILQ_ENTRY(packet) next;
128 /* Buffer for the partial outgoing packet being constructed. */
131 /* Buffer for the incoming packet currently being processed. */
134 /* Scratch buffer for packet compression/decompression. */
139 * Flag indicating whether packet compression/decompression is
144 /* default maximum packet size */
161 /* The maximum time that we will wait to send or receive a packet */
194 TAILQ_HEAD(, packet) outgoing;
279 packet_disconnect("Packet corrupt");
517 * Starts packet compression from the next packet on in both directions.
575 /* Start constructing a packet to send. */
650 * Finalizes and sends the packet. If the encryption key has been set,
651 * encrypts the packet before sending.
663 packet compression, compress the payload of the outgoing
664 * packet.
680 /* Compute packet length without padding (add checksum, remove padding). */
726 * Note that the packet is now only buffered in output. It won't be
841 * Finalize packet in SSH2 format (compress, mac, encrypt, enqueue)
928 /* compute MAC over seqnr and packet(length fields, payload, padding) */
935 /* encrypt packet and append to output buffer. */
967 struct packet *p;
977 debug("enqueue packet: %u", type);
999 debug("dequeue packet: %u", type);
1021 * Waits until a packet has been received, and returns its type. Note that
1042 /* Stay in the loop until we have received a complete packet. */
1044 /* Try to read a packet from the buffer. */
1052 /* If we got a packet, return it. */
1119 * Waits until a packet has been received, verifies that its type matches
1130 packet_disconnect("Protocol error: expected packet type %d, got %d",
1134 /* Checks if a full packet is available in the data received so far via
1135 * packet_process_incoming. If so, reads the packet; otherwise returns
1150 /* Check if input size is less than minimum packet size. */
1153 /* Get length of incoming packet. */
1157 packet_disconnect("Bad packet length %u.", len);
1160 /* Check if the packet has been entirely received. */
1164 /* The entire packet is in buffer. */
1166 /* Consume packet length. */
1199 /* Compute packet checksum. */
1230 packet_disconnect("Invalid ssh1 packet type: %d", type);
1258 * decrypt first block and extract length of incoming packet
1274 logit("Bad packet length %u.", active_state->packlen);
1279 DBG(debug("input: packet len %u", active_state->packlen+4));
1282 /* we have a partial packet of block_size bytes */
1284 DBG(debug("partial packet %d, need %d, maclen %d", block_size,
1294 * check if the entire packet has been received and
1308 * compute MAC over seqnr and packet,
1309 * increment sequence number for incoming packet
1346 /* skip packet size + padlen, discard padding */
1364 * get packet type, implies consume.
1369 packet_disconnect("Invalid ssh2 packet type: %d", type);
1379 /* reset for next packet */
1396 DBG(debug("received packet type %d", type));
1444 DBG(debug("received packet type %d", type));
1475 /* Returns a character from the packet. */
1486 /* Returns an integer from the packet data. */
1494 /* Returns an 64 bit integer from the packet data. */
1503 * Returns an arbitrary precision integer from the packet data. The integer
1544 * Returns a string from the packet data. The string is allocated using
1605 * Logs the error plus constructs and sends a disconnect packet, closes the