File indexing completed on 2024-04-14 04:37:16

0001 /*
0002  * SPDX-FileCopyrightText: 2010 Kare Sars <kare dot sars at iki dot fi>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 #ifndef KSANE_AUTHENTICATION_H
0008 #define KSANE_AUTHENTICATION_H
0009 
0010 // Qt includes
0011 #include <QString>
0012 
0013 // Sane includes
0014 extern "C"
0015 {
0016 #include <sane/saneopts.h>
0017 #include <sane/sane.h>
0018 }
0019 
0020 namespace KSaneCore
0021 {
0022 
0023 /**
0024  * Sane authentication helpers.
0025  */
0026 class Authentication
0027 {
0028 public:
0029     static Authentication *getInstance();
0030     ~Authentication();
0031 
0032     void setDeviceAuth(const QString &resource, const QString &username, const QString &password);
0033     void clearDeviceAuth(const QString &resource);
0034     static void authorization(SANE_String_Const resource, SANE_Char *username, SANE_Char *password);
0035 
0036 private:
0037     Authentication();
0038     struct Private;
0039     Private *const d;
0040 };
0041 
0042 } // namespace KSaneCore
0043 
0044 #endif // KSANE_AUTHENTICATION_H