Back to index

openldap  2.4.31
Public Member Functions | Static Public Attributes | Protected Attributes | Private Member Functions | Private Attributes
LDAPSearchRequest Class Reference

#include <LDAPSearchRequest.h>

Inheritance diagram for LDAPSearchRequest:
Inheritance graph
[legend]
Collaboration diagram for LDAPSearchRequest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LDAPSearchRequest (const LDAPSearchRequest &req)
 LDAPSearchRequest (const std::string &base, int scope, const std::string &filter, const StringList &attrs, bool attrsOnly, LDAPAsynConnection *connect, const LDAPConstraints *cons, bool isReferral=false, const LDAPRequest *parent=0)
virtual ~LDAPSearchRequest ()
virtual LDAPMessageQueuesendRequest ()
 This method encodes the request an calls the apprpriate functions of the C-API to send the Request to a LDAP-Server.
virtual LDAPRequestfollowReferral (LDAPMsg *ref)
virtual bool equals (const LDAPRequest *req) const
 Compare this request with another on.
const LDAPConstraintsgetConstraints () const
const LDAPAsynConnectiongetConnection () const
virtual LDAPMsggetNextMessage () const
int getType () const
int getMsgID () const
int getHopCount () const
const LDAPRequestgetParent () const
bool isReferral () const
void unbind () const
bool isCycle () const

Static Public Attributes

static const int BIND = 0
static const int UNBIND = 2
static const int SEARCH = 3
static const int MODIFY = 7
static const int ADD = 8
static const int DELETE = 10
static const int COMPARE = 14

Protected Attributes

bool m_isReferral
int m_requestType
LDAPConstraintsm_cons
LDAPAsynConnectionm_connection
const LDAPRequestm_parent
int m_hopCount
int m_msgID

Private Member Functions

 LDAPSearchRequest ()

Private Attributes

std::string m_base
int m_scope
std::string m_filter
StringList m_attrs
bool m_attrsOnly

Detailed Description

Definition at line 17 of file LDAPSearchRequest.h.


Constructor & Destructor Documentation

Definition at line 19 of file LDAPSearchRequest.cpp.

                                                                  :
        LDAPRequest (req){
    DEBUG(LDAP_DEBUG_CONSTRUCT, 
        "LDAPSearchRequest::LDAPSearchRequest(&)" << endl);
    m_base=req.m_base;
    m_scope=req.m_scope;
    m_filter=req.m_filter;
    m_attrs=req.m_attrs;
    m_attrsOnly=req.m_attrsOnly;
}
LDAPSearchRequest::LDAPSearchRequest ( const std::string &  base,
int  scope,
const std::string &  filter,
const StringList attrs,
bool  attrsOnly,
LDAPAsynConnection connect,
const LDAPConstraints cons,
bool  isReferral = false,
const LDAPRequest parent = 0 
)

Definition at line 31 of file LDAPSearchRequest.cpp.

            : LDAPRequest (connect,cons,isReferral,parent) {
    
    DEBUG(LDAP_DEBUG_CONSTRUCT,
            "LDAPSearchRequest:LDAPSearchRequest()" << endl);
    DEBUG(LDAP_DEBUG_CONSTRUCT & LDAP_DEBUG_PARAMETER,
            "   base:" << base << endl << "   scope:" << scope << endl
            << "   filter:" << filter << endl);
    m_requestType=LDAPRequest::SEARCH;
    //insert some validating and copying here  
    m_base=base;
    m_scope=scope;
    if(filter == ""){
        m_filter="objectClass=*";  
    }else{
        m_filter=filter;
    }
    m_attrs=attrs;
    m_attrsOnly=attrsOnly;
}

Definition at line 56 of file LDAPSearchRequest.cpp.

                                     {
    DEBUG(LDAP_DEBUG_DESTROY, "LDAPSearchRequest::~LDAPSearchRequest" << endl);
}
LDAPSearchRequest::LDAPSearchRequest ( ) [inline, private]

Definition at line 40 of file LDAPSearchRequest.h.

{};

Here is the caller graph for this function:


Member Function Documentation

bool LDAPSearchRequest::equals ( const LDAPRequest req) const [virtual]

Compare this request with another on.

And returns true if they have the same parameters.

Reimplemented from LDAPRequest.

Definition at line 124 of file LDAPSearchRequest.cpp.

                                                         {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchRequest::equals()" << endl);
    if( LDAPRequest::equals(req)){
        LDAPSearchRequest* sreq = (LDAPSearchRequest*)req;
        if ( (m_base == sreq->m_base) &&
             (m_scope == sreq->m_scope) 
           ){
            return true;
        }
    }
    return false;
}

Here is the call graph for this function:

Reimplemented from LDAPRequest.

Definition at line 89 of file LDAPSearchRequest.cpp.

                                                          {
    DEBUG(LDAP_DEBUG_TRACE, "LDAPSearchRequest::followReferral()" << endl);
    LDAPUrlList urls;
    LDAPUrlList::const_iterator usedUrl;
    LDAPAsynConnection* con;
    string filter;
    int scope;
    if(ref->getMessageType() == LDAPMsg::SEARCH_REFERENCE){
        urls = ((LDAPSearchReference *)ref)->getUrls();
    }else{
        urls = ((LDAPResult *)ref)->getReferralUrls();
    }
    con = getConnection()->referralConnect(urls,usedUrl,m_cons);
    if(con != 0){
        if((usedUrl->getFilter() != "") && 
            (usedUrl->getFilter() != m_filter)){
                filter=usedUrl->getFilter();
        }else{
            filter=m_filter;
        }
        if( (ref->getMessageType() == LDAPMsg::SEARCH_REFERENCE) && 
            (m_scope == LDAPAsynConnection::SEARCH_ONE)
          ){
            scope = LDAPAsynConnection::SEARCH_BASE;
            DEBUG(LDAP_DEBUG_TRACE,"   adjusted scope to BASE" << endl);
        }else{
            scope = m_scope;
        }
    }else{
        return 0;
    }
    return new LDAPSearchRequest(usedUrl->getDN(), scope, filter,
            m_attrs, m_attrsOnly, con, m_cons,true,this);
}

Here is the call graph for this function:

Definition at line 86 of file LDAPRequest.cpp.

                                                          {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getConnection()" << endl);
    return m_connection;
}

Here is the caller graph for this function:

Definition at line 81 of file LDAPRequest.cpp.

                                                        {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getConstraints()" << endl);
    return m_cons;
}

Here is the caller graph for this function:

int LDAPRequest::getHopCount ( ) const [inherited]

Definition at line 101 of file LDAPRequest.cpp.

                                   {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getHopCount()" << endl);
    return m_hopCount;
}

Here is the caller graph for this function:

int LDAPRequest::getMsgID ( ) const [inherited]

Definition at line 96 of file LDAPRequest.cpp.

                                {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getMsgId()" << endl);
    return m_msgID;
}

Here is the caller graph for this function:

LDAPMsg * LDAPRequest::getNextMessage ( ) const [virtual, inherited]

Reimplemented in LDAPSaslInteractiveBind.

Definition at line 51 of file LDAPRequest.cpp.

{
    DEBUG(LDAP_DEBUG_DESTROY,"LDAPRequest::getNextMessage()" << endl);
    int res;
    LDAPMessage *msg;

    res=ldap_result(this->m_connection->getSessionHandle(),
            this->m_msgID,0,0,&msg);

    if (res <= 0){
        if(msg != 0){
            ldap_msgfree(msg);
        }
        throw  LDAPException(this->m_connection);
    }else{    
        LDAPMsg *ret=0;
        //this can  throw an exception (Decoding Error)
        ret = LDAPMsg::create(this,msg);
        ldap_msgfree(msg);
        return ret;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

const LDAPRequest * LDAPRequest::getParent ( ) const [inherited]
Returns:
The LDAPRequest that has created this object. Or 0 if this object was not created by another request.

Definition at line 106 of file LDAPRequest.cpp.

                                               {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getParent()" << endl);
    return m_parent;
}

Here is the caller graph for this function:

int LDAPRequest::getType ( ) const [inherited]

Definition at line 91 of file LDAPRequest.cpp.

                               {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getType()" << endl);
    return m_requestType;
}

Here is the caller graph for this function:

bool LDAPRequest::isCycle ( ) const [inherited]

Definition at line 126 of file LDAPRequest.cpp.

                               {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::isCycle()" << endl);
    const LDAPRequest* parent=m_parent;
    if(parent != 0){
        do{
            if(this->equals(parent)){
                return true;
            }else{
                parent=parent->getParent();
            }
        }
        while(parent != 0);
    }
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool LDAPRequest::isReferral ( ) const [inherited]
Returns:
true if this object was created during the automatic chasing of referrals. Otherwise false

Definition at line 111 of file LDAPRequest.cpp.

                                   {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::isReferral()" << endl);
    return m_isReferral;
}

Here is the caller graph for this function:

This method encodes the request an calls the apprpriate functions of the C-API to send the Request to a LDAP-Server.

Implements LDAPRequest.

Definition at line 60 of file LDAPSearchRequest.cpp.

                                                {
    int msgID; 
    DEBUG(LDAP_DEBUG_TRACE, "LDAPSearchRequest::sendRequest()" << endl);
    timeval* tmptime=m_cons->getTimeoutStruct();
    char** tmpattrs=m_attrs.toCharArray();
    LDAPControl** tmpSrvCtrl=m_cons->getSrvCtrlsArray();
    LDAPControl** tmpClCtrl=m_cons->getClCtrlsArray();
    int aliasDeref = m_cons->getAliasDeref();
    ldap_set_option(m_connection->getSessionHandle(), LDAP_OPT_DEREF, 
            &aliasDeref);
    int err=ldap_search_ext(m_connection->getSessionHandle(), m_base.c_str(),
            m_scope, m_filter.c_str(), tmpattrs, m_attrsOnly, tmpSrvCtrl,
            tmpClCtrl, tmptime, m_cons->getSizeLimit(), &msgID );
    delete tmptime;
    ber_memvfree((void**)tmpattrs);
    LDAPControlSet::freeLDAPControlArray(tmpSrvCtrl);
    LDAPControlSet::freeLDAPControlArray(tmpClCtrl);

    if (err != LDAP_SUCCESS){  
        throw LDAPException(err);
    } else if (isReferral()){
        m_msgID=msgID;
        return 0;
    }else{
        m_msgID=msgID;
        return  new LDAPMessageQueue(this);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void LDAPRequest::unbind ( ) const [inherited]

Definition at line 142 of file LDAPRequest.cpp.

                              {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::unbind()" << endl);
    m_connection->unbind();
}

Here is the caller graph for this function:


Member Data Documentation

const int LDAPRequest::ADD = 8 [static, inherited]

Definition at line 32 of file LDAPRequest.h.

const int LDAPRequest::BIND = 0 [static, inherited]

Definition at line 28 of file LDAPRequest.h.

const int LDAPRequest::COMPARE = 14 [static, inherited]

Definition at line 34 of file LDAPRequest.h.

const int LDAPRequest::DELETE = 10 [static, inherited]

Definition at line 33 of file LDAPRequest.h.

Definition at line 36 of file LDAPSearchRequest.h.

Definition at line 37 of file LDAPSearchRequest.h.

std::string LDAPSearchRequest::m_base [private]

Definition at line 33 of file LDAPSearchRequest.h.

Definition at line 82 of file LDAPRequest.h.

LDAPConstraints* LDAPRequest::m_cons [protected, inherited]

Definition at line 81 of file LDAPRequest.h.

std::string LDAPSearchRequest::m_filter [private]

Definition at line 35 of file LDAPSearchRequest.h.

int LDAPRequest::m_hopCount [protected, inherited]

Definition at line 84 of file LDAPRequest.h.

bool LDAPRequest::m_isReferral [protected, inherited]

Definition at line 79 of file LDAPRequest.h.

int LDAPRequest::m_msgID [protected, inherited]

Definition at line 85 of file LDAPRequest.h.

const LDAPRequest* LDAPRequest::m_parent [protected, inherited]

Definition at line 83 of file LDAPRequest.h.

int LDAPRequest::m_requestType [protected, inherited]

Definition at line 80 of file LDAPRequest.h.

Definition at line 34 of file LDAPSearchRequest.h.

const int LDAPRequest::MODIFY = 7 [static, inherited]

Definition at line 31 of file LDAPRequest.h.

const int LDAPRequest::SEARCH = 3 [static, inherited]

Definition at line 30 of file LDAPRequest.h.

const int LDAPRequest::UNBIND = 2 [static, inherited]

Definition at line 29 of file LDAPRequest.h.


The documentation for this class was generated from the following files: