Add some types for cellular pdn
[platform/core/connectivity/libnet-client.git] / include / profile / network-pm-intf.h
1 /*
2  * Network Client Library
3  *
4  * Copyright 2012 Samsung Electronics Co., Ltd
5  *
6  * Licensed under the Flora License, Version 1.1 (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 #ifndef __NETWORK_PM_INTF_H__
21 #define __NETWORK_PM_INTF_H__
22
23 #include "network-pm-wlan.h"
24
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #endif /* __cplusplus */
29
30 #ifndef DEPRECATED
31 #define DEPRECATED __attribute__((deprecated))
32 #endif
33
34 /**
35  * @file network-pm-intf.h
36  * @brief This file defines the interface of Profile Manager with the application/Connection Manager.
37 */
38
39 /**
40  * \addtogroup  profile_managing
41  * \{
42 */
43
44 /*==================================================================================================
45                                            CONSTANTS
46 ==================================================================================================*/
47
48 /*==================================================================================================
49                                              ENUMS
50 ==================================================================================================*/
51
52 /**
53  * @enum net_pdp_type_t
54  * This enumeration defines the pdp protocol type.
55  */
56 typedef enum
57 {
58         /** Not defined */
59         NET_PDP_TYPE_NONE       = 0x00,
60         /** PDP-GPRS type */
61         NET_PDP_TYPE_GPRS,
62         /** PDP-EDGE type */
63         NET_PDP_TYPE_EDGE,
64         /** PDP-UMTS type */
65         NET_PDP_TYPE_UMTS,
66 } net_pdp_type_t;
67
68 /**
69  * @enum net_pdn_type_e
70  * This enumeration defines the pdn type.
71  */
72 typedef enum
73 {
74         NET_PDN_TYPE_UNKNOWN    = 0x00,
75         NET_PDN_TYPE_IPV4               = 0x02,
76         NET_PDN_TYPE_IPV6               = 0x05,
77         NET_PDN_TYPE_IPV4_IPV6  = 0x06,
78 } net_pdn_type_e;
79
80 /**
81  * @enum net_state_type_t
82  * This enumeration defines the service state type.
83  */
84 typedef enum
85 {
86         /** Not defined */
87         NET_STATE_TYPE_UNKNOWN  = 0x00,
88         /** Idle state */
89         NET_STATE_TYPE_IDLE,
90         /** Failure state */
91         NET_STATE_TYPE_FAILURE,
92         /** Association state */
93         NET_STATE_TYPE_ASSOCIATION,
94         /** Configuration state */
95         NET_STATE_TYPE_CONFIGURATION,
96         /** Ready state */
97         NET_STATE_TYPE_READY,
98         /** Online state */
99         NET_STATE_TYPE_ONLINE,
100         /** Login state */
101         NET_STATE_TYPE_DISCONNECT,
102 } net_state_type_t;
103
104 /**
105  * @enum net_state_error_type_t
106  * This enumeration defines the service error state type.
107  */
108 typedef enum
109 {
110         NET_STATE_ERROR_NONE                    = 0x00,
111         NET_STATE_ERROR_OUT_OF_RANGE    = 0x01,
112         NET_STATE_ERROR_PIN_MISSING             = 0x02,
113         NET_STATE_ERROR_DHCP_FAILED             = 0x03,
114         NET_STATE_ERROR_CONNECT_FAILED  = 0x04,
115         NET_STATE_ERROR_LOGIN_FAILED    = 0x05,
116         NET_STATE_ERROR_AUTH_FAILED             = 0x06,
117         NET_STATE_ERROR_INVALID_KEY             = 0x07,
118 } net_error_state_type_t;
119
120 /*==================================================================================================
121                                  STRUCTURES AND OTHER TYPEDEFS
122 ==================================================================================================*/
123
124
125 /**
126  * Profile data structures: Used between Application and PM Plug-in Interface
127  */
128 typedef struct
129 {
130         /** Specifies a protocol type */
131         net_pdp_type_t  ProtocolType;
132         /** Specifies a pdn type */
133         net_pdn_type_e  PdnType;
134         /** Specifies a roam pdn type */
135         net_pdn_type_e  RoamPdnType;
136         /** Specifies a service type(Internet, MMS, WAP, etc...) */
137         net_service_type_t ServiceType;
138         /** Network Access Point Name */
139         char            Apn[NET_PDP_APN_LEN_MAX+1];
140         /** Authentication info of the PDP profile */
141         net_auth_info_t AuthInfo;
142         /** Browser Home URL or MMS server URL */
143         char            HomeURL[NET_HOME_URL_LEN_MAX+1];
144         /** Sim Info Mcc */
145         char Mcc[NET_SIM_INFO_LEN+1];
146         /** Sim Info Mnc */
147         char Mnc[NET_SIM_INFO_LEN+1];
148         /** Indicates whether the use of static IP or not */
149         char IsStatic;
150
151         /** Indicates Roaming mode */
152         char Roaming;
153         /** This will be deprecated */
154         char SetupRequired;
155
156         char Keyword[NET_PDP_APN_LEN_MAX+1];
157         char Hidden;
158         char Editable;
159         char DefaultConn;
160
161         /** Modem object path for PS cellular profile */
162         char                    PSModemPath[NET_PROFILE_NAME_LEN_MAX + 1];
163
164         /** network information */
165         net_dev_info_t net_info;
166 } net_pdp_profile_info_t;
167
168 /**
169  * Profile data structures: Ethernet Interface
170  */
171 typedef struct
172 {
173         /** network information */
174         net_dev_info_t net_info;
175 } net_eth_profile_info_t;
176
177 /**
178  * Profile data structures: Bluetooth Interface
179  */
180 typedef struct
181 {
182         /** network information */
183         net_dev_info_t net_info;
184 } net_bt_profile_info_t;
185
186 /**
187  * Specific profile information related to each technology type
188  */
189 typedef union
190 {
191         /** PDP Profile Information */
192         net_pdp_profile_info_t          Pdp;
193         /** Wifi Profile Information */
194         net_wifi_profile_info_t         Wlan;
195         /** Ethernet Profile Information */
196         net_eth_profile_info_t          Ethernet;
197         /** Bluetooth Profile Information */
198         net_bt_profile_info_t           Bluetooth;
199 } net_specific_profile_info_t;
200
201 /**
202  * This is the profile structure exposed to applications.
203  */
204 typedef struct
205 {
206         /** Device Type of the profile */
207         net_device_t                            profile_type;
208         /** Profile name */
209         char                                            ProfileName[NET_PROFILE_NAME_LEN_MAX+1];
210         /** Specific profile information */
211         net_specific_profile_info_t     ProfileInfo;
212         /** Service state */
213         net_state_type_t                        ProfileState;
214         /** Service error state */
215         net_error_state_type_t          ProfileErrorState;
216         /** Favourite flag */
217         char                                            Favourite;
218 } net_profile_info_t;
219
220 /*
221 ==================================================================================================
222                                      FUNCTION PROTOTYPES
223 ==================================================================================================
224 */
225
226 /*****************************************************************************************/
227 /* net_add_profile API function prototype
228  * int net_add_profile(net_service_type_t network_type, net_profile_info_t *prof_info);
229  */
230
231 /**
232  * \brief       Add new Profile.
233  *
234  * \par Sync (or) Async:
235  * This is a Synchronous API.
236  *
237  * \par Important Notes:
238  *
239  * \warning
240  *  None
241  *
242  * \param[in]   network_type  A type of network service.
243  * \param[in]   prof_info     A pointer of New created Profile Information to be added.
244  *
245  * \par Async Response Message:
246  *        None.
247  *
248  * \return Return Type (int) \n
249  * - NET_ERR_NONE  - indicating that the operation has completed successfully. \n
250  * - NET_ERR_INVALID_PARAM - Invalid parameter\n
251  * - NET_ERR_UNKNOWN - Any other error\n
252  * - NET_ERR_APP_NOT_REGISTERED - Client is invalid may be unregistered\n
253  *
254  * \par Prospective Clients:
255  * Network Connection Setting Applet, WLAN Setting UI Applet.
256  *
257  * \par Example of how this function would be called:
258  *
259  * net_profile_info_t prof_info;\n
260  * int result;\n
261  * result = net_add_profile(NET_SERVICE_MMS, &prof_info);\n
262  * if(result == NET_ERR_NONE)
263  *
264 ******************************************************************************************/
265 int net_add_profile(net_service_type_t network_type, net_profile_info_t *prof_info);
266
267 /*****************************************************************************************/
268
269 /* net_reset_profile API function prototype
270  * int net_reset_profile(int type, int sim_id);
271  */
272
273 /**
274  * \brief       Reset to default Profile.
275  *              (0 : Return to Default , 1: Delete profile)
276  *
277  * \par Sync (or) Async:
278  * This is a Asynchronous API.
279  *
280  * \par Important Notes:
281  *
282  * \warning
283  *  None
284  *
285  * \param[in]   type        Reset style
286  *
287  * \par Async Response Message:
288  *        None.
289  *
290  * \return Return Type (int) \n
291  * - NET_ERR_NONE  - indicating that the operation has completed successfully.
292  * - NET_ERR_INVALID_PARAM - Invalid parameter
293  * - NET_ERR_UNKNOWN - Any other error
294  * - NET_ERR_IN_PROGRESS - Already in progress
295  * - NET_ERR_APP_NOT_REGISTERED - Client is invalid may be unregistered
296  *
297  * \par Prospective Clients:
298  * Network Connection Setting Applet, WLAN Setting UI Applet.
299  *
300  * \par Example of how this function would be called:
301  *
302  * int result;\n
303  *
304  * result = net_delete_profile(profile_name);
305  *
306  * if (result == NET_ERR_NONE)
307  *
308 ******************************************************************************************/
309 int net_reset_profile(int type, int sim_id);
310
311 /*****************************************************************************************/
312
313 /* net_delete_profile API function prototype
314  * int net_delete_profile(const char* profile_name);
315  */
316
317 /**
318  * \brief       Delete a specific existing Profile.
319  *              (cellular : Delete profile, wifi : forgot AP)
320  *
321  * \par Sync (or) Async:
322  * This is a Synchronous API.
323  *
324  * \par Important Notes:
325  *
326  * \warning
327  *  None
328  *
329  * \param[in]   profile_name        Profile name to be deleted.
330  *
331  * \par Async Response Message:
332  *        None.
333  *
334  * \return Return Type (int) \n
335  * - NET_ERR_NONE  - indicating that the operation has completed successfully.
336  * - NET_ERR_INVALID_PARAM - Invalid parameter
337  * - NET_ERR_UNKNOWN - Any other error
338  * - NET_ERR_APP_NOT_REGISTERED - Client is invalid may be unregistered
339  *
340  * \par Prospective Clients:
341  * Network Connection Setting Applet, WLAN Setting UI Applet.
342  *
343  * \par Example of how this function would be called:
344  *
345  * int result;\n
346  *
347  * result = net_delete_profile(profile_name);
348  *
349  * if (result == NET_ERR_NONE)
350  *
351 ******************************************************************************************/
352 int net_delete_profile(const char *profile_name);
353
354 /*****************************************************************************************/
355 /* net_get_profile_info API function prototype
356  * int net_get_profile_info(const char *profile_name, net_profile_info_t *prof_info);
357  */
358
359 /**
360  * \brief       Return the profile information referred by Profile Name.
361  *
362  * \par Sync (or) Async:
363  * This is a Synchronous API.
364  *
365  * \par Important Notes:
366  *              On success, profile information shall be copied to prof_info parameter in net_profile_info_t format.
367  *              If profile doesn't exist, error shall be returned.
368  *
369  * \warning
370  *  None
371  *
372  * \param[in]   profile_name  Profile Identifier.
373  * \param[out]  prof_info     Buffer containing the profile.
374  *
375  * \par Async Response Message:
376  *        None.
377  *
378  * \return Return Type (int) \n
379  * - NET_ERR_NONE  - indicating that the operation has completed successfully. \n
380  * - NET_ERR_INVALID_PARAM - Invalid parameter\n
381  * - NET_ERR_UNKNOWN - Any other error\n
382  * - NET_ERR_APP_NOT_REGISTERED - Client is invalid may be unregistered\n
383  *
384  * \par Prospective Clients:
385  * Profile Manager.
386  *
387  * \par Example of how this function would be called:
388  *
389  * net_profile_info_t prof_info;\n
390  * int result;\n
391  *
392  * result = net_get_profile_info(profile_name, &prof_info);\n
393  *
394  * if (result == NET_ERR_NONE)\n
395  *
396 ******************************************************************************************/
397 int net_get_profile_info(const char *profile_name, net_profile_info_t *prof_info);
398
399 /*****************************************************************************************/
400 /* net_modify_profile API function prototype
401  * int net_modify_profile(const char* profile_name, net_profile_info_t* prof_info);
402  */
403
404 /**
405  * \brief       Edit a specific existing Profile.
406  *
407  * \par Sync (or) Async:
408  * This is a Synchronous API.
409  *
410  * \par Important Notes:
411  *
412  * \warning
413  *  None
414  *
415  * \param[in]  profile_name  Profile Identifier.
416  * \param[in]  prof_info     Changed Profile Information to be updated.
417  *
418  *
419  * \par Async Response Message:
420  *        None.
421  *
422  * \return Return Type (int) \n
423  * - NET_ERR_NONE  - indicating that the operation has completed successfully. \n
424  * - NET_ERR_INVALID_PARAM - Invalid parameter\n
425  * - NET_ERR_UNKNOWN - Any other error\n
426  * - NET_ERR_APP_NOT_REGISTERED - Client is invalid may be unregistered\n
427  *
428  * \par Prospective Clients:
429  * Network Connection Setting Applet.
430  *
431  * \par Example of how this function would be called:
432  *
433  * net_profile_info_t prof_info;\n
434  * int result;\n
435  *
436  * result = net_get_profile_info(profile_name, &prof_info);\n
437  * ......(Modifying ProfInfo)\n
438  *
439  * result = net_modify_profile(profile_name, &prof_info);\n
440  *
441  * if (result == NET_ERR_NONE)\n
442  *
443 ******************************************************************************************/
444 int net_modify_profile(const char *profile_name, net_profile_info_t *prof_info);
445
446 /*****************************************************************************************/
447 /**
448  * @fn   int net_get_profile_list(net_device_t device_type, net_profile_info_t **profile_list, int *count)
449  *
450  * This function request service list to ConnMan through dbus.
451  *
452  * \par Sync (or) Async:
453  * This is a Synchronous API.
454  *
455  * \param[in]   device_type     Type of device
456  * \param[out]  profile_list    Profile list. After use this, it should be free()
457  * \param[out]  count           Number of profile
458  *
459  * \return Return Type (int) \n
460  * - NET_ERR_NONE  - indicating that the operation has completed successfully. \n
461  * - NET_ERR_INVALID_PARAM - Invalid parameter\n
462  * - NET_ERR_UNKNOWN - Any other error\n
463  * - NET_ERR_APP_NOT_REGISTERED - Client is invalid may be unregistered\n
464  *
465  * \par Prospective Clients:
466  * External Apps.
467  *
468 ******************************************************************************************/
469 int net_get_profile_list(net_device_t device_type, net_profile_info_t **profile_list, int *count);
470
471 /*****************************************************************************************/
472 /**
473  * This function sets the default profile which provides the given cellular service.
474  *
475  * \par Sync (or) Async:
476  * This is a Synchronous API.
477  *
478  * \param[in]   profile_name    Profile Identifier.
479  *
480  * \par Prospective Clients:
481  * External Apps.
482  *
483 ******************************************************************************************/
484 int net_set_default_cellular_service_profile(const char *profile_name);
485
486 /*****************************************************************************************/
487 /**
488  * This function sets the default profile which provides the given cellular service.
489  *
490  * \par Sync (or) Async:
491  * This is a Asynchronous API.
492  *
493  * \param[in]   profile_name    Profile Identifier.
494  *
495  * \par Prospective Clients:
496  * External Apps.
497  *
498 ******************************************************************************************/
499 int net_set_default_cellular_service_profile_async(const char *profile_name);
500
501 /*****************************************************************************************/
502 /**
503  * This function gets the modem object path which provides the given subscriber id.
504  *
505  * \par Sync (or) Async:
506  * This is a Synchronous API.
507  *
508  * \param[in]   sim_id      Subscriber identity.
509  * \param[out]  modem_path  Multi-subscribers' object path. After use this, it should be free()
510  *
511  * \par Prospective Clients:
512  * External Apps.
513  *
514 ******************************************************************************************/
515 int net_get_cellular_modem_object_path(char **modem_path, int sim_id);
516
517 /**
518  * \}
519  */
520
521 #ifdef __cplusplus
522 }
523 #endif /* __cplusplus */
524
525 #endif