MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
error.hpp
1 /*
2  Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; see the file COPYING. If not, write to the
15  Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
16  MA 02110-1301 USA.
17 */
18 
19 /* error.hpp provides a taocrypt error numbers
20  *
21  */
22 
23 
24 #ifndef TAO_CRYPT_ERROR_HPP
25 #define TAO_CRYPT_ERROR_HPP
26 
27 
28 namespace TaoCrypt {
29 
30 
31 enum ErrorNumber {
32 
33 NO_ERROR_E = 0, // "not in error state"
34 
35 // RandomNumberGenerator
36 WINCRYPT_E = 1001, // "bad wincrypt acquire"
37 CRYPTGEN_E = 1002, // "CryptGenRandom error"
38 OPEN_RAN_E = 1003, // "open /dev/urandom error"
39 READ_RAN_E = 1004, // "read /dev/urandom error"
40 
41 // Integer
42 INTEGER_E = 1010, // "bad DER Integer Header"
43 
44 
45 // ASN.1
46 SEQUENCE_E = 1020, // "bad Sequence Header"
47 SET_E = 1021, // "bad Set Header"
48 VERSION_E = 1022, // "version length not 1"
49 SIG_OID_E = 1023, // "signature OID mismatch"
50 BIT_STR_E = 1024, // "bad BitString Header"
51 UNKNOWN_OID_E = 1025, // "unknown key OID type"
52 OBJECT_ID_E = 1026, // "bad Ojbect ID Header"
53 TAG_NULL_E = 1027, // "expected TAG NULL"
54 EXPECT_0_E = 1028, // "expected 0"
55 OCTET_STR_E = 1029, // "bad Octet String Header"
56 TIME_E = 1030, // "bad TIME"
57 
58 DATE_SZ_E = 1031, // "bad Date Size"
59 SIG_LEN_E = 1032, // "bad Signature Length"
60 UNKOWN_SIG_E = 1033, // "unknown signature OID"
61 UNKOWN_HASH_E = 1034, // "unknown hash OID"
62 DSA_SZ_E = 1035, // "bad DSA r or s size"
63 BEFORE_DATE_E = 1036, // "before date in the future"
64 AFTER_DATE_E = 1037, // "after date in the past"
65 SIG_CONFIRM_E = 1038, // "bad self signature confirmation"
66 SIG_OTHER_E = 1039, // "bad other signature confirmation"
67 
68 CONTENT_E = 1040, // "bad content processing"
69 PEM_E = 1041 // "bad pem format error"
70 
71  // add error string to yassl/src/yassl_error.cpp !!!
72 };
73 
74 
75 struct Error {
76  ErrorNumber what_; // description number, 0 for no error
77 
78  explicit Error(ErrorNumber w = NO_ERROR_E) : what_(w) {}
79 
80  ErrorNumber What() const { return what_; }
81  void SetError(ErrorNumber w) { what_ = w; }
82 };
83 
84 
85 
86 } // namespace TaoCrypt
87 
88 #endif // TAO_CRYPT_ERROR_HPP