File indexing completed on 2024-12-01 04:22:00

0001 /*
0002  * qca_plugin.h - Qt Cryptographic Architecture
0003  * Copyright (C) 2003-2007  Justin Karneges <justin@affinix.com>
0004  * Copyright (C) 2004,2005  Brad Hards <bradh@frogmouth.net>
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Lesser General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2.1 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Lesser General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Lesser General Public
0017  * License along with this library; if not, write to the Free Software
0018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0019  * 02110-1301  USA
0020  *
0021  */
0022 
0023 #ifndef QCA_PLUGIN_H
0024 #define QCA_PLUGIN_H
0025 
0026 // NOTE: this API is private to QCA
0027 
0028 #include "qca_core.h"
0029 #include <QMutex>
0030 
0031 namespace QCA {
0032 
0033 class ProviderItem;
0034 
0035 class ProviderManager
0036 {
0037 public:
0038     ProviderManager();
0039     ~ProviderManager();
0040 
0041     void         scan();
0042     bool         add(Provider *p, int priority);
0043     bool         unload(const QString &name);
0044     void         unloadAll();
0045     void         setDefault(Provider *p);
0046     Provider    *find(Provider *p) const;
0047     Provider    *find(const QString &name) const;
0048     Provider    *findFor(const QString &name, const QString &type) const;
0049     void         changePriority(const QString &name, int priority);
0050     int          getPriority(const QString &name);
0051     QStringList  allFeatures() const;
0052     ProviderList providers() const;
0053 
0054     static void mergeFeatures(QStringList *a, const QStringList &b);
0055 
0056     QString diagnosticText() const;
0057     void    appendDiagnosticText(const QString &str);
0058     void    clearDiagnosticText();
0059 
0060 private:
0061     mutable QMutex        logMutex, providerMutex;
0062     QString               dtext;
0063     QList<ProviderItem *> providerItemList;
0064     ProviderList          providerList;
0065     Provider             *def;
0066     bool                  scanned_static;
0067     void                  addItem(ProviderItem *i, int priority);
0068     bool                  haveAlready(const QString &name) const;
0069     int                   get_default_priority(const QString &name) const;
0070 };
0071 
0072 }
0073 
0074 #endif