]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPExtResult.cpp
ef5361c574fd412a30772654c6f9c0c69dfbe66f
[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 LDAPExtResult::LDAPExtResult(const LDAPRequest* req, LDAPMessage* msg) :
15         LDAPResult(req, msg){
16     DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPExtResult::LDAPExtResult()" << endl);
17     char* oid = 0;
18     BerValue* data = 0;
19     LDAP* lc = req->getConnection()->getSessionHandle();
20     int err=ldap_parse_extended_result(lc, msg, &oid, &data, 0);
21     if(err != LDAP_SUCCESS){
22         ber_bvfree(data);
23         ldap_memfree(oid);
24         throw LDAPException(err);
25     }else{
26         m_oid=string(oid);
27         ldap_memfree(oid);
28         if(data){
29             m_data=string(data->bv_val, data->bv_len);
30             ber_bvfree(data);
31         }
32     }
33 }
34
35 LDAPExtResult::~LDAPExtResult(){
36     DEBUG(LDAP_DEBUG_DESTROY,"LDAPExtResult::~LDAPExtResult()" << endl);
37 }
38
39 const string& LDAPExtResult::getResponseOid() const{
40     return m_oid;
41 }
42
43 const string& LDAPExtResult::getResponse() const{
44     return m_data;
45 }
46