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

Move alloc_channel_id into sshcommon.c.

That function _did_ depend on ssh.c's internal facilities, namely the
layout of 'struct ssh_channel'. In place of that, it now takes an
extra integer argument telling it where to find the channel id in
whatever data structure you give it a tree of - so now I can split up
the SSH-1 and SSH-2 channel handling without losing the services of
that nice channel-number allocator.
This commit is contained in:
Simon Tatham
2018-09-19 20:37:12 +01:00
parent 12abb95394
commit 968252bbdc
3 changed files with 46 additions and 33 deletions

8
ssh.h
View File

@ -1326,3 +1326,11 @@ enum { SSH_IMPL_BUG_LIST(TMP_DECLARE_REAL_ENUM) };
void write_ttymodes_to_packet_from_conf(
BinarySink *bs, Frontend *frontend, Conf *conf,
int ssh_version, int ospeed, int ispeed);
/* Shared system for allocating local SSH channel ids. Expects to be
* passed a tree full of structs that have a field called 'localid' of
* type unsigned, and will check that! */
unsigned alloc_channel_id_general(tree234 *channels, size_t localid_offset);
#define alloc_channel_id(tree, type) \
TYPECHECK(&((type *)0)->localid == (unsigned *)0, \
alloc_channel_id_general(tree, offsetof(type, localid)))