1 /* back-ldbm.h - ldap ldbm back-end header file */
8 #define DEFAULT_CACHE_SIZE 1000
9 #define DEFAULT_DBCACHE_SIZE 100000
10 #define DEFAULT_DB_DIRECTORY "/usr/tmp"
11 #define DEFAULT_MODE 0600
16 * there is a single index for each attribute. these prefixes insure
17 * that there is no collision among keys.
19 #define EQ_PREFIX '=' /* prefix for equality keys */
20 #define APPROX_PREFIX '~' /* prefix for approx keys */
21 #define SUB_PREFIX '*' /* prefix for substring keys */
22 #define CONT_PREFIX '\\' /* prefix for continuation keys */
24 #define DEFAULT_BLOCKSIZE 8192
27 * This structure represents an id block on disk and an id list
30 * The fields have the following meanings:
32 * b_nmax maximum number of ids in this block. if this is == ALLIDSBLOCK,
33 * then this block represents all ids.
34 * b_nids current number of ids in use in this block. if this
35 * is == INDBLOCK, then this block is an indirect block
36 * containing a list of other blocks containing actual ids.
37 * the list is terminated by an id of NOID.
38 * b_ids a list of the actual ids themselves
40 typedef struct block {
41 ID b_nmax; /* max number of ids in this list */
42 #define ALLIDSBLOCK 0 /* == 0 => this is an allid block */
43 ID b_nids; /* current number of ids used */
44 #define INDBLOCK 0 /* == 0 => this is an indirect blk */
45 ID b_ids[1]; /* the ids - actually bigger */
48 #define ALLIDS( idl ) ((idl)->b_nmax == ALLIDSBLOCK)
49 #define INDIRECT_BLOCK( idl ) ((idl)->b_nids == INDBLOCK)
51 /* for the in-core cache of entries */
57 Entry *c_lruhead; /* lru - add accessed entries here */
58 Entry *c_lrutail; /* lru - rem lru entries from here */
59 pthread_mutex_t c_mutex;
62 /* for the cache of open index files */
67 pthread_mutex_t dbc_mutex;
68 pthread_cond_t dbc_cv;
76 /* for the cache of attribute information (which are indexed, etc.) */
78 char *ai_type; /* type name (cn, sn, ...) */
79 int ai_indexmask; /* how the attr is indexed */
80 #define INDEX_PRESENCE 0x01
81 #define INDEX_EQUALITY 0x02
82 #define INDEX_APPROX 0x04
83 #define INDEX_SUB 0x08
84 #define INDEX_UNKNOWN 0x10
85 #define INDEX_FROMINIT 0x20
86 int ai_syntaxmask; /* what kind of syntax */
88 #define SYNTAX_CIS 0x01
89 #define SYNTAX_CES 0x02
90 #define SYNTAX_BIN 0x04
99 pthread_mutex_t li_nextid_mutex;
102 struct cache li_cache;
105 struct dbcache li_dbcache[MAXDBCACHE];
106 pthread_mutex_t li_dbcache_mutex;
107 pthread_cond_t li_dbcache_cv;
111 #include "proto-back-ldbm.h"
114 #endif /* _back_ldbm_h_ */