OLD | NEW |
| (Empty) |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
4 | |
5 /* | |
6 * seccomon.h - common data structures for security libraries | |
7 * | |
8 * This file should have lowest-common-denominator datastructures | |
9 * for security libraries. It should not be dependent on any other | |
10 * headers, and should not require linking with any libraries. | |
11 * | |
12 * $Id: seccomon.h,v 1.8 2012/04/25 14:50:16 gerv%gerv.net Exp $ | |
13 */ | |
14 | |
15 #ifndef _SECCOMMON_H_ | |
16 #define _SECCOMMON_H_ | |
17 | |
18 #include "utilrename.h" | |
19 #include "prtypes.h" | |
20 | |
21 | |
22 #ifdef __cplusplus | |
23 # define SEC_BEGIN_PROTOS extern "C" { | |
24 # define SEC_END_PROTOS } | |
25 #else | |
26 # define SEC_BEGIN_PROTOS | |
27 # define SEC_END_PROTOS | |
28 #endif | |
29 | |
30 #include "secport.h" | |
31 | |
32 typedef enum { | |
33 siBuffer = 0, | |
34 siClearDataBuffer = 1, | |
35 siCipherDataBuffer = 2, | |
36 siDERCertBuffer = 3, | |
37 siEncodedCertBuffer = 4, | |
38 siDERNameBuffer = 5, | |
39 siEncodedNameBuffer = 6, | |
40 siAsciiNameString = 7, | |
41 siAsciiString = 8, | |
42 siDEROID = 9, | |
43 siUnsignedInteger = 10, | |
44 siUTCTime = 11, | |
45 siGeneralizedTime = 12, | |
46 siVisibleString = 13, | |
47 siUTF8String = 14, | |
48 siBMPString = 15 | |
49 } SECItemType; | |
50 | |
51 typedef struct SECItemStr SECItem; | |
52 | |
53 struct SECItemStr { | |
54 SECItemType type; | |
55 unsigned char *data; | |
56 unsigned int len; | |
57 }; | |
58 | |
59 /* | |
60 ** A status code. Status's are used by procedures that return status | |
61 ** values. Again the motivation is so that a compiler can generate | |
62 ** warnings when return values are wrong. Correct testing of status codes: | |
63 ** | |
64 ** SECStatus rv; | |
65 ** rv = some_function (some_argument); | |
66 ** if (rv != SECSuccess) | |
67 ** do_an_error_thing(); | |
68 ** | |
69 */ | |
70 typedef enum _SECStatus { | |
71 SECWouldBlock = -2, | |
72 SECFailure = -1, | |
73 SECSuccess = 0 | |
74 } SECStatus; | |
75 | |
76 /* | |
77 ** A comparison code. Used for procedures that return comparision | |
78 ** values. Again the motivation is so that a compiler can generate | |
79 ** warnings when return values are wrong. | |
80 */ | |
81 typedef enum _SECComparison { | |
82 SECLessThan = -1, | |
83 SECEqual = 0, | |
84 SECGreaterThan = 1 | |
85 } SECComparison; | |
86 | |
87 #endif /* _SECCOMMON_H_ */ | |
OLD | NEW |