]> asedeno.scripts.mit.edu Git - PuTTY.git/blob - pageant.h
Move half of Pageant out into a cross-platform source file.
[PuTTY.git] / pageant.h
1 /*
2  * pageant.h: header for pageant.c.
3  */
4
5 /*
6  * FIXME: it would be nice not to have this arbitrary limit. It's
7  * currently needed because the Windows Pageant IPC system needs an
8  * upper bound known to the client, but it's also reused as a basic
9  * sanity check on incoming messages' length fields.
10  */
11 #define AGENT_MAX_MSGLEN  8192
12
13 /*
14  * Initial setup.
15  */
16 void pageant_init(void);
17
18 /*
19  * The main agent function that answers messages.
20  *
21  * Expects a message/length pair as input, minus its initial length
22  * field but still with its type code on the front.
23  *
24  * Returns a fully formatted message as output, *with* its initial
25  * length field, and sets *outlen to the full size of that message.
26  */
27 void *pageant_handle_msg(const void *msg, int msglen, int *outlen);
28
29 /*
30  * Construct a failure response. Useful for agent front ends which
31  * suffer a problem before they even get to pageant_handle_msg.
32  */
33 void *pageant_failure_msg(int *outlen);
34
35 /*
36  * Construct a list of public keys, just as the two LIST_IDENTITIES
37  * requests would have returned them.
38  */
39 void *pageant_make_keylist1(int *length);
40 void *pageant_make_keylist2(int *length);
41
42 /*
43  * Accessor functions for Pageant's internal key lists. Fetch the nth
44  * key; count the keys; attempt to add a key (returning true on
45  * success, in which case the ownership of the key structure has been
46  * taken over by pageant.c); attempt to delete a key (returning true
47  * on success, in which case the ownership of the key structure is
48  * passed back to the client).
49  */
50 struct RSAKey *pageant_nth_ssh1_key(int i);
51 struct ssh2_userkey *pageant_nth_ssh2_key(int i);
52 int pageant_count_ssh1_keys(void);
53 int pageant_count_ssh2_keys(void);
54 int pageant_add_ssh1_key(struct RSAKey *rkey);
55 int pageant_add_ssh2_key(struct ssh2_userkey *skey);
56 int pageant_delete_ssh1_key(struct RSAKey *rkey);
57 int pageant_delete_ssh2_key(struct ssh2_userkey *skey);
58
59 /*
60  * This callback must be provided by the Pageant front end code.
61  * pageant_handle_msg calls it to indicate that the message it's just
62  * handled has changed the list of keys held by the agent. Front ends
63  * which expose that key list through dedicated UI may need to refresh
64  * that UI's state in this function; other front ends can leave it
65  * empty.
66  */
67 void keylist_update(void);