ldap_count_entries

Returns the number of LDAPMessage structures that are of the type LDAP_RES_SEARCH_ENTRY.

LDAP Version:v2 or higher
Library:*ldapsdk.*
NDS Version:7.xx or higher
Platform:NLM, Windows (NT, 95, 98, 2000, XP, Vista 32-bit and 64-bit ), Linux (32-bit and 64-bit), Solaris, AIX, and HP-UX

Syntax

  #include <ldap.h>
  
  int ldap_count_entries (
     LDAP          *ld,
     LDAPMessage   *res);
  
  

Parameters

ld

(IN) Points to the handle for the LDAP session.

res

(IN) Points to the result message chain returned by the ldap_result function or a synchronous search function.

Return Values

>0

Number of entries

0

No more entries

-1

Failure

Remarks

The ldap_count_entries function can be used to count the number of message structures that remain in a chain. Messages are removed from the chain by calling one of the following functions:

  • ldap_first_message

  • ldap_next_message

  • ldap_first_entry

  • ldap_next_entry

This function counts from the current position of the pointer to the end of the chain.

  • If you pass a pointer that points to the first message structure in the chain, it counts all the entries in the chain.

  • If you pass a pointer that points to a structure in the middle of the chain, it counts the entries from that point to the end of the chain.

See Also

ldap_first_entry, ldap_next_entry, ldap_search, ldap_search_ext, ldap_search_ext_s, ldap_search_s, ldap_search_st