Rationalise access to, and content of, backends[] array.
[u/mdw/putty] / putty.h
diff --git a/putty.h b/putty.h
index 4e879aa..30b23bf 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -70,8 +70,10 @@ typedef struct terminal_tag Terminal;
 #define LATTR_TOP    0x00000002UL
 #define LATTR_BOT    0x00000003UL
 #define LATTR_MODE   0x00000003UL
-#define LATTR_WRAPPED 0x00000010UL
-#define LATTR_WRAPPED2 0x00000020UL
+#define LATTR_WRAPPED 0x00000010UL     /* this line wraps to next */
+#define LATTR_WRAPPED2 0x00000020UL    /* with WRAPPED: CJK wide character
+                                         wrapped to next line, so last
+                                         single-width cell is empty */
 
 #define ATTR_INVALID 0x03FFFFU
 
@@ -161,6 +163,7 @@ struct unicode_data {
 #define LGTYP_ASCII 1                 /* logmode: pure ascii */
 #define LGTYP_DEBUG 2                 /* logmode: all chars of traffic */
 #define LGTYP_PACKETS 3                       /* logmode: SSH data packets */
+#define LGTYP_SSHRAW 4                /* logmode: SSH raw data */
 
 typedef enum {
     /* Actual special commands. Originally Telnet, but some codes have
@@ -249,6 +252,7 @@ enum {
     KEX_DHGROUP1,
     KEX_DHGROUP14,
     KEX_DHGEX,
+    KEX_RSA,
     KEX_MAX
 };
 
@@ -295,8 +299,16 @@ enum {
 };
 
 enum {
+    /* Actions on remote window title query */
+    TITLE_NONE, TITLE_EMPTY, TITLE_REAL
+};
+
+enum {
     /* Protocol back ends. (cfg.protocol) */
-    PROT_RAW, PROT_TELNET, PROT_RLOGIN, PROT_SSH
+    PROT_RAW, PROT_TELNET, PROT_RLOGIN, PROT_SSH,
+    /* PROT_SERIAL is supported on a subset of platforms, but it doesn't
+     * hurt to define it globally. */
+    PROT_SERIAL
 };
 
 enum {
@@ -324,6 +336,18 @@ enum {
     FUNKY_SCO
 };
 
+enum {
+    FQ_DEFAULT, FQ_ANTIALIASED, FQ_NONANTIALIASED, FQ_CLEARTYPE
+};
+
+enum {
+    SER_PAR_NONE, SER_PAR_ODD, SER_PAR_EVEN, SER_PAR_MARK, SER_PAR_SPACE
+};
+
+enum {
+    SER_FLOW_NONE, SER_FLOW_XONXOFF, SER_FLOW_RTSCTS, SER_FLOW_DSRDTR
+};
+
 extern const char *const ttymodes[];
 
 enum {
@@ -351,7 +375,7 @@ struct backend_tag {
     void (*size) (void *handle, int width, int height);
     void (*special) (void *handle, Telnet_Special code);
     const struct telnet_special *(*get_specials) (void *handle);
-    Socket(*socket) (void *handle);
+    int (*connected) (void *handle);
     int (*exitcode) (void *handle);
     /* If back->sendok() returns FALSE, data sent to it from the frontend
      * may be lost. */
@@ -365,14 +389,12 @@ struct backend_tag {
      */
     void (*unthrottle) (void *handle, int);
     int (*cfg_info) (void *handle);
+    char *name;
+    int protocol;
     int default_port;
 };
 
-extern struct backend_list {
-    int protocol;
-    char *name;
-    Backend *backend;
-} backends[];
+extern Backend *backends[];
 
 /*
  * Suggested default protocol provided by the backend link module.
@@ -417,8 +439,6 @@ struct config_tag {
     char proxy_telnet_command[512];
     /* SSH options */
     char remote_cmd[512];
-    char remote_cmd2[512];            /* fallback if the first fails
-                                       * (used internally for scp) */
     char *remote_cmd_ptr;             /* might point to a larger command
                                        * but never for loading/saving */
     char *remote_cmd_ptr2;            /* might point to a larger command
@@ -428,6 +448,7 @@ struct config_tag {
     int ssh_kexlist[KEX_MAX];
     int ssh_rekey_time;                       /* in minutes */
     char ssh_rekey_data[16];
+    int tryagent;
     int agentfwd;
     int change_username;              /* allow username switching in SSH-2 */
     int ssh_cipherlist[CIPHER_MAX];
@@ -438,8 +459,10 @@ struct config_tag {
     int try_tis_auth;
     int try_ki_auth;
     int ssh_subsys;                   /* run a subsystem rather than a command */
-    int ssh_subsys2;                  /* fallback to go with remote_cmd2 */
+    int ssh_subsys2;                  /* fallback to go with remote_cmd_ptr2 */
     int ssh_no_shell;                 /* avoid running a shell */
+    char ssh_nc_host[512];            /* host to connect to in `nc' mode */
+    int ssh_nc_port;                  /* port to connect to in `nc' mode */
     /* Telnet options */
     char termtype[32];
     char termspeed[32];
@@ -449,6 +472,12 @@ struct config_tag {
     char localusername[100];
     int rfc_environ;
     int passive_telnet;
+    /* Serial port options */
+    char serline[256];
+    int serspeed;
+    int serdatabits, serstopbits;
+    int serparity;
+    int serflow;
     /* Keyboard options */
     int bksp_is_delete;
     int rxvt_homeend;
@@ -461,7 +490,7 @@ struct config_tag {
     int no_remote_wintitle;           /* disable remote retitling */
     int no_dbackspace;                /* disable destructive backspace */
     int no_remote_charset;            /* disable remote charset config */
-    int no_remote_qtitle;             /* disable remote win title query */
+    int remote_qtitle_action;         /* remote win title query action */
     int app_cursor;
     int app_keypad;
     int nethack_keypad;
@@ -502,6 +531,7 @@ struct config_tag {
     int win_name_always;
     int width, height;
     FontSpec font;
+    int font_quality;
     Filename logfilename;
     int logtype;
     int logxfovr;
@@ -675,7 +705,7 @@ void free_ctx(Context);
 void palette_set(void *frontend, int, int, int, int);
 void palette_reset(void *frontend);
 void write_aclip(void *frontend, char *, int, int);
-void write_clip(void *frontend, wchar_t *, int, int);
+void write_clip(void *frontend, wchar_t *, int *, int, int);
 void get_clip(void *frontend, wchar_t **, int *);
 void optimised_move(void *frontend, int, int, int);
 void set_raw_mouse_mode(void *frontend, int);
@@ -746,10 +776,12 @@ void random_destroy_seed(void);
 /*
  * Exports from settings.c.
  */
-char *save_settings(char *section, int do_host, Config * cfg);
-void save_open_settings(void *sesskey, int do_host, Config *cfg);
-void load_settings(char *section, int do_host, Config * cfg);
-void load_open_settings(void *sesskey, int do_host, Config *cfg);
+Backend *backend_from_name(const char *name);
+Backend *backend_from_proto(int proto);
+char *save_settings(char *section, Config * cfg);
+void save_open_settings(void *sesskey, Config *cfg);
+void load_settings(char *section, Config * cfg);
+void load_open_settings(void *sesskey, Config *cfg);
 void get_sesslist(struct sesslist *, int allocate);
 void do_defaults(char *, Config *);
 void registry_cleanup(void);
@@ -779,7 +811,7 @@ void term_free(Terminal *);
 void term_size(Terminal *, int, int, int);
 void term_paint(Terminal *, Context, int, int, int, int, int);
 void term_scroll(Terminal *, int, int);
-void term_pwron(Terminal *);
+void term_pwron(Terminal *, int);
 void term_clrsb(Terminal *);
 void term_mouse(Terminal *, Mouse_Button, Mouse_Button, Mouse_Action,
                int,int,int,int,int);
@@ -900,6 +932,14 @@ void pinger_free(Pinger);
  */
 
 #include "misc.h"
+int cfg_launchable(const Config *cfg);
+char const *cfg_dest(const Config *cfg);
+
+/*
+ * Exports from sercfg.c.
+ */
+void ser_setup_config_box(struct controlbox *b, int midsession,
+                         int parity_mask, int flow_mask);
 
 /*
  * Exports from version.c.
@@ -1053,6 +1093,7 @@ typedef struct bidi_char {
 } bidi_char;
 int do_bidi(bidi_char *line, int count);
 int do_shape(bidi_char *line, bidi_char *to, int count);
+int is_rtl(int c);
 
 /*
  * X11 auth mechanisms we know about.