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