1 /* 2 * private.h - Private data structures for the software token library 3 * 4 * This Source Code Form is subject to the terms of the Mozilla Public 5 * License, v. 2.0. If a copy of the MPL was not distributed with this 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 7 8 #ifndef _KEYDBI_H_ 9 #define _KEYDBI_H_ 10 11 #include <nspr.h> 12 #include "seccomon.h" 13 #include <db.h> 14 15 /* 16 * Handle structure for open key databases 17 */ 18 struct NSSLOWKEYDBHandleStr { 19 DB *db; 20 DB *updatedb; /* used when updating an old version */ 21 SECItem *global_salt; /* password hashing salt for this db */ 22 int version; /* version of the database */ 23 char *appname; /* multiaccess app name */ 24 char *dbname; /* name of the openned DB */ 25 PRBool readOnly; /* is the DB read only */ 26 PRLock *lock; 27 PRInt32 ref; /* reference count */ 28 }; 29 30 /* 31 ** Typedef for callback for traversing key database. 32 ** "key" is the key used to index the data in the database (nickname) 33 ** "data" is the key data 34 ** "pdata" is the user's data 35 */ 36 typedef SECStatus (*NSSLOWKEYTraverseKeysFunc)(DBT *key, DBT *data, void *pdata); 37 38 SEC_BEGIN_PROTOS 39 40 /* 41 ** Traverse the entire key database, and pass the nicknames and keys to a 42 ** user supplied function. 43 ** "f" is the user function to call for each key 44 ** "udata" is the user's data, which is passed through to "f" 45 */ 46 extern SECStatus nsslowkey_TraverseKeys(NSSLOWKEYDBHandle *handle, 47 NSSLOWKEYTraverseKeysFunc f, 48 void *udata); 49 50 SEC_END_PROTOS 51 52 #endif /* _KEYDBI_H_ */ 53