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