Doc: Fix broken link
[TortoiseGit.git] / src / TortoisePlink / STORAGE.H
blobe7963ece32e34bd16c1d97e44d4291579fdab6b3
1 /*\r
2  * storage.h: interface defining functions for storage and recovery\r
3  * of PuTTY's persistent data.\r
4  */\r
5 \r
6 #ifndef PUTTY_STORAGE_H\r
7 #define PUTTY_STORAGE_H\r
8 \r
9 /* ----------------------------------------------------------------------\r
10  * Functions to save and restore PuTTY sessions. Note that this is\r
11  * only the low-level code to do the reading and writing. The\r
12  * higher-level code that translates an internal Conf structure into\r
13  * a set of (key,value) pairs in their external storage format is\r
14  * elsewhere, since it doesn't (mostly) change between platforms.\r
15  */\r
17 /*\r
18  * Write a saved session. The caller is expected to call\r
19  * open_setting_w() to get a `void *' handle, then pass that to a\r
20  * number of calls to write_setting_s() and write_setting_i(), and\r
21  * then close it using close_settings_w(). At the end of this call\r
22  * sequence the settings should have been written to the PuTTY\r
23  * persistent storage area.\r
24  *\r
25  * A given key will be written at most once while saving a session.\r
26  * Keys may be up to 255 characters long.  String values have no length\r
27  * limit.\r
28  * \r
29  * Any returned error message must be freed after use.\r
30  */\r
31 void *open_settings_w(const char *sessionname, char **errmsg);\r
32 void write_setting_s(void *handle, const char *key, const char *value);\r
33 void write_setting_i(void *handle, const char *key, int value);\r
34 void write_setting_filename(void *handle, const char *key, Filename *value);\r
35 void write_setting_fontspec(void *handle, const char *key, FontSpec *font);\r
36 void close_settings_w(void *handle);\r
38 /*\r
39  * Read a saved session. The caller is expected to call\r
40  * open_setting_r() to get a `void *' handle, then pass that to a\r
41  * number of calls to read_setting_s() and read_setting_i(), and\r
42  * then close it using close_settings_r().\r
43  * \r
44  * read_setting_s() returns a dynamically allocated string which the\r
45  * caller must free. read_setting_filename() and\r
46  * read_setting_fontspec() likewise return dynamically allocated\r
47  * structures.\r
48  * \r
49  * If a particular string setting is not present in the session,\r
50  * read_setting_s() can return NULL, in which case the caller\r
51  * should invent a sensible default. If an integer setting is not\r
52  * present, read_setting_i() returns its provided default.\r
53  */\r
54 void *open_settings_r(const char *sessionname);\r
55 char *read_setting_s(void *handle, const char *key);\r
56 int read_setting_i(void *handle, const char *key, int defvalue);\r
57 Filename *read_setting_filename(void *handle, const char *key);\r
58 FontSpec *read_setting_fontspec(void *handle, const char *key);\r
59 void close_settings_r(void *handle);\r
61 /*\r
62  * Delete a whole saved session.\r
63  */\r
64 void del_settings(const char *sessionname);\r
66 /*\r
67  * Enumerate all saved sessions.\r
68  */\r
69 void *enum_settings_start(void);\r
70 char *enum_settings_next(void *handle, char *buffer, int buflen);\r
71 void enum_settings_finish(void *handle);\r
73 /* ----------------------------------------------------------------------\r
74  * Functions to access PuTTY's host key database.\r
75  */\r
77 /*\r
78  * See if a host key matches the database entry. Return values can\r
79  * be 0 (entry matches database), 1 (entry is absent in database),\r
80  * or 2 (entry exists in database and is different).\r
81  */\r
82 int verify_host_key(const char *hostname, int port,\r
83                     const char *keytype, const char *key);\r
85 /*\r
86  * Write a host key into the database, overwriting any previous\r
87  * entry that might have been there.\r
88  */\r
89 void store_host_key(const char *hostname, int port,\r
90                     const char *keytype, const char *key);\r
92 /* ----------------------------------------------------------------------\r
93  * Functions to access PuTTY's random number seed file.\r
94  */\r
96 typedef void (*noise_consumer_t) (void *data, int len);\r
98 /*\r
99  * Read PuTTY's random seed file and pass its contents to a noise\r
100  * consumer function.\r
101  */\r
102 void read_random_seed(noise_consumer_t consumer);\r
104 /*\r
105  * Write PuTTY's random seed file from a given chunk of noise.\r
106  */\r
107 void write_random_seed(void *data, int len);\r
109 /* ----------------------------------------------------------------------\r
110  * Cleanup function: remove all of PuTTY's persistent state.\r
111  */\r
112 void cleanup_all(void);\r
114 #endif\r