home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ldapsdk.zip / libraries / libldap / messages.c < prev    next >
C/C++ Source or Header  |  2000-07-05  |  1KB  |  66 lines

  1. /* $OpenLDAP: pkg/ldap/libraries/libldap/messages.c,v 1.5.6.3 2000/07/04 17:58:52 kurt Exp $ */
  2. /*
  3.  * Copyright 1998-2000 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/socket.h>
  17. #include <ac/string.h>
  18. #include <ac/time.h>
  19.  
  20. #include "ldap-int.h"
  21.  
  22. LDAPMessage *
  23. ldap_first_message( LDAP *ld, LDAPMessage *chain )
  24. {
  25.     assert( ld != NULL );
  26.     assert( LDAP_VALID( ld ) );
  27.  
  28.     if ( ld == NULL || chain == NULL ) {
  29.         return NULL;
  30.     }
  31.     
  32.       return chain;
  33. }
  34.  
  35. LDAPMessage *
  36. ldap_next_message( LDAP *ld, LDAPMessage *msg )
  37. {
  38.     assert( ld != NULL );
  39.     assert( LDAP_VALID( ld ) );
  40.  
  41.     if ( ld == NULL || msg == NULL || msg->lm_chain == NULL ) {
  42.         return NULL;
  43.     }
  44.  
  45.     return( msg->lm_chain );
  46. }
  47.  
  48. int
  49. ldap_count_messages( LDAP *ld, LDAPMessage *chain )
  50. {
  51.     int    i;
  52.  
  53.     assert( ld != NULL );
  54.     assert( LDAP_VALID( ld ) );
  55.  
  56.     if ( ld == NULL ) {
  57.         return -1;
  58.     }
  59.  
  60.     for ( i = 0; chain != NULL; chain = chain->lm_chain ) {
  61.         i++;
  62.     }
  63.  
  64.     return( i );
  65. }
  66.