mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
Give BackendVtable separate id and displayname fields.
The previous 'name' field was awkwardly serving both purposes: it was a machine-readable identifier for the backend used in the saved session format, and it was also used in error messages when Plink wanted to complain that it didn't support a particular backend. Now there are two separate name fields for those purposes.
This commit is contained in:
parent
37f26089fa
commit
9482f33739
6
putty.h
6
putty.h
@ -512,7 +512,11 @@ struct BackendVtable {
|
|||||||
* connection-sharing upstream exists for a given configuration. */
|
* connection-sharing upstream exists for a given configuration. */
|
||||||
bool (*test_for_upstream)(const char *host, int port, Conf *conf);
|
bool (*test_for_upstream)(const char *host, int port, Conf *conf);
|
||||||
|
|
||||||
const char *name;
|
/* 'id' is a machine-readable name for the backend, used in
|
||||||
|
* saved-session storage. 'displayname' is a human-readable name
|
||||||
|
* for error messages. */
|
||||||
|
const char *id, *displayname;
|
||||||
|
|
||||||
int protocol;
|
int protocol;
|
||||||
int default_port;
|
int default_port;
|
||||||
};
|
};
|
||||||
|
2
raw.c
2
raw.c
@ -324,7 +324,7 @@ const struct BackendVtable raw_backend = {
|
|||||||
raw_unthrottle,
|
raw_unthrottle,
|
||||||
raw_cfg_info,
|
raw_cfg_info,
|
||||||
NULL /* test_for_upstream */,
|
NULL /* test_for_upstream */,
|
||||||
"raw",
|
"raw", "Raw",
|
||||||
PROT_RAW,
|
PROT_RAW,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
2
rlogin.c
2
rlogin.c
@ -422,7 +422,7 @@ const struct BackendVtable rlogin_backend = {
|
|||||||
rlogin_unthrottle,
|
rlogin_unthrottle,
|
||||||
rlogin_cfg_info,
|
rlogin_cfg_info,
|
||||||
NULL /* test_for_upstream */,
|
NULL /* test_for_upstream */,
|
||||||
"rlogin",
|
"rlogin", "Rlogin",
|
||||||
PROT_RLOGIN,
|
PROT_RLOGIN,
|
||||||
513
|
513
|
||||||
};
|
};
|
||||||
|
@ -82,7 +82,7 @@ const struct BackendVtable *backend_vt_from_name(const char *name)
|
|||||||
{
|
{
|
||||||
const struct BackendVtable *const *p;
|
const struct BackendVtable *const *p;
|
||||||
for (p = backends; *p != NULL; p++)
|
for (p = backends; *p != NULL; p++)
|
||||||
if (!strcmp((*p)->name, name))
|
if (!strcmp((*p)->id, name))
|
||||||
return *p;
|
return *p;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -556,7 +556,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
|
|||||||
const struct BackendVtable *vt =
|
const struct BackendVtable *vt =
|
||||||
backend_vt_from_proto(conf_get_int(conf, CONF_protocol));
|
backend_vt_from_proto(conf_get_int(conf, CONF_protocol));
|
||||||
if (vt)
|
if (vt)
|
||||||
p = vt->name;
|
p = vt->id;
|
||||||
}
|
}
|
||||||
write_setting_s(sesskey, "Protocol", p);
|
write_setting_s(sesskey, "Protocol", p);
|
||||||
write_setting_i(sesskey, "PortNumber", conf_get_int(conf, CONF_port));
|
write_setting_i(sesskey, "PortNumber", conf_get_int(conf, CONF_port));
|
||||||
|
2
ssh.c
2
ssh.c
@ -1190,7 +1190,7 @@ const struct BackendVtable ssh_backend = {
|
|||||||
ssh_unthrottle,
|
ssh_unthrottle,
|
||||||
ssh_cfg_info,
|
ssh_cfg_info,
|
||||||
ssh_test_for_upstream,
|
ssh_test_for_upstream,
|
||||||
"ssh",
|
"ssh", "SSH",
|
||||||
PROT_SSH,
|
PROT_SSH,
|
||||||
22
|
22
|
||||||
};
|
};
|
||||||
|
2
telnet.c
2
telnet.c
@ -1064,7 +1064,7 @@ const struct BackendVtable telnet_backend = {
|
|||||||
telnet_unthrottle,
|
telnet_unthrottle,
|
||||||
telnet_cfg_info,
|
telnet_cfg_info,
|
||||||
NULL /* test_for_upstream */,
|
NULL /* test_for_upstream */,
|
||||||
"telnet",
|
"telnet", "Telnet",
|
||||||
PROT_TELNET,
|
PROT_TELNET,
|
||||||
23
|
23
|
||||||
};
|
};
|
||||||
|
@ -57,14 +57,14 @@ const struct BackendVtable null_backend = {
|
|||||||
null_init, null_free, null_reconfig, null_send, null_sendbuffer, null_size,
|
null_init, null_free, null_reconfig, null_send, null_sendbuffer, null_size,
|
||||||
null_special, null_get_specials, null_connected, null_exitcode, null_sendok,
|
null_special, null_get_specials, null_connected, null_exitcode, null_sendok,
|
||||||
null_ldisc, null_provide_ldisc, null_unthrottle,
|
null_ldisc, null_provide_ldisc, null_unthrottle,
|
||||||
null_cfg_info, NULL /* test_for_upstream */, "null", -1, 0
|
null_cfg_info, NULL /* test_for_upstream */, "null", "null", -1, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct BackendVtable loop_backend = {
|
const struct BackendVtable loop_backend = {
|
||||||
loop_init, loop_free, null_reconfig, loop_send, null_sendbuffer, null_size,
|
loop_init, loop_free, null_reconfig, loop_send, null_sendbuffer, null_size,
|
||||||
null_special, null_get_specials, null_connected, null_exitcode, null_sendok,
|
null_special, null_get_specials, null_connected, null_exitcode, null_sendok,
|
||||||
null_ldisc, null_provide_ldisc, null_unthrottle,
|
null_ldisc, null_provide_ldisc, null_unthrottle,
|
||||||
null_cfg_info, NULL /* test_for_upstream */, "loop", -1, 0
|
null_cfg_info, NULL /* test_for_upstream */, "loop", "loop", -1, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
struct loop_state {
|
struct loop_state {
|
||||||
|
@ -891,8 +891,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (just_test_share_exists) {
|
if (just_test_share_exists) {
|
||||||
if (!backvt->test_for_upstream) {
|
if (!backvt->test_for_upstream) {
|
||||||
fprintf(stderr, "Connection sharing not supported for connection "
|
fprintf(stderr, "Connection sharing not supported for this "
|
||||||
"type '%s'\n", backvt->name);
|
"connection type (%s)'\n", backvt->displayname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (backvt->test_for_upstream(conf_get_str(conf, CONF_host),
|
if (backvt->test_for_upstream(conf_get_str(conf, CONF_host),
|
||||||
|
@ -1601,7 +1601,7 @@ const struct BackendVtable pty_backend = {
|
|||||||
pty_unthrottle,
|
pty_unthrottle,
|
||||||
pty_cfg_info,
|
pty_cfg_info,
|
||||||
NULL /* test_for_upstream */,
|
NULL /* test_for_upstream */,
|
||||||
"pty",
|
"pty", "pty",
|
||||||
-1,
|
-1,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
@ -576,7 +576,7 @@ const struct BackendVtable serial_backend = {
|
|||||||
serial_unthrottle,
|
serial_unthrottle,
|
||||||
serial_cfg_info,
|
serial_cfg_info,
|
||||||
NULL /* test_for_upstream */,
|
NULL /* test_for_upstream */,
|
||||||
"serial",
|
"serial", "Serial",
|
||||||
PROT_SERIAL,
|
PROT_SERIAL,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
@ -413,8 +413,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (just_test_share_exists) {
|
if (just_test_share_exists) {
|
||||||
if (!vt->test_for_upstream) {
|
if (!vt->test_for_upstream) {
|
||||||
fprintf(stderr, "Connection sharing not supported for connection "
|
fprintf(stderr, "Connection sharing not supported for this "
|
||||||
"type '%s'\n", vt->name);
|
"connection type (%s)'\n", vt->displayname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (vt->test_for_upstream(conf_get_str(conf, CONF_host),
|
if (vt->test_for_upstream(conf_get_str(conf, CONF_host),
|
||||||
|
@ -444,7 +444,7 @@ const struct BackendVtable serial_backend = {
|
|||||||
serial_unthrottle,
|
serial_unthrottle,
|
||||||
serial_cfg_info,
|
serial_cfg_info,
|
||||||
NULL /* test_for_upstream */,
|
NULL /* test_for_upstream */,
|
||||||
"serial",
|
"serial", "Serial",
|
||||||
PROT_SERIAL,
|
PROT_SERIAL,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user