Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions
cdbhdl.h File Reference
#include "nspr.h"
#include "mcom_db.h"
#include "pcertt.h"
#include "prtypes.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  NSSLOWCERTCertDBHandleStr

Defines

#define nsslowcert_reference(x)   (PR_AtomicIncrement(&(x)->ref) , (x))
#define NO_RDONLY   O_RDONLY
#define NO_RDWR   O_RDWR
#define NO_CREATE   (O_RDWR | O_CREAT | O_TRUNC)
#define RDB_FAIL   1
#define RDB_RETRY   2

Typedefs

typedef DB *(* rdbfunc )(const char *appName, const char *prefix, const char *type, int flags)
typedef int(* rdbstatusfunc )(void)

Functions

DBrdbopen (const char *appName, const char *prefix, const char *type, int flags, int *status)
DBdbsopen (const char *dbname, int flags, int mode, DBTYPE type, const void *appData)
SECStatus db_Copy (DB *dest, DB *src)
int db_BeginTransaction (DB *db)
int db_FinishTransaction (DB *db, PRBool abort)
int db_InitComplete (DB *db)

Class Documentation

struct NSSLOWCERTCertDBHandleStr

Definition at line 53 of file cdbhdl.h.

Collaboration diagram for NSSLOWCERTCertDBHandleStr:
Class Members
PZMonitor * dbMon
PRBool dbVerify
DB * permCertDB
PRInt32 ref

Define Documentation

Definition at line 69 of file cdbhdl.h.

Definition at line 67 of file cdbhdl.h.

Definition at line 68 of file cdbhdl.h.

Definition at line 60 of file cdbhdl.h.

#define RDB_FAIL   1

Definition at line 76 of file cdbhdl.h.

#define RDB_RETRY   2

Definition at line 77 of file cdbhdl.h.


Typedef Documentation

typedef DB*(* rdbfunc)(const char *appName, const char *prefix, const char *type, int flags)

Definition at line 72 of file cdbhdl.h.

typedef int(* rdbstatusfunc)(void)

Definition at line 74 of file cdbhdl.h.


Function Documentation

Definition at line 393 of file dbinit.c.

{
    struct RDBStr *rdb = (struct RDBStr *)db;
    if (db->type != DB_RDB) {
       return 0;
    }

    return rdb->xactstart(db);
}
SECStatus db_Copy ( DB dest,
DB src 
)

Definition at line 434 of file dbinit.c.

{
    int ret;
    DBT key,data;
    ret = (*src->seq)(src, &key, &data, R_FIRST);
    if (ret)  {
       return SECSuccess;
    }

    do {
       (void)(*dest->put)(dest,&key,&data, R_NOOVERWRITE);
    } while ( (*src->seq)(src, &key, &data, R_NEXT) == 0);
    (void)(*dest->sync)(dest,0);

    return SECSuccess;
}
int db_FinishTransaction ( DB db,
PRBool  abort 
)

Definition at line 404 of file dbinit.c.

{
    struct RDBStr *rdb = (struct RDBStr *)db;
    if (db->type != DB_RDB) {
       return 0;
    }

    return rdb->xactdone(db, abort);
}
int db_InitComplete ( DB db)

Definition at line 415 of file dbinit.c.

{
    struct RDBStr *rdb = (struct RDBStr *)db;
    if (db->type != DB_RDB) {
       return 0;
    }
    /* we should have addes a version number to the RDBS structure. Since we
     * didn't, we detect that we have and 'extended' structure if the rdbstatus
     * func exists */
    if (!sftk_rdbstatusfunc) {
       return 0;
    }

    return rdb->dbinitcomplete(db);
}
DB* dbsopen ( const char *  dbname,
int  flags,
int  mode,
DBTYPE  type,
const void appData 
)

Definition at line 604 of file dbmshim.c.

{
    DB *db = NULL,*dbs = NULL;
    DBS *dbsp = NULL;

    /* NOTE: we are overriding userData with dbs_hashInfo. since all known
     * callers pass 0, this is ok, otherwise we should merge the two */

    dbsp = (DBS *)PORT_ZAlloc(sizeof(DBS));
    if (!dbsp) {
       return NULL;
    }
    dbs = &dbsp->db;

    dbsp->blobdir=dbs_mkBlobDirName(dbname);
    if (dbsp->blobdir == NULL) {
       goto loser;
    }
    dbsp->mode = mode;
    dbsp->readOnly = (PRBool)(flags == NO_RDONLY);
    dbsp->dbs_mapfile = NULL;
    dbsp->dbs_addr = NULL;
    dbsp->dbs_len = 0;

    /* the real dbm call */
    db = dbopen(dbname, flags, mode, type, &dbs_hashInfo);
    if (db == NULL) {
       goto loser;
    }
    dbs->internal = (void *) db;
    dbs->type = type;
    dbs->close = dbs_close;
    dbs->get = dbs_get;
    dbs->del = dbs_del;
    dbs->put = dbs_put;
    dbs->seq = dbs_seq;
    dbs->sync = dbs_sync;
    dbs->fd = dbs_fd;

    return dbs;
loser:
    if (db) {
       (*db->close)(db);
    }
    if (dbsp && dbsp->blobdir) {
       PORT_Free(dbsp->blobdir);
    }
    if (dbsp) {
       PORT_Free(dbsp);
    }
    return NULL;
}

Here is the call graph for this function:

DB* rdbopen ( const char *  appName,
const char *  prefix,
const char *  type,
int  flags,
int status 
)

Definition at line 315 of file dbinit.c.

{
    PRLibrary *lib;
    DB *db;

    if (sftk_rdbfunc) {
       db = (*sftk_rdbfunc)(appName,prefix,type,rdbmapflags(flags));
       if (!db && status && sftk_rdbstatusfunc) {
           *status = (*sftk_rdbstatusfunc)();
       }
       return db;
    }

    /*
     * try to open the library.
     */
    lib = PR_LoadLibrary(RDBLIB);

    if (!lib) {
       return NULL;
    }

    /* get the entry points */
    sftk_rdbstatusfunc = (rdbstatusfunc) PR_FindSymbol(lib,"rdbstatus");
    sftk_rdbfunc = (rdbfunc) PR_FindSymbol(lib,"rdbopen");
    if (sftk_rdbfunc) {
       db = (*sftk_rdbfunc)(appName,prefix,type,rdbmapflags(flags));
       if (!db && status && sftk_rdbstatusfunc) {
           *status = (*sftk_rdbstatusfunc)();
       }
       return db;
    }

    /* couldn't find the entry point, unload the library and fail */
    PR_UnloadLibrary(lib);
    return NULL;
}

Here is the call graph for this function: