]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPConstraints.h
dfc90ec83497cf20aea4ad16e62949518f2eec10
[openldap] / contrib / ldapc++ / src / LDAPConstraints.h
1 // $OpenLDAP$
2 /*
3  * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6
7
8 #ifndef LDAP_CONSTRAINTS_H
9 #define LDAP_CONSTRAINTS_H 
10 #include <list>
11
12 #include <LDAPControl.h>
13 #include <LDAPControlSet.h>
14 #include <LDAPRebind.h>
15
16 //TODO!!
17 // * implement the Alias-Handling Option (OPT_DEREF)
18 // * the Restart-Option ???
19 // * default Server(s)
20
21 //* Class for representating the various protocol options
22 /** This class represents some options that can be set for a LDAPConnection
23  *  operation. Namely these are time and size limits. Options for referral
24  *  chasing and a default set of client of server controls to be used with
25  *  every request
26  */
27 class LDAPConstraints{
28         
29     public :
30         static const int DEREF_NEVER = 0x00;   
31         static const int DEREF_SEARCHING = 0x01;   
32         static const int DEREF_FINDING = 0x02;   
33         static const int DEREF_ALWAYS = 0x04;   
34         
35         //* Constructs a LDAPConstraints object with default values
36         LDAPConstraints();
37
38         //* Copy constructor
39         LDAPConstraints(const LDAPConstraints& c);
40
41         ~LDAPConstraints();
42             
43         void setAliasDeref(int deref);
44         void setMaxTime(int t);
45         void setSizeLimit(int s);
46         void setReferralChase(bool rc);
47         void setHopLimit(int hop);
48         void setReferralRebind(const LDAPRebind* rebind);
49         void setServerControls(const LDAPControlSet* ctrls);
50         void setClientControls(const LDAPControlSet* ctrls);
51         
52         int getAliasDeref() const;
53         int getMaxTime() const ;
54         int getSizeLimit() const;
55         const LDAPRebind* getReferralRebind() const;
56         const LDAPControlSet* getServerControls() const;
57         const LDAPControlSet* getClientControls() const;
58         
59         //*for internal use only
60         LDAPControl** getSrvCtrlsArray() const;
61         
62         //*for internal use only
63         LDAPControl** getClCtrlsArray() const;
64         
65         //*for internal use only
66         timeval* getTimeoutStruct() const;
67         bool getReferralChase() const ;
68         int getHopLimit() const;
69
70     private :
71         int m_aliasDeref;
72
73         //* max. time the server may spend for a search request
74         int m_maxTime;
75
76         //* max number of entries to return from a search request
77         int m_maxSize;
78
79         //* Flag for enabling automatic referral/reference chasing
80         bool m_referralChase;
81
82         //* HopLimit for referral chasing
83         int m_HopLimit;
84
85         //* Alias dereferencing option
86         int m_deref;
87         
88         //* Object used to do bind for Referral chasing
89         const LDAPRebind* m_refRebind;
90
91         //* List of Client Controls that should be used for each request        
92         LDAPControlSet* m_clientControls;
93
94         //* List of Server Controls that should be used for each request        
95         LDAPControlSet* m_serverControls;
96
97 };
98 #endif //LDAP_CONSTRAINTS_H