Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2018-10-11 21:58:42 +0300
committerSimon Tatham <anakin@pobox.com>2018-10-11 21:58:42 +0300
commitb4c8fd9d86fdebac075967aa233128449da7ed57 (patch)
treee9e59bbb022c0ea4c683477f28ae3ca13cad82c9 /ldisc.c
parent109df9f46b6a0ff19190839d8d62f72f8dedce87 (diff)
New abstraction 'Seat', to pass to backends.
This is a new vtable-based abstraction which is passed to a backend in place of Frontend, and it implements only the subset of the Frontend functions needed by a backend. (Many other Frontend functions still exist, notably the wide range of things called by terminal.c providing platform-independent operations on the GUI terminal window.) The purpose of making it a vtable is that this opens up the possibility of creating a backend as an internal implementation detail of some other activity, by providing just that one backend with a custom Seat that implements the methods differently. For example, this refactoring should make it feasible to directly implement an SSH proxy type, aka the 'jump host' feature supported by OpenSSH, aka 'open a secondary SSH session in MAINCHAN_DIRECT_TCP mode, and then expose the main channel of that as the Socket for the primary connection'. (Which of course you can already do by spawning 'plink -nc' as a separate proxy process, but this would permit it in the _same_ process without anything getting confused.) I've centralised a full set of stub methods in misc.c for the new abstraction, which allows me to get rid of several annoying stubs in the previous code. Also, while I'm here, I've moved a lot of duplicated modalfatalbox() type functions from application main program files into wincons.c / uxcons.c, which I think saves duplication overall. (A minor visible effect is that the prefixes on those console-based fatal error messages will now be more consistent between applications.)
Diffstat (limited to 'ldisc.c')
-rw-r--r--ldisc.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/ldisc.c b/ldisc.c
index 2225318e..a72adbcb 100644
--- a/ldisc.c
+++ b/ldisc.c
@@ -24,7 +24,7 @@
static void c_write(Ldisc *ldisc, const void *buf, int len)
{
- from_backend(ldisc->frontend, 0, buf, len);
+ seat_stdout(ldisc->seat, buf, len);
}
static int plen(Ldisc *ldisc, unsigned char c)
@@ -77,8 +77,7 @@ static void bsb(Ldisc *ldisc, int n)
#define CTRL(x) (x^'@')
#define KCTRL(x) ((x^'@') | 0x100)
-Ldisc *ldisc_create(Conf *conf, Terminal *term,
- Backend *backend, Frontend *frontend)
+Ldisc *ldisc_create(Conf *conf, Terminal *term, Backend *backend, Seat *seat)
{
Ldisc *ldisc = snew(Ldisc);
@@ -89,7 +88,7 @@ Ldisc *ldisc_create(Conf *conf, Terminal *term,
ldisc->backend = backend;
ldisc->term = term;
- ldisc->frontend = frontend;
+ ldisc->seat = seat;
ldisc_configure(ldisc, conf);
@@ -124,7 +123,7 @@ void ldisc_free(Ldisc *ldisc)
void ldisc_echoedit_update(Ldisc *ldisc)
{
- frontend_echoedit_update(ldisc->frontend, ECHOING, EDITING);
+ seat_echoedit_update(ldisc->seat, ECHOING, EDITING);
}
void ldisc_send(Ldisc *ldisc, const void *vbuf, int len, int interactive)