nssbaset.h (2670B)
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 #ifndef NSSBASET_H 6 #define NSSBASET_H 7 8 /* 9 * nssbaset.h 10 * 11 * This file contains the most low-level, fundamental public types. 12 */ 13 14 #include "nspr.h" 15 #include "nssilock.h" 16 17 /* 18 * NSS_EXTERN, NSS_IMPLEMENT, NSS_EXTERN_DATA, NSS_IMPLEMENT_DATA 19 * 20 * NSS has its own versions of these NSPR macros, in a form which 21 * does not confuse ctags and other related utilities. NSPR 22 * defines these macros to take the type as an argument, because 23 * of certain OS requirements on platforms not supported by NSS. 24 */ 25 26 #define DUMMY /* dummy */ 27 #define NSS_EXTERN extern 28 #define NSS_EXTERN_DATA extern 29 #define NSS_IMPLEMENT 30 #define NSS_IMPLEMENT_DATA 31 32 PR_BEGIN_EXTERN_C 33 34 /* 35 * NSSError 36 * 37 * Calls to NSS routines may result in one or more errors being placed 38 * on the calling thread's "error stack." Every possible error that 39 * may be returned from a function is declared where the function is 40 * prototyped. All errors are of the following type. 41 */ 42 43 typedef PRInt32 NSSError; 44 45 /* 46 * NSSArena 47 * 48 * Arenas are logical sets of heap memory, from which memory may be 49 * allocated. When an arena is destroyed, all memory allocated within 50 * that arena is implicitly freed. These arenas are thread-safe: 51 * an arena pointer may be used by multiple threads simultaneously. 52 * However, as they are not backed by shared memory, they may only be 53 * used within one process. 54 */ 55 56 struct NSSArenaStr; 57 typedef struct NSSArenaStr NSSArena; 58 59 /* 60 * NSSItem 61 * 62 * This is the basic type used to refer to an unconstrained datum of 63 * arbitrary size. 64 */ 65 66 struct NSSItemStr { 67 void *data; 68 PRUint32 size; 69 }; 70 typedef struct NSSItemStr NSSItem; 71 72 /* 73 * NSSBER 74 * 75 * Data packed according to the Basic Encoding Rules of ASN.1. 76 */ 77 78 typedef NSSItem NSSBER; 79 80 /* 81 * NSSDER 82 * 83 * Data packed according to the Distinguished Encoding Rules of ASN.1; 84 * this form is also known as the Canonical Encoding Rules form (CER). 85 */ 86 87 typedef NSSBER NSSDER; 88 89 /* 90 * NSSBitString 91 * 92 * Some ASN.1 types use "bit strings," which are passed around as 93 * octet strings but whose length is counted in bits. We use this 94 * typedef of NSSItem to point out the occasions when the length 95 * is counted in bits, not octets. 96 */ 97 98 typedef NSSItem NSSBitString; 99 100 /* 101 * NSSUTF8 102 * 103 * Character strings encoded in UTF-8, as defined by RFC 2279. 104 */ 105 106 typedef char NSSUTF8; 107 108 /* 109 * NSSASCII7 110 * 111 * Character strings guaranteed to be 7-bit ASCII. 112 */ 113 114 typedef char NSSASCII7; 115 116 PR_END_EXTERN_C 117 118 #endif /* NSSBASET_H */