2 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
8 #include"LDAPAsynConnection.h"
9 #include "LDAPConstraints.h"
10 #include"LDAPResult.h"
11 #include"LDAPSearchResult.h"
12 #include"LDAPSearchReference.h"
13 #include"LDAPAttribute.h"
14 #include"LDAPAttributeList.h"
16 #include"LDAPException.h"
17 #include"LDAPModification.h"
21 LDAPAsynConnection *lc=new LDAPAsynConnection("localhost",9009);
22 cout << "----------------------doing bind...." << endl;
24 LDAPMessageQueue *q=lc->bind("cn=Manager,o=Organisation,c=DE" ,
26 LDAPMsg *res=q->getNext();
27 if( ((LDAPResult*)res)->getResultCode() == LDAPResult::SUCCESS){
28 cout << "--------------------...successfully bound" << endl;
30 }catch (LDAPException e){
31 cout << "-------------------------...error during bind" << endl;
34 cout << "--------------------starting search" << endl;
36 LDAPMessageQueue *q=lc->search("");
37 LDAPMsg *res=q->getNext();
40 switch(res->getMessageType()){
41 LDAPSearchResult *res2;
43 case LDAP_RES_SEARCH_ENTRY :
44 res2= (LDAPSearchResult*)res;
45 entry= res2->getEntry();
46 cout << "Entry: " << *entry << endl;
50 case LDAP_RES_SEARCH_REFERENCE :
55 cout << ( *(LDAPResult*) res) << endl;
57 cout << "-----------------search done" << endl;
63 }catch (LDAPException e){
64 cout << "----------------error during search" << endl;