| 1 | /* |
| 2 | * qca_plugin.h - Qt Cryptographic Architecture |
| 3 | * Copyright (C) 2003-2007 Justin Karneges <justin@affinix.com> |
| 4 | * Copyright (C) 2004,2005 Brad Hards <bradh@frogmouth.net> |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 19 | * 02110-1301 USA |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | #ifndef QCA_PLUGIN_H |
| 24 | #define QCA_PLUGIN_H |
| 25 | |
| 26 | // NOTE: this API is private to QCA |
| 27 | |
| 28 | #include "qca_core.h" |
| 29 | #include <QMutex> |
| 30 | |
| 31 | namespace QCA { |
| 32 | |
| 33 | class ProviderItem; |
| 34 | |
| 35 | class ProviderManager |
| 36 | { |
| 37 | public: |
| 38 | ProviderManager(); |
| 39 | ~ProviderManager(); |
| 40 | |
| 41 | void scan(); |
| 42 | bool add(Provider *p, int priority); |
| 43 | bool unload(const QString &name); |
| 44 | void unloadAll(); |
| 45 | void setDefault(Provider *p); |
| 46 | Provider *find(Provider *p) const; |
| 47 | Provider *find(const QString &name) const; |
| 48 | Provider *findFor(const QString &name, const QString &type) const; |
| 49 | void changePriority(const QString &name, int priority); |
| 50 | int getPriority(const QString &name); |
| 51 | QStringList allFeatures() const; |
| 52 | ProviderList providers() const; |
| 53 | |
| 54 | static void mergeFeatures(QStringList *a, const QStringList &b); |
| 55 | |
| 56 | QString diagnosticText() const; |
| 57 | void appendDiagnosticText(const QString &str); |
| 58 | void clearDiagnosticText(); |
| 59 | |
| 60 | private: |
| 61 | mutable QMutex logMutex, providerMutex; |
| 62 | QString dtext; |
| 63 | QList<ProviderItem *> providerItemList; |
| 64 | ProviderList providerList; |
| 65 | Provider *def; |
| 66 | bool scanned_static; |
| 67 | void addItem(ProviderItem *i, int priority); |
| 68 | bool haveAlready(const QString &name) const; |
| 69 | int get_default_priority(const QString &name) const; |
| 70 | }; |
| 71 | |
| 72 | } |
| 73 | |
| 74 | #endif |
| 75 | |