]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPExtResult.cpp
use URIs instead of hostname/port
[openldap] / contrib / ldapc++ / src / LDAPExtResult.cpp
1 /*
2  * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
4  */
5
6 #include "debug.h"
7 #include <lber.h>
8 #include "LDAPRequest.h"
9 #include "LDAPException.h"
10
11 #include "LDAPResult.h"
12 #include "LDAPExtResult.h"
13
14 using namespace std;
15
16 LDAPExtResult::LDAPExtResult(const LDAPRequest* req, LDAPMessage* msg) :
17         LDAPResult(req, msg){
18     DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPExtResult::LDAPExtResult()" << endl);
19     char* oid = 0;
20     BerValue* data = 0;
21     LDAP* lc = req->getConnection()->getSessionHandle();
22     int err=ldap_parse_extended_result(lc, msg, &oid, &data, 0);
23     if(err != LDAP_SUCCESS){
24         ber_bvfree(data);
25         ldap_memfree(oid);
26         throw LDAPException(err);
27     }else{
28         m_oid=string(oid);
29         ldap_memfree(oid);
30         if(data){
31             m_data=string(data->bv_val, data->bv_len);
32             ber_bvfree(data);
33         }
34     }
35 }
36
37 LDAPExtResult::~LDAPExtResult(){
38     DEBUG(LDAP_DEBUG_DESTROY,"LDAPExtResult::~LDAPExtResult()" << endl);
39 }
40
41 const string& LDAPExtResult::getResponseOid() const{
42     return m_oid;
43 }
44
45 const string& LDAPExtResult::getResponse() const{
46     return m_data;
47 }
48