1/* $NetBSD: LDAPRequest.h,v 1.1.1.2 2010/03/08 02:14:14 lukem Exp $ */ 2 3// OpenLDAP: pkg/ldap/contrib/ldapc++/src/LDAPRequest.h,v 1.4.10.3 2008/04/14 23:09:26 quanah Exp 4/* 5 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved. 6 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file 7 */ 8 9 10#ifndef LDAP_REQUEST_H 11#define LDAP_REQUEST_H 12 13#include <LDAPConstraints.h> 14#include <LDAPAsynConnection.h> 15#include <LDAPMessageQueue.h> 16 17class LDAPUrl; 18 19/** 20 * For internal use only 21 * 22 * Each request that is sent to a LDAP-server by this library is 23 * represented by a special object that contains the parameters and some 24 * other info of the request. This virtual class is the common base classe 25 * for these specialized request classes. 26 */ 27class LDAPRequest{ 28 29 public : 30 static const int BIND=0; 31 static const int UNBIND=2; 32 static const int SEARCH=3; 33 static const int MODIFY=7; 34 static const int ADD=8; 35 static const int DELETE=10; 36 static const int COMPARE=14; 37 38 LDAPRequest(const LDAPRequest& req); 39 LDAPRequest(LDAPAsynConnection* conn, 40 const LDAPConstraints* cons, bool isReferral=false, 41 const LDAPRequest* parent=0); 42 virtual ~LDAPRequest(); 43 44 const LDAPConstraints* getConstraints() const; 45 const LDAPAsynConnection* getConnection() const; 46 virtual LDAPMsg *getNextMessage() const; 47 int getType()const; 48 int getMsgID() const; 49 int getHopCount() const; 50 51 /** 52 * @return The LDAPRequest that has created this object. Or 0 if 53 * this object was not created by another request. 54 */ 55 const LDAPRequest* getParent() const; 56 57 /** 58 * @return true if this object was created during the automatic 59 * chasing of referrals. Otherwise false 60 */ 61 bool isReferral() const; 62 63 void unbind() const; 64 65 /** 66 * This method encodes the request an calls the apprpriate 67 * functions of the C-API to send the Request to a LDAP-Server 68 */ 69 virtual LDAPMessageQueue* sendRequest()=0; 70 virtual LDAPRequest* followReferral(LDAPMsg* ref); 71 72 /** 73 * Compare this request with another on. And returns true if they 74 * have the same parameters. 75 */ 76 virtual bool equals(const LDAPRequest* req) const; 77 78 bool isCycle() const; 79 80 protected : 81 bool m_isReferral; 82 int m_requestType; 83 LDAPConstraints *m_cons; 84 LDAPAsynConnection *m_connection; 85 const LDAPRequest* m_parent; 86 int m_hopCount; 87 int m_msgID; //the associated C-API Message ID 88 LDAPRequest(); 89}; 90#endif //LDAP_REQUEST_H 91 92