mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 11:32:48 -05:00
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.)
This commit is contained in:
@ -23,43 +23,12 @@
|
||||
SockAddr *unix_sock_addr(const char *path);
|
||||
Socket *new_unix_listener(SockAddr *listenaddr, Plug *plug);
|
||||
|
||||
void modalfatalbox(const char *p, ...)
|
||||
void cmdline_error(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
fprintf(stderr, "FATAL ERROR: ");
|
||||
va_start(ap, p);
|
||||
vfprintf(stderr, p, ap);
|
||||
va_start(ap, fmt);
|
||||
console_print_error_msg_fmt_v("pageant", fmt, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
exit(1);
|
||||
}
|
||||
void nonfatal(const char *p, ...)
|
||||
{
|
||||
va_list ap;
|
||||
fprintf(stderr, "ERROR: ");
|
||||
va_start(ap, p);
|
||||
vfprintf(stderr, p, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
}
|
||||
void connection_fatal(Frontend *frontend, const char *p, ...)
|
||||
{
|
||||
va_list ap;
|
||||
fprintf(stderr, "FATAL ERROR: ");
|
||||
va_start(ap, p);
|
||||
vfprintf(stderr, p, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
exit(1);
|
||||
}
|
||||
void cmdline_error(const char *p, ...)
|
||||
{
|
||||
va_list ap;
|
||||
fprintf(stderr, "pageant: ");
|
||||
va_start(ap, p);
|
||||
vfprintf(stderr, p, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -92,8 +61,6 @@ int platform_default_i(const char *name, int def) { return def; }
|
||||
FontSpec *platform_default_fontspec(const char *name) { return fontspec_new(""); }
|
||||
Filename *platform_default_filename(const char *name) { return filename_from_str(""); }
|
||||
char *x_get_default(const char *key) { return NULL; }
|
||||
int from_backend(Frontend *fe, int is_stderr, const void *data, int datalen)
|
||||
{ assert(!"only here to satisfy notional call from backend_socket_log"); }
|
||||
|
||||
/*
|
||||
* Short description of parameters.
|
||||
@ -338,7 +305,7 @@ enum {
|
||||
static char *askpass_tty(const char *prompt)
|
||||
{
|
||||
int ret;
|
||||
prompts_t *p = new_prompts(NULL);
|
||||
prompts_t *p = new_prompts();
|
||||
p->to_server = FALSE;
|
||||
p->name = dupstr("Pageant passphrase prompt");
|
||||
add_prompt(p, dupcat(prompt, ": ", (const char *)NULL), FALSE);
|
||||
|
Reference in New Issue
Block a user