1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-03 04:22:47 -05:00

Give the BPP an input and output packet queue.

Now, instead of writing each packet straight on to the raw output
bufchain by calling the BPP's format_packet function, the higher
protocol layers will put the packets on to a queue, which will
automatically trigger a callback (using the new mechanism for
embedding a callback in any packet queue) to make the BPP format its
queue on to the raw-output bufchain. That in turn triggers a second
callback which moves the data to the socket.

This means in particular that the CBC ignore-message workaround can be
moved into the new BPP routine to process the output queue, which is a
good place for it because then it can easily arrange to only put an
ignore message at the start of any sequence of packets that are being
formatted as a single output blob.
This commit is contained in:
Simon Tatham
2018-09-24 18:08:09 +01:00
parent 60d95b6a62
commit 6bb847738b
7 changed files with 173 additions and 72 deletions

View File

@ -41,14 +41,14 @@ struct ssh_verstring_state {
static void ssh_verstring_free(BinaryPacketProtocol *bpp);
static void ssh_verstring_handle_input(BinaryPacketProtocol *bpp);
static void ssh_verstring_handle_output(BinaryPacketProtocol *bpp);
static PktOut *ssh_verstring_new_pktout(int type);
static void ssh_verstring_format_packet(BinaryPacketProtocol *bpp, PktOut *);
static const struct BinaryPacketProtocolVtable ssh_verstring_vtable = {
ssh_verstring_free,
ssh_verstring_handle_input,
ssh_verstring_handle_output,
ssh_verstring_new_pktout,
ssh_verstring_format_packet,
};
static void ssh_detect_bugs(struct ssh_verstring_state *s);
@ -97,6 +97,7 @@ BinaryPacketProtocol *ssh_verstring_new(
s->send_early = !ssh_version_includes_v1(protoversion);
s->bpp.vt = &ssh_verstring_vtable;
ssh_bpp_common_setup(&s->bpp);
return &s->bpp;
}
@ -394,7 +395,7 @@ static PktOut *ssh_verstring_new_pktout(int type)
return NULL;
}
static void ssh_verstring_format_packet(BinaryPacketProtocol *bpp, PktOut *pkg)
static void ssh_verstring_handle_output(BinaryPacketProtocol *bpp)
{
assert(0 && "Should never try to send packets during SSH version "
"string exchange");