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