KLDAP Library
ldapconnection.h
00001 /* 00002 This file is part of libkldap. 00003 Copyright (c) 2004-2006 Szombathelyi György <gyurco@freemail.hu> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KLDAP_LDAPCONNECTION_H 00022 #define KLDAP_LDAPCONNECTION_H 00023 00024 #include <QtCore/QString> 00025 00026 #include "ldapurl.h" 00027 #include "ldapserver.h" 00028 #include "kldap_export.h" 00029 00030 namespace KLDAP { 00031 00036 class KLDAP_EXPORT LdapConnection 00037 { 00038 public: 00039 00040 enum SASL_Fields { 00041 SASL_Authname = 0x1, 00042 SASL_Authzid = 0x2, 00043 SASL_Realm = 0x4, 00044 SASL_Password = 0x8 00045 }; 00046 00048 LdapConnection(); 00050 explicit LdapConnection( const LdapUrl &url ); 00052 explicit LdapConnection( const LdapServer &server ); 00053 00054 virtual ~LdapConnection(); 00055 00060 void setUrl( const LdapUrl &url ); 00065 const LdapServer &server() const; 00070 void setServer( const LdapServer &server ); 00071 00078 int connect(); 00082 QString connectionError() const; 00086 void close(); 00087 00089 bool setSizeLimit( int sizelimit ); 00091 int sizeLimit() const; 00092 00094 bool setTimeLimit( int timelimit ); 00096 int timeLimit() const; 00097 00100 int getOption( int option, void *value ) const; 00103 int setOption( int option, void *value ); 00104 00106 int ldapErrorCode() const; 00108 QString ldapErrorString() const; 00110 static QString errorString( int code ); 00111 00113 QString saslErrorString() const; 00114 00119 void *handle() const; 00120 00125 void *saslHandle() const; 00126 00127 private: 00128 class LdapConnectionPrivate; 00129 LdapConnectionPrivate *const d; 00130 00131 Q_DISABLE_COPY( LdapConnection ) 00132 }; 00133 00134 } 00135 00136 #endif