michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * seccomon.h - common data structures for security libraries michael@0: * michael@0: * This file should have lowest-common-denominator datastructures michael@0: * for security libraries. It should not be dependent on any other michael@0: * headers, and should not require linking with any libraries. michael@0: */ michael@0: michael@0: #ifndef _SECCOMMON_H_ michael@0: #define _SECCOMMON_H_ michael@0: michael@0: #include "utilrename.h" michael@0: #include "prtypes.h" michael@0: michael@0: michael@0: #ifdef __cplusplus michael@0: # define SEC_BEGIN_PROTOS extern "C" { michael@0: # define SEC_END_PROTOS } michael@0: #else michael@0: # define SEC_BEGIN_PROTOS michael@0: # define SEC_END_PROTOS michael@0: #endif michael@0: michael@0: #include "secport.h" michael@0: michael@0: typedef enum { michael@0: siBuffer = 0, michael@0: siClearDataBuffer = 1, michael@0: siCipherDataBuffer = 2, michael@0: siDERCertBuffer = 3, michael@0: siEncodedCertBuffer = 4, michael@0: siDERNameBuffer = 5, michael@0: siEncodedNameBuffer = 6, michael@0: siAsciiNameString = 7, michael@0: siAsciiString = 8, michael@0: siDEROID = 9, michael@0: siUnsignedInteger = 10, michael@0: siUTCTime = 11, michael@0: siGeneralizedTime = 12, michael@0: siVisibleString = 13, michael@0: siUTF8String = 14, michael@0: siBMPString = 15 michael@0: } SECItemType; michael@0: michael@0: typedef struct SECItemStr SECItem; michael@0: michael@0: struct SECItemStr { michael@0: SECItemType type; michael@0: unsigned char *data; michael@0: unsigned int len; michael@0: }; michael@0: michael@0: typedef struct SECItemArrayStr SECItemArray; michael@0: michael@0: struct SECItemArrayStr { michael@0: SECItem *items; michael@0: unsigned int len; michael@0: }; michael@0: michael@0: /* michael@0: ** A status code. Status's are used by procedures that return status michael@0: ** values. Again the motivation is so that a compiler can generate michael@0: ** warnings when return values are wrong. Correct testing of status codes: michael@0: ** michael@0: ** SECStatus rv; michael@0: ** rv = some_function (some_argument); michael@0: ** if (rv != SECSuccess) michael@0: ** do_an_error_thing(); michael@0: ** michael@0: */ michael@0: typedef enum _SECStatus { michael@0: SECWouldBlock = -2, michael@0: SECFailure = -1, michael@0: SECSuccess = 0 michael@0: } SECStatus; michael@0: michael@0: /* michael@0: ** A comparison code. Used for procedures that return comparision michael@0: ** values. Again the motivation is so that a compiler can generate michael@0: ** warnings when return values are wrong. michael@0: */ michael@0: typedef enum _SECComparison { michael@0: SECLessThan = -1, michael@0: SECEqual = 0, michael@0: SECGreaterThan = 1 michael@0: } SECComparison; michael@0: michael@0: #endif /* _SECCOMMON_H_ */