8 VPNSTATUS_INVALID
= -1,
10 VPNSTATUS_UNINITIALISED
,
11 VPNSTATUS_INITIALISING
,
14 VPNSTATUS_DISCONNECTING
,
19 class VPNControl
: public QObject
24 Q_PROPERTY (QString logText READ getLogText WRITE setLogText NOTIFY logTextChanged
)
26 // Configuration properties
27 Q_PROPERTY (QString server READ getServer WRITE setServer NOTIFY serverChanged
)
28 Q_PROPERTY (unsigned int port READ getPort WRITE setPort NOTIFY portChanged
)
29 Q_PROPERTY (bool compressed READ getCompressed WRITE setCompressed NOTIFY compressedChanged
)
30 Q_PROPERTY (bool useTLS READ getUseTLS WRITE setUseTLS NOTIFY useTLSChanged
)
31 Q_PROPERTY (int tlsDirection READ getTlsDirection WRITE setTlsDirection NOTIFY tlsDirectionChanged
)
32 Q_PROPERTY (QString caCertFile READ getCaCertFile WRITE setCaCertFile NOTIFY caCertFileChanged
)
33 Q_PROPERTY (QString clientCertFile READ getClientCertFile WRITE setClientCertFile NOTIFY clientCertFileChanged
)
34 Q_PROPERTY (QString clientKeyFile READ getClientKeyFile WRITE setClientKeyFile NOTIFY clientKeyFileChanged
)
35 Q_PROPERTY (QString tlsKeyFile READ getTlsKeyFile WRITE setTlsKeyFile NOTIFY tlsKeyFileChanged
)
36 Q_PROPERTY (QString configFile READ getConfigFile WRITE setConfigFile NOTIFY configFileChanged
)
40 QProcess
* vpnProcess
;
42 QStringList arguments
;
45 // Configuration options
52 QString clientCertFile
;
53 QString clientKeyFile
;
58 void collectArguments ();
59 void setStatus (VPNSTATUS newStatus
);
60 void addArgument (QString key
, QString value
);
61 void addArgument (QString key
);
62 void addArgumentNonempty (QString key
, QString value
);
63 void addOption (QString key
, bool add
);
64 void addValue (QString key
);
65 void settingsSetValue (QString key
, QString value
);
66 void settingsSetValue (QString key
, int value
);
70 explicit VPNControl(QObject
*parent
= 0);
72 QString
getLogText() const;
74 // Configuration retreival methods
75 QString
getServer() const;
76 unsigned int getPort() const;
77 bool getCompressed() const;
78 bool getUseTLS() const;
79 int getTlsDirection() const;
80 QString
getCaCertFile () const;
81 QString
getClientCertFile () const;
82 QString
getClientKeyFile () const;
83 QString
getTlsKeyFile () const;
84 QString
getConfigFile () const;
88 void statusChanged(int status
);
89 void logTextChanged (QString
&logText
);
91 // Configuration change signals
92 void serverChanged(QString
&server
);
93 void portChanged(unsigned int port
);
94 void compressedChanged(bool compressed
);
95 void useTLSChanged(bool useTLS
);
96 void tlsDirectionChanged(int direction
);
97 void caCertFileChanged(QString
&caCertFile
);
98 void clientCertFileChanged(QString
&clientCertFile
);
99 void clientKeyFileChanged(QString
&clientKeyFile
);
100 void tlsKeyFileChanged(QString
&tlsKeyFile
);
101 void configFileChanged(QString
&configFile
);
106 void vpnDisconnect ();
109 void finished (int code
);
110 void readError (QProcess::ProcessError error
);
111 void updateConfiguration ();
112 void setLogText(const QString
&value
);
113 void logAppend(const QString
&text
);
115 // Configuration setting
116 void setServer(const QString
&value
);
117 void setPort(unsigned int value
);
118 void setCompressed(bool value
);
119 void setUseTLS(bool value
);
120 void setTlsDirection(int value
);
121 void setCaCertFile(const QString
&value
);
122 void setClientCertFile(const QString
&value
);
123 void setClientKeyFile(const QString
&value
);
124 void setTlsKeyFile(const QString
&value
);
125 void setConfigFile(const QString
&value
);
128 #endif // VPNCONTROL_H