1 /* back-ldbm.h - ldap ldbm back-end header file */
10 #define DEFAULT_CACHE_SIZE 1000
12 #ifdef HAVE_BERKELEY_DB2
13 # define DEFAULT_DBCACHE_SIZE (100 * DEFAULT_DB_PAGE_SIZE)
15 # define DEFAULT_DBCACHE_SIZE 100000
18 #define DEFAULT_DB_DIRECTORY "/usr/tmp"
19 #define DEFAULT_MODE 0600
24 * there is a single index for each attribute. these prefixes insure
25 * that there is no collision among keys.
27 #define EQ_PREFIX '=' /* prefix for equality keys */
28 #define APPROX_PREFIX '~' /* prefix for approx keys */
29 #define SUB_PREFIX '*' /* prefix for substring keys */
30 #define CONT_PREFIX '\\' /* prefix for continuation keys */
32 #define DEFAULT_BLOCKSIZE 8192
35 * This structure represents an id block on disk and an id list
38 * The fields have the following meanings:
40 * b_nmax maximum number of ids in this block. if this is == ALLIDSBLOCK,
41 * then this block represents all ids.
42 * b_nids current number of ids in use in this block. if this
43 * is == INDBLOCK, then this block is an indirect block
44 * containing a list of other blocks containing actual ids.
45 * the list is terminated by an id of NOID.
46 * b_ids a list of the actual ids themselves
48 typedef struct block {
49 ID b_nmax; /* max number of ids in this list */
50 #define ALLIDSBLOCK 0 /* == 0 => this is an allid block */
51 ID b_nids; /* current number of ids used */
52 #define INDBLOCK 0 /* == 0 => this is an indirect blk */
53 ID b_ids[1]; /* the ids - actually bigger */
56 #define ALLIDS( idl ) ((idl)->b_nmax == ALLIDSBLOCK)
57 #define INDIRECT_BLOCK( idl ) ((idl)->b_nids == INDBLOCK)
59 /* for the in-core cache of entries */
65 Entry *c_lruhead; /* lru - add accessed entries here */
66 Entry *c_lrutail; /* lru - rem lru entries from here */
67 pthread_mutex_t c_mutex;
70 /* for the cache of open index files */
75 pthread_mutex_t dbc_mutex;
76 pthread_cond_t dbc_cv;
84 /* for the cache of attribute information (which are indexed, etc.) */
86 char *ai_type; /* type name (cn, sn, ...) */
87 int ai_indexmask; /* how the attr is indexed */
88 #define INDEX_PRESENCE 0x01
89 #define INDEX_EQUALITY 0x02
90 #define INDEX_APPROX 0x04
91 #define INDEX_SUB 0x08
92 #define INDEX_UNKNOWN 0x10
93 #define INDEX_FROMINIT 0x20
94 int ai_syntaxmask; /* what kind of syntax */
96 #define SYNTAX_CIS 0x01
97 #define SYNTAX_CES 0x02
98 #define SYNTAX_BIN 0x04
103 #define MAXDBCACHE 10
107 pthread_mutex_t li_nextid_mutex;
110 struct cache li_cache;
114 struct dbcache li_dbcache[MAXDBCACHE];
115 pthread_mutex_t li_dbcache_mutex;
116 pthread_cond_t li_dbcache_cv;
119 #include "proto-back-ldbm.h"
123 #endif /* _back_ldbm_h_ */