Scrollbar was failing to update when no scrollback-reset event had happened
[u/mdw/putty] / storage.h
CommitLineData
d5859615 1/*
2 * storage.h: interface defining functions for storage and recovery
3 * of PuTTY's persistent data.
4 */
5
6#ifndef PUTTY_STORAGE_H
7#define PUTTY_STORAGE_H
8
9/* ----------------------------------------------------------------------
10 * Functions to save and restore PuTTY sessions. Note that this is
11 * only the low-level code to do the reading and writing. The
12 * higher-level code that translates a Config structure into a set
13 * of (key,value) pairs is elsewhere, since it doesn't (mostly)
14 * change between platforms.
15 */
16
17/*
18 * Write a saved session. The caller is expected to call
19 * open_setting_w() to get a `void *' handle, then pass that to a
20 * number of calls to write_setting_s() and write_setting_i(), and
21 * then close it using close_settings_w(). At the end of this call
22 * sequence the settings should have been written to the PuTTY
23 * persistent storage area.
24 */
25void *open_settings_w(char *sessionname);
26void write_setting_s(void *handle, char *key, char *value);
27void write_setting_i(void *handle, char *key, int value);
d1622aed 28void close_settings_w(void *handle);
d5859615 29
30/*
31 * Read a saved session. The caller is expected to call
32 * open_setting_r() to get a `void *' handle, then pass that to a
33 * number of calls to read_setting_s() and read_setting_i(), and
34 * then close it using close_settings_r().
35 *
36 * read_setting_s() writes into the provided buffer and returns a
37 * pointer to the same buffer.
38 *
39 * If a particular string setting is not present in the session,
40 * read_setting_s() can return NULL, in which case the caller
41 * should invent a sensible default. If an integer setting is not
42 * present, read_setting_i() returns its provided default.
43 */
44void *open_settings_r(char *sessionname);
45char *read_setting_s(void *handle, char *key, char *buffer, int buflen);
46int read_setting_i(void *handle, char *key, int defvalue);
d1622aed 47void close_settings_r(void *handle);
48
49/*
50 * Delete a whole saved session.
51 */
52void del_settings(char *sessionname);
53
54/*
55 * Enumerate all saved sessions.
56 */
57void *enum_settings_start(void);
58char *enum_settings_next(void *handle, char *buffer, int buflen);
59void enum_settings_finish(void *handle);
d5859615 60
61/* ----------------------------------------------------------------------
62 * Functions to access PuTTY's host key database.
63 */
64
65/*
66 * See if a host key matches the database entry. Return values can
67 * be 0 (entry matches database), 1 (entry is absent in database),
68 * or 2 (entry exists in database and is different).
69 */
d4857987 70int verify_host_key(char *hostname, int port, char *keytype, char *key);
d5859615 71
72/*
73 * Write a host key into the database, overwriting any previous
74 * entry that might have been there.
75 */
d4857987 76void store_host_key(char *hostname, int port, char *keytype, char *key);
d5859615 77
78/* ----------------------------------------------------------------------
79 * Functions to access PuTTY's random number seed file.
80 */
81
32874aea 82typedef void (*noise_consumer_t) (void *data, int len);
d5859615 83
84/*
85 * Read PuTTY's random seed file and pass its contents to a noise
86 * consumer function.
87 */
88void read_random_seed(noise_consumer_t consumer);
89
90/*
91 * Write PuTTY's random seed file from a given chunk of noise.
92 */
d1622aed 93void write_random_seed(void *data, int len);
d5859615 94
95/* ----------------------------------------------------------------------
96 * Cleanup function: remove all of PuTTY's persistent state.
97 */
98void cleanup_all(void);
99
100#endif