File: ldapserver.h

package info (click to toggle)
kdepimlibs 4%3A4.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 22,300 kB
  • ctags: 16,353
  • sloc: cpp: 118,725; ansic: 17,101; xml: 2,722; perl: 1,791; yacc: 954; sh: 168; ruby: 60; makefile: 44
file content (116 lines) | stat: -rw-r--r-- 3,215 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
  This file is part of libkldap.
  Copyright (c) 2004-2006 Szombathelyi György <gyurco@freemail.hu>

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General  Public
  License as published by the Free Software Foundation; either
  version 2 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Library General Public License for more details.

  You should have received a copy of the GNU Library General Public License
  along with this library; see the file COPYING.LIB.  If not, write to
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  Boston, MA 02110-1301, USA.
*/

#ifndef KLDAP_LDAPSERVER_H
#define KLDAP_LDAPSERVER_H

#include <QtCore/QString>

#include "ldapurl.h"
#include "ldapdn.h"
#include "kldap_export.h"

namespace KLDAP {

/** This class holds various parameters about an LDAP server,
 * and the LDAP query parameters.
 */
class KLDAP_EXPORT LdapServer
{
  public:
    LdapServer();
    LdapServer( const LdapUrl &url );

    LdapServer( const LdapServer &that );
    LdapServer &operator= ( const LdapServer &that );

    virtual ~LdapServer();

    typedef enum {
      None, TLS, SSL
    } Security;
    typedef enum {
      Anonymous, Simple, SASL
    } Auth;

    /**
     * Clears all server settings.
     */
    void clear();

    QString host() const;
    int port() const;
    LdapDN baseDn() const;
    QString user() const;
    QString bindDn() const;
    QString realm() const;
    QString password() const;
    int version() const;
    Security security() const;
    Auth auth() const;
    QString mech() const;
    int timeout() const;

    LdapUrl::Scope scope() const;
    int timeLimit() const;
    int sizeLimit() const;
    int pageSize() const;
    QString filter() const;

    void setHost( const QString &host );
    void setPort( int port );
    void setBaseDn( const LdapDN &baseDn );
    void setUser( const QString &user );
    void setBindDn( const QString &bindDn );
    void setRealm( const QString &realm );
    void setPassword( const QString &password );
    void setVersion( int version );
    void setSecurity( Security security );
    void setAuth( Auth auth );
    void setMech( const QString &mech );
    void setTimeout( int timeout );

    void setScope( LdapUrl::Scope scope );
    void setTimeLimit( int timelimit );
    void setSizeLimit( int sizelimit );
    void setPageSize( int pagesize );
    void setFilter( const QString &filter );

    /**
     * Returns the server parameters as an RFC2255 compliant LDAP Url.
     * The URL extensions which are supported:
     * Standard: bindname
     * KLDAP extensions: x-tls, x-version, x-sasl, x-mech, x-realm,
     * x-sizelimit, x-timelimit, x-pagesize, x-timeout
     */
    LdapUrl url() const;
    /**
     * Sets the server parameters from an RFC2255 compliant LDAP Url.
     */
    void setUrl( const LdapUrl &url );

  private:
    class LdapServerPrivate;
    LdapServerPrivate *const d;
};

}

#endif