]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPSearchReference.cpp
Entry rwlock is no longer needed as concurrency is managed
[openldap] / contrib / ldapc++ / src / LDAPSearchReference.cpp
1 /*
2  * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
4  */
5
6
7 #include <iostream>
8
9 #include "debug.h"
10 #include "LDAPSearchReference.h"
11 #include "LDAPException.h"
12 #include "LDAPRequest.h"
13 #include "LDAPUrl.h"
14
15 using namespace std;
16
17 LDAPSearchReference::LDAPSearchReference(const LDAPRequest *req,
18         LDAPMessage *msg) : LDAPMsg(msg){
19     DEBUG(LDAP_DEBUG_CONSTRUCT,
20             "LDAPSearchReference::LDAPSearchReference()" << endl;)    
21     char **ref=0;
22     LDAPControl** srvctrls=0;
23     const LDAPAsynConnection* con=req->getConnection();
24     int err = ldap_parse_reference(con->getSessionHandle(), msg, &ref, 
25             &srvctrls,0);
26     if (err != LDAP_SUCCESS){
27         ldap_value_free(ref);
28         ldap_controls_free(srvctrls);
29         throw LDAPException(err);
30     }else{
31         m_urlList=LDAPUrlList(ref);
32         ldap_value_free(ref);
33         if (srvctrls){
34             m_srvControls = LDAPControlSet(srvctrls);
35             m_hasControls = true;
36             ldap_controls_free(srvctrls);
37         }else{
38             m_hasControls = false;
39         }
40     }
41 }
42
43 LDAPSearchReference::~LDAPSearchReference(){
44     DEBUG(LDAP_DEBUG_DESTROY,"LDAPSearchReference::~LDAPSearchReference()"
45             << endl);
46 }
47
48 const LDAPUrlList& LDAPSearchReference::getUrls() const{
49     DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchReference::getUrls()" << endl);
50     return m_urlList;
51 }
52