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