Lines Matching defs:packet

1 /* $OpenBSD: packet.c,v 1.318 2025/02/18 08:02:12 djm Exp $ */
6 * This file contains code implementing the packet protocol and communication
16 * SSH2 packet format added by Markus Friedl.
96 #include "packet.h"
115 struct packet {
116 TAILQ_ENTRY(packet) next;
146 /* Buffer for the partial outgoing packet being constructed. */
149 /* Buffer for the incoming packet currently being processed. */
152 /* Scratch buffer for packet compression/decompression. */
165 /* default maximum packet size */
182 /* The maximum time that we will wait to send or receive a packet */
226 TAILQ_HEAD(, packet) outgoing;
771 * Starts packet compression from the next packet on in both directions.
1068 * Permit one packet in or out per rekey - this allows us to
1143 /* Used to mute debug logging for noisy packet types */
1160 * Finalize packet in SSH2 format (compress, mac, encrypt, enqueue)
1188 debug3("send packet: type %u", type);
1220 len -= aadlen; /* packet length is not encrypted for EtM modes */
1267 /* compute MAC over seqnr and packet(length fields, payload, padding) */
1275 /* encrypt packet and append to output buffer. */
1330 /* returns non-zero if the specified packet type is usec by KEX */
1346 struct packet *p;
1363 debug("enqueue packet: %u", type);
1375 * This packet triggered a rekey, so send the
1398 * If this packet triggers a rekex, then skip the
1404 debug3_f("queued packet triggered rekex");
1407 debug("dequeue packet: %u", type);
1421 * Waits until a packet has been received, and returns its type. Note that
1445 /* Stay in the loop until we have received a complete packet. */
1447 /* Try to read a packet from the buffer. */
1450 /* If we got a packet, return it. */
1533 return 0; /* packet is incomplete */
1541 return 0; /* packet is incomplete */
1552 /* reset for next packet */
1599 logit("Bad packet length %u.", state->packlen);
1608 * decrypt first block and extract length of incoming packet
1629 logit("Bad packet length %u.", state->packlen);
1636 DBG(debug("input: packet len %u", state->packlen+4));
1644 * have a partial packet of block_size bytes
1648 DBG(debug("partial packet: block %d, need %d, maclen %d, authlen %d,"
1657 * check if the entire packet has been received and
1665 return 0; /* packet is incomplete */
1736 /* skip packet size + padlen, discard padding */
1756 * get packet type, implies consume.
1762 debug3("receive packet: type %u", *typep);
1765 "Invalid ssh2 packet type: %d", *typep)) != 0 ||
1782 /* reset for next packet */
1815 DBG(debug("received packet type %d", *typep));
2057 * Logs the error plus constructs and sends a disconnect packet, closes the
2345 /* turn kex into a blob for packet state serialization */
2367 /* turn key exchange results into a blob for packet state serialization */
2411 /* serialize packet state into a blob */
2438 /* restore key exchange results from blob for packet state de-serialization */
2505 /* restore kex from blob for packet state de-serialization */
2543 * Restore packet state from content of blob 'm' (de-serialization).
2597 /* put data to the outgoing packet */
2669 /* fetch data from the incoming packet */
2757 /* start a new packet */
2762 u_char buf[6]; /* u32 packet length, u8 pad len, u8 type */