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

Move the zombiechan implementation into sshcommon.c.

It doesn't really have to be in ssh.c sharing that file's internal
data structures; it's as much an independent object implementation as
any of the less trivial Channel instances. So it's another thing we
can get out of that too-large source file.
This commit is contained in:
Simon Tatham
2018-09-19 20:31:19 +01:00
parent 6a5d4d083a
commit 64f95e6334
3 changed files with 76 additions and 67 deletions

View File

@ -203,3 +203,67 @@ void ssh_free_pktout(PktOut *pkt)
sfree(pkt->data);
sfree(pkt);
}
/* ----------------------------------------------------------------------
* Implement zombiechan_new() and its trivial vtable.
*/
static void zombiechan_free(Channel *chan);
static int zombiechan_send(Channel *chan, int is_stderr, const void *, int);
static void zombiechan_set_input_wanted(Channel *chan, int wanted);
static void zombiechan_do_nothing(Channel *chan);
static void zombiechan_open_failure(Channel *chan, const char *);
static int zombiechan_want_close(Channel *chan, int sent_eof, int rcvd_eof);
static char *zombiechan_log_close_msg(Channel *chan) { return NULL; }
static const struct ChannelVtable zombiechan_channelvt = {
zombiechan_free,
zombiechan_do_nothing, /* open_confirmation */
zombiechan_open_failure,
zombiechan_send,
zombiechan_do_nothing, /* send_eof */
zombiechan_set_input_wanted,
zombiechan_log_close_msg,
zombiechan_want_close,
};
Channel *zombiechan_new(void)
{
Channel *chan = snew(Channel);
chan->vt = &zombiechan_channelvt;
chan->initial_fixed_window_size = 0;
return chan;
}
static void zombiechan_free(Channel *chan)
{
assert(chan->vt == &zombiechan_channelvt);
sfree(chan);
}
static void zombiechan_do_nothing(Channel *chan)
{
assert(chan->vt == &zombiechan_channelvt);
}
static void zombiechan_open_failure(Channel *chan, const char *errtext)
{
assert(chan->vt == &zombiechan_channelvt);
}
static int zombiechan_send(Channel *chan, int is_stderr,
const void *data, int length)
{
assert(chan->vt == &zombiechan_channelvt);
return 0;
}
static void zombiechan_set_input_wanted(Channel *chan, int enable)
{
assert(chan->vt == &zombiechan_channelvt);
}
static int zombiechan_want_close(Channel *chan, int sent_eof, int rcvd_eof)
{
return TRUE;
}