Line data Source code
1 : /* gpg-error.h or gpgrt.h - Public interface to libgpg-error. -*- c -*-
2 : * Copyright (C) 2003-2004, 2010, 2013-2017 g10 Code GmbH
3 : *
4 : * This file is part of libgpg-error.
5 : *
6 : * libgpg-error is free software; you can redistribute it and/or
7 : * modify it under the terms of the GNU Lesser General Public License
8 : * as published by the Free Software Foundation; either version 2.1 of
9 : * the License, or (at your option) any later version.
10 : *
11 : * libgpg-error is distributed in the hope that it will be useful, but
12 : * WITHOUT ANY WARRANTY; without even the implied warranty of
13 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 : * Lesser General Public License for more details.
15 : *
16 : * You should have received a copy of the GNU Lesser General Public
17 : * License along with this program; if not, see <https://www.gnu.org/licenses/>.
18 : *
19 : * Do not edit. Generated from gpg-error.h.in for:
20 : x86_64-pc-linux-gnu
21 : */
22 :
23 : #ifndef GPG_ERROR_H
24 : #define GPG_ERROR_H 1
25 : #ifndef GPGRT_H
26 : #define GPGRT_H 1
27 :
28 : #include <stddef.h>
29 : #include <stdio.h>
30 : #include <stdarg.h>
31 :
32 : /* The version string of this header. */
33 : #define GPG_ERROR_VERSION "1.28"
34 : #define GPGRT_VERSION "1.28"
35 :
36 : /* The version number of this header. */
37 : #define GPG_ERROR_VERSION_NUMBER 0x011c00
38 : #define GPGRT_VERSION_NUMBER 0x011c00
39 :
40 :
41 : #ifdef __GNUC__
42 : # define GPG_ERR_INLINE __inline__
43 : #elif defined(_MSC_VER) && _MSC_VER >= 1300
44 : # define GPG_ERR_INLINE __inline
45 : #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
46 : # define GPG_ERR_INLINE inline
47 : #else
48 : # ifndef GPG_ERR_INLINE
49 : # define GPG_ERR_INLINE
50 : # endif
51 : #endif
52 :
53 : #ifdef __cplusplus
54 : extern "C" {
55 : #if 0 /* just to make Emacs auto-indent happy */
56 : }
57 : #endif
58 : #endif /* __cplusplus */
59 :
60 : /* The GnuPG project consists of many components. Error codes are
61 : exchanged between all components. The common error codes and their
62 : user-presentable descriptions are kept into a shared library to
63 : allow adding new error codes and components without recompiling any
64 : of the other components. The interface will not change in a
65 : backward incompatible way.
66 :
67 : An error code together with an error source build up an error
68 : value. As the error value is been passed from one component to
69 : another, it preserver the information about the source and nature
70 : of the error.
71 :
72 : A component of the GnuPG project can define the following macros to
73 : tune the behaviour of the library:
74 :
75 : GPG_ERR_SOURCE_DEFAULT: Define to an error source of type
76 : gpg_err_source_t to make that source the default for gpg_error().
77 : Otherwise GPG_ERR_SOURCE_UNKNOWN is used as default.
78 :
79 : GPG_ERR_ENABLE_GETTEXT_MACROS: Define to provide macros to map the
80 : internal gettext API to standard names. This has only an effect on
81 : Windows platforms.
82 :
83 : GPGRT_ENABLE_ES_MACROS: Define to provide "es_" macros for the
84 : estream functions.
85 :
86 : In addition to the error codes, Libgpg-error also provides a set of
87 : functions used by most GnuPG components. */
88 :
89 :
90 : /* The error source type gpg_err_source_t.
91 :
92 : Where as the Poo out of a welle small
93 : Taketh his firste springing and his sours.
94 : --Chaucer. */
95 :
96 : /* Only use free slots, never change or reorder the existing
97 : entries. */
98 : typedef enum
99 : {
100 : GPG_ERR_SOURCE_UNKNOWN = 0,
101 : GPG_ERR_SOURCE_GCRYPT = 1,
102 : GPG_ERR_SOURCE_GPG = 2,
103 : GPG_ERR_SOURCE_GPGSM = 3,
104 : GPG_ERR_SOURCE_GPGAGENT = 4,
105 : GPG_ERR_SOURCE_PINENTRY = 5,
106 : GPG_ERR_SOURCE_SCD = 6,
107 : GPG_ERR_SOURCE_GPGME = 7,
108 : GPG_ERR_SOURCE_KEYBOX = 8,
109 : GPG_ERR_SOURCE_KSBA = 9,
110 : GPG_ERR_SOURCE_DIRMNGR = 10,
111 : GPG_ERR_SOURCE_GSTI = 11,
112 : GPG_ERR_SOURCE_GPA = 12,
113 : GPG_ERR_SOURCE_KLEO = 13,
114 : GPG_ERR_SOURCE_G13 = 14,
115 : GPG_ERR_SOURCE_ASSUAN = 15,
116 : GPG_ERR_SOURCE_TLS = 17,
117 : GPG_ERR_SOURCE_ANY = 31,
118 : GPG_ERR_SOURCE_USER_1 = 32,
119 : GPG_ERR_SOURCE_USER_2 = 33,
120 : GPG_ERR_SOURCE_USER_3 = 34,
121 : GPG_ERR_SOURCE_USER_4 = 35,
122 :
123 : /* This is one more than the largest allowed entry. */
124 : GPG_ERR_SOURCE_DIM = 128
125 : } gpg_err_source_t;
126 :
127 :
128 : /* The error code type gpg_err_code_t. */
129 :
130 : /* Only use free slots, never change or reorder the existing
131 : entries. */
132 : typedef enum
133 : {
134 : GPG_ERR_NO_ERROR = 0,
135 : GPG_ERR_GENERAL = 1,
136 : GPG_ERR_UNKNOWN_PACKET = 2,
137 : GPG_ERR_UNKNOWN_VERSION = 3,
138 : GPG_ERR_PUBKEY_ALGO = 4,
139 : GPG_ERR_DIGEST_ALGO = 5,
140 : GPG_ERR_BAD_PUBKEY = 6,
141 : GPG_ERR_BAD_SECKEY = 7,
142 : GPG_ERR_BAD_SIGNATURE = 8,
143 : GPG_ERR_NO_PUBKEY = 9,
144 : GPG_ERR_CHECKSUM = 10,
145 : GPG_ERR_BAD_PASSPHRASE = 11,
146 : GPG_ERR_CIPHER_ALGO = 12,
147 : GPG_ERR_KEYRING_OPEN = 13,
148 : GPG_ERR_INV_PACKET = 14,
149 : GPG_ERR_INV_ARMOR = 15,
150 : GPG_ERR_NO_USER_ID = 16,
151 : GPG_ERR_NO_SECKEY = 17,
152 : GPG_ERR_WRONG_SECKEY = 18,
153 : GPG_ERR_BAD_KEY = 19,
154 : GPG_ERR_COMPR_ALGO = 20,
155 : GPG_ERR_NO_PRIME = 21,
156 : GPG_ERR_NO_ENCODING_METHOD = 22,
157 : GPG_ERR_NO_ENCRYPTION_SCHEME = 23,
158 : GPG_ERR_NO_SIGNATURE_SCHEME = 24,
159 : GPG_ERR_INV_ATTR = 25,
160 : GPG_ERR_NO_VALUE = 26,
161 : GPG_ERR_NOT_FOUND = 27,
162 : GPG_ERR_VALUE_NOT_FOUND = 28,
163 : GPG_ERR_SYNTAX = 29,
164 : GPG_ERR_BAD_MPI = 30,
165 : GPG_ERR_INV_PASSPHRASE = 31,
166 : GPG_ERR_SIG_CLASS = 32,
167 : GPG_ERR_RESOURCE_LIMIT = 33,
168 : GPG_ERR_INV_KEYRING = 34,
169 : GPG_ERR_TRUSTDB = 35,
170 : GPG_ERR_BAD_CERT = 36,
171 : GPG_ERR_INV_USER_ID = 37,
172 : GPG_ERR_UNEXPECTED = 38,
173 : GPG_ERR_TIME_CONFLICT = 39,
174 : GPG_ERR_KEYSERVER = 40,
175 : GPG_ERR_WRONG_PUBKEY_ALGO = 41,
176 : GPG_ERR_TRIBUTE_TO_D_A = 42,
177 : GPG_ERR_WEAK_KEY = 43,
178 : GPG_ERR_INV_KEYLEN = 44,
179 : GPG_ERR_INV_ARG = 45,
180 : GPG_ERR_BAD_URI = 46,
181 : GPG_ERR_INV_URI = 47,
182 : GPG_ERR_NETWORK = 48,
183 : GPG_ERR_UNKNOWN_HOST = 49,
184 : GPG_ERR_SELFTEST_FAILED = 50,
185 : GPG_ERR_NOT_ENCRYPTED = 51,
186 : GPG_ERR_NOT_PROCESSED = 52,
187 : GPG_ERR_UNUSABLE_PUBKEY = 53,
188 : GPG_ERR_UNUSABLE_SECKEY = 54,
189 : GPG_ERR_INV_VALUE = 55,
190 : GPG_ERR_BAD_CERT_CHAIN = 56,
191 : GPG_ERR_MISSING_CERT = 57,
192 : GPG_ERR_NO_DATA = 58,
193 : GPG_ERR_BUG = 59,
194 : GPG_ERR_NOT_SUPPORTED = 60,
195 : GPG_ERR_INV_OP = 61,
196 : GPG_ERR_TIMEOUT = 62,
197 : GPG_ERR_INTERNAL = 63,
198 : GPG_ERR_EOF_GCRYPT = 64,
199 : GPG_ERR_INV_OBJ = 65,
200 : GPG_ERR_TOO_SHORT = 66,
201 : GPG_ERR_TOO_LARGE = 67,
202 : GPG_ERR_NO_OBJ = 68,
203 : GPG_ERR_NOT_IMPLEMENTED = 69,
204 : GPG_ERR_CONFLICT = 70,
205 : GPG_ERR_INV_CIPHER_MODE = 71,
206 : GPG_ERR_INV_FLAG = 72,
207 : GPG_ERR_INV_HANDLE = 73,
208 : GPG_ERR_TRUNCATED = 74,
209 : GPG_ERR_INCOMPLETE_LINE = 75,
210 : GPG_ERR_INV_RESPONSE = 76,
211 : GPG_ERR_NO_AGENT = 77,
212 : GPG_ERR_AGENT = 78,
213 : GPG_ERR_INV_DATA = 79,
214 : GPG_ERR_ASSUAN_SERVER_FAULT = 80,
215 : GPG_ERR_ASSUAN = 81,
216 : GPG_ERR_INV_SESSION_KEY = 82,
217 : GPG_ERR_INV_SEXP = 83,
218 : GPG_ERR_UNSUPPORTED_ALGORITHM = 84,
219 : GPG_ERR_NO_PIN_ENTRY = 85,
220 : GPG_ERR_PIN_ENTRY = 86,
221 : GPG_ERR_BAD_PIN = 87,
222 : GPG_ERR_INV_NAME = 88,
223 : GPG_ERR_BAD_DATA = 89,
224 : GPG_ERR_INV_PARAMETER = 90,
225 : GPG_ERR_WRONG_CARD = 91,
226 : GPG_ERR_NO_DIRMNGR = 92,
227 : GPG_ERR_DIRMNGR = 93,
228 : GPG_ERR_CERT_REVOKED = 94,
229 : GPG_ERR_NO_CRL_KNOWN = 95,
230 : GPG_ERR_CRL_TOO_OLD = 96,
231 : GPG_ERR_LINE_TOO_LONG = 97,
232 : GPG_ERR_NOT_TRUSTED = 98,
233 : GPG_ERR_CANCELED = 99,
234 : GPG_ERR_BAD_CA_CERT = 100,
235 : GPG_ERR_CERT_EXPIRED = 101,
236 : GPG_ERR_CERT_TOO_YOUNG = 102,
237 : GPG_ERR_UNSUPPORTED_CERT = 103,
238 : GPG_ERR_UNKNOWN_SEXP = 104,
239 : GPG_ERR_UNSUPPORTED_PROTECTION = 105,
240 : GPG_ERR_CORRUPTED_PROTECTION = 106,
241 : GPG_ERR_AMBIGUOUS_NAME = 107,
242 : GPG_ERR_CARD = 108,
243 : GPG_ERR_CARD_RESET = 109,
244 : GPG_ERR_CARD_REMOVED = 110,
245 : GPG_ERR_INV_CARD = 111,
246 : GPG_ERR_CARD_NOT_PRESENT = 112,
247 : GPG_ERR_NO_PKCS15_APP = 113,
248 : GPG_ERR_NOT_CONFIRMED = 114,
249 : GPG_ERR_CONFIGURATION = 115,
250 : GPG_ERR_NO_POLICY_MATCH = 116,
251 : GPG_ERR_INV_INDEX = 117,
252 : GPG_ERR_INV_ID = 118,
253 : GPG_ERR_NO_SCDAEMON = 119,
254 : GPG_ERR_SCDAEMON = 120,
255 : GPG_ERR_UNSUPPORTED_PROTOCOL = 121,
256 : GPG_ERR_BAD_PIN_METHOD = 122,
257 : GPG_ERR_CARD_NOT_INITIALIZED = 123,
258 : GPG_ERR_UNSUPPORTED_OPERATION = 124,
259 : GPG_ERR_WRONG_KEY_USAGE = 125,
260 : GPG_ERR_NOTHING_FOUND = 126,
261 : GPG_ERR_WRONG_BLOB_TYPE = 127,
262 : GPG_ERR_MISSING_VALUE = 128,
263 : GPG_ERR_HARDWARE = 129,
264 : GPG_ERR_PIN_BLOCKED = 130,
265 : GPG_ERR_USE_CONDITIONS = 131,
266 : GPG_ERR_PIN_NOT_SYNCED = 132,
267 : GPG_ERR_INV_CRL = 133,
268 : GPG_ERR_BAD_BER = 134,
269 : GPG_ERR_INV_BER = 135,
270 : GPG_ERR_ELEMENT_NOT_FOUND = 136,
271 : GPG_ERR_IDENTIFIER_NOT_FOUND = 137,
272 : GPG_ERR_INV_TAG = 138,
273 : GPG_ERR_INV_LENGTH = 139,
274 : GPG_ERR_INV_KEYINFO = 140,
275 : GPG_ERR_UNEXPECTED_TAG = 141,
276 : GPG_ERR_NOT_DER_ENCODED = 142,
277 : GPG_ERR_NO_CMS_OBJ = 143,
278 : GPG_ERR_INV_CMS_OBJ = 144,
279 : GPG_ERR_UNKNOWN_CMS_OBJ = 145,
280 : GPG_ERR_UNSUPPORTED_CMS_OBJ = 146,
281 : GPG_ERR_UNSUPPORTED_ENCODING = 147,
282 : GPG_ERR_UNSUPPORTED_CMS_VERSION = 148,
283 : GPG_ERR_UNKNOWN_ALGORITHM = 149,
284 : GPG_ERR_INV_ENGINE = 150,
285 : GPG_ERR_PUBKEY_NOT_TRUSTED = 151,
286 : GPG_ERR_DECRYPT_FAILED = 152,
287 : GPG_ERR_KEY_EXPIRED = 153,
288 : GPG_ERR_SIG_EXPIRED = 154,
289 : GPG_ERR_ENCODING_PROBLEM = 155,
290 : GPG_ERR_INV_STATE = 156,
291 : GPG_ERR_DUP_VALUE = 157,
292 : GPG_ERR_MISSING_ACTION = 158,
293 : GPG_ERR_MODULE_NOT_FOUND = 159,
294 : GPG_ERR_INV_OID_STRING = 160,
295 : GPG_ERR_INV_TIME = 161,
296 : GPG_ERR_INV_CRL_OBJ = 162,
297 : GPG_ERR_UNSUPPORTED_CRL_VERSION = 163,
298 : GPG_ERR_INV_CERT_OBJ = 164,
299 : GPG_ERR_UNKNOWN_NAME = 165,
300 : GPG_ERR_LOCALE_PROBLEM = 166,
301 : GPG_ERR_NOT_LOCKED = 167,
302 : GPG_ERR_PROTOCOL_VIOLATION = 168,
303 : GPG_ERR_INV_MAC = 169,
304 : GPG_ERR_INV_REQUEST = 170,
305 : GPG_ERR_UNKNOWN_EXTN = 171,
306 : GPG_ERR_UNKNOWN_CRIT_EXTN = 172,
307 : GPG_ERR_LOCKED = 173,
308 : GPG_ERR_UNKNOWN_OPTION = 174,
309 : GPG_ERR_UNKNOWN_COMMAND = 175,
310 : GPG_ERR_NOT_OPERATIONAL = 176,
311 : GPG_ERR_NO_PASSPHRASE = 177,
312 : GPG_ERR_NO_PIN = 178,
313 : GPG_ERR_NOT_ENABLED = 179,
314 : GPG_ERR_NO_ENGINE = 180,
315 : GPG_ERR_MISSING_KEY = 181,
316 : GPG_ERR_TOO_MANY = 182,
317 : GPG_ERR_LIMIT_REACHED = 183,
318 : GPG_ERR_NOT_INITIALIZED = 184,
319 : GPG_ERR_MISSING_ISSUER_CERT = 185,
320 : GPG_ERR_NO_KEYSERVER = 186,
321 : GPG_ERR_INV_CURVE = 187,
322 : GPG_ERR_UNKNOWN_CURVE = 188,
323 : GPG_ERR_DUP_KEY = 189,
324 : GPG_ERR_AMBIGUOUS = 190,
325 : GPG_ERR_NO_CRYPT_CTX = 191,
326 : GPG_ERR_WRONG_CRYPT_CTX = 192,
327 : GPG_ERR_BAD_CRYPT_CTX = 193,
328 : GPG_ERR_CRYPT_CTX_CONFLICT = 194,
329 : GPG_ERR_BROKEN_PUBKEY = 195,
330 : GPG_ERR_BROKEN_SECKEY = 196,
331 : GPG_ERR_MAC_ALGO = 197,
332 : GPG_ERR_FULLY_CANCELED = 198,
333 : GPG_ERR_UNFINISHED = 199,
334 : GPG_ERR_BUFFER_TOO_SHORT = 200,
335 : GPG_ERR_SEXP_INV_LEN_SPEC = 201,
336 : GPG_ERR_SEXP_STRING_TOO_LONG = 202,
337 : GPG_ERR_SEXP_UNMATCHED_PAREN = 203,
338 : GPG_ERR_SEXP_NOT_CANONICAL = 204,
339 : GPG_ERR_SEXP_BAD_CHARACTER = 205,
340 : GPG_ERR_SEXP_BAD_QUOTATION = 206,
341 : GPG_ERR_SEXP_ZERO_PREFIX = 207,
342 : GPG_ERR_SEXP_NESTED_DH = 208,
343 : GPG_ERR_SEXP_UNMATCHED_DH = 209,
344 : GPG_ERR_SEXP_UNEXPECTED_PUNC = 210,
345 : GPG_ERR_SEXP_BAD_HEX_CHAR = 211,
346 : GPG_ERR_SEXP_ODD_HEX_NUMBERS = 212,
347 : GPG_ERR_SEXP_BAD_OCT_CHAR = 213,
348 : GPG_ERR_SUBKEYS_EXP_OR_REV = 217,
349 : GPG_ERR_DB_CORRUPTED = 218,
350 : GPG_ERR_SERVER_FAILED = 219,
351 : GPG_ERR_NO_NAME = 220,
352 : GPG_ERR_NO_KEY = 221,
353 : GPG_ERR_LEGACY_KEY = 222,
354 : GPG_ERR_REQUEST_TOO_SHORT = 223,
355 : GPG_ERR_REQUEST_TOO_LONG = 224,
356 : GPG_ERR_OBJ_TERM_STATE = 225,
357 : GPG_ERR_NO_CERT_CHAIN = 226,
358 : GPG_ERR_CERT_TOO_LARGE = 227,
359 : GPG_ERR_INV_RECORD = 228,
360 : GPG_ERR_BAD_MAC = 229,
361 : GPG_ERR_UNEXPECTED_MSG = 230,
362 : GPG_ERR_COMPR_FAILED = 231,
363 : GPG_ERR_WOULD_WRAP = 232,
364 : GPG_ERR_FATAL_ALERT = 233,
365 : GPG_ERR_NO_CIPHER = 234,
366 : GPG_ERR_MISSING_CLIENT_CERT = 235,
367 : GPG_ERR_CLOSE_NOTIFY = 236,
368 : GPG_ERR_TICKET_EXPIRED = 237,
369 : GPG_ERR_BAD_TICKET = 238,
370 : GPG_ERR_UNKNOWN_IDENTITY = 239,
371 : GPG_ERR_BAD_HS_CERT = 240,
372 : GPG_ERR_BAD_HS_CERT_REQ = 241,
373 : GPG_ERR_BAD_HS_CERT_VER = 242,
374 : GPG_ERR_BAD_HS_CHANGE_CIPHER = 243,
375 : GPG_ERR_BAD_HS_CLIENT_HELLO = 244,
376 : GPG_ERR_BAD_HS_SERVER_HELLO = 245,
377 : GPG_ERR_BAD_HS_SERVER_HELLO_DONE = 246,
378 : GPG_ERR_BAD_HS_FINISHED = 247,
379 : GPG_ERR_BAD_HS_SERVER_KEX = 248,
380 : GPG_ERR_BAD_HS_CLIENT_KEX = 249,
381 : GPG_ERR_BOGUS_STRING = 250,
382 : GPG_ERR_FORBIDDEN = 251,
383 : GPG_ERR_KEY_DISABLED = 252,
384 : GPG_ERR_KEY_ON_CARD = 253,
385 : GPG_ERR_INV_LOCK_OBJ = 254,
386 : GPG_ERR_TRUE = 255,
387 : GPG_ERR_FALSE = 256,
388 : GPG_ERR_ASS_GENERAL = 257,
389 : GPG_ERR_ASS_ACCEPT_FAILED = 258,
390 : GPG_ERR_ASS_CONNECT_FAILED = 259,
391 : GPG_ERR_ASS_INV_RESPONSE = 260,
392 : GPG_ERR_ASS_INV_VALUE = 261,
393 : GPG_ERR_ASS_INCOMPLETE_LINE = 262,
394 : GPG_ERR_ASS_LINE_TOO_LONG = 263,
395 : GPG_ERR_ASS_NESTED_COMMANDS = 264,
396 : GPG_ERR_ASS_NO_DATA_CB = 265,
397 : GPG_ERR_ASS_NO_INQUIRE_CB = 266,
398 : GPG_ERR_ASS_NOT_A_SERVER = 267,
399 : GPG_ERR_ASS_NOT_A_CLIENT = 268,
400 : GPG_ERR_ASS_SERVER_START = 269,
401 : GPG_ERR_ASS_READ_ERROR = 270,
402 : GPG_ERR_ASS_WRITE_ERROR = 271,
403 : GPG_ERR_ASS_TOO_MUCH_DATA = 273,
404 : GPG_ERR_ASS_UNEXPECTED_CMD = 274,
405 : GPG_ERR_ASS_UNKNOWN_CMD = 275,
406 : GPG_ERR_ASS_SYNTAX = 276,
407 : GPG_ERR_ASS_CANCELED = 277,
408 : GPG_ERR_ASS_NO_INPUT = 278,
409 : GPG_ERR_ASS_NO_OUTPUT = 279,
410 : GPG_ERR_ASS_PARAMETER = 280,
411 : GPG_ERR_ASS_UNKNOWN_INQUIRE = 281,
412 : GPG_ERR_ENGINE_TOO_OLD = 300,
413 : GPG_ERR_WINDOW_TOO_SMALL = 301,
414 : GPG_ERR_WINDOW_TOO_LARGE = 302,
415 : GPG_ERR_MISSING_ENVVAR = 303,
416 : GPG_ERR_USER_ID_EXISTS = 304,
417 : GPG_ERR_NAME_EXISTS = 305,
418 : GPG_ERR_DUP_NAME = 306,
419 : GPG_ERR_TOO_YOUNG = 307,
420 : GPG_ERR_TOO_OLD = 308,
421 : GPG_ERR_UNKNOWN_FLAG = 309,
422 : GPG_ERR_INV_ORDER = 310,
423 : GPG_ERR_ALREADY_FETCHED = 311,
424 : GPG_ERR_TRY_LATER = 312,
425 : GPG_ERR_WRONG_NAME = 313,
426 : GPG_ERR_SYSTEM_BUG = 666,
427 : GPG_ERR_DNS_UNKNOWN = 711,
428 : GPG_ERR_DNS_SECTION = 712,
429 : GPG_ERR_DNS_ADDRESS = 713,
430 : GPG_ERR_DNS_NO_QUERY = 714,
431 : GPG_ERR_DNS_NO_ANSWER = 715,
432 : GPG_ERR_DNS_CLOSED = 716,
433 : GPG_ERR_DNS_VERIFY = 717,
434 : GPG_ERR_DNS_TIMEOUT = 718,
435 : GPG_ERR_LDAP_GENERAL = 721,
436 : GPG_ERR_LDAP_ATTR_GENERAL = 722,
437 : GPG_ERR_LDAP_NAME_GENERAL = 723,
438 : GPG_ERR_LDAP_SECURITY_GENERAL = 724,
439 : GPG_ERR_LDAP_SERVICE_GENERAL = 725,
440 : GPG_ERR_LDAP_UPDATE_GENERAL = 726,
441 : GPG_ERR_LDAP_E_GENERAL = 727,
442 : GPG_ERR_LDAP_X_GENERAL = 728,
443 : GPG_ERR_LDAP_OTHER_GENERAL = 729,
444 : GPG_ERR_LDAP_X_CONNECTING = 750,
445 : GPG_ERR_LDAP_REFERRAL_LIMIT = 751,
446 : GPG_ERR_LDAP_CLIENT_LOOP = 752,
447 : GPG_ERR_LDAP_NO_RESULTS = 754,
448 : GPG_ERR_LDAP_CONTROL_NOT_FOUND = 755,
449 : GPG_ERR_LDAP_NOT_SUPPORTED = 756,
450 : GPG_ERR_LDAP_CONNECT = 757,
451 : GPG_ERR_LDAP_NO_MEMORY = 758,
452 : GPG_ERR_LDAP_PARAM = 759,
453 : GPG_ERR_LDAP_USER_CANCELLED = 760,
454 : GPG_ERR_LDAP_FILTER = 761,
455 : GPG_ERR_LDAP_AUTH_UNKNOWN = 762,
456 : GPG_ERR_LDAP_TIMEOUT = 763,
457 : GPG_ERR_LDAP_DECODING = 764,
458 : GPG_ERR_LDAP_ENCODING = 765,
459 : GPG_ERR_LDAP_LOCAL = 766,
460 : GPG_ERR_LDAP_SERVER_DOWN = 767,
461 : GPG_ERR_LDAP_SUCCESS = 768,
462 : GPG_ERR_LDAP_OPERATIONS = 769,
463 : GPG_ERR_LDAP_PROTOCOL = 770,
464 : GPG_ERR_LDAP_TIMELIMIT = 771,
465 : GPG_ERR_LDAP_SIZELIMIT = 772,
466 : GPG_ERR_LDAP_COMPARE_FALSE = 773,
467 : GPG_ERR_LDAP_COMPARE_TRUE = 774,
468 : GPG_ERR_LDAP_UNSUPPORTED_AUTH = 775,
469 : GPG_ERR_LDAP_STRONG_AUTH_RQRD = 776,
470 : GPG_ERR_LDAP_PARTIAL_RESULTS = 777,
471 : GPG_ERR_LDAP_REFERRAL = 778,
472 : GPG_ERR_LDAP_ADMINLIMIT = 779,
473 : GPG_ERR_LDAP_UNAVAIL_CRIT_EXTN = 780,
474 : GPG_ERR_LDAP_CONFIDENT_RQRD = 781,
475 : GPG_ERR_LDAP_SASL_BIND_INPROG = 782,
476 : GPG_ERR_LDAP_NO_SUCH_ATTRIBUTE = 784,
477 : GPG_ERR_LDAP_UNDEFINED_TYPE = 785,
478 : GPG_ERR_LDAP_BAD_MATCHING = 786,
479 : GPG_ERR_LDAP_CONST_VIOLATION = 787,
480 : GPG_ERR_LDAP_TYPE_VALUE_EXISTS = 788,
481 : GPG_ERR_LDAP_INV_SYNTAX = 789,
482 : GPG_ERR_LDAP_NO_SUCH_OBJ = 800,
483 : GPG_ERR_LDAP_ALIAS_PROBLEM = 801,
484 : GPG_ERR_LDAP_INV_DN_SYNTAX = 802,
485 : GPG_ERR_LDAP_IS_LEAF = 803,
486 : GPG_ERR_LDAP_ALIAS_DEREF = 804,
487 : GPG_ERR_LDAP_X_PROXY_AUTH_FAIL = 815,
488 : GPG_ERR_LDAP_BAD_AUTH = 816,
489 : GPG_ERR_LDAP_INV_CREDENTIALS = 817,
490 : GPG_ERR_LDAP_INSUFFICIENT_ACC = 818,
491 : GPG_ERR_LDAP_BUSY = 819,
492 : GPG_ERR_LDAP_UNAVAILABLE = 820,
493 : GPG_ERR_LDAP_UNWILL_TO_PERFORM = 821,
494 : GPG_ERR_LDAP_LOOP_DETECT = 822,
495 : GPG_ERR_LDAP_NAMING_VIOLATION = 832,
496 : GPG_ERR_LDAP_OBJ_CLS_VIOLATION = 833,
497 : GPG_ERR_LDAP_NOT_ALLOW_NONLEAF = 834,
498 : GPG_ERR_LDAP_NOT_ALLOW_ON_RDN = 835,
499 : GPG_ERR_LDAP_ALREADY_EXISTS = 836,
500 : GPG_ERR_LDAP_NO_OBJ_CLASS_MODS = 837,
501 : GPG_ERR_LDAP_RESULTS_TOO_LARGE = 838,
502 : GPG_ERR_LDAP_AFFECTS_MULT_DSAS = 839,
503 : GPG_ERR_LDAP_VLV = 844,
504 : GPG_ERR_LDAP_OTHER = 848,
505 : GPG_ERR_LDAP_CUP_RESOURCE_LIMIT = 881,
506 : GPG_ERR_LDAP_CUP_SEC_VIOLATION = 882,
507 : GPG_ERR_LDAP_CUP_INV_DATA = 883,
508 : GPG_ERR_LDAP_CUP_UNSUP_SCHEME = 884,
509 : GPG_ERR_LDAP_CUP_RELOAD = 885,
510 : GPG_ERR_LDAP_CANCELLED = 886,
511 : GPG_ERR_LDAP_NO_SUCH_OPERATION = 887,
512 : GPG_ERR_LDAP_TOO_LATE = 888,
513 : GPG_ERR_LDAP_CANNOT_CANCEL = 889,
514 : GPG_ERR_LDAP_ASSERTION_FAILED = 890,
515 : GPG_ERR_LDAP_PROX_AUTH_DENIED = 891,
516 : GPG_ERR_USER_1 = 1024,
517 : GPG_ERR_USER_2 = 1025,
518 : GPG_ERR_USER_3 = 1026,
519 : GPG_ERR_USER_4 = 1027,
520 : GPG_ERR_USER_5 = 1028,
521 : GPG_ERR_USER_6 = 1029,
522 : GPG_ERR_USER_7 = 1030,
523 : GPG_ERR_USER_8 = 1031,
524 : GPG_ERR_USER_9 = 1032,
525 : GPG_ERR_USER_10 = 1033,
526 : GPG_ERR_USER_11 = 1034,
527 : GPG_ERR_USER_12 = 1035,
528 : GPG_ERR_USER_13 = 1036,
529 : GPG_ERR_USER_14 = 1037,
530 : GPG_ERR_USER_15 = 1038,
531 : GPG_ERR_USER_16 = 1039,
532 : GPG_ERR_MISSING_ERRNO = 16381,
533 : GPG_ERR_UNKNOWN_ERRNO = 16382,
534 : GPG_ERR_EOF = 16383,
535 :
536 : /* The following error codes are used to map system errors. */
537 : #define GPG_ERR_SYSTEM_ERROR (1 << 15)
538 : GPG_ERR_E2BIG = GPG_ERR_SYSTEM_ERROR | 0,
539 : GPG_ERR_EACCES = GPG_ERR_SYSTEM_ERROR | 1,
540 : GPG_ERR_EADDRINUSE = GPG_ERR_SYSTEM_ERROR | 2,
541 : GPG_ERR_EADDRNOTAVAIL = GPG_ERR_SYSTEM_ERROR | 3,
542 : GPG_ERR_EADV = GPG_ERR_SYSTEM_ERROR | 4,
543 : GPG_ERR_EAFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 5,
544 : GPG_ERR_EAGAIN = GPG_ERR_SYSTEM_ERROR | 6,
545 : GPG_ERR_EALREADY = GPG_ERR_SYSTEM_ERROR | 7,
546 : GPG_ERR_EAUTH = GPG_ERR_SYSTEM_ERROR | 8,
547 : GPG_ERR_EBACKGROUND = GPG_ERR_SYSTEM_ERROR | 9,
548 : GPG_ERR_EBADE = GPG_ERR_SYSTEM_ERROR | 10,
549 : GPG_ERR_EBADF = GPG_ERR_SYSTEM_ERROR | 11,
550 : GPG_ERR_EBADFD = GPG_ERR_SYSTEM_ERROR | 12,
551 : GPG_ERR_EBADMSG = GPG_ERR_SYSTEM_ERROR | 13,
552 : GPG_ERR_EBADR = GPG_ERR_SYSTEM_ERROR | 14,
553 : GPG_ERR_EBADRPC = GPG_ERR_SYSTEM_ERROR | 15,
554 : GPG_ERR_EBADRQC = GPG_ERR_SYSTEM_ERROR | 16,
555 : GPG_ERR_EBADSLT = GPG_ERR_SYSTEM_ERROR | 17,
556 : GPG_ERR_EBFONT = GPG_ERR_SYSTEM_ERROR | 18,
557 : GPG_ERR_EBUSY = GPG_ERR_SYSTEM_ERROR | 19,
558 : GPG_ERR_ECANCELED = GPG_ERR_SYSTEM_ERROR | 20,
559 : GPG_ERR_ECHILD = GPG_ERR_SYSTEM_ERROR | 21,
560 : GPG_ERR_ECHRNG = GPG_ERR_SYSTEM_ERROR | 22,
561 : GPG_ERR_ECOMM = GPG_ERR_SYSTEM_ERROR | 23,
562 : GPG_ERR_ECONNABORTED = GPG_ERR_SYSTEM_ERROR | 24,
563 : GPG_ERR_ECONNREFUSED = GPG_ERR_SYSTEM_ERROR | 25,
564 : GPG_ERR_ECONNRESET = GPG_ERR_SYSTEM_ERROR | 26,
565 : GPG_ERR_ED = GPG_ERR_SYSTEM_ERROR | 27,
566 : GPG_ERR_EDEADLK = GPG_ERR_SYSTEM_ERROR | 28,
567 : GPG_ERR_EDEADLOCK = GPG_ERR_SYSTEM_ERROR | 29,
568 : GPG_ERR_EDESTADDRREQ = GPG_ERR_SYSTEM_ERROR | 30,
569 : GPG_ERR_EDIED = GPG_ERR_SYSTEM_ERROR | 31,
570 : GPG_ERR_EDOM = GPG_ERR_SYSTEM_ERROR | 32,
571 : GPG_ERR_EDOTDOT = GPG_ERR_SYSTEM_ERROR | 33,
572 : GPG_ERR_EDQUOT = GPG_ERR_SYSTEM_ERROR | 34,
573 : GPG_ERR_EEXIST = GPG_ERR_SYSTEM_ERROR | 35,
574 : GPG_ERR_EFAULT = GPG_ERR_SYSTEM_ERROR | 36,
575 : GPG_ERR_EFBIG = GPG_ERR_SYSTEM_ERROR | 37,
576 : GPG_ERR_EFTYPE = GPG_ERR_SYSTEM_ERROR | 38,
577 : GPG_ERR_EGRATUITOUS = GPG_ERR_SYSTEM_ERROR | 39,
578 : GPG_ERR_EGREGIOUS = GPG_ERR_SYSTEM_ERROR | 40,
579 : GPG_ERR_EHOSTDOWN = GPG_ERR_SYSTEM_ERROR | 41,
580 : GPG_ERR_EHOSTUNREACH = GPG_ERR_SYSTEM_ERROR | 42,
581 : GPG_ERR_EIDRM = GPG_ERR_SYSTEM_ERROR | 43,
582 : GPG_ERR_EIEIO = GPG_ERR_SYSTEM_ERROR | 44,
583 : GPG_ERR_EILSEQ = GPG_ERR_SYSTEM_ERROR | 45,
584 : GPG_ERR_EINPROGRESS = GPG_ERR_SYSTEM_ERROR | 46,
585 : GPG_ERR_EINTR = GPG_ERR_SYSTEM_ERROR | 47,
586 : GPG_ERR_EINVAL = GPG_ERR_SYSTEM_ERROR | 48,
587 : GPG_ERR_EIO = GPG_ERR_SYSTEM_ERROR | 49,
588 : GPG_ERR_EISCONN = GPG_ERR_SYSTEM_ERROR | 50,
589 : GPG_ERR_EISDIR = GPG_ERR_SYSTEM_ERROR | 51,
590 : GPG_ERR_EISNAM = GPG_ERR_SYSTEM_ERROR | 52,
591 : GPG_ERR_EL2HLT = GPG_ERR_SYSTEM_ERROR | 53,
592 : GPG_ERR_EL2NSYNC = GPG_ERR_SYSTEM_ERROR | 54,
593 : GPG_ERR_EL3HLT = GPG_ERR_SYSTEM_ERROR | 55,
594 : GPG_ERR_EL3RST = GPG_ERR_SYSTEM_ERROR | 56,
595 : GPG_ERR_ELIBACC = GPG_ERR_SYSTEM_ERROR | 57,
596 : GPG_ERR_ELIBBAD = GPG_ERR_SYSTEM_ERROR | 58,
597 : GPG_ERR_ELIBEXEC = GPG_ERR_SYSTEM_ERROR | 59,
598 : GPG_ERR_ELIBMAX = GPG_ERR_SYSTEM_ERROR | 60,
599 : GPG_ERR_ELIBSCN = GPG_ERR_SYSTEM_ERROR | 61,
600 : GPG_ERR_ELNRNG = GPG_ERR_SYSTEM_ERROR | 62,
601 : GPG_ERR_ELOOP = GPG_ERR_SYSTEM_ERROR | 63,
602 : GPG_ERR_EMEDIUMTYPE = GPG_ERR_SYSTEM_ERROR | 64,
603 : GPG_ERR_EMFILE = GPG_ERR_SYSTEM_ERROR | 65,
604 : GPG_ERR_EMLINK = GPG_ERR_SYSTEM_ERROR | 66,
605 : GPG_ERR_EMSGSIZE = GPG_ERR_SYSTEM_ERROR | 67,
606 : GPG_ERR_EMULTIHOP = GPG_ERR_SYSTEM_ERROR | 68,
607 : GPG_ERR_ENAMETOOLONG = GPG_ERR_SYSTEM_ERROR | 69,
608 : GPG_ERR_ENAVAIL = GPG_ERR_SYSTEM_ERROR | 70,
609 : GPG_ERR_ENEEDAUTH = GPG_ERR_SYSTEM_ERROR | 71,
610 : GPG_ERR_ENETDOWN = GPG_ERR_SYSTEM_ERROR | 72,
611 : GPG_ERR_ENETRESET = GPG_ERR_SYSTEM_ERROR | 73,
612 : GPG_ERR_ENETUNREACH = GPG_ERR_SYSTEM_ERROR | 74,
613 : GPG_ERR_ENFILE = GPG_ERR_SYSTEM_ERROR | 75,
614 : GPG_ERR_ENOANO = GPG_ERR_SYSTEM_ERROR | 76,
615 : GPG_ERR_ENOBUFS = GPG_ERR_SYSTEM_ERROR | 77,
616 : GPG_ERR_ENOCSI = GPG_ERR_SYSTEM_ERROR | 78,
617 : GPG_ERR_ENODATA = GPG_ERR_SYSTEM_ERROR | 79,
618 : GPG_ERR_ENODEV = GPG_ERR_SYSTEM_ERROR | 80,
619 : GPG_ERR_ENOENT = GPG_ERR_SYSTEM_ERROR | 81,
620 : GPG_ERR_ENOEXEC = GPG_ERR_SYSTEM_ERROR | 82,
621 : GPG_ERR_ENOLCK = GPG_ERR_SYSTEM_ERROR | 83,
622 : GPG_ERR_ENOLINK = GPG_ERR_SYSTEM_ERROR | 84,
623 : GPG_ERR_ENOMEDIUM = GPG_ERR_SYSTEM_ERROR | 85,
624 : GPG_ERR_ENOMEM = GPG_ERR_SYSTEM_ERROR | 86,
625 : GPG_ERR_ENOMSG = GPG_ERR_SYSTEM_ERROR | 87,
626 : GPG_ERR_ENONET = GPG_ERR_SYSTEM_ERROR | 88,
627 : GPG_ERR_ENOPKG = GPG_ERR_SYSTEM_ERROR | 89,
628 : GPG_ERR_ENOPROTOOPT = GPG_ERR_SYSTEM_ERROR | 90,
629 : GPG_ERR_ENOSPC = GPG_ERR_SYSTEM_ERROR | 91,
630 : GPG_ERR_ENOSR = GPG_ERR_SYSTEM_ERROR | 92,
631 : GPG_ERR_ENOSTR = GPG_ERR_SYSTEM_ERROR | 93,
632 : GPG_ERR_ENOSYS = GPG_ERR_SYSTEM_ERROR | 94,
633 : GPG_ERR_ENOTBLK = GPG_ERR_SYSTEM_ERROR | 95,
634 : GPG_ERR_ENOTCONN = GPG_ERR_SYSTEM_ERROR | 96,
635 : GPG_ERR_ENOTDIR = GPG_ERR_SYSTEM_ERROR | 97,
636 : GPG_ERR_ENOTEMPTY = GPG_ERR_SYSTEM_ERROR | 98,
637 : GPG_ERR_ENOTNAM = GPG_ERR_SYSTEM_ERROR | 99,
638 : GPG_ERR_ENOTSOCK = GPG_ERR_SYSTEM_ERROR | 100,
639 : GPG_ERR_ENOTSUP = GPG_ERR_SYSTEM_ERROR | 101,
640 : GPG_ERR_ENOTTY = GPG_ERR_SYSTEM_ERROR | 102,
641 : GPG_ERR_ENOTUNIQ = GPG_ERR_SYSTEM_ERROR | 103,
642 : GPG_ERR_ENXIO = GPG_ERR_SYSTEM_ERROR | 104,
643 : GPG_ERR_EOPNOTSUPP = GPG_ERR_SYSTEM_ERROR | 105,
644 : GPG_ERR_EOVERFLOW = GPG_ERR_SYSTEM_ERROR | 106,
645 : GPG_ERR_EPERM = GPG_ERR_SYSTEM_ERROR | 107,
646 : GPG_ERR_EPFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 108,
647 : GPG_ERR_EPIPE = GPG_ERR_SYSTEM_ERROR | 109,
648 : GPG_ERR_EPROCLIM = GPG_ERR_SYSTEM_ERROR | 110,
649 : GPG_ERR_EPROCUNAVAIL = GPG_ERR_SYSTEM_ERROR | 111,
650 : GPG_ERR_EPROGMISMATCH = GPG_ERR_SYSTEM_ERROR | 112,
651 : GPG_ERR_EPROGUNAVAIL = GPG_ERR_SYSTEM_ERROR | 113,
652 : GPG_ERR_EPROTO = GPG_ERR_SYSTEM_ERROR | 114,
653 : GPG_ERR_EPROTONOSUPPORT = GPG_ERR_SYSTEM_ERROR | 115,
654 : GPG_ERR_EPROTOTYPE = GPG_ERR_SYSTEM_ERROR | 116,
655 : GPG_ERR_ERANGE = GPG_ERR_SYSTEM_ERROR | 117,
656 : GPG_ERR_EREMCHG = GPG_ERR_SYSTEM_ERROR | 118,
657 : GPG_ERR_EREMOTE = GPG_ERR_SYSTEM_ERROR | 119,
658 : GPG_ERR_EREMOTEIO = GPG_ERR_SYSTEM_ERROR | 120,
659 : GPG_ERR_ERESTART = GPG_ERR_SYSTEM_ERROR | 121,
660 : GPG_ERR_EROFS = GPG_ERR_SYSTEM_ERROR | 122,
661 : GPG_ERR_ERPCMISMATCH = GPG_ERR_SYSTEM_ERROR | 123,
662 : GPG_ERR_ESHUTDOWN = GPG_ERR_SYSTEM_ERROR | 124,
663 : GPG_ERR_ESOCKTNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 125,
664 : GPG_ERR_ESPIPE = GPG_ERR_SYSTEM_ERROR | 126,
665 : GPG_ERR_ESRCH = GPG_ERR_SYSTEM_ERROR | 127,
666 : GPG_ERR_ESRMNT = GPG_ERR_SYSTEM_ERROR | 128,
667 : GPG_ERR_ESTALE = GPG_ERR_SYSTEM_ERROR | 129,
668 : GPG_ERR_ESTRPIPE = GPG_ERR_SYSTEM_ERROR | 130,
669 : GPG_ERR_ETIME = GPG_ERR_SYSTEM_ERROR | 131,
670 : GPG_ERR_ETIMEDOUT = GPG_ERR_SYSTEM_ERROR | 132,
671 : GPG_ERR_ETOOMANYREFS = GPG_ERR_SYSTEM_ERROR | 133,
672 : GPG_ERR_ETXTBSY = GPG_ERR_SYSTEM_ERROR | 134,
673 : GPG_ERR_EUCLEAN = GPG_ERR_SYSTEM_ERROR | 135,
674 : GPG_ERR_EUNATCH = GPG_ERR_SYSTEM_ERROR | 136,
675 : GPG_ERR_EUSERS = GPG_ERR_SYSTEM_ERROR | 137,
676 : GPG_ERR_EWOULDBLOCK = GPG_ERR_SYSTEM_ERROR | 138,
677 : GPG_ERR_EXDEV = GPG_ERR_SYSTEM_ERROR | 139,
678 : GPG_ERR_EXFULL = GPG_ERR_SYSTEM_ERROR | 140,
679 :
680 : /* This is one more than the largest allowed entry. */
681 : GPG_ERR_CODE_DIM = 65536
682 : } gpg_err_code_t;
683 :
684 :
685 : /* The error value type gpg_error_t. */
686 :
687 : /* We would really like to use bit-fields in a struct, but using
688 : structs as return values can cause binary compatibility issues, in
689 : particular if you want to do it efficiently (also see
690 : -freg-struct-return option to GCC). */
691 : typedef unsigned int gpg_error_t;
692 :
693 : /* We use the lowest 16 bits of gpg_error_t for error codes. The 16th
694 : bit indicates system errors. */
695 : #define GPG_ERR_CODE_MASK (GPG_ERR_CODE_DIM - 1)
696 :
697 : /* Bits 17 to 24 are reserved. */
698 :
699 : /* We use the upper 7 bits of gpg_error_t for error sources. */
700 : #define GPG_ERR_SOURCE_MASK (GPG_ERR_SOURCE_DIM - 1)
701 : #define GPG_ERR_SOURCE_SHIFT 24
702 :
703 : /* The highest bit is reserved. It shouldn't be used to prevent
704 : potential negative numbers when transmitting error values as
705 : text. */
706 :
707 :
708 : /* GCC feature test. */
709 : #if __GNUC__
710 : # define _GPG_ERR_GCC_VERSION (__GNUC__ * 10000 \
711 : + __GNUC_MINOR__ * 100 \
712 : + __GNUC_PATCHLEVEL__)
713 : #else
714 : # define _GPG_ERR_GCC_VERSION 0
715 : #endif
716 :
717 : #undef _GPG_ERR_HAVE_CONSTRUCTOR
718 : #if _GPG_ERR_GCC_VERSION > 30100
719 : # define _GPG_ERR_CONSTRUCTOR __attribute__ ((__constructor__))
720 : # define _GPG_ERR_HAVE_CONSTRUCTOR
721 : #else
722 : # define _GPG_ERR_CONSTRUCTOR
723 : #endif
724 :
725 : #define GPGRT_GCC_VERSION _GPG_ERR_GCC_VERSION
726 :
727 : #if _GPG_ERR_GCC_VERSION >= 29200
728 : # define _GPGRT__RESTRICT __restrict__
729 : #else
730 : # define _GPGRT__RESTRICT
731 : #endif
732 :
733 : /* The noreturn attribute. */
734 : #if _GPG_ERR_GCC_VERSION >= 20500
735 : # define GPGRT_ATTR_NORETURN __attribute__ ((noreturn))
736 : #else
737 : # define GPGRT_ATTR_NORETURN
738 : #endif
739 :
740 : /* The printf attributes. */
741 : #if _GPG_ERR_GCC_VERSION >= 40400
742 : # define GPGRT_ATTR_PRINTF(f, a) \
743 : __attribute__ ((format(__gnu_printf__,f,a)))
744 : # define GPGRT_ATTR_NR_PRINTF(f, a) \
745 : __attribute__ ((noreturn, format(__gnu_printf__,f,a)))
746 : #elif _GPG_ERR_GCC_VERSION >= 20500
747 : # define GPGRT_ATTR_PRINTF(f, a) \
748 : __attribute__ ((format(printf,f,a)))
749 : # define GPGRT_ATTR_NR_PRINTF(f, a) \
750 : __attribute__ ((noreturn, format(printf,f,a)))
751 : #else
752 : # define GPGRT_ATTR_PRINTF(f, a)
753 : # define GPGRT_ATTR_NR_PRINTF(f, a)
754 : #endif
755 : #if _GPG_ERR_GCC_VERSION >= 20800
756 : # define GPGRT_ATTR_FORMAT_ARG(a) __attribute__ ((__format_arg__ (a)))
757 : #else
758 : # define GPGRT_ATTR_FORMAT_ARG(a)
759 : #endif
760 :
761 : /* The sentinel attribute. */
762 : #if _GPG_ERR_GCC_VERSION >= 40000
763 : # define GPGRT_ATTR_SENTINEL(a) __attribute__ ((sentinel(a)))
764 : #else
765 : # define GPGRT_ATTR_SENTINEL(a)
766 : #endif
767 :
768 : /* The used and unused attributes.
769 : I am not sure since when the unused attribute is really supported.
770 : In any case it it only needed for gcc versions which print a
771 : warning. Thus let us require gcc >= 3.5. */
772 : #if _GPG_ERR_GCC_VERSION >= 40000
773 : # define GPGRT_ATTR_USED __attribute__ ((used))
774 : #else
775 : # define GPGRT_ATTR_USED
776 : #endif
777 : #if _GPG_ERR_GCC_VERSION >= 30500
778 : # define GPGRT_ATTR_UNUSED __attribute__ ((unused))
779 : #else
780 : # define GPGRT_ATTR_UNUSED
781 : #endif
782 :
783 : /* The deprecated attribute. */
784 : #if _GPG_ERR_GCC_VERSION >= 30100
785 : # define GPGRT_ATTR_DEPRECATED __attribute__ ((__deprecated__))
786 : #else
787 : # define GPGRT_ATTR_DEPRECATED
788 : #endif
789 :
790 : /* The pure attribute. */
791 : #if _GPG_ERR_GCC_VERSION >= 29600
792 : # define GPGRT_ATTR_PURE __attribute__ ((__pure__))
793 : #else
794 : # define GPGRT_ATTR_PURE
795 : #endif
796 :
797 : /* The malloc attribute. */
798 : #if _GPG_ERR_GCC_VERSION >= 30200
799 : # define GPGRT_ATTR_MALLOC __attribute__ ((__malloc__))
800 : #else
801 : # define GPGRT_ATTR_MALLOC
802 : #endif
803 :
804 : /* A macro defined if a GCC style __FUNCTION__ macro is available. */
805 : #undef GPGRT_HAVE_MACRO_FUNCTION
806 : #if _GPG_ERR_GCC_VERSION >= 20500
807 : # define GPGRT_HAVE_MACRO_FUNCTION 1
808 : #endif
809 :
810 : /* A macro defined if the pragma GCC push_options is available. */
811 : #undef GPGRT_HAVE_PRAGMA_GCC_PUSH
812 : #if _GPG_ERR_GCC_VERSION >= 40400
813 : # define GPGRT_HAVE_PRAGMA_GCC_PUSH 1
814 : #endif
815 :
816 : /* Detect LeakSanitizer (LSan) support for GCC and Clang based on
817 : * whether AddressSanitizer (ASAN) is enabled via -fsanitize=address).
818 : * Note that -fsanitize=leak just affect the linker options which
819 : * cannot be detected here. In that case you have to define the
820 : * GPGRT_HAVE_LEAK_SANITIZER macro manually. */
821 : #ifdef __GNUC__
822 : # ifdef __SANITIZE_ADDRESS__
823 : # define GPGRT_HAVE_LEAK_SANITIZER
824 : # elif defined(__has_feature)
825 : # if __has_feature(address_sanitizer)
826 : # define GPGRT_HAVE_LEAK_SANITIZER
827 : # endif
828 : # endif
829 : #endif
830 :
831 :
832 : /* The new name for the inline macro. */
833 : #define GPGRT_INLINE GPG_ERR_INLINE
834 :
835 : #ifdef GPGRT_HAVE_LEAK_SANITIZER
836 : # include <sanitizer/lsan_interface.h>
837 : #endif
838 :
839 : /* Mark heap objects as non-leaked memory. */
840 : static GPGRT_INLINE void
841 : gpgrt_annotate_leaked_object (const void *p)
842 : {
843 : #ifdef GPGRT_HAVE_LEAK_SANITIZER
844 : __lsan_ignore_object(p);
845 : #else
846 : (void)p;
847 : #endif
848 : }
849 :
850 :
851 : /* Initialization function. */
852 :
853 : /* Initialize the library. This function should be run early. */
854 : gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR;
855 :
856 : /* If this is defined, the library is already initialized by the
857 : constructor and does not need to be initialized explicitely. */
858 : #undef GPG_ERR_INITIALIZED
859 : #ifdef _GPG_ERR_HAVE_CONSTRUCTOR
860 : # define GPG_ERR_INITIALIZED 1
861 : # define gpgrt_init() do { gpg_err_init (); } while (0)
862 : #else
863 : # define gpgrt_init() do { ; } while (0)
864 : #endif
865 :
866 : /* See the source on how to use the deinit function; it is usually not
867 : required. */
868 : void gpg_err_deinit (int mode);
869 :
870 : /* Register blocking system I/O clamping functions. */
871 : void gpgrt_set_syscall_clamp (void (*pre)(void), void (*post)(void));
872 :
873 : /* Get current I/O clamping functions. */
874 : void gpgrt_get_syscall_clamp (void (**r_pre)(void), void (**r_post)(void));
875 :
876 : /* Register a custom malloc/realloc/free function. */
877 : void gpgrt_set_alloc_func (void *(*f)(void *a, size_t n));
878 :
879 :
880 :
881 : /* Constructor and accessor functions. */
882 :
883 : /* Construct an error value from an error code and source. Within a
884 : subsystem, use gpg_error. */
885 : static GPG_ERR_INLINE gpg_error_t
886 2615 : gpg_err_make (gpg_err_source_t source, gpg_err_code_t code)
887 : {
888 2 : return code == GPG_ERR_NO_ERROR ? GPG_ERR_NO_ERROR
889 5056 : : (((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT)
890 2443 : | (code & GPG_ERR_CODE_MASK));
891 : }
892 :
893 :
894 : /* The user should define GPG_ERR_SOURCE_DEFAULT before including this
895 : file to specify a default source for gpg_error. */
896 : #ifndef GPG_ERR_SOURCE_DEFAULT
897 : #define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_UNKNOWN
898 : #endif
899 :
900 : static GPG_ERR_INLINE gpg_error_t
901 2614 : gpg_error (gpg_err_code_t code)
902 : {
903 2624 : return gpg_err_make (GPG_ERR_SOURCE_DEFAULT, code);
904 : }
905 :
906 :
907 : /* Retrieve the error code from an error value. */
908 : static GPG_ERR_INLINE gpg_err_code_t
909 7960 : gpg_err_code (gpg_error_t err)
910 : {
911 8047 : return (gpg_err_code_t) (err & GPG_ERR_CODE_MASK);
912 : }
913 :
914 :
915 : /* Retrieve the error source from an error value. */
916 : static GPG_ERR_INLINE gpg_err_source_t
917 0 : gpg_err_source (gpg_error_t err)
918 : {
919 2 : return (gpg_err_source_t) ((err >> GPG_ERR_SOURCE_SHIFT)
920 0 : & GPG_ERR_SOURCE_MASK);
921 : }
922 :
923 :
924 : /* String functions. */
925 :
926 : /* Return a pointer to a string containing a description of the error
927 : code in the error value ERR. This function is not thread-safe. */
928 : const char *gpg_strerror (gpg_error_t err);
929 :
930 : /* Return the error string for ERR in the user-supplied buffer BUF of
931 : size BUFLEN. This function is, in contrast to gpg_strerror,
932 : thread-safe if a thread-safe strerror_r() function is provided by
933 : the system. If the function succeeds, 0 is returned and BUF
934 : contains the string describing the error. If the buffer was not
935 : large enough, ERANGE is returned and BUF contains as much of the
936 : beginning of the error string as fits into the buffer. */
937 : int gpg_strerror_r (gpg_error_t err, char *buf, size_t buflen);
938 :
939 : /* Return a pointer to a string containing a description of the error
940 : source in the error value ERR. */
941 : const char *gpg_strsource (gpg_error_t err);
942 :
943 :
944 : /* Mapping of system errors (errno). */
945 :
946 : /* Retrieve the error code for the system error ERR. This returns
947 : GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
948 : this). */
949 : gpg_err_code_t gpg_err_code_from_errno (int err);
950 :
951 :
952 : /* Retrieve the system error for the error code CODE. This returns 0
953 : if CODE is not a system error code. */
954 : int gpg_err_code_to_errno (gpg_err_code_t code);
955 :
956 :
957 : /* Retrieve the error code directly from the ERRNO variable. This
958 : returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped
959 : (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */
960 : gpg_err_code_t gpg_err_code_from_syserror (void);
961 :
962 :
963 : /* Set the ERRNO variable. This function is the preferred way to set
964 : ERRNO due to peculiarities on WindowsCE. */
965 : void gpg_err_set_errno (int err);
966 :
967 : /* Return or check the version. Both functions are identical. */
968 : const char *gpgrt_check_version (const char *req_version);
969 : const char *gpg_error_check_version (const char *req_version);
970 :
971 : /* System specific type definitions. */
972 : #include <sys/types.h>
973 : typedef ssize_t gpgrt_ssize_t;
974 :
975 : typedef long gpgrt_off_t;
976 :
977 :
978 :
979 :
980 : /* Self-documenting convenience functions. */
981 :
982 : static GPG_ERR_INLINE gpg_error_t
983 0 : gpg_err_make_from_errno (gpg_err_source_t source, int err)
984 : {
985 0 : return gpg_err_make (source, gpg_err_code_from_errno (err));
986 : }
987 :
988 :
989 : static GPG_ERR_INLINE gpg_error_t
990 : gpg_error_from_errno (int err)
991 : {
992 : return gpg_error (gpg_err_code_from_errno (err));
993 : }
994 :
995 : static GPG_ERR_INLINE gpg_error_t
996 656 : gpg_error_from_syserror (void)
997 : {
998 656 : return gpg_error (gpg_err_code_from_syserror ());
999 : }
1000 :
1001 :
1002 :
1003 : /* Lock functions. */
1004 :
1005 :
1006 : typedef struct
1007 : {
1008 : long _vers;
1009 : union {
1010 : volatile char _priv[40];
1011 : long _x_align;
1012 : long *_xp_align;
1013 : } u;
1014 : } gpgrt_lock_t;
1015 :
1016 : #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \
1017 : 0,0,0,0,0,0,0,0, \
1018 : 0,0,0,0,0,0,0,0, \
1019 : 0,0,0,0,0,0,0,0, \
1020 : 0,0,0,0,0,0,0,0}}}
1021 :
1022 :
1023 : #define GPGRT_LOCK_DEFINE(name) \
1024 : static gpgrt_lock_t name = GPGRT_LOCK_INITIALIZER
1025 :
1026 : /* NB: If GPGRT_LOCK_DEFINE is not used, zero out the lock variable
1027 : before passing it to gpgrt_lock_init. */
1028 : gpg_err_code_t gpgrt_lock_init (gpgrt_lock_t *lockhd);
1029 : gpg_err_code_t gpgrt_lock_lock (gpgrt_lock_t *lockhd);
1030 : gpg_err_code_t gpgrt_lock_trylock (gpgrt_lock_t *lockhd);
1031 : gpg_err_code_t gpgrt_lock_unlock (gpgrt_lock_t *lockhd);
1032 : gpg_err_code_t gpgrt_lock_destroy (gpgrt_lock_t *lockhd);
1033 :
1034 :
1035 :
1036 : /* Thread functions. */
1037 :
1038 : gpg_err_code_t gpgrt_yield (void);
1039 :
1040 :
1041 :
1042 :
1043 : /* Estream */
1044 :
1045 : /* The definition of this struct is entirely private. You must not
1046 : use it for anything. It is only here so some functions can be
1047 : implemented as macros. */
1048 : struct _gpgrt_stream_internal;
1049 : struct _gpgrt__stream
1050 : {
1051 : /* The layout of this struct must never change. It may be grown,
1052 : but only if all functions which access the new members are
1053 : versioned. */
1054 :
1055 : /* Various flags. */
1056 : struct {
1057 : unsigned int magic: 16;
1058 : unsigned int writing: 1;
1059 : unsigned int reserved: 15;
1060 : } flags;
1061 :
1062 : /* A pointer to the stream buffer. */
1063 : unsigned char *buffer;
1064 :
1065 : /* The size of the buffer in bytes. */
1066 : size_t buffer_size;
1067 :
1068 : /* The length of the usable data in the buffer, only valid when in
1069 : read mode (see flags). */
1070 : size_t data_len;
1071 :
1072 : /* The current position of the offset pointer, valid in read and
1073 : write mode. */
1074 : size_t data_offset;
1075 :
1076 : size_t data_flushed;
1077 : unsigned char *unread_buffer;
1078 : size_t unread_buffer_size;
1079 :
1080 : /* The number of unread bytes. */
1081 : size_t unread_data_len;
1082 :
1083 : /* A pointer to our internal data for this stream. */
1084 : struct _gpgrt_stream_internal *intern;
1085 : };
1086 :
1087 : /* The opaque type for an estream. */
1088 : typedef struct _gpgrt__stream *gpgrt_stream_t;
1089 : #ifdef GPGRT_ENABLE_ES_MACROS
1090 : typedef struct _gpgrt__stream *estream_t;
1091 : #endif
1092 :
1093 : typedef ssize_t (*gpgrt_cookie_read_function_t) (void *cookie,
1094 : void *buffer, size_t size);
1095 : typedef ssize_t (*gpgrt_cookie_write_function_t) (void *cookie,
1096 : const void *buffer,
1097 : size_t size);
1098 : typedef int (*gpgrt_cookie_seek_function_t) (void *cookie,
1099 : gpgrt_off_t *pos, int whence);
1100 : typedef int (*gpgrt_cookie_close_function_t) (void *cookie);
1101 :
1102 : struct _gpgrt_cookie_io_functions
1103 : {
1104 : gpgrt_cookie_read_function_t func_read;
1105 : gpgrt_cookie_write_function_t func_write;
1106 : gpgrt_cookie_seek_function_t func_seek;
1107 : gpgrt_cookie_close_function_t func_close;
1108 : };
1109 : typedef struct _gpgrt_cookie_io_functions gpgrt_cookie_io_functions_t;
1110 : #ifdef GPGRT_ENABLE_ES_MACROS
1111 : typedef struct _gpgrt_cookie_io_functions es_cookie_io_functions_t;
1112 : #define es_cookie_read_function_t gpgrt_cookie_read_function_t
1113 : #define es_cookie_write_function_t gpgrt_cookie_read_function_t
1114 : #define es_cookie_seek_function_t gpgrt_cookie_read_function_t
1115 : #define es_cookie_close_function_t gpgrt_cookie_read_function_t
1116 : #endif
1117 :
1118 : enum gpgrt_syshd_types
1119 : {
1120 : GPGRT_SYSHD_NONE = 0, /* No system handle available. */
1121 : GPGRT_SYSHD_FD = 1, /* A file descriptor as returned by open(). */
1122 : GPGRT_SYSHD_SOCK = 2, /* A socket as returned by socket(). */
1123 : GPGRT_SYSHD_RVID = 3, /* A rendezvous id (see libassuan's gpgcedev.c). */
1124 : GPGRT_SYSHD_HANDLE = 4 /* A HANDLE object (Windows). */
1125 : };
1126 :
1127 : struct _gpgrt_syshd
1128 : {
1129 : enum gpgrt_syshd_types type;
1130 : union {
1131 : int fd;
1132 : int sock;
1133 : int rvid;
1134 : void *handle;
1135 : } u;
1136 : };
1137 : typedef struct _gpgrt_syshd gpgrt_syshd_t;
1138 : #ifdef GPGRT_ENABLE_ES_MACROS
1139 : typedef struct _gpgrt_syshd es_syshd_t;
1140 : #define ES_SYSHD_NONE GPGRT_SYSHD_NONE
1141 : #define ES_SYSHD_FD GPGRT_SYSHD_FD
1142 : #define ES_SYSHD_SOCK GPGRT_SYSHD_SOCK
1143 : #define ES_SYSHD_RVID GPGRT_SYSHD_RVID
1144 : #define ES_SYSHD_HANDLE GPGRT_SYSHD_HANDLE
1145 : #endif
1146 :
1147 : /* The object used with gpgrt_poll. */
1148 : struct _gpgrt_poll_s
1149 : {
1150 : gpgrt_stream_t stream;
1151 : unsigned int want_read:1;
1152 : unsigned int want_write:1;
1153 : unsigned int want_oob:1;
1154 : unsigned int want_rdhup:1;
1155 : unsigned int _reserv1:4;
1156 : unsigned int got_read:1;
1157 : unsigned int got_write:1;
1158 : unsigned int got_oob:1;
1159 : unsigned int got_rdhup:1;
1160 : unsigned int _reserv2:4;
1161 : unsigned int got_err:1;
1162 : unsigned int got_hup:1;
1163 : unsigned int got_nval:1;
1164 : unsigned int _reserv3:4;
1165 : unsigned int ignore:1;
1166 : unsigned int user:8; /* For application use. */
1167 : };
1168 : typedef struct _gpgrt_poll_s gpgrt_poll_t;
1169 : #ifdef GPGRT_ENABLE_ES_MACROS
1170 : typedef struct _gpgrt_poll_s es_poll_t;
1171 : #endif
1172 :
1173 : gpgrt_stream_t gpgrt_fopen (const char *_GPGRT__RESTRICT path,
1174 : const char *_GPGRT__RESTRICT mode);
1175 : gpgrt_stream_t gpgrt_mopen (void *_GPGRT__RESTRICT data,
1176 : size_t data_n, size_t data_len,
1177 : unsigned int grow,
1178 : void *(*func_realloc) (void *mem, size_t size),
1179 : void (*func_free) (void *mem),
1180 : const char *_GPGRT__RESTRICT mode);
1181 : gpgrt_stream_t gpgrt_fopenmem (size_t memlimit,
1182 : const char *_GPGRT__RESTRICT mode);
1183 : gpgrt_stream_t gpgrt_fopenmem_init (size_t memlimit,
1184 : const char *_GPGRT__RESTRICT mode,
1185 : const void *data, size_t datalen);
1186 : gpgrt_stream_t gpgrt_fdopen (int filedes, const char *mode);
1187 : gpgrt_stream_t gpgrt_fdopen_nc (int filedes, const char *mode);
1188 : gpgrt_stream_t gpgrt_sysopen (gpgrt_syshd_t *syshd, const char *mode);
1189 : gpgrt_stream_t gpgrt_sysopen_nc (gpgrt_syshd_t *syshd, const char *mode);
1190 : gpgrt_stream_t gpgrt_fpopen (FILE *fp, const char *mode);
1191 : gpgrt_stream_t gpgrt_fpopen_nc (FILE *fp, const char *mode);
1192 : gpgrt_stream_t gpgrt_freopen (const char *_GPGRT__RESTRICT path,
1193 : const char *_GPGRT__RESTRICT mode,
1194 : gpgrt_stream_t _GPGRT__RESTRICT stream);
1195 : gpgrt_stream_t gpgrt_fopencookie (void *_GPGRT__RESTRICT cookie,
1196 : const char *_GPGRT__RESTRICT mode,
1197 : gpgrt_cookie_io_functions_t functions);
1198 : int gpgrt_fclose (gpgrt_stream_t stream);
1199 : int gpgrt_fclose_snatch (gpgrt_stream_t stream,
1200 : void **r_buffer, size_t *r_buflen);
1201 : int gpgrt_onclose (gpgrt_stream_t stream, int mode,
1202 : void (*fnc) (gpgrt_stream_t, void*), void *fnc_value);
1203 : int gpgrt_fileno (gpgrt_stream_t stream);
1204 : int gpgrt_fileno_unlocked (gpgrt_stream_t stream);
1205 : int gpgrt_syshd (gpgrt_stream_t stream, gpgrt_syshd_t *syshd);
1206 : int gpgrt_syshd_unlocked (gpgrt_stream_t stream, gpgrt_syshd_t *syshd);
1207 :
1208 : void _gpgrt_set_std_fd (int no, int fd);
1209 : gpgrt_stream_t _gpgrt_get_std_stream (int fd);
1210 :
1211 : #define gpgrt_stdin _gpgrt_get_std_stream (0)
1212 : #define gpgrt_stdout _gpgrt_get_std_stream (1)
1213 : #define gpgrt_stderr _gpgrt_get_std_stream (2)
1214 :
1215 :
1216 : void gpgrt_flockfile (gpgrt_stream_t stream);
1217 : int gpgrt_ftrylockfile (gpgrt_stream_t stream);
1218 : void gpgrt_funlockfile (gpgrt_stream_t stream);
1219 :
1220 : int gpgrt_feof (gpgrt_stream_t stream);
1221 : int gpgrt_feof_unlocked (gpgrt_stream_t stream);
1222 : int gpgrt_ferror (gpgrt_stream_t stream);
1223 : int gpgrt_ferror_unlocked (gpgrt_stream_t stream);
1224 : void gpgrt_clearerr (gpgrt_stream_t stream);
1225 : void gpgrt_clearerr_unlocked (gpgrt_stream_t stream);
1226 :
1227 : int _gpgrt_pending (gpgrt_stream_t stream); /* (private) */
1228 : int _gpgrt_pending_unlocked (gpgrt_stream_t stream); /* (private) */
1229 :
1230 : #define gpgrt_pending(stream) _gpgrt_pending (stream)
1231 :
1232 : #define gpgrt_pending_unlocked(stream) \
1233 : (((!(stream)->flags.writing) \
1234 : && (((stream)->data_offset < (stream)->data_len) \
1235 : || ((stream)->unread_data_len))) \
1236 : ? 1 : _gpgrt_pending_unlocked ((stream)))
1237 :
1238 : int gpgrt_fflush (gpgrt_stream_t stream);
1239 : int gpgrt_fseek (gpgrt_stream_t stream, long int offset, int whence);
1240 : int gpgrt_fseeko (gpgrt_stream_t stream, gpgrt_off_t offset, int whence);
1241 : long int gpgrt_ftell (gpgrt_stream_t stream);
1242 : gpgrt_off_t gpgrt_ftello (gpgrt_stream_t stream);
1243 : void gpgrt_rewind (gpgrt_stream_t stream);
1244 :
1245 : int gpgrt_fgetc (gpgrt_stream_t stream);
1246 : int gpgrt_fputc (int c, gpgrt_stream_t stream);
1247 :
1248 : int _gpgrt_getc_underflow (gpgrt_stream_t stream); /* (private) */
1249 : int _gpgrt_putc_overflow (int c, gpgrt_stream_t stream); /* (private) */
1250 :
1251 : #define gpgrt_getc_unlocked(stream) \
1252 : (((!(stream)->flags.writing) \
1253 : && ((stream)->data_offset < (stream)->data_len) \
1254 : && (! (stream)->unread_data_len)) \
1255 : ? ((int) (stream)->buffer[((stream)->data_offset)++]) \
1256 : : _gpgrt_getc_underflow ((stream)))
1257 :
1258 : #define gpgrt_putc_unlocked(c, stream) \
1259 : (((stream)->flags.writing \
1260 : && ((stream)->data_offset < (stream)->buffer_size) \
1261 : && (c != '\n')) \
1262 : ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c))) \
1263 : : _gpgrt_putc_overflow ((c), (stream)))
1264 :
1265 : #define gpgrt_getc(stream) gpgrt_fgetc (stream)
1266 : #define gpgrt_putc(c, stream) gpgrt_fputc (c, stream)
1267 :
1268 : int gpgrt_ungetc (int c, gpgrt_stream_t stream);
1269 :
1270 : int gpgrt_read (gpgrt_stream_t _GPGRT__RESTRICT stream,
1271 : void *_GPGRT__RESTRICT buffer, size_t bytes_to_read,
1272 : size_t *_GPGRT__RESTRICT bytes_read);
1273 : int gpgrt_write (gpgrt_stream_t _GPGRT__RESTRICT stream,
1274 : const void *_GPGRT__RESTRICT buffer, size_t bytes_to_write,
1275 : size_t *_GPGRT__RESTRICT bytes_written);
1276 : int gpgrt_write_sanitized (gpgrt_stream_t _GPGRT__RESTRICT stream,
1277 : const void *_GPGRT__RESTRICT buffer, size_t length,
1278 : const char *delimiters,
1279 : size_t *_GPGRT__RESTRICT bytes_written);
1280 : int gpgrt_write_hexstring (gpgrt_stream_t _GPGRT__RESTRICT stream,
1281 : const void *_GPGRT__RESTRICT buffer, size_t length,
1282 : int reserved,
1283 : size_t *_GPGRT__RESTRICT bytes_written);
1284 :
1285 : size_t gpgrt_fread (void *_GPGRT__RESTRICT ptr, size_t size, size_t nitems,
1286 : gpgrt_stream_t _GPGRT__RESTRICT stream);
1287 : size_t gpgrt_fwrite (const void *_GPGRT__RESTRICT ptr, size_t size, size_t memb,
1288 : gpgrt_stream_t _GPGRT__RESTRICT stream);
1289 :
1290 : char *gpgrt_fgets (char *_GPGRT__RESTRICT s, int n,
1291 : gpgrt_stream_t _GPGRT__RESTRICT stream);
1292 : int gpgrt_fputs (const char *_GPGRT__RESTRICT s,
1293 : gpgrt_stream_t _GPGRT__RESTRICT stream);
1294 : int gpgrt_fputs_unlocked (const char *_GPGRT__RESTRICT s,
1295 : gpgrt_stream_t _GPGRT__RESTRICT stream);
1296 :
1297 : ssize_t gpgrt_getline (char *_GPGRT__RESTRICT *_GPGRT__RESTRICT lineptr,
1298 : size_t *_GPGRT__RESTRICT n,
1299 : gpgrt_stream_t stream);
1300 : ssize_t gpgrt_read_line (gpgrt_stream_t stream,
1301 : char **addr_of_buffer, size_t *length_of_buffer,
1302 : size_t *max_length);
1303 : void gpgrt_free (void *a);
1304 :
1305 : int gpgrt_fprintf (gpgrt_stream_t _GPGRT__RESTRICT stream,
1306 : const char *_GPGRT__RESTRICT format, ...)
1307 : GPGRT_ATTR_PRINTF(2,3);
1308 : int gpgrt_fprintf_unlocked (gpgrt_stream_t _GPGRT__RESTRICT stream,
1309 : const char *_GPGRT__RESTRICT format, ...)
1310 : GPGRT_ATTR_PRINTF(2,3);
1311 :
1312 : int gpgrt_printf (const char *_GPGRT__RESTRICT format, ...)
1313 : GPGRT_ATTR_PRINTF(1,2);
1314 : int gpgrt_printf_unlocked (const char *_GPGRT__RESTRICT format, ...)
1315 : GPGRT_ATTR_PRINTF(1,2);
1316 :
1317 : int gpgrt_vfprintf (gpgrt_stream_t _GPGRT__RESTRICT stream,
1318 : const char *_GPGRT__RESTRICT format, va_list ap)
1319 : GPGRT_ATTR_PRINTF(2,0);
1320 : int gpgrt_vfprintf_unlocked (gpgrt_stream_t _GPGRT__RESTRICT stream,
1321 : const char *_GPGRT__RESTRICT format, va_list ap)
1322 : GPGRT_ATTR_PRINTF(2,0);
1323 :
1324 : int gpgrt_setvbuf (gpgrt_stream_t _GPGRT__RESTRICT stream,
1325 : char *_GPGRT__RESTRICT buf, int mode, size_t size);
1326 : void gpgrt_setbuf (gpgrt_stream_t _GPGRT__RESTRICT stream,
1327 : char *_GPGRT__RESTRICT buf);
1328 :
1329 : void gpgrt_set_binary (gpgrt_stream_t stream);
1330 : int gpgrt_set_nonblock (gpgrt_stream_t stream, int onoff);
1331 : int gpgrt_get_nonblock (gpgrt_stream_t stream);
1332 :
1333 : int gpgrt_poll (gpgrt_poll_t *fdlist, unsigned int nfds, int timeout);
1334 :
1335 : gpgrt_stream_t gpgrt_tmpfile (void);
1336 :
1337 : void gpgrt_opaque_set (gpgrt_stream_t _GPGRT__RESTRICT stream,
1338 : void *_GPGRT__RESTRICT opaque);
1339 : void *gpgrt_opaque_get (gpgrt_stream_t stream);
1340 :
1341 : void gpgrt_fname_set (gpgrt_stream_t stream, const char *fname);
1342 : const char *gpgrt_fname_get (gpgrt_stream_t stream);
1343 :
1344 : int gpgrt_asprintf (char **r_buf, const char * _GPGRT__RESTRICT format, ...)
1345 : GPGRT_ATTR_PRINTF(2,3);
1346 : int gpgrt_vasprintf (char **r_buf, const char * _GPGRT__RESTRICT format,
1347 : va_list ap)
1348 : GPGRT_ATTR_PRINTF(2,0);
1349 : char *gpgrt_bsprintf (const char * _GPGRT__RESTRICT format, ...)
1350 : GPGRT_ATTR_PRINTF(1,2);
1351 : char *gpgrt_vbsprintf (const char * _GPGRT__RESTRICT format, va_list ap)
1352 : GPGRT_ATTR_PRINTF(1,0);
1353 : int gpgrt_snprintf (char *buf, size_t bufsize,
1354 : const char * _GPGRT__RESTRICT format, ...)
1355 : GPGRT_ATTR_PRINTF(3,4);
1356 : int gpgrt_vsnprintf (char *buf,size_t bufsize,
1357 : const char * _GPGRT__RESTRICT format, va_list arg_ptr)
1358 : GPGRT_ATTR_PRINTF(3,0);
1359 :
1360 :
1361 : #ifdef GPGRT_ENABLE_ES_MACROS
1362 : # define es_fopen gpgrt_fopen
1363 : # define es_mopen gpgrt_mopen
1364 : # define es_fopenmem gpgrt_fopenmem
1365 : # define es_fopenmem_init gpgrt_fopenmem_init
1366 : # define es_fdopen gpgrt_fdopen
1367 : # define es_fdopen_nc gpgrt_fdopen_nc
1368 : # define es_sysopen gpgrt_sysopen
1369 : # define es_sysopen_nc gpgrt_sysopen_nc
1370 : # define es_fpopen gpgrt_fpopen
1371 : # define es_fpopen_nc gpgrt_fpopen_nc
1372 : # define es_freopen gpgrt_freopen
1373 : # define es_fopencookie gpgrt_fopencookie
1374 : # define es_fclose gpgrt_fclose
1375 : # define es_fclose_snatch gpgrt_fclose_snatch
1376 : # define es_onclose gpgrt_onclose
1377 : # define es_fileno gpgrt_fileno
1378 : # define es_fileno_unlocked gpgrt_fileno_unlocked
1379 : # define es_syshd gpgrt_syshd
1380 : # define es_syshd_unlocked gpgrt_syshd_unlocked
1381 : # define es_stdin _gpgrt_get_std_stream (0)
1382 : # define es_stdout _gpgrt_get_std_stream (1)
1383 : # define es_stderr _gpgrt_get_std_stream (2)
1384 : # define es_flockfile gpgrt_flockfile
1385 : # define es_ftrylockfile gpgrt_ftrylockfile
1386 : # define es_funlockfile gpgrt_funlockfile
1387 : # define es_feof gpgrt_feof
1388 : # define es_feof_unlocked gpgrt_feof_unlocked
1389 : # define es_ferror gpgrt_ferror
1390 : # define es_ferror_unlocked gpgrt_ferror_unlocked
1391 : # define es_clearerr gpgrt_clearerr
1392 : # define es_clearerr_unlocked gpgrt_clearerr_unlocked
1393 : # define es_pending gpgrt_pending
1394 : # define es_pending_unlocked gpgrt_pending_unlocked
1395 : # define es_fflush gpgrt_fflush
1396 : # define es_fseek gpgrt_fseek
1397 : # define es_fseeko gpgrt_fseeko
1398 : # define es_ftell gpgrt_ftell
1399 : # define es_ftello gpgrt_ftello
1400 : # define es_rewind gpgrt_rewind
1401 : # define es_fgetc gpgrt_fgetc
1402 : # define es_fputc gpgrt_fputc
1403 : # define es_getc_unlocked gpgrt_getc_unlocked
1404 : # define es_putc_unlocked gpgrt_putc_unlocked
1405 : # define es_getc gpgrt_getc
1406 : # define es_putc gpgrt_putc
1407 : # define es_ungetc gpgrt_ungetc
1408 : # define es_read gpgrt_read
1409 : # define es_write gpgrt_write
1410 : # define es_write_sanitized gpgrt_write_sanitized
1411 : # define es_write_hexstring gpgrt_write_hexstring
1412 : # define es_fread gpgrt_fread
1413 : # define es_fwrite gpgrt_fwrite
1414 : # define es_fgets gpgrt_fgets
1415 : # define es_fputs gpgrt_fputs
1416 : # define es_fputs_unlocked gpgrt_fputs_unlocked
1417 : # define es_getline gpgrt_getline
1418 : # define es_read_line gpgrt_read_line
1419 : # define es_free gpgrt_free
1420 : # define es_fprintf gpgrt_fprintf
1421 : # define es_fprintf_unlocked gpgrt_fprintf_unlocked
1422 : # define es_printf gpgrt_printf
1423 : # define es_printf_unlocked gpgrt_printf_unlocked
1424 : # define es_vfprintf gpgrt_vfprintf
1425 : # define es_vfprintf_unlocked gpgrt_vfprintf_unlocked
1426 : # define es_setvbuf gpgrt_setvbuf
1427 : # define es_setbuf gpgrt_setbuf
1428 : # define es_set_binary gpgrt_set_binary
1429 : # define es_set_nonblock gpgrt_set_nonblock
1430 : # define es_get_nonblock gpgrt_get_nonblock
1431 : # define es_poll gpgrt_poll
1432 : # define es_tmpfile gpgrt_tmpfile
1433 : # define es_opaque_set gpgrt_opaque_set
1434 : # define es_opaque_get gpgrt_opaque_get
1435 : # define es_fname_set gpgrt_fname_set
1436 : # define es_fname_get gpgrt_fname_get
1437 : # define es_asprintf gpgrt_asprintf
1438 : # define es_vasprintf gpgrt_vasprintf
1439 : # define es_bsprintf gpgrt_bsprintf
1440 : # define es_vbsprintf gpgrt_vbsprintf
1441 : #endif /*GPGRT_ENABLE_ES_MACROS*/
1442 :
1443 : /* Base64 decode functions. */
1444 :
1445 : struct _gpgrt_b64state;
1446 : typedef struct _gpgrt_b64state *gpgrt_b64state_t;
1447 :
1448 : gpgrt_b64state_t gpgrt_b64dec_start (const char *title);
1449 : gpg_error_t gpgrt_b64dec_proc (gpgrt_b64state_t state,
1450 : void *buffer, size_t length, size_t *r_nbytes);
1451 : gpg_error_t gpgrt_b64dec_finish (gpgrt_b64state_t state);
1452 :
1453 : #ifdef __cplusplus
1454 : }
1455 : #endif
1456 : #endif /* GPGRT_H */
1457 : #endif /* GPG_ERROR_H */
1458 : /*
1459 : Local Variables:
1460 : buffer-read-only: t
1461 : End:
1462 : */
|