Release 2.0 beta
[framework/connectivity/libnet-client.git] / include / profile / network-pm-wlan.h
1 /*
2  *  Network Client Library
3  *
4 * Copyright 2012  Samsung Electronics Co., Ltd
5
6 * Licensed under the Flora License, Version 1.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9
10 * http://www.tizenopensource.org/license
11
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17  *
18  */
19
20
21 #ifndef __NETWORK_PM_WLAN_H__
22 #define __NETWORK_PM_WLAN_H__
23
24
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #endif /* __cplusplus */
29
30 /**  \file network-pm-wlan.h
31      \brief This file contains constants, enums, tructs, and function prototypes that are used by Wlan related sources internally. This File defines the WLAN exported Data Structures.
32
33 */
34
35 /**
36  * \addtogroup  profile_managing
37  * \{
38 */
39
40 /*
41 ==================================================================================================
42                                          INCLUDE FILES
43 ==================================================================================================
44 */
45
46 #include "network-pm-config.h"
47
48 /*
49 ==================================================================================================
50                                            CONSTANTS
51 ==================================================================================================
52 */
53
54 /** Length of essid */
55 #define NET_WLAN_ESSID_LEN      128
56
57
58 /** 
59  * Length of WPS PIN code 
60  * WPS PIN code should be 4 or 8 digits
61  */
62 #define NET_WLAN_MAX_WPSPIN_LEN         8       
63
64 /**
65  * Passphrase length should be between 8..63,
66  * If we plan to use encrypted key(hex value generated by wpa_passphrase),
67  * then we have to set this value to some higher number
68  *
69  */
70 #define NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN 65
71
72 /**
73  * Length of WEP Key
74  * Max of 10 Hex digits allowed in case of 64 bit encryption
75  * Max of 26 Hex digits allowed in case of 128 bit encryption
76  */
77 #define NETPM_WLAN_MAX_WEP_KEY_LEN        26
78
79
80 /**
81  * These lengths depends on authentication server being used,
82  * In case of freeradius server Max allowed length for username/password is 255
83  * Let us restrict this value to some optimal value say 50.
84  * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
85  */
86 #define NETPM_WLAN_USERNAME_LEN               50
87 /**
88  * These lengths depends on authentication server being used,
89  * In case of freeradius server Max allowed length for username/password is 255
90  * Let us restrict this value to some optimal value say 50.
91  * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
92  */
93 #define NETPM_WLAN_PASSWORD_LEN               50
94
95 /**
96  * length of CA Cert file name
97  * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
98  */
99 #define NETPM_WLAN_CA_CERT_FILENAME_LEN       50
100 /**
101  * length of Client Cert file name
102  * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
103  */
104 #define NETPM_WLAN_CLIENT_CERT_FILENAME_LEN   50
105 /**
106  * length of private key file name
107  * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
108  */
109 #define NETPM_WLAN_PRIVATE_KEY_FILENAME_LEN   50
110 /**
111  * length of Private key password
112  * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
113  */
114 #define NETPM_WLAN_PRIVATE_KEY_PASSWD_LEN     50
115
116 /*==================================================================================================
117                                              ENUMS
118 ==================================================================================================*/
119
120 /**
121  * @enum wlan_security_mode_type_t
122  * Below security modes are used in infrastructure and ad-hoc mode
123  * For now all EAP security mechanisms are provided only in infrastructure mode
124  */
125 typedef enum
126 {
127         /** Security disabled */
128         WLAN_SEC_MODE_NONE = 0x01,
129         /** WEP */
130         WLAN_SEC_MODE_WEP,
131         /** EAP */
132         WLAN_SEC_MODE_IEEE8021X,
133         /** WPA-PSK */
134         WLAN_SEC_MODE_WPA_PSK,
135         /** WPA2-PSK */
136         WLAN_SEC_MODE_WPA2_PSK,
137 } wlan_security_mode_type_t;
138
139 /**
140  * @enum wlan_encryption_mode_type_t
141  * Below encryption modes are used in infrastructure and ad-hoc mode
142  */
143 typedef enum
144 {
145         /** Encryption disabled */
146         WLAN_ENC_MODE_NONE = 0x01,
147         /** WEP */
148         WLAN_ENC_MODE_WEP,
149         /** TKIP */
150         WLAN_ENC_MODE_TKIP,
151         /** AES */
152         WLAN_ENC_MODE_AES,
153         /** TKIP and AES are both supported */
154         WLAN_ENC_MODE_TKIP_AES_MIXED,
155 } wlan_encryption_mode_type_t;
156
157 /**
158  * @enum wlan_connection_mode_type_t
159  * WLAN Operation Mode
160  * @see net_pm_wlan_profile_info_t
161  */
162 typedef enum
163 {
164         /** auto connection mode */
165         NETPM_WLAN_CONNMODE_AUTO = 0x01,
166         /** Connection mode Adhoc  */
167         NETPM_WLAN_CONNMODE_ADHOC,
168         /** Infra connection mode */
169         NETPM_WLAN_CONNMODE_INFRA,
170 } wlan_connection_mode_type_t;
171
172
173 /**
174  * @enum wlan_eap_type_t
175  * EAP type
176  * @see wlan_eap_info_t
177  */
178 typedef enum {
179         /** EAP PEAP type */
180         WLAN_SEC_EAP_TYPE_PEAP = 0x01,
181         /** EAP TLS type */
182         WLAN_SEC_EAP_TYPE_TLS,
183         /** EAP TTLS type */
184         WLAN_SEC_EAP_TYPE_TTLS,
185         /** EAP SIM type */
186         WLAN_SEC_EAP_TYPE_SIM,
187         /** EAP AKA type */
188         WLAN_SEC_EAP_TYPE_AKA,
189 } wlan_eap_type_t;
190
191 /**
192  * @enum wlan_eap_auth_type_t
193  * EAP phase2 authentication type
194  * @see wlan_eap_info_t
195  */
196 typedef enum {
197         /** EAP phase2 authentication none */
198         WLAN_SEC_EAP_AUTH_NONE = 0x01,
199         /** EAP phase2 authentication PAP */
200         WLAN_SEC_EAP_AUTH_PAP,
201         /** EAP phase2 authentication MSCHAP */
202         WLAN_SEC_EAP_AUTH_MSCHAP,
203         /** EAP phase2 authentication MSCHAPv2 */
204         WLAN_SEC_EAP_AUTH_MSCHAPV2,
205         /** EAP phase2 authentication GTC */
206         WLAN_SEC_EAP_AUTH_GTC,
207         /** EAP phase2 authentication MD5 */
208         WLAN_SEC_EAP_AUTH_MD5,
209 } wlan_eap_auth_type_t;
210
211 /*
212 ==================================================================================================
213                                             MACROS
214 ==================================================================================================
215 */
216
217
218 /*==================================================================================================
219                                  STRUCTURES AND OTHER TYPEDEFS
220 ==================================================================================================*/
221
222 /**
223  * Below structure is used to export essid
224  */
225 typedef struct
226 {
227         /** ESSID */
228         char essid[NET_WLAN_ESSID_LEN+1];
229 } net_essid_t;
230
231
232 /**
233  * Below structure is used by WPA-PSK or WPA2-PSK
234  * @remark To see the maximum length of PSK passphrase key.
235  * @see wlan_auth_info_t
236  */
237 typedef struct
238 {
239         /** key value for WPA-PSK or WPA2-PSK */
240         char pskKey[NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN + 1];
241 } wlan_psk_info_t;
242
243
244 /**
245  * Below structure is used by WEP
246  * @remark To see the maximum length of WEP key.
247  * @see wlan_auth_info_t
248  */
249 typedef struct
250 {
251         /** key value for WEP */
252         char wepKey[NETPM_WLAN_MAX_WEP_KEY_LEN + 1];
253 } wlan_wep_info_t;
254
255
256 /**
257  * Below structure is used by EAP
258  * @see wlan_auth_info_t
259  */
260 typedef struct
261 {
262         /** User name */
263         char username[NETPM_WLAN_USERNAME_LEN+1];
264         /** Password */
265         char password[NETPM_WLAN_PASSWORD_LEN+1];
266
267         /**
268          * Following fields are mandatory for EAP-TLS,
269          * Optional for EAP-TTLS and EAP-PEAP
270          */
271         /**
272          * For EAP-TTLS and EAP-PEAP only ca_cert_filename[] can also be provided
273          */
274         char ca_cert_filename[NETPM_WLAN_CA_CERT_FILENAME_LEN+1]; /* Used to authenticate server */
275         /** client certificate file name */
276         char client_cert_filename[NETPM_WLAN_CLIENT_CERT_FILENAME_LEN+1];
277         /** private key file name */
278         char private_key_filename[NETPM_WLAN_PRIVATE_KEY_FILENAME_LEN+1];
279         /** private key password */
280         char private_key_passwd[NETPM_WLAN_PRIVATE_KEY_PASSWD_LEN+1];
281
282         /** eap type */
283         wlan_eap_type_t eap_type;
284         /** eap phase2 authentication type */
285         wlan_eap_auth_type_t eap_auth;
286 } wlan_eap_info_t;
287
288
289 /**
290  * At any point of time only one security mechanism is supported
291  * @see wlan_security_info_t
292  */
293 typedef union
294 {
295         /** Wep Authentication */
296         wlan_wep_info_t wep;
297         /** psk Authentication */
298         wlan_psk_info_t psk;
299         /** eap Authentication */
300         wlan_eap_info_t eap;
301 } wlan_auth_info_t;
302
303
304 /**
305  * This is main security information structure
306  * @see net_pm_wlan_profile_info_t
307  */
308 typedef struct
309 {
310         /** security mode type */
311         wlan_security_mode_type_t sec_mode;
312         /** encryption mode type */
313         wlan_encryption_mode_type_t enc_mode;
314         /** authentication information */
315         wlan_auth_info_t authentication;
316         /** If WPS is supported, then this property will be set to TRUE */
317         char wps_support;
318 } wlan_security_info_t;
319
320
321 /**
322  * AP Profile information
323  */
324 typedef struct
325 {
326         /** ESSID */
327         char essid[NET_WLAN_ESSID_LEN+1];
328         /** Basic service set identification */
329         char bssid[NET_MAX_MAC_ADDR_LEN+1];
330         /**  Strength : between 0 and 100 */
331         unsigned char Strength;
332         /** Frequency band(MHz) */
333         unsigned int frequency;
334         /** Maximum speed of the line(bps) */
335         unsigned int max_rate;
336         /** If a passphrase has been set already or if no
337                 passphrase is needed, then this property will
338                 be set to FALSE. */
339         char PassphraseRequired;
340         /** Infrastucture / ad-hoc / auto mode */
341         wlan_connection_mode_type_t wlan_mode;
342         /** Security mode and authentication info */
343         wlan_security_info_t security_info;
344
345         /** network information */
346         net_dev_info_t net_info;
347 } net_wifi_profile_info_t;
348
349 /**
350  * \}
351  */
352
353 #ifdef __cplusplus
354 }
355 #endif /* __cplusplus */
356
357 #endif /* __NETPM_WLAN_H__ */
358
359