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