1999-09-09 03:06:24 +08:00
|
|
|
/* $OpenLDAP$ */
|
1998-12-29 04:53:15 +08:00
|
|
|
/*
|
2000-05-13 10:36:07 +08:00
|
|
|
* Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
|
1998-12-29 04:53:15 +08:00
|
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
|
|
*/
|
1998-12-24 12:45:54 +08:00
|
|
|
/*
|
|
|
|
* messages.c
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "portable.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
1999-06-03 08:37:44 +08:00
|
|
|
|
|
|
|
#include <ac/stdlib.h>
|
1998-12-24 12:45:54 +08:00
|
|
|
|
|
|
|
#include <ac/ctype.h>
|
|
|
|
#include <ac/socket.h>
|
|
|
|
#include <ac/string.h>
|
|
|
|
#include <ac/time.h>
|
|
|
|
|
|
|
|
#include "ldap-int.h"
|
|
|
|
|
|
|
|
LDAPMessage *
|
|
|
|
ldap_first_message( LDAP *ld, LDAPMessage *chain )
|
|
|
|
{
|
1999-06-06 04:18:32 +08:00
|
|
|
assert( ld != NULL );
|
|
|
|
assert( LDAP_VALID( ld ) );
|
|
|
|
|
1999-06-19 07:53:05 +08:00
|
|
|
if ( ld == NULL || chain == NULL ) {
|
|
|
|
return NULL;
|
1999-06-06 04:18:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return chain;
|
1998-12-24 12:45:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
LDAPMessage *
|
|
|
|
ldap_next_message( LDAP *ld, LDAPMessage *msg )
|
|
|
|
{
|
1999-06-06 04:18:32 +08:00
|
|
|
assert( ld != NULL );
|
|
|
|
assert( LDAP_VALID( ld ) );
|
|
|
|
|
1999-06-19 07:53:05 +08:00
|
|
|
if ( ld == NULL || msg == NULL || msg->lm_chain == NULL ) {
|
|
|
|
return NULL;
|
1998-12-24 12:45:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return( msg->lm_chain );
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ldap_count_messages( LDAP *ld, LDAPMessage *chain )
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
1999-06-06 04:18:32 +08:00
|
|
|
assert( ld != NULL );
|
|
|
|
assert( LDAP_VALID( ld ) );
|
|
|
|
|
1998-12-24 12:45:54 +08:00
|
|
|
if ( ld == NULL ) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( i = 0; chain != NULL; chain = chain->lm_chain ) {
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return( i );
|
|
|
|
}
|