connectivity-api: connectivityqt/openvpn-connection.h Source File

connectivity-api

openvpn-connection.h
Go to the documentation of this file.
1 /*
2 * Copyright © 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Pete Woods <pete.woods@canonical.com>
18 */
19
20 #pragma once
21
22 #include <connectivityqt/vpn-connection.h>
23
24 namespace connectivityqt
25 {
26
27 class Q_DECL_EXPORT OpenvpnConnection : public VpnConnection
28 {
29 Q_OBJECT
30
31 public:
32 UNITY_DEFINES_PTRS(OpenvpnConnection);
33
34 Q_ENUMS(ConnectionType)
35 enum ConnectionType
36 {
37 TLS,
38 PASSWORD,
39 PASSWORD_TLS,
40 STATIC_KEY
41 };
42
43 Q_ENUMS(DevType)
44 enum DevType
45 {
46 TUN,
47 TAP
48 };
49
50 Q_ENUMS(Cipher)
51 enum Cipher
52 {
53 DEFAULT_CIPHER,
54 DES_CBC,
55 RC2_CBC,
56 DES_EDE_CBC,
57 DES_EDE3_CBC,
58 DESX_CBC,
59 RC2_40_CBC,
60 CAST5_CBC,
61 AES_128_CBC,
62 AES_192_CBC,
63 AES_256_CBC,
64 CAMELLIA_128_CBC,
65 CAMELLIA_192_CBC,
66 CAMELLIA_256_CBC,
67 SEED_CBC,
68 AES_128_CBC_HMAC_SHA1,
69 AES_256_CBC_HMAC_SHA1
70 };
71
72 Q_ENUMS(Auth)
73 enum Auth
74 {
75 DEFAULT_AUTH,
76 NONE,
77 RSA_MD4,
78 MD5,
79 SHA1,
80 SHA224,
81 SHA256,
82 SHA384,
83 SHA512,
84 RIPEMD160
85 };
86
87 Q_ENUMS(TlsType)
88 enum TlsType
89 {
90 SERVER,
91 CLIENT
92 };
93
94 Q_ENUMS(KeyDir)
95 enum KeyDir
96 {
97 KEY_NONE,
98 ZERO,
99 ONE
100 };
101
102 Q_ENUMS(ProxyType)
103 enum ProxyType
104 {
105 NOT_REQUIRED,
106 HTTP,
107 SOCKS
108 };
109
110 OpenvpnConnection(const QDBusObjectPath& path, const QDBusConnection& connection);
111
112 virtual ~OpenvpnConnection();
113
114 Type type() const override;
115
116 // Basic properties
117
118 Q_PROPERTY(QString ca READ ca WRITE setCa NOTIFY caChanged)
119 QString ca() const;
120
121 Q_PROPERTY(QString cert READ cert WRITE setCert NOTIFY certChanged)
122 QString cert() const;
123
124 Q_PROPERTY(QString certPass READ certPass WRITE setCertPass NOTIFY certPassChanged)
125 QString certPass() const;
126
127 Q_PROPERTY(ConnectionType connectionType READ connectionType WRITE setConnectionType NOTIFY connectionTypeChanged)
128 ConnectionType connectionType() const;
129
130 Q_PROPERTY(QString key READ key WRITE setKey NOTIFY keyChanged)
131 QString key() const;
132
133 Q_PROPERTY(QString localIp READ localIp WRITE setLocalIp NOTIFY localIpChanged)
134 QString localIp() const;
135
136 Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
137 QString password() const;
138
139 Q_PROPERTY(QString remote READ remote WRITE setRemote NOTIFY remoteChanged)
140 QString remote() const;
141
142 Q_PROPERTY(QString remoteIp READ remoteIp WRITE setRemoteIp NOTIFY remoteIpChanged)
143 QString remoteIp() const;
144
145 Q_PROPERTY(QString staticKey READ staticKey WRITE setStaticKey NOTIFY staticKeyChanged)
146 QString staticKey() const;
147
148 Q_PROPERTY(KeyDir staticKeyDirection READ staticKeyDirection WRITE setStaticKeyDirection NOTIFY staticKeyDirectionChanged)
149 KeyDir staticKeyDirection() const;
150
151 Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged)
152 QString username() const;
153
154 // Advanced general properties
155
156 Q_PROPERTY(int port READ port WRITE setPort NOTIFY portChanged)
157 int port() const;
158
159 Q_PROPERTY(bool portSet READ portSet WRITE setPortSet NOTIFY portSetChanged)
160 bool portSet() const;
161
162 Q_PROPERTY(int renegSeconds READ renegSeconds WRITE setRenegSeconds NOTIFY renegSecondsChanged)
163 int renegSeconds() const;
164
165 Q_PROPERTY(bool renegSecondsSet READ renegSecondsSet WRITE setRenegSecondsSet NOTIFY renegSecondsSetChanged)
166 bool renegSecondsSet() const;
167
168 Q_PROPERTY(bool compLzo READ compLzo WRITE setCompLzo NOTIFY compLzoChanged)
169 bool compLzo() const;
170
171 Q_PROPERTY(bool protoTcp READ protoTcp WRITE setProtoTcp NOTIFY protoTcpChanged)
172 bool protoTcp() const;
173
174 Q_PROPERTY(QString dev READ dev WRITE setDev NOTIFY devChanged)
175 QString dev() const;
176
177 Q_PROPERTY(DevType devType READ devType WRITE setDevType NOTIFY devTypeChanged)
178 DevType devType() const;
179
180 Q_PROPERTY(bool devTypeSet READ devTypeSet WRITE setDevTypeSet NOTIFY devTypeSetChanged)
181 bool devTypeSet() const;
182
183 Q_PROPERTY(int tunnelMtu READ tunnelMtu WRITE setTunnelMtu NOTIFY tunnelMtuChanged)
184 int tunnelMtu() const;
185
186 Q_PROPERTY(bool tunnelMtuSet READ tunnelMtuSet WRITE setTunnelMtuSet NOTIFY tunnelMtuSetChanged)
187 bool tunnelMtuSet() const;
188
189 Q_PROPERTY(int fragmentSize READ fragmentSize WRITE setFragmentSize NOTIFY fragmentSizeChanged)
190 int fragmentSize() const;
191
192 Q_PROPERTY(bool fragmentSizeSet READ fragmentSizeSet WRITE setFragmentSizeSet NOTIFY fragmentSizeSetChanged)
193 bool fragmentSizeSet() const;
194
195 Q_PROPERTY(bool mssFix READ mssFix WRITE setMssFix NOTIFY mssFixChanged)
196 bool mssFix() const;
197
198 Q_PROPERTY(bool remoteRandom READ remoteRandom WRITE setRemoteRandom NOTIFY remoteRandomChanged)
199 bool remoteRandom() const;
200
201 // Advanced security properties
202
203 Q_PROPERTY(Cipher cipher READ cipher WRITE setCipher NOTIFY cipherChanged)
204 Cipher cipher() const;
205
206 Q_PROPERTY(int keysize READ keysize WRITE setKeysize NOTIFY keysizeChanged)
207 int keysize() const;
208
209 Q_PROPERTY(bool keysizeSet READ keysizeSet WRITE setKeysizeSet NOTIFY keysizeSetChanged)
210 bool keysizeSet() const;
211
212 Q_PROPERTY(Auth auth READ auth WRITE setAuth NOTIFY authChanged)
213 Auth auth() const;
214
215 // Advanced TLS auth properties
216
217 Q_PROPERTY(QString tlsRemote READ tlsRemote WRITE setTlsRemote NOTIFY tlsRemoteChanged)
218 QString tlsRemote() const;
219
220 Q_PROPERTY(TlsType remoteCertTls READ remoteCertTls WRITE setRemoteCertTls NOTIFY remoteCertTlsChanged)
221 TlsType remoteCertTls() const;
222
223 Q_PROPERTY(bool remoteCertTlsSet READ remoteCertTlsSet WRITE setRemoteCertTlsSet NOTIFY remoteCertTlsSetChanged)
224 bool remoteCertTlsSet() const;
225
226 Q_PROPERTY(QString ta READ ta WRITE setTa NOTIFY taChanged)
227 QString ta() const;
228
229 Q_PROPERTY(KeyDir taDir READ taDir WRITE setTaDir NOTIFY taDirChanged)
230 KeyDir taDir() const;
231
232 Q_PROPERTY(bool taSet READ taSet WRITE setTaSet NOTIFY taSetChanged)
233 bool taSet() const;
234
235 // Advanced proxy settings
236
237 Q_PROPERTY(ProxyType proxyType READ proxyType WRITE setProxyType NOTIFY proxyTypeChanged)
238 ProxyType proxyType() const;
239
240 Q_PROPERTY(QString proxyServer READ proxyServer WRITE setProxyServer NOTIFY proxyServerChanged)
241 QString proxyServer() const;
242
243 Q_PROPERTY(int proxyPort READ proxyPort WRITE setProxyPort NOTIFY proxyPortChanged)
244 int proxyPort() const;
245
246 Q_PROPERTY(bool proxyRetry READ proxyRetry WRITE setProxyRetry NOTIFY proxyRetryChanged)
247 bool proxyRetry() const;
248
249 Q_PROPERTY(QString proxyUsername READ proxyUsername WRITE setProxyUsername NOTIFY proxyUsernameChanged)
250 QString proxyUsername() const;
251
252 Q_PROPERTY(QString proxyPassword READ proxyPassword WRITE setProxyPassword NOTIFY proxyPasswordChanged)
253 QString proxyPassword() const;
254
255 public Q_SLOTS:
256 // Basic properties
257
258 void setCa(const QString &value);
259
260 void setCert(const QString &value);
261
262 void setCertPass(const QString &value);
263
264 void setConnectionType(ConnectionType connectionType);
265
266 void setKey(const QString &value);
267
268 void setLocalIp(const QString &value);
269
270 void setPassword(const QString &value);
271
272 void setRemote(const QString &value);
273
274 void setRemoteIp(const QString &value);
275
276 void setStaticKey(const QString &value);
277
278 void setStaticKeyDirection(KeyDir value);
279
280 void setUsername(const QString &value);
281
282 // Advanced general properties
283
284 void setPort(int value);
285
286 void setPortSet(bool value);
287
288 void setRenegSeconds(int value);
289
290 void setRenegSecondsSet(bool value);
291
292 void setCompLzo(bool value);
293
294 void setProtoTcp(bool value);
295
296 void setDev(const QString &value);
297
298 void setDevType(DevType value);
299
300 void setDevTypeSet(bool value);
301
302 void setTunnelMtu(int value);
303
304 void setTunnelMtuSet(bool value);
305
306 void setFragmentSize(int value);
307
308 void setFragmentSizeSet(bool value);
309
310 void setMssFix(bool value);
311
312 void setRemoteRandom(bool value);
313
314 // Advanced security properties
315
316 void setCipher(Cipher value);
317
318 void setKeysize(int value);
319
320 void setKeysizeSet(bool value);
321
322 void setAuth(Auth value);
323
324 // Advanced TLS auth properties
325
326 void setTlsRemote(const QString &value);
327
328 void setRemoteCertTls(TlsType value);
329
330 void setRemoteCertTlsSet(bool value);
331
332 void setTa(const QString &value);
333
334 void setTaDir(KeyDir value);
335
336 void setTaSet(bool value);
337
338 // Advanced proxy settings
339
340 void setProxyType(ProxyType value);
341
342 void setProxyServer(const QString &value);
343
344 void setProxyPort(int value);
345
346 void setProxyRetry(bool value);
347
348 void setProxyUsername(const QString &value);
349
350 void setProxyPassword(const QString &value);
351
352 Q_SIGNALS:
353 // Basic properties
354
355 void caChanged(const QString &value);
356
357 void certChanged(const QString &value);
358
359 void certPassChanged(const QString &value);
360
361 void connectionTypeChanged(ConnectionType connectionType);
362
363 void keyChanged(const QString &value);
364
365 void localIpChanged(const QString &value);
366
367 void passwordChanged(const QString &value);
368
369 void remoteChanged(const QString &value);
370
371 void remoteIpChanged(const QString &value);
372
373 void staticKeyChanged(const QString &value);
374
375 void staticKeyDirectionChanged(KeyDir value);
376
377 void usernameChanged(const QString &value);
378
379 // Advanced general properties
380
381 void portChanged(int value);
382
383 void portSetChanged(bool value);
384
385 void renegSecondsChanged(int value);
386
387 void renegSecondsSetChanged(bool value);
388
389 void compLzoChanged(bool value);
390
391 void protoTcpChanged(bool value);
392
393 void devChanged(const QString &value);
394
395 void devTypeChanged(DevType value);
396
397 void devTypeSetChanged(bool value);
398
399 void tunnelMtuChanged(int value);
400
401 void tunnelMtuSetChanged(bool value);
402
403 void fragmentSizeChanged(int value);
404
405 void fragmentSizeSetChanged(bool value);
406
407 void mssFixChanged(bool value);
408
409 void remoteRandomChanged(bool value);
410
411 // Advanced security properties
412
413 void cipherChanged(Cipher value);
414
415 void keysizeChanged(int value);
416
417 void keysizeSetChanged(bool value);
418
419 void authChanged(Auth value);
420
421 // Advanced TLS auth properties
422
423 void tlsRemoteChanged(const QString &value);
424
425 void remoteCertTlsChanged(TlsType value);
426
427 void remoteCertTlsSetChanged(bool value);
428
429 void taChanged(const QString &value);
430
431 void taDirChanged(KeyDir value);
432
433 void taSetChanged(bool value);
434
435 // Advanced proxy tings
436
437 void proxyTypeChanged(ProxyType value);
438
439 void proxyServerChanged(const QString &value);
440
441 void proxyPortChanged(int value);
442
443 void proxyRetryChanged(bool value);
444
445 void proxyUsernameChanged(const QString &value);
446
447 void proxyPasswordChanged(const QString &value);
448
449 protected:
450 class Priv;
451 std::shared_ptr<Priv> d;
452 };
453
454 }
connectivityqt::OpenvpnConnection::DES_CBC
@ DES_CBC
Definition: openvpn-connection.h:54
connectivityqt::OpenvpnConnection::KeyDir
KeyDir
Definition: openvpn-connection.h:96
vpn-connection.h
connectivityqt::OpenvpnConnection::RC2_40_CBC
@ RC2_40_CBC
Definition: openvpn-connection.h:59
connectivityqt::OpenvpnConnection::DevType
DevType
Definition: openvpn-connection.h:45
connectivityqt::OpenvpnConnection::CAMELLIA_128_CBC
@ CAMELLIA_128_CBC
Definition: openvpn-connection.h:64
connectivityqt::OpenvpnConnection::DEFAULT_CIPHER
@ DEFAULT_CIPHER
Definition: openvpn-connection.h:53
connectivityqt::OpenvpnConnection::AES_128_CBC
@ AES_128_CBC
Definition: openvpn-connection.h:61
connectivityqt::OpenvpnConnection::UNITY_DEFINES_PTRS
UNITY_DEFINES_PTRS(OpenvpnConnection)
connectivityqt::OpenvpnConnection::AES_192_CBC
@ AES_192_CBC
Definition: openvpn-connection.h:62
connectivityqt::OpenvpnConnection::TLS
@ TLS
Definition: openvpn-connection.h:37
connectivityqt::OpenvpnConnection::HTTP
@ HTTP
Definition: openvpn-connection.h:106
connectivityqt::OpenvpnConnection::NOT_REQUIRED
@ NOT_REQUIRED
Definition: openvpn-connection.h:105
connectivityqt::OpenvpnConnection::TUN
@ TUN
Definition: openvpn-connection.h:46
connectivityqt::OpenvpnConnection::KEY_NONE
@ KEY_NONE
Definition: openvpn-connection.h:97
connectivityqt::OpenvpnConnection::CAST5_CBC
@ CAST5_CBC
Definition: openvpn-connection.h:60
connectivityqt::OpenvpnConnection::PASSWORD_TLS
@ PASSWORD_TLS
Definition: openvpn-connection.h:39
connectivityqt::OpenvpnConnection::SHA256
@ SHA256
Definition: openvpn-connection.h:81
connectivityqt::OpenvpnConnection::DEFAULT_AUTH
@ DEFAULT_AUTH
Definition: openvpn-connection.h:75
connectivityqt::OpenvpnConnection::CAMELLIA_192_CBC
@ CAMELLIA_192_CBC
Definition: openvpn-connection.h:65
connectivityqt::OpenvpnConnection::DESX_CBC
@ DESX_CBC
Definition: openvpn-connection.h:58
connectivityqt::OpenvpnConnection::RC2_CBC
@ RC2_CBC
Definition: openvpn-connection.h:55
connectivityqt::VpnConnection
Definition: vpn-connection.h:32
connectivityqt::OpenvpnConnection::AES_256_CBC
@ AES_256_CBC
Definition: openvpn-connection.h:63
connectivityqt::OpenvpnConnection::ConnectionType
ConnectionType
Definition: openvpn-connection.h:36
connectivityqt::OpenvpnConnection::SHA224
@ SHA224
Definition: openvpn-connection.h:80
connectivityqt
Definition: connectivity.cpp:37
connectivityqt::OpenvpnConnection::PASSWORD
@ PASSWORD
Definition: openvpn-connection.h:38
connectivityqt::OpenvpnConnection::TlsType
TlsType
Definition: openvpn-connection.h:89
connectivityqt::OpenvpnConnection::SHA512
@ SHA512
Definition: openvpn-connection.h:83
connectivityqt::OpenvpnConnection::NONE
@ NONE
Definition: openvpn-connection.h:76
connectivityqt::VpnConnection::Type
Type
Definition: vpn-connection.h:41
connectivityqt::OpenvpnConnection::DES_EDE3_CBC
@ DES_EDE3_CBC
Definition: openvpn-connection.h:57
connectivityqt::OpenvpnConnection::SEED_CBC
@ SEED_CBC
Definition: openvpn-connection.h:67
connectivityqt::OpenvpnConnection::Auth
Auth
Definition: openvpn-connection.h:74
connectivityqt::OpenvpnConnection::MD5
@ MD5
Definition: openvpn-connection.h:78
connectivityqt::OpenvpnConnection::RSA_MD4
@ RSA_MD4
Definition: openvpn-connection.h:77
connectivityqt::OpenvpnConnection::AES_128_CBC_HMAC_SHA1
@ AES_128_CBC_HMAC_SHA1
Definition: openvpn-connection.h:68
connectivityqt::OpenvpnConnection::ZERO
@ ZERO
Definition: openvpn-connection.h:98
connectivityqt::OpenvpnConnection::SHA384
@ SHA384
Definition: openvpn-connection.h:82
connectivityqt::OpenvpnConnection::SERVER
@ SERVER
Definition: openvpn-connection.h:90
connectivityqt::OpenvpnConnection::ProxyType
ProxyType
Definition: openvpn-connection.h:104
connectivityqt::OpenvpnConnection::SHA1
@ SHA1
Definition: openvpn-connection.h:79
connectivityqt::OpenvpnConnection
Definition: openvpn-connection.h:28
connectivityqt::OpenvpnConnection::DES_EDE_CBC
@ DES_EDE_CBC
Definition: openvpn-connection.h:56
connectivityqt::OpenvpnConnection::CAMELLIA_256_CBC
@ CAMELLIA_256_CBC
Definition: openvpn-connection.h:66
connectivityqt::OpenvpnConnection::Cipher
Cipher
Definition: openvpn-connection.h:52