LDAPConstraints.h 2.89 KB
Newer Older
Ralf Haferkamp's avatar
Ralf Haferkamp committed
1
// $OpenLDAP$
2
/*
Quanah Gibson-Mount's avatar
Quanah Gibson-Mount committed
3
 * Copyright 2000-2021 The OpenLDAP Foundation, All Rights Reserved.
4
5
6
7
8
9
10
11
 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
 */


#ifndef LDAP_CONSTRAINTS_H
#define LDAP_CONSTRAINTS_H 
#include <list>

12
13
14
#include <LDAPControl.h>
#include <LDAPControlSet.h>
#include <LDAPRebind.h>
15
16
17
18
19
20

//TODO!!
// * implement the Alias-Handling Option (OPT_DEREF)
// * the Restart-Option ???
// * default Server(s)

21
//* Class for representing the various protocol options
22
/** This class represents some options that can be set for a LDAPConnection
23
24
25
26
27
 *  operation. Namely these are time and size limits. Options for referral
 *  chasing and a default set of client of server controls to be used with
 *  every request
 */
class LDAPConstraints{
28
        
Ralf Haferkamp's avatar
Ralf Haferkamp committed
29
    public :
30
31
32
33
        static const int DEREF_NEVER = 0x00;   
        static const int DEREF_SEARCHING = 0x01;   
        static const int DEREF_FINDING = 0x02;   
        static const int DEREF_ALWAYS = 0x04;   
34
        
Ralf Haferkamp's avatar
Ralf Haferkamp committed
35
36
        //* Constructs a LDAPConstraints object with default values
        LDAPConstraints();
37

Ralf Haferkamp's avatar
Ralf Haferkamp committed
38
39
        //* Copy constructor
        LDAPConstraints(const LDAPConstraints& c);
40
41

        ~LDAPConstraints();
Ralf Haferkamp's avatar
Ralf Haferkamp committed
42
43
            
        void setAliasDeref(int deref);
44
        void setMaxTime(int t);
Ralf Haferkamp's avatar
Ralf Haferkamp committed
45
46
        void setSizeLimit(int s);
        void setReferralChase(bool rc);
47
48
49
50
51
        void setHopLimit(int hop);
        void setReferralRebind(const LDAPRebind* rebind);
        void setServerControls(const LDAPControlSet* ctrls);
        void setClientControls(const LDAPControlSet* ctrls);
        
Ralf Haferkamp's avatar
Ralf Haferkamp committed
52
        int getAliasDeref() const;
53
        int getMaxTime() const ;
Ralf Haferkamp's avatar
Ralf Haferkamp committed
54
        int getSizeLimit() const;
55
56
57
58
59
        const LDAPRebind* getReferralRebind() const;
        const LDAPControlSet* getServerControls() const;
        const LDAPControlSet* getClientControls() const;
        
        //*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;
Ralf Haferkamp's avatar
Ralf Haferkamp committed
67
        bool getReferralChase() const ;
68
        int getHopLimit() const;
Ralf Haferkamp's avatar
Ralf Haferkamp committed
69
70

    private :
71
72
73
        int m_aliasDeref;

        //* max. time the server may spend for a search request
Ralf Haferkamp's avatar
Ralf Haferkamp committed
74
75
76
77
        int m_maxTime;

        //* max number of entries to return from a search request
        int m_maxSize;
78

Ralf Haferkamp's avatar
Ralf Haferkamp committed
79
80
        //* Flag for enabling automatic referral/reference chasing
        bool m_referralChase;
81
82
83
84
85
86
87
88
89
90

        //* HopLimit for referral chasing
        int m_HopLimit;

        //* Alias dereferencing option
        int m_deref;
	
        //* Object used to do bind for Referral chasing
        const LDAPRebind* m_refRebind;

Ralf Haferkamp's avatar
Ralf Haferkamp committed
91
92
        //* List of Client Controls that should be used for each request	
        LDAPControlSet* m_clientControls;
93

Ralf Haferkamp's avatar
Ralf Haferkamp committed
94
95
        //* List of Server Controls that should be used for each request	
        LDAPControlSet* m_serverControls;
96

97
98
};
#endif //LDAP_CONSTRAINTS_H