signon 8.54

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

remotepluginprocess.h
Go to the documentation of this file.
1 /*
2 * This file is part of signon
3 *
4 * Copyright (C) 2009-2010 Nokia Corporation.
5 *
6 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * version 2.1 as published by the Free Software Foundation.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23 #ifndef REMOTEPLUGINPROCESS_H
24 #define REMOTEPLUGINPROCESS_H
25
26 #include <QCoreApplication>
27 #include <QString>
28 #include <QStringList>
29 #include <QDataStream>
30 #include <QByteArray>
31 #include <QVariant>
32 #include <QMap>
33 #include <QIODevice>
34 #include <QFile>
35 #include <QDir>
36 #include <QLibrary>
37 #include <QSocketNotifier>
38 #include <QThread>
39
40 #include "SignOn/uisessiondata.h"
41 #include "SignOn/authpluginif.h"
42
43 extern "C" {
44 #include <sys/types.h>
45 #include <sys/socket.h>
46 #include <signal.h>
47 }
48
49 #ifndef SIGNOND_PLUGINS_DIR
50 #define SIGNOND_PLUGINS_DIR "/usr/lib/signon"
51 #endif
52
53 #ifndef SIGNON_PLUGIN_PREFIX
54 #define SIGNON_PLUGIN_PREFIX "lib"
55 #endif
56
57 #ifndef SIGNON_PLUGIN_SUFFIX
58 #define SIGNON_PLUGIN_SUFFIX "plugin.so"
59 #endif
60
61 using namespace SignOn;
62
63 namespace SignOn {
64 class BlobIOHandler;
65 };
66
67 namespace RemotePluginProcessNS {
68
73 class CancelEventThread: public QThread
74 {
75 Q_OBJECT
76
77 public:
78 CancelEventThread(AuthPluginInterface *plugin);
79 ~CancelEventThread();
80
81 void run();
82
83 public Q_SLOTS:
84 void cancel();
85
86 private:
87 AuthPluginInterface *m_plugin;
88 QSocketNotifier *m_cancelNotifier;
89 };
90
95 class RemotePluginProcess: public QObject
96 {
97 Q_OBJECT
98
99 public:
100 RemotePluginProcess(QObject *parent);
101 ~RemotePluginProcess();
102
103 static RemotePluginProcess* createRemotePluginProcess(QString &type,
104 QObject *parent);
105
106 bool loadPlugin(QString &type);
107 bool setupDataStreams();
108 bool setupProxySettings();
109
110 public Q_SLOTS:
111 void startTask();
112 void sessionDataReceived(const QVariantMap &sessionDataMap);
113
114 private:
115 AuthPluginInterface *m_plugin;
116
117 QFile m_inFile;
118 QFile m_outFile;
119
120 QSocketNotifier *m_readnotifier;
121 QSocketNotifier *m_errnotifier;
122
123 BlobIOHandler *m_blobIOHandler;
124
125 //Requiered for async session data reading
126 quint32 m_currentOperation;
127 QString m_currentMechanism;
128
129 private:
130 QString getPluginName(const QString &type);
131 void type();
132 void mechanism();
133 void mechanisms();
134
135 void process();
136 void userActionFinished();
137 void refresh();
138
139 void enableCancelThread();
140 void disableCancelThread();
141
142 private Q_SLOTS:
143 void result(const SignOn::SessionData &data);
144 void store(const SignOn::SessionData &data);
145 void error(const SignOn::Error &err);
146 void userActionRequired(const SignOn::UiSessionData &data);
147 void refreshed(const SignOn::UiSessionData &data);
148 void statusChanged(const AuthPluginState state, const QString &message);
149 void blobIOError();
150
151 Q_SIGNALS :
152 void processStopped();
153 };
154
155 } //namespace RemotePluginProcessNS
156
157 #endif /* REMOTEPLUGINPROCESS_H */
RemotePluginProcessNS::CancelEventThread
Thread to enable cancel functionality.
Definition: remotepluginprocess.h:73
RemotePluginProcessNS::RemotePluginProcess
Class to execute plugin process.
Definition: remotepluginprocess.h:95
process
RemotePluginProcess * process
Definition: main.cpp:43