Warning, file /plasma/plasma-nm/vpn/openconnect/openconnectauthworkerthread.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2011 Ilia Kats <ilia-kats@gmx.net> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef OPENCONNECTAUTHWORKERTHREAD_H 0008 #define OPENCONNECTAUTHWORKERTHREAD_H 0009 0010 extern "C" { 0011 #include <openconnect.h> 0012 } 0013 0014 #if OPENCONNECT_CHECK_VER(3, 0) 0015 #define NEWGROUP_SUPPORTED 1 0016 #define AUTHGROUP_OPT(form) (void *)(form)->authgroup_opt 0017 #define AUTHGROUP_SELECTION(form) (form)->authgroup_selection 0018 #define FORMCHOICE(sopt, i) ((sopt)->choices[i]) 0019 #define IGNORE_OPT(opt) ((opt)->flags & OC_FORM_OPT_IGNORE) 0020 #else 0021 #define NEWGROUP_SUPPORTED 0 0022 #define AUTHGROUP_OPT(form) nullptr 0023 #define AUTHGROUP_SELECTION(form) 0 0024 #define FORMCHOICE(sopt, i) (&(sopt)->choices[i]) 0025 #define IGNORE_OPT(opt) 0 0026 0027 #define OC_FORM_RESULT_ERR -1 0028 #define OC_FORM_RESULT_OK 0 0029 #define OC_FORM_RESULT_CANCELLED 1 0030 #define OC_FORM_RESULT_NEWGROUP 2 0031 #endif 0032 0033 #if OPENCONNECT_CHECK_VER(4, 0) 0034 #define OC3DUP(x) (x) 0035 #else 0036 #define openconnect_set_option_value(opt, val) \ 0037 do { \ 0038 struct oc_form_opt *_o = (opt); \ 0039 free(_o->value); \ 0040 _o->value = strdup(val); \ 0041 } while (0) 0042 #define openconnect_free_cert_info(v, x) ::free(x) 0043 #define OC3DUP(x) strdup(x) 0044 #endif 0045 0046 #include <QThread> 0047 0048 class QMutex; 0049 class QWaitCondition; 0050 struct openconnect_info; 0051 0052 class OpenconnectAuthWorkerThread : public QThread 0053 { 0054 Q_OBJECT 0055 friend class OpenconnectAuthStaticWrapper; 0056 0057 public: 0058 OpenconnectAuthWorkerThread(QMutex *, QWaitCondition *, bool *, bool *, int); 0059 ~OpenconnectAuthWorkerThread() override; 0060 struct openconnect_info *getOpenconnectInfo(); 0061 0062 Q_SIGNALS: 0063 void validatePeerCert(const QString &, const QString &, const QString &, bool *); 0064 void processAuthForm(struct oc_auth_form *); 0065 void updateLog(const QString &, const int &); 0066 void writeNewConfig(const QString &); 0067 void cookieObtained(const int &); 0068 void initTokens(); 0069 0070 protected: 0071 void run() override; 0072 0073 private: 0074 int writeNewConfig(const char *, int); 0075 int validatePeerCert(void *, const char *); 0076 int processAuthFormP(struct oc_auth_form *); 0077 void writeProgress(int level, const char *, va_list); 0078 #if OPENCONNECT_CHECK_VER(5, 8) 0079 int openUri(struct openconnect_info *, const char *, void *); 0080 #endif 0081 0082 QMutex *m_mutex; 0083 QWaitCondition *m_waitForUserInput; 0084 bool *m_userDecidedToQuit; 0085 bool *m_formGroupChanged; 0086 struct openconnect_info *m_openconnectInfo; 0087 }; 0088 0089 #endif