00001
00002
00003
00004
00005
00006 #ifndef LDAP_CONNECTION_H
00007 #define LDAP_CONNECTION_H
00008
00009 #include <LDAPSearchResults.h>
00010 #include <LDAPExtResult.h>
00011 #include <LDAPAsynConnection.h>
00012
00020 class LDAPConnection : private LDAPAsynConnection {
00021
00022 public :
00027 static const int SEARCH_BASE;
00028
00033 static const int SEARCH_ONE;
00034
00039 static const int SEARCH_SUB;
00040
00050 LDAPConnection(const std::string& hostname="localhost", int port=389,
00051 LDAPConstraints* cons=new LDAPConstraints());
00052
00056 ~LDAPConnection();
00057
00069 void init(const std::string& hostname, int port);
00070
00077 int start_tls();
00078
00088 void bind(const std::string& dn="", const std::string& passwd="",
00089 LDAPConstraints* cons=0);
00090
00096 void unbind();
00097
00115 bool compare(const std::string& dn, const LDAPAttribute& attr,
00116 LDAPConstraints* cons=0);
00117
00129 void del(const std::string& dn, const LDAPConstraints* cons=0);
00130
00141 void add(const LDAPEntry* le, const LDAPConstraints* cons=0);
00142
00154 void modify(const std::string& dn, const LDAPModList* mods,
00155 const LDAPConstraints* cons=0);
00156
00177 void rename(const std::string& dn, const std::string& newRDN,
00178 bool delOldRDN=false, const std::string& newParentDN="",
00179 const LDAPConstraints* cons=0);
00180
00202 LDAPSearchResults* search(const std::string& base, int scope=0,
00203 const std::string& filter="objectClass=*",
00204 const StringList& attrs=StringList(), bool attrsOnly=false,
00205 const LDAPConstraints* cons=0);
00206
00222 LDAPExtResult* extOperation(const std::string& oid, const std::string&
00223 value="", const LDAPConstraints *const = 0);
00224
00225 const std::string& getHost() const;
00226
00227 int getPort() const;
00228
00229 void setConstraints(LDAPConstraints *cons);
00230
00231 const LDAPConstraints* getConstraints() const ;
00232 };
00233
00234 #endif //LDAP_CONNECTION_H