File indexing completed on 2024-06-09 05:17:18

0001 /*
0002     kleo/keyserverconfig.h
0003 
0004     This file is part of libkleopatra, the KDE keymanagement library
0005     SPDX-FileCopyrightText: 2021 g10 Code GmbH
0006     SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #pragma once
0012 
0013 #include "kleo_export.h"
0014 
0015 #include <QStringList>
0016 
0017 #include <memory>
0018 
0019 class QString;
0020 class QUrl;
0021 
0022 namespace Kleo
0023 {
0024 
0025 enum class KeyserverAuthentication {
0026     Anonymous,
0027     ActiveDirectory,
0028     Password,
0029 };
0030 
0031 enum class KeyserverConnection {
0032     Default,
0033     Plain,
0034     UseSTARTTLS,
0035     TunnelThroughTLS,
0036 };
0037 
0038 class KLEO_EXPORT KeyserverConfig
0039 {
0040 public:
0041     KeyserverConfig();
0042     ~KeyserverConfig();
0043 
0044     KeyserverConfig(const KeyserverConfig &other);
0045     KeyserverConfig &operator=(const KeyserverConfig &other);
0046 
0047     KeyserverConfig(KeyserverConfig &&other);
0048     KeyserverConfig &operator=(KeyserverConfig &&other);
0049 
0050     static KeyserverConfig fromUrl(const QUrl &url);
0051     QUrl toUrl() const;
0052 
0053     QString host() const;
0054     void setHost(const QString &host);
0055 
0056     int port() const;
0057     void setPort(int port);
0058 
0059     KeyserverAuthentication authentication() const;
0060     void setAuthentication(KeyserverAuthentication authentication);
0061 
0062     QString user() const;
0063     void setUser(const QString &user);
0064 
0065     QString password() const;
0066     void setPassword(const QString &password);
0067 
0068     KeyserverConnection connection() const;
0069     void setConnection(KeyserverConnection connection);
0070 
0071     QString ldapBaseDn() const;
0072     void setLdapBaseDn(const QString &baseDn);
0073 
0074     QStringList additionalFlags() const;
0075     void setAdditionalFlags(const QStringList &flags);
0076 
0077 private:
0078     class Private;
0079     std::unique_ptr<Private> d;
0080 };
0081 
0082 }