Provide better interface to key locking.
[u/mdw/catacomb] / key-error.h
CommitLineData
1dda051b 1/* -*-c-*-
2 *
3 * $Id$
4 *
5 * Key management error codes
6 *
7 * (c) 2004 Straylight/Edgeware
8 */
9
10/*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of Catacomb.
13 *
14 * Catacomb is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 *
19 * Catacomb is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
23 *
24 * You should have received a copy of the GNU Library General Public
25 * License along with Catacomb; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27 * MA 02111-1307, USA.
28 */
29
30#ifndef CATACOMB_KEY_ERROR_H
31#define CATACOMB_KEY_ERROR_H
32
33#ifdef __cplusplus
34 extern "C" {
35#endif
36
37/*----- Error codes -------------------------------------------------------*/
38
39enum {
40 KERR_OK = 0, /* No error */
41 KERR_BADTAG = -1, /* Malformed tag string */
42 KERR_BADTYPE = -2, /* Malformed type string */
43 KERR_BADCOMMENT = -3, /* Malformed comment string */
44 KERR_DUPID = -4, /* Duplicate keyid */
45 KERR_DUPTAG = -5, /* Duplicate key tag string */
46 KERR_READONLY = -6, /* Key file is read-only */
47 KERR_WILLEXPIRE = -7, /* Key will eventually expire */
48 KERR_EXPIRED = -8, /* Key has already expired */
49 KERR_BADFLAGS = -9, /* Error in flags string */
50 KERR_BADPASS = -10, /* Error decrypting locked key */
51 KERR_WRONGTYPE = -11, /* Key has incorrect type */
52 KERR_NOTFOUND = -12, /* Key couldn't be found */
53 KERR_BADATTR = -13, /* Malformed attribute name */
54 KERR_MALFORMED = -14, /* Key data is malformed */
55 KERR_IO = -15, /* I/O error of some kind */
56 KERR_MAX = -16 /* Not useful */
57};
58
59/*----- Functions provided ------------------------------------------------*/
60
61/* --- @key_strerror@ --- *
62 *
63 * Arguments: @int err@ = error code from @key_new@
64 *
65 * Returns: Pointer to error string.
66 *
67 * Use: Translates a @KERR@ error code into a human-readable string.
68 */
69
70extern const char *key_strerror(int /*err*/);
71
72/*----- That's all, folks -------------------------------------------------*/
73
74#ifdef __cplusplus
75 }
76#endif
77
78#endif