ldap_count_messages()--Count messages in a result chain, as returned by ldap_result




Syntax

#include <ldap.h>
 
int ldap_count_messages(LDAP           *ld,
                        LDAPMessage    *result)



Threadsafe: Yes

The ldap_count_messages() routine is used to step through the list of messages in a result chain, as returned by ldap_result(). It is used to count the number of messages returned. The ldap_msgtype() API can be used to distinguish between the different message types.

In addition to returning the number of messages contained in a chain of results, the ldap_count_messages API can be used to count the number of messages that remain in a chain if called with a message, entry, or reference returned by ldap_first_message(), ldap_next_message(), ldap_first_entry, ldap_next_entry, ldap_first_reference and ldap_next_reference.

Authorities and Locks

No OS/400 authority is required. All authority checking is done by the LDAP server.

Parameters

ld
(Input) Specifies the LDAP pointer returned by a previous call to ldap_init(),ldap_ssl_init(), or ldap_open().

result
(Input) Specifies the result returned by a call to ldap_result() or one of the synchronous search routines (ldap_search_s(), ldap_search_st() or ldap_search_ext_s()).

Return Value

Number of Message
If the request was successful, ldap_count_message() API retuns the number of messages in a result chain or number of messages that remain in a chain, as returned by ldap_result().
-1
if the request was not successful.

Error Conditions

If ldap_count_message() is not successful, ld_errno will be set to indicate the error. See LDAP Client API Error Conditions for possible LDAP error code values. Use ldap_get_errno() function to retrieve the error information.

Error Messages

    The following message may be set from this function.
    CPF3CF2 E  Error(s) occurred during running of ldap_count_message API.

Related Information

    ldap_first_message() -- Return first message in a result chain, as returned by ldap_result.
    ldap_next_message() -- Return next message in a result chain, as returned by ldap_result.


Top | LDAP APIs List
APIs by category

[Information Center Home Page | Feedback ] [Legal | AS/400 Glossary]