1*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 2*7c478bd9Sstevel@tonic-gate 3*7c478bd9Sstevel@tonic-gate /* 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the Netscape Public 5*7c478bd9Sstevel@tonic-gate * License Version 1.1 (the "License"); you may not use this file 6*7c478bd9Sstevel@tonic-gate * except in compliance with the License. You may obtain a copy of 7*7c478bd9Sstevel@tonic-gate * the License at http://www.mozilla.org/NPL/ 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * Software distributed under the License is distributed on an "AS 10*7c478bd9Sstevel@tonic-gate * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 11*7c478bd9Sstevel@tonic-gate * implied. See the License for the specific language governing 12*7c478bd9Sstevel@tonic-gate * rights and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * The Original Code is Mozilla Communicator client code, released 15*7c478bd9Sstevel@tonic-gate * March 31, 1998. 16*7c478bd9Sstevel@tonic-gate * 17*7c478bd9Sstevel@tonic-gate * The Initial Developer of the Original Code is Netscape 18*7c478bd9Sstevel@tonic-gate * Communications Corporation. Portions created by Netscape are 19*7c478bd9Sstevel@tonic-gate * Copyright (C) 1998-1999 Netscape Communications Corporation. All 20*7c478bd9Sstevel@tonic-gate * Rights Reserved. 21*7c478bd9Sstevel@tonic-gate * 22*7c478bd9Sstevel@tonic-gate * Contributor(s): 23*7c478bd9Sstevel@tonic-gate */ 24*7c478bd9Sstevel@tonic-gate #include "ldap-int.h" 25*7c478bd9Sstevel@tonic-gate 26*7c478bd9Sstevel@tonic-gate int 27*7c478bd9Sstevel@tonic-gate LDAP_CALL 28*7c478bd9Sstevel@tonic-gate ldap_msgid( LDAPMessage *lm ) 29*7c478bd9Sstevel@tonic-gate { 30*7c478bd9Sstevel@tonic-gate if ( !NSLDAPI_VALID_LDAPMESSAGE_POINTER( lm )) { 31*7c478bd9Sstevel@tonic-gate return( -1 ); 32*7c478bd9Sstevel@tonic-gate } 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate return( lm->lm_msgid ); 35*7c478bd9Sstevel@tonic-gate } 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate int 38*7c478bd9Sstevel@tonic-gate LDAP_CALL 39*7c478bd9Sstevel@tonic-gate ldap_msgtype( LDAPMessage *lm ) 40*7c478bd9Sstevel@tonic-gate { 41*7c478bd9Sstevel@tonic-gate if ( !NSLDAPI_VALID_LDAPMESSAGE_POINTER( lm )) { 42*7c478bd9Sstevel@tonic-gate return( -1 ); 43*7c478bd9Sstevel@tonic-gate } 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate return( lm->lm_msgtype ); 46*7c478bd9Sstevel@tonic-gate } 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate LDAPMessage * 50*7c478bd9Sstevel@tonic-gate LDAP_CALL 51*7c478bd9Sstevel@tonic-gate ldap_first_message( LDAP *ld, LDAPMessage *chain ) 52*7c478bd9Sstevel@tonic-gate { 53*7c478bd9Sstevel@tonic-gate if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { 54*7c478bd9Sstevel@tonic-gate return( NULLMSG ); /* punt */ 55*7c478bd9Sstevel@tonic-gate } 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate return( chain ); 58*7c478bd9Sstevel@tonic-gate } 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gate LDAPMessage * 62*7c478bd9Sstevel@tonic-gate LDAP_CALL 63*7c478bd9Sstevel@tonic-gate ldap_next_message( LDAP *ld, LDAPMessage *msg ) 64*7c478bd9Sstevel@tonic-gate { 65*7c478bd9Sstevel@tonic-gate if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { 66*7c478bd9Sstevel@tonic-gate return( NULLMSG ); /* punt */ 67*7c478bd9Sstevel@tonic-gate } 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate if ( msg == NULLMSG || msg->lm_chain == NULLMSG ) { 70*7c478bd9Sstevel@tonic-gate return( NULLMSG ); 71*7c478bd9Sstevel@tonic-gate } 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate return( msg->lm_chain ); 74*7c478bd9Sstevel@tonic-gate } 75*7c478bd9Sstevel@tonic-gate 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate int 78*7c478bd9Sstevel@tonic-gate LDAP_CALL 79*7c478bd9Sstevel@tonic-gate ldap_count_messages( LDAP *ld, LDAPMessage *chain ) 80*7c478bd9Sstevel@tonic-gate { 81*7c478bd9Sstevel@tonic-gate int i; 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { 84*7c478bd9Sstevel@tonic-gate return( -1 ); 85*7c478bd9Sstevel@tonic-gate } 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate for ( i = 0; chain != NULL; chain = chain->lm_chain ) { 88*7c478bd9Sstevel@tonic-gate i++; 89*7c478bd9Sstevel@tonic-gate } 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate return( i ); 92*7c478bd9Sstevel@tonic-gate } 93