2 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6 // $Id: LDAPResult.cpp,v 1.10 2000/08/31 17:43:49 rhafer Exp $
10 #include"LDAPAsynConnection.h"
11 #include "LDAPRequest.h"
13 LDAPResult::LDAPResult(LDAPRequest *req, LDAPMessage *msg) : LDAPMsg(msg){
15 DEBUG(LDAP_DEBUG_TRACE,"LDAPResult::LDAPResult()" << endl);
16 const LDAPAsynConnection *con=req->getConnection();
19 //handle referrals and controls
21 ldap_parse_result(con->getSessionHandle(),msg,&m_resCode,
22 &m_matchedDN, &m_errMsg,&refs,0,0);
24 for (char **tmp=refs;*tmp != 0; tmp++){
25 DEBUG(LDAP_DEBUG_PARAMETER," url:" << *tmp << endl);
31 LDAPResult::~LDAPResult(){
32 DEBUG(LDAP_DEBUG_TRACE,"LDAPResult::~LDAPResult()" << endl);
37 int LDAPResult::getResultCode(){
41 char* LDAPResult::resToString(){
42 return ldap_err2string(m_resCode);
45 char* LDAPResult::getErrMsg(){
46 return strdup(m_errMsg);
49 char* LDAPResult::getMatchedDN(){
50 return strdup(m_matchedDN);
53 ostream& operator<<(ostream &s,LDAPResult &l){
54 return s << "Result: " << l.m_resCode << ": "
55 << ldap_err2string(l.m_resCode) << endl
56 << "Matched: " << l.m_matchedDN << endl << "ErrMsg: " << l.m_errMsg;