michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef CKDBM_H michael@0: #define CKDBM_H michael@0: michael@0: #include "nssckmdt.h" michael@0: #include "nssckfw.h" michael@0: michael@0: /* michael@0: * I'm including this for access to the arena functions. michael@0: * Looks like we should publish that API. michael@0: */ michael@0: #ifndef BASE_H michael@0: #include "base.h" michael@0: #endif /* BASE_H */ michael@0: michael@0: /* michael@0: * This is where the Netscape extensions live, at least for now. michael@0: */ michael@0: #ifndef CKT_H michael@0: #include "ckt.h" michael@0: #endif /* CKT_H */ michael@0: michael@0: #include "mcom_db.h" michael@0: michael@0: NSS_EXTERN_DATA NSSCKMDInstance nss_dbm_mdInstance; michael@0: michael@0: typedef struct nss_dbm_db_struct nss_dbm_db_t; michael@0: struct nss_dbm_db_struct { michael@0: DB *db; michael@0: NSSCKFWMutex *crustylock; michael@0: }; michael@0: michael@0: typedef struct nss_dbm_dbt_struct nss_dbm_dbt_t; michael@0: struct nss_dbm_dbt_struct { michael@0: DBT dbt; michael@0: nss_dbm_db_t *my_db; michael@0: }; michael@0: michael@0: typedef struct nss_dbm_instance_struct nss_dbm_instance_t; michael@0: struct nss_dbm_instance_struct { michael@0: NSSArena *arena; michael@0: CK_ULONG nSlots; michael@0: char **filenames; michael@0: int *flags; /* e.g. O_RDONLY, O_RDWR */ michael@0: }; michael@0: michael@0: typedef struct nss_dbm_slot_struct nss_dbm_slot_t; michael@0: struct nss_dbm_slot_struct { michael@0: nss_dbm_instance_t *instance; michael@0: char *filename; michael@0: int flags; michael@0: nss_dbm_db_t *token_db; michael@0: }; michael@0: michael@0: typedef struct nss_dbm_token_struct nss_dbm_token_t; michael@0: struct nss_dbm_token_struct { michael@0: NSSArena *arena; michael@0: nss_dbm_slot_t *slot; michael@0: nss_dbm_db_t *session_db; michael@0: NSSUTF8 *label; michael@0: }; michael@0: michael@0: struct nss_dbm_dbt_node { michael@0: struct nss_dbm_dbt_node *next; michael@0: nss_dbm_dbt_t *dbt; michael@0: }; michael@0: michael@0: typedef struct nss_dbm_session_struct nss_dbm_session_t; michael@0: struct nss_dbm_session_struct { michael@0: NSSArena *arena; michael@0: nss_dbm_token_t *token; michael@0: CK_ULONG deviceError; michael@0: struct nss_dbm_dbt_node *session_objects; michael@0: NSSCKFWMutex *list_lock; michael@0: }; michael@0: michael@0: typedef struct nss_dbm_object_struct nss_dbm_object_t; michael@0: struct nss_dbm_object_struct { michael@0: NSSArena *arena; /* token or session */ michael@0: nss_dbm_dbt_t *handle; michael@0: }; michael@0: michael@0: typedef struct nss_dbm_find_struct nss_dbm_find_t; michael@0: struct nss_dbm_find_struct { michael@0: NSSArena *arena; michael@0: struct nss_dbm_dbt_node *found; michael@0: NSSCKFWMutex *list_lock; michael@0: }; michael@0: michael@0: NSS_EXTERN NSSCKMDSlot * michael@0: nss_dbm_mdSlot_factory michael@0: ( michael@0: nss_dbm_instance_t *instance, michael@0: char *filename, michael@0: int flags, michael@0: CK_RV *pError michael@0: ); michael@0: michael@0: NSS_EXTERN NSSCKMDToken * michael@0: nss_dbm_mdToken_factory michael@0: ( michael@0: nss_dbm_slot_t *slot, michael@0: CK_RV *pError michael@0: ); michael@0: michael@0: NSS_EXTERN NSSCKMDSession * michael@0: nss_dbm_mdSession_factory michael@0: ( michael@0: nss_dbm_token_t *token, michael@0: NSSCKFWSession *fwSession, michael@0: NSSCKFWInstance *fwInstance, michael@0: CK_BBOOL rw, michael@0: CK_RV *pError michael@0: ); michael@0: michael@0: NSS_EXTERN NSSCKMDObject * michael@0: nss_dbm_mdObject_factory michael@0: ( michael@0: nss_dbm_object_t *object, michael@0: CK_RV *pError michael@0: ); michael@0: michael@0: NSS_EXTERN NSSCKMDFindObjects * michael@0: nss_dbm_mdFindObjects_factory michael@0: ( michael@0: nss_dbm_find_t *find, michael@0: CK_RV *pError michael@0: ); michael@0: michael@0: NSS_EXTERN nss_dbm_db_t * michael@0: nss_dbm_db_open michael@0: ( michael@0: NSSArena *arena, michael@0: NSSCKFWInstance *fwInstance, michael@0: char *filename, michael@0: int flags, michael@0: CK_RV *pError michael@0: ); michael@0: michael@0: NSS_EXTERN void michael@0: nss_dbm_db_close michael@0: ( michael@0: nss_dbm_db_t *db michael@0: ); michael@0: michael@0: NSS_EXTERN CK_VERSION michael@0: nss_dbm_db_get_format_version michael@0: ( michael@0: nss_dbm_db_t *db michael@0: ); michael@0: michael@0: NSS_EXTERN CK_RV michael@0: nss_dbm_db_set_label michael@0: ( michael@0: nss_dbm_db_t *db, michael@0: NSSUTF8 *label michael@0: ); michael@0: michael@0: NSS_EXTERN NSSUTF8 * michael@0: nss_dbm_db_get_label michael@0: ( michael@0: nss_dbm_db_t *db, michael@0: NSSArena *arena, michael@0: CK_RV *pError michael@0: ); michael@0: michael@0: NSS_EXTERN CK_RV michael@0: nss_dbm_db_delete_object michael@0: ( michael@0: nss_dbm_dbt_t *dbt michael@0: ); michael@0: michael@0: NSS_EXTERN nss_dbm_dbt_t * michael@0: nss_dbm_db_create_object michael@0: ( michael@0: NSSArena *arena, michael@0: nss_dbm_db_t *db, michael@0: CK_ATTRIBUTE_PTR pTemplate, michael@0: CK_ULONG ulAttributeCount, michael@0: CK_RV *pError, michael@0: CK_ULONG *pdbrv michael@0: ); michael@0: michael@0: NSS_EXTERN CK_RV michael@0: nss_dbm_db_find_objects michael@0: ( michael@0: nss_dbm_find_t *find, michael@0: nss_dbm_db_t *db, michael@0: CK_ATTRIBUTE_PTR pTemplate, michael@0: CK_ULONG ulAttributeCount, michael@0: CK_ULONG *pdbrv michael@0: ); michael@0: michael@0: NSS_EXTERN CK_BBOOL michael@0: nss_dbm_db_object_still_exists michael@0: ( michael@0: nss_dbm_dbt_t *dbt michael@0: ); michael@0: michael@0: NSS_EXTERN CK_ULONG michael@0: nss_dbm_db_get_object_attribute_count michael@0: ( michael@0: nss_dbm_dbt_t *dbt, michael@0: CK_RV *pError, michael@0: CK_ULONG *pdbrv michael@0: ); michael@0: michael@0: NSS_EXTERN CK_RV michael@0: nss_dbm_db_get_object_attribute_types michael@0: ( michael@0: nss_dbm_dbt_t *dbt, michael@0: CK_ATTRIBUTE_TYPE_PTR typeArray, michael@0: CK_ULONG ulCount, michael@0: CK_ULONG *pdbrv michael@0: ); michael@0: michael@0: NSS_EXTERN CK_ULONG michael@0: nss_dbm_db_get_object_attribute_size michael@0: ( michael@0: nss_dbm_dbt_t *dbt, michael@0: CK_ATTRIBUTE_TYPE type, michael@0: CK_RV *pError, michael@0: CK_ULONG *pdbrv michael@0: ); michael@0: michael@0: NSS_EXTERN NSSItem * michael@0: nss_dbm_db_get_object_attribute michael@0: ( michael@0: nss_dbm_dbt_t *dbt, michael@0: NSSArena *arena, michael@0: CK_ATTRIBUTE_TYPE type, michael@0: CK_RV *pError, michael@0: CK_ULONG *pdbrv michael@0: ); michael@0: michael@0: NSS_EXTERN CK_RV michael@0: nss_dbm_db_set_object_attribute michael@0: ( michael@0: nss_dbm_dbt_t *dbt, michael@0: CK_ATTRIBUTE_TYPE type, michael@0: NSSItem *value, michael@0: CK_ULONG *pdbrv michael@0: ); michael@0: michael@0: #endif /* CKDBM_H */