📄 putty.h
字号:
void *log_init(void *frontend, Config *cfg);
void log_free(void *logctx);
void log_reconfig(void *logctx, Config *cfg);
void logfopen(void *logctx);
void logfclose(void *logctx);
void logtraffic(void *logctx, unsigned char c, int logmode);
void logflush(void *logctx);
void log_eventlog(void *logctx, const char *string);
enum { PKT_INCOMING, PKT_OUTGOING };
enum { PKTLOG_EMIT, PKTLOG_BLANK, PKTLOG_OMIT };
struct logblank_t {
int offset;
int len;
int type;
};
void log_packet(void *logctx, int direction, int type,
char *texttype, void *data, int len,
int n_blanks, const struct logblank_t *blanks);
/*
* Exports from testback.c
*/
extern Backend null_backend;
extern Backend loop_backend;
/*
* Exports from raw.c.
*/
extern Backend raw_backend;
/*
* Exports from rlogin.c.
*/
extern Backend rlogin_backend;
/*
* Exports from telnet.c.
*/
extern Backend telnet_backend;
/*
* Exports from ssh.c. (NB the getline variables have to be GLOBAL
* so that PuTTYtel will still compile - otherwise it would depend
* on ssh.c.)
*/
GLOBAL int (*ssh_get_line) (const char *prompt, char *str, int maxlen,
int is_pw, int nType);
GLOBAL int ssh_getline_pw_only;
extern Backend ssh_backend;
/*
* Exports from ldisc.c.
*/
void *ldisc_create(Config *, Terminal *, Backend *, void *, void *);
void ldisc_free(void *);
void ldisc_send(void *handle, char *buf, int len, int interactive);
/*
* Exports from ldiscucs.c.
*/
void lpage_send(void *, int codepage, char *buf, int len, int interactive);
void luni_send(void *, wchar_t * widebuf, int len, int interactive);
/*
* Exports from sshrand.c.
*/
void random_add_noise(void *noise, int length);
int random_byte(void);
void random_get_savedata(void **data, int *len);
extern int random_active;
/* The random number subsystem is activated if at least one other entity
* within the program expresses an interest in it. So each SSH session
* calls random_ref on startup and random_unref on shutdown. */
void random_ref(void);
void random_unref(void);
/*
* Exports from pinger.c.
*/
typedef struct pinger_tag *Pinger;
Pinger pinger_new(Config *cfg, Backend *back, void *backhandle);
void pinger_reconfig(Pinger, Config *oldcfg, Config *newcfg);
void pinger_free(Pinger);
/*
* Exports from misc.c.
*/
#include "misc.h"
/*
* Exports from version.c.
*/
extern char ver[];
/*
* Exports from unicode.c.
*/
#ifndef CP_UTF8
#define CP_UTF8 65001
#endif
/* void init_ucs(void); -- this is now in platform-specific headers */
int is_dbcs_leadbyte(int codepage, char byte);
int mb_to_wc(int codepage, int flags, char *mbstr, int mblen,
wchar_t *wcstr, int wclen);
int wc_to_mb(int codepage, int flags, wchar_t *wcstr, int wclen,
char *mbstr, int mblen, char *defchr, int *defused,
struct unicode_data *ucsdata);
wchar_t xlat_uskbd2cyrllic(int ch);
int check_compose(int first, int second);
int decode_codepage(char *cp_name);
const char *cp_enumerate (int index);
const char *cp_name(int codepage);
void get_unitab(int codepage, wchar_t * unitab, int ftype);
/*
* Exports from wcwidth.c
*/
int wcwidth(wchar_t ucs);
int wcswidth(const wchar_t *pwcs, size_t n);
/*
* Exports from mscrypto.c
*/
#ifdef MSCRYPTOAPI
int crypto_startup();
void crypto_wrapup();
#endif
/*
* Exports from pageantc.c.
*
* agent_query returns 1 for here's-a-response, and 0 for query-in-
* progress. In the latter case there will be a call to `callback'
* at some future point, passing callback_ctx as the first
* parameter and the actual reply data as the second and third.
*
* The response may be a NULL pointer (in either of the synchronous
* or asynchronous cases), which indicates failure to receive a
* response.
*/
int agent_query(void *in, int inlen, void **out, int *outlen,
void (*callback)(void *, void *, int), void *callback_ctx);
int agent_exists(void);
/*
* Exports from wildcard.c
*/
const char *wc_error(int value);
int wc_match(const char *wildcard, const char *target);
int wc_unescape(char *output, const char *wildcard);
/*
* Exports from windlg.c
*/
void logevent(void *frontend, const char *);
/*
* verify_ssh_host_key() can return one of three values:
*
* - +1 means `key was OK' (either already known or the user just
* approved it) `so continue with the connection'
*
* - 0 means `key was not OK, abandon the connection'
*
* - -1 means `I've initiated enquiries, please wait to be called
* back via the provided function with a result that's either 0
* or +1'.
*/
int verify_ssh_host_key(void *frontend, char *host, int port, char *keytype,
char *keystr, char *fingerprint,
void (*callback)(void *ctx, int result), void *ctx);
/*
* askalg has the same set of return values as verify_ssh_host_key.
*/
int askalg(void *frontend, const char *algtype, const char *algname,
void (*callback)(void *ctx, int result), void *ctx);
/*
* askappend can return four values:
*
* - 2 means overwrite the log file
* - 1 means append to the log file
* - 0 means cancel logging for this session
* - -1 means please wait.
*/
int askappend(void *frontend, Filename filename,
void (*callback)(void *ctx, int result), void *ctx);
/*
* Exports from console.c (that aren't equivalents to things in
* windlg.c).
*/
extern int console_batch_mode;
int console_get_line(const char *prompt, char *str, int maxlen, int is_pw, int nType);
/* Not used in FileZilla
void console_provide_logctx(void *logctx);
*/
int is_interactive(void);
/*
* Exports from printing.c.
*/
/* Not used in FileZilla
typedef struct printer_enum_tag printer_enum;
typedef struct printer_job_tag printer_job;
printer_enum *printer_start_enum(int *nprinters);
char *printer_get_name(printer_enum *, int);
void printer_finish_enum(printer_enum *);
printer_job *printer_start_job(char *printer);
void printer_job_data(printer_job *, void *, int);
void printer_finish_job(printer_job *);
*/
/*
* Exports from cmdline.c (and also cmdline_error(), which is
* defined differently in various places and required _by_
* cmdline.c).
*/
int cmdline_process_param(char *, char *, int, Config *);
void cmdline_run_saved(Config *);
void cmdline_cleanup(void);
extern char *cmdline_password;
#define TOOLTYPE_FILETRANSFER 1
#define TOOLTYPE_NONNETWORK 2
extern int cmdline_tooltype;
void cmdline_error(char *, ...);
/*
* Exports from config.c.
*/
struct controlbox;
void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
int midsession, int protocol, int protcfginfo);
/*
* Exports from minibidi.c.
*/
typedef struct bidi_char {
wchar_t origwc, wc;
unsigned short index;
} bidi_char;
int do_bidi(bidi_char *line, int count);
int do_shape(bidi_char *line, bidi_char *to, int count);
/*
* X11 auth mechanisms we know about.
*/
enum {
X11_NO_AUTH,
X11_MIT, /* MIT-MAGIC-COOKIE-1 */
X11_XDM, /* XDM-AUTHORIZATION-1 */
X11_NAUTHS
};
extern const char *const x11_authnames[]; /* declared in x11fwd.c */
/*
* Miscellaneous exports from the platform-specific code.
*/
Filename filename_from_str(const char *string);
const char *filename_to_str(const Filename *fn);
int filename_equal(Filename f1, Filename f2);
int filename_is_null(Filename fn);
char *get_username(void); /* return value needs freeing */
char *get_random_data(int bytes); /* used in cmdgen.c */
/*
* Exports and imports from timing.c.
*
* schedule_timer() asks the front end to schedule a callback to a
* timer function in a given number of ticks. The returned value is
* the time (in ticks since an arbitrary offset) at which the
* callback can be expected. This value will also be passed as the
* `now' parameter to the callback function. Hence, you can (for
* example) schedule an event at a particular time by calling
* schedule_timer() and storing the return value in your context
* structure as the time when that event is due. The first time a
* callback function gives you that value or more as `now', you do
* the thing.
*
* expire_timer_context() drops all current timers associated with
* a given value of ctx (for when you're about to free ctx).
*
* run_timers() is called from the front end when it has reason to
* think some timers have reached their moment, or when it simply
* needs to know how long to wait next. We pass it the time we
* think it is. It returns TRUE and places the time when the next
* timer needs to go off in `next', or alternatively it returns
* FALSE if there are no timers at all pending.
*
* timer_change_notify() must be supplied by the front end; it
* notifies the front end that a new timer has been added to the
* list which is sooner than any existing ones. It provides the
* time when that timer needs to go off.
*
* *** FRONT END IMPLEMENTORS NOTE:
*
* There's an important subtlety in the front-end implementation of
* the timer interface. When a front end is given a `next' value,
* either returned from run_timers() or via timer_change_notify(),
* it should ensure that it really passes _that value_ as the `now'
* parameter to its next run_timers call. It should _not_ simply
* call GETTICKCOUNT() to get the `now' parameter when invoking
* run_timers().
*
* The reason for this is that an OS's system clock might not agree
* exactly with the timing mechanisms it supplies to wait for a
* given interval. I'll illustrate this by the simple example of
* Unix Plink, which uses timeouts to select() in a way which for
* these purposes can simply be considered to be a wait() function.
* Suppose, for the sake of argument, that this wait() function
* tends to return early by 1%. Then a possible sequence of actions
* is:
*
* - run_timers() tells the front end that the next timer firing
* is 10000ms from now.
* - Front end calls wait(10000ms), but according to
* GETTICKCOUNT() it has only waited for 9900ms.
* - Front end calls run_timers() again, passing time T-100ms as
* `now'.
* - run_timers() does nothing, and says the next timer firing is
* still 100ms from now.
* - Front end calls wait(100ms), which only waits for 99ms.
* - Front end calls run_timers() yet again, passing time T-1ms.
* - run_timers() says there's still 1ms to wait.
* - Front end calls wait(1ms).
*
* If you're _lucky_ at this point, wait(1ms) will actually wait
* for 1ms and you'll only have woken the program up three times.
* If you're unlucky, wait(1ms) might do nothing at all due to
* being below some minimum threshold, and you might find your
* program spends the whole of the last millisecond tight-looping
* between wait() and run_timers().
*
* Instead, what you should do is to _save_ the precise `next'
* value provided by run_timers() or via timer_change_notify(), and
* use that precise value as the input to the next run_timers()
* call. So:
*
* - run_timers() tells the front end that the next timer firing
* is at time T, 10000ms from now.
* - Front end calls wait(10000ms).
* - Front end then immediately calls run_timers() and passes it
* time T, without stopping to check GETTICKCOUNT() at all.
*
* This guarantees that the program wakes up only as many times as
* there are actual timer actions to be taken, and that the timing
* mechanism will never send it into a tight loop.
*
* (It does also mean that the timer action in the above example
* will occur 100ms early, but this is not generally critical. And
* the hypothetical 1% error in wait() will be partially corrected
* for anyway when, _after_ run_timers() returns, you call
* GETTICKCOUNT() and compare the result with the returned `next'
* value to find out how long you have to make your next wait().)
*/
typedef void (*timer_fn_t)(void *ctx, long now);
long schedule_timer(int ticks, timer_fn_t fn, void *ctx);
void expire_timer_context(void *ctx);
int run_timers(long now, long *next);
void timer_change_notify(long next);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -