Back to index

openldap  2.4.31
LDAPExtResult.cpp
Go to the documentation of this file.
00001 // $OpenLDAP$
00002 /*
00003  * Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
00004  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
00005  */
00006 
00007 #include "debug.h"
00008 #include <lber.h>
00009 #include "LDAPRequest.h"
00010 #include "LDAPException.h"
00011 
00012 #include "LDAPResult.h"
00013 #include "LDAPExtResult.h"
00014 
00015 using namespace std;
00016 
00017 LDAPExtResult::LDAPExtResult(const LDAPRequest* req, LDAPMessage* msg) :
00018         LDAPResult(req, msg){
00019     DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPExtResult::LDAPExtResult()" << endl);
00020     char* oid = 0;
00021     BerValue* data = 0;
00022     LDAP* lc = req->getConnection()->getSessionHandle();
00023     int err=ldap_parse_extended_result(lc, msg, &oid, &data, 0);
00024     if(err != LDAP_SUCCESS){
00025         ber_bvfree(data);
00026         ldap_memfree(oid);
00027         throw LDAPException(err);
00028     }else{
00029         m_oid=string(oid);
00030         ldap_memfree(oid);
00031         if(data){
00032             m_data=string(data->bv_val, data->bv_len);
00033             ber_bvfree(data);
00034         }
00035     }
00036 }
00037 
00038 LDAPExtResult::~LDAPExtResult(){
00039     DEBUG(LDAP_DEBUG_DESTROY,"LDAPExtResult::~LDAPExtResult()" << endl);
00040 }
00041 
00042 const string& LDAPExtResult::getResponseOid() const{
00043     return m_oid;
00044 }
00045 
00046 const string& LDAPExtResult::getResponse() const{
00047     return m_data;
00048 }
00049