#include <ldap.h>
int ldap_create_sort_control( LDAP *ld,
LDAPsortkey **sortKeyList, const char ctl_iscritical,
LDAPControl **ctrlp );
ld |
Connection handle, which is a pointer to an |
sortKeyList |
Pointer to an array of |
ctl_iscritical | |
ctrlp |
Pointer to a pointer to an |
LDAP_SUCCESS if successful. LDAP_PARAM_ERROR if an invalid parameter was passed to the function. LDAP_NO_MEMORY if memory cannot be allocated.LDAP_ENCODING_ERROR if an error occurred when BER-encoding the control ldap_create_sort_control() function allows you to specify the order in which you want to receive data from the server. Calling this function creates an LDAP control that you can pass to the ldap_search_ext() and ldap_search_ext_s() functions.
In order for the control to work, the LDAP server that you are connecting to must support the server control for sorting search results (OID 1.2.840.113556.1.4.473, or LDAP_CONTROL_SORTREQUEST as defined in ldap.h). See "Determining the Controls Supported By the Server" on page 288 for information on determining the controls supported by a server.
To specify the attributes to use for sorting the results, you can call ldap_create_sort_keylist() to create an array of LDAPsortkey structures and pass the array as the sortKeyList argument.
When you are done with the search, you should free the control and the array of LDAPsortkey structures by calling the ldap_control_free() function and the ldap_free_sort_keylist() function.
ldap_create_sort_keylist(), ldap_search_ext(), ldap_search_ext_s(), ldap_control_free().
Last Updated: 10/01/98 17:06:23