1 /* back-ldbm.h - ldap ldbm back-end header file */
7 #include "ldapconfig.h"
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 DEFAULT_RUNDIR DEFAULT_DIRSEP "openldap-ldbm"
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
54 #define ID_BLOCK_NMAX_OFFSET 0
55 #define ID_BLOCK_NIDS_OFFSET 1
56 #define ID_BLOCK_IDS_OFFSET 2
58 /* all ID_BLOCK macros operate on a pointer to a ID_BLOCK */
60 #define ID_BLOCK_NMAX(b) ((b)[ID_BLOCK_NMAX_OFFSET])
61 #define ID_BLOCK_NIDS(b) ((b)[ID_BLOCK_NIDS_OFFSET])
62 #define ID_BLOCK_ID(b, n) ((b)[ID_BLOCK_IDS_OFFSET+(n)])
64 #define ID_BLOCK_NOID(b, n) (ID_BLOCK_ID((b),(n)) == NOID)
66 #define ID_BLOCK_ALLIDS_VALUE 0
67 #define ID_BLOCK_ALLIDS(b) (ID_BLOCK_NMAX(b) == ID_BLOCK_ALLIDS_VALUE)
69 #define ID_BLOCK_INDIRECT_VALUE 0
70 #define ID_BLOCK_INDIRECT(b) (ID_BLOCK_NIDS(b) == ID_BLOCK_INDIRECT_VALUE)
72 /* for the in-core cache of entries */
78 Entry *c_lruhead; /* lru - add accessed entries here */
79 Entry *c_lrutail; /* lru - rem lru entries from here */
80 ldap_pvt_thread_mutex_t c_mutex;
83 /* for the cache of open index files */
94 /* for the cache of attribute information (which are indexed, etc.) */
96 char *ai_type; /* type name (cn, sn, ...) */
97 int ai_indexmask; /* how the attr is indexed */
98 #define INDEX_PRESENCE 0x01
99 #define INDEX_EQUALITY 0x02
100 #define INDEX_APPROX 0x04
101 #define INDEX_SUB 0x08
102 #define INDEX_UNKNOWN 0x10
103 #define INDEX_FROMINIT 0x20
104 int ai_syntaxmask; /* what kind of syntax */
106 #define SYNTAX_CIS 0x01
107 #define SYNTAX_CES 0x02
108 #define SYNTAX_BIN 0x04
113 #define MAXDBCACHE 10
115 /* this could be made an option */
116 #ifndef SLAPD_NEXTID_CHUNK
117 #define SLAPD_NEXTID_CHUNK 32
122 #if SLAPD_NEXTID_CHUNK > 1
125 char *li_nextid_file;
126 ldap_pvt_thread_mutex_t li_root_mutex;
127 ldap_pvt_thread_mutex_t li_add_mutex;
128 ldap_pvt_thread_mutex_t li_nextid_mutex;
131 struct cache li_cache;
135 struct dbcache li_dbcache[MAXDBCACHE];
136 ldap_pvt_thread_mutex_t li_dbcache_mutex;
137 ldap_pvt_thread_cond_t li_dbcache_cv;
140 #include "proto-back-ldbm.h"
144 #endif /* _back_ldbm_h_ */