]> git.sur5r.net Git - openldap/blob - libraries/libldap/messages.c
Add lber_log_print support to libldap.
[openldap] / libraries / libldap / messages.c
1 /*
2  * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
3  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
4  */
5 /*
6  *  messages.c
7  */
8
9 #include "portable.h"
10
11 #include <stdio.h>
12 #include <stdlib.h>
13
14 #include <ac/ctype.h>
15 #include <ac/socket.h>
16 #include <ac/string.h>
17 #include <ac/time.h>
18
19 #include "ldap-int.h"
20
21 /* ARGSUSED */
22 LDAPMessage *
23 ldap_first_message( LDAP *ld, LDAPMessage *chain )
24 {
25         return( ld == NULL || chain == NULLMSG
26                         ? NULLMSG : chain );
27 }
28
29 /* ARGSUSED */
30 LDAPMessage *
31 ldap_next_message( LDAP *ld, LDAPMessage *msg )
32 {
33         if ( ld == NULL || msg == NULLMSG || msg->lm_chain == NULL ) {
34                 return NULLMSG;
35         }
36
37         return( msg->lm_chain );
38 }
39
40 /* ARGSUSED */
41 int
42 ldap_count_messages( LDAP *ld, LDAPMessage *chain )
43 {
44         int     i;
45
46         if ( ld == NULL ) {
47                 return -1;
48         }
49
50         for ( i = 0; chain != NULL; chain = chain->lm_chain ) {
51                 i++;
52         }
53
54         return( i );
55 }