PageRenderTime 97ms CodeModel.GetById 34ms app.highlight 57ms RepoModel.GetById 1ms app.codeStats 0ms

/Frameworks/OTR.framework/Versions/A/Headers/gpg-error.h

https://bitbucket.org/adium/adium-13
C++ Header | 570 lines | 443 code | 41 blank | 86 comment | 1 complexity | 0c6c4d1a51c50c2ce20efabad1656722 MD5 | raw file
  1/* Output of mkheader.awk.  DO NOT EDIT.  */
  2
  3/* gpg-error.h - Public interface to libgpg-error.
  4   Copyright (C) 2003, 2004 g10 Code GmbH
  5
  6   This file is part of libgpg-error.
  7 
  8   libgpg-error is free software; you can redistribute it and/or
  9   modify it under the terms of the GNU Lesser General Public License
 10   as published by the Free Software Foundation; either version 2.1 of
 11   the License, or (at your option) any later version.
 12 
 13   libgpg-error is distributed in the hope that it will be useful, but
 14   WITHOUT ANY WARRANTY; without even the implied warranty of
 15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 16   Lesser General Public License for more details.
 17 
 18   You should have received a copy of the GNU Lesser General Public
 19   License along with libgpg-error; if not, write to the Free
 20   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 21   02111-1307, USA.  */
 22
 23#ifndef GPG_ERROR_H
 24#define GPG_ERROR_H	1
 25
 26#include <stddef.h>
 27
 28#ifdef __GNUC__
 29#define GPG_ERR_INLINE __inline__
 30#elif __STDC_VERSION__ >= 199901L
 31#define GPG_ERR_INLINE inline
 32#else
 33#ifndef GPG_ERR_INLINE
 34#define GPG_ERR_INLINE
 35#endif 
 36#endif
 37
 38#ifdef __cplusplus
 39extern "C" {
 40#if 0 /* just to make Emacs auto-indent happy */
 41}
 42#endif
 43#endif /* __cplusplus */
 44
 45/* The GnuPG project consists of many components.  Error codes are
 46   exchanged between all components.  The common error codes and their
 47   user-presentable descriptions are kept into a shared library to
 48   allow adding new error codes and components without recompiling any
 49   of the other components.  The interface will not change in a
 50   backward incompatible way.
 51
 52   An error code together with an error source build up an error
 53   value.  As the error value is been passed from one component to
 54   another, it preserver the information about the source and nature
 55   of the error.
 56
 57   A component of the GnuPG project can define the following macro to
 58   tune the behaviour of the library:
 59
 60   GPG_ERR_SOURCE_DEFAULT: Define to an error source of type
 61   gpg_err_source_t to make that source the default for gpg_error().
 62   Otherwise GPG_ERR_SOURCE_UNKNOWN is used as default.  */
 63
 64
 65/* The error source type gpg_err_source_t.
 66
 67   Where as the Poo out of a welle small
 68   Taketh his firste springing and his sours.
 69					--Chaucer.  */
 70
 71/* Only use free slots, never change or reorder the existing
 72   entries.  */
 73typedef enum
 74  {
 75    GPG_ERR_SOURCE_UNKNOWN = 0,
 76    GPG_ERR_SOURCE_GCRYPT = 1,
 77    GPG_ERR_SOURCE_GPG = 2,
 78    GPG_ERR_SOURCE_GPGSM = 3,
 79    GPG_ERR_SOURCE_GPGAGENT = 4,
 80    GPG_ERR_SOURCE_PINENTRY = 5,
 81    GPG_ERR_SOURCE_SCD = 6,
 82    GPG_ERR_SOURCE_GPGME = 7,
 83    GPG_ERR_SOURCE_KEYBOX = 8,
 84    GPG_ERR_SOURCE_KSBA = 9,
 85    GPG_ERR_SOURCE_DIRMNGR = 10,
 86    GPG_ERR_SOURCE_GSTI = 11,
 87    GPG_ERR_SOURCE_USER_1 = 32,
 88    GPG_ERR_SOURCE_USER_2 = 33,
 89    GPG_ERR_SOURCE_USER_3 = 34,
 90    GPG_ERR_SOURCE_USER_4 = 35,
 91
 92    /* This is one more than the largest allowed entry.  */
 93    GPG_ERR_SOURCE_DIM = 256
 94  } gpg_err_source_t;
 95
 96
 97/* The error code type gpg_err_code_t.  */
 98
 99/* Only use free slots, never change or reorder the existing
100   entries.  */
101typedef enum
102  {
103    GPG_ERR_NO_ERROR = 0,
104    GPG_ERR_GENERAL = 1,
105    GPG_ERR_UNKNOWN_PACKET = 2,
106    GPG_ERR_UNKNOWN_VERSION = 3,
107    GPG_ERR_PUBKEY_ALGO = 4,
108    GPG_ERR_DIGEST_ALGO = 5,
109    GPG_ERR_BAD_PUBKEY = 6,
110    GPG_ERR_BAD_SECKEY = 7,
111    GPG_ERR_BAD_SIGNATURE = 8,
112    GPG_ERR_NO_PUBKEY = 9,
113    GPG_ERR_CHECKSUM = 10,
114    GPG_ERR_BAD_PASSPHRASE = 11,
115    GPG_ERR_CIPHER_ALGO = 12,
116    GPG_ERR_KEYRING_OPEN = 13,
117    GPG_ERR_INV_PACKET = 14,
118    GPG_ERR_INV_ARMOR = 15,
119    GPG_ERR_NO_USER_ID = 16,
120    GPG_ERR_NO_SECKEY = 17,
121    GPG_ERR_WRONG_SECKEY = 18,
122    GPG_ERR_BAD_KEY = 19,
123    GPG_ERR_COMPR_ALGO = 20,
124    GPG_ERR_NO_PRIME = 21,
125    GPG_ERR_NO_ENCODING_METHOD = 22,
126    GPG_ERR_NO_ENCRYPTION_SCHEME = 23,
127    GPG_ERR_NO_SIGNATURE_SCHEME = 24,
128    GPG_ERR_INV_ATTR = 25,
129    GPG_ERR_NO_VALUE = 26,
130    GPG_ERR_NOT_FOUND = 27,
131    GPG_ERR_VALUE_NOT_FOUND = 28,
132    GPG_ERR_SYNTAX = 29,
133    GPG_ERR_BAD_MPI = 30,
134    GPG_ERR_INV_PASSPHRASE = 31,
135    GPG_ERR_SIG_CLASS = 32,
136    GPG_ERR_RESOURCE_LIMIT = 33,
137    GPG_ERR_INV_KEYRING = 34,
138    GPG_ERR_TRUSTDB = 35,
139    GPG_ERR_BAD_CERT = 36,
140    GPG_ERR_INV_USER_ID = 37,
141    GPG_ERR_UNEXPECTED = 38,
142    GPG_ERR_TIME_CONFLICT = 39,
143    GPG_ERR_KEYSERVER = 40,
144    GPG_ERR_WRONG_PUBKEY_ALGO = 41,
145    GPG_ERR_TRIBUTE_TO_D_A = 42,
146    GPG_ERR_WEAK_KEY = 43,
147    GPG_ERR_INV_KEYLEN = 44,
148    GPG_ERR_INV_ARG = 45,
149    GPG_ERR_BAD_URI = 46,
150    GPG_ERR_INV_URI = 47,
151    GPG_ERR_NETWORK = 48,
152    GPG_ERR_UNKNOWN_HOST = 49,
153    GPG_ERR_SELFTEST_FAILED = 50,
154    GPG_ERR_NOT_ENCRYPTED = 51,
155    GPG_ERR_NOT_PROCESSED = 52,
156    GPG_ERR_UNUSABLE_PUBKEY = 53,
157    GPG_ERR_UNUSABLE_SECKEY = 54,
158    GPG_ERR_INV_VALUE = 55,
159    GPG_ERR_BAD_CERT_CHAIN = 56,
160    GPG_ERR_MISSING_CERT = 57,
161    GPG_ERR_NO_DATA = 58,
162    GPG_ERR_BUG = 59,
163    GPG_ERR_NOT_SUPPORTED = 60,
164    GPG_ERR_INV_OP = 61,
165    GPG_ERR_TIMEOUT = 62,
166    GPG_ERR_INTERNAL = 63,
167    GPG_ERR_EOF_GCRYPT = 64,
168    GPG_ERR_INV_OBJ = 65,
169    GPG_ERR_TOO_SHORT = 66,
170    GPG_ERR_TOO_LARGE = 67,
171    GPG_ERR_NO_OBJ = 68,
172    GPG_ERR_NOT_IMPLEMENTED = 69,
173    GPG_ERR_CONFLICT = 70,
174    GPG_ERR_INV_CIPHER_MODE = 71,
175    GPG_ERR_INV_FLAG = 72,
176    GPG_ERR_INV_HANDLE = 73,
177    GPG_ERR_TRUNCATED = 74,
178    GPG_ERR_INCOMPLETE_LINE = 75,
179    GPG_ERR_INV_RESPONSE = 76,
180    GPG_ERR_NO_AGENT = 77,
181    GPG_ERR_AGENT = 78,
182    GPG_ERR_INV_DATA = 79,
183    GPG_ERR_ASSUAN_SERVER_FAULT = 80,
184    GPG_ERR_ASSUAN = 81,
185    GPG_ERR_INV_SESSION_KEY = 82,
186    GPG_ERR_INV_SEXP = 83,
187    GPG_ERR_UNSUPPORTED_ALGORITHM = 84,
188    GPG_ERR_NO_PIN_ENTRY = 85,
189    GPG_ERR_PIN_ENTRY = 86,
190    GPG_ERR_BAD_PIN = 87,
191    GPG_ERR_INV_NAME = 88,
192    GPG_ERR_BAD_DATA = 89,
193    GPG_ERR_INV_PARAMETER = 90,
194    GPG_ERR_WRONG_CARD = 91,
195    GPG_ERR_NO_DIRMNGR = 92,
196    GPG_ERR_DIRMNGR = 93,
197    GPG_ERR_CERT_REVOKED = 94,
198    GPG_ERR_NO_CRL_KNOWN = 95,
199    GPG_ERR_CRL_TOO_OLD = 96,
200    GPG_ERR_LINE_TOO_LONG = 97,
201    GPG_ERR_NOT_TRUSTED = 98,
202    GPG_ERR_CANCELED = 99,
203    GPG_ERR_BAD_CA_CERT = 100,
204    GPG_ERR_CERT_EXPIRED = 101,
205    GPG_ERR_CERT_TOO_YOUNG = 102,
206    GPG_ERR_UNSUPPORTED_CERT = 103,
207    GPG_ERR_UNKNOWN_SEXP = 104,
208    GPG_ERR_UNSUPPORTED_PROTECTION = 105,
209    GPG_ERR_CORRUPTED_PROTECTION = 106,
210    GPG_ERR_AMBIGUOUS_NAME = 107,
211    GPG_ERR_CARD = 108,
212    GPG_ERR_CARD_RESET = 109,
213    GPG_ERR_CARD_REMOVED = 110,
214    GPG_ERR_INV_CARD = 111,
215    GPG_ERR_CARD_NOT_PRESENT = 112,
216    GPG_ERR_NO_PKCS15_APP = 113,
217    GPG_ERR_NOT_CONFIRMED = 114,
218    GPG_ERR_CONFIGURATION = 115,
219    GPG_ERR_NO_POLICY_MATCH = 116,
220    GPG_ERR_INV_INDEX = 117,
221    GPG_ERR_INV_ID = 118,
222    GPG_ERR_NO_SCDAEMON = 119,
223    GPG_ERR_SCDAEMON = 120,
224    GPG_ERR_UNSUPPORTED_PROTOCOL = 121,
225    GPG_ERR_BAD_PIN_METHOD = 122,
226    GPG_ERR_CARD_NOT_INITIALIZED = 123,
227    GPG_ERR_UNSUPPORTED_OPERATION = 124,
228    GPG_ERR_WRONG_KEY_USAGE = 125,
229    GPG_ERR_NOTHING_FOUND = 126,
230    GPG_ERR_WRONG_BLOB_TYPE = 127,
231    GPG_ERR_MISSING_VALUE = 128,
232    GPG_ERR_HARDWARE = 129,
233    GPG_ERR_PIN_BLOCKED = 130,
234    GPG_ERR_USE_CONDITIONS = 131,
235    GPG_ERR_PIN_NOT_SYNCED = 132,
236    GPG_ERR_INV_CRL = 133,
237    GPG_ERR_BAD_BER = 134,
238    GPG_ERR_INV_BER = 135,
239    GPG_ERR_ELEMENT_NOT_FOUND = 136,
240    GPG_ERR_IDENTIFIER_NOT_FOUND = 137,
241    GPG_ERR_INV_TAG = 138,
242    GPG_ERR_INV_LENGTH = 139,
243    GPG_ERR_INV_KEYINFO = 140,
244    GPG_ERR_UNEXPECTED_TAG = 141,
245    GPG_ERR_NOT_DER_ENCODED = 142,
246    GPG_ERR_NO_CMS_OBJ = 143,
247    GPG_ERR_INV_CMS_OBJ = 144,
248    GPG_ERR_UNKNOWN_CMS_OBJ = 145,
249    GPG_ERR_UNSUPPORTED_CMS_OBJ = 146,
250    GPG_ERR_UNSUPPORTED_ENCODING = 147,
251    GPG_ERR_UNSUPPORTED_CMS_VERSION = 148,
252    GPG_ERR_UNKNOWN_ALGORITHM = 149,
253    GPG_ERR_INV_ENGINE = 150,
254    GPG_ERR_PUBKEY_NOT_TRUSTED = 151,
255    GPG_ERR_DECRYPT_FAILED = 152,
256    GPG_ERR_KEY_EXPIRED = 153,
257    GPG_ERR_SIG_EXPIRED = 154,
258    GPG_ERR_ENCODING_PROBLEM = 155,
259    GPG_ERR_INV_STATE = 156,
260    GPG_ERR_DUP_VALUE = 157,
261    GPG_ERR_MISSING_ACTION = 158,
262    GPG_ERR_MODULE_NOT_FOUND = 159,
263    GPG_ERR_INV_OID_STRING = 160,
264    GPG_ERR_INV_TIME = 161,
265    GPG_ERR_INV_CRL_OBJ = 162,
266    GPG_ERR_UNSUPPORTED_CRL_VERSION = 163,
267    GPG_ERR_INV_CERT_OBJ = 164,
268    GPG_ERR_UNKNOWN_NAME = 165,
269    GPG_ERR_LOCALE_PROBLEM = 166,
270    GPG_ERR_NOT_LOCKED = 167,
271    GPG_ERR_PROTOCOL_VIOLATION = 168,
272    GPG_ERR_INV_MAC = 169,
273    GPG_ERR_INV_REQUEST = 170,
274    GPG_ERR_BUFFER_TOO_SHORT = 200,
275    GPG_ERR_SEXP_INV_LEN_SPEC = 201,
276    GPG_ERR_SEXP_STRING_TOO_LONG = 202,
277    GPG_ERR_SEXP_UNMATCHED_PAREN = 203,
278    GPG_ERR_SEXP_NOT_CANONICAL = 204,
279    GPG_ERR_SEXP_BAD_CHARACTER = 205,
280    GPG_ERR_SEXP_BAD_QUOTATION = 206,
281    GPG_ERR_SEXP_ZERO_PREFIX = 207,
282    GPG_ERR_SEXP_NESTED_DH = 208,
283    GPG_ERR_SEXP_UNMATCHED_DH = 209,
284    GPG_ERR_SEXP_UNEXPECTED_PUNC = 210,
285    GPG_ERR_SEXP_BAD_HEX_CHAR = 211,
286    GPG_ERR_SEXP_ODD_HEX_NUMBERS = 212,
287    GPG_ERR_SEXP_BAD_OCT_CHAR = 213,
288    GPG_ERR_USER_1 = 1024,
289    GPG_ERR_USER_2 = 1025,
290    GPG_ERR_USER_3 = 1026,
291    GPG_ERR_USER_4 = 1027,
292    GPG_ERR_USER_5 = 1028,
293    GPG_ERR_USER_6 = 1029,
294    GPG_ERR_USER_7 = 1030,
295    GPG_ERR_USER_8 = 1031,
296    GPG_ERR_USER_9 = 1032,
297    GPG_ERR_USER_10 = 1033,
298    GPG_ERR_USER_11 = 1034,
299    GPG_ERR_USER_12 = 1035,
300    GPG_ERR_USER_13 = 1036,
301    GPG_ERR_USER_14 = 1037,
302    GPG_ERR_USER_15 = 1038,
303    GPG_ERR_USER_16 = 1039,
304    GPG_ERR_UNKNOWN_ERRNO = 16382,
305    GPG_ERR_EOF = 16383,
306
307    /* The following error codes are used to map system errors.  */
308#define GPG_ERR_SYSTEM_ERROR	(1 << 15)
309    GPG_ERR_E2BIG = GPG_ERR_SYSTEM_ERROR | 0,
310    GPG_ERR_EACCES = GPG_ERR_SYSTEM_ERROR | 1,
311    GPG_ERR_EADDRINUSE = GPG_ERR_SYSTEM_ERROR | 2,
312    GPG_ERR_EADDRNOTAVAIL = GPG_ERR_SYSTEM_ERROR | 3,
313    GPG_ERR_EADV = GPG_ERR_SYSTEM_ERROR | 4,
314    GPG_ERR_EAFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 5,
315    GPG_ERR_EAGAIN = GPG_ERR_SYSTEM_ERROR | 6,
316    GPG_ERR_EALREADY = GPG_ERR_SYSTEM_ERROR | 7,
317    GPG_ERR_EAUTH = GPG_ERR_SYSTEM_ERROR | 8,
318    GPG_ERR_EBACKGROUND = GPG_ERR_SYSTEM_ERROR | 9,
319    GPG_ERR_EBADE = GPG_ERR_SYSTEM_ERROR | 10,
320    GPG_ERR_EBADF = GPG_ERR_SYSTEM_ERROR | 11,
321    GPG_ERR_EBADFD = GPG_ERR_SYSTEM_ERROR | 12,
322    GPG_ERR_EBADMSG = GPG_ERR_SYSTEM_ERROR | 13,
323    GPG_ERR_EBADR = GPG_ERR_SYSTEM_ERROR | 14,
324    GPG_ERR_EBADRPC = GPG_ERR_SYSTEM_ERROR | 15,
325    GPG_ERR_EBADRQC = GPG_ERR_SYSTEM_ERROR | 16,
326    GPG_ERR_EBADSLT = GPG_ERR_SYSTEM_ERROR | 17,
327    GPG_ERR_EBFONT = GPG_ERR_SYSTEM_ERROR | 18,
328    GPG_ERR_EBUSY = GPG_ERR_SYSTEM_ERROR | 19,
329    GPG_ERR_ECANCELED = GPG_ERR_SYSTEM_ERROR | 20,
330    GPG_ERR_ECHILD = GPG_ERR_SYSTEM_ERROR | 21,
331    GPG_ERR_ECHRNG = GPG_ERR_SYSTEM_ERROR | 22,
332    GPG_ERR_ECOMM = GPG_ERR_SYSTEM_ERROR | 23,
333    GPG_ERR_ECONNABORTED = GPG_ERR_SYSTEM_ERROR | 24,
334    GPG_ERR_ECONNREFUSED = GPG_ERR_SYSTEM_ERROR | 25,
335    GPG_ERR_ECONNRESET = GPG_ERR_SYSTEM_ERROR | 26,
336    GPG_ERR_ED = GPG_ERR_SYSTEM_ERROR | 27,
337    GPG_ERR_EDEADLK = GPG_ERR_SYSTEM_ERROR | 28,
338    GPG_ERR_EDEADLOCK = GPG_ERR_SYSTEM_ERROR | 29,
339    GPG_ERR_EDESTADDRREQ = GPG_ERR_SYSTEM_ERROR | 30,
340    GPG_ERR_EDIED = GPG_ERR_SYSTEM_ERROR | 31,
341    GPG_ERR_EDOM = GPG_ERR_SYSTEM_ERROR | 32,
342    GPG_ERR_EDOTDOT = GPG_ERR_SYSTEM_ERROR | 33,
343    GPG_ERR_EDQUOT = GPG_ERR_SYSTEM_ERROR | 34,
344    GPG_ERR_EEXIST = GPG_ERR_SYSTEM_ERROR | 35,
345    GPG_ERR_EFAULT = GPG_ERR_SYSTEM_ERROR | 36,
346    GPG_ERR_EFBIG = GPG_ERR_SYSTEM_ERROR | 37,
347    GPG_ERR_EFTYPE = GPG_ERR_SYSTEM_ERROR | 38,
348    GPG_ERR_EGRATUITOUS = GPG_ERR_SYSTEM_ERROR | 39,
349    GPG_ERR_EGREGIOUS = GPG_ERR_SYSTEM_ERROR | 40,
350    GPG_ERR_EHOSTDOWN = GPG_ERR_SYSTEM_ERROR | 41,
351    GPG_ERR_EHOSTUNREACH = GPG_ERR_SYSTEM_ERROR | 42,
352    GPG_ERR_EIDRM = GPG_ERR_SYSTEM_ERROR | 43,
353    GPG_ERR_EIEIO = GPG_ERR_SYSTEM_ERROR | 44,
354    GPG_ERR_EILSEQ = GPG_ERR_SYSTEM_ERROR | 45,
355    GPG_ERR_EINPROGRESS = GPG_ERR_SYSTEM_ERROR | 46,
356    GPG_ERR_EINTR = GPG_ERR_SYSTEM_ERROR | 47,
357    GPG_ERR_EINVAL = GPG_ERR_SYSTEM_ERROR | 48,
358    GPG_ERR_EIO = GPG_ERR_SYSTEM_ERROR | 49,
359    GPG_ERR_EISCONN = GPG_ERR_SYSTEM_ERROR | 50,
360    GPG_ERR_EISDIR = GPG_ERR_SYSTEM_ERROR | 51,
361    GPG_ERR_EISNAM = GPG_ERR_SYSTEM_ERROR | 52,
362    GPG_ERR_EL2HLT = GPG_ERR_SYSTEM_ERROR | 53,
363    GPG_ERR_EL2NSYNC = GPG_ERR_SYSTEM_ERROR | 54,
364    GPG_ERR_EL3HLT = GPG_ERR_SYSTEM_ERROR | 55,
365    GPG_ERR_EL3RST = GPG_ERR_SYSTEM_ERROR | 56,
366    GPG_ERR_ELIBACC = GPG_ERR_SYSTEM_ERROR | 57,
367    GPG_ERR_ELIBBAD = GPG_ERR_SYSTEM_ERROR | 58,
368    GPG_ERR_ELIBEXEC = GPG_ERR_SYSTEM_ERROR | 59,
369    GPG_ERR_ELIBMAX = GPG_ERR_SYSTEM_ERROR | 60,
370    GPG_ERR_ELIBSCN = GPG_ERR_SYSTEM_ERROR | 61,
371    GPG_ERR_ELNRNG = GPG_ERR_SYSTEM_ERROR | 62,
372    GPG_ERR_ELOOP = GPG_ERR_SYSTEM_ERROR | 63,
373    GPG_ERR_EMEDIUMTYPE = GPG_ERR_SYSTEM_ERROR | 64,
374    GPG_ERR_EMFILE = GPG_ERR_SYSTEM_ERROR | 65,
375    GPG_ERR_EMLINK = GPG_ERR_SYSTEM_ERROR | 66,
376    GPG_ERR_EMSGSIZE = GPG_ERR_SYSTEM_ERROR | 67,
377    GPG_ERR_EMULTIHOP = GPG_ERR_SYSTEM_ERROR | 68,
378    GPG_ERR_ENAMETOOLONG = GPG_ERR_SYSTEM_ERROR | 69,
379    GPG_ERR_ENAVAIL = GPG_ERR_SYSTEM_ERROR | 70,
380    GPG_ERR_ENEEDAUTH = GPG_ERR_SYSTEM_ERROR | 71,
381    GPG_ERR_ENETDOWN = GPG_ERR_SYSTEM_ERROR | 72,
382    GPG_ERR_ENETRESET = GPG_ERR_SYSTEM_ERROR | 73,
383    GPG_ERR_ENETUNREACH = GPG_ERR_SYSTEM_ERROR | 74,
384    GPG_ERR_ENFILE = GPG_ERR_SYSTEM_ERROR | 75,
385    GPG_ERR_ENOANO = GPG_ERR_SYSTEM_ERROR | 76,
386    GPG_ERR_ENOBUFS = GPG_ERR_SYSTEM_ERROR | 77,
387    GPG_ERR_ENOCSI = GPG_ERR_SYSTEM_ERROR | 78,
388    GPG_ERR_ENODATA = GPG_ERR_SYSTEM_ERROR | 79,
389    GPG_ERR_ENODEV = GPG_ERR_SYSTEM_ERROR | 80,
390    GPG_ERR_ENOENT = GPG_ERR_SYSTEM_ERROR | 81,
391    GPG_ERR_ENOEXEC = GPG_ERR_SYSTEM_ERROR | 82,
392    GPG_ERR_ENOLCK = GPG_ERR_SYSTEM_ERROR | 83,
393    GPG_ERR_ENOLINK = GPG_ERR_SYSTEM_ERROR | 84,
394    GPG_ERR_ENOMEDIUM = GPG_ERR_SYSTEM_ERROR | 85,
395    GPG_ERR_ENOMEM = GPG_ERR_SYSTEM_ERROR | 86,
396    GPG_ERR_ENOMSG = GPG_ERR_SYSTEM_ERROR | 87,
397    GPG_ERR_ENONET = GPG_ERR_SYSTEM_ERROR | 88,
398    GPG_ERR_ENOPKG = GPG_ERR_SYSTEM_ERROR | 89,
399    GPG_ERR_ENOPROTOOPT = GPG_ERR_SYSTEM_ERROR | 90,
400    GPG_ERR_ENOSPC = GPG_ERR_SYSTEM_ERROR | 91,
401    GPG_ERR_ENOSR = GPG_ERR_SYSTEM_ERROR | 92,
402    GPG_ERR_ENOSTR = GPG_ERR_SYSTEM_ERROR | 93,
403    GPG_ERR_ENOSYS = GPG_ERR_SYSTEM_ERROR | 94,
404    GPG_ERR_ENOTBLK = GPG_ERR_SYSTEM_ERROR | 95,
405    GPG_ERR_ENOTCONN = GPG_ERR_SYSTEM_ERROR | 96,
406    GPG_ERR_ENOTDIR = GPG_ERR_SYSTEM_ERROR | 97,
407    GPG_ERR_ENOTEMPTY = GPG_ERR_SYSTEM_ERROR | 98,
408    GPG_ERR_ENOTNAM = GPG_ERR_SYSTEM_ERROR | 99,
409    GPG_ERR_ENOTSOCK = GPG_ERR_SYSTEM_ERROR | 100,
410    GPG_ERR_ENOTSUP = GPG_ERR_SYSTEM_ERROR | 101,
411    GPG_ERR_ENOTTY = GPG_ERR_SYSTEM_ERROR | 102,
412    GPG_ERR_ENOTUNIQ = GPG_ERR_SYSTEM_ERROR | 103,
413    GPG_ERR_ENXIO = GPG_ERR_SYSTEM_ERROR | 104,
414    GPG_ERR_EOPNOTSUPP = GPG_ERR_SYSTEM_ERROR | 105,
415    GPG_ERR_EOVERFLOW = GPG_ERR_SYSTEM_ERROR | 106,
416    GPG_ERR_EPERM = GPG_ERR_SYSTEM_ERROR | 107,
417    GPG_ERR_EPFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 108,
418    GPG_ERR_EPIPE = GPG_ERR_SYSTEM_ERROR | 109,
419    GPG_ERR_EPROCLIM = GPG_ERR_SYSTEM_ERROR | 110,
420    GPG_ERR_EPROCUNAVAIL = GPG_ERR_SYSTEM_ERROR | 111,
421    GPG_ERR_EPROGMISMATCH = GPG_ERR_SYSTEM_ERROR | 112,
422    GPG_ERR_EPROGUNAVAIL = GPG_ERR_SYSTEM_ERROR | 113,
423    GPG_ERR_EPROTO = GPG_ERR_SYSTEM_ERROR | 114,
424    GPG_ERR_EPROTONOSUPPORT = GPG_ERR_SYSTEM_ERROR | 115,
425    GPG_ERR_EPROTOTYPE = GPG_ERR_SYSTEM_ERROR | 116,
426    GPG_ERR_ERANGE = GPG_ERR_SYSTEM_ERROR | 117,
427    GPG_ERR_EREMCHG = GPG_ERR_SYSTEM_ERROR | 118,
428    GPG_ERR_EREMOTE = GPG_ERR_SYSTEM_ERROR | 119,
429    GPG_ERR_EREMOTEIO = GPG_ERR_SYSTEM_ERROR | 120,
430    GPG_ERR_ERESTART = GPG_ERR_SYSTEM_ERROR | 121,
431    GPG_ERR_EROFS = GPG_ERR_SYSTEM_ERROR | 122,
432    GPG_ERR_ERPCMISMATCH = GPG_ERR_SYSTEM_ERROR | 123,
433    GPG_ERR_ESHUTDOWN = GPG_ERR_SYSTEM_ERROR | 124,
434    GPG_ERR_ESOCKTNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 125,
435    GPG_ERR_ESPIPE = GPG_ERR_SYSTEM_ERROR | 126,
436    GPG_ERR_ESRCH = GPG_ERR_SYSTEM_ERROR | 127,
437    GPG_ERR_ESRMNT = GPG_ERR_SYSTEM_ERROR | 128,
438    GPG_ERR_ESTALE = GPG_ERR_SYSTEM_ERROR | 129,
439    GPG_ERR_ESTRPIPE = GPG_ERR_SYSTEM_ERROR | 130,
440    GPG_ERR_ETIME = GPG_ERR_SYSTEM_ERROR | 131,
441    GPG_ERR_ETIMEDOUT = GPG_ERR_SYSTEM_ERROR | 132,
442    GPG_ERR_ETOOMANYREFS = GPG_ERR_SYSTEM_ERROR | 133,
443    GPG_ERR_ETXTBSY = GPG_ERR_SYSTEM_ERROR | 134,
444    GPG_ERR_EUCLEAN = GPG_ERR_SYSTEM_ERROR | 135,
445    GPG_ERR_EUNATCH = GPG_ERR_SYSTEM_ERROR | 136,
446    GPG_ERR_EUSERS = GPG_ERR_SYSTEM_ERROR | 137,
447    GPG_ERR_EWOULDBLOCK = GPG_ERR_SYSTEM_ERROR | 138,
448    GPG_ERR_EXDEV = GPG_ERR_SYSTEM_ERROR | 139,
449    GPG_ERR_EXFULL = GPG_ERR_SYSTEM_ERROR | 140,
450
451    /* This is one more than the largest allowed entry.  */
452    GPG_ERR_CODE_DIM = 65536
453  } gpg_err_code_t;
454
455
456/* The error value type gpg_error_t.  */
457
458/* We would really like to use bit-fields in a struct, but using
459   structs as return values can cause binary compatibility issues, in
460   particular if you want to do it effeciently (also see
461   -freg-struct-return option to GCC).  */
462typedef unsigned int gpg_error_t;
463
464/* We use the lowest 16 bits of gpg_error_t for error codes.  The 16th
465   bit indicates system errors.  */
466#define GPG_ERR_CODE_MASK	(GPG_ERR_CODE_DIM - 1)
467
468/* Bits 17 to 24 are reserved.  */
469
470/* We use the upper 8 bits of gpg_error_t for error sources.  */
471#define GPG_ERR_SOURCE_MASK	(GPG_ERR_SOURCE_DIM - 1)
472#define GPG_ERR_SOURCE_SHIFT	24
473
474
475/* Constructor and accessor functions.  */
476
477/* Construct an error value from an error code and source.  Within a
478   subsystem, use gpg_error.  */
479static GPG_ERR_INLINE gpg_error_t
480gpg_err_make (gpg_err_source_t source, gpg_err_code_t code)
481{
482  return code == GPG_ERR_NO_ERROR ? GPG_ERR_NO_ERROR
483    : (((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT)
484       | (code & GPG_ERR_CODE_MASK));
485}
486
487
488/* The user should define GPG_ERR_SOURCE_DEFAULT before including this
489   file to specify a default source for gpg_error.  */
490#ifndef GPG_ERR_SOURCE_DEFAULT
491#define GPG_ERR_SOURCE_DEFAULT	GPG_ERR_SOURCE_UNKNOWN
492#endif
493
494static GPG_ERR_INLINE gpg_error_t
495gpg_error (gpg_err_code_t code)
496{
497  return gpg_err_make (GPG_ERR_SOURCE_DEFAULT, code);
498}
499
500
501/* Retrieve the error code from an error value.  */
502static GPG_ERR_INLINE gpg_err_code_t
503gpg_err_code (gpg_error_t err)
504{
505  return (gpg_err_code_t) (err & GPG_ERR_CODE_MASK);
506}
507
508
509/* Retrieve the error source from an error value.  */
510static GPG_ERR_INLINE gpg_err_source_t
511gpg_err_source (gpg_error_t err)
512{
513  return (gpg_err_source_t) ((err >> GPG_ERR_SOURCE_SHIFT)
514			     & GPG_ERR_SOURCE_MASK);
515}
516
517
518/* String functions.  */
519
520/* Return a pointer to a string containing a description of the error
521   code in the error value ERR.  This function is not thread-safe.  */
522const char *gpg_strerror (gpg_error_t err);
523
524/* Return the error string for ERR in the user-supplied buffer BUF of
525   size BUFLEN.  This function is, in contrast to gpg_strerror,
526   thread-safe if a thread-safe strerror_r() function is provided by
527   the system.  If the function succeeds, 0 is returned and BUF
528   contains the string describing the error.  If the buffer was not
529   large enough, ERANGE is returned and BUF contains as much of the
530   beginning of the error string as fits into the buffer.  */
531int gpg_strerror_r (gpg_error_t err, char *buf, size_t buflen);
532
533/* Return a pointer to a string containing a description of the error
534   source in the error value ERR.  */
535const char *gpg_strsource (gpg_error_t err);
536
537
538/* Mapping of system errors (errno).  */
539
540/* Retrieve the error code for the system error ERR.  This returns
541   GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
542   this).  */
543gpg_err_code_t gpg_err_code_from_errno (int err);
544
545
546/* Retrieve the system error for the error code CODE.  This returns 0
547   if CODE is not a system error code.  */
548int gpg_err_code_to_errno (gpg_err_code_t code);
549
550
551/* Self-documenting convenience functions.  */
552
553static GPG_ERR_INLINE gpg_error_t
554gpg_err_make_from_errno (gpg_err_source_t source, int err)
555{
556  return gpg_err_make (source, gpg_err_code_from_errno (err));
557}
558
559
560static GPG_ERR_INLINE gpg_error_t
561gpg_error_from_errno (int err)
562{
563  return gpg_error (gpg_err_code_from_errno (err));
564}
565
566#ifdef __cplusplus
567}
568#endif
569
570#endif	/* GPG_ERROR_H */