Update Debian Vcs-* fields to point to git repository
[onak.git] / keyd.h
1 /**
2  * @file keyd.h
3  * @brief Public API for keyd.
4  *
5  * Copyright 2004,2011 Jonathan McDowell <noodles@earth.li>
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the Free
9  * Software Foundation; version 2 of the License.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17   * this program; if not, write to the Free Software Foundation, Inc., 51
18  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef __KEYD_H__
22 #define __KEYD_H__
23
24 #include <stdint.h>
25
26 /**
27  * @brief The name of the keyd Unix domain socket
28  */
29 #define KEYD_SOCKET "keyd.sock"
30
31 /**
32  * @brief keyd commands
33  */
34 enum keyd_ops {
35         KEYD_CMD_UNKNOWN = 0,
36         KEYD_CMD_VERSION = 1,
37         KEYD_CMD_GET,
38         KEYD_CMD_STORE,
39         KEYD_CMD_DELETE,
40         KEYD_CMD_GETTEXT,
41         KEYD_CMD_GETFULLKEYID,
42         KEYD_CMD_KEYITER,
43         KEYD_CMD_CLOSE,
44         KEYD_CMD_QUIT,
45         KEYD_CMD_STATS,
46         KEYD_CMD_GETSKSHASH,
47         KEYD_CMD_LAST                   /* Placeholder */
48 };
49
50 /**
51  * @brief Reply codes for keyd commands
52  */
53 enum keyd_reply {
54         KEYD_REPLY_OK = 0,
55         KEYD_REPLY_UNKNOWN_CMD = 1
56 };
57
58 /**
59  * @brief Version of the keyd protocol currently supported
60  */
61 static const uint32_t keyd_version = 3;
62
63 /**
64  * @brief Response structure for the @a KEYD_CMD_STATS response
65  */
66 struct keyd_stats {
67         /** Unix time of when the keyd daemon was started */
68         time_t started;
69         /** Number of connects we've seen to keyd */
70         uint32_t connects;
71         /** Count of the number of times each command has been used */
72         uint32_t command_stats[KEYD_CMD_LAST];
73 };
74
75 #endif /* __KEYD_H__ */