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