Back to index

lightning-sunbird  0.9+nobinonly
keydbi.h
Go to the documentation of this file.
00001 /*
00002  * private.h - Private data structures for the software token library
00003  *
00004  * ***** BEGIN LICENSE BLOCK *****
00005  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00006  *
00007  * The contents of this file are subject to the Mozilla Public License Version
00008  * 1.1 (the "License"); you may not use this file except in compliance with
00009  * the License. You may obtain a copy of the License at
00010  * http://www.mozilla.org/MPL/
00011  *
00012  * Software distributed under the License is distributed on an "AS IS" basis,
00013  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00014  * for the specific language governing rights and limitations under the
00015  * License.
00016  *
00017  * The Original Code is the Netscape security libraries.
00018  *
00019  * The Initial Developer of the Original Code is
00020  * Netscape Communications Corporation.
00021  * Portions created by the Initial Developer are Copyright (C) 1994-2000
00022  * the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either the GNU General Public License Version 2 or later (the "GPL"), or
00028  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 /* $Id: keydbi.h,v 1.7 2005/09/28 17:12:17 relyea%netscape.com Exp $ */
00040 
00041 #ifndef _KEYDBI_H_
00042 #define _KEYDBI_H_
00043 
00044 #include "nspr.h"
00045 #include "seccomon.h"
00046 #include "mcom_db.h"
00047 
00048 /*
00049  * Handle structure for open key databases
00050  */
00051 struct NSSLOWKEYDBHandleStr {
00052     DB *db;
00053     DB *updatedb;           /* used when updating an old version */
00054     SECItem *global_salt;   /* password hashing salt for this db */
00055     int version;            /* version of the database */
00056     char *appname;          /* multiaccess app name */
00057     char *dbname;           /* name of the openned DB */
00058     PRBool readOnly;        /* is the DB read only */
00059     PRLock *lock;
00060     PRInt32 ref;            /* reference count */
00061 };
00062 
00063 /*
00064 ** Typedef for callback for traversing key database.
00065 **      "key" is the key used to index the data in the database (nickname)
00066 **      "data" is the key data
00067 **      "pdata" is the user's data 
00068 */
00069 typedef SECStatus (* NSSLOWKEYTraverseKeysFunc)(DBT *key, DBT *data, void *pdata);
00070 
00071 
00072 SEC_BEGIN_PROTOS
00073 
00074 /*
00075 ** Traverse the entire key database, and pass the nicknames and keys to a 
00076 ** user supplied function.
00077 **      "f" is the user function to call for each key
00078 **      "udata" is the user's data, which is passed through to "f"
00079 */
00080 extern SECStatus nsslowkey_TraverseKeys(NSSLOWKEYDBHandle *handle, 
00081                             NSSLOWKEYTraverseKeysFunc f,
00082                             void *udata);
00083 
00084 SEC_END_PROTOS
00085 
00086 #endif /* _KEYDBI_H_ */