1 /* slap.h - stand alone ldap server include file */
23 * represents an attribute value assertion (i.e., attr=value)
27 struct berval ava_value;
31 * represents a search filter
33 typedef struct filter {
34 unsigned long f_choice; /* values taken from ldap.h */
40 /* equality, lessorequal, greaterorequal, approx */
44 struct filter *f_un_complex;
49 char *f_un_sub_initial;
54 #define f_type f_un.f_un_type
55 #define f_ava f_un.f_un_ava
56 #define f_avtype f_un.f_un_ava.ava_type
57 #define f_avvalue f_un.f_un_ava.ava_value
58 #define f_and f_un.f_un_complex
59 #define f_or f_un.f_un_complex
60 #define f_not f_un.f_un_complex
61 #define f_list f_un.f_un_complex
62 #define f_sub f_un.f_un_sub
63 #define f_sub_type f_un.f_un_sub.f_un_sub_type
64 #define f_sub_initial f_un.f_un_sub.f_un_sub_initial
65 #define f_sub_any f_un.f_un_sub.f_un_sub_any
66 #define f_sub_final f_un.f_un_sub.f_un_sub_final
68 struct filter *f_next;
72 * represents an attribute (type + values + syntax)
76 struct berval **a_vals;
82 * the attr_syntax() routine returns one of these values
83 * telling what kind of syntax an attribute supports.
85 #define SYNTAX_CIS 0x01 /* case insensitive string */
86 #define SYNTAX_CES 0x02 /* case sensitive string */
87 #define SYNTAX_BIN 0x04 /* binary data */
88 #define SYNTAX_TEL 0x08 /* telephone number string */
89 #define SYNTAX_DN 0x10 /* dn string */
92 * the id used in the indexes to refer to an entry
94 typedef unsigned long ID;
95 #define NOID ((unsigned long)-1)
98 * represents an entry in core
100 typedef struct entry {
101 char *e_dn; /* DN of this entry */
102 Attribute *e_attrs; /* list of attributes + values */
104 ID e_id; /* id of this entry - this should */
105 /* really be private to back-ldbm */
106 char e_state; /* for the cache */
107 #define ENTRY_STATE_DELETED 1
108 #define ENTRY_STATE_CREATING 2
109 int e_refcnt; /* # threads ref'ing this entry */
110 struct entry *e_lrunext; /* for cache lru list */
111 struct entry *e_lruprev;
115 * represents an access control list
125 #define ACL_NONE 0x01
126 #define ACL_COMPARE 0x02
127 #define ACL_SEARCH 0x04
128 #define ACL_READ 0x08
129 #define ACL_WRITE 0x10
130 #define ACL_SELF 0x40
131 struct access *a_next;
136 /* "to" part: the entries this acl applies to */
141 /* "by" part: list of who has what access to the entries */
142 struct access *acl_access;
144 struct acl *acl_next;
148 * represents schema information for a database
155 struct objclass *oc_next;
159 * represents a "database"
162 typedef struct backend {
163 char **be_suffix; /* the DN suffixes of data in this backend */
164 char *be_rootdn; /* the magic "root" dn for this db */
165 char *be_rootpw; /* the magic "root" password for this db */
166 int be_readonly; /* 1 => db is in "read only" mode */
167 int be_sizelimit; /* size limit for this backend */
168 int be_timelimit; /* time limit for this backend */
169 struct acl *be_acl; /* access control list for this backend */
170 int be_dfltaccess; /* access given if no acl matches */
171 char **be_replica; /* replicas of this backend (in master) */
172 char *be_replogfile; /* replication log file (in master) */
173 char *be_updatedn; /* allowed to make changes (in replicas) */
174 int be_lastmod; /* keep track of lastmodified{by,time} */
175 char *be_type; /* type of database */
177 void *be_private; /* anything the backend needs */
179 IFP be_bind; /* backend bind routine */
180 IFP be_unbind; /* backend unbind routine */
181 IFP be_search; /* backend search routine */
182 IFP be_compare; /* backend compare routine */
183 IFP be_modify; /* backend modify routine */
184 IFP be_modrdn; /* backend modrdn routine */
185 IFP be_add; /* backend add routine */
186 IFP be_delete; /* backend delete routine */
187 IFP be_abandon; /* backend abandon routine */
188 IFP be_config; /* backend config routine */
189 IFP be_init; /* backend init routine */
190 IFP be_close; /* backend close routine */
194 * represents an operation pending from an ldap client
198 BerElement *o_ber; /* ber of the request */
199 long o_msgid; /* msgid of the request */
200 unsigned long o_tag; /* tag of the request */
201 time_t o_time; /* time op was initiated */
202 char *o_dn; /* dn bound when op was initiated */
203 int o_authtype; /* auth method used to bind dn */
204 /* values taken from ldap.h */
206 int o_opid; /* id of this operation */
207 int o_connid; /* id of conn initiating this op */
209 int o_cldap; /* != 0 if this came in via CLDAP */
210 struct sockaddr o_clientaddr; /* client address if via CLDAP */
211 char o_searchbase; /* search base if via CLDAP */
213 struct op *o_next; /* next operation pending */
214 pthread_t o_tid; /* thread handling this op */
215 int o_abandon; /* signals op has been abandoned */
216 pthread_mutex_t o_abandonmutex; /* signals op has been abandoned */
218 int o_private; /* anything the backend needs */
222 * represents a connection from an ldap client
225 typedef struct conn {
226 Sockbuf c_sb; /* ber connection stuff */
227 char *c_dn; /* current DN bound to this conn */
228 pthread_mutex_t c_dnmutex; /* mutex for c_dn field */
229 int c_authtype; /* auth method used to bind c_dn */
231 int c_version; /* for compatibility w/2.0, 3.0 */
233 char *c_addr; /* address of client on this conn */
234 char *c_domain; /* domain of client on this conn */
235 Operation *c_ops; /* list of pending operations */
236 pthread_mutex_t c_opsmutex; /* mutex for c_ops list & stats */
237 pthread_mutex_t c_pdumutex; /* only one pdu written at a time */
238 pthread_cond_t c_wcv; /* used to wait for sd write-ready*/
239 int c_gettingber; /* in the middle of ber_get_next */
240 BerElement *c_currentber; /* ber we're getting */
241 int c_writewaiter; /* signals write-ready sd waiter */
242 int c_pduwaiters; /* signals threads waiting 4 pdu */
243 time_t c_starttime; /* when the connection was opened */
244 int c_connid; /* id of this connection for stats*/
245 int c_opsinitiated; /* # ops initiated/next op id */
246 int c_opscompleted; /* # ops completed */
249 #if defined(LDAP_SYSLOG) && defined(LDAP_DEBUG)
250 #define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) \
252 if ( ldap_debug & level ) \
253 fprintf( stderr, fmt, connid, opid, arg1, arg2, arg3 );\
254 if ( ldap_syslog & level ) \
255 syslog( ldap_syslog_level, fmt, connid, opid, arg1, \
259 #define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 )
263 #include "proto-slap.h"
266 #endif /* _slap_h_ */