Mercurial > trustbridge > nss-cmake-static
comparison nss/lib/base/baset.h @ 0:1e5118fa0cb1
This is NSS with a Cmake Buildsyste
To compile a static NSS library for Windows we've used the
Chromium-NSS fork and added a Cmake buildsystem to compile
it statically for Windows. See README.chromium for chromium
changes and README.trustbridge for our modifications.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 28 Jul 2014 10:47:06 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1e5118fa0cb1 |
---|---|
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 BASET_H | |
6 #define BASET_H | |
7 | |
8 /* | |
9 * baset.h | |
10 * | |
11 * This file contains definitions for the basic types used throughout | |
12 * nss but not available publicly. | |
13 */ | |
14 | |
15 #ifndef NSSBASET_H | |
16 #include "nssbaset.h" | |
17 #endif /* NSSBASET_H */ | |
18 | |
19 #include "plhash.h" | |
20 | |
21 PR_BEGIN_EXTERN_C | |
22 | |
23 /* | |
24 * nssArenaMark | |
25 * | |
26 * This type is used to mark the current state of an NSSArena. | |
27 */ | |
28 | |
29 struct nssArenaMarkStr; | |
30 typedef struct nssArenaMarkStr nssArenaMark; | |
31 | |
32 #ifdef DEBUG | |
33 /* | |
34 * ARENA_THREADMARK | |
35 * | |
36 * Optionally, this arena implementation can be compiled with some | |
37 * runtime checking enabled, which will catch the situation where | |
38 * one thread "marks" the arena, another thread allocates memory, | |
39 * and then the mark is released. Usually this is a surprise to | |
40 * the second thread, and this leads to weird runtime errors. | |
41 * Define ARENA_THREADMARK to catch these cases; we define it for all | |
42 * (internal and external) debug builds. | |
43 */ | |
44 #define ARENA_THREADMARK | |
45 | |
46 /* | |
47 * ARENA_DESTRUCTOR_LIST | |
48 * | |
49 * Unfortunately, our pointer-tracker facility, used in debug | |
50 * builds to agressively fight invalid pointers, requries that | |
51 * pointers be deregistered when objects are destroyed. This | |
52 * conflicts with the standard arena usage where "memory-only" | |
53 * objects (that don't hold onto resources outside the arena) | |
54 * can be allocated in an arena, and never destroyed other than | |
55 * when the arena is destroyed. Therefore we have added a | |
56 * destructor-registratio facility to our arenas. This was not | |
57 * a simple decision, since we're getting ever-further away from | |
58 * the original arena philosophy. However, it was felt that | |
59 * adding this in debug builds wouldn't be so bad; as it would | |
60 * discourage them from being used for "serious" purposes. | |
61 * This facility requires ARENA_THREADMARK to be defined. | |
62 */ | |
63 #ifdef ARENA_THREADMARK | |
64 #define ARENA_DESTRUCTOR_LIST | |
65 #endif /* ARENA_THREADMARK */ | |
66 | |
67 #endif /* DEBUG */ | |
68 | |
69 typedef struct nssListStr nssList; | |
70 typedef struct nssListIteratorStr nssListIterator; | |
71 typedef PRBool (* nssListCompareFunc)(void *a, void *b); | |
72 typedef PRIntn (* nssListSortFunc)(void *a, void *b); | |
73 typedef void (* nssListElementDestructorFunc)(void *el); | |
74 | |
75 typedef struct nssHashStr nssHash; | |
76 typedef void (PR_CALLBACK *nssHashIterator)(const void *key, | |
77 void *value, | |
78 void *arg); | |
79 | |
80 /* | |
81 * nssPointerTracker | |
82 * | |
83 * This type is used in debug builds (both external and internal) to | |
84 * track our object pointers. Objects of this type must be statically | |
85 * allocated, which means the structure size must be available to the | |
86 * compiler. Therefore we must expose the contents of this structure. | |
87 * But please don't access elements directly; use the accessors. | |
88 */ | |
89 | |
90 #ifdef DEBUG | |
91 struct nssPointerTrackerStr { | |
92 PRCallOnceType once; | |
93 PZLock *lock; | |
94 PLHashTable *table; | |
95 }; | |
96 typedef struct nssPointerTrackerStr nssPointerTracker; | |
97 #endif /* DEBUG */ | |
98 | |
99 /* | |
100 * nssStringType | |
101 * | |
102 * There are several types of strings in the real world. We try to | |
103 * use only UTF8 and avoid the rest, but that's not always possible. | |
104 * So we have a couple converter routines to go to and from the other | |
105 * string types. We have to be able to specify those string types, | |
106 * so we have this enumeration. | |
107 */ | |
108 | |
109 enum nssStringTypeEnum { | |
110 nssStringType_DirectoryString, | |
111 nssStringType_TeletexString, /* Not "teletext" with trailing 't' */ | |
112 nssStringType_PrintableString, | |
113 nssStringType_UniversalString, | |
114 nssStringType_BMPString, | |
115 nssStringType_UTF8String, | |
116 nssStringType_PHGString, | |
117 nssStringType_GeneralString, | |
118 | |
119 nssStringType_Unknown = -1 | |
120 }; | |
121 typedef enum nssStringTypeEnum nssStringType; | |
122 | |
123 PR_END_EXTERN_C | |
124 | |
125 #endif /* BASET_H */ |