1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/base/nssbaset.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,119 @@ 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 +#ifndef NSSBASET_H 1.9 +#define NSSBASET_H 1.10 + 1.11 +/* 1.12 + * nssbaset.h 1.13 + * 1.14 + * This file contains the most low-level, fundamental public types. 1.15 + */ 1.16 + 1.17 +#include "nspr.h" 1.18 +#include "nssilock.h" 1.19 + 1.20 +/* 1.21 + * NSS_EXTERN, NSS_IMPLEMENT, NSS_EXTERN_DATA, NSS_IMPLEMENT_DATA 1.22 + * 1.23 + * NSS has its own versions of these NSPR macros, in a form which 1.24 + * does not confuse ctags and other related utilities. NSPR 1.25 + * defines these macros to take the type as an argument, because 1.26 + * of certain OS requirements on platforms not supported by NSS. 1.27 + */ 1.28 + 1.29 +#define DUMMY /* dummy */ 1.30 +#define NSS_EXTERN extern 1.31 +#define NSS_EXTERN_DATA extern 1.32 +#define NSS_IMPLEMENT 1.33 +#define NSS_IMPLEMENT_DATA 1.34 + 1.35 +PR_BEGIN_EXTERN_C 1.36 + 1.37 +/* 1.38 + * NSSError 1.39 + * 1.40 + * Calls to NSS routines may result in one or more errors being placed 1.41 + * on the calling thread's "error stack." Every possible error that 1.42 + * may be returned from a function is declared where the function is 1.43 + * prototyped. All errors are of the following type. 1.44 + */ 1.45 + 1.46 +typedef PRInt32 NSSError; 1.47 + 1.48 +/* 1.49 + * NSSArena 1.50 + * 1.51 + * Arenas are logical sets of heap memory, from which memory may be 1.52 + * allocated. When an arena is destroyed, all memory allocated within 1.53 + * that arena is implicitly freed. These arenas are thread-safe: 1.54 + * an arena pointer may be used by multiple threads simultaneously. 1.55 + * However, as they are not backed by shared memory, they may only be 1.56 + * used within one process. 1.57 + */ 1.58 + 1.59 +struct NSSArenaStr; 1.60 +typedef struct NSSArenaStr NSSArena; 1.61 + 1.62 +/* 1.63 + * NSSItem 1.64 + * 1.65 + * This is the basic type used to refer to an unconstrained datum of 1.66 + * arbitrary size. 1.67 + */ 1.68 + 1.69 +struct NSSItemStr { 1.70 + void *data; 1.71 + PRUint32 size; 1.72 +}; 1.73 +typedef struct NSSItemStr NSSItem; 1.74 + 1.75 + 1.76 +/* 1.77 + * NSSBER 1.78 + * 1.79 + * Data packed according to the Basic Encoding Rules of ASN.1. 1.80 + */ 1.81 + 1.82 +typedef NSSItem NSSBER; 1.83 + 1.84 +/* 1.85 + * NSSDER 1.86 + * 1.87 + * Data packed according to the Distinguished Encoding Rules of ASN.1; 1.88 + * this form is also known as the Canonical Encoding Rules form (CER). 1.89 + */ 1.90 + 1.91 +typedef NSSBER NSSDER; 1.92 + 1.93 +/* 1.94 + * NSSBitString 1.95 + * 1.96 + * Some ASN.1 types use "bit strings," which are passed around as 1.97 + * octet strings but whose length is counted in bits. We use this 1.98 + * typedef of NSSItem to point out the occasions when the length 1.99 + * is counted in bits, not octets. 1.100 + */ 1.101 + 1.102 +typedef NSSItem NSSBitString; 1.103 + 1.104 +/* 1.105 + * NSSUTF8 1.106 + * 1.107 + * Character strings encoded in UTF-8, as defined by RFC 2279. 1.108 + */ 1.109 + 1.110 +typedef char NSSUTF8; 1.111 + 1.112 +/* 1.113 + * NSSASCII7 1.114 + * 1.115 + * Character strings guaranteed to be 7-bit ASCII. 1.116 + */ 1.117 + 1.118 +typedef char NSSASCII7; 1.119 + 1.120 +PR_END_EXTERN_C 1.121 + 1.122 +#endif /* NSSBASET_H */