chiark / gitweb /
rand/rand-x86ish.S: Hoist argument register allocation outside.
[catacomb] / key / key-error.h
1 /* -*-c-*-
2  *
3  * Key management error codes
4  *
5  * (c) 2004 Straylight/Edgeware
6  */
7
8 /*----- Licensing notice --------------------------------------------------*
9  *
10  * This file is part of Catacomb.
11  *
12  * Catacomb is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU Library General Public License as
14  * published by the Free Software Foundation; either version 2 of the
15  * License, or (at your option) any later version.
16  *
17  * Catacomb is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU Library General Public License for more details.
21  *
22  * You should have received a copy of the GNU Library General Public
23  * License along with Catacomb; if not, write to the Free
24  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25  * MA 02111-1307, USA.
26  */
27
28 #ifndef CATACOMB_KEY_ERROR_H
29 #define CATACOMB_KEY_ERROR_H
30
31 #ifdef __cplusplus
32   extern "C" {
33 #endif
34
35 /*----- Error codes -------------------------------------------------------*/
36
37 #define KEY_ERRORS(_)                                                   \
38   _(OK,           0, "No error")                                        \
39   _(BADTAG,      -1, "Bad tag string")                                  \
40   _(BADTYPE,     -2, "Bad type string")                                 \
41   _(BADCOMMENT,  -3, "Bad comment string")                              \
42   _(DUPID,       -4, "Key id already exists")                           \
43   _(DUPTAG,      -5, "Key tag already exists")                          \
44   _(READONLY,    -6, "Key file is read-only")                           \
45   _(WILLEXPIRE,  -7, "Key will eventually expire")                      \
46   _(EXPIRED,     -8, "Key has expired")                                 \
47   _(BADFLAGS,    -9, "Bad key flags string")                            \
48   _(BADPASS,    -10, "Failed to unlock key")                            \
49   _(WRONGTYPE,  -11, "Unexpected key encoding type")                    \
50   _(NOTFOUND,   -12, "Key not found")                                   \
51   _(BADATTR,    -13, "Bad attribute name")                              \
52   _(MALFORMED,  -14, "Malformed key data")                              \
53   _(IO,         -15, "I/O error")                                       \
54
55 enum {
56 #define ENTRY(tag, num, str) KERR_##tag = num,
57   KEY_ERRORS(ENTRY)
58 #undef ENTRY
59   KERR__dummy
60 };
61
62 /*----- Functions provided ------------------------------------------------*/
63
64 /* --- @key_strerror@ --- *
65  *
66  * Arguments:   @int err@ = error code from @key_new@
67  *
68  * Returns:     Pointer to error string.
69  *
70  * Use:         Translates a @KERR@ error code into a human-readable string.
71  */
72
73 extern const char *key_strerror(int /*err*/);
74
75 /*----- That's all, folks -------------------------------------------------*/
76
77 #ifdef __cplusplus
78   }
79 #endif
80
81 #endif