null-seat.c 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Stub methods usable by Seat implementations.
  3. */
  4. #include "putty.h"
  5. size_t nullseat_output(
  6. Seat *seat, SeatOutputType type, const void *data, size_t len) {return 0;}
  7. bool nullseat_eof(Seat *seat) { return true; }
  8. void nullseat_sent(Seat *seat, size_t bufsize) {}
  9. size_t nullseat_banner(Seat *seat, const void *data, size_t len) {return 0;}
  10. size_t nullseat_banner_to_stderr(Seat *seat, const void *data, size_t len)
  11. { return seat_output(seat, SEAT_OUTPUT_STDERR, data, len); }
  12. SeatPromptResult nullseat_get_userpass_input(Seat *seat, prompts_t *p)
  13. { return SPR_SW_ABORT("this seat can't handle interactive prompts"); }
  14. void nullseat_notify_session_started(Seat *seat) {}
  15. void nullseat_notify_remote_exit(Seat *seat) {}
  16. void nullseat_notify_remote_disconnect(Seat *seat) {}
  17. void nullseat_connection_fatal(Seat *seat, const char *message) {}
  18. void nullseat_update_specials_menu(Seat *seat) {}
  19. char *nullseat_get_ttymode(Seat *seat, const char *mode) { return NULL; }
  20. void nullseat_set_busy_status(Seat *seat, BusyStatus status) {}
  21. SeatPromptResult nullseat_confirm_ssh_host_key(
  22. Seat *seat, const char *host, int port, const char *keytype,
  23. char *keystr, SeatDialogText *text, HelpCtx helpctx,
  24. void (*callback)(void *ctx, SeatPromptResult result), void *ctx,
  25. char **fingerprints, bool is_certificate, int ca_count, bool already_verified) // WINSCP
  26. { return SPR_SW_ABORT("this seat can't handle interactive prompts"); }
  27. SeatPromptResult nullseat_confirm_weak_crypto_primitive(
  28. Seat *seat, SeatDialogText *text,
  29. void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
  30. { return SPR_SW_ABORT("this seat can't handle interactive prompts"); }
  31. SeatPromptResult nullseat_confirm_weak_cached_hostkey(
  32. Seat *seat, SeatDialogText *text,
  33. void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
  34. { return SPR_SW_ABORT("this seat can't handle interactive prompts"); }
  35. bool nullseat_is_never_utf8(Seat *seat) { return false; }
  36. bool nullseat_is_always_utf8(Seat *seat) { return true; }
  37. void nullseat_echoedit_update(Seat *seat, bool echoing, bool editing) {}
  38. const char *nullseat_get_x_display(Seat *seat) { return NULL; }
  39. bool nullseat_get_windowid(Seat *seat, long *id_out) { return false; }
  40. bool nullseat_get_window_pixel_size(
  41. Seat *seat, int *width, int *height) { return false; }
  42. StripCtrlChars *nullseat_stripctrl_new(
  43. Seat *seat, BinarySink *bs_out, SeatInteractionContext sic) {return NULL;}
  44. void nullseat_set_trust_status(Seat *seat, bool trusted) {}
  45. bool nullseat_can_set_trust_status_yes(Seat *seat) { return true; }
  46. bool nullseat_can_set_trust_status_no(Seat *seat) { return false; }
  47. bool nullseat_has_mixed_input_stream_yes(Seat *seat) { return true; }
  48. bool nullseat_has_mixed_input_stream_no(Seat *seat) { return false; }
  49. bool nullseat_verbose_no(Seat *seat) { return false; }
  50. bool nullseat_verbose_yes(Seat *seat) { return true; }
  51. bool nullseat_interactive_no(Seat *seat) { return false; }
  52. bool nullseat_interactive_yes(Seat *seat) { return true; }
  53. bool nullseat_get_cursor_position(Seat *seat, int *x, int *y) { return false; }
  54. const SeatDialogPromptDescriptions *nullseat_prompt_descriptions(Seat *seat)
  55. {
  56. static const SeatDialogPromptDescriptions descs = {
  57. /*.hk_accept_action =*/ "",
  58. /*.hk_connect_once_action =*/ "",
  59. /*.hk_cancel_action =*/ "",
  60. /*.hk_cancel_action_Participle =*/ "",
  61. .weak_accept_action = "",
  62. .weak_cancel_action = "",
  63. };
  64. return &descs;
  65. }