| 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 | |
| 13 #ifndef _SECCOMMON_H_ | |
| 14 #define _SECCOMMON_H_ | |
| 15 | |
| 16 #include "utilrename.h" | |
| 17 #include "prtypes.h" | |
| 18 | |
| 19 | |
| 20 #ifdef __cplusplus | |
| 21 # define SEC_BEGIN_PROTOS extern "C" { | |
| 22 # define SEC_END_PROTOS } | |
| 23 #else | |
| 24 # define SEC_BEGIN_PROTOS | |
| 25 # define SEC_END_PROTOS | |
| 26 #endif | |
| 27 | |
| 28 #include "secport.h" | |
| 29 | |
| 30 typedef enum { | |
| 31 siBuffer = 0, | |
| 32 siClearDataBuffer = 1, | |
| 33 siCipherDataBuffer = 2, | |
| 34 siDERCertBuffer = 3, | |
| 35 siEncodedCertBuffer = 4, | |
| 36 siDERNameBuffer = 5, | |
| 37 siEncodedNameBuffer = 6, | |
| 38 siAsciiNameString = 7, | |
| 39 siAsciiString = 8, | |
| 40 siDEROID = 9, | |
| 41 siUnsignedInteger = 10, | |
| 42 siUTCTime = 11, | |
| 43 siGeneralizedTime = 12, | |
| 44 siVisibleString = 13, | |
| 45 siUTF8String = 14, | |
| 46 siBMPString = 15 | |
| 47 } SECItemType; | |
| 48 | |
| 49 typedef struct SECItemStr SECItem; | |
| 50 | |
| 51 struct SECItemStr { | |
| 52 SECItemType type; | |
| 53 unsigned char *data; | |
| 54 unsigned int len; | |
| 55 }; | |
| 56 | |
| 57 typedef struct SECItemArrayStr SECItemArray; | |
| 58 | |
| 59 struct SECItemArrayStr { | |
| 60 SECItem *items; | |
| 61 unsigned int len; | |
| 62 }; | |
| 63 | |
| 64 /* | |
| 65 ** A status code. Status's are used by procedures that return status | |
| 66 ** values. Again the motivation is so that a compiler can generate | |
| 67 ** warnings when return values are wrong. Correct testing of status codes: | |
| 68 ** | |
| 69 ** SECStatus rv; | |
| 70 ** rv = some_function (some_argument); | |
| 71 ** if (rv != SECSuccess) | |
| 72 ** do_an_error_thing(); | |
| 73 ** | |
| 74 */ | |
| 75 typedef enum _SECStatus { | |
| 76 SECWouldBlock = -2, | |
| 77 SECFailure = -1, | |
| 78 SECSuccess = 0 | |
| 79 } SECStatus; | |
| 80 | |
| 81 /* | |
| 82 ** A comparison code. Used for procedures that return comparision | |
| 83 ** values. Again the motivation is so that a compiler can generate | |
| 84 ** warnings when return values are wrong. | |
| 85 */ | |
| 86 typedef enum _SECComparison { | |
| 87 SECLessThan = -1, | |
| 88 SECEqual = 0, | |
| 89 SECGreaterThan = 1 | |
| 90 } SECComparison; | |
| 91 | |
| 92 #endif /* _SECCOMMON_H_ */ | |
| OLD | NEW |