1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-16 02:27:32 -05:00

Put a layer of abstraction in front of struct ssh_channel.

Clients outside ssh.c - all implementations of Channel - will now not
see the ssh_channel data type itself, but only a subobject of the
interface type SshChannel. All the sshfwd_* functions have become
methods in that interface type's vtable (though, wrapped in the usual
kind of macros, the call sites look identical).

This paves the way for me to split up the SSH-1 and SSH-2 connection
layers and have each one lay out its channel bookkeeping structure as
it sees fit; as long as they each provide an implementation of the
sshfwd_ method family, the types behind that need not look different.

A minor good effect of this is that the sshfwd_ methods are no longer
global symbols, so they don't have to be stubbed in Unix Pageant to
get it to compile.
This commit is contained in:
Simon Tatham
2018-09-14 13:47:13 +01:00
parent d437e5402e
commit aa08e6ca91
8 changed files with 110 additions and 69 deletions

View File

@ -23,7 +23,7 @@ typedef enum {
} SocksState;
typedef struct PortForwarding {
struct ssh_channel *c; /* channel structure held by ssh.c */
SshChannel *c; /* channel structure held by SSH backend */
Ssh ssh; /* instance of SSH backend itself */
/* Note that ssh need not be filled in if c is non-NULL */
Socket s;
@ -146,11 +146,11 @@ static void pfl_closing(Plug plug, const char *error_msg, int error_code,
pfl_terminate(pl);
}
static struct ssh_channel *wrap_send_port_open(
static SshChannel *wrap_send_port_open(
Ssh ssh, const char *hostname, int port, Socket s, Channel *chan)
{
char *peerinfo, *description;
struct ssh_channel *toret;
SshChannel *toret;
peerinfo = sk_peer_info(s);
if (peerinfo) {
@ -455,7 +455,7 @@ static const struct ChannelVtable PortForwarding_channelvt = {
* dynamically allocated error message string.
*/
char *pfd_connect(Channel **chan_ret, char *hostname,int port,
struct ssh_channel *c, Conf *conf, int addressfamily)
SshChannel *c, Conf *conf, int addressfamily)
{
SockAddr addr;
const char *err;