1 /* back-ldbm.h - ldap ldbm back-end header file */
11 #define DEFAULT_CACHE_SIZE 1000
13 #ifdef HAVE_BERKELEY_DB2
14 # define DEFAULT_DBCACHE_SIZE (100 * DEFAULT_DB_PAGE_SIZE)
16 # define DEFAULT_DBCACHE_SIZE 100000
19 #define DEFAULT_DB_DIRECTORY "/usr/tmp"
20 #define DEFAULT_MODE 0600
25 * there is a single index for each attribute. these prefixes insure
26 * that there is no collision among keys.
28 #define EQ_PREFIX '=' /* prefix for equality keys */
29 #define APPROX_PREFIX '~' /* prefix for approx keys */
30 #define SUB_PREFIX '*' /* prefix for substring keys */
31 #define CONT_PREFIX '\\' /* prefix for continuation keys */
33 #define UNKNOWN_PREFIX '?' /* prefix for unknown keys */
35 #define DEFAULT_BLOCKSIZE 8192
38 * This structure represents an id block on disk and an id list
41 * The fields have the following meanings:
43 * b_nmax maximum number of ids in this block. if this is == ALLIDSBLOCK,
44 * then this block represents all ids.
45 * b_nids current number of ids in use in this block. if this
46 * is == INDBLOCK, then this block is an indirect block
47 * containing a list of other blocks containing actual ids.
48 * the list is terminated by an id of NOID.
49 * b_ids a list of the actual ids themselves
51 typedef struct block {
52 ID b_nmax; /* max number of ids in this list */
53 #define ALLIDSBLOCK 0 /* == 0 => this is an allid block */
54 ID b_nids; /* current number of ids used */
55 #define INDBLOCK 0 /* == 0 => this is an indirect blk */
56 ID b_ids[1]; /* the ids - actually bigger */
59 #define ALLIDS( idl ) ((idl)->b_nmax == ALLIDSBLOCK)
60 #define INDIRECT_BLOCK( idl ) ((idl)->b_nids == INDBLOCK)
62 /* for the in-core cache of entries */
68 Entry *c_lruhead; /* lru - add accessed entries here */
69 Entry *c_lrutail; /* lru - rem lru entries from here */
70 pthread_mutex_t c_mutex;
73 /* for the cache of open index files */
83 #ifdef HAVE_BERKELEY_DB2
88 /* for the cache of attribute information (which are indexed, etc.) */
90 char *ai_type; /* type name (cn, sn, ...) */
91 int ai_indexmask; /* how the attr is indexed */
92 #define INDEX_PRESENCE 0x01
93 #define INDEX_EQUALITY 0x02
94 #define INDEX_APPROX 0x04
95 #define INDEX_SUB 0x08
96 #define INDEX_UNKNOWN 0x10
97 #define INDEX_FROMINIT 0x20
98 int ai_syntaxmask; /* what kind of syntax */
100 #define SYNTAX_CIS 0x01
101 #define SYNTAX_CES 0x02
102 #define SYNTAX_BIN 0x04
107 #define MAXDBCACHE 10
111 pthread_mutex_t li_root_mutex;
112 pthread_mutex_t li_add_mutex;
113 pthread_mutex_t li_nextid_mutex;
116 struct cache li_cache;
120 struct dbcache li_dbcache[MAXDBCACHE];
121 ldap_pvt_thread_mutex_t li_dbcache_mutex;
122 ldap_pvt_thread_cond_t li_dbcache_cv;
124 #ifdef HAVE_BERKELEY_DB2
126 /* Berkeley DB2 Environment */
132 #include "proto-back-ldbm.h"
136 #endif /* _back_ldbm_h_ */