X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=keydb%2Fkeyd.h;fp=keydb%2Fkeyd.h;h=1ea601c82777af9de57ecc039578f0e8b4e1b5b3;hb=51c1a7dd950efef6a4d00df1878341777f8064ff;hp=0000000000000000000000000000000000000000;hpb=dfab9e96ee1fa4a10acf9c1cf644d7a4366a5af6;p=onak.git diff --git a/keydb/keyd.h b/keydb/keyd.h new file mode 100644 index 0000000..1ea601c --- /dev/null +++ b/keydb/keyd.h @@ -0,0 +1,76 @@ +/** + * @file keyd.h + * @brief Public API for keyd. + * + * Copyright 2004,2011 Jonathan McDowell + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#ifndef __KEYD_H__ +#define __KEYD_H__ + +#include + +/** + * @brief The name of the keyd Unix domain socket + */ +#define KEYD_SOCKET "keyd.sock" + +/** + * @brief keyd commands + */ +enum keyd_ops { + KEYD_CMD_UNKNOWN = 0, + KEYD_CMD_VERSION = 1, + KEYD_CMD_GET_ID, + KEYD_CMD_STORE, + KEYD_CMD_DELETE, + KEYD_CMD_GET_TEXT, + KEYD_CMD_GETFULLKEYID, + KEYD_CMD_KEYITER, + KEYD_CMD_CLOSE, + KEYD_CMD_QUIT, + KEYD_CMD_STATS, + KEYD_CMD_GET_SKSHASH, + KEYD_CMD_GET_FP, + KEYD_CMD_UPDATE, + KEYD_CMD_LAST /* Placeholder */ +}; + +/** + * @brief Reply codes for keyd commands + */ +enum keyd_reply { + KEYD_REPLY_OK = 0, + KEYD_REPLY_UNKNOWN_CMD = 1 +}; + +/** + * @brief Version of the keyd protocol currently supported + */ +static const uint32_t keyd_version = 5; + +/** + * @brief Response structure for the @a KEYD_CMD_STATS response + */ +struct keyd_stats { + /** Unix time of when the keyd daemon was started */ + time_t started; + /** Number of connects we've seen to keyd */ + uint32_t connects; + /** Count of the number of times each command has been used */ + uint32_t command_stats[KEYD_CMD_LAST]; +}; + +#endif /* __KEYD_H__ */