1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3  *
4  * The contents of this file are subject to the Mozilla Public License Version
5  * 1.1 (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS" basis,
10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11  * for the specific language governing rights and limitations under the
12  * License.
13  *
14  * The Original Code is Mozilla Communicator client code, released
15  * March 31, 1998.
16  *
17  * The Initial Developer of the Original Code is
18  * Netscape Communications Corporation.
19  * Portions created by the Initial Developer are Copyright (C) 1998-1999
20  * the Initial Developer. All Rights Reserved.
21  *
22  * Contributor(s):
23  *
24  * Alternatively, the contents of this file may be used under the terms of
25  * either of the GNU General Public License Version 2 or later (the "GPL"),
26  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27  * in which case the provisions of the GPL or the LGPL are applicable instead
28  * of those above. If you wish to allow use of your version of this file only
29  * under the terms of either the GPL or the LGPL, and not to allow others to
30  * use your version of this file under the terms of the MPL, indicate your
31  * decision by deleting the provisions above and replace them with the notice
32  * and other provisions required by the GPL or the LGPL. If you do not delete
33  * the provisions above, a recipient may use your version of this file under
34  * the terms of any one of the MPL, the GPL or the LGPL.
35  *
36  * ***** END LICENSE BLOCK ***** */
37 
38 /* ldap-standard.h - standards base header file for libldap */
39 /* This file contain the defines and function prototypes matching */
40 /* very closely to the latest LDAP C API draft */
41 
42 #ifndef _LDAP_STANDARD_H
43 #define _LDAP_STANDARD_H
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 #include "ldap-platform.h"
50 
51 #include "lber.h"
52 
53 #define LDAP_PORT 389
54 #define LDAPS_PORT 636
55 #define LDAP_VERSION2 2
56 #define LDAP_VERSION3 3
57 #define LDAP_VERSION_MIN LDAP_VERSION1
58 #define LDAP_VERSION_MAX LDAP_VERSION3
59 
60 #define LDAP_VENDOR_VERSION 607 /* version # * 100 */
61 #define LDAP_VENDOR_NAME "mozilla.org"
62 /*
63  * The following will be an RFC number once the LDAP C API Internet Draft
64  * is published as a Proposed Standard RFC.  For now we use 2000 + the
65  * draft revision number (currently 5) since we are close to compliance
66  * with revision 5 of the draft.
67  */
68 #define LDAP_API_VERSION 2005
69 
70 /* special values that may appear in the attributes field of a SearchRequest.
71  */
72 #define LDAP_NO_ATTRS "1.1"
73 #define LDAP_ALL_USER_ATTRS "*"
74 
75 /*
76  * Standard options (used with ldap_set_option() and ldap_get_option):
77  */
78 #define LDAP_OPT_API_INFO 0x00         /*  0 */
79 #define LDAP_OPT_DEREF 0x02            /*  2 */
80 #define LDAP_OPT_SIZELIMIT 0x03        /*  3 */
81 #define LDAP_OPT_TIMELIMIT 0x04        /*  4 */
82 #define LDAP_OPT_REFERRALS 0x08        /*  8 */
83 #define LDAP_OPT_RESTART 0x09          /*  9 */
84 #define LDAP_OPT_PROTOCOL_VERSION 0x11 /* 17 */
85 #define LDAP_OPT_SERVER_CONTROLS 0x12  /* 18 */
86 #define LDAP_OPT_CLIENT_CONTROLS 0x13  /* 19 */
87 #define LDAP_OPT_API_FEATURE_INFO 0x15 /* 21 */
88 #define LDAP_OPT_HOST_NAME 0x30        /* 48 */
89 #define LDAP_OPT_ERROR_NUMBER 0x31     /* 49 */
90 #define LDAP_OPT_ERROR_STRING 0x32     /* 50 */
91 #define LDAP_OPT_MATCHED_DN 0x33       /* 51 */
92 
93 /*
94  * Well-behaved private and experimental extensions will use option values
95  * between 0x4000 (16384) and 0x7FFF (32767) inclusive.
96  */
97 #define LDAP_OPT_PRIVATE_EXTENSION_BASE 0x4000 /* to 0x7FFF inclusive */
98 
99 /* for on/off options */
100 #define LDAP_OPT_ON ((void*)1)
101 #define LDAP_OPT_OFF ((void*)0)
102 
103 typedef struct ldap LDAP;           /* opaque connection handle */
104 typedef struct ldapmsg LDAPMessage; /* opaque result/entry handle */
105 
106 /* structure representing an LDAP modification */
107 typedef struct ldapmod {
108   int mod_op; /* kind of mod + form of values*/
109 #define LDAP_MOD_ADD 0x00
110 #define LDAP_MOD_DELETE 0x01
111 #define LDAP_MOD_REPLACE 0x02
112 #define LDAP_MOD_BVALUES 0x80
113   char* mod_type; /* attribute name to modify */
114   union mod_vals_u {
115     char** modv_strvals;
116     struct berval** modv_bvals;
117   } mod_vals; /* values to add/delete/replace */
118 #define mod_values mod_vals.modv_strvals
119 #define mod_bvalues mod_vals.modv_bvals
120 } LDAPMod;
121 
122 /*
123  * structure for holding ldapv3 controls
124  */
125 typedef struct ldapcontrol {
126   char* ldctl_oid;
127   struct berval ldctl_value;
128   char ldctl_iscritical;
129 } LDAPControl;
130 
131 /*
132  * LDAP API information.  Can be retrieved by using a sequence like:
133  *
134  *    LDAPAPIInfo ldai;
135  *    ldai.ldapai_info_version = LDAP_API_INFO_VERSION;
136  *    if ( ldap_get_option( NULL, LDAP_OPT_API_INFO, &ldia ) == 0 ) ...
137  */
138 #define LDAP_API_INFO_VERSION 1
139 typedef struct ldapapiinfo {
140   int ldapai_info_version;     /* version of this struct (1) */
141   int ldapai_api_version;      /* revision of API supported */
142   int ldapai_protocol_version; /* highest LDAP version supported */
143   char** ldapai_extensions;    /* names of API extensions */
144   char* ldapai_vendor_name;    /* name of supplier */
145   int ldapai_vendor_version;   /* supplier-specific version times 100 */
146 } LDAPAPIInfo;
147 
148 /*
149  * LDAP API extended features info.  Can be retrieved by using a sequence like:
150  *
151  *    LDAPAPIFeatureInfo ldfi;
152  *    ldfi.ldapaif_info_version = LDAP_FEATURE_INFO_VERSION;
153  *    ldfi.ldapaif_name = "VIRTUAL_LIST_VIEW";
154  *    if ( ldap_get_option( NULL, LDAP_OPT_API_FEATURE_INFO, &ldfi ) == 0 ) ...
155  */
156 #define LDAP_FEATURE_INFO_VERSION 1
157 typedef struct ldap_apifeature_info {
158   int ldapaif_info_version; /* version of this struct (1) */
159   char* ldapaif_name;       /* name of supported feature */
160   int ldapaif_version;      /* revision of supported feature */
161 } LDAPAPIFeatureInfo;
162 
163 /* possible result types a server can return */
164 #define LDAP_RES_BIND 0x61L             /* 97 */
165 #define LDAP_RES_SEARCH_ENTRY 0x64L     /* 100 */
166 #define LDAP_RES_SEARCH_RESULT 0x65L    /* 101 */
167 #define LDAP_RES_MODIFY 0x67L           /* 103 */
168 #define LDAP_RES_ADD 0x69L              /* 105 */
169 #define LDAP_RES_DELETE 0x6BL           /* 107 */
170 #define LDAP_RES_MODDN 0x6DL            /* 109 */
171 #define LDAP_RES_COMPARE 0x6FL          /* 111 */
172 #define LDAP_RES_SEARCH_REFERENCE 0x73L /* 115 */
173 #define LDAP_RES_EXTENDED 0x78L         /* 120 */
174 
175 /* Special values for ldap_result() "msgid" parameter */
176 #define LDAP_RES_ANY (-1)
177 #define LDAP_RES_UNSOLICITED 0
178 
179 /* built-in SASL methods */
180 #define LDAP_SASL_SIMPLE 0 /* special value used for simple bind */
181 
182 /* search scopes */
183 #define LDAP_SCOPE_BASE 0x00
184 #define LDAP_SCOPE_ONELEVEL 0x01
185 #define LDAP_SCOPE_SUBTREE 0x02
186 
187 /* alias dereferencing */
188 #define LDAP_DEREF_NEVER 0x00
189 #define LDAP_DEREF_SEARCHING 0x01
190 #define LDAP_DEREF_FINDING 0x02
191 #define LDAP_DEREF_ALWAYS 0x03
192 
193 /* predefined size/time limits */
194 #define LDAP_NO_LIMIT 0
195 
196 /* allowed values for "all" ldap_result() parameter */
197 #define LDAP_MSG_ONE 0x00
198 #define LDAP_MSG_ALL 0x01
199 #define LDAP_MSG_RECEIVED 0x02
200 
201 /* possible error codes we can be returned */
202 #define LDAP_SUCCESS 0x00                        /* 0 */
203 #define LDAP_OPERATIONS_ERROR 0x01               /* 1 */
204 #define LDAP_PROTOCOL_ERROR 0x02                 /* 2 */
205 #define LDAP_TIMELIMIT_EXCEEDED 0x03             /* 3 */
206 #define LDAP_SIZELIMIT_EXCEEDED 0x04             /* 4 */
207 #define LDAP_COMPARE_FALSE 0x05                  /* 5 */
208 #define LDAP_COMPARE_TRUE 0x06                   /* 6 */
209 #define LDAP_STRONG_AUTH_NOT_SUPPORTED 0x07      /* 7 */
210 #define LDAP_STRONG_AUTH_REQUIRED 0x08           /* 8 */
211 #define LDAP_REFERRAL 0x0a                       /* 10 - LDAPv3 */
212 #define LDAP_ADMINLIMIT_EXCEEDED 0x0b            /* 11 - LDAPv3 */
213 #define LDAP_UNAVAILABLE_CRITICAL_EXTENSION 0x0c /* 12 - LDAPv3 */
214 #define LDAP_CONFIDENTIALITY_REQUIRED 0x0d       /* 13 */
215 #define LDAP_SASL_BIND_IN_PROGRESS 0x0e          /* 14 - LDAPv3 */
216 
217 #define LDAP_NO_SUCH_ATTRIBUTE 0x10      /* 16 */
218 #define LDAP_UNDEFINED_TYPE 0x11         /* 17 */
219 #define LDAP_INAPPROPRIATE_MATCHING 0x12 /* 18 */
220 #define LDAP_CONSTRAINT_VIOLATION 0x13   /* 19 */
221 #define LDAP_TYPE_OR_VALUE_EXISTS 0x14   /* 20 */
222 #define LDAP_INVALID_SYNTAX 0x15         /* 21 */
223 
224 #define LDAP_NO_SUCH_OBJECT 0x20      /* 32 */
225 #define LDAP_ALIAS_PROBLEM 0x21       /* 33 */
226 #define LDAP_INVALID_DN_SYNTAX 0x22   /* 34 */
227 #define LDAP_IS_LEAF 0x23             /* 35 (not used in LDAPv3) */
228 #define LDAP_ALIAS_DEREF_PROBLEM 0x24 /* 36 */
229 
230 #define LDAP_INAPPROPRIATE_AUTH 0x30   /* 48 */
231 #define LDAP_INVALID_CREDENTIALS 0x31  /* 49 */
232 #define LDAP_INSUFFICIENT_ACCESS 0x32  /* 50 */
233 #define LDAP_BUSY 0x33                 /* 51 */
234 #define LDAP_UNAVAILABLE 0x34          /* 52 */
235 #define LDAP_UNWILLING_TO_PERFORM 0x35 /* 53 */
236 #define LDAP_LOOP_DETECT 0x36          /* 54 */
237 
238 #define LDAP_NAMING_VIOLATION 0x40       /* 64 */
239 #define LDAP_OBJECT_CLASS_VIOLATION 0x41 /* 65 */
240 #define LDAP_NOT_ALLOWED_ON_NONLEAF 0x42 /* 66 */
241 #define LDAP_NOT_ALLOWED_ON_RDN 0x43     /* 67 */
242 #define LDAP_ALREADY_EXISTS 0x44         /* 68 */
243 #define LDAP_NO_OBJECT_CLASS_MODS 0x45   /* 69 */
244 #define LDAP_RESULTS_TOO_LARGE 0x46      /* 70 - CLDAP */
245 #define LDAP_AFFECTS_MULTIPLE_DSAS 0x47  /* 71 */
246 
247 #define LDAP_OTHER 0x50                   /* 80 */
248 #define LDAP_SERVER_DOWN 0x51             /* 81 */
249 #define LDAP_LOCAL_ERROR 0x52             /* 82 */
250 #define LDAP_ENCODING_ERROR 0x53          /* 83 */
251 #define LDAP_DECODING_ERROR 0x54          /* 84 */
252 #define LDAP_TIMEOUT 0x55                 /* 85 */
253 #define LDAP_AUTH_UNKNOWN 0x56            /* 86 */
254 #define LDAP_FILTER_ERROR 0x57            /* 87 */
255 #define LDAP_USER_CANCELLED 0x58          /* 88 */
256 #define LDAP_PARAM_ERROR 0x59             /* 89 */
257 #define LDAP_NO_MEMORY 0x5a               /* 90 */
258 #define LDAP_CONNECT_ERROR 0x5b           /* 91 */
259 #define LDAP_NOT_SUPPORTED 0x5c           /* 92 - LDAPv3 */
260 #define LDAP_CONTROL_NOT_FOUND 0x5d       /* 93 - LDAPv3 */
261 #define LDAP_NO_RESULTS_RETURNED 0x5e     /* 94 - LDAPv3 */
262 #define LDAP_MORE_RESULTS_TO_RETURN 0x5f  /* 95 - LDAPv3 */
263 #define LDAP_CLIENT_LOOP 0x60             /* 96 - LDAPv3 */
264 #define LDAP_REFERRAL_LIMIT_EXCEEDED 0x61 /* 97 - LDAPv3 */
265 
266 /*
267  * LDAPv3 unsolicited notification messages we know about
268  */
269 #define LDAP_NOTICE_OF_DISCONNECTION "1.3.6.1.4.1.1466.20036"
270 
271 /*
272  * Client controls we know about
273  */
274 #define LDAP_CONTROL_REFERRALS "1.2.840.113556.1.4.616"
275 
276 /*
277  * Initializing an ldap session, set session handle options, and
278  * closing an ldap session functions
279  *
280  * NOTE: If you want to use IPv6, you must use prldap creating a LDAP handle
281  * with prldap_init instead of ldap_init. Or install the NSPR functions
282  * by calling prldap_install_routines. (See the nspr samples in examples)
283  */
284 LDAP_API(LDAP*) LDAP_CALL ldap_init(const char* defhost, int defport);
285 LDAP_API(int)
286 LDAP_CALL ldap_set_option(LDAP* ld, int option, const void* optdata);
287 LDAP_API(int) LDAP_CALL ldap_get_option(LDAP* ld, int option, void* optdata);
288 LDAP_API(int) LDAP_CALL ldap_unbind(LDAP* ld);
289 LDAP_API(int) LDAP_CALL ldap_unbind_s(LDAP* ld);
290 
291 /*
292  * perform ldap operations
293  */
294 LDAP_API(int) LDAP_CALL ldap_abandon(LDAP* ld, int msgid);
295 LDAP_API(int) LDAP_CALL ldap_add(LDAP* ld, const char* dn, LDAPMod** attrs);
296 LDAP_API(int) LDAP_CALL ldap_add_s(LDAP* ld, const char* dn, LDAPMod** attrs);
297 LDAP_API(int)
298 LDAP_CALL ldap_simple_bind(LDAP* ld, const char* who, const char* passwd);
299 LDAP_API(int)
300 LDAP_CALL ldap_simple_bind_s(LDAP* ld, const char* who, const char* passwd);
301 LDAP_API(int) LDAP_CALL ldap_modify(LDAP* ld, const char* dn, LDAPMod** mods);
302 LDAP_API(int) LDAP_CALL ldap_modify_s(LDAP* ld, const char* dn, LDAPMod** mods);
303 LDAP_API(int)
304 LDAP_CALL
305 ldap_compare(LDAP* ld, const char* dn, const char* attr, const char* value);
306 LDAP_API(int)
307 LDAP_CALL ldap_compare_s(LDAP* ld, const char* dn, const char* attr,
308                          const char* value);
309 LDAP_API(int) LDAP_CALL ldap_delete(LDAP* ld, const char* dn);
310 LDAP_API(int) LDAP_CALL ldap_delete_s(LDAP* ld, const char* dn);
311 LDAP_API(int)
312 LDAP_CALL ldap_search(LDAP* ld, const char* base, int scope, const char* filter,
313                       char** attrs, int attrsonly);
314 LDAP_API(int)
315 LDAP_CALL
316 ldap_search_s(LDAP* ld, const char* base, int scope, const char* filter,
317               char** attrs, int attrsonly, LDAPMessage** res);
318 LDAP_API(int)
319 LDAP_CALL ldap_search_st(LDAP* ld, const char* base, int scope,
320                          const char* filter, char** attrs, int attrsonly,
321                          struct timeval* timeout, LDAPMessage** res);
322 
323 /*
324  * obtain result from ldap operation
325  */
326 LDAP_API(int)
327 LDAP_CALL ldap_result(LDAP* ld, int msgid, int all, struct timeval* timeout,
328                       LDAPMessage** result);
329 
330 /*
331  * peeking inside LDAP Messages and deallocating LDAP Messages
332  */
333 LDAP_API(int) LDAP_CALL ldap_msgfree(LDAPMessage* lm);
334 LDAP_API(int) LDAP_CALL ldap_msgid(LDAPMessage* lm);
335 LDAP_API(int) LDAP_CALL ldap_msgtype(LDAPMessage* lm);
336 
337 /*
338  * Routines to parse/deal with results and errors returned
339  */
340 LDAP_API(char*) LDAP_CALL ldap_err2string(int err);
341 LDAP_API(LDAPMessage*)
342 LDAP_CALL ldap_first_entry(LDAP* ld, LDAPMessage* chain);
343 LDAP_API(LDAPMessage*) LDAP_CALL ldap_next_entry(LDAP* ld, LDAPMessage* entry);
344 LDAP_API(int) LDAP_CALL ldap_count_entries(LDAP* ld, LDAPMessage* chain);
345 LDAP_API(char*) LDAP_CALL ldap_get_dn(LDAP* ld, LDAPMessage* entry);
346 LDAP_API(char*) LDAP_CALL ldap_dn2ufn(const char* dn);
347 LDAP_API(char**) LDAP_CALL ldap_explode_dn(const char* dn, const int notypes);
348 LDAP_API(char**)
349 LDAP_CALL ldap_explode_rdn(const char* rdn, const int notypes);
350 LDAP_API(char*)
351 LDAP_CALL ldap_first_attribute(LDAP* ld, LDAPMessage* entry, BerElement** ber);
352 LDAP_API(char*)
353 LDAP_CALL ldap_next_attribute(LDAP* ld, LDAPMessage* entry, BerElement* ber);
354 LDAP_API(char**)
355 LDAP_CALL ldap_get_values(LDAP* ld, LDAPMessage* entry, const char* target);
356 LDAP_API(struct berval**)
357 LDAP_CALL ldap_get_values_len(LDAP* ld, LDAPMessage* entry, const char* target);
358 LDAP_API(int) LDAP_CALL ldap_count_values(char** vals);
359 LDAP_API(int) LDAP_CALL ldap_count_values_len(struct berval** vals);
360 LDAP_API(void) LDAP_CALL ldap_value_free(char** vals);
361 LDAP_API(void) LDAP_CALL ldap_value_free_len(struct berval** vals);
362 LDAP_API(void) LDAP_CALL ldap_memfree(void* p);
363 
364 /*
365  * LDAPv3 extended operation calls
366  */
367 /*
368  * Note: all of the new asynchronous calls return an LDAP error code,
369  * not a message id.  A message id is returned via the int *msgidp
370  * parameter (usually the last parameter) if appropriate.
371  */
372 LDAP_API(int)
373 LDAP_CALL ldap_abandon_ext(LDAP* ld, int msgid, LDAPControl** serverctrls,
374                            LDAPControl** clientctrls);
375 LDAP_API(int)
376 LDAP_CALL ldap_add_ext(LDAP* ld, const char* dn, LDAPMod** attrs,
377                        LDAPControl** serverctrls, LDAPControl** clientctrls,
378                        int* msgidp);
379 LDAP_API(int)
380 LDAP_CALL ldap_add_ext_s(LDAP* ld, const char* dn, LDAPMod** attrs,
381                          LDAPControl** serverctrls, LDAPControl** clientctrls);
382 LDAP_API(int)
383 LDAP_CALL ldap_sasl_bind(LDAP* ld, const char* dn, const char* mechanism,
384                          const struct berval* cred, LDAPControl** serverctrls,
385                          LDAPControl** clientctrls, int* msgidp);
386 LDAP_API(int)
387 LDAP_CALL
388 ldap_sasl_bind_s(LDAP* ld, const char* dn, const char* mechanism,
389                  const struct berval* cred, LDAPControl** serverctrls,
390                  LDAPControl** clientctrls, struct berval** servercredp);
391 LDAP_API(int)
392 LDAP_CALL ldap_modify_ext(LDAP* ld, const char* dn, LDAPMod** mods,
393                           LDAPControl** serverctrls, LDAPControl** clientctrls,
394                           int* msgidp);
395 LDAP_API(int)
396 LDAP_CALL
397 ldap_modify_ext_s(LDAP* ld, const char* dn, LDAPMod** mods,
398                   LDAPControl** serverctrls, LDAPControl** clientctrls);
399 LDAP_API(int)
400 LDAP_CALL ldap_rename(LDAP* ld, const char* dn, const char* newrdn,
401                       const char* newparent, int deleteoldrdn,
402                       LDAPControl** serverctrls, LDAPControl** clientctrls,
403                       int* msgidp);
404 LDAP_API(int)
405 LDAP_CALL ldap_rename_s(LDAP* ld, const char* dn, const char* newrdn,
406                         const char* newparent, int deleteoldrdn,
407                         LDAPControl** serverctrls, LDAPControl** clientctrls);
408 LDAP_API(int)
409 LDAP_CALL
410 ldap_compare_ext(LDAP* ld, const char* dn, const char* attr,
411                  const struct berval* bvalue, LDAPControl** serverctrls,
412                  LDAPControl** clientctrls, int* msgidp);
413 LDAP_API(int)
414 LDAP_CALL
415 ldap_compare_ext_s(LDAP* ld, const char* dn, const char* attr,
416                    const struct berval* bvalue, LDAPControl** serverctrls,
417                    LDAPControl** clientctrls);
418 LDAP_API(int)
419 LDAP_CALL ldap_delete_ext(LDAP* ld, const char* dn, LDAPControl** serverctrls,
420                           LDAPControl** clientctrls, int* msgidp);
421 LDAP_API(int)
422 LDAP_CALL ldap_delete_ext_s(LDAP* ld, const char* dn, LDAPControl** serverctrls,
423                             LDAPControl** clientctrls);
424 LDAP_API(int)
425 LDAP_CALL ldap_search_ext(LDAP* ld, const char* base, int scope,
426                           const char* filter, char** attrs, int attrsonly,
427                           LDAPControl** serverctrls, LDAPControl** clientctrls,
428                           struct timeval* timeoutp, int sizelimit, int* msgidp);
429 LDAP_API(int)
430 LDAP_CALL
431 ldap_search_ext_s(LDAP* ld, const char* base, int scope, const char* filter,
432                   char** attrs, int attrsonly, LDAPControl** serverctrls,
433                   LDAPControl** clientctrls, struct timeval* timeoutp,
434                   int sizelimit, LDAPMessage** res);
435 LDAP_API(int)
436 LDAP_CALL ldap_extended_operation(LDAP* ld, const char* requestoid,
437                                   const struct berval* requestdata,
438                                   LDAPControl** serverctrls,
439                                   LDAPControl** clientctrls, int* msgidp);
440 LDAP_API(int)
441 LDAP_CALL ldap_extended_operation_s(LDAP* ld, const char* requestoid,
442                                     const struct berval* requestdata,
443                                     LDAPControl** serverctrls,
444                                     LDAPControl** clientctrls, char** retoidp,
445                                     struct berval** retdatap);
446 LDAP_API(int)
447 LDAP_CALL ldap_unbind_ext(LDAP* ld, LDAPControl** serverctrls,
448                           LDAPControl** clientctrls);
449 
450 /*
451  * LDAPv3 extended parsing / result handling calls
452  */
453 LDAP_API(int)
454 LDAP_CALL ldap_parse_sasl_bind_result(LDAP* ld, LDAPMessage* res,
455                                       struct berval** servercredp, int freeit);
456 LDAP_API(int)
457 LDAP_CALL
458 ldap_parse_result(LDAP* ld, LDAPMessage* res, int* errcodep, char** matcheddnp,
459                   char** errmsgp, char*** referralsp,
460                   LDAPControl*** serverctrlsp, int freeit);
461 LDAP_API(int)
462 LDAP_CALL ldap_parse_extended_result(LDAP* ld, LDAPMessage* res, char** retoidp,
463                                      struct berval** retdatap, int freeit);
464 LDAP_API(LDAPMessage*)
465 LDAP_CALL ldap_first_message(LDAP* ld, LDAPMessage* res);
466 LDAP_API(LDAPMessage*) LDAP_CALL ldap_next_message(LDAP* ld, LDAPMessage* msg);
467 LDAP_API(int) LDAP_CALL ldap_count_messages(LDAP* ld, LDAPMessage* res);
468 LDAP_API(LDAPMessage*)
469 LDAP_CALL ldap_first_reference(LDAP* ld, LDAPMessage* res);
470 LDAP_API(LDAPMessage*)
471 LDAP_CALL ldap_next_reference(LDAP* ld, LDAPMessage* ref);
472 LDAP_API(int) LDAP_CALL ldap_count_references(LDAP* ld, LDAPMessage* res);
473 LDAP_API(int)
474 LDAP_CALL ldap_parse_reference(LDAP* ld, LDAPMessage* ref, char*** referralsp,
475                                LDAPControl*** serverctrlsp, int freeit);
476 LDAP_API(int)
477 LDAP_CALL ldap_get_entry_controls(LDAP* ld, LDAPMessage* entry,
478                                   LDAPControl*** serverctrlsp);
479 LDAP_API(void) LDAP_CALL ldap_control_free(LDAPControl* ctrl);
480 LDAP_API(void) LDAP_CALL ldap_controls_free(LDAPControl** ctrls);
481 
482 #ifdef __cplusplus
483 }
484 #endif
485 #endif /* _LDAP_STANDARD_H */
486