ldapsdk  0.0.1
LDAPConnection.h
Go to the documentation of this file.
1 // $OpenLDAP$
2 /*
3  * Copyright 2000-2011 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6 
7 #ifndef LDAP_CONNECTION_H
8 #define LDAP_CONNECTION_H
9 
10 #include <LDAPSearchResults.h>
11 #include <LDAPExtResult.h>
12 #include <LDAPAsynConnection.h>
13 
22 
23  public :
28  static const int SEARCH_BASE;
29 
34  static const int SEARCH_ONE;
35 
40  static const int SEARCH_SUB;
41 
51  LDAPConnection(const std::string& hostname="localhost", int port=389,
52  LDAPConstraints* cons=new LDAPConstraints());
53 
58 
70  void init(const std::string& hostname, int port);
71 
79  void start_tls();
80 
90  void bind(const std::string& dn="", const std::string& passwd="",
91  LDAPConstraints* cons=0);
92  void saslInteractiveBind(const std::string& mech,
93  int flags=0,
95  const LDAPConstraints *cons=0);
96 
102  void unbind();
103 
121  bool compare(const std::string& dn, const LDAPAttribute& attr,
122  LDAPConstraints* cons=0);
123 
135  void del(const std::string& dn, const LDAPConstraints* cons=0);
136 
147  void add(const LDAPEntry* le, const LDAPConstraints* cons=0);
148 
160  void modify(const std::string& dn, const LDAPModList* mods,
161  const LDAPConstraints* cons=0);
162 
183  void rename(const std::string& dn, const std::string& newRDN,
184  bool delOldRDN=false, const std::string& newParentDN="",
185  const LDAPConstraints* cons=0);
186 
208  LDAPSearchResults* search(const std::string& base, int scope=0,
209  const std::string& filter="objectClass=*",
210  const StringList& attrs=StringList(), bool attrsOnly=false,
211  const LDAPConstraints* cons=0);
212 
228  LDAPExtResult* extOperation(const std::string& oid, const std::string&
229  value="", const LDAPConstraints *const = 0);
230 
231  const std::string& getHost() const;
232 
233  int getPort() const;
234 
235  void setConstraints(LDAPConstraints *cons);
236 
237  const LDAPConstraints* getConstraints() const ;
238  TlsOptions getTlsOptions() const;
239 };
240 
241 #endif //LDAP_CONNECTION_H