• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KLDAP Library

  • kldap
ldapoperation.h
1/*
2 This file is part of libkldap.
3 Copyright (c) 2004-2006 Szombathelyi György <gyurco@freemail.hu>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KLDAP_LDAPOPERATION_H
22#define KLDAP_LDAPOPERATION_H
23
24#include "kldap_export.h"
25#include "ldapconnection.h"
26#include "ldapcontrol.h"
27#include "ldapobject.h"
28#include "ldapdn.h"
29#include "ldapserver.h"
30#include "ldapurl.h"
31
32#include <QtCore/QByteArray>
33#include <QtCore/QList>
34#include <QtCore/QString>
35
36namespace KLDAP {
37
43class KLDAP_EXPORT LdapOperation
44{
45 public:
46 typedef enum {
47 Mod_None, Mod_Add, Mod_Replace, Mod_Del
48 } ModType;
49
50 typedef enum {
51 RES_BIND = 0x61,
52 RES_SEARCH_ENTRY = 0x64,
53 RES_SEARCH_REFERENCE = 0x73,
54 RES_SEARCH_RESULT = 0x65,
55 RES_MODIFY = 0x67,
56 RES_ADD = 0x69,
57 RES_DELETE = 0x69,
58 RES_MODDN = 0x6d,
59 RES_COMPARE = 0x6f,
60 RES_EXTENDED = 0x78,
61 RES_EXTENDED_PARTIAL = 0x79
62 } ResultType;
63
64 typedef struct {
65 ModType type;
66 QString attr;
67 QList<QByteArray> values;
68 } ModOp ;
69
70 typedef QList<ModOp> ModOps;
71
72 enum SASL_Fields {
73 SASL_Authname = 0x1,
74 SASL_Authzid = 0x2,
75 SASL_Realm = 0x4,
76 SASL_Password = 0x8
77 };
78
79 struct SASL_Credentials {
80 int fields;
81 QString authname;
82 QString authzid;
83 QString realm;
84 QString password;
85 };
86
87 typedef int (SASL_Callback_Proc) ( SASL_Credentials &cred, void *data );
88
89 struct SASL_Data {
90 SASL_Callback_Proc *proc;
91 void *data;
92 SASL_Credentials creds;
93 };
94
95 LdapOperation();
96 LdapOperation( LdapConnection &conn );
97 virtual ~LdapOperation();
98
104 void setConnection( LdapConnection &conn );
108 LdapConnection &connection();
112 void setClientControls( const LdapControls &ctrls );
116 void setServerControls( const LdapControls &ctrls );
120 LdapControls clientControls() const;
124 LdapControls serverControls() const;
125
130 int bind( const QByteArray &creds = QByteArray(),
131 SASL_Callback_Proc *saslproc = NULL, void *data = NULL );
132
138 int bind_s( SASL_Callback_Proc *saslproc = NULL, void *data = NULL );
139
144 int search( const LdapDN &base, LdapUrl::Scope scope,
145 const QString &filter, const QStringList &attrs );
151 int add( const LdapObject &object );
157 int add_s( const LdapObject &object );
164 int add( const LdapDN &dn, const ModOps &ops );
172 int add_s( const LdapDN &dn, const ModOps &ops );
179 int rename( const LdapDN &dn, const QString &newRdn,
180 const QString &newSuperior, bool deleteold = true );
187 int rename_s( const LdapDN &dn, const QString &newRdn,
188 const QString &newSuperior, bool deleteold = true );
193 int del( const LdapDN &dn );
199 int del_s( const LdapDN &dn );
205 int modify( const LdapDN &dn, const ModOps &ops );
211 int modify_s( const LdapDN &dn, const ModOps &ops );
217 int compare( const LdapDN &dn, const QString &attr, const QByteArray &value );
225 int compare_s( const LdapDN &dn, const QString &attr, const QByteArray &value );
230 int exop( const QString &oid, const QByteArray &data );
236 int exop_s( const QString &oid, const QByteArray &data );
240 int abandon( int id );
253 int waitForResult( int id, int msecs = -1 );
257 LdapObject object() const;
262 LdapControls controls() const;
267 QByteArray extendedOid() const;
272 QByteArray extendedData() const;
278 QString matchedDn() const;
283 QList<QByteArray> referrals() const;
288 QByteArray serverCred() const;
289
290 private:
291 class LdapOperationPrivate;
292 LdapOperationPrivate *const d;
293
294 Q_DISABLE_COPY( LdapOperation )
295};
296
297}
298
299#endif
KLDAP::LdapConnection
This class represents a connection to an LDAP server.
Definition ldapconnection.h:37
KLDAP::LdapObject
This class represents an LDAP Object.
Definition ldapobject.h:42
KLDAP::LdapOperation::setClientControls
void setClientControls(const LdapControls &ctrls)
Sets the client controls which will sent with each operation.
Definition ldapoperation.cpp:114
KLDAP::LdapOperation::extendedOid
QByteArray extendedOid() const
Returns the OID of the extended operation response (result returned RES_EXTENDED).
Definition ldapoperation.cpp:144
KLDAP::LdapOperation::matchedDn
QString matchedDn() const
The server might supply a matched DN string in the message indicating how much of a name in a request...
Definition ldapoperation.cpp:154
KLDAP::LdapOperation::bind_s
int bind_s(SASL_Callback_Proc *saslproc=NULL, void *data=NULL)
Binds to the server which specified in the connection object.
Definition ldapoperation.cpp:1210
KLDAP::LdapOperation::referrals
QList< QByteArray > referrals() const
This function returns the referral strings from the parsed message (if any).
Definition ldapoperation.cpp:159
KLDAP::LdapOperation::abandon
int abandon(int id)
Abandons a long-running operation.
Definition ldapoperation.cpp:1315
KLDAP::LdapOperation::clientControls
LdapControls clientControls() const
Returns the client controls (which set by setClientControls()).
Definition ldapoperation.cpp:124
KLDAP::LdapOperation::serverCred
QByteArray serverCred() const
Returns the server response for a bind request (result returned RES_BIND).
Definition ldapoperation.cpp:164
KLDAP::LdapOperation::extendedData
QByteArray extendedData() const
Returns the data from the extended operation response (result returned RES_EXTENDED).
Definition ldapoperation.cpp:149
KLDAP::LdapOperation::bind
int bind(const QByteArray &creds=QByteArray(), SASL_Callback_Proc *saslproc=NULL, void *data=NULL)
Binds to the server which specified in the connection object.
Definition ldapoperation.cpp:1204
KLDAP::LdapOperation::modify
int modify(const LdapDN &dn, const ModOps &ops)
Starts a modify operation on the given DN.
Definition ldapoperation.cpp:1273
KLDAP::LdapOperation::exop
int exop(const QString &oid, const QByteArray &data)
Starts an extended operation specified with oid and data.
Definition ldapoperation.cpp:1291
KLDAP::LdapOperation::rename
int rename(const LdapDN &dn, const QString &newRdn, const QString &newSuperior, bool deleteold=true)
Starts a modrdn operation on given DN, changing its RDN to newRdn, changing its parent to newSuperior...
Definition ldapoperation.cpp:1247
KLDAP::LdapOperation::rename_s
int rename_s(const LdapDN &dn, const QString &newRdn, const QString &newSuperior, bool deleteold=true)
Performs a modrdn operation on given DN, changing its RDN to newRdn, changing its parent to newSuperi...
Definition ldapoperation.cpp:1254
KLDAP::LdapOperation::setConnection
void setConnection(LdapConnection &conn)
Sets the connection object.
Definition ldapoperation.cpp:104
KLDAP::LdapOperation::setServerControls
void setServerControls(const LdapControls &ctrls)
Sets the server controls which will sent with each operation.
Definition ldapoperation.cpp:119
KLDAP::LdapOperation::add
int add(const LdapObject &object)
Starts an addition operation.
Definition ldapoperation.cpp:1223
KLDAP::LdapOperation::compare
int compare(const LdapDN &dn, const QString &attr, const QByteArray &value)
Starts a compare operation on the given DN, compares the specified attribute with the given value.
Definition ldapoperation.cpp:1285
KLDAP::LdapOperation::object
LdapObject object() const
Returns the result object if result() returned RES_SEARCH_ENTRY.
Definition ldapoperation.cpp:134
KLDAP::LdapOperation::compare_s
int compare_s(const LdapDN &dn, const QString &attr, const QByteArray &value)
Performs a compare operation on the given DN, compares the specified attribute with the given value.
Definition ldapoperation.cpp:1297
KLDAP::LdapOperation::del_s
int del_s(const LdapDN &dn)
Deletes the given DN.
Definition ldapoperation.cpp:1267
KLDAP::LdapOperation::connection
LdapConnection & connection()
Returns the connection object.
Definition ldapoperation.cpp:109
KLDAP::LdapOperation::modify_s
int modify_s(const LdapDN &dn, const ModOps &ops)
Performs a modify operation on the given DN.
Definition ldapoperation.cpp:1279
KLDAP::LdapOperation::del
int del(const LdapDN &dn)
Starts a delete operation on the given DN.
Definition ldapoperation.cpp:1261
KLDAP::LdapOperation::controls
LdapControls controls() const
Returns the server controls from the returned ldap message (grabbed by result()).
Definition ldapoperation.cpp:139
KLDAP::LdapOperation::serverControls
LdapControls serverControls() const
Returns the server controls (which set by setServerControls()).
Definition ldapoperation.cpp:129
KLDAP::LdapOperation::exop_s
int exop_s(const QString &oid, const QByteArray &data)
Performs an extended operation specified with oid and data.
Definition ldapoperation.cpp:1303
KLDAP::LdapOperation::waitForResult
int waitForResult(int id, int msecs=-1)
Waits for up to msecs milliseconds for a result message from the LDAP server.
Definition ldapoperation.cpp:1309
KLDAP::LdapOperation::add_s
int add_s(const LdapObject &object)
Adds the specified object to the LDAP database.
Definition ldapoperation.cpp:1229
KLDAP::LdapOperation::search
int search(const LdapDN &base, LdapUrl::Scope scope, const QString &filter, const QStringList &attrs)
Starts a search operation with the given base DN, scope, filter and result attributes.
Definition ldapoperation.cpp:1216
KLDAP::LdapUrl::Scope
Scope
Describes the scope of the LDAP url.
Definition ldapurl.h:58
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 17 2025 00:00:00 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KLDAP Library

Skip menu "KLDAP Library"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal