summaryrefslogtreecommitdiffstats
path: root/contrib/ldapc++/src/LDAPConstraints.h
blob: 550a26d2c19892e01e3995ba13fb78fc4d3ed994 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// $OpenLDAP$
/*
 * Copyright 2000-2021 The OpenLDAP Foundation, All Rights Reserved.
 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
 */


#ifndef LDAP_CONSTRAINTS_H
#define LDAP_CONSTRAINTS_H 
#include <list>

#include <LDAPControl.h>
#include <LDAPControlSet.h>
#include <LDAPRebind.h>

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

//* Class for representating the various protocol options
/** This class represents some options that can be set for a LDAPConnection
 *  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{
        
    public :
        static const int DEREF_NEVER = 0x00;   
        static const int DEREF_SEARCHING = 0x01;   
        static const int DEREF_FINDING = 0x02;   
        static const int DEREF_ALWAYS = 0x04;   
        
        //* Constructs a LDAPConstraints object with default values
        LDAPConstraints();

        //* Copy constructor
        LDAPConstraints(const LDAPConstraints& c);

        ~LDAPConstraints();
            
        void setAliasDeref(int deref);
        void setMaxTime(int t);
        void setSizeLimit(int s);
        void setReferralChase(bool rc);
        void setHopLimit(int hop);
        void setReferralRebind(const LDAPRebind* rebind);
        void setServerControls(const LDAPControlSet* ctrls);
        void setClientControls(const LDAPControlSet* ctrls);
        
        int getAliasDeref() const;
        int getMaxTime() const ;
        int getSizeLimit() const;
        const LDAPRebind* getReferralRebind() const;
        const LDAPControlSet* getServerControls() const;
        const LDAPControlSet* getClientControls() const;
        
        //*for internal use only
        LDAPControl** getSrvCtrlsArray() const;
        
        //*for internal use only
        LDAPControl** getClCtrlsArray() const;
        
        //*for internal use only
        timeval* getTimeoutStruct() const;
        bool getReferralChase() const ;
        int getHopLimit() const;

    private :
        int m_aliasDeref;

        //* max. time the server may spend for a search request
        int m_maxTime;

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

        //* Flag for enabling automatic referral/reference chasing
        bool m_referralChase;

        //* 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;

        //* List of Client Controls that should be used for each request	
        LDAPControlSet* m_clientControls;

        //* List of Server Controls that should be used for each request	
        LDAPControlSet* m_serverControls;

};
#endif //LDAP_CONSTRAINTS_H