2 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
8 #include "LDAPRequest.h"
12 LDAPRequest::LDAPRequest(){
13 DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPRequest::LDAPRequest()" << endl);
16 LDAPRequest::LDAPRequest(const LDAPRequest& req){
17 DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPRequest::LDAPRequest(&)" << endl);
18 m_isReferral=req.m_isReferral;
19 m_cons = new LDAPConstraints(*(req.m_cons));
20 m_connection = req.m_connection;
21 m_parent = req.m_parent;
22 m_hopCount = req.m_hopCount;
23 m_msgID = req.m_msgID;
26 LDAPRequest::LDAPRequest(LDAPAsynConnection* con,
27 const LDAPConstraints* cons,bool isReferral, const LDAPRequest* parent){
28 DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPRequest::LDAPRequest()" << endl);
31 m_cons=new LDAPConstraints( *(con->getConstraints()) );
33 m_cons=new LDAPConstraints( *cons);
35 m_isReferral=isReferral;
37 m_hopCount = (parent->getHopCount()+1);
45 LDAPRequest::~LDAPRequest(){
46 DEBUG(LDAP_DEBUG_DESTROY,"LDAPRequest::~LDAPRequest()" << endl);
50 LDAPMsg* LDAPRequest::getNextMessage() const
52 DEBUG(LDAP_DEBUG_DESTROY,"LDAPRequest::getNextMessage()" << endl);
56 res=ldap_result(this->m_connection->getSessionHandle(),
57 this->m_msgID,0,0,&msg);
63 throw LDAPException(this->m_connection);
66 //this can throw an exception (Decoding Error)
67 ret = LDAPMsg::create(this,msg);
73 LDAPRequest* LDAPRequest::followReferral(LDAPMsg* /*urls*/){
74 DEBUG(LDAP_DEBUG_TRACE,"LDAPBindRequest::followReferral()" << endl);
75 DEBUG(LDAP_DEBUG_TRACE,
76 "ReferralChasing not implemented for this operation" << endl);
80 const LDAPConstraints* LDAPRequest::getConstraints() const{
81 DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getConstraints()" << endl);
85 const LDAPAsynConnection* LDAPRequest::getConnection() const{
86 DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getConnection()" << endl);
90 int LDAPRequest::getType() const {
91 DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getType()" << endl);
95 int LDAPRequest::getMsgID() const {
96 DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getMsgId()" << endl);
100 int LDAPRequest::getHopCount() const {
101 DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getHopCount()" << endl);
105 const LDAPRequest* LDAPRequest::getParent() const{
106 DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getParent()" << endl);
110 bool LDAPRequest::isReferral() const {
111 DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::isReferral()" << endl);
115 bool LDAPRequest::equals(const LDAPRequest* req) const{
116 DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::equals()" << endl);
117 if( (this->m_requestType == req->getType()) &&
118 (this->m_connection->getHost() == req->m_connection->getHost()) &&
119 (this->m_connection->getPort() == req->m_connection->getPort())
125 bool LDAPRequest::isCycle() const{
126 DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::isCycle()" << endl);
127 const LDAPRequest* parent=m_parent;
130 if(this->equals(parent)){
133 parent=parent->getParent();
141 void LDAPRequest::unbind() const{
142 DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::unbind()" << endl);
143 m_connection->unbind();