summaryrefslogtreecommitdiffstats
path: root/knetworkmanager-0.8/src/knetworkmanager-connection_setting_8021x.h
blob: a5c593ea3ed25ef319667cfa2589ebebe146a328 (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
/***************************************************************************
 *
 * knetworkmanager-connection_setting_8021x.h - A NetworkManager frontend for KDE
 *
 * Copyright (C) 2005, 2006 Novell, Inc.
 *
 * Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 **************************************************************************/

#ifndef KNETWORKMANAGER_CONNECTION_SETTING_8021X_H
#define KNETWORKMANAGER_CONNECTION_SETTING_8021X_H

#include <stdint.h>
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvariant.h>
#include <tqobject.h>

#include <tqdbusdata.h>

#include "knetworkmanager-connection_setting.h"
#include "qbidirectionalmap.h"
/* NM */
#include <nm-setting-8021x.h>
#include <nm-setting-wireless.h>


class AccessPoint;

namespace ConnectionSettings
{

// setting for 802.1x parameters
class IEEE8021x : public ConnectionSetting
{
	public:

		enum EAP
		{
		  EAP_NONE = 0
		, EAP_LEAP
		, EAP_MD5
		, EAP_PAP
		, EAP_CHAP
		, EAP_MSCHAP
		, EAP_MSCHAPV2
		, EAP_FAST
		, EAP_PSK
		, EAP_PAX
		, EAP_SAKE
		, EAP_GPSK
		, EAP_TLS
		, EAP_PEAP
		, EAP_TTLS
		, EAP_SIM
		, EAP_GTC
		, EAP_OTP
		};

		enum EAP_PHASE1
		{
		  EAP_PHASE1_NONE = EAP_NONE
		, EAP_PHASE1_LEAP = EAP_LEAP
		, EAP_PHASE1_MD5 = EAP_MD5
		, EAP_PHASE1_TLS = EAP_TLS
		, EAP_PHASE1_PEAP = EAP_PEAP
		, EAP_PHASE1_TTLS = EAP_TTLS
		, EAP_PHASE1_SIM = EAP_SIM
		, EAP_PHASE1_FAST = EAP_FAST
		};

		enum EAP_PHASE2
		{
		  EAP_PHASE2_AUTH_NONE = EAP_NONE
		, EAP_PHASE2_AUTH_PAP = EAP_PAP
		, EAP_PHASE2_AUTH_CHAP = EAP_CHAP
		, EAP_PHASE2_AUTH_MSCHAP = EAP_MSCHAP
		, EAP_PHASE2_AUTH_MSCHAPV2 = EAP_MSCHAPV2
		, EAP_PHASE2_AUTH_GTC = EAP_GTC
		, EAP_PHASE2_AUTH_OTP = EAP_OTP
		, EAP_PHASE2_AUTH_MD5 = EAP_MD5
		, EAP_PHASE2_AUTH_TLS = EAP_TLS
		};

		enum EAP_PHASE2_AUTH_EAP
		{
		  EAP_PHASE2_AUTH_EAP_NONE = EAP_NONE
		, EAP_PHASE2_AUTH_EAP_MD5 = EAP_MD5
		, EAP_PHASE2_AUTH_EAP_MSCHAPV2 = EAP_MSCHAPV2
		, EAP_PHASE2_AUTH_EAP_OTP = EAP_OTP
		, EAP_PHASE2_AUTH_EAP_GTC = EAP_GTC
		, EAP_PHASE2_AUTH_EAP_TLS = EAP_TLS
		};

		enum PEAPVER
		{
			PEAPVER_0 = 0
		, PEAPVER_1
		};

		IEEE8021x(Connection* conn);

		SettingsMap toMap() const;
		void        fromMap(const SettingsMap&);

		SettingsMap toSecretsMap(bool with_settings = true) const;
		bool        fromSecretsMap(const SettingsMap&);

		// FIXME
		// multiple EAP methods are allowed
		EAP_PHASE1 getEAP(void) const;
		void     setEAP(EAP_PHASE1);

		EAP_PHASE2 getPhase2EAP(void) const;
		void       setPhase2EAP(EAP_PHASE2);

		TQString  getIdentity(void) const;
		void     setIdentity(const TQString&);

		TQString  getAnonIdentity(void) const;
		void     setAnonIdentity(const TQString&);

		TQString  getPassword(void) const;
		void     setPassword(const TQString&);

		// FIXME
		// ca cert

		TQString  getCaPath(void) const;
		void     setCaPath(TQString);

		bool     getUseSystemCaCert(void) const;
		void     setUseSystemCaCert(bool);

		//FIXME
		// client cert

		// FIXME
		// private key

		PEAPVER  getPhase1PeapVer(void) const;
		void     setPhase1PeapVer(PEAPVER);

		// get a list of allowed phase2 methods
		TQValueList<EAP_PHASE2> getAllowedPhase2Methods() const;

		bool     isValid() const;

	private:
		// settigs
		EAP_PHASE1          _eap;
		EAP_PHASE2          _eapPhase2;

		TQString             _identity;
		TQString             _anonIdentity;
		TQByteArray          _caCert;
		bool                _useSystemCaCert;
		TQString             _caPath;
		TQByteArray          _clientCert;
		TQByteArray          _privateKey;
		TQString             _phase1PeapVer;
		TQString             _phase1PeapLabel;
		TQString             _phase1FastProvisioning;
		TQString             _phase2AuthEAP;
		TQByteArray          _phase2CaCert;
		TQString             _phase2CaPath;
		TQByteArray          _phase2ClientCert;
		TQByteArray          _phase2PrivateKey;

		// secrets
		TQString             _password;
		TQString             _privateKeyPasswd;
		TQString             _phase2PrivateKeyPasswd;

		// map the different eap types (enum EAP) to their string representation
		TQBiDirectionalMap<EAP, TQString> _eapMap;
};

}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_8021X_H */