mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
Replace conf.c's type arrays with a new conf_key_info[].
This array is planned to be exposed more widely, and used for more purposes than just checking the types of Conf options. In this commit it just takes over from the two previous smaller arrays, and adds no extra data.
This commit is contained in:
parent
72bbca9ddd
commit
860bd0d5b7
731
conf.h
Normal file
731
conf.h
Normal file
@ -0,0 +1,731 @@
|
||||
/*
|
||||
* Master list of configuration options living in the Conf data
|
||||
* structure.
|
||||
*
|
||||
* Each CONF_OPTION directive defines a single CONF_foo primary key in
|
||||
* Conf, and can be equipped with the following properties:
|
||||
*
|
||||
* - VALUE_TYPE: the type of data associated with that key
|
||||
* - SUBKEY_TYPE: if the primary key goes with a subkey (that is, the
|
||||
* primary key identifies some mapping from subkeys to values), the
|
||||
* data type of the subkey
|
||||
*/
|
||||
|
||||
CONF_OPTION(host,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(port,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(protocol,
|
||||
VALUE_TYPE(INT), /* PROT_SSH, PROT_TELNET etc */
|
||||
)
|
||||
CONF_OPTION(addressfamily,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(close_on_exit,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(warn_on_close,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ping_interval,
|
||||
VALUE_TYPE(INT), /* in seconds */
|
||||
)
|
||||
CONF_OPTION(tcp_nodelay,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(tcp_keepalives,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(loghost, /* logical host being contacted, for host key check */
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
|
||||
/* Proxy options */
|
||||
CONF_OPTION(proxy_exclude_list,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(proxy_dns,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(even_proxy_localhost,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(proxy_type,
|
||||
VALUE_TYPE(INT), /* PROXY_NONE, PROXY_SOCKS4, ... */
|
||||
)
|
||||
CONF_OPTION(proxy_host,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(proxy_port,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(proxy_username,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(proxy_password,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(proxy_telnet_command,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(proxy_log_to_term,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
|
||||
/* SSH options */
|
||||
CONF_OPTION(remote_cmd,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(remote_cmd2,
|
||||
/*
|
||||
* Fallback command to try to run if remote_cmd fails.
|
||||
*/
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(nopty,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(compression,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ssh_kexlist,
|
||||
SUBKEY_TYPE(INT), /* indices in preference order: 0,...,KEX_MAX-1
|
||||
* (lower is more preferred) */
|
||||
VALUE_TYPE(INT), /* KEX_* enum values */
|
||||
)
|
||||
CONF_OPTION(ssh_hklist,
|
||||
SUBKEY_TYPE(INT), /* indices in preference order: 0,...,HK_MAX-1
|
||||
* (lower is more preferred) */
|
||||
VALUE_TYPE(INT), /* HK_* enum values */
|
||||
)
|
||||
CONF_OPTION(ssh_prefer_known_hostkeys,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ssh_rekey_time,
|
||||
VALUE_TYPE(INT), /* in minutes */
|
||||
)
|
||||
CONF_OPTION(ssh_rekey_data,
|
||||
VALUE_TYPE(STR), /* string encoding e.g. "100K", "2M", "1G" */
|
||||
)
|
||||
CONF_OPTION(tryagent,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(agentfwd,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(change_username, /* allow username switching in SSH-2 */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ssh_cipherlist,
|
||||
SUBKEY_TYPE(INT), /* indices in preference order: 0,...,CIPHER_MAX-1
|
||||
* (lower is more preferred) */
|
||||
VALUE_TYPE(INT), /* CIPHER_* enum values */
|
||||
)
|
||||
CONF_OPTION(keyfile,
|
||||
VALUE_TYPE(FILENAME),
|
||||
)
|
||||
CONF_OPTION(detached_cert,
|
||||
VALUE_TYPE(FILENAME),
|
||||
)
|
||||
CONF_OPTION(auth_plugin,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(sshprot,
|
||||
/*
|
||||
* Which SSH protocol to use.
|
||||
*
|
||||
* For historical reasons, the current legal values for CONF_sshprot
|
||||
* are:
|
||||
* 0 = SSH-1 only
|
||||
* 3 = SSH-2 only
|
||||
*
|
||||
* We used to also support
|
||||
* 1 = SSH-1 with fallback to SSH-2
|
||||
* 2 = SSH-2 with fallback to SSH-1
|
||||
*
|
||||
* and we continue to use 0/3 in storage formats rather than the more
|
||||
* obvious 1/2 to avoid surprises if someone saves a session and later
|
||||
* downgrades PuTTY. So it's easier to use these numbers internally too.
|
||||
*/
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(ssh_simple,
|
||||
/*
|
||||
* This means that we promise never to open any channel other
|
||||
* than the main one, which means it can safely use a very large
|
||||
* window in SSH-2.
|
||||
*/
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ssh_connection_sharing,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ssh_connection_sharing_upstream,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ssh_connection_sharing_downstream,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ssh_manual_hostkeys,
|
||||
/*
|
||||
* Manually configured host keys to accept regardless of the state
|
||||
* of the host key cache.
|
||||
*
|
||||
* This is conceptually a set rather than a dictionary: every
|
||||
* value in this map is the empty string, and the set of subkeys
|
||||
* that exist is the important data.
|
||||
*/
|
||||
SUBKEY_TYPE(STR),
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(ssh2_des_cbc, /* "des-cbc" unrecommended SSH-2 cipher */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ssh_no_userauth, /* bypass "ssh-userauth" (SSH-2 only) */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ssh_no_trivial_userauth, /* disable trivial types of auth */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ssh_show_banner, /* show USERAUTH_BANNERs (SSH-2 only) */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(try_tis_auth,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(try_ki_auth,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(try_gssapi_auth, /* attempt gssapi via ssh userauth */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(try_gssapi_kex, /* attempt gssapi via ssh kex */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(gssapifwd, /* forward tgt via gss */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(gssapirekey, /* KEXGSS refresh interval (mins) */
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(ssh_gsslist,
|
||||
SUBKEY_TYPE(INT), /* indices in preference order: 0,...,ngsslibs
|
||||
* (lower is more preferred; ngsslibs is a platform-
|
||||
* dependent value) */
|
||||
VALUE_TYPE(INT), /* indices of GSSAPI lib types (platform-dependent) */
|
||||
)
|
||||
CONF_OPTION(ssh_gss_custom,
|
||||
VALUE_TYPE(FILENAME),
|
||||
)
|
||||
CONF_OPTION(ssh_subsys, /* run a subsystem rather than a command */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ssh_subsys2, /* fallback to go with remote_cmd_ptr2 */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ssh_no_shell, /* avoid running a shell */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ssh_nc_host, /* host to connect to in `nc' mode */
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(ssh_nc_port, /* port to connect to in `nc' mode */
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
|
||||
/* Telnet options */
|
||||
CONF_OPTION(termtype,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(termspeed,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(ttymodes,
|
||||
SUBKEY_TYPE(STR), /* subkeys are listed in ttymodes[] in settings.c */
|
||||
VALUE_TYPE(STR), /* values are "Vvalue" or "A" */
|
||||
)
|
||||
CONF_OPTION(environmt,
|
||||
SUBKEY_TYPE(STR), /* environment variable name */
|
||||
VALUE_TYPE(STR), /* environment variable value */
|
||||
)
|
||||
CONF_OPTION(username,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(username_from_env,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(localusername,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(rfc_environ,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(passive_telnet,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
|
||||
/* Serial port options */
|
||||
CONF_OPTION(serline,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(serspeed,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(serdatabits,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(serstopbits,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(serparity,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(serflow,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
|
||||
/* SUPDUP options */
|
||||
CONF_OPTION(supdup_location,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(supdup_ascii_set,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(supdup_more,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(supdup_scroll,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
|
||||
/* Keyboard options */
|
||||
CONF_OPTION(bksp_is_delete,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(rxvt_homeend,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(funky_type,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sharrow_type,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(no_applic_c, /* totally disable app cursor keys */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(no_applic_k, /* totally disable app keypad */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(no_mouse_rep, /* totally disable mouse reporting */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(no_remote_resize, /* disable remote resizing */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(no_alt_screen, /* disable alternate screen */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(no_remote_wintitle, /* disable remote retitling */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(no_remote_clearscroll, /* disable ESC[3J */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(no_dbackspace, /* disable destructive backspace */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(no_remote_charset, /* disable remote charset config */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(remote_qtitle_action, /* handling of remote window title queries */
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(app_cursor,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(app_keypad,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(nethack_keypad,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(telnet_keyboard,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(telnet_newline,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(alt_f4, /* is it special? */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(alt_space, /* is it special? */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(alt_only, /* is it special? */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(localecho,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(localedit,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(alwaysontop,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(fullscreenonaltenter,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(scroll_on_key,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(scroll_on_disp,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(erase_to_scrollback,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(compose_key,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(ctrlaltkeys,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(osx_option_meta,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(osx_command_meta,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(wintitle, /* initial window title */
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
/* Terminal options */
|
||||
CONF_OPTION(savelines,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(dec_om,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(wrap_mode,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(lfhascr,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(cursor_type,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(blink_cur,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(beep,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(beep_ind,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(bellovl, /* bell overload protection active? */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(bellovl_n, /* number of bells to cause overload */
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(bellovl_t, /* time interval for overload (ticks) */
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(bellovl_s, /* period of silence to re-enable bell (s) */
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(bell_wavefile,
|
||||
VALUE_TYPE(FILENAME),
|
||||
)
|
||||
CONF_OPTION(scrollbar,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(scrollbar_in_fullscreen,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(resize_action,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(bce,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(blinktext,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(win_name_always,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(width,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(height,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(font,
|
||||
VALUE_TYPE(FONT),
|
||||
)
|
||||
CONF_OPTION(font_quality,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(logfilename,
|
||||
VALUE_TYPE(FILENAME),
|
||||
)
|
||||
CONF_OPTION(logtype,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(logxfovr,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(logflush,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(logheader,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(logomitpass,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(logomitdata,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(hide_mouseptr,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(sunken_edge,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(window_border,
|
||||
VALUE_TYPE(INT), /* in pixels */
|
||||
)
|
||||
CONF_OPTION(answerback,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(printer,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(no_arabicshaping,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(no_bidi,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
|
||||
/* Colour options */
|
||||
CONF_OPTION(ansi_colour,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(xterm_256_colour,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(true_colour,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(system_colour,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(try_palette,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(bold_style,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(colours,
|
||||
SUBKEY_TYPE(INT), /* indexed by CONF_COLOUR_* enum encoding */
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
|
||||
/* Selection options */
|
||||
CONF_OPTION(mouse_is_xterm,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(rect_select,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(paste_controls,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(rawcnp,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(utf8linedraw,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(rtf_paste,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(mouse_override,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(wordness,
|
||||
SUBKEY_TYPE(INT), /* ASCII character codes (literally, just 00-7F) */
|
||||
VALUE_TYPE(INT), /* arbitrary equivalence-class value for that char */
|
||||
)
|
||||
CONF_OPTION(mouseautocopy,
|
||||
/*
|
||||
* What clipboard (if any) to copy text to as soon as it's
|
||||
* selected with the mouse.
|
||||
*/
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(mousepaste, /* clipboard used by one-mouse-click paste actions */
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(ctrlshiftins, /* clipboard used by Ctrl+Ins and Shift+Ins */
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(ctrlshiftcv, /* clipboard used by Ctrl+Shift+C and Ctrl+Shift+V */
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(mousepaste_custom,
|
||||
/* Custom clipboard name if CONF_mousepaste is set to CLIPUI_CUSTOM */
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(ctrlshiftins_custom,
|
||||
/* Custom clipboard name if CONF_ctrlshiftins is set to CLIPUI_CUSTOM */
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(ctrlshiftcv_custom,
|
||||
/* Custom clipboard name if CONF_ctrlshiftcv is set to CLIPUI_CUSTOM */
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
|
||||
/* Character-set translation */
|
||||
CONF_OPTION(vtmode,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(line_codepage,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(cjk_ambig_wide,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(utf8_override,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(xlat_capslockcyr,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
|
||||
/* X11 forwarding */
|
||||
CONF_OPTION(x11_forward,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(x11_display,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
CONF_OPTION(x11_auth,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(xauthfile,
|
||||
VALUE_TYPE(FILENAME),
|
||||
)
|
||||
|
||||
/* Port forwarding */
|
||||
CONF_OPTION(lport_acceptall, /* accept conns from hosts other than localhost */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(rport_acceptall, /* same for remote forwarded ports */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(portfwd,
|
||||
/*
|
||||
* Subkeys for 'portfwd' can have the following forms:
|
||||
*
|
||||
* [LR]localport
|
||||
* [LR]localaddr:localport
|
||||
*
|
||||
* Dynamic forwardings are indicated by an 'L' key, and the
|
||||
* special value "D". For all other forwardings, the value should
|
||||
* be of the form 'host:port'.
|
||||
*/
|
||||
SUBKEY_TYPE(STR),
|
||||
VALUE_TYPE(STR),
|
||||
)
|
||||
|
||||
/* SSH bug compatibility modes. All FORCE_ON/FORCE_OFF/AUTO */
|
||||
CONF_OPTION(sshbug_ignore1,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_plainpw1,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_rsa1,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_ignore2,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_derivekey2,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_rsapad2,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_pksessid2,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_rekey2,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_maxpkt2,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_oldgex2,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_winadj,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_chanreq,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_dropstart,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_filter_kexinit,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_rsa_sha2_cert_userauth,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
CONF_OPTION(sshbug_hmac2,
|
||||
VALUE_TYPE(INT),
|
||||
)
|
||||
|
||||
/* Options for Unix. Should split out into platform-dependent part. */
|
||||
CONF_OPTION(stamp_utmp, /* used by Unix pterm */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(login_shell, /* used by Unix pterm */
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(scrollbar_on_left,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(shadowbold,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(boldfont,
|
||||
VALUE_TYPE(FONT),
|
||||
)
|
||||
CONF_OPTION(widefont,
|
||||
VALUE_TYPE(FONT),
|
||||
)
|
||||
CONF_OPTION(wideboldfont,
|
||||
VALUE_TYPE(FONT),
|
||||
)
|
||||
CONF_OPTION(shadowboldoffset,
|
||||
VALUE_TYPE(INT), /* in pixels */
|
||||
)
|
||||
CONF_OPTION(crhaslf,
|
||||
VALUE_TYPE(BOOL),
|
||||
)
|
||||
CONF_OPTION(winclass,
|
||||
VALUE_TYPE(STR),
|
||||
)
|
2
defs.h
2
defs.h
@ -74,6 +74,8 @@ uintmax_t strtoumax(const char *nptr, char **endptr, int base);
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
typedef struct conf_tag Conf;
|
||||
typedef struct ConfKeyInfo ConfKeyInfo;
|
||||
|
||||
typedef struct terminal_tag Terminal;
|
||||
typedef struct term_utf8_decode term_utf8_decode;
|
||||
|
||||
|
279
putty.h
279
putty.h
@ -1787,271 +1787,15 @@ NORETURN void cleanup_exit(int);
|
||||
* Exports from conf.c, and a big enum (via parametric macro) of
|
||||
* configuration option keys.
|
||||
*/
|
||||
#define CONFIG_OPTIONS(X) \
|
||||
/* X(value-type, subkey-type, keyword) */ \
|
||||
X(STR, NONE, host) \
|
||||
X(INT, NONE, port) \
|
||||
X(INT, NONE, protocol) /* PROT_SSH, PROT_TELNET etc */ \
|
||||
X(INT, NONE, addressfamily) /* ADDRTYPE_IPV[46] or ADDRTYPE_UNSPEC */ \
|
||||
X(INT, NONE, close_on_exit) /* FORCE_ON, FORCE_OFF, AUTO */ \
|
||||
X(BOOL, NONE, warn_on_close) \
|
||||
X(INT, NONE, ping_interval) /* in seconds */ \
|
||||
X(BOOL, NONE, tcp_nodelay) \
|
||||
X(BOOL, NONE, tcp_keepalives) \
|
||||
X(STR, NONE, loghost) /* logical host being contacted, for host key check */ \
|
||||
/* Proxy options */ \
|
||||
X(STR, NONE, proxy_exclude_list) \
|
||||
X(INT, NONE, proxy_dns) /* FORCE_ON, FORCE_OFF, AUTO */ \
|
||||
X(BOOL, NONE, even_proxy_localhost) \
|
||||
X(INT, NONE, proxy_type) /* PROXY_NONE, PROXY_SOCKS4, ... */ \
|
||||
X(STR, NONE, proxy_host) \
|
||||
X(INT, NONE, proxy_port) \
|
||||
X(STR, NONE, proxy_username) \
|
||||
X(STR, NONE, proxy_password) \
|
||||
X(STR, NONE, proxy_telnet_command) \
|
||||
X(INT, NONE, proxy_log_to_term) /* FORCE_ON, FORCE_OFF, AUTO */ \
|
||||
/* SSH options */ \
|
||||
X(STR, NONE, remote_cmd) \
|
||||
X(STR, NONE, remote_cmd2) /* fallback if remote_cmd fails; never loaded or saved */ \
|
||||
X(BOOL, NONE, nopty) \
|
||||
X(BOOL, NONE, compression) \
|
||||
X(INT, INT, ssh_kexlist) \
|
||||
X(INT, INT, ssh_hklist) \
|
||||
X(BOOL, NONE, ssh_prefer_known_hostkeys) \
|
||||
X(INT, NONE, ssh_rekey_time) /* in minutes */ \
|
||||
X(STR, NONE, ssh_rekey_data) /* string encoding e.g. "100K", "2M", "1G" */ \
|
||||
X(BOOL, NONE, tryagent) \
|
||||
X(BOOL, NONE, agentfwd) \
|
||||
X(BOOL, NONE, change_username) /* allow username switching in SSH-2 */ \
|
||||
X(INT, INT, ssh_cipherlist) \
|
||||
X(FILENAME, NONE, keyfile) \
|
||||
X(FILENAME, NONE, detached_cert) \
|
||||
X(STR, NONE, auth_plugin) \
|
||||
/* \
|
||||
* Which SSH protocol to use. \
|
||||
* For historical reasons, the current legal values for CONF_sshprot \
|
||||
* are: \
|
||||
* 0 = SSH-1 only \
|
||||
* 3 = SSH-2 only \
|
||||
* We used to also support \
|
||||
* 1 = SSH-1 with fallback to SSH-2 \
|
||||
* 2 = SSH-2 with fallback to SSH-1 \
|
||||
* and we continue to use 0/3 in storage formats rather than the more \
|
||||
* obvious 1/2 to avoid surprises if someone saves a session and later \
|
||||
* downgrades PuTTY. So it's easier to use these numbers internally too. \
|
||||
*/ \
|
||||
X(INT, NONE, sshprot) \
|
||||
X(BOOL, NONE, ssh2_des_cbc) /* "des-cbc" unrecommended SSH-2 cipher */ \
|
||||
X(BOOL, NONE, ssh_no_userauth) /* bypass "ssh-userauth" (SSH-2 only) */ \
|
||||
X(BOOL, NONE, ssh_no_trivial_userauth) /* disable trivial types of auth */ \
|
||||
X(BOOL, NONE, ssh_show_banner) /* show USERAUTH_BANNERs (SSH-2 only) */ \
|
||||
X(BOOL, NONE, try_tis_auth) \
|
||||
X(BOOL, NONE, try_ki_auth) \
|
||||
X(BOOL, NONE, try_gssapi_auth) /* attempt gssapi auth via ssh userauth */ \
|
||||
X(BOOL, NONE, try_gssapi_kex) /* attempt gssapi auth via ssh kex */ \
|
||||
X(BOOL, NONE, gssapifwd) /* forward tgt via gss */ \
|
||||
X(INT, NONE, gssapirekey) /* KEXGSS refresh interval (mins) */ \
|
||||
X(INT, INT, ssh_gsslist) /* preference order for local GSS libs */ \
|
||||
X(FILENAME, NONE, ssh_gss_custom) \
|
||||
X(BOOL, NONE, ssh_subsys) /* run a subsystem rather than a command */ \
|
||||
X(BOOL, NONE, ssh_subsys2) /* fallback to go with remote_cmd_ptr2 */ \
|
||||
X(BOOL, NONE, ssh_no_shell) /* avoid running a shell */ \
|
||||
X(STR, NONE, ssh_nc_host) /* host to connect to in `nc' mode */ \
|
||||
X(INT, NONE, ssh_nc_port) /* port to connect to in `nc' mode */ \
|
||||
/* Telnet options */ \
|
||||
X(STR, NONE, termtype) \
|
||||
X(STR, NONE, termspeed) \
|
||||
X(STR, STR, ttymodes) /* values are "Vvalue" or "A" */ \
|
||||
X(STR, STR, environmt) \
|
||||
X(STR, NONE, username) \
|
||||
X(BOOL, NONE, username_from_env) \
|
||||
X(STR, NONE, localusername) \
|
||||
X(BOOL, NONE, rfc_environ) \
|
||||
X(BOOL, NONE, passive_telnet) \
|
||||
/* Serial port options */ \
|
||||
X(STR, NONE, serline) \
|
||||
X(INT, NONE, serspeed) \
|
||||
X(INT, NONE, serdatabits) \
|
||||
X(INT, NONE, serstopbits) \
|
||||
X(INT, NONE, serparity) /* SER_PAR_NONE, SER_PAR_ODD, ... */ \
|
||||
X(INT, NONE, serflow) /* SER_FLOW_NONE, SER_FLOW_XONXOFF, ... */ \
|
||||
/* Supdup options */ \
|
||||
X(STR, NONE, supdup_location) \
|
||||
X(INT, NONE, supdup_ascii_set) \
|
||||
X(BOOL, NONE, supdup_more) \
|
||||
X(BOOL, NONE, supdup_scroll) \
|
||||
/* Keyboard options */ \
|
||||
X(BOOL, NONE, bksp_is_delete) \
|
||||
X(BOOL, NONE, rxvt_homeend) \
|
||||
X(INT, NONE, funky_type) /* FUNKY_XTERM, FUNKY_LINUX, ... */ \
|
||||
X(INT, NONE, sharrow_type) /* SHARROW_APPLICATION, SHARROW_BITMAP, ... */ \
|
||||
X(BOOL, NONE, no_applic_c) /* totally disable app cursor keys */ \
|
||||
X(BOOL, NONE, no_applic_k) /* totally disable app keypad */ \
|
||||
X(BOOL, NONE, no_mouse_rep) /* totally disable mouse reporting */ \
|
||||
X(BOOL, NONE, no_remote_resize) /* disable remote resizing */ \
|
||||
X(BOOL, NONE, no_alt_screen) /* disable alternate screen */ \
|
||||
X(BOOL, NONE, no_remote_wintitle) /* disable remote retitling */ \
|
||||
X(BOOL, NONE, no_remote_clearscroll) /* disable ESC[3J */ \
|
||||
X(BOOL, NONE, no_dbackspace) /* disable destructive backspace */ \
|
||||
X(BOOL, NONE, no_remote_charset) /* disable remote charset config */ \
|
||||
X(INT, NONE, remote_qtitle_action) /* remote win title query action
|
||||
* (TITLE_NONE, TITLE_EMPTY, ...) */ \
|
||||
X(BOOL, NONE, app_cursor) \
|
||||
X(BOOL, NONE, app_keypad) \
|
||||
X(BOOL, NONE, nethack_keypad) \
|
||||
X(BOOL, NONE, telnet_keyboard) \
|
||||
X(BOOL, NONE, telnet_newline) \
|
||||
X(BOOL, NONE, alt_f4) /* is it special? */ \
|
||||
X(BOOL, NONE, alt_space) /* is it special? */ \
|
||||
X(BOOL, NONE, alt_only) /* is it special? */ \
|
||||
X(INT, NONE, localecho) /* FORCE_ON, FORCE_OFF, AUTO */ \
|
||||
X(INT, NONE, localedit) /* FORCE_ON, FORCE_OFF, AUTO */ \
|
||||
X(BOOL, NONE, alwaysontop) \
|
||||
X(BOOL, NONE, fullscreenonaltenter) \
|
||||
X(BOOL, NONE, scroll_on_key) \
|
||||
X(BOOL, NONE, scroll_on_disp) \
|
||||
X(BOOL, NONE, erase_to_scrollback) \
|
||||
X(BOOL, NONE, compose_key) \
|
||||
X(BOOL, NONE, ctrlaltkeys) \
|
||||
X(BOOL, NONE, osx_option_meta) \
|
||||
X(BOOL, NONE, osx_command_meta) \
|
||||
X(STR, NONE, wintitle) /* initial window title */ \
|
||||
/* Terminal options */ \
|
||||
X(INT, NONE, savelines) \
|
||||
X(BOOL, NONE, dec_om) \
|
||||
X(BOOL, NONE, wrap_mode) \
|
||||
X(BOOL, NONE, lfhascr) \
|
||||
X(INT, NONE, cursor_type) /* 0=block 1=underline 2=vertical */ \
|
||||
X(BOOL, NONE, blink_cur) \
|
||||
X(INT, NONE, beep) /* BELL_DISABLED, BELL_DEFAULT, ... */ \
|
||||
X(INT, NONE, beep_ind) /* B_IND_DISABLED, B_IND_FLASH, ... */ \
|
||||
X(BOOL, NONE, bellovl) /* bell overload protection active? */ \
|
||||
X(INT, NONE, bellovl_n) /* number of bells to cause overload */ \
|
||||
X(INT, NONE, bellovl_t) /* time interval for overload (seconds) */ \
|
||||
X(INT, NONE, bellovl_s) /* period of silence to re-enable bell (s) */ \
|
||||
X(FILENAME, NONE, bell_wavefile) \
|
||||
X(BOOL, NONE, scrollbar) \
|
||||
X(BOOL, NONE, scrollbar_in_fullscreen) \
|
||||
X(INT, NONE, resize_action) /* RESIZE_TERM, RESIZE_DISABLED, ... */ \
|
||||
X(BOOL, NONE, bce) \
|
||||
X(BOOL, NONE, blinktext) \
|
||||
X(BOOL, NONE, win_name_always) \
|
||||
X(INT, NONE, width) \
|
||||
X(INT, NONE, height) \
|
||||
X(FONT, NONE, font) \
|
||||
X(INT, NONE, font_quality) /* FQ_DEFAULT, FQ_ANTIALIASED, ... */ \
|
||||
X(FILENAME, NONE, logfilename) \
|
||||
X(INT, NONE, logtype) /* LGTYP_NONE, LGTYPE_ASCII, ... */ \
|
||||
X(INT, NONE, logxfovr) /* LGXF_OVR, LGXF_APN, LGXF_ASK */ \
|
||||
X(BOOL, NONE, logflush) \
|
||||
X(BOOL, NONE, logheader) \
|
||||
X(BOOL, NONE, logomitpass) \
|
||||
X(BOOL, NONE, logomitdata) \
|
||||
X(BOOL, NONE, hide_mouseptr) \
|
||||
X(BOOL, NONE, sunken_edge) \
|
||||
X(INT, NONE, window_border) /* in pixels */ \
|
||||
X(STR, NONE, answerback) \
|
||||
X(STR, NONE, printer) \
|
||||
X(BOOL, NONE, no_arabicshaping) \
|
||||
X(BOOL, NONE, no_bidi) \
|
||||
/* Colour options */ \
|
||||
X(BOOL, NONE, ansi_colour) \
|
||||
X(BOOL, NONE, xterm_256_colour) \
|
||||
X(BOOL, NONE, true_colour) \
|
||||
X(BOOL, NONE, system_colour) \
|
||||
X(BOOL, NONE, try_palette) \
|
||||
X(INT, NONE, bold_style) /* 1=font 2=colour (3=both) */ \
|
||||
X(INT, INT, colours) /* indexed by the CONF_COLOUR_* enum encoding */ \
|
||||
/* Selection options */ \
|
||||
X(INT, NONE, mouse_is_xterm) /* 0=compromise 1=xterm 2=Windows */ \
|
||||
X(BOOL, NONE, rect_select) \
|
||||
X(BOOL, NONE, paste_controls) \
|
||||
X(BOOL, NONE, rawcnp) \
|
||||
X(BOOL, NONE, utf8linedraw) \
|
||||
X(BOOL, NONE, rtf_paste) \
|
||||
X(BOOL, NONE, mouse_override) \
|
||||
X(INT, INT, wordness) \
|
||||
X(BOOL, NONE, mouseautocopy) \
|
||||
X(INT, NONE, mousepaste) /* CLIPUI_IMPLICIT, CLIPUI_EXPLICIT, ... */ \
|
||||
X(INT, NONE, ctrlshiftins) /* CLIPUI_IMPLICIT, CLIPUI_EXPLICIT, ... */ \
|
||||
X(INT, NONE, ctrlshiftcv) /* CLIPUI_IMPLICIT, CLIPUI_EXPLICIT, ... */ \
|
||||
X(STR, NONE, mousepaste_custom) \
|
||||
X(STR, NONE, ctrlshiftins_custom) \
|
||||
X(STR, NONE, ctrlshiftcv_custom) \
|
||||
/* translations */ \
|
||||
X(INT, NONE, vtmode) /* VT_XWINDOWS, VT_OEMANSI, ... */ \
|
||||
X(STR, NONE, line_codepage) \
|
||||
X(BOOL, NONE, cjk_ambig_wide) \
|
||||
X(BOOL, NONE, utf8_override) \
|
||||
X(BOOL, NONE, xlat_capslockcyr) \
|
||||
/* X11 forwarding */ \
|
||||
X(BOOL, NONE, x11_forward) \
|
||||
X(STR, NONE, x11_display) \
|
||||
X(INT, NONE, x11_auth) /* X11_NO_AUTH, X11_MIT, X11_XDM */ \
|
||||
X(FILENAME, NONE, xauthfile) \
|
||||
/* port forwarding */ \
|
||||
X(BOOL, NONE, lport_acceptall) /* accept conns from hosts other than localhost */ \
|
||||
X(BOOL, NONE, rport_acceptall) /* same for remote forwarded ports (SSH-2 only) */ \
|
||||
/* \
|
||||
* Subkeys for 'portfwd' can have the following forms: \
|
||||
* \
|
||||
* [LR]localport \
|
||||
* [LR]localaddr:localport \
|
||||
* \
|
||||
* Dynamic forwardings are indicated by an 'L' key, and the \
|
||||
* special value "D". For all other forwardings, the value \
|
||||
* should be of the form 'host:port'. \
|
||||
*/ \
|
||||
X(STR, STR, portfwd) \
|
||||
/* SSH bug compatibility modes. All FORCE_ON/FORCE_OFF/AUTO */ \
|
||||
X(INT, NONE, sshbug_ignore1) \
|
||||
X(INT, NONE, sshbug_plainpw1) \
|
||||
X(INT, NONE, sshbug_rsa1) \
|
||||
X(INT, NONE, sshbug_hmac2) \
|
||||
X(INT, NONE, sshbug_derivekey2) \
|
||||
X(INT, NONE, sshbug_rsapad2) \
|
||||
X(INT, NONE, sshbug_pksessid2) \
|
||||
X(INT, NONE, sshbug_rekey2) \
|
||||
X(INT, NONE, sshbug_maxpkt2) \
|
||||
X(INT, NONE, sshbug_ignore2) \
|
||||
X(INT, NONE, sshbug_oldgex2) \
|
||||
X(INT, NONE, sshbug_winadj) \
|
||||
X(INT, NONE, sshbug_chanreq) \
|
||||
X(INT, NONE, sshbug_dropstart) \
|
||||
X(INT, NONE, sshbug_filter_kexinit) \
|
||||
X(INT, NONE, sshbug_rsa_sha2_cert_userauth) \
|
||||
/* \
|
||||
* ssh_simple means that we promise never to open any channel \
|
||||
* other than the main one, which means it can safely use a very \
|
||||
* large window in SSH-2. \
|
||||
*/ \
|
||||
X(BOOL, NONE, ssh_simple) \
|
||||
X(BOOL, NONE, ssh_connection_sharing) \
|
||||
X(BOOL, NONE, ssh_connection_sharing_upstream) \
|
||||
X(BOOL, NONE, ssh_connection_sharing_downstream) \
|
||||
/*
|
||||
* ssh_manual_hostkeys is conceptually a set rather than a
|
||||
* dictionary: the string subkeys are the important thing, and the
|
||||
* actual values to which those subkeys map are all "".
|
||||
*/ \
|
||||
X(STR, STR, ssh_manual_hostkeys) \
|
||||
/* Options for pterm. Should split out into platform-dependent part. */ \
|
||||
X(BOOL, NONE, stamp_utmp) \
|
||||
X(BOOL, NONE, login_shell) \
|
||||
X(BOOL, NONE, scrollbar_on_left) \
|
||||
X(BOOL, NONE, shadowbold) \
|
||||
X(FONT, NONE, boldfont) \
|
||||
X(FONT, NONE, widefont) \
|
||||
X(FONT, NONE, wideboldfont) \
|
||||
X(INT, NONE, shadowboldoffset) /* in pixels */ \
|
||||
X(BOOL, NONE, crhaslf) \
|
||||
X(STR, NONE, winclass) \
|
||||
/* end of list */
|
||||
|
||||
/* Now define the actual enum of option keywords using that macro. */
|
||||
#define CONF_ENUM_DEF(valtype, keytype, keyword) CONF_ ## keyword,
|
||||
enum config_primary_key { CONFIG_OPTIONS(CONF_ENUM_DEF) N_CONFIG_OPTIONS };
|
||||
#undef CONF_ENUM_DEF
|
||||
/* The master list of option keywords lives in conf.h */
|
||||
enum config_primary_key {
|
||||
#define CONF_OPTION(keyword, ...) CONF_ ## keyword,
|
||||
#include "conf.h"
|
||||
#undef CONF_OPTION
|
||||
|
||||
N_CONFIG_OPTIONS
|
||||
};
|
||||
|
||||
/* Types that appear in Conf keys and values. CONF_TYPE_NONE is used
|
||||
* as the subkey type for options that don't have subkeys, and is also
|
||||
@ -2066,6 +1810,13 @@ enum {
|
||||
CONF_TYPE_FONT,
|
||||
};
|
||||
|
||||
struct ConfKeyInfo {
|
||||
int subkey_type;
|
||||
int value_type;
|
||||
};
|
||||
|
||||
extern const ConfKeyInfo conf_key_info[];
|
||||
|
||||
/* Functions handling configuration structures. */
|
||||
Conf *conf_new(void); /* create an empty configuration */
|
||||
void conf_free(Conf *conf);
|
||||
|
@ -14,6 +14,7 @@ add_sources_from_current_dir(utils
|
||||
chomp.c
|
||||
cmdline_get_passwd_input_state_new.c
|
||||
conf.c
|
||||
conf_data.c
|
||||
conf_dest.c
|
||||
conf_launchable.c
|
||||
ctrlparse.c
|
||||
|
97
utils/conf.c
97
utils/conf.c
@ -10,15 +10,6 @@
|
||||
#include "tree234.h"
|
||||
#include "putty.h"
|
||||
|
||||
/*
|
||||
* Arrays which allow us to look up the subkey and value types for a
|
||||
* given primary key id.
|
||||
*/
|
||||
#define CONF_SUBKEYTYPE_DEF(valtype, keytype, keyword) CONF_TYPE_ ## keytype,
|
||||
static int subkeytypes[] = { CONFIG_OPTIONS(CONF_SUBKEYTYPE_DEF) };
|
||||
#define CONF_VALUETYPE_DEF(valtype, keytype, keyword) CONF_TYPE_ ## valtype,
|
||||
static int valuetypes[] = { CONFIG_OPTIONS(CONF_VALUETYPE_DEF) };
|
||||
|
||||
/*
|
||||
* Configuration keys are primarily integers (big enum of all the
|
||||
* different configurable options); some keys have string-designated
|
||||
@ -80,7 +71,7 @@ static int conf_cmp(void *av, void *bv)
|
||||
return -1;
|
||||
else if (a->primary > b->primary)
|
||||
return +1;
|
||||
switch (subkeytypes[a->primary]) {
|
||||
switch (conf_key_info[a->primary].subkey_type) {
|
||||
case CONF_TYPE_INT:
|
||||
if (a->secondary.i < b->secondary.i)
|
||||
return -1;
|
||||
@ -103,7 +94,7 @@ static int conf_cmp_constkey(void *av, void *bv)
|
||||
return -1;
|
||||
else if (a->primary > b->primary)
|
||||
return +1;
|
||||
switch (subkeytypes[a->primary]) {
|
||||
switch (conf_key_info[a->primary].subkey_type) {
|
||||
case CONF_TYPE_INT:
|
||||
if (a->secondary.i < b->secondary.i)
|
||||
return -1;
|
||||
@ -124,7 +115,7 @@ static int conf_cmp_constkey(void *av, void *bv)
|
||||
*/
|
||||
static void free_key(struct key *key)
|
||||
{
|
||||
if (subkeytypes[key->primary] == CONF_TYPE_STR)
|
||||
if (conf_key_info[key->primary].subkey_type == CONF_TYPE_STR)
|
||||
sfree(key->secondary.s);
|
||||
}
|
||||
|
||||
@ -135,7 +126,7 @@ static void free_key(struct key *key)
|
||||
static void copy_key(struct key *to, struct key *from)
|
||||
{
|
||||
to->primary = from->primary;
|
||||
switch (subkeytypes[to->primary]) {
|
||||
switch (conf_key_info[to->primary].subkey_type) {
|
||||
case CONF_TYPE_INT:
|
||||
to->secondary.i = from->secondary.i;
|
||||
break;
|
||||
@ -191,7 +182,7 @@ static void copy_value(struct value *to, struct value *from, int type)
|
||||
static void free_entry(struct conf_entry *entry)
|
||||
{
|
||||
free_key(&entry->key);
|
||||
free_value(&entry->value, valuetypes[entry->key.primary]);
|
||||
free_value(&entry->value, conf_key_info[entry->key.primary].value_type);
|
||||
sfree(entry);
|
||||
}
|
||||
|
||||
@ -241,7 +232,7 @@ void conf_copy_into(Conf *newconf, Conf *oldconf)
|
||||
entry2 = snew(struct conf_entry);
|
||||
copy_key(&entry2->key, &entry->key);
|
||||
copy_value(&entry2->value, &entry->value,
|
||||
valuetypes[entry->key.primary]);
|
||||
conf_key_info[entry->key.primary].value_type);
|
||||
add234(newconf->tree, entry2);
|
||||
}
|
||||
}
|
||||
@ -260,8 +251,8 @@ bool conf_get_bool(Conf *conf, int primary)
|
||||
struct key key;
|
||||
struct conf_entry *entry;
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_NONE);
|
||||
assert(valuetypes[primary] == CONF_TYPE_BOOL);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_NONE);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_BOOL);
|
||||
key.primary = primary;
|
||||
entry = find234(conf->tree, &key, NULL);
|
||||
assert(entry);
|
||||
@ -273,8 +264,8 @@ int conf_get_int(Conf *conf, int primary)
|
||||
struct key key;
|
||||
struct conf_entry *entry;
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_NONE);
|
||||
assert(valuetypes[primary] == CONF_TYPE_INT);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_NONE);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_INT);
|
||||
key.primary = primary;
|
||||
entry = find234(conf->tree, &key, NULL);
|
||||
assert(entry);
|
||||
@ -286,8 +277,8 @@ int conf_get_int_int(Conf *conf, int primary, int secondary)
|
||||
struct key key;
|
||||
struct conf_entry *entry;
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_INT);
|
||||
assert(valuetypes[primary] == CONF_TYPE_INT);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_INT);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_INT);
|
||||
key.primary = primary;
|
||||
key.secondary.i = secondary;
|
||||
entry = find234(conf->tree, &key, NULL);
|
||||
@ -300,8 +291,8 @@ char *conf_get_str(Conf *conf, int primary)
|
||||
struct key key;
|
||||
struct conf_entry *entry;
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_NONE);
|
||||
assert(valuetypes[primary] == CONF_TYPE_STR);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_NONE);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_STR);
|
||||
key.primary = primary;
|
||||
entry = find234(conf->tree, &key, NULL);
|
||||
assert(entry);
|
||||
@ -313,8 +304,8 @@ char *conf_get_str_str_opt(Conf *conf, int primary, const char *secondary)
|
||||
struct key key;
|
||||
struct conf_entry *entry;
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_STR);
|
||||
assert(valuetypes[primary] == CONF_TYPE_STR);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_STR);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_STR);
|
||||
key.primary = primary;
|
||||
key.secondary.s = (char *)secondary;
|
||||
entry = find234(conf->tree, &key, NULL);
|
||||
@ -334,8 +325,8 @@ char *conf_get_str_strs(Conf *conf, int primary,
|
||||
struct constkey key;
|
||||
struct conf_entry *entry;
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_STR);
|
||||
assert(valuetypes[primary] == CONF_TYPE_STR);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_STR);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_STR);
|
||||
key.primary = primary;
|
||||
if (subkeyin) {
|
||||
key.secondary.s = subkeyin;
|
||||
@ -356,8 +347,8 @@ char *conf_get_str_nthstrkey(Conf *conf, int primary, int n)
|
||||
struct conf_entry *entry;
|
||||
int index;
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_STR);
|
||||
assert(valuetypes[primary] == CONF_TYPE_STR);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_STR);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_STR);
|
||||
key.primary = primary;
|
||||
key.secondary.s = "";
|
||||
entry = findrelpos234(conf->tree, &key, conf_cmp_constkey,
|
||||
@ -375,8 +366,8 @@ Filename *conf_get_filename(Conf *conf, int primary)
|
||||
struct key key;
|
||||
struct conf_entry *entry;
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_NONE);
|
||||
assert(valuetypes[primary] == CONF_TYPE_FILENAME);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_NONE);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_FILENAME);
|
||||
key.primary = primary;
|
||||
entry = find234(conf->tree, &key, NULL);
|
||||
assert(entry);
|
||||
@ -388,8 +379,8 @@ FontSpec *conf_get_fontspec(Conf *conf, int primary)
|
||||
struct key key;
|
||||
struct conf_entry *entry;
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_NONE);
|
||||
assert(valuetypes[primary] == CONF_TYPE_FONT);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_NONE);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_FONT);
|
||||
key.primary = primary;
|
||||
entry = find234(conf->tree, &key, NULL);
|
||||
assert(entry);
|
||||
@ -400,8 +391,8 @@ void conf_set_bool(Conf *conf, int primary, bool value)
|
||||
{
|
||||
struct conf_entry *entry = snew(struct conf_entry);
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_NONE);
|
||||
assert(valuetypes[primary] == CONF_TYPE_BOOL);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_NONE);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_BOOL);
|
||||
entry->key.primary = primary;
|
||||
entry->value.u.boolval = value;
|
||||
conf_insert(conf, entry);
|
||||
@ -411,8 +402,8 @@ void conf_set_int(Conf *conf, int primary, int value)
|
||||
{
|
||||
struct conf_entry *entry = snew(struct conf_entry);
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_NONE);
|
||||
assert(valuetypes[primary] == CONF_TYPE_INT);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_NONE);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_INT);
|
||||
entry->key.primary = primary;
|
||||
entry->value.u.intval = value;
|
||||
conf_insert(conf, entry);
|
||||
@ -423,8 +414,8 @@ void conf_set_int_int(Conf *conf, int primary,
|
||||
{
|
||||
struct conf_entry *entry = snew(struct conf_entry);
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_INT);
|
||||
assert(valuetypes[primary] == CONF_TYPE_INT);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_INT);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_INT);
|
||||
entry->key.primary = primary;
|
||||
entry->key.secondary.i = secondary;
|
||||
entry->value.u.intval = value;
|
||||
@ -435,8 +426,8 @@ void conf_set_str(Conf *conf, int primary, const char *value)
|
||||
{
|
||||
struct conf_entry *entry = snew(struct conf_entry);
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_NONE);
|
||||
assert(valuetypes[primary] == CONF_TYPE_STR);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_NONE);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_STR);
|
||||
entry->key.primary = primary;
|
||||
entry->value.u.stringval = dupstr(value);
|
||||
conf_insert(conf, entry);
|
||||
@ -447,8 +438,8 @@ void conf_set_str_str(Conf *conf, int primary, const char *secondary,
|
||||
{
|
||||
struct conf_entry *entry = snew(struct conf_entry);
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_STR);
|
||||
assert(valuetypes[primary] == CONF_TYPE_STR);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_STR);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_STR);
|
||||
entry->key.primary = primary;
|
||||
entry->key.secondary.s = dupstr(secondary);
|
||||
entry->value.u.stringval = dupstr(value);
|
||||
@ -460,8 +451,8 @@ void conf_del_str_str(Conf *conf, int primary, const char *secondary)
|
||||
struct key key;
|
||||
struct conf_entry *entry;
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_STR);
|
||||
assert(valuetypes[primary] == CONF_TYPE_STR);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_STR);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_STR);
|
||||
key.primary = primary;
|
||||
key.secondary.s = (char *)secondary;
|
||||
entry = find234(conf->tree, &key, NULL);
|
||||
@ -475,8 +466,8 @@ void conf_set_filename(Conf *conf, int primary, const Filename *value)
|
||||
{
|
||||
struct conf_entry *entry = snew(struct conf_entry);
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_NONE);
|
||||
assert(valuetypes[primary] == CONF_TYPE_FILENAME);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_NONE);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_FILENAME);
|
||||
entry->key.primary = primary;
|
||||
entry->value.u.fileval = filename_copy(value);
|
||||
conf_insert(conf, entry);
|
||||
@ -486,8 +477,8 @@ void conf_set_fontspec(Conf *conf, int primary, const FontSpec *value)
|
||||
{
|
||||
struct conf_entry *entry = snew(struct conf_entry);
|
||||
|
||||
assert(subkeytypes[primary] == CONF_TYPE_NONE);
|
||||
assert(valuetypes[primary] == CONF_TYPE_FONT);
|
||||
assert(conf_key_info[primary].subkey_type == CONF_TYPE_NONE);
|
||||
assert(conf_key_info[primary].value_type == CONF_TYPE_FONT);
|
||||
entry->key.primary = primary;
|
||||
entry->value.u.fontval = fontspec_copy(value);
|
||||
conf_insert(conf, entry);
|
||||
@ -501,7 +492,7 @@ void conf_serialise(BinarySink *bs, Conf *conf)
|
||||
for (i = 0; (entry = index234(conf->tree, i)) != NULL; i++) {
|
||||
put_uint32(bs, entry->key.primary);
|
||||
|
||||
switch (subkeytypes[entry->key.primary]) {
|
||||
switch (conf_key_info[entry->key.primary].subkey_type) {
|
||||
case CONF_TYPE_INT:
|
||||
put_uint32(bs, entry->key.secondary.i);
|
||||
break;
|
||||
@ -509,7 +500,7 @@ void conf_serialise(BinarySink *bs, Conf *conf)
|
||||
put_asciz(bs, entry->key.secondary.s);
|
||||
break;
|
||||
}
|
||||
switch (valuetypes[entry->key.primary]) {
|
||||
switch (conf_key_info[entry->key.primary].value_type) {
|
||||
case CONF_TYPE_BOOL:
|
||||
put_bool(bs, entry->value.u.boolval);
|
||||
break;
|
||||
@ -549,7 +540,7 @@ bool conf_deserialise(Conf *conf, BinarySource *src)
|
||||
entry = snew(struct conf_entry);
|
||||
entry->key.primary = primary;
|
||||
|
||||
switch (subkeytypes[entry->key.primary]) {
|
||||
switch (conf_key_info[entry->key.primary].subkey_type) {
|
||||
case CONF_TYPE_INT:
|
||||
entry->key.secondary.i = toint(get_uint32(src));
|
||||
break;
|
||||
@ -558,7 +549,7 @@ bool conf_deserialise(Conf *conf, BinarySource *src)
|
||||
break;
|
||||
}
|
||||
|
||||
switch (valuetypes[entry->key.primary]) {
|
||||
switch (conf_key_info[entry->key.primary].value_type) {
|
||||
case CONF_TYPE_BOOL:
|
||||
entry->value.u.boolval = get_bool(src);
|
||||
break;
|
||||
|
9
utils/conf_data.c
Normal file
9
utils/conf_data.c
Normal file
@ -0,0 +1,9 @@
|
||||
#include "putty.h"
|
||||
|
||||
#define CONF_OPTION(id, ...) { __VA_ARGS__ },
|
||||
#define VALUE_TYPE(x) .value_type = CONF_TYPE_ ## x
|
||||
#define SUBKEY_TYPE(x) .subkey_type = CONF_TYPE_ ## x
|
||||
|
||||
const ConfKeyInfo conf_key_info[] = {
|
||||
#include "conf.h"
|
||||
};
|
Loading…
Reference in New Issue
Block a user