2000-09-02 02:46:32 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
|
|
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef LDAP_REQUEST_H
|
|
|
|
#define LDAP_REQUEST_H
|
|
|
|
|
2001-03-15 19:07:58 +08:00
|
|
|
#include <LDAPConstraints.h>
|
|
|
|
#include <LDAPAsynConnection.h>
|
|
|
|
#include <LDAPMessageQueue.h>
|
2000-09-02 02:46:32 +08:00
|
|
|
|
|
|
|
class LDAPUrl;
|
|
|
|
|
2001-02-19 19:34:28 +08:00
|
|
|
/**
|
|
|
|
* For internal use only
|
|
|
|
*
|
|
|
|
* Each request that is sent to a LDAP-server by this library is
|
|
|
|
* represented by a special object that contains the parameters and some
|
|
|
|
* other info of the request. This virtual class is the common base classe
|
|
|
|
* for these specialized request classes.
|
|
|
|
*/
|
2000-09-02 02:46:32 +08:00
|
|
|
class LDAPRequest{
|
|
|
|
|
|
|
|
public :
|
|
|
|
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;
|
2000-10-04 02:25:34 +08:00
|
|
|
|
|
|
|
LDAPRequest(const LDAPRequest& req);
|
|
|
|
LDAPRequest(LDAPAsynConnection* conn,
|
|
|
|
const LDAPConstraints* cons, bool isReferral=false,
|
|
|
|
const LDAPRequest* parent=0);
|
|
|
|
virtual ~LDAPRequest();
|
|
|
|
|
|
|
|
const LDAPConstraints* getConstraints() const;
|
|
|
|
const LDAPAsynConnection* getConnection() const;
|
2007-12-20 20:33:48 +08:00
|
|
|
virtual LDAPMsg *getNextMessage() const;
|
2000-10-04 02:25:34 +08:00
|
|
|
int getType()const;
|
|
|
|
int getMsgID() const;
|
|
|
|
int getHopCount() const;
|
2001-02-19 19:34:28 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return The LDAPRequest that has created this object. Or 0 if
|
|
|
|
* this object was not created by another request.
|
|
|
|
*/
|
2000-10-04 02:25:34 +08:00
|
|
|
const LDAPRequest* getParent() const;
|
|
|
|
|
2001-02-19 19:34:28 +08:00
|
|
|
/**
|
|
|
|
* @return true if this object was created during the automatic
|
|
|
|
* chasing of referrals. Otherwise false
|
|
|
|
*/
|
2000-10-04 02:25:34 +08:00
|
|
|
bool isReferral() const;
|
2001-02-19 19:34:28 +08:00
|
|
|
|
2000-10-04 02:25:34 +08:00
|
|
|
void unbind() const;
|
2001-02-19 19:34:28 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This method encodes the request an calls the apprpriate
|
|
|
|
* functions of the C-API to send the Request to a LDAP-Server
|
|
|
|
*/
|
2000-10-04 02:25:34 +08:00
|
|
|
virtual LDAPMessageQueue* sendRequest()=0;
|
2007-12-20 20:33:48 +08:00
|
|
|
virtual LDAPRequest* followReferral(LDAPMsg* ref);
|
2001-02-19 19:34:28 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Compare this request with another on. And returns true if they
|
|
|
|
* have the same parameters.
|
|
|
|
*/
|
2000-10-04 02:25:34 +08:00
|
|
|
virtual bool equals(const LDAPRequest* req) const;
|
2001-02-19 19:34:28 +08:00
|
|
|
|
2000-10-04 02:25:34 +08:00
|
|
|
bool isCycle() const;
|
|
|
|
|
|
|
|
protected :
|
|
|
|
bool m_isReferral;
|
|
|
|
int m_requestType;
|
|
|
|
LDAPConstraints *m_cons;
|
|
|
|
LDAPAsynConnection *m_connection;
|
|
|
|
const LDAPRequest* m_parent;
|
|
|
|
int m_hopCount;
|
|
|
|
int m_msgID; //the associated C-API Message ID
|
|
|
|
LDAPRequest();
|
2000-09-02 02:46:32 +08:00
|
|
|
};
|
|
|
|
#endif //LDAP_REQUEST_H
|
|
|
|
|