summaryrefslogtreecommitdiffstats
path: root/tdecore/tdenetworkconnections.h
blob: 4afdbc8636cfcb6132d7749b087e194b81aac689 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
/* This file is part of the TDE libraries
   Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/
#ifndef _TDENETWORKCONNECTIONS_H
#define _TDENETWORKCONNECTIONS_H

// TDE includes
#include <tqobject.h>
#include <tqstring.h>
#include <tqptrlist.h>
#include <tqdatetime.h>
#include <tqstringlist.h>
#include <tqhostaddress.h>
#include "kiconloader.h"
#include "tdelibs_export.h"

#define CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(x)														\
	inline x operator|(x a, x b)																\
	{																			\
		return static_cast<x>(static_cast<int>(a) | static_cast<int>(b));										\
	}																			\
																				\
	inline x operator&(x a, x b)																\
	{																			\
		return static_cast<x>(static_cast<int>(a) & static_cast<int>(b));										\
	}																			\
																				\
	inline x operator~(x a)																	\
	{																			\
		return static_cast<x>(~static_cast<int>(a));													\
	}																			\
																				\
	inline x &operator|=(x& a, const x& b)															\
	{																			\
		a = static_cast<x>(static_cast<int>(a) | static_cast<int>(b));											\
		return a;																	\
	}																			\
																				\
	inline x &operator&=(x& a, const x& b)															\
	{																			\
		a = static_cast<x>(static_cast<int>(a) & static_cast<int>(b));											\
		return a;																	\
	}

class TDENetworkDevice;

typedef TQValueList<TQ_UINT8> TDENetworkByteList;
typedef TQValueList<TQHostAddress> TDENetworkAddressList;
typedef TQMap<TQString, TQString> TDENetworkSettingsMap;
typedef TQMap<TQ_UINT32, TQ_UINT32> TDENetworkPriorityMap;

namespace TDENetworkDeviceType {
	enum TDENetworkDeviceType {
		BackendOnly,
		WiredEthernet,
		WiFi,
		Bluetooth,
		OLPCMesh,
		WiMax,
		Modem,
		Infiniband,
		Bond,
		VLAN,
		ADSL,
		Other,
		Last = Other
	};
};

namespace TDENetworkConnectionType {
	enum TDENetworkConnectionType {
		WiredEthernet,
		WiFi,
		Bluetooth,
		OLPCMesh,
		WiMax,
		Modem,
		Infiniband,
		Bond,
		VLAN,
		ADSL,
		VPN,
		Other,
		Last = Other
	};
};

namespace TDENetworkInfinibandTransportMode {
	enum TDENetworkInfinibandTransportMode {
		Datagram,
		Connected,
		Other,
		Last = Other
	};
};

namespace TDEWiFiMode {
	enum TDEWiFiMode {
		AdHoc,
		Infrastructure,
		Other,
		Last = Other
	};
};

namespace TDEWiFiFrequencyBand {
	enum TDEWiFiFrequencyBand {
		None,
		Band2_4GHz,
		Band5GHz,
		Other,
		Last = Other
	};
};

namespace TDEBluetoothConnectionType {
	enum TDEBluetoothConnectionType {
		DUN,
		PAN,
		Other,
		Last = Other
	};
};

namespace TDEModemConnectionType {
	enum TDEModemConnectionType {
		CDMA,
		GSM,
		Other,
		Last = Other
	};
};

namespace TDEGSMNetworkType {
	enum TDEGSMNetworkType {
		Any,
		Only3G,
		GPRSEdge,
		Prefer3G,
		Prefer2G,
		Other,
		Last = Other
	};
};

namespace TDENetworkParity {
	enum TDENetworkParity {
		None,
		Even,
		Odd,
		Other,
		Last = Other
	};
};

namespace TDENetworkSlaveDeviceType {
	enum TDENetworkSlaveDeviceType {
		None,
		Bond,
		Other,
		Last = Other
	};
};

namespace TDENetworkGlobalManagerFlags {
	enum TDENetworkGlobalManagerFlags {
		Unknown			= 0x00000000,
		Disconnected		= 0x00000001,
		Connected		= 0x00000002,
		EstablishingLink	= 0x00000004,
		DeactivatingLink	= 0x00000008,
		LinkLocalAccess		= 0x00000010,
		SiteLocalAccess		= 0x00000020,
		GlobalAccess		= 0x00000040,
		Sleeping		= 0x00000080,
		BackendUnavailable	= 0x00000100
	};

	CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkGlobalManagerFlags)
};

namespace TDENetworkDeviceCapabilityFlags {
	enum TDENetworkDeviceCapabilityFlags {
		None			= 0x00000000,
		Supported		= 0x00000001,
		CanDetectLink		= 0x00000002
	};

	CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkDeviceCapabilityFlags)
};

namespace TDENetworkPPPFlags {
	enum TDENetworkPPPFlags {
		None			= 0x00000000,
		DisableEAP		= 0x00000001,
		DisablePAP		= 0x00000002,
		DisableCHAP		= 0x00000004,
		DisableMSCHAP		= 0x00000008,
		DisableMSCHAPv2		= 0x00000010,
		AllowBSDCompression	= 0x00000020,
		AllowDeflateCompression	= 0x00000040,
		AllowVJCompression	= 0x00000080,
		RequireMPPE		= 0x00000100,
		RequireMPPE128		= 0x00000200,
		StatefulMPPE		= 0x00000400,
		UseHardwareFlowControl	= 0x00000800
	};

	CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkPPPFlags)
};

namespace TDENetworkWiFiAPFlags {
	enum TDENetworkWiFiAPFlags {
		None			= 0x00000000,
		PrivacySupport		= 0x00000001,
		PairWEP40		= 0x00000002,
		PairWEP104		= 0x00000004,
		PairTKIP		= 0x00000008,
		PairCCMP		= 0x00000010,
		GroupWEP40		= 0x00000020,
		GroupWEP104		= 0x00000040,
		GroupTKIP		= 0x00000080,
		GroupCCMP		= 0x00000100,
		KeyManagementPSK	= 0x00000200,
		KeyManagement80211	= 0x00000400
	};

	CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkWiFiAPFlags)
};

namespace TDENetworkWiFiClientFlags {
	enum TDENetworkWiFiClientFlags {
		None			= 0x00000000,
		CipherWEP40		= 0x00000002,
		CipherWEP104		= 0x00000004,
		CipherTKIP		= 0x00000008,
		CipherCCMP		= 0x00000010,
		CipherWPA		= 0x00000020,
		CipherRSN		= 0x00000040
	};

	CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkWiFiClientFlags)
};

namespace TDENetworkWiFiConnectionCipher {
	enum TDENetworkWiFiConnectionCipher {
		None,
		CipherWEP40,
		CipherWEP104,
		CipherTKIP,
		CipherCCMP,
		CipherWPA,
		CipherRSN
	};
};

namespace TDENetworkWepKeyType {
	enum TDENetworkWepKeyType {
		Hexadecimal,
		Passphrase
	};
};

namespace TDENetworkVLANFlags {
	enum TDENetworkVLANFlags {
		None			= 0x00000000,
		ReorderPacketHeaders	= 0x00000001,
		UseGVRP			= 0x00000002,
		LooseBinding		= 0x00000004
	};

	CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkVLANFlags)
};

typedef TQValueList<TDENetworkWiFiConnectionCipher::TDENetworkWiFiConnectionCipher> TDENetworkWiFiConnectionCipherList;

namespace TDENetworkWiFiKeyType {
	enum TDENetworkWiFiKeyType {
		WEP,
		DynamicWEP,
		WPAAdHoc,
		WPAInfrastructure,
		WPAEnterprise,
		Other,
		Last = Other
	};
};

namespace TDENetworkWiFiAuthType {
	enum TDENetworkWiFiAuthType {
		Open,
		Shared,
		LEAP,
		Other,
		Last = Other
	};
};

namespace TDENetworkWiFiWPAVersion {
	enum TDENetworkWiFiWPAVersion {
		Any,
		WPA,
		RSN,
		Other,
		Last = Other
	};
};

namespace TDENetworkIEEE8021xType {
	enum TDENetworkIEEE8021xType {
		None,
		LEAP,
		MD5,
		PAP,
		CHAP,
		MSCHAP,
		MSCHAPV2,
		Fast,
		PSK,
		PAX,
		SAKE,
		GPSK,
		TLS,
		PEAP,
		TTLS,
		SIM,
		GTC,
		OTP
	};
};

namespace TDENetworkIEEE8021xFastFlags {
	enum TDENetworkIEEE8021xFastFlags {
		None			= 0x00000000,
		AllowUnauthenticated	= 0x00000001,
		AllowAuthenticated	= 0x00000002
	};

	CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkIEEE8021xFastFlags)
};

namespace TDENetworkPasswordHandlingFlags {
	enum TDENetworkPasswordHandlingFlags {
		None			= 0x00000000,
		NoSave			= 0x00000001,
		NoPrompt		= 0x00000002,
		ExternalStorage		= 0x00000004
	};

	CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkPasswordHandlingFlags)
};

namespace TDENetworkConnectionStatus {
	enum TDENetworkConnectionStatus {
		Invalid			= 0x00000000,
		Disconnected		= 0x00000001,
		Connected		= 0x00000002,
		LinkUnavailable		= 0x00000004,
		EstablishingLink	= 0x00000008,
		DeactivatingLink	= 0x00000010,
		ConfiguringProtocols	= 0x00000020,
		Reconnecting		= 0x00000040,
		LinkLost		= 0x00000080,
		LinkLocalAccess		= 0x00000100,
		SiteLocalAccess		= 0x00000200,
		GlobalAccess		= 0x00000400,
		UnManaged		= 0x00000800,
		NeedAuthorization	= 0x00001000,
		Failed			= 0x00002000,
		VerifyingProtocols	= 0x00004000,
		DependencyWait		= 0x00008000
	};

	CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkConnectionStatus)
};

namespace TDENetworkIPConfigurationFlags {
	enum TDENetworkIPConfigurationFlags {
		None					= 0x00000000,
		IPV4DHCPIP				= 0x00000001,
		IPV4DHCPDNS				= 0x00000002,
		IPV4DHCPRoutes				= 0x00000004,
		IPV4LocalOnly				= 0x00000008,
		IPV4StartConnectionSharingServer	= 0x00000010,
		IPV4Disabled				= 0x00000020,
		IPV4MayUseAsDefaultRoute		= 0x00000040,
		IPV6DHCPIP				= 0x00000080,
		IPV6DHCPDNS				= 0x00000100,
		IPV6DHCPRoutes				= 0x00000200,
		IPV6LocalOnly				= 0x00000400,
		IPV6StartConnectionSharingServer	= 0x00000800,
		IPV6Disabled				= 0x00001000,
		IPV6MayUseAsDefaultRoute		= 0x00002000
	};

	CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkIPConfigurationFlags)
};

class TDECORE_EXPORT TDENetworkSearchDomain
{
	public:
		TDENetworkSearchDomain();
		TDENetworkSearchDomain(TQString domain, bool ipv6=false);
		~TDENetworkSearchDomain();

		TQString searchDomain();
		void setSearchDomain(TQString domain, bool ipv6=false);

		bool isIPv4();
		bool isIPv6();

	private:
		TQString m_domain;
		bool m_isIPV6;
};

typedef TQValueList<TDENetworkSearchDomain> TDENetworkSearchDomainList;

class TDECORE_EXPORT TDENetMask
{
	public:
		TDENetMask();
		TDENetMask(TQ_UINT32 netmask);
		TDENetMask(TQ_UINT8* netmask);
		~TDENetMask();

		void fromCIDRMask(unsigned char mask, bool ipv6=false);
		unsigned char toCIDRMask();
		void fromString(TQString mask);
		TQString toString();

		bool isIPv4();
		bool isIPv6();

	private:
		TQ_UINT32 m_ipv4NetMask;
		TQHostAddress m_ipv6NetMask;
		bool m_isIPV6;
};

class TDECORE_EXPORT TDEMACAddress
{
	public:
		TDEMACAddress();
		TDEMACAddress(TDENetworkByteList address);
		~TDEMACAddress();

		TDENetworkByteList address();
		void setAddress(TDENetworkByteList address);
		TQString toString();
		void fromString(TQString address);
		bool isValid();

	private:
		bool m_isValid;
		TDENetworkByteList m_macAddress;

		friend bool operator==(const TDEMACAddress &a1, const TDEMACAddress &a2);
};

bool operator==(const TDEMACAddress &a1, const TDEMACAddress &a2);

typedef TQValueList<TDEMACAddress> TDEMACAddressList;

class TDECORE_EXPORT TDENetworkSingleIPConfiguration
{
	public:
		TDENetworkSingleIPConfiguration();
		~TDENetworkSingleIPConfiguration();

		bool isIPv4();
		bool isIPv6();

	public:
		bool valid;
		TQHostAddress ipAddress;
		TDENetMask networkMask;
		TQHostAddress gateway;
};

typedef TQValueList<TDENetworkSingleIPConfiguration> TDENetworkSingleIPConfigurationList;

class TDECORE_EXPORT TDENetworkSingleRouteConfiguration
{
	public:
		TDENetworkSingleRouteConfiguration();
		~TDENetworkSingleRouteConfiguration();

		bool isIPv4();
		bool isIPv6();

	public:
		bool valid;
		TQHostAddress ipAddress;
		TDENetMask networkMask;
		TQHostAddress gateway;
		TQ_UINT32 metric;
};

typedef TQValueList<TDENetworkSingleRouteConfiguration> TDENetworkSingleRouteConfigurationList;

class TDENetworkIEEE8021xConfiguration
{
	public:
		TDENetworkIEEE8021xConfiguration();
		~TDENetworkIEEE8021xConfiguration();

	public:
		bool valid;
		bool secretsValid;
		TDENetworkIEEE8021xType::TDENetworkIEEE8021xType type;
		TQString userName;
		TQString anonymousUserName;
		TQString pacFileName;
		TQByteArray caCertificate;
		TQString additionalCAFilesPath;
		TQString authServerCertSubjectMatch;
		TQStringList alternateAuthServerCertSubjectMatch;
		TQByteArray clientCertificate;
		TQString forcePEAPVersion;
		TQString forcePEAPLabel;
		TDENetworkIEEE8021xFastFlags::TDENetworkIEEE8021xFastFlags fastProvisioningFlags;
		TQString phase2NonEAPAuthMethod;
		TQString phase2EAPAuthMethod;
		TQByteArray phase2CaCertificate;
		TQString phase2CaFilesPath;
		TQString phase2AuthServerCertSubjectMatch;
		TQStringList phase2AlternateAuthServerCertSubjectMatch;
		TQByteArray phase2ClientCertificate;
		TQString password;
		TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags passwordFlags;
		TQByteArray binaryPassword;
		TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags binaryPasswordFlags;
		TQByteArray privateKey;
		TQString privateKeyPassword;
		TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags privateKeyPasswordFlags;
		TQByteArray phase2PrivateKey;
		TQString phase2PrivateKeyPassword;
		TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags phase2PrivateKeyPasswordFlags;
		bool forceSystemCaCertificates;
};

class TDECORE_EXPORT TDENetworkPPPConfiguration
{
	public:
		TDENetworkPPPConfiguration();
		virtual ~TDENetworkPPPConfiguration();

	public:
		bool valid;
		bool requireServerAuthentication;
		TDENetworkPPPFlags::TDENetworkPPPFlags flags;
		TQ_UINT32 baudRate;
		TQ_UINT32 mru;
		TQ_UINT32 mtu;
		TQ_UINT32 lcpEchoPingInterval;
		TQ_UINT32 lcpEchoFailureThreshold;
};

class TDECORE_EXPORT TDENetworkPPPOEConfiguration
{
	public:
		TDENetworkPPPOEConfiguration();
		virtual ~TDENetworkPPPOEConfiguration();

	public:
		bool valid;
		bool secretsValid;
		TQString networkServiceProvider;
		TQString username;
		TQString password;
		TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags passwordFlags;
};

class TDECORE_EXPORT TDENetworkSerialConfiguration
{
	public:
		TDENetworkSerialConfiguration();
		virtual ~TDENetworkSerialConfiguration();

	public:
		bool valid;
		TQ_UINT32 baudRate;
		TQ_UINT32 byteWidth;
		TDENetworkParity::TDENetworkParity parity;
		TQ_UINT32 stopBits;
		TQ_UINT64 txDelay;
};

class TDECORE_EXPORT TDENetworkCDMAConfiguration
{
	public:
		TDENetworkCDMAConfiguration();
		virtual ~TDENetworkCDMAConfiguration();

	public:
		bool valid;
		bool secretsValid;
		TQString providerDataNumber;
		TQString username;
		TQString password;
		TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags passwordFlags;
};

class TDECORE_EXPORT TDENetworkGSMConfiguration
{
	public:
		TDENetworkGSMConfiguration();
		virtual ~TDENetworkGSMConfiguration();

	public:
		bool valid;
		bool secretsValid;
		TQString providerDataNumber;
		TQString username;
		TQString password;
		TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags passwordFlags;
		TQString accessPointName;
		TQString networkID;
		TDEGSMNetworkType::TDEGSMNetworkType networkType;
		TQString pin;
		TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags pinFlags;
		TQ_UINT32 allowedFrequencyBands;
		bool allowRoaming;
};
		

class TDENetworkWiFiSecurityConfiguration
{
	public:
		TDENetworkWiFiSecurityConfiguration();
		~TDENetworkWiFiSecurityConfiguration();

	public:
		bool valid;
		bool secretsValid;
		TDENetworkWiFiKeyType::TDENetworkWiFiKeyType keyType;
		TDENetworkWiFiAuthType::TDENetworkWiFiAuthType authType;
		TDENetworkWiFiWPAVersion::TDENetworkWiFiWPAVersion wpaVersion;
		TDENetworkWiFiConnectionCipher::TDENetworkWiFiConnectionCipher cipher;
		TQString wepKey0;
		TQString wepKey1;
		TQString wepKey2;
		TQString wepKey3;
		TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags wepKeyFlags;
		TQ_UINT32 wepKeyIndex;
		TDENetworkWepKeyType::TDENetworkWepKeyType wepKeyType;
		TDENetworkWiFiConnectionCipherList allowedPairWiseCiphers;
		TDENetworkWiFiConnectionCipherList allowedGroupWiseCiphers;
		TQString psk;
		TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags pskFlags;
		TQString leapUsername;
		TQString leapPassword;
		TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags leapPasswordFlags;
};

class TDECORE_EXPORT TDENetworkIPConfiguration
{
	public:
		TDENetworkIPConfiguration();
		~TDENetworkIPConfiguration();

	public:
		bool valid;
		TDENetworkIPConfigurationFlags::TDENetworkIPConfigurationFlags connectionFlags;
		TDENetworkSingleIPConfigurationList ipConfigurations;
		TDENetworkSingleRouteConfigurationList routeConfigurations;
		TQHostAddress broadcast;
		TQHostAddress destination;
		TDENetworkAddressList resolvers;
		TDENetworkSearchDomainList searchDomains;
		TQString dhcpClientIdentifier;
};

class TDECORE_EXPORT TDENetworkWiFiDeviceInfo
{
	public:
		TDENetworkWiFiDeviceInfo();
		~TDENetworkWiFiDeviceInfo();

	public:
		bool valid;
		TDEMACAddress hwAddress;
		TDEMACAddress permanentHWAddress;
		TDEWiFiMode::TDEWiFiMode operatingMode;
		unsigned int bitrate;
		TDEMACAddress activeAccessPointBSSID;
		TDENetworkWiFiClientFlags::TDENetworkWiFiClientFlags wirelessFlags;
};

class TDECORE_EXPORT TDENetworkDeviceInformation
{
	public:
		TDENetworkDeviceInformation();
		~TDENetworkDeviceInformation();

	public:
		bool valid;
		TDENetworkConnectionStatus::TDENetworkConnectionStatus statusFlags;
		TQString UUID;
		TQString backendDriver;
		TQString backendDriverVersion;
		TQString firmwareVersion;
		TDENetworkDeviceCapabilityFlags::TDENetworkDeviceCapabilityFlags capabilityFlags;
		TDENetworkIPConfiguration ipConfiguration;
		bool managed;
		bool autoConnect;
		bool firmwareMissing;
		TDENetworkDeviceType::TDENetworkDeviceType deviceType;
		TQString activeConnectionUUID;
		TDENetworkWiFiDeviceInfo wiFiInfo;
};

class TDECORE_EXPORT TDENetworkHWNeighbor
{
	public:
		TDENetworkHWNeighbor();
		~TDENetworkHWNeighbor();

	public:
		bool valid;
};

class TDECORE_EXPORT TDENetworkWiFiAPInfo : public TDENetworkHWNeighbor
{
	public:
		TDENetworkWiFiAPInfo();
		~TDENetworkWiFiAPInfo();

	public:
		TQByteArray SSID;
		TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags wpaFlags;
		TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags rsnFlags;
		unsigned int frequency;
		TDEMACAddress BSSID;
		unsigned int maxBitrate;
		double signalQuality;
};

typedef TQPtrList< TDENetworkHWNeighbor > TDENetworkHWNeighborList;

class TDECORE_EXPORT TDENetworkConnection
{
	public:
		TDENetworkConnection();
		virtual ~TDENetworkConnection();

	public:
		TQString UUID;
		TQString friendlyName;
		TDENetworkIPConfiguration ipConfig;
		TDEMACAddress lockedHWAddress;
		TDEMACAddress manualHWAddress;
		bool readOnly;
		bool autoConnect;
		bool fullDuplex;
		bool requireIPV4;
		bool requireIPV6;
		TQ_UINT32 mtu;
		TDENetworkIEEE8021xConfiguration eapConfig;
		TDENetworkPPPConfiguration pppConfig;
		TDENetworkPPPOEConfiguration pppoeConfig;
		TDENetworkSerialConfiguration serialConfig;
		TQStringList authorizedUsers;
		TQString masterConnectionUUID;
		TDENetworkSlaveDeviceType::TDENetworkSlaveDeviceType slaveType;
		TQDateTime lastKnownConnection;
};

class TDECORE_EXPORT TDEWiredEthernetConnection : public TDENetworkConnection
{
	public:
		TDEWiredEthernetConnection();
		virtual ~TDEWiredEthernetConnection();
};

class TDECORE_EXPORT TDEWiFiConnection : public TDENetworkConnection
{
	public:
		TDEWiFiConnection();
		virtual ~TDEWiFiConnection();

	public:
		TQByteArray SSID;
		TDEWiFiMode::TDEWiFiMode operatingMode;
		TDEWiFiFrequencyBand::TDEWiFiFrequencyBand bandRestriction;
		TQ_INT32 channelRestriction;
		TQ_INT32 bitRateRestriction;
		TQ_INT32 powerRestriction;
		TDEMACAddress accessPointRestriction;
		TDEMACAddressList blacklistedBSSIDs;
		TDEMACAddressList heardBSSIDs;
		bool isHiddenNetwork;
		bool securityRequired;
		TDENetworkWiFiSecurityConfiguration securitySettings;
};

class TDECORE_EXPORT TDEWiredInfinibandConnection : public TDENetworkConnection
{
	public:
		TDEWiredInfinibandConnection();
		virtual ~TDEWiredInfinibandConnection();

	public:
		TDENetworkInfinibandTransportMode::TDENetworkInfinibandTransportMode transportMode;
};

class TDECORE_EXPORT TDEVPNConnection : public TDENetworkConnection
{
	public:
		TDEVPNConnection();
		virtual ~TDEVPNConnection();

	public:
		TQString vpnPluginID;
		TQString lockedUserName;
		TDENetworkSettingsMap pluginData;
		bool secretsValid;
		TDENetworkSettingsMap pluginSecrets;
};

class TDECORE_EXPORT TDEWiMaxConnection : public TDENetworkConnection
{
	public:
		TDEWiMaxConnection();
		virtual ~TDEWiMaxConnection();

	public:
		TQString networkServiceProvider;
};

class TDECORE_EXPORT TDEVLANConnection : public TDENetworkConnection
{
	public:
		TDEVLANConnection();
		virtual ~TDEVLANConnection();

	public:
		TQString kernelName;
		TQString parentConnectionUUID;
		TQ_UINT32 vlanID;
		TDENetworkVLANFlags::TDENetworkVLANFlags vlanFlags;
		TDENetworkPriorityMap ingressPriorityMap;
		TDENetworkPriorityMap egressPriorityMap;
};

class TDECORE_EXPORT TDEOLPCMeshConnection : public TDENetworkConnection
{
	public:
		TDEOLPCMeshConnection();
		virtual ~TDEOLPCMeshConnection();

	public:
		TQByteArray SSID;
		TQ_INT32 channel;
		TQByteArray anycastDHCPHWAddress;
};

class TDECORE_EXPORT TDEBluetoothConnection : public TDENetworkConnection
{
	public:
		TDEBluetoothConnection();
		virtual ~TDEBluetoothConnection();

	public:
		TDEBluetoothConnectionType::TDEBluetoothConnectionType type;
};

class TDECORE_EXPORT TDEModemConnection : public TDENetworkConnection
{
	public:
		TDEModemConnection();
		virtual ~TDEModemConnection();

	public:
		TDEModemConnectionType::TDEModemConnectionType type;
		TDENetworkCDMAConfiguration cdmaConfig;
		TDENetworkGSMConfiguration gsmConfig;
};

typedef TQPtrList< TDENetworkConnection > TDENetworkConnectionList;

class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
{
	Q_OBJECT

	public:
		/**
		*  Constructor.
		*  @param macAddress The MAC address of the hardware device
		*  If an empty MAC address is passed, this object will make global networking backend
		*  methods available exclusively (TDENetworkDeviceType::BackendOnly).
		*/
		TDENetworkConnectionManager(TQString macAddress);
		
		/**
		* Destructor.
		*/
		~TDENetworkConnectionManager();

		/**
		* @return the MAC address of this device
		*/
		TQString deviceMACAddress();

		/**
		* @return the type of connection supported by this device
		*/
		virtual TDENetworkDeviceType::TDENetworkDeviceType deviceType() = 0;

		/**
		* @return A TDENetworkGlobalManagerFlags enum value with the current status of the networking backend.
		*/
		virtual TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags backendStatus() = 0;

		/**
		* @return A TDENetworkDeviceInformation object containing the current status of the network device.
		*/
		virtual TDENetworkDeviceInformation deviceInformation() = 0;

		/**
		* Loads all connection information from the configuration backend
		* Secret information must be loaded separately via a call to
		* loadConnectionSecrets(TQString uuid) after this method has been
		* executed at least once.
		*/
		virtual void loadConnectionInformation() = 0;

		/**
		* @param uuid a TQString conntaining the UUID of a connection for which to
		* load secrets from the configuration backend.
		* @return true on success, false on failure.
		*/
		virtual bool loadConnectionSecrets(TQString uuid) = 0;

		/**
		* @param connection a pointer to a TDENetworkConnection object containing a
		* connection to save to the configuration backend.
		* @return true on success, false on failure.
		*/
		virtual bool saveConnection(TDENetworkConnection* connection) = 0;

		/**
		* @param uuid a TQString conntaining the UUID of a connection to
		* delete from the configuration backend.
		* @return true on success, false on failure.
		*/
		virtual bool deleteConnection(TQString uuid) = 0;

		/**
		* Initiates a connection with UUID @param uuid.
		* @return A TDENetworkConnectionStatus enum value with the current connection status
		* The client application should poll for status updates using checkConnectionStatus()
		*/
		virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus initiateConnection(TQString uuid) = 0;

		/**
		* Checks the status of a connection with UUID @param uuid.
		* @return A TDENetworkConnectionStatus enum value with the current connection status
		*/
		virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus checkConnectionStatus(TQString uuid) = 0;

		/**
		* Disconnects a connection with UUID @param uuid.
		* @return A TDENetworkConnectionStatus enum value with the current connection status
		* The client application should poll for status updates using checkConnectionStatus()
		*/
		virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus deactivateConnection(TQString uuid) = 0;

		/**
		* @return a TDENetworkHWNeighborList object containing the result of a site survey;
		* i.e. all nearby access points or devices. This function only returns valid information
		* if the underlying network device supports site surveys.
		*
		* Note that the returned list is internally managed and must not be deleted!
		* Also note that pointers in the list may become invalid on subsequent calls to
		* siteSurvey().
		*/
		virtual TDENetworkHWNeighborList* siteSurvey() = 0;

		/**
		* @return a TQStringList containing the UUIDs of all physical devices used by this connection
		* This function may return an empty list if the connection is inactive, this behaviour is
		* dependend on the specific network backend in use.
		*/
		virtual TQStringList connectionPhysicalDeviceUUIDs(TQString uuid) = 0;

		/**
		* @return true if networking is enabled, false if not.
		*/
		virtual bool networkingEnabled() = 0;

		/**
		* @param enable true to enable networking, false to disable it.
		* @return true on success, false on failure.
		*/
		virtual bool enableNetworking(bool enable) = 0;

		/**
		* @return true if WiFi hardware is enabled, false if not.
		*/
		virtual bool wiFiHardwareEnabled() = 0;

		/**
		* @param enable true to enable WiFi, false to disable it.
		* @return true on success, false on failure.
		*/
		virtual bool enableWiFi(bool enable) = 0;

		/**
		* @return true if WiFi is enabled, false if not.
		*/
		virtual bool wiFiEnabled() = 0;

	signals:
		/**
		* Emitted whenever the state of the system's connection changes
		* If previous state data was unavailable, @param previousState will contain TDENetworkConnectionStatus::Invalid
		*/
		void networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags previousState);

		/**
		* Emitted whenever the state of a device changes
		* If previous state data was unavailable, @param previousState will contain TDENetworkConnectionStatus::Invalid
		* If the global connection state has changed, @param hwAddress will be empty, otherwise it will contain the MAC address
		* of the networking hardware that has changed state.
		*/
		void networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus previousState, TQString hwAddress);

	public:
		/**
		* @return a TDENetworkConnectionList object containing a list of all
		* possible connections this connection manager is aware of, regardless
		* of current state or availability.
		*
		* loadConnectionInformation() should be called at least once before calling
		* this method, in order to update internal connection information from the
		* configuration backend.
		*
		* Note that the returned list is internally managed and must not be deleted!
		* Also note that pointers in the list may become invalid on subsequent calls to
		* loadConnectionInformation(), saveConnection(), deleteConnection(), or connections().
		*/
		virtual TDENetworkConnectionList* connections();

		/**
		* @return a pointer to a TDENetworkConnection object with the specified @param uuid,
		* or a NULL pointer if no such connection exists.
		*
		* Note that the returned object is internally managed and must not be deleted!
		*/
		TDENetworkConnection* findConnectionByUUID(TQString uuid);

		/**
		* @return a pointer to a TDENetworkDevice object with the specified @param uuid,
		* or a NULL pointer if no such connection exists.
		*
		* Note that the returned object is internally managed and must not be deleted!
		*/
		TDENetworkDevice* findDeviceByUUID(TQString uuid);

	protected:
		void clearTDENetworkConnectionList();
		void clearTDENetworkHWNeighborList();
		void internalNetworkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState);
		void internalNetworkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TQString hwAddress=TQString::null);

	protected:
		TDENetworkConnectionList* m_connectionList;
		TDENetworkHWNeighborList* m_hwNeighborList;
		TQString m_macAddress;
		TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags m_prevConnectionStatus;
		TQMap<TQString, TDENetworkConnectionStatus::TDENetworkConnectionStatus> m_prevDeviceStatus;
};

class TDECORE_EXPORT TDEGlobalNetworkManager : public TQObject
{
	Q_OBJECT

	public:
		/**
		*  Constructor.
		*/
		TDEGlobalNetworkManager();
		
		/**
		* Destructor.
		*/
		~TDEGlobalNetworkManager();

		/**
		* @return A TDENetworkGlobalManagerFlags enum value with the current status of the networking backend.
		*/
		virtual TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags backendStatus();

		/**
		* Loads all connection information from the configuration backend
		* Secret information must be loaded separately via a call to
		* loadConnectionSecrets(TQString uuid) after this method has been
		* executed at least once.
		*/
		virtual void loadConnectionInformation();

		/**
		* @param uuid a TQString conntaining the UUID of a connection for which to
		* load secrets from the configuration backend.
		* @return true on success, false on failure.
		*/
		virtual bool loadConnectionSecrets(TQString uuid);

		/**
		* @param connection a pointer to a TDENetworkConnection object containing a
		* connection to save to the configuration backend.
		* @return true on success, false on failure.
		*/
		virtual bool saveConnection(TDENetworkConnection* connection);

		/**
		* @param uuid a TQString conntaining the UUID of a connection to
		* delete from the configuration backend.
		* @return true on success, false on failure.
		*/
		virtual bool deleteConnection(TQString uuid);

		/**
		* Initiates a connection with UUID @param uuid.
		* @return A TDENetworkConnectionStatus enum value with the current connection status
		* The client application should poll for status updates using checkConnectionStatus()
		*/
		virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus initiateConnection(TQString uuid);

		/**
		* Checks the status of a connection with UUID @param uuid.
		* @return A TDENetworkConnectionStatus enum value with the current connection status
		*/
		virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus checkConnectionStatus(TQString uuid);

		/**
		* Disconnects a connection with UUID @param uuid.
		* @return A TDENetworkConnectionStatus enum value with the current connection status
		* The client application should poll for status updates using checkConnectionStatus()
		*/
		virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus deactivateConnection(TQString uuid);

		/**
		* @return a TDENetworkHWNeighborList object containing the result of a site survey;
		* i.e. all nearby access points or devices. This function only returns valid information
		* if the underlying network device supports site surveys.
		*
		* Note that the returned list is internally managed and must not be deleted!
		* Also note that pointers in the list may become invalid on subsequent calls to
		* siteSurvey().
		*/
		virtual TDENetworkHWNeighborList* siteSurvey();

		/**
		* @return a TQStringList containing the UUIDs of all physical devices used by this connection
		* This function may return an empty list if the connection is inactive, this behaviour is
		* dependend on the specific network backend in use.
		*/
		virtual TQStringList connectionPhysicalDeviceUUIDs(TQString uuid);

		/**
		* @return true if networking is enabled, false if not.
		*/
		virtual bool networkingEnabled();

		/**
		* @param enable true to enable networking, false to disable it.
		* @return true on success, false on failure.
		*/
		virtual bool enableNetworking(bool enable);

		/**
		* @return true if WiFi hardware is enabled, false if not.
		*/
		virtual bool wiFiHardwareEnabled();

		/**
		* @param enable true to enable WiFi, false to disable it.
		* @return true on success, false on failure.
		*/
		virtual bool enableWiFi(bool enable);

		/**
		* @return true if WiFi is enabled, false if not.
		*/
		virtual bool wiFiEnabled();

	signals:
		/**
		* Emitted whenever the state of the system's connection changes
		* If previous state data was unavailable, @param previousState will contain TDENetworkConnectionStatus::Invalid
		*/
		void networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags previousState);

		/**
		* Emitted whenever the state of a device changes
		* If previous state data was unavailable, @param previousState will contain TDENetworkConnectionStatus::Invalid
		* If the global connection state has changed, @param hwAddress will be empty, otherwise it will contain the MAC address
		* of the networking hardware that has changed state.
		*/
		void networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus previousState, TQString hwAddress);

	public:
		/**
		* @return a TDENetworkConnectionList object containing a list of all
		* possible connections this connection manager is aware of, regardless
		* of current state or availability.
		*
		* loadConnectionInformation() should be called at least once before calling
		* this method, in order to update internal connection information from the
		* configuration backend.
		*
		* Note that the returned list is internally managed and must not be deleted!
		* Also note that pointers in the list may become invalid on subsequent calls to
		* loadConnectionInformation(), saveConnection(), deleteConnection(), or connections().
		*/
		virtual TDENetworkConnectionList* connections();

		/**
		* @return a pointer to a TDENetworkConnection object with the specified @param uuid,
		* or a NULL pointer if no such connection exists.
		*
		* Note that the returned object is internally managed and must not be deleted!
		*/
		TDENetworkConnection* findConnectionByUUID(TQString uuid);

		/**
		* @return a pointer to a TDENetworkDevice object with the specified @param uuid,
		* or a NULL pointer if no such connection exists.
		*
		* Note that the returned object is internally managed and must not be deleted!
		*/
		TDENetworkDevice* findDeviceByUUID(TQString uuid);

	private:
		TDENetworkConnectionManager* m_internalConnectionManager;
};

#endif // _TDENETWORKCONNECTIONS_H