1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/util/seccomon.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,92 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +/* 1.9 + * seccomon.h - common data structures for security libraries 1.10 + * 1.11 + * This file should have lowest-common-denominator datastructures 1.12 + * for security libraries. It should not be dependent on any other 1.13 + * headers, and should not require linking with any libraries. 1.14 + */ 1.15 + 1.16 +#ifndef _SECCOMMON_H_ 1.17 +#define _SECCOMMON_H_ 1.18 + 1.19 +#include "utilrename.h" 1.20 +#include "prtypes.h" 1.21 + 1.22 + 1.23 +#ifdef __cplusplus 1.24 +# define SEC_BEGIN_PROTOS extern "C" { 1.25 +# define SEC_END_PROTOS } 1.26 +#else 1.27 +# define SEC_BEGIN_PROTOS 1.28 +# define SEC_END_PROTOS 1.29 +#endif 1.30 + 1.31 +#include "secport.h" 1.32 + 1.33 +typedef enum { 1.34 + siBuffer = 0, 1.35 + siClearDataBuffer = 1, 1.36 + siCipherDataBuffer = 2, 1.37 + siDERCertBuffer = 3, 1.38 + siEncodedCertBuffer = 4, 1.39 + siDERNameBuffer = 5, 1.40 + siEncodedNameBuffer = 6, 1.41 + siAsciiNameString = 7, 1.42 + siAsciiString = 8, 1.43 + siDEROID = 9, 1.44 + siUnsignedInteger = 10, 1.45 + siUTCTime = 11, 1.46 + siGeneralizedTime = 12, 1.47 + siVisibleString = 13, 1.48 + siUTF8String = 14, 1.49 + siBMPString = 15 1.50 +} SECItemType; 1.51 + 1.52 +typedef struct SECItemStr SECItem; 1.53 + 1.54 +struct SECItemStr { 1.55 + SECItemType type; 1.56 + unsigned char *data; 1.57 + unsigned int len; 1.58 +}; 1.59 + 1.60 +typedef struct SECItemArrayStr SECItemArray; 1.61 + 1.62 +struct SECItemArrayStr { 1.63 + SECItem *items; 1.64 + unsigned int len; 1.65 +}; 1.66 + 1.67 +/* 1.68 +** A status code. Status's are used by procedures that return status 1.69 +** values. Again the motivation is so that a compiler can generate 1.70 +** warnings when return values are wrong. Correct testing of status codes: 1.71 +** 1.72 +** SECStatus rv; 1.73 +** rv = some_function (some_argument); 1.74 +** if (rv != SECSuccess) 1.75 +** do_an_error_thing(); 1.76 +** 1.77 +*/ 1.78 +typedef enum _SECStatus { 1.79 + SECWouldBlock = -2, 1.80 + SECFailure = -1, 1.81 + SECSuccess = 0 1.82 +} SECStatus; 1.83 + 1.84 +/* 1.85 +** A comparison code. Used for procedures that return comparision 1.86 +** values. Again the motivation is so that a compiler can generate 1.87 +** warnings when return values are wrong. 1.88 +*/ 1.89 +typedef enum _SECComparison { 1.90 + SECLessThan = -1, 1.91 + SECEqual = 0, 1.92 + SECGreaterThan = 1 1.93 +} SECComparison; 1.94 + 1.95 +#endif /* _SECCOMMON_H_ */