KLDAPCore::LdapConnection Class

This class represents a connection to an LDAP server. More...

Header: #include <KLDAPCore/LdapConnection>
CMake: find_package(KPim6LdapCore REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::LdapCore)

Public Functions

LdapConnection()
LdapConnection(const KLDAPCore::LdapServer &server)
LdapConnection(const KLDAPCore::LdapUrl &url)
void close()
int connect()
QString connectionError() const
int getOption(int option, void *value) const
void *handle() const
int ldapErrorCode() const
QString ldapErrorString() const
QString saslErrorString() const
void *saslHandle() const
const KLDAPCore::LdapServer &server() const
int setOption(int option, void *value)
void setServer(const KLDAPCore::LdapServer &server)
bool setSizeLimit(int sizelimit)
bool setTimeLimit(int timelimit)
void setUrl(const KLDAPCore::LdapUrl &url)
int sizeLimit() const
int timeLimit() const

Static Public Members

QString errorString(int code)

Detailed Description

Member Function Documentation

LdapConnection::LdapConnection()

Constructs an LdapConnection object

[explicit] LdapConnection::LdapConnection(const KLDAPCore::LdapServer &server)

Constructs an LdapConnection with the parameters given in server

[explicit] LdapConnection::LdapConnection(const KLDAPCore::LdapUrl &url)

Constructs an LdapConnection with the parameters given in url

void LdapConnection::close()

Closes the LDAP connection.

int LdapConnection::connect()

Sets up the connection parameters with creating a handle to the LDAP server. Also sets sizelimit and timelimit and starts TLS if it is requested. Returns 0 if successful, else returns an LDAP error code, and an error string which is available via connectionError().

QString LdapConnection::connectionError() const

Returns a translated error string if connect() failed.

[static] QString LdapConnection::errorString(int code)

Returns a translated error message from the specified LDAP error code

int LdapConnection::getOption(int option, void *value) const

Gets an option from the connection. The option value can be client library specific, so avoid this function if possible option the connection option to return value the value of option to get

void *LdapConnection::handle() const

Returns the opaqe client-library specific LDAP object. Avoid its usage if you can.

int LdapConnection::ldapErrorCode() const

Returns the LDAP error code from the last operation

QString LdapConnection::ldapErrorString() const

Returns the LDAP error string from the last operation

QString LdapConnection::saslErrorString() const

Returns the SASL error string from the last SASL operation

void *LdapConnection::saslHandle() const

Returns the opaqe sasl-library specific SASL object. Avoid its usage if you can.

const KLDAPCore::LdapServer &LdapConnection::server() const

Returns the connection parameters which was specified with an LDAP Url or a LdapServer structure.

See also setServer().

int LdapConnection::setOption(int option, void *value)

Sets an option in the connection. The option value can be client library specific, so avoid this function if possible

void LdapConnection::setServer(const KLDAPCore::LdapServer &server)

Sets the connection parameters via the specified server structure. After this, you need to call connect() to connect with the new parameters. server the server object containing the connection parameters

See also server().

bool LdapConnection::setSizeLimit(int sizelimit)

Sets the size limit for the connection. sizelimit the connection size limit to set

See also sizeLimit().

bool LdapConnection::setTimeLimit(int timelimit)

Sets the time limit for the connection. timelimit the connection time limit to set

See also timeLimit().

void LdapConnection::setUrl(const KLDAPCore::LdapUrl &url)

Sets the connection parameters via the specified url. After this, you need to call connect() to connect with the new parameters. url the URL containing the connection parameters

int LdapConnection::sizeLimit() const

Returns the current size limit.

See also setSizeLimit().

int LdapConnection::timeLimit() const

Returns the current time limit.

See also setTimeLimit().