1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers. 3*7c478bd9Sstevel@tonic-gate * All rights reserved. 4*7c478bd9Sstevel@tonic-gate * 5*7c478bd9Sstevel@tonic-gate * By using this file, you agree to the terms and conditions set 6*7c478bd9Sstevel@tonic-gate * forth in the LICENSE file which can be found at the top level of 7*7c478bd9Sstevel@tonic-gate * the sendmail distribution. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * $Id: smdb.h,v 8.40.2.1 2002/10/05 17:04:51 ca Exp $ 10*7c478bd9Sstevel@tonic-gate * 11*7c478bd9Sstevel@tonic-gate */ 12*7c478bd9Sstevel@tonic-gate 13*7c478bd9Sstevel@tonic-gate #ifndef _SMDB_H_ 14*7c478bd9Sstevel@tonic-gate # define _SMDB_H_ 15*7c478bd9Sstevel@tonic-gate 16*7c478bd9Sstevel@tonic-gate # include <sys/types.h> 17*7c478bd9Sstevel@tonic-gate # include <sys/stat.h> 18*7c478bd9Sstevel@tonic-gate # include <sm/gen.h> 19*7c478bd9Sstevel@tonic-gate # include <sm/errstring.h> 20*7c478bd9Sstevel@tonic-gate 21*7c478bd9Sstevel@tonic-gate # ifdef NDBM 22*7c478bd9Sstevel@tonic-gate # include <ndbm.h> 23*7c478bd9Sstevel@tonic-gate # endif /* NDBM */ 24*7c478bd9Sstevel@tonic-gate 25*7c478bd9Sstevel@tonic-gate # ifdef NEWDB 26*7c478bd9Sstevel@tonic-gate # include "sm/bdb.h" 27*7c478bd9Sstevel@tonic-gate # endif /* NEWDB */ 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate /* 30*7c478bd9Sstevel@tonic-gate ** Some size constants 31*7c478bd9Sstevel@tonic-gate */ 32*7c478bd9Sstevel@tonic-gate 33*7c478bd9Sstevel@tonic-gate #define SMDB_MAX_USER_NAME_LEN 1024 34*7c478bd9Sstevel@tonic-gate 35*7c478bd9Sstevel@tonic-gate /* 36*7c478bd9Sstevel@tonic-gate ** This file defines the abstraction for database lookups. It is pretty 37*7c478bd9Sstevel@tonic-gate ** much a copy of the db2 interface with the exception that every function 38*7c478bd9Sstevel@tonic-gate ** returns 0 on success and non-zero on failure. The non-zero return code 39*7c478bd9Sstevel@tonic-gate ** is meaningful. 40*7c478bd9Sstevel@tonic-gate ** 41*7c478bd9Sstevel@tonic-gate ** I'm going to put the function comments in this file since the interface 42*7c478bd9Sstevel@tonic-gate ** MUST be the same for all inheritors of this interface. 43*7c478bd9Sstevel@tonic-gate */ 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate typedef struct database_struct SMDB_DATABASE; 46*7c478bd9Sstevel@tonic-gate typedef struct cursor_struct SMDB_CURSOR; 47*7c478bd9Sstevel@tonic-gate typedef struct entry_struct SMDB_DBENT; 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate /* 50*7c478bd9Sstevel@tonic-gate ** DB_CLOSE_FUNC -- close the database 51*7c478bd9Sstevel@tonic-gate ** 52*7c478bd9Sstevel@tonic-gate ** Parameters: 53*7c478bd9Sstevel@tonic-gate ** db -- The database to close. 54*7c478bd9Sstevel@tonic-gate ** 55*7c478bd9Sstevel@tonic-gate ** Returns: 56*7c478bd9Sstevel@tonic-gate ** 0 - Success, otherwise errno. 57*7c478bd9Sstevel@tonic-gate ** 58*7c478bd9Sstevel@tonic-gate */ 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gate typedef int (*db_close_func) __P((SMDB_DATABASE *db)); 61*7c478bd9Sstevel@tonic-gate 62*7c478bd9Sstevel@tonic-gate /* 63*7c478bd9Sstevel@tonic-gate ** DB_DEL_FUNC -- removes a key and data pair from the database 64*7c478bd9Sstevel@tonic-gate ** 65*7c478bd9Sstevel@tonic-gate ** Parameters: 66*7c478bd9Sstevel@tonic-gate ** db -- The database to close. 67*7c478bd9Sstevel@tonic-gate ** key -- The key to remove. 68*7c478bd9Sstevel@tonic-gate ** flags -- delete options. There are currently no defined 69*7c478bd9Sstevel@tonic-gate ** flags for delete. 70*7c478bd9Sstevel@tonic-gate ** 71*7c478bd9Sstevel@tonic-gate ** Returns: 72*7c478bd9Sstevel@tonic-gate ** 0 - Success, otherwise errno. 73*7c478bd9Sstevel@tonic-gate ** 74*7c478bd9Sstevel@tonic-gate */ 75*7c478bd9Sstevel@tonic-gate 76*7c478bd9Sstevel@tonic-gate typedef int (*db_del_func) __P((SMDB_DATABASE *db, 77*7c478bd9Sstevel@tonic-gate SMDB_DBENT *key, unsigned int flags)); 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate /* 80*7c478bd9Sstevel@tonic-gate ** DB_FD_FUNC -- Returns a pointer to a file used for the database. 81*7c478bd9Sstevel@tonic-gate ** 82*7c478bd9Sstevel@tonic-gate ** Parameters: 83*7c478bd9Sstevel@tonic-gate ** db -- The database to close. 84*7c478bd9Sstevel@tonic-gate ** fd -- A pointer to store the returned fd in. 85*7c478bd9Sstevel@tonic-gate ** 86*7c478bd9Sstevel@tonic-gate ** Returns: 87*7c478bd9Sstevel@tonic-gate ** 0 - Success, otherwise errno. 88*7c478bd9Sstevel@tonic-gate ** 89*7c478bd9Sstevel@tonic-gate */ 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate typedef int (*db_fd_func) __P((SMDB_DATABASE *db, int* fd)); 92*7c478bd9Sstevel@tonic-gate 93*7c478bd9Sstevel@tonic-gate /* 94*7c478bd9Sstevel@tonic-gate ** DB_GET_FUNC -- Gets the data associated with a key. 95*7c478bd9Sstevel@tonic-gate ** 96*7c478bd9Sstevel@tonic-gate ** Parameters: 97*7c478bd9Sstevel@tonic-gate ** db -- The database to close. 98*7c478bd9Sstevel@tonic-gate ** key -- The key to access. 99*7c478bd9Sstevel@tonic-gate ** data -- A place to store the returned data. 100*7c478bd9Sstevel@tonic-gate ** flags -- get options. There are currently no defined 101*7c478bd9Sstevel@tonic-gate ** flags for get. 102*7c478bd9Sstevel@tonic-gate ** 103*7c478bd9Sstevel@tonic-gate ** Returns: 104*7c478bd9Sstevel@tonic-gate ** 0 - Success, otherwise errno. 105*7c478bd9Sstevel@tonic-gate ** 106*7c478bd9Sstevel@tonic-gate */ 107*7c478bd9Sstevel@tonic-gate 108*7c478bd9Sstevel@tonic-gate typedef int (*db_get_func) __P((SMDB_DATABASE *db, 109*7c478bd9Sstevel@tonic-gate SMDB_DBENT *key, 110*7c478bd9Sstevel@tonic-gate SMDB_DBENT *data, unsigned int flags)); 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate /* 113*7c478bd9Sstevel@tonic-gate ** DB_PUT_FUNC -- Sets some data according to the key. 114*7c478bd9Sstevel@tonic-gate ** 115*7c478bd9Sstevel@tonic-gate ** Parameters: 116*7c478bd9Sstevel@tonic-gate ** db -- The database to close. 117*7c478bd9Sstevel@tonic-gate ** key -- The key to use. 118*7c478bd9Sstevel@tonic-gate ** data -- The data to store. 119*7c478bd9Sstevel@tonic-gate ** flags -- put options: 120*7c478bd9Sstevel@tonic-gate ** SMDBF_NO_OVERWRITE - Return an error if key alread 121*7c478bd9Sstevel@tonic-gate ** exists. 122*7c478bd9Sstevel@tonic-gate ** SMDBF_ALLOW_DUP - Allow duplicates in btree maps. 123*7c478bd9Sstevel@tonic-gate ** 124*7c478bd9Sstevel@tonic-gate ** Returns: 125*7c478bd9Sstevel@tonic-gate ** 0 - Success, otherwise errno. 126*7c478bd9Sstevel@tonic-gate ** 127*7c478bd9Sstevel@tonic-gate */ 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate typedef int (*db_put_func) __P((SMDB_DATABASE *db, 130*7c478bd9Sstevel@tonic-gate SMDB_DBENT *key, 131*7c478bd9Sstevel@tonic-gate SMDB_DBENT *data, unsigned int flags)); 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate /* 134*7c478bd9Sstevel@tonic-gate ** DB_SYNC_FUNC -- Flush any cached information to disk. 135*7c478bd9Sstevel@tonic-gate ** 136*7c478bd9Sstevel@tonic-gate ** Parameters: 137*7c478bd9Sstevel@tonic-gate ** db -- The database to sync. 138*7c478bd9Sstevel@tonic-gate ** flags -- sync options: 139*7c478bd9Sstevel@tonic-gate ** 140*7c478bd9Sstevel@tonic-gate ** Returns: 141*7c478bd9Sstevel@tonic-gate ** 0 - Success, otherwise errno. 142*7c478bd9Sstevel@tonic-gate ** 143*7c478bd9Sstevel@tonic-gate */ 144*7c478bd9Sstevel@tonic-gate 145*7c478bd9Sstevel@tonic-gate typedef int (*db_sync_func) __P((SMDB_DATABASE *db, unsigned int flags)); 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate /* 148*7c478bd9Sstevel@tonic-gate ** DB_SET_OWNER_FUNC -- Set the owner and group of the database files. 149*7c478bd9Sstevel@tonic-gate ** 150*7c478bd9Sstevel@tonic-gate ** Parameters: 151*7c478bd9Sstevel@tonic-gate ** db -- The database to set. 152*7c478bd9Sstevel@tonic-gate ** uid -- The UID for the new owner (-1 for no change) 153*7c478bd9Sstevel@tonic-gate ** gid -- The GID for the new owner (-1 for no change) 154*7c478bd9Sstevel@tonic-gate ** 155*7c478bd9Sstevel@tonic-gate ** Returns: 156*7c478bd9Sstevel@tonic-gate ** 0 - Success, otherwise errno. 157*7c478bd9Sstevel@tonic-gate ** 158*7c478bd9Sstevel@tonic-gate */ 159*7c478bd9Sstevel@tonic-gate 160*7c478bd9Sstevel@tonic-gate typedef int (*db_set_owner_func) __P((SMDB_DATABASE *db, uid_t uid, gid_t gid)); 161*7c478bd9Sstevel@tonic-gate 162*7c478bd9Sstevel@tonic-gate /* 163*7c478bd9Sstevel@tonic-gate ** DB_CURSOR -- Obtain a cursor for sequential access 164*7c478bd9Sstevel@tonic-gate ** 165*7c478bd9Sstevel@tonic-gate ** Parameters: 166*7c478bd9Sstevel@tonic-gate ** db -- The database to use. 167*7c478bd9Sstevel@tonic-gate ** cursor -- The address of a cursor pointer. 168*7c478bd9Sstevel@tonic-gate ** flags -- sync options: 169*7c478bd9Sstevel@tonic-gate ** 170*7c478bd9Sstevel@tonic-gate ** Returns: 171*7c478bd9Sstevel@tonic-gate ** 0 - Success, otherwise errno. 172*7c478bd9Sstevel@tonic-gate ** 173*7c478bd9Sstevel@tonic-gate */ 174*7c478bd9Sstevel@tonic-gate 175*7c478bd9Sstevel@tonic-gate typedef int (*db_cursor_func) __P((SMDB_DATABASE *db, 176*7c478bd9Sstevel@tonic-gate SMDB_CURSOR **cursor, unsigned int flags)); 177*7c478bd9Sstevel@tonic-gate 178*7c478bd9Sstevel@tonic-gate typedef int (*db_lockfd_func) __P((SMDB_DATABASE *db)); 179*7c478bd9Sstevel@tonic-gate 180*7c478bd9Sstevel@tonic-gate struct database_struct 181*7c478bd9Sstevel@tonic-gate { 182*7c478bd9Sstevel@tonic-gate db_close_func smdb_close; 183*7c478bd9Sstevel@tonic-gate db_del_func smdb_del; 184*7c478bd9Sstevel@tonic-gate db_fd_func smdb_fd; 185*7c478bd9Sstevel@tonic-gate db_get_func smdb_get; 186*7c478bd9Sstevel@tonic-gate db_put_func smdb_put; 187*7c478bd9Sstevel@tonic-gate db_sync_func smdb_sync; 188*7c478bd9Sstevel@tonic-gate db_set_owner_func smdb_set_owner; 189*7c478bd9Sstevel@tonic-gate db_cursor_func smdb_cursor; 190*7c478bd9Sstevel@tonic-gate db_lockfd_func smdb_lockfd; 191*7c478bd9Sstevel@tonic-gate void *smdb_impl; 192*7c478bd9Sstevel@tonic-gate }; 193*7c478bd9Sstevel@tonic-gate /* 194*7c478bd9Sstevel@tonic-gate ** DB_CURSOR_CLOSE -- Close a cursor 195*7c478bd9Sstevel@tonic-gate ** 196*7c478bd9Sstevel@tonic-gate ** Parameters: 197*7c478bd9Sstevel@tonic-gate ** cursor -- The cursor to close. 198*7c478bd9Sstevel@tonic-gate ** 199*7c478bd9Sstevel@tonic-gate ** Returns: 200*7c478bd9Sstevel@tonic-gate ** 0 - Success, otherwise errno. 201*7c478bd9Sstevel@tonic-gate ** 202*7c478bd9Sstevel@tonic-gate */ 203*7c478bd9Sstevel@tonic-gate 204*7c478bd9Sstevel@tonic-gate typedef int (*db_cursor_close_func) __P((SMDB_CURSOR *cursor)); 205*7c478bd9Sstevel@tonic-gate 206*7c478bd9Sstevel@tonic-gate /* 207*7c478bd9Sstevel@tonic-gate ** DB_CURSOR_DEL -- Delete the key/value pair of this cursor 208*7c478bd9Sstevel@tonic-gate ** 209*7c478bd9Sstevel@tonic-gate ** Parameters: 210*7c478bd9Sstevel@tonic-gate ** cursor -- The cursor. 211*7c478bd9Sstevel@tonic-gate ** flags -- flags 212*7c478bd9Sstevel@tonic-gate ** 213*7c478bd9Sstevel@tonic-gate ** Returns: 214*7c478bd9Sstevel@tonic-gate ** 0 - Success, otherwise errno. 215*7c478bd9Sstevel@tonic-gate ** 216*7c478bd9Sstevel@tonic-gate */ 217*7c478bd9Sstevel@tonic-gate 218*7c478bd9Sstevel@tonic-gate typedef int (*db_cursor_del_func) __P((SMDB_CURSOR *cursor, 219*7c478bd9Sstevel@tonic-gate unsigned int flags)); 220*7c478bd9Sstevel@tonic-gate 221*7c478bd9Sstevel@tonic-gate /* 222*7c478bd9Sstevel@tonic-gate ** DB_CURSOR_GET -- Get the key/value of this cursor. 223*7c478bd9Sstevel@tonic-gate ** 224*7c478bd9Sstevel@tonic-gate ** Parameters: 225*7c478bd9Sstevel@tonic-gate ** cursor -- The cursor. 226*7c478bd9Sstevel@tonic-gate ** key -- The current key. 227*7c478bd9Sstevel@tonic-gate ** value -- The current value 228*7c478bd9Sstevel@tonic-gate ** flags -- flags 229*7c478bd9Sstevel@tonic-gate ** 230*7c478bd9Sstevel@tonic-gate ** Returns: 231*7c478bd9Sstevel@tonic-gate ** 0 - Success, otherwise errno. 232*7c478bd9Sstevel@tonic-gate ** SMDBE_LAST_ENTRY - This is a success condition that 233*7c478bd9Sstevel@tonic-gate ** gets returned when the end of the 234*7c478bd9Sstevel@tonic-gate ** database is hit. 235*7c478bd9Sstevel@tonic-gate ** 236*7c478bd9Sstevel@tonic-gate */ 237*7c478bd9Sstevel@tonic-gate 238*7c478bd9Sstevel@tonic-gate typedef int (*db_cursor_get_func) __P((SMDB_CURSOR *cursor, 239*7c478bd9Sstevel@tonic-gate SMDB_DBENT *key, 240*7c478bd9Sstevel@tonic-gate SMDB_DBENT *data, 241*7c478bd9Sstevel@tonic-gate unsigned int flags)); 242*7c478bd9Sstevel@tonic-gate 243*7c478bd9Sstevel@tonic-gate /* 244*7c478bd9Sstevel@tonic-gate ** Flags for DB_CURSOR_GET 245*7c478bd9Sstevel@tonic-gate */ 246*7c478bd9Sstevel@tonic-gate 247*7c478bd9Sstevel@tonic-gate #define SMDB_CURSOR_GET_FIRST 0 248*7c478bd9Sstevel@tonic-gate #define SMDB_CURSOR_GET_LAST 1 249*7c478bd9Sstevel@tonic-gate #define SMDB_CURSOR_GET_NEXT 2 250*7c478bd9Sstevel@tonic-gate #define SMDB_CURSOR_GET_RANGE 3 251*7c478bd9Sstevel@tonic-gate 252*7c478bd9Sstevel@tonic-gate /* 253*7c478bd9Sstevel@tonic-gate ** DB_CURSOR_PUT -- Put the key/value at this cursor. 254*7c478bd9Sstevel@tonic-gate ** 255*7c478bd9Sstevel@tonic-gate ** Parameters: 256*7c478bd9Sstevel@tonic-gate ** cursor -- The cursor. 257*7c478bd9Sstevel@tonic-gate ** key -- The current key. 258*7c478bd9Sstevel@tonic-gate ** value -- The current value 259*7c478bd9Sstevel@tonic-gate ** flags -- flags 260*7c478bd9Sstevel@tonic-gate ** 261*7c478bd9Sstevel@tonic-gate ** Returns: 262*7c478bd9Sstevel@tonic-gate ** 0 - Success, otherwise errno. 263*7c478bd9Sstevel@tonic-gate ** 264*7c478bd9Sstevel@tonic-gate */ 265*7c478bd9Sstevel@tonic-gate 266*7c478bd9Sstevel@tonic-gate typedef int (*db_cursor_put_func) __P((SMDB_CURSOR *cursor, 267*7c478bd9Sstevel@tonic-gate SMDB_DBENT *key, 268*7c478bd9Sstevel@tonic-gate SMDB_DBENT *data, 269*7c478bd9Sstevel@tonic-gate unsigned int flags)); 270*7c478bd9Sstevel@tonic-gate 271*7c478bd9Sstevel@tonic-gate 272*7c478bd9Sstevel@tonic-gate 273*7c478bd9Sstevel@tonic-gate struct cursor_struct 274*7c478bd9Sstevel@tonic-gate { 275*7c478bd9Sstevel@tonic-gate db_cursor_close_func smdbc_close; 276*7c478bd9Sstevel@tonic-gate db_cursor_del_func smdbc_del; 277*7c478bd9Sstevel@tonic-gate db_cursor_get_func smdbc_get; 278*7c478bd9Sstevel@tonic-gate db_cursor_put_func smdbc_put; 279*7c478bd9Sstevel@tonic-gate void *smdbc_impl; 280*7c478bd9Sstevel@tonic-gate }; 281*7c478bd9Sstevel@tonic-gate 282*7c478bd9Sstevel@tonic-gate 283*7c478bd9Sstevel@tonic-gate struct database_params_struct 284*7c478bd9Sstevel@tonic-gate { 285*7c478bd9Sstevel@tonic-gate unsigned int smdbp_num_elements; 286*7c478bd9Sstevel@tonic-gate unsigned int smdbp_cache_size; 287*7c478bd9Sstevel@tonic-gate bool smdbp_allow_dup; 288*7c478bd9Sstevel@tonic-gate }; 289*7c478bd9Sstevel@tonic-gate 290*7c478bd9Sstevel@tonic-gate typedef struct database_params_struct SMDB_DBPARAMS; 291*7c478bd9Sstevel@tonic-gate 292*7c478bd9Sstevel@tonic-gate struct database_user_struct 293*7c478bd9Sstevel@tonic-gate { 294*7c478bd9Sstevel@tonic-gate uid_t smdbu_id; 295*7c478bd9Sstevel@tonic-gate gid_t smdbu_group_id; 296*7c478bd9Sstevel@tonic-gate char smdbu_name[SMDB_MAX_USER_NAME_LEN]; 297*7c478bd9Sstevel@tonic-gate }; 298*7c478bd9Sstevel@tonic-gate 299*7c478bd9Sstevel@tonic-gate typedef struct database_user_struct SMDB_USER_INFO; 300*7c478bd9Sstevel@tonic-gate 301*7c478bd9Sstevel@tonic-gate struct entry_struct 302*7c478bd9Sstevel@tonic-gate { 303*7c478bd9Sstevel@tonic-gate void *data; 304*7c478bd9Sstevel@tonic-gate size_t size; 305*7c478bd9Sstevel@tonic-gate }; 306*7c478bd9Sstevel@tonic-gate 307*7c478bd9Sstevel@tonic-gate typedef char *SMDB_DBTYPE; 308*7c478bd9Sstevel@tonic-gate typedef unsigned int SMDB_FLAG; 309*7c478bd9Sstevel@tonic-gate 310*7c478bd9Sstevel@tonic-gate /* 311*7c478bd9Sstevel@tonic-gate ** These are types of databases. 312*7c478bd9Sstevel@tonic-gate */ 313*7c478bd9Sstevel@tonic-gate 314*7c478bd9Sstevel@tonic-gate # define SMDB_TYPE_DEFAULT NULL 315*7c478bd9Sstevel@tonic-gate # define SMDB_TYPE_DEFAULT_LEN 0 316*7c478bd9Sstevel@tonic-gate # define SMDB_TYPE_HASH "hash" 317*7c478bd9Sstevel@tonic-gate # define SMDB_TYPE_HASH_LEN 5 318*7c478bd9Sstevel@tonic-gate # define SMDB_TYPE_BTREE "btree" 319*7c478bd9Sstevel@tonic-gate # define SMDB_TYPE_BTREE_LEN 6 320*7c478bd9Sstevel@tonic-gate # define SMDB_TYPE_NDBM "dbm" 321*7c478bd9Sstevel@tonic-gate # define SMDB_TYPE_NDBM_LEN 4 322*7c478bd9Sstevel@tonic-gate 323*7c478bd9Sstevel@tonic-gate /* 324*7c478bd9Sstevel@tonic-gate ** These are flags 325*7c478bd9Sstevel@tonic-gate */ 326*7c478bd9Sstevel@tonic-gate 327*7c478bd9Sstevel@tonic-gate /* Flags for put */ 328*7c478bd9Sstevel@tonic-gate # define SMDBF_NO_OVERWRITE 0x00000001 329*7c478bd9Sstevel@tonic-gate # define SMDBF_ALLOW_DUP 0x00000002 330*7c478bd9Sstevel@tonic-gate 331*7c478bd9Sstevel@tonic-gate 332*7c478bd9Sstevel@tonic-gate extern SMDB_DATABASE *smdb_malloc_database __P((void)); 333*7c478bd9Sstevel@tonic-gate extern void smdb_free_database __P((SMDB_DATABASE *)); 334*7c478bd9Sstevel@tonic-gate extern int smdb_open_database __P((SMDB_DATABASE **, char *, int, 335*7c478bd9Sstevel@tonic-gate int, long, SMDB_DBTYPE, 336*7c478bd9Sstevel@tonic-gate SMDB_USER_INFO *, 337*7c478bd9Sstevel@tonic-gate SMDB_DBPARAMS *)); 338*7c478bd9Sstevel@tonic-gate # ifdef NEWDB 339*7c478bd9Sstevel@tonic-gate extern int smdb_db_open __P((SMDB_DATABASE **, char *, int, int, 340*7c478bd9Sstevel@tonic-gate long, SMDB_DBTYPE, SMDB_USER_INFO *, 341*7c478bd9Sstevel@tonic-gate SMDB_DBPARAMS *)); 342*7c478bd9Sstevel@tonic-gate # endif /* NEWDB */ 343*7c478bd9Sstevel@tonic-gate # ifdef NDBM 344*7c478bd9Sstevel@tonic-gate extern int smdb_ndbm_open __P((SMDB_DATABASE **, char *, int, int, 345*7c478bd9Sstevel@tonic-gate long, SMDB_DBTYPE, 346*7c478bd9Sstevel@tonic-gate SMDB_USER_INFO *, 347*7c478bd9Sstevel@tonic-gate SMDB_DBPARAMS *)); 348*7c478bd9Sstevel@tonic-gate # endif /* NDBM */ 349*7c478bd9Sstevel@tonic-gate extern int smdb_add_extension __P((char *, int, char *, char *)); 350*7c478bd9Sstevel@tonic-gate extern int smdb_setup_file __P((char *, char *, int, long, 351*7c478bd9Sstevel@tonic-gate SMDB_USER_INFO *, struct stat *)); 352*7c478bd9Sstevel@tonic-gate extern int smdb_lock_file __P((int *, char *, int, long, char *)); 353*7c478bd9Sstevel@tonic-gate extern int smdb_unlock_file __P((int)); 354*7c478bd9Sstevel@tonic-gate extern int smdb_filechanged __P((char *, char *, int, 355*7c478bd9Sstevel@tonic-gate struct stat *)); 356*7c478bd9Sstevel@tonic-gate extern void smdb_print_available_types __P((void)); 357*7c478bd9Sstevel@tonic-gate extern char *smdb_db_definition __P((SMDB_DBTYPE)); 358*7c478bd9Sstevel@tonic-gate extern int smdb_lock_map __P((SMDB_DATABASE *, int)); 359*7c478bd9Sstevel@tonic-gate extern int smdb_unlock_map __P((SMDB_DATABASE *)); 360*7c478bd9Sstevel@tonic-gate #endif /* ! _SMDB_H_ */ 361