1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 19:42:48 -05:00

Reorganise the stubs collection.

I made a specific subdirectory 'stubs' to keep all the link-time stub
modules in, like notiming.c. And I put _one_ run-time stub in it,
namely nullplug.c. But the rest of the runtime stubs went into utils.

I think it's better to keep all the stubs together, so I've moved all
the null*.c in utils into stubs (with the exception of nullstrcmp.c,
which means the 'null' in a different sense). Also, fiddled with the
naming to be a bit more consistent, and stated in the new CMakeLists
the naming policy that distinguishes no-*.c from null-*.c.
This commit is contained in:
Simon Tatham
2022-08-23 18:57:58 +01:00
parent d862d8d60d
commit 6a1b713e13
17 changed files with 52 additions and 26 deletions

View File

@ -41,11 +41,6 @@ add_sources_from_current_dir(utils
marshal.c
memory.c
memxor.c
null_lp.c
nullcipher.c
nullkey.c
nullmac.c
nullseat.c
nullstrcmp.c
out_of_memory.c
parse_blocksize.c

View File

@ -1,8 +0,0 @@
/*
* Stub methods usable by LogPolicy implementations.
*/
#include "putty.h"
bool null_lp_verbose_no(LogPolicy *lp) { return false; }
bool null_lp_verbose_yes(LogPolicy *lp) { return true; }

View File

@ -1,11 +0,0 @@
/*
* Implementation of shared trivial routines that ssh_cipher
* implementations might use.
*/
#include "ssh.h"
void nullcipher_next_message(ssh_cipher *cipher)
{
/* Most ciphers don't do anything at all with this */
}

View File

@ -1,22 +0,0 @@
#include "misc.h"
#include "ssh.h"
unsigned nullkey_supported_flags(const ssh_keyalg *self)
{
return 0;
}
const char *nullkey_alternate_ssh_id(const ssh_keyalg *self, unsigned flags)
{
/* There are no alternate ids */
return self->ssh_id;
}
ssh_key *nullkey_base_key(ssh_key *key)
{
/* When a key is not certified, it is its own base */
return key;
}
bool nullkey_variable_size_no(const ssh_keyalg *self) { return false; }
bool nullkey_variable_size_yes(const ssh_keyalg *self) { return true; }

View File

@ -1,11 +0,0 @@
/*
* Implementation of shared trivial routines that ssh2_mac
* implementations might use.
*/
#include "ssh.h"
void nullmac_next_message(ssh2_mac *m)
{
/* Most MACs don't do anything at all with this */
}

View File

@ -1,65 +0,0 @@
/*
* Stub methods usable by Seat implementations.
*/
#include "putty.h"
size_t nullseat_output(
Seat *seat, SeatOutputType type, const void *data, size_t len) {return 0;}
bool nullseat_eof(Seat *seat) { return true; }
void nullseat_sent(Seat *seat, size_t bufsize) {}
size_t nullseat_banner(Seat *seat, const void *data, size_t len) {return 0;}
size_t nullseat_banner_to_stderr(Seat *seat, const void *data, size_t len)
{ return seat_output(seat, SEAT_OUTPUT_STDERR, data, len); }
SeatPromptResult nullseat_get_userpass_input(Seat *seat, prompts_t *p)
{ return SPR_SW_ABORT("this seat can't handle interactive prompts"); }
void nullseat_notify_session_started(Seat *seat) {}
void nullseat_notify_remote_exit(Seat *seat) {}
void nullseat_notify_remote_disconnect(Seat *seat) {}
void nullseat_connection_fatal(Seat *seat, const char *message) {}
void nullseat_update_specials_menu(Seat *seat) {}
char *nullseat_get_ttymode(Seat *seat, const char *mode) { return NULL; }
void nullseat_set_busy_status(Seat *seat, BusyStatus status) {}
SeatPromptResult nullseat_confirm_ssh_host_key(
Seat *seat, const char *host, int port, const char *keytype,
char *keystr, SeatDialogText *text, HelpCtx helpctx,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{ return SPR_SW_ABORT("this seat can't handle interactive prompts"); }
SeatPromptResult nullseat_confirm_weak_crypto_primitive(
Seat *seat, const char *algtype, const char *algname,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{ return SPR_SW_ABORT("this seat can't handle interactive prompts"); }
SeatPromptResult nullseat_confirm_weak_cached_hostkey(
Seat *seat, const char *algname, const char *betteralgs,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{ return SPR_SW_ABORT("this seat can't handle interactive prompts"); }
bool nullseat_is_never_utf8(Seat *seat) { return false; }
bool nullseat_is_always_utf8(Seat *seat) { return true; }
void nullseat_echoedit_update(Seat *seat, bool echoing, bool editing) {}
const char *nullseat_get_x_display(Seat *seat) { return NULL; }
bool nullseat_get_windowid(Seat *seat, long *id_out) { return false; }
bool nullseat_get_window_pixel_size(
Seat *seat, int *width, int *height) { return false; }
StripCtrlChars *nullseat_stripctrl_new(
Seat *seat, BinarySink *bs_out, SeatInteractionContext sic) {return NULL;}
void nullseat_set_trust_status(Seat *seat, bool trusted) {}
bool nullseat_can_set_trust_status_yes(Seat *seat) { return true; }
bool nullseat_can_set_trust_status_no(Seat *seat) { return false; }
bool nullseat_has_mixed_input_stream_yes(Seat *seat) { return true; }
bool nullseat_has_mixed_input_stream_no(Seat *seat) { return false; }
bool nullseat_verbose_no(Seat *seat) { return false; }
bool nullseat_verbose_yes(Seat *seat) { return true; }
bool nullseat_interactive_no(Seat *seat) { return false; }
bool nullseat_interactive_yes(Seat *seat) { return true; }
bool nullseat_get_cursor_position(Seat *seat, int *x, int *y) { return false; }
const SeatDialogPromptDescriptions *nullseat_prompt_descriptions(Seat *seat)
{
static const SeatDialogPromptDescriptions descs = {
.hk_accept_action = "",
.hk_connect_once_action = "",
.hk_cancel_action = "",
.hk_cancel_action_Participle = "",
};
return &descs;
}