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