1 /* messages.c */ 2 /* $OpenLDAP: pkg/ldap/libraries/libldap/messages.c,v 1.17.2.3 2008/02/11 23:26:41 kurt Exp $ */ 3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>. 4 * 5 * Copyright 1998-2008 The OpenLDAP Foundation. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted only as authorized by the OpenLDAP 10 * Public License. 11 * 12 * A copy of this license is available in the file LICENSE in the 13 * top-level directory of the distribution or, alternatively, at 14 * <http://www.OpenLDAP.org/license.html>. 15 */ 16 17 #include "portable.h" 18 19 #include <stdio.h> 20 21 #include <ac/stdlib.h> 22 23 #include <ac/socket.h> 24 #include <ac/string.h> 25 #include <ac/time.h> 26 27 #include "ldap-int.h" 28 29 LDAPMessage * 30 ldap_first_message( LDAP *ld, LDAPMessage *chain ) 31 { 32 assert( ld != NULL ); 33 assert( LDAP_VALID( ld ) ); 34 assert( chain != NULL ); 35 36 return chain; 37 } 38 39 LDAPMessage * 40 ldap_next_message( LDAP *ld, LDAPMessage *msg ) 41 { 42 assert( ld != NULL ); 43 assert( LDAP_VALID( ld ) ); 44 assert( msg != NULL ); 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 for ( i = 0; chain != NULL; chain = chain->lm_chain ) { 58 i++; 59 } 60 61 return( i ); 62 } 63 64 BerElement* 65 ldap_get_message_ber( LDAPMessage *ld ) 66 { 67 return ld->lm_ber; 68 } 69