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