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 CKDBM_H |
michael@0 | 6 | #define CKDBM_H |
michael@0 | 7 | |
michael@0 | 8 | #include "nssckmdt.h" |
michael@0 | 9 | #include "nssckfw.h" |
michael@0 | 10 | |
michael@0 | 11 | /* |
michael@0 | 12 | * I'm including this for access to the arena functions. |
michael@0 | 13 | * Looks like we should publish that API. |
michael@0 | 14 | */ |
michael@0 | 15 | #ifndef BASE_H |
michael@0 | 16 | #include "base.h" |
michael@0 | 17 | #endif /* BASE_H */ |
michael@0 | 18 | |
michael@0 | 19 | /* |
michael@0 | 20 | * This is where the Netscape extensions live, at least for now. |
michael@0 | 21 | */ |
michael@0 | 22 | #ifndef CKT_H |
michael@0 | 23 | #include "ckt.h" |
michael@0 | 24 | #endif /* CKT_H */ |
michael@0 | 25 | |
michael@0 | 26 | #include "mcom_db.h" |
michael@0 | 27 | |
michael@0 | 28 | NSS_EXTERN_DATA NSSCKMDInstance nss_dbm_mdInstance; |
michael@0 | 29 | |
michael@0 | 30 | typedef struct nss_dbm_db_struct nss_dbm_db_t; |
michael@0 | 31 | struct nss_dbm_db_struct { |
michael@0 | 32 | DB *db; |
michael@0 | 33 | NSSCKFWMutex *crustylock; |
michael@0 | 34 | }; |
michael@0 | 35 | |
michael@0 | 36 | typedef struct nss_dbm_dbt_struct nss_dbm_dbt_t; |
michael@0 | 37 | struct nss_dbm_dbt_struct { |
michael@0 | 38 | DBT dbt; |
michael@0 | 39 | nss_dbm_db_t *my_db; |
michael@0 | 40 | }; |
michael@0 | 41 | |
michael@0 | 42 | typedef struct nss_dbm_instance_struct nss_dbm_instance_t; |
michael@0 | 43 | struct nss_dbm_instance_struct { |
michael@0 | 44 | NSSArena *arena; |
michael@0 | 45 | CK_ULONG nSlots; |
michael@0 | 46 | char **filenames; |
michael@0 | 47 | int *flags; /* e.g. O_RDONLY, O_RDWR */ |
michael@0 | 48 | }; |
michael@0 | 49 | |
michael@0 | 50 | typedef struct nss_dbm_slot_struct nss_dbm_slot_t; |
michael@0 | 51 | struct nss_dbm_slot_struct { |
michael@0 | 52 | nss_dbm_instance_t *instance; |
michael@0 | 53 | char *filename; |
michael@0 | 54 | int flags; |
michael@0 | 55 | nss_dbm_db_t *token_db; |
michael@0 | 56 | }; |
michael@0 | 57 | |
michael@0 | 58 | typedef struct nss_dbm_token_struct nss_dbm_token_t; |
michael@0 | 59 | struct nss_dbm_token_struct { |
michael@0 | 60 | NSSArena *arena; |
michael@0 | 61 | nss_dbm_slot_t *slot; |
michael@0 | 62 | nss_dbm_db_t *session_db; |
michael@0 | 63 | NSSUTF8 *label; |
michael@0 | 64 | }; |
michael@0 | 65 | |
michael@0 | 66 | struct nss_dbm_dbt_node { |
michael@0 | 67 | struct nss_dbm_dbt_node *next; |
michael@0 | 68 | nss_dbm_dbt_t *dbt; |
michael@0 | 69 | }; |
michael@0 | 70 | |
michael@0 | 71 | typedef struct nss_dbm_session_struct nss_dbm_session_t; |
michael@0 | 72 | struct nss_dbm_session_struct { |
michael@0 | 73 | NSSArena *arena; |
michael@0 | 74 | nss_dbm_token_t *token; |
michael@0 | 75 | CK_ULONG deviceError; |
michael@0 | 76 | struct nss_dbm_dbt_node *session_objects; |
michael@0 | 77 | NSSCKFWMutex *list_lock; |
michael@0 | 78 | }; |
michael@0 | 79 | |
michael@0 | 80 | typedef struct nss_dbm_object_struct nss_dbm_object_t; |
michael@0 | 81 | struct nss_dbm_object_struct { |
michael@0 | 82 | NSSArena *arena; /* token or session */ |
michael@0 | 83 | nss_dbm_dbt_t *handle; |
michael@0 | 84 | }; |
michael@0 | 85 | |
michael@0 | 86 | typedef struct nss_dbm_find_struct nss_dbm_find_t; |
michael@0 | 87 | struct nss_dbm_find_struct { |
michael@0 | 88 | NSSArena *arena; |
michael@0 | 89 | struct nss_dbm_dbt_node *found; |
michael@0 | 90 | NSSCKFWMutex *list_lock; |
michael@0 | 91 | }; |
michael@0 | 92 | |
michael@0 | 93 | NSS_EXTERN NSSCKMDSlot * |
michael@0 | 94 | nss_dbm_mdSlot_factory |
michael@0 | 95 | ( |
michael@0 | 96 | nss_dbm_instance_t *instance, |
michael@0 | 97 | char *filename, |
michael@0 | 98 | int flags, |
michael@0 | 99 | CK_RV *pError |
michael@0 | 100 | ); |
michael@0 | 101 | |
michael@0 | 102 | NSS_EXTERN NSSCKMDToken * |
michael@0 | 103 | nss_dbm_mdToken_factory |
michael@0 | 104 | ( |
michael@0 | 105 | nss_dbm_slot_t *slot, |
michael@0 | 106 | CK_RV *pError |
michael@0 | 107 | ); |
michael@0 | 108 | |
michael@0 | 109 | NSS_EXTERN NSSCKMDSession * |
michael@0 | 110 | nss_dbm_mdSession_factory |
michael@0 | 111 | ( |
michael@0 | 112 | nss_dbm_token_t *token, |
michael@0 | 113 | NSSCKFWSession *fwSession, |
michael@0 | 114 | NSSCKFWInstance *fwInstance, |
michael@0 | 115 | CK_BBOOL rw, |
michael@0 | 116 | CK_RV *pError |
michael@0 | 117 | ); |
michael@0 | 118 | |
michael@0 | 119 | NSS_EXTERN NSSCKMDObject * |
michael@0 | 120 | nss_dbm_mdObject_factory |
michael@0 | 121 | ( |
michael@0 | 122 | nss_dbm_object_t *object, |
michael@0 | 123 | CK_RV *pError |
michael@0 | 124 | ); |
michael@0 | 125 | |
michael@0 | 126 | NSS_EXTERN NSSCKMDFindObjects * |
michael@0 | 127 | nss_dbm_mdFindObjects_factory |
michael@0 | 128 | ( |
michael@0 | 129 | nss_dbm_find_t *find, |
michael@0 | 130 | CK_RV *pError |
michael@0 | 131 | ); |
michael@0 | 132 | |
michael@0 | 133 | NSS_EXTERN nss_dbm_db_t * |
michael@0 | 134 | nss_dbm_db_open |
michael@0 | 135 | ( |
michael@0 | 136 | NSSArena *arena, |
michael@0 | 137 | NSSCKFWInstance *fwInstance, |
michael@0 | 138 | char *filename, |
michael@0 | 139 | int flags, |
michael@0 | 140 | CK_RV *pError |
michael@0 | 141 | ); |
michael@0 | 142 | |
michael@0 | 143 | NSS_EXTERN void |
michael@0 | 144 | nss_dbm_db_close |
michael@0 | 145 | ( |
michael@0 | 146 | nss_dbm_db_t *db |
michael@0 | 147 | ); |
michael@0 | 148 | |
michael@0 | 149 | NSS_EXTERN CK_VERSION |
michael@0 | 150 | nss_dbm_db_get_format_version |
michael@0 | 151 | ( |
michael@0 | 152 | nss_dbm_db_t *db |
michael@0 | 153 | ); |
michael@0 | 154 | |
michael@0 | 155 | NSS_EXTERN CK_RV |
michael@0 | 156 | nss_dbm_db_set_label |
michael@0 | 157 | ( |
michael@0 | 158 | nss_dbm_db_t *db, |
michael@0 | 159 | NSSUTF8 *label |
michael@0 | 160 | ); |
michael@0 | 161 | |
michael@0 | 162 | NSS_EXTERN NSSUTF8 * |
michael@0 | 163 | nss_dbm_db_get_label |
michael@0 | 164 | ( |
michael@0 | 165 | nss_dbm_db_t *db, |
michael@0 | 166 | NSSArena *arena, |
michael@0 | 167 | CK_RV *pError |
michael@0 | 168 | ); |
michael@0 | 169 | |
michael@0 | 170 | NSS_EXTERN CK_RV |
michael@0 | 171 | nss_dbm_db_delete_object |
michael@0 | 172 | ( |
michael@0 | 173 | nss_dbm_dbt_t *dbt |
michael@0 | 174 | ); |
michael@0 | 175 | |
michael@0 | 176 | NSS_EXTERN nss_dbm_dbt_t * |
michael@0 | 177 | nss_dbm_db_create_object |
michael@0 | 178 | ( |
michael@0 | 179 | NSSArena *arena, |
michael@0 | 180 | nss_dbm_db_t *db, |
michael@0 | 181 | CK_ATTRIBUTE_PTR pTemplate, |
michael@0 | 182 | CK_ULONG ulAttributeCount, |
michael@0 | 183 | CK_RV *pError, |
michael@0 | 184 | CK_ULONG *pdbrv |
michael@0 | 185 | ); |
michael@0 | 186 | |
michael@0 | 187 | NSS_EXTERN CK_RV |
michael@0 | 188 | nss_dbm_db_find_objects |
michael@0 | 189 | ( |
michael@0 | 190 | nss_dbm_find_t *find, |
michael@0 | 191 | nss_dbm_db_t *db, |
michael@0 | 192 | CK_ATTRIBUTE_PTR pTemplate, |
michael@0 | 193 | CK_ULONG ulAttributeCount, |
michael@0 | 194 | CK_ULONG *pdbrv |
michael@0 | 195 | ); |
michael@0 | 196 | |
michael@0 | 197 | NSS_EXTERN CK_BBOOL |
michael@0 | 198 | nss_dbm_db_object_still_exists |
michael@0 | 199 | ( |
michael@0 | 200 | nss_dbm_dbt_t *dbt |
michael@0 | 201 | ); |
michael@0 | 202 | |
michael@0 | 203 | NSS_EXTERN CK_ULONG |
michael@0 | 204 | nss_dbm_db_get_object_attribute_count |
michael@0 | 205 | ( |
michael@0 | 206 | nss_dbm_dbt_t *dbt, |
michael@0 | 207 | CK_RV *pError, |
michael@0 | 208 | CK_ULONG *pdbrv |
michael@0 | 209 | ); |
michael@0 | 210 | |
michael@0 | 211 | NSS_EXTERN CK_RV |
michael@0 | 212 | nss_dbm_db_get_object_attribute_types |
michael@0 | 213 | ( |
michael@0 | 214 | nss_dbm_dbt_t *dbt, |
michael@0 | 215 | CK_ATTRIBUTE_TYPE_PTR typeArray, |
michael@0 | 216 | CK_ULONG ulCount, |
michael@0 | 217 | CK_ULONG *pdbrv |
michael@0 | 218 | ); |
michael@0 | 219 | |
michael@0 | 220 | NSS_EXTERN CK_ULONG |
michael@0 | 221 | nss_dbm_db_get_object_attribute_size |
michael@0 | 222 | ( |
michael@0 | 223 | nss_dbm_dbt_t *dbt, |
michael@0 | 224 | CK_ATTRIBUTE_TYPE type, |
michael@0 | 225 | CK_RV *pError, |
michael@0 | 226 | CK_ULONG *pdbrv |
michael@0 | 227 | ); |
michael@0 | 228 | |
michael@0 | 229 | NSS_EXTERN NSSItem * |
michael@0 | 230 | nss_dbm_db_get_object_attribute |
michael@0 | 231 | ( |
michael@0 | 232 | nss_dbm_dbt_t *dbt, |
michael@0 | 233 | NSSArena *arena, |
michael@0 | 234 | CK_ATTRIBUTE_TYPE type, |
michael@0 | 235 | CK_RV *pError, |
michael@0 | 236 | CK_ULONG *pdbrv |
michael@0 | 237 | ); |
michael@0 | 238 | |
michael@0 | 239 | NSS_EXTERN CK_RV |
michael@0 | 240 | nss_dbm_db_set_object_attribute |
michael@0 | 241 | ( |
michael@0 | 242 | nss_dbm_dbt_t *dbt, |
michael@0 | 243 | CK_ATTRIBUTE_TYPE type, |
michael@0 | 244 | NSSItem *value, |
michael@0 | 245 | CK_ULONG *pdbrv |
michael@0 | 246 | ); |
michael@0 | 247 | |
michael@0 | 248 | #endif /* CKDBM_H */ |