|
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 /* |
|
74 * NSSBER |
|
75 * |
|
76 * Data packed according to the Basic Encoding Rules of ASN.1. |
|
77 */ |
|
78 |
|
79 typedef NSSItem NSSBER; |
|
80 |
|
81 /* |
|
82 * NSSDER |
|
83 * |
|
84 * Data packed according to the Distinguished Encoding Rules of ASN.1; |
|
85 * this form is also known as the Canonical Encoding Rules form (CER). |
|
86 */ |
|
87 |
|
88 typedef NSSBER NSSDER; |
|
89 |
|
90 /* |
|
91 * NSSBitString |
|
92 * |
|
93 * Some ASN.1 types use "bit strings," which are passed around as |
|
94 * octet strings but whose length is counted in bits. We use this |
|
95 * typedef of NSSItem to point out the occasions when the length |
|
96 * is counted in bits, not octets. |
|
97 */ |
|
98 |
|
99 typedef NSSItem NSSBitString; |
|
100 |
|
101 /* |
|
102 * NSSUTF8 |
|
103 * |
|
104 * Character strings encoded in UTF-8, as defined by RFC 2279. |
|
105 */ |
|
106 |
|
107 typedef char NSSUTF8; |
|
108 |
|
109 /* |
|
110 * NSSASCII7 |
|
111 * |
|
112 * Character strings guaranteed to be 7-bit ASCII. |
|
113 */ |
|
114 |
|
115 typedef char NSSASCII7; |
|
116 |
|
117 PR_END_EXTERN_C |
|
118 |
|
119 #endif /* NSSBASET_H */ |