~ubuntu-branches/debian/squeeze/putty/squeeze

« back to all changes in this revision

Viewing changes to putty.h

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2008-05-28 09:28:32 UTC
  • mfrom: (4.1.4 hardy)
  • Revision ID: james.westby@ubuntu.com-20080528092832-88epkb3d4s1zsw61
Tags: 0.60-3
* Move putty to Applications/Network/Communication menu sub-section.
* Use dh_desktop.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
#define LATTR_TOP    0x00000002UL
71
71
#define LATTR_BOT    0x00000003UL
72
72
#define LATTR_MODE   0x00000003UL
73
 
#define LATTR_WRAPPED 0x00000010UL
74
 
#define LATTR_WRAPPED2 0x00000020UL
 
73
#define LATTR_WRAPPED 0x00000010UL     /* this line wraps to next */
 
74
#define LATTR_WRAPPED2 0x00000020UL    /* with WRAPPED: CJK wide character
 
75
                                          wrapped to next line, so last
 
76
                                          single-width cell is empty */
75
77
 
76
78
#define ATTR_INVALID 0x03FFFFU
77
79
 
161
163
#define LGTYP_ASCII 1                  /* logmode: pure ascii */
162
164
#define LGTYP_DEBUG 2                  /* logmode: all chars of traffic */
163
165
#define LGTYP_PACKETS 3                /* logmode: SSH data packets */
 
166
#define LGTYP_SSHRAW 4                 /* logmode: SSH raw data */
164
167
 
165
168
typedef enum {
166
169
    /* Actual special commands. Originally Telnet, but some codes have
261
264
    CIPHER_BLOWFISH,
262
265
    CIPHER_AES,                        /* (SSH-2 only) */
263
266
    CIPHER_DES,
 
267
    CIPHER_ARCFOUR,
264
268
    CIPHER_MAX                         /* no. ciphers (inc warn) */
265
269
};
266
270
 
294
298
};
295
299
 
296
300
enum {
 
301
    /* Actions on remote window title query */
 
302
    TITLE_NONE, TITLE_EMPTY, TITLE_REAL
 
303
};
 
304
 
 
305
enum {
297
306
    /* Protocol back ends. (cfg.protocol) */
298
 
    PROT_RAW, PROT_TELNET, PROT_RLOGIN, PROT_SSH
 
307
    PROT_RAW, PROT_TELNET, PROT_RLOGIN, PROT_SSH,
 
308
    /* PROT_SERIAL is supported on a subset of platforms, but it doesn't
 
309
     * hurt to define it globally. */
 
310
    PROT_SERIAL
299
311
};
300
312
 
301
313
enum {
324
336
};
325
337
 
326
338
enum {
 
339
    FQ_DEFAULT, FQ_ANTIALIASED, FQ_NONANTIALIASED, FQ_CLEARTYPE
 
340
};
 
341
 
 
342
enum {
 
343
    SER_PAR_NONE, SER_PAR_ODD, SER_PAR_EVEN, SER_PAR_MARK, SER_PAR_SPACE
 
344
};
 
345
 
 
346
enum {
 
347
    SER_FLOW_NONE, SER_FLOW_XONXOFF, SER_FLOW_RTSCTS, SER_FLOW_DSRDTR
 
348
};
 
349
 
 
350
extern const char *const ttymodes[];
 
351
 
 
352
enum {
327
353
    /*
328
354
     * Network address types. Used for specifying choice of IPv4/v6
329
355
     * in config; also used in proxy.c to indicate whether a given
348
374
    void (*size) (void *handle, int width, int height);
349
375
    void (*special) (void *handle, Telnet_Special code);
350
376
    const struct telnet_special *(*get_specials) (void *handle);
351
 
    Socket(*socket) (void *handle);
 
377
    int (*connected) (void *handle);
352
378
    int (*exitcode) (void *handle);
 
379
    /* If back->sendok() returns FALSE, data sent to it from the frontend
 
380
     * may be lost. */
353
381
    int (*sendok) (void *handle);
354
382
    int (*ldisc) (void *handle, int);
355
383
    void (*provide_ldisc) (void *handle, void *ldisc);
412
440
    char proxy_telnet_command[512];
413
441
    /* SSH options */
414
442
    char remote_cmd[512];
415
 
    char remote_cmd2[512];             /* fallback if the first fails
416
 
                                        * (used internally for scp) */
417
443
    char *remote_cmd_ptr;              /* might point to a larger command
418
444
                                        * but never for loading/saving */
419
445
    char *remote_cmd_ptr2;             /* might point to a larger command
423
449
    int ssh_kexlist[KEX_MAX];
424
450
    int ssh_rekey_time;                /* in minutes */
425
451
    char ssh_rekey_data[16];
 
452
    int tryagent;
426
453
    int agentfwd;
427
454
    int change_username;               /* allow username switching in SSH-2 */
428
455
    int ssh_cipherlist[CIPHER_MAX];
429
456
    Filename keyfile;
430
457
    int sshprot;                       /* use v1 or v2 when both available */
431
458
    int ssh2_des_cbc;                  /* "des-cbc" unrecommended SSH-2 cipher */
 
459
    int ssh_no_userauth;               /* bypass "ssh-userauth" (SSH-2 only) */
432
460
    int try_tis_auth;
433
461
    int try_ki_auth;
434
462
    int ssh_subsys;                    /* run a subsystem rather than a command */
435
 
    int ssh_subsys2;                   /* fallback to go with remote_cmd2 */
 
463
    int ssh_subsys2;                   /* fallback to go with remote_cmd_ptr2 */
436
464
    int ssh_no_shell;                  /* avoid running a shell */
 
465
    char ssh_nc_host[512];             /* host to connect to in `nc' mode */
 
466
    int ssh_nc_port;                   /* port to connect to in `nc' mode */
437
467
    /* Telnet options */
438
468
    char termtype[32];
439
469
    char termspeed[32];
 
470
    char ttymodes[768];                /* MODE\tVvalue\0MODE\tA\0\0 */
440
471
    char environmt[1024];              /* VAR\tvalue\0VAR\tvalue\0\0 */
441
472
    char username[100];
442
473
    char localusername[100];
443
474
    int rfc_environ;
444
475
    int passive_telnet;
 
476
    /* Serial port options */
 
477
    char serline[256];
 
478
    int serspeed;
 
479
    int serdatabits, serstopbits;
 
480
    int serparity;
 
481
    int serflow;
445
482
    /* Keyboard options */
446
483
    int bksp_is_delete;
447
484
    int rxvt_homeend;
454
491
    int no_remote_wintitle;            /* disable remote retitling */
455
492
    int no_dbackspace;                 /* disable destructive backspace */
456
493
    int no_remote_charset;             /* disable remote charset config */
457
 
    int no_remote_qtitle;              /* disable remote win title query */
 
494
    int remote_qtitle_action;          /* remote win title query action */
458
495
    int app_cursor;
459
496
    int app_keypad;
460
497
    int nethack_keypad;
495
532
    int win_name_always;
496
533
    int width, height;
497
534
    FontSpec font;
 
535
    int font_quality;
498
536
    Filename logfilename;
499
537
    int logtype;
500
538
    int logxfovr;
605
643
struct RSAKey;                         /* be a little careful of scope */
606
644
 
607
645
/*
608
 
 * Exports from window.c.
 
646
 * Mechanism for getting text strings such as usernames and passwords
 
647
 * from the front-end.
 
648
 * The fields are mostly modelled after SSH's keyboard-interactive auth.
 
649
 * FIXME We should probably mandate a character set/encoding (probably UTF-8).
 
650
 *
 
651
 * Since many of the pieces of text involved may be chosen by the server,
 
652
 * the caller must take care to ensure that the server can't spoof locally-
 
653
 * generated prompts such as key passphrase prompts. Some ground rules:
 
654
 *  - If the front-end needs to truncate a string, it should lop off the
 
655
 *    end.
 
656
 *  - The front-end should filter out any dangerous characters and
 
657
 *    generally not trust the strings. (But \n is required to behave
 
658
 *    vaguely sensibly, at least in `instruction', and ideally in
 
659
 *    `prompt[]' too.)
 
660
 */
 
661
typedef struct {
 
662
    char *prompt;
 
663
    int echo;
 
664
    char *result;       /* allocated/freed by caller */
 
665
    size_t result_len;
 
666
} prompt_t;
 
667
typedef struct {
 
668
    /*
 
669
     * Indicates whether the information entered is to be used locally
 
670
     * (for instance a key passphrase prompt), or is destined for the wire.
 
671
     * This is a hint only; the front-end is at liberty not to use this
 
672
     * information (so the caller should ensure that the supplied text is
 
673
     * sufficient).
 
674
     */
 
675
    int to_server;
 
676
    char *name;         /* Short description, perhaps for dialog box title */
 
677
    int name_reqd;      /* Display of `name' required or optional? */
 
678
    char *instruction;  /* Long description, maybe with embedded newlines */
 
679
    int instr_reqd;     /* Display of `instruction' required or optional? */
 
680
    size_t n_prompts;
 
681
    prompt_t **prompts;
 
682
    void *frontend;
 
683
    void *data;         /* slot for housekeeping data, managed by
 
684
                         * get_userpass_input(); initially NULL */
 
685
} prompts_t;
 
686
prompts_t *new_prompts(void *frontend);
 
687
void add_prompt(prompts_t *p, char *promptstr, int echo, size_t len);
 
688
/* Burn the evidence. (Assumes _all_ strings want free()ing.) */
 
689
void free_prompts(prompts_t *p);
 
690
 
 
691
/*
 
692
 * Exports from the front end.
609
693
 */
610
694
void request_resize(void *frontend, int, int);
611
695
void do_text(Context, int, int, wchar_t *, int, unsigned long, int);
622
706
void palette_set(void *frontend, int, int, int, int);
623
707
void palette_reset(void *frontend);
624
708
void write_aclip(void *frontend, char *, int, int);
625
 
void write_clip(void *frontend, wchar_t *, int, int);
 
709
void write_clip(void *frontend, wchar_t *, int *, int, int);
626
710
void get_clip(void *frontend, wchar_t **, int *);
627
711
void optimised_move(void *frontend, int, int, int);
628
712
void set_raw_mouse_mode(void *frontend, int);
633
717
#pragma noreturn(fatalbox)
634
718
#pragma noreturn(modalfatalbox)
635
719
#endif
636
 
void beep(void *frontend, int);
 
720
void do_beep(void *frontend, int);
637
721
void begin_session(void *frontend);
638
722
void sys_cursor(void *frontend, int x, int y);
639
723
void request_paste(void *frontend);
645
729
 * shutdown. */
646
730
void update_specials_menu(void *frontend);
647
731
int from_backend(void *frontend, int is_stderr, const char *data, int len);
 
732
int from_backend_untrusted(void *frontend, const char *data, int len);
648
733
void notify_remote_exit(void *frontend);
 
734
/* Get a sensible value for a tty mode. NULL return = don't set.
 
735
 * Otherwise, returned value should be freed by caller. */
 
736
char *get_ttymode(void *frontend, const char *mode);
 
737
/*
 
738
 * >0 = `got all results, carry on'
 
739
 * 0  = `user cancelled' (FIXME distinguish "give up entirely" and "next auth"?)
 
740
 * <0 = `please call back later with more in/inlen'
 
741
 */
 
742
int get_userpass_input(prompts_t *p, unsigned char *in, int inlen);
649
743
#define OPTIMISE_IS_SCROLL 1
650
744
 
651
745
void set_iconic(void *frontend, int iconic);
683
777
/*
684
778
 * Exports from settings.c.
685
779
 */
686
 
char *save_settings(char *section, int do_host, Config * cfg);
687
 
void save_open_settings(void *sesskey, int do_host, Config *cfg);
688
 
void load_settings(char *section, int do_host, Config * cfg);
689
 
void load_open_settings(void *sesskey, int do_host, Config *cfg);
 
780
char *save_settings(char *section, Config * cfg);
 
781
void save_open_settings(void *sesskey, Config *cfg);
 
782
void load_settings(char *section, Config * cfg);
 
783
void load_open_settings(void *sesskey, Config *cfg);
690
784
void get_sesslist(struct sesslist *, int allocate);
691
785
void do_defaults(char *, Config *);
692
786
void registry_cleanup(void);
716
810
void term_size(Terminal *, int, int, int);
717
811
void term_paint(Terminal *, Context, int, int, int, int, int);
718
812
void term_scroll(Terminal *, int, int);
719
 
void term_pwron(Terminal *);
 
813
void term_pwron(Terminal *, int);
720
814
void term_clrsb(Terminal *);
721
815
void term_mouse(Terminal *, Mouse_Button, Mouse_Button, Mouse_Action,
722
816
                int,int,int,int,int);
735
829
void term_reconfig(Terminal *, Config *);
736
830
void term_seen_key_event(Terminal *); 
737
831
int term_data(Terminal *, int is_stderr, const char *data, int len);
 
832
int term_data_untrusted(Terminal *, const char *data, int len);
738
833
void term_provide_resize_fn(Terminal *term,
739
834
                            void (*resize_fn)(void *, int, int),
740
835
                            void *resize_ctx);
741
836
void term_provide_logctx(Terminal *term, void *logctx);
742
837
void term_set_focus(Terminal *term, int has_focus);
 
838
char *term_get_ttymode(Terminal *term, const char *mode);
 
839
int term_get_userpass_input(Terminal *term, prompts_t *p,
 
840
                            unsigned char *in, int inlen);
743
841
 
744
842
/*
745
843
 * Exports from logging.c.
789
887
extern Backend telnet_backend;
790
888
 
791
889
/*
792
 
 * Exports from ssh.c. (NB the getline variables have to be GLOBAL
793
 
 * so that PuTTYtel will still compile - otherwise it would depend
794
 
 * on ssh.c.)
 
890
 * Exports from ssh.c.
795
891
 */
796
 
 
797
 
GLOBAL int (*ssh_get_line) (const char *prompt, char *str, int maxlen,
798
 
                            int is_pw);
799
 
GLOBAL int ssh_getline_pw_only;
800
892
extern Backend ssh_backend;
801
893
 
802
894
/*
839
931
 */
840
932
 
841
933
#include "misc.h"
 
934
int cfg_launchable(const Config *cfg);
 
935
char const *cfg_dest(const Config *cfg);
 
936
 
 
937
/*
 
938
 * Exports from sercfg.c.
 
939
 */
 
940
void ser_setup_config_box(struct controlbox *b, int midsession,
 
941
                          int parity_mask, int flow_mask);
842
942
 
843
943
/*
844
944
 * Exports from version.c.
941
1041
              void (*callback)(void *ctx, int result), void *ctx);
942
1042
 
943
1043
/*
944
 
 * Exports from console.c (that aren't equivalents to things in
945
 
 * windlg.c).
 
1044
 * Exports from console frontends (wincons.c, uxcons.c)
 
1045
 * that aren't equivalents to things in windlg.c et al.
946
1046
 */
947
1047
extern int console_batch_mode;
948
 
int console_get_line(const char *prompt, char *str, int maxlen, int is_pw);
 
1048
int console_get_userpass_input(prompts_t *p, unsigned char *in, int inlen);
949
1049
void console_provide_logctx(void *logctx);
950
1050
int is_interactive(void);
951
1051
 
969
1069
int cmdline_process_param(char *, char *, int, Config *);
970
1070
void cmdline_run_saved(Config *);
971
1071
void cmdline_cleanup(void);
972
 
extern char *cmdline_password;
 
1072
int cmdline_get_passwd_input(prompts_t *p, unsigned char *in, int inlen);
973
1073
#define TOOLTYPE_FILETRANSFER 1
974
1074
#define TOOLTYPE_NONNETWORK 2
975
1075
extern int cmdline_tooltype;
980
1080
 * Exports from config.c.
981
1081
 */
982
1082
struct controlbox;
983
 
void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
984
 
                      int midsession, int protocol, int protcfginfo);
 
1083
void setup_config_box(struct controlbox *b, int midsession,
 
1084
                      int protocol, int protcfginfo);
985
1085
 
986
1086
/*
987
1087
 * Exports from minibidi.c.
992
1092
} bidi_char;
993
1093
int do_bidi(bidi_char *line, int count);
994
1094
int do_shape(bidi_char *line, bidi_char *to, int count);
 
1095
int is_rtl(int c);
995
1096
 
996
1097
/*
997
1098
 * X11 auth mechanisms we know about.