summaryrefslogtreecommitdiffstats
path: root/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security.h
blob: 187fd3705fdaadd02479f196dbd2cae319538236 (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
/***************************************************************************
 *
 * knetworkmanager-devicestore_dbus.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_WIRELESS_SECURITY_H
#define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_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-wireless-security.h>
#include <nm-setting-wireless.h>


class AccessPoint;

namespace ConnectionSettings
{

class WirelessSecurity;


// setting for wireless security parameters
class WirelessSecurity : public ConnectionSetting
{
	public:
		// bitwise or-able ciphers
		enum CIPHERS
		{
		  CIPHER_NONE   = 0
		, CIPHER_TKIP   = 1
		, CIPHER_CCMP   = 2
		, CIPHER_WEP40  = 4
		, CIPHER_WEP104 = 8
		, CIPHER_AUTO   = CIPHER_TKIP | CIPHER_CCMP
		};

		enum KEY_MGMT
		{
		  KEY_MGMT_NONE = 0
		, KEY_MGMT_IEEE8021X
		, KEY_MGMT_WPA_NONE
		, KEY_MGMT_WPA_PSK
		, KEY_MGMT_WPA_EAP
		};

		enum AUTH_ALG
		{
		  AUTH_ALG_NONE = 0
		, AUTH_ALG_OPEN
		, AUTH_ALG_SHARED
		, AUTH_ALG_LEAP
		};

		// bitwise or-able protos
		enum PROTO
		{
		  PROTO_NONE = 0
    , PROTO_AUTO = PROTO_NONE
		, PROTO_WPA
		, PROTO_RSN
		};

		WirelessSecurity(Connection* conn);
		SettingsMap toMap() const;
		void        fromMap(const SettingsMap&);

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

		uint32_t getGroupCiphers(void) const;
		void     setGroupCiphers(uint32_t);

		uint32_t getPairwiseCiphers(void) const;
		void     setPairwiseCiphers(uint32_t);

		KEY_MGMT getKeyMgmt(void) const;
		void     setKeyMgmt(KEY_MGMT);

		AUTH_ALG getAuthAlg(void) const;
		void     setAuthAlg(AUTH_ALG);

		uint32_t getProto(void) const;
		void     setProto(uint32_t);
		void     addProto(uint32_t);
		void     delProto(uint32_t);

		TQString  getPSK(void) const;
		void     setPSK(const TQString&);

		TQString  getLeapUsername(void) const;
		void     setLeapUsername(const TQString&);

		TQString  getLeapPassword(void) const;
		void     setLeapPassword(const TQString&);

		TQString  getWepKey(int) const;
		void     setWepKey(int, TQString);

		int      getWepTxidx() const;
		void     setWepTxidx(int);

		bool     isValid() const;
		bool     getEnabled() const;

	private:
		// settigs
		KEY_MGMT _keyMgmt;
		int     _wepTxKeyidx;
		AUTH_ALG _authAlg;
		uint32_t _proto;
		uint32_t _pairwise;
		uint32_t _group;
		TQString  _leapUsername;

		// secrets
		TQString _wepKey[4];
		TQString _psk;
		TQString _leapPassword;

		TQBiDirectionalMap<KEY_MGMT, TQString> _keyMgmtMap;
		TQBiDirectionalMap<AUTH_ALG, TQString> _authAlgMap;
		TQBiDirectionalMap<PROTO, TQString> _protoMap;
		TQBiDirectionalMap<CIPHERS, TQString> _cipherMap;
};

}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_H */