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

Move SSH_MSG_DISCONNECT construction into the BPP.

This is a convenient place for it because it abstracts away the
difference in disconnect packet formats between SSH-1 and -2, so when
I start restructuring, I'll be able to call it even from places that
don't know which version of SSH they're running.
This commit is contained in:
Simon Tatham
2018-09-24 18:14:33 +01:00
parent 6bb847738b
commit 3074440040
7 changed files with 41 additions and 14 deletions

View File

@ -31,6 +31,8 @@ struct ssh1_bpp_state {
static void ssh1_bpp_free(BinaryPacketProtocol *bpp);
static void ssh1_bpp_handle_input(BinaryPacketProtocol *bpp);
static void ssh1_bpp_handle_output(BinaryPacketProtocol *bpp);
static void ssh1_bpp_queue_disconnect(BinaryPacketProtocol *bpp,
const char *msg, int category);
static PktOut *ssh1_bpp_new_pktout(int type);
static const struct BinaryPacketProtocolVtable ssh1_bpp_vtable = {
@ -38,6 +40,7 @@ static const struct BinaryPacketProtocolVtable ssh1_bpp_vtable = {
ssh1_bpp_handle_input,
ssh1_bpp_handle_output,
ssh1_bpp_new_pktout,
ssh1_bpp_queue_disconnect,
};
BinaryPacketProtocol *ssh1_bpp_new(void)
@ -302,3 +305,11 @@ static void ssh1_bpp_handle_output(BinaryPacketProtocol *bpp)
ssh_free_pktout(pkt);
}
}
static void ssh1_bpp_queue_disconnect(BinaryPacketProtocol *bpp,
const char *msg, int category)
{
PktOut *pkt = ssh_bpp_new_pktout(bpp, SSH1_MSG_DISCONNECT);
put_stringz(pkt, msg);
pq_push(&bpp->out_pq, pkt);
}