apply FSL(Flora Software License)
[framework/connectivity/libnet-client.git] / include / profile / network-pm-config.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.tizenopensource.org/license
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #ifndef __NETWORK_PM_CONFIG_H__
19 #define __NETWORK_PM_CONFIG_H__
20
21
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif /* __cplusplus */
26
27 /**
28  * @file network-pm-config.h
29  * @brief This file defines the constants and enumerations used by Profile Manager with the application/Connection Manager.
30 */
31
32 /**
33  * \addtogroup  profile_managing
34  * \{
35 */
36
37 /*==================================================================================================
38                                          INCLUDE FILES
39 ==================================================================================================*/
40
41 #include <netinet/in.h>
42
43 #include "network-cm-error.h"
44
45 /*==================================================================================================
46                                            CONSTANTS
47 ==================================================================================================*/
48
49 /** Profile name max length */
50 #define NET_PROFILE_NAME_LEN_MAX 512
51
52 /** Home URL max length in profile account */
53 #define NET_HOME_URL_LEN_MAX 512
54
55 /** Maximum length of IPv4 string type e.g., "165.213.173.105". This length does not include NULL in the last byte. */
56 #define NETPM_IPV4_STR_LEN_MAX 15
57
58 /** Minimum length of IPv4 string type e.g., "0.0.0.0". This length does not include NULL in the last byte. */
59 #define NETPM_IPV4_STR_LEN_MIN 7
60
61 /** This is for MCC + MNC string */
62 #define NET_SIM_INFO_LEN 10
63
64 /** Maximum length of username in PDP profile. (used in authentication parameters) [3GPP Defined variable] */
65 #define NET_PDP_AUTH_USERNAME_LEN_MAX 32 
66
67 /** Maximum length of password in PDP profile (used in authentication parameters) [3GPP Defined variable] */
68 #define NET_PDP_AUTH_PASSWORD_LEN_MAX 32
69
70 /** Maximum length of APN in PDP profile [3GPP Defined variable] */
71 #define NET_PDP_APN_LEN_MAX 100
72
73 /** Maximum length of proxy string */
74 #define NET_PROXY_LEN_MAX 64
75
76 /** MAX number of DNS Address */
77 #define NET_DNS_ADDR_MAX 2
78
79 /** Maximum length of device name  */
80 #define NET_MAX_DEVICE_NAME_LEN 32
81
82 /** Maximum length of MAC address  */
83 #define NET_MAX_MAC_ADDR_LEN 32
84
85 /*==================================================================================================
86                                              ENUMS
87 ==================================================================================================*/
88
89 /**
90  * @enum net_device_t
91  * Profile Type
92  */
93 typedef enum
94 {
95         /** Unknown device */
96         NET_DEVICE_UNKNOWN = 0x0,
97
98         /** Default device */
99         NET_DEVICE_DEFAULT = 0x1,
100
101         /** GPRS & WCDMA device */
102         NET_DEVICE_CELLULAR = 0x2,
103
104         /** WLAN device */
105         NET_DEVICE_WIFI = 0x3,
106
107         /** Serial USB device */
108         NET_DEVICE_USB = 0x4,
109
110         /** Count of device type */
111         NET_DEVICE_MAX = 0x5,
112 } net_device_t;
113
114 /**
115  * @enum net_addr_type_t
116  * Address Type
117  */
118 typedef enum
119 {
120
121         /** IPV4 Address type */
122         NET_ADDR_IPV4 = 0x0,
123
124         /** IPV6 Address type */
125         NET_ADDR_IPV6 = 0x1,
126 } net_addr_type_t;
127
128 /**
129  * @enum net_auth_type_t
130  * PDP Authentication Type
131  */
132 typedef enum
133 {
134
135         /** No authentication */
136         NET_PDP_AUTH_NONE       = 0x0,
137
138         /** PAP authentication */
139         NET_PDP_AUTH_PAP        = 0x1,
140
141         /** CHAP authentication */
142         NET_PDP_AUTH_CHAP       = 0x2,
143 } net_auth_type_t;
144
145 /**
146  * @enum net_proxy_type_t
147  * This enumeration defines the proxy method type.
148  */
149 typedef enum
150 {
151         /** Not defined */
152         NET_PROXY_TYPE_UNKNOWN  = 0x00, 
153         /** Direct connection */
154         NET_PROXY_TYPE_DIRECT = 0x01,
155         /** Auto configuration(Use PAC file)
156          *  If URL property is not set, DHCP/WPAD auto-discover will be tried */
157         NET_PROXY_TYPE_AUTO = 0x02,
158         /** Manual configuration */
159         NET_PROXY_TYPE_MANUAL= 0x03,
160 } net_proxy_type_t;
161
162 /**
163 * @enum net_service_type_t
164 * This enum indicates network connection type
165 */
166 typedef enum
167 {
168         /** Unknown type \n
169         */
170         NET_SERVICE_UNKNOWN = 0x00,
171
172         /** Mobile Internet Type \n
173                 Network connection is established in Cellular network for Internet \n
174         */
175         NET_SERVICE_INTERNET = 0x01,
176
177         /** Mobile MMS Type \n
178                 Network connection is established in Cellular network for MMS \n
179         */
180         NET_SERVICE_MMS = 0x02,
181
182         /** Mobile WAP Type \n
183                 Network connection is established in Cellular network for WAP \n
184         */
185         NET_SERVICE_WAP = 0x03,
186
187         /** Prepaid Mobile Internet Type \n
188                 Network connection is established in Cellular network for prepaid internet service.\n
189                 This service supports to establish network connection in prepaid sim case\n
190         */
191         NET_SERVICE_PREPAID_INTERNET = 0x04,
192
193         /** Prepaid Mobile MMS Type \n
194                 Network Connection is established in Cellular network for prepaid MMS service. \n
195                 This profile supports to establish network connection in prepaid sim case\n
196         */
197         NET_SERVICE_PREPAID_MMS = 0x05,
198 } net_service_type_t;
199
200
201 /**
202  * @enum net_ip_config_type_t
203  * Net IP configuration Type
204  */
205 typedef enum
206 {
207         /** Manual IP configuration */
208         NET_IP_CONFIG_TYPE_STATIC = 0x01,
209
210         /** Config ip using DHCP client*/
211         NET_IP_CONFIG_TYPE_DYNAMIC,
212
213         /** Config IP from Auto IP pool (169.254/16)
214          * Later with DHCP client, if available */
215         NET_IP_CONFIG_TYPE_AUTO_IP,
216
217         /** Indicates an IP address that can not be modified */
218         NET_IP_CONFIG_TYPE_FIXED,
219
220         /** Don't use any method */
221         NET_IP_CONFIG_TYPE_OFF,
222 } net_ip_config_type_t;
223
224 /*==================================================================================================
225                                  STRUCTURES AND OTHER TYPEDEFS
226 ==================================================================================================*/
227
228 /**
229  * IP Address
230  */
231 typedef union
232 {
233         /** IP Version 4 address */
234         struct in_addr           Ipv4;
235
236         /** IP Version 6 address */
237         struct in6_addr          Ipv6;
238 } ip_addr_t;
239
240 /**
241  * Network Address information
242  */
243 typedef struct
244 {
245         /** Address Type: IPv4 or IPv6 */
246         net_addr_type_t Type;
247
248         /** IP Address */
249         ip_addr_t Data;
250 } net_addr_t;
251
252 /**
253  * Below structure is used to export proxy info
254  */
255 typedef struct
256 {
257         /** Proxy info */
258         char                    proxy_addr[NET_PROXY_LEN_MAX+1];
259 } net_proxy_t;
260
261 /**
262  * Below structure is used to export profile name
263  */
264 typedef struct
265 {
266         /** Profile name */
267         char                    ProfileName[NET_PROFILE_NAME_LEN_MAX+1];
268 } net_profile_name_t;
269
270 /**
271  * PDP Authentication Information
272  */
273 typedef struct
274 {
275         /** Authentication type  */
276         net_auth_type_t         AuthType;
277
278         /** UserName to be used during authentication */
279         char                    UserName[NET_PDP_AUTH_USERNAME_LEN_MAX+1];
280
281         /** Password to be used during authentication */
282         char                    Password[NET_PDP_AUTH_PASSWORD_LEN_MAX+1];
283 } net_auth_info_t;
284
285 /**
286  * Device Info in Connect response event
287  */
288 typedef struct
289 {
290         /** Profile Name of the connection link */
291         char            ProfileName[NET_PROFILE_NAME_LEN_MAX+1];
292
293         /** Device Name of the connection link */
294         char            DevName[NET_MAX_DEVICE_NAME_LEN+1];
295
296         /** Dns Server Address of the connection link */
297         net_addr_t      DnsAddr[NET_DNS_ADDR_MAX];
298         /** No of DNS Address for the connection link */
299         int                     DnsCount;
300
301         /** Net IP configuration Type */
302         net_ip_config_type_t IpConfigType;
303
304         /** IP Address for the connection link */
305         net_addr_t      IpAddr;
306         /** Whether subnet mask present or not. */
307         char            BNetmask;
308         /** Subnet mask */
309         net_addr_t      SubnetMask;
310         /** Whether gateway address present or not */
311         char            BDefGateway;
312         /** Gateway address */
313         net_addr_t      GatewayAddr;
314
315         /** Proxy Method type */
316         net_proxy_type_t        ProxyMethod;
317         /** Proxy address */
318         char            ProxyAddr[NET_PROXY_LEN_MAX+1];
319
320         /** MAC address */
321         char            MacAddr[NET_MAX_MAC_ADDR_LEN+1];
322 } net_dev_info_t;
323
324 /**
325  * \}
326  */
327
328 #ifdef __cplusplus
329 }
330 #endif /* __cplusplus */
331
332 #endif
333
334