mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-03 20:42: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
unix/unix.h
23
unix/unix.h
@ -191,14 +191,8 @@ enum MenuAction {
|
||||
};
|
||||
void app_menu_action(Frontend *frontend, enum MenuAction);
|
||||
|
||||
/* Things pty.c needs from pterm.c */
|
||||
const char *get_x_display(Frontend *frontend);
|
||||
int font_dimension(Frontend *frontend, int which);/* 0 for width, 1 for height */
|
||||
int get_windowid(Frontend *frontend, long *id);
|
||||
|
||||
/* Things gtkdlg.c needs from pterm.c */
|
||||
#ifdef MAY_REFER_TO_GTK_IN_HEADERS
|
||||
GtkWidget *get_window(Frontend *frontend);
|
||||
enum DialogSlot {
|
||||
DIALOG_SLOT_RECONFIGURE,
|
||||
DIALOG_SLOT_NETWORK_PROMPT,
|
||||
@ -207,8 +201,9 @@ enum DialogSlot {
|
||||
DIALOG_SLOT_CONNECTION_FATAL,
|
||||
DIALOG_SLOT_LIMIT /* must remain last */
|
||||
};
|
||||
void register_dialog(Frontend *frontend, enum DialogSlot slot, GtkWidget *dialog);
|
||||
void unregister_dialog(Frontend *frontend, enum DialogSlot slot);
|
||||
GtkWidget *gtk_seat_get_window(Seat *seat);
|
||||
void register_dialog(Seat *seat, enum DialogSlot slot, GtkWidget *dialog);
|
||||
void unregister_dialog(Seat *seat, enum DialogSlot slot);
|
||||
#endif
|
||||
|
||||
/* Things pterm.c needs from gtkdlg.c */
|
||||
@ -224,6 +219,18 @@ eventlog_stuff *eventlogstuff_new(void);
|
||||
void eventlogstuff_free(eventlog_stuff *);
|
||||
void showeventlog(eventlog_stuff *estuff, void *parentwin);
|
||||
void logevent_dlg(eventlog_stuff *estuff, const char *string);
|
||||
int gtkdlg_askappend(Seat *seat, Filename *filename,
|
||||
void (*callback)(void *ctx, int result), void *ctx);
|
||||
int gtk_seat_verify_ssh_host_key(
|
||||
Seat *seat, const char *host, int port,
|
||||
const char *keytype, char *keystr, char *fingerprint,
|
||||
void (*callback)(void *ctx, int result), void *ctx);
|
||||
int gtk_seat_confirm_weak_crypto_primitive(
|
||||
Seat *seat, const char *algtype, const char *algname,
|
||||
void (*callback)(void *ctx, int result), void *ctx);
|
||||
int gtk_seat_confirm_weak_cached_hostkey(
|
||||
Seat *seat, const char *algname, const char *betteralgs,
|
||||
void (*callback)(void *ctx, int result), void *ctx);
|
||||
#ifdef MAY_REFER_TO_GTK_IN_HEADERS
|
||||
struct message_box_button {
|
||||
const char *title;
|
||||
|
Reference in New Issue
Block a user