1 
2 /* ****************************************************************************
3 * eID Middleware Project.
4 * Copyright (C) 2008-2013 FedICT.
5 *
6 * This is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License version
8 * 3.0 as published by the Free Software Foundation.
9 *
10 * This software is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this software; if not, see
17 * http://www.gnu.org/licenses/.
18 **************************************************************************** */
19 
20 #pragma once
21 
22 #define EIDMW_OK                   0
23 
24 // Results of calling the function with incorrect parameters */
25 
26 /** A function parameter has an unexpected value (general) */
27 #define EIDMW_ERR_PARAM_BAD            0xe1d00100L
28 
29 /** A function parameter exceeded the allowed range */
30 #define EIDMW_ERR_PARAM_RANGE          0xe1d00101L
31 
32 /** Bad file path (invalid characters, length no multiple of 4) */
33 #define EIDMW_ERR_BAD_PATH             0xe1d00102L
34 
35 /** Unknown/unsupported algorithm */
36 #define EIDMW_ERR_ALGO_BAD             0xe1d00103L
37 
38 /** Invalid/unsupported PIN operation */
39 #define EIDMW_ERR_PIN_OPERATION        0xe1d00104L
40 
41 /** PIN not allowed for this card (invalid characters, too short/long) */
42 #define EIDMW_ERR_PIN_FORMAT           0xe1d00105L
43 
44 /** Bad usage of a class or function */
45 #define EIDMW_ERR_BAD_USAGE            0xe1d00106L
46 
47 /** wrong length */
48 #define EIDMW_ERR_LEN_BAD              0xe1d00107L
49 
50 /** Condition of use not satisfied */
51 #define EIDMW_ERR_BAD_COND             0xe1d00108L
52 
53 /** Command not available within current lifecycle */
54 #define EIDMW_ERR_CMD_NOT_AVAIL        0xe1d00109L
55 
56 /** Wrong class byte */
57 #define EIDMW_ERR_CLASS_BAD            0xe1d0010AL
58 
59 
60 // Card errors
61 
62 /** Generic card error */
63 #define EIDMW_ERR_CARD                 0xe1d00200L
64 
65 /** Not Authenticated (no PIN specified) */
66 #define EIDMW_ERR_NOT_AUTHENTICATED    0xe1d00201L
67 
68 /** This command is not supported by this card */
69 #define EIDMW_ERR_NOT_SUPPORTED        0xe1d00202L
70 
71 /** Bad PIN */
72 #define EIDMW_ERR_PIN_BAD              0xe1d00203L
73 
74 /** PIN blocked */
75 #define EIDMW_ERR_PIN_BLOCKED          0xe1d00204L
76 
77 /** No card present or card has been removed */
78 #define EIDMW_ERR_NO_CARD              0xe1d00205L
79 
80 /** Bad parameter P1 or P2 */
81 #define EIDMW_ERR_BAD_P1P2             0xe1d00206L
82 
83 /** Command not allowed */
84 #define EIDMW_ERR_CMD_NOT_ALLOWED      0xe1d00207L
85 
86 /** File not found */
87 #define EIDMW_ERR_FILE_NOT_FOUND       0xe1d00208L
88 
89 /** Unable to read applet version from the card */
90 #define EIDMW_ERR_APPLET_VERSION_NOT_FOUND 0xe1d00209L
91 
92 /** Card not activated */
93 #define EIDMW_ERR_NOT_ACTIVATED        0xe1d0020AL
94 
95 /** EEPROM corrupted */
96 #define EIDMW_ERR_EEPROM               0xe1d0020BL
97 
98 /** no precise diagnostic */
99 #define EIDMW_ERR_NOT_SPEC             0xe1d0020CL
100 
101 
102 // Reader errors
103 
104 /** Error communicating with the card */
105 #define EIDMW_ERR_CARD_COMM            0xe1d00300L
106 
107 /** No reader has been found */
108 #define EIDMW_ERR_NO_READER            0xe1d00301L
109 
110 /** The pinpad reader returned an error */
111 #define EIDMW_ERR_PINPAD               0xe1d00302L
112 
113 /** A card is present but we can't connect.
114  * E.g. no card present, or a synchronous card is
115  * inserted in the reader, but no 'reader specific card plugin'
116  * is available for that reader */
117 #define EIDMW_ERR_CANT_CONNECT         0xe1d00303L
118 
119 /** The card has been reset (e.g. by another application) */
120 #define EIDMW_ERR_CARD_RESET           0xe1d00304L
121 
122 /** The card can't be accessed because of other connections */
123 #define EIDMW_ERR_CARD_SHARING         0xe1d00305L
124 
125 /** Can't end a transaction that wasn't started (also returned
126  *  on Mac OS X when multiple apps are access the card simultaneously) */
127 #define EIDMW_ERR_NOT_TRANSACTED       0xe1d00306L
128 
129 // Internal errors (caused by the middleware)
130 
131 /** An internal limit has been reached */
132 #define EIDMW_ERR_LIMIT                0xe1d00400L
133 
134 /** An internal check failed */
135 #define EIDMW_ERR_CHECK	               0xe1d00401L
136 
137 /** The PCSC library could not be located */
138 #define EIDMW_ERR_PCSC_LIB             0xe1d00402L
139 
140 /** An attempt to resolve a Z-lib address failed */
141 #define EIDMW_ERR_ZLIB_RESOLVE         0xe1d00403L
142 
143 /** And unknown error occurred */
144 #define EIDMW_ERR_UNKNOWN              0xe1d00404L
145 
146 /** The pinpad reader received a wrong/unknown value */
147 #define EIDMW_PINPAD_ERR               0xe1d00405L
148 
149 /** Dynamic library couldn't be loaded (found found at the specified location) */
150 #define EIDMW_CANT_LOAD_LIB            0xe1d00406L
151 
152 /** Memory error */
153 #define EIDMW_ERR_MEMORY               0xe1d00407L
154 
155 /** Couldn't delete cache file(s) */
156 #define EIDMW_ERR_DELETE_CACHE         0xe1d00408L
157 
158 /** Error getting or writing config data */
159 #define EIDMW_CONF                     0xe1d00409L
160 
161 /** The cached files have been tampered with */
162 #define EIDMW_CACHE_TAMPERED           0xe1d0040AL
163 
164 
165 // Socket related errors
166 
167 /** Creation of a socket failed */
168 #define EIDMW_ERR_SOCKET_CREATE        0xe1d00500L
169 
170 /** Socket 'send()' failed */
171 #define EIDMW_ERR_SOCKET_SEND          0xe1d00501L
172 
173 /** Socket 'recv()' failed */
174 #define EIDMW_ERR_SOCKET_RECV          0xe1d00502L
175 
176 /** Call to 'gethostbyname()' in SocketClient failed */
177 #define EIDMW_ERR_SOCKET_GETHOST       0xe1d00503L
178 
179 /** Call to 'connect()' in SocketClient failed */
180 #define EIDMW_ERR_SOCKET_CONNECT       0xe1d00504L
181 
182 /** Invalid in SocketServer, call to 'socket()' failed */
183 #define EIDMW_ERR_SOCKET_SOCKET        0xe1d00510L
184 
185 /** Call to 'bind()' in SocketServer failed */
186 #define EIDMW_ERR_SOCKET_BIND          0xe1d00511L
187 
188 /** Call to 'Accept()' in SocketServer failed */
189 #define EIDMW_ERR_SOCKET_ACCEPT        0xe1d00512L
190 
191 
192 // User errors/events
193 
194 /** User pressed Cancel in PIN dialog */
195 #define EIDMW_ERR_PIN_CANCEL           0xe1d00600L
196 
197 /** Pinpad timeout */
198 #define EIDMW_ERR_TIMEOUT              0xe1d00601L
199 
200 /** The new PINs that were entered differ */
201 #define EIDMW_NEW_PINS_DIFFER          0xe1d00602L
202 
203 /** A PIN with invalid length or format was entered */
204 #define EIDMW_WRONG_PIN_FORMAT         0xe1d00603L
205 
206 
207 // Parser errors
208 
209 /** Could not find expected elements in parsed ASN.1 vector */
210 #define EIDMW_WRONG_ASN1_FORMAT        0xe1d00700L
211 
212 
213 // I/O errors
214 // errors modelled on the definitions in errno.h
215 
216 /** File could not be opened */
217 #define EIDMW_FILE_NOT_OPENED          0xe1d00800L
218 
219 /** Search permission is denied for a component of the path prefix of path. */
220 #define EIDMW_PERMISSION_DENIED        0xe1d00801L
221 
222 /** A loop exists in symbolic links encountered during resolution of the path argument. */
223 
224 /** A component of path does not name an existing file or path is an empty string.*/
225 
226 /** A component of the path prefix is not a directory. */
227 
228 /** The length of the path argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}. */
229 #define EIDMW_INVALID_PATH             0xe1d00802L
230 
231 /** {OPEN_MAX} file descriptors are currently open in the calling process. */
232 
233 /** Too many files are currently open in the system.*/
234 #define EIDMW_TOO_MANY_OPENED_FILES    0xe1d00803L
235 
236 /** The argument of closedir or readdir does not refer to an open directory stream. */
237 #define EIDMW_DIR_NOT_OPENED           0xe1d00804L
238 
239 /** Interrupted by a signal */
240 #define EIDMW_INTERRUPTION             0xe1d00805L
241 
242 /** One of the values in the structure to be returned cannot be represented correctly. */
243 #define EIDMW_OVERFLOW                 0xe1d00806L
244 
245 /** An I/O error occurred while reading from the file system.*/
246 #define EIDMW_ERROR_IO                 0xe1d00807L
247 
248 /** Call of the Logger after destruct time */
249 #define EIDMW_ERR_LOGGER_APPLEAVING    0xe1d00900L
250 
251 
252 // SDK error
253 
254 /** The document type is unknown for this card */
255 #define EIDMW_ERR_DOCTYPE_UNKNOWN      0xe1d00b00L
256 
257 /** The card type asked doesn't correspond with the real card type */
258 #define EIDMW_ERR_CARDTYPE_BAD         0xe1d00b01L
259 
260 /** This card type is unknown */
261 #define EIDMW_ERR_CARDTYPE_UNKNOWN     0xe1d00b02L
262 
263 /** This Certificate has no issuer (=root) */
264 #define EIDMW_ERR_CERT_NOISSUER        0xe1d00b03L
265 
266 /** No release of SDK object has been done before closing the application */
267 #define EIDMW_ERR_RELEASE_NEEDED       0xe1d00b04L
268 
269 /** Bad transaction commande (Unlock without Lock OR Lock without Unlock) */
270 #define EIDMW_ERR_BAD_TRANSACTION      0xe1d00b05L
271 
272 /** The file type is unknown for this card */
273 #define EIDMW_ERR_FILETYPE_UNKNOWN     0xe1d00b06L
274 
275 /** The card has been changed */
276 #define EIDMW_ERR_CARD_CHANGED         0xe1d00b07L
277 
278 /** The reader set has been changed */
279 #define EIDMW_ERR_READERSET_CHANGED    0xe1d00b08L
280 
281 /** User did not allow to read the card */
282 #define EIDMW_ERR_NOT_ALLOW_BY_USER    0xe1d00b09L
283 
284 /** This Certificate has no CDP */
285 #define EIDMW_ERR_CERT_NOCRL           0xe1d00b0AL
286 
287 /** This Certificate has no OCSP responder */
288 #define EIDMW_ERR_CERT_NOOCSP          0xe1d00b0BL
289 
290 /** No root is found for the store or certificate */
291 #define EIDMW_ERR_CERT_NOROOT          0xe1d00b0CL
292 
293 /** User did not yet allow or disallow to read the card */
294 #define EIDMW_ERR_USER_MUST_ANSWER     0xe1d00b0DL
295 
296 /** User did not yet allow or disallow to read the card */
297 #define EIDMW_ERR_CANCELLED            0xe1d00b0EL
298 // Errors in system calls
299 
300 /** a system call returned an error */
301 #define EIDMW_ERR_SYSTEM               0xe1d00c01L
302 
303 /** a signal function returned an error */
304 #define EIDMW_ERR_SIGNAL               0xe1d00c02L
305