Configurable TCP_NODELAY option on network connections
[u/mdw/putty] / windlg.c
index b0c6d8c..f3084ce 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -361,17 +361,22 @@ enum { IDCX_ABOUT =
     IDC_RESIZEEITHER,
     IDC_SCROLLBAR,
     IDC_SCROLLBARFULLSCREEN,
-    IDC_CLOSEWARN,
     IDC_SAVESTATIC,
     IDC_SAVEEDIT,
+    IDC_SCROLLKEY,
+    IDC_SCROLLDISP,
+    windowpanelend,
+
+    behaviourpanelstart,
+    IDC_TITLE_BEHAVIOUR,
+    IDC_BOX_BEHAVIOUR1,
+    IDC_CLOSEWARN,
     IDC_ALTF4,
     IDC_ALTSPACE,
     IDC_ALTONLY,
-    IDC_SCROLLKEY,
-    IDC_SCROLLDISP,
     IDC_ALWAYSONTOP,
     IDC_FULLSCREENONALTENTER,
-    windowpanelend,
+    behaviourpanelend,
 
     appearancepanelstart,
     IDC_TITLE_APPEARANCE,
@@ -400,12 +405,14 @@ enum { IDCX_ABOUT =
     IDC_TITLE_CONNECTION,
     IDC_BOX_CONNECTION1,
     IDC_BOX_CONNECTION2,
+    IDC_BOX_CONNECTION3,
     IDC_TTSTATIC,
     IDC_TTEDIT,
     IDC_LOGSTATIC,
     IDC_LOGEDIT,
     IDC_PINGSTATIC,
     IDC_PINGEDIT,
+    IDC_NODELAY,
     connectionpanelend,
 
     telnetpanelstart,
@@ -469,6 +476,7 @@ enum { IDCX_ABOUT =
     IDC_PKBUTTON,
     IDC_AGENTFWD,
     IDC_AUTHTIS,
+    IDC_AUTHKI,
     sshauthpanelend,
 
     selectionpanelstart,
@@ -606,6 +614,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
                     cfg.protocol ==
                     PROT_RLOGIN ? IDC_PROTRLOGIN : IDC_PROTRAW);
     SetDlgItemInt(hwnd, IDC_PINGEDIT, cfg.ping_interval, FALSE);
+    CheckDlgButton(hwnd, IDC_NODELAY, cfg.tcp_nodelay);
 
     CheckRadioButton(hwnd, IDC_DEL008, IDC_DEL127,
                     cfg.bksp_is_delete ? IDC_DEL127 : IDC_DEL008);
@@ -735,6 +744,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
     CheckRadioButton(hwnd, IDC_SSHPROT1, IDC_SSHPROT2,
                     cfg.sshprot == 1 ? IDC_SSHPROT1 : IDC_SSHPROT2);
     CheckDlgButton(hwnd, IDC_AUTHTIS, cfg.try_tis_auth);
+    CheckDlgButton(hwnd, IDC_AUTHKI, cfg.try_ki_auth);
     SetDlgItemText(hwnd, IDC_PKEDIT, cfg.keyfile);
     SetDlgItemText(hwnd, IDC_CMDEDIT, cfg.remote_cmd);
 
@@ -1010,10 +1020,8 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
        /* The Keyboard panel. Accelerators used: [acgo] bhf ruyntd */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
-       /*
-          bartitle(&cp, "Options controlling the effects of keys",
-          IDC_TITLE_KEYBOARD);
-        */
+       bartitle(&cp, "Options controlling the effects of keys",
+                IDC_TITLE_KEYBOARD);
        beginbox(&cp, "Change the sequences sent by:", IDC_BOX_KEYBOARD1);
        radioline(&cp, "The &Backspace key", IDC_DELSTATIC, 2,
                  "Control-H", IDC_DEL008,
@@ -1050,7 +1058,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
     }
 
     if (panel == windowpanelstart) {
-       /* The Window panel. Accelerators used: [acgo] rmz sdikp w4ylt f */
+       /* The Window panel. Accelerators used: [acgo] rmz sdikp */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
        bartitle(&cp, "Options controlling PuTTY's window",
@@ -1059,11 +1067,11 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
        multiedit(&cp,
                  "&Rows", IDC_ROWSSTATIC, IDC_ROWSEDIT, 50,
                  "Colu&mns", IDC_COLSSTATIC, IDC_COLSEDIT, 50, NULL);
-       radioline(&cp, "When window is resi&zed, change:", IDC_RESIZESTATIC,
-                 4, "Terminal", IDC_RESIZETERM,
-                 "Font", IDC_RESIZEFONT,
-                 "Special", IDC_RESIZEEITHER,
-                 "Nothing", IDC_RESIZENONE, NULL);
+       radiobig(&cp, "When window is resi&zed:", IDC_RESIZESTATIC,
+                "Change the number of rows and columns", IDC_RESIZETERM,
+                "Change the size of the font", IDC_RESIZEFONT,
+                "Change font size only when maximised", IDC_RESIZEEITHER,
+                "Forbid resizing completely", IDC_RESIZENONE, NULL);
        endbox(&cp);
        beginbox(&cp, "Control the scrollback in the window",
                 IDC_BOX_WINDOW2);
@@ -1075,22 +1083,14 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
        checkbox(&cp, "Reset scrollback on dis&play activity",
                 IDC_SCROLLDISP);
        endbox(&cp);
-       beginbox(&cp, NULL, IDC_BOX_WINDOW3);
-       checkbox(&cp, "&Warn before closing window", IDC_CLOSEWARN);
-       checkbox(&cp, "Window closes on ALT-F&4", IDC_ALTF4);
-       checkbox(&cp, "S&ystem menu appears on ALT-Space", IDC_ALTSPACE);
-       checkbox(&cp, "System menu appears on A&LT alone", IDC_ALTONLY);
-       checkbox(&cp, "Ensure window is always on &top", IDC_ALWAYSONTOP);
-       checkbox(&cp, "&Full screen on Alt-Enter", IDC_FULLSCREENONALTENTER);
-       endbox(&cp);
     }
 
     if (panel == appearancepanelstart) {
        /* The Appearance panel. Accelerators used: [acgo] luvb h ti p s */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
-       /* bartitle(&cp, "Options controlling PuTTY's appearance",
-                IDC_TITLE_APPEARANCE); */
+       bartitle(&cp, "Configure the appearance of PuTTY's window",
+                IDC_TITLE_APPEARANCE);
        beginbox(&cp, "Adjust the use of the cursor", IDC_BOX_APPEARANCE1);
        radioline(&cp, "Cursor appearance:", IDC_CURSORSTATIC, 3,
                  "B&lock", IDC_CURBLOCK,
@@ -1121,6 +1121,22 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
        endbox(&cp);
     }
 
+    if (panel == behaviourpanelstart) {
+       /* The Behaviour panel. Accelerators used: [acgo] w4yltf */
+       struct ctlpos cp;
+       ctlposinit(&cp, hwnd, 80, 3, 13);
+       bartitle(&cp, "Configure the behaviour of PuTTY's window",
+                IDC_TITLE_WINDOW);
+       beginbox(&cp, NULL, IDC_BOX_BEHAVIOUR1);
+       checkbox(&cp, "&Warn before closing window", IDC_CLOSEWARN);
+       checkbox(&cp, "Window closes on ALT-F&4", IDC_ALTF4);
+       checkbox(&cp, "S&ystem menu appears on ALT-Space", IDC_ALTSPACE);
+       checkbox(&cp, "System menu appears on A&LT alone", IDC_ALTONLY);
+       checkbox(&cp, "Ensure window is always on &top", IDC_ALWAYSONTOP);
+       checkbox(&cp, "&Full screen on Alt-Enter", IDC_FULLSCREENONALTENTER);
+       endbox(&cp);
+    }
+
     if (panel == translationpanelstart) {
        /* The Translation panel. Accelerators used: [acgo] rxbepus */
        struct ctlpos cp;
@@ -1211,7 +1227,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
     }
 
     if (panel == connectionpanelstart) {
-       /* The Connection panel. Accelerators used: [acgo] tuk */
+       /* The Connection panel. Accelerators used: [acgo] tukn */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
        bartitle(&cp, "Options controlling the connection",
@@ -1235,6 +1251,13 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
        staticedit(&cp, "Seconds between &keepalives (0 to turn off)",
                   IDC_PINGSTATIC, IDC_PINGEDIT, 20);
        endbox(&cp);
+       if (dlgtype == 0) {
+           beginbox(&cp, "Low-level TCP connection options",
+                    IDC_BOX_CONNECTION3);
+           checkbox(&cp, "Disable &Nagle's algorithm (TCP_NODELAY option)",
+                    IDC_NODELAY);
+           endbox(&cp);
+       }
     }
 
     if (panel == telnetpanelstart) {
@@ -1311,7 +1334,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
     }
 
     if (panel == sshauthpanelstart) {
-       /* The SSH authentication panel. Accelerators used: [acgo] m fkw */
+       /* The SSH authentication panel. Accelerators used: [acgo] m fkiw */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
        if (dlgtype == 0) {
@@ -1319,8 +1342,10 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
                     IDC_TITLE_SSHAUTH);
            beginbox(&cp, "Authentication methods",
                     IDC_BOX_SSHAUTH1);
-           checkbox(&cp, "Atte&mpt TIS or CryptoCard authentication",
+           checkbox(&cp, "Atte&mpt TIS or CryptoCard authentication (SSH1)",
                     IDC_AUTHTIS);
+           checkbox(&cp, "Attempt \"keyboard-&interactive\" authentication"
+                    " (SSH2)", IDC_AUTHKI);
            endbox(&cp);
            beginbox(&cp, "Authentication parameters",
                     IDC_BOX_SSHAUTH2);
@@ -1479,6 +1504,7 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
        treeview_insert(&tvfaff, 1, "Bell");
        treeview_insert(&tvfaff, 0, "Window");
        treeview_insert(&tvfaff, 1, "Appearance");
+       treeview_insert(&tvfaff, 1, "Behaviour");
        treeview_insert(&tvfaff, 1, "Translation");
        treeview_insert(&tvfaff, 1, "Selection");
        treeview_insert(&tvfaff, 1, "Colours");
@@ -1559,6 +1585,8 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                create_controls(hwnd, dlgtype, windowpanelstart);
            if (!strcmp(buffer, "Appearance"))
                create_controls(hwnd, dlgtype, appearancepanelstart);
+           if (!strcmp(buffer, "Behaviour"))
+               create_controls(hwnd, dlgtype, behaviourpanelstart);
            if (!strcmp(buffer, "Tunnels"))
                create_controls(hwnd, dlgtype, tunnelspanelstart);
            if (!strcmp(buffer, "Connection"))
@@ -1759,6 +1787,12 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                    MyGetDlgItemInt(hwnd, IDC_PINGEDIT,
                                    &cfg.ping_interval);
                break;
+             case IDC_NODELAY:
+               if (HIWORD(wParam) == BN_CLICKED ||
+                   HIWORD(wParam) == BN_DOUBLECLICKED)
+                       cfg.tcp_nodelay =
+                       IsDlgButtonChecked(hwnd, IDC_NODELAY);
+               break;
              case IDC_DEL008:
              case IDC_DEL127:
                if (HIWORD(wParam) == BN_CLICKED ||
@@ -2387,6 +2421,12 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                        cfg.try_tis_auth =
                        IsDlgButtonChecked(hwnd, IDC_AUTHTIS);
                break;
+             case IDC_AUTHKI:
+               if (HIWORD(wParam) == BN_CLICKED ||
+                   HIWORD(wParam) == BN_DOUBLECLICKED)
+                       cfg.try_ki_auth =
+                       IsDlgButtonChecked(hwnd, IDC_AUTHKI);
+               break;
              case IDC_PKEDIT:
                if (HIWORD(wParam) == EN_CHANGE)
                    GetDlgItemText(hwnd, IDC_PKEDIT, cfg.keyfile,