d3c0943a7122320e106a5062100c9038329effa9
[framework/connectivity/libnet-client.git] / include / profile / network-pm-intf.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_INTF_H__
19 #define __NETWORK_PM_INTF_H__
20
21
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif /* __cplusplus */
26
27 /**
28  * @file network-pm-intf.h
29  * @brief This file defines the interface of Profile Manager with the application/Connection Manager.
30 */
31
32 /**
33  * \addtogroup  profile_managing
34  * \{
35 */
36
37 #ifndef DEPRECATED
38 #define DEPRECATED __attribute__((deprecated))
39 #endif
40 /*==================================================================================================
41                                          INCLUDE FILES
42 ==================================================================================================*/
43
44 #include "network-pm-wlan.h"
45
46 /*==================================================================================================
47                                            CONSTANTS
48 ==================================================================================================*/
49
50 /*==================================================================================================
51                                              ENUMS
52 ==================================================================================================*/
53
54 /**
55  * @enum net_pdp_type_t
56  * This enumeration defines the pdp protocol type.
57  */
58 typedef enum
59 {
60         /** Not defined */
61         NET_PDP_TYPE_NONE       = 0x00,
62         /** PDP-GPRS type */
63         NET_PDP_TYPE_GPRS,
64         /** PDP-EDGE type */
65         NET_PDP_TYPE_EDGE,
66         /** PDP-UMTS type */
67         NET_PDP_TYPE_UMTS,
68 } net_pdp_type_t;
69
70 /**
71  * @enum net_state_type_t
72  * This enumeration defines the service state type.
73  */
74 typedef enum
75 {
76         /** Not defined */
77         NET_STATE_TYPE_UNKNOWN  = 0x00,
78         /** Idle state */
79         NET_STATE_TYPE_IDLE,
80         /** Failure state */
81         NET_STATE_TYPE_FAILURE,
82         /** Association state */
83         NET_STATE_TYPE_ASSOCIATION,
84         /** Configuration state */
85         NET_STATE_TYPE_CONFIGURATION,
86         /** Ready state */
87         NET_STATE_TYPE_READY,
88         /** Online state */
89         NET_STATE_TYPE_ONLINE,
90         /** Login state */
91         NET_STATE_TYPE_DISCONNECT,
92 } net_state_type_t;
93
94
95 /*==================================================================================================
96                                  STRUCTURES AND OTHER TYPEDEFS
97 ==================================================================================================*/
98
99
100 /**
101  * Profile data structures: Used between Application and PM Plug-in Interface
102  */
103 typedef struct
104 {
105         /** Specifies a protocol type */
106         net_pdp_type_t  ProtocolType;
107         /** Specifies a service type(Internet, MMS, WAP, etc...) */
108         net_service_type_t ServiceType;
109         /** Network Access Point Name */
110         char            Apn[NET_PDP_APN_LEN_MAX+1];
111         /** Authentication info of the PDP profile */
112         net_auth_info_t AuthInfo;
113         /** Browser Home URL or MMS server URL */
114         char            HomeURL[NET_HOME_URL_LEN_MAX+1];
115         /** Sim Info Mcc */
116         char Mcc[NET_SIM_INFO_LEN+1];
117         /** Sim Info Mnc */
118         char Mnc[NET_SIM_INFO_LEN+1];
119         /** Indicates whether the use of static IP or not */
120         char IsStatic;
121
122         /** Indicates Roaming mode */
123         char Roaming;
124         /** This will be deprecated */
125         char SetupRequired;
126
127         /** network information */
128         net_dev_info_t net_info;
129 } net_pdp_profile_info_t;
130
131 /**
132  * Specific profile information related to each technology type
133  */
134 typedef union
135 {
136         /** PDP Profile Information */
137         net_pdp_profile_info_t       Pdp;
138         /** Wifi Profile Information */
139         net_wifi_profile_info_t      Wlan;
140 } net_specific_profile_info_t;
141
142 /**
143  * This is the profile structure exposed to applications.
144  */
145 typedef struct
146 {
147         /** Device Type of the profile */
148         net_device_t    profile_type;
149         /** Profile name */
150         char    ProfileName[NET_PROFILE_NAME_LEN_MAX+1];
151         /** Specific profile information */
152         net_specific_profile_info_t ProfileInfo;
153         /** Service state */
154         net_state_type_t        ProfileState;
155         /** Favourite flag */
156         char Favourite;
157 } net_profile_info_t;
158
159 /*
160 ==================================================================================================
161                                      FUNCTION PROTOTYPES
162 ==================================================================================================
163 */
164
165 /*****************************************************************************************/
166 /* net_add_profile API function prototype
167  * int net_add_profile(net_service_type_t network_type, net_profile_info_t *prof_info);
168  */
169
170 /**
171  * \brief       Add new Profile.
172  *
173  * \par Sync (or) Async:
174  * This is a Synchronous API.
175  *
176  * \par Important Notes:
177  *
178  * \warning
179  *  None
180  *
181  * \param[in]   network_type  A type of network service.
182  * \param[in]   prof_info     A pointer of New created Profile Information to be added.
183  *
184  * \par Async Response Message:
185  *        None.
186  *
187  * \return Return Type (int) \n
188  * - NET_ERR_NONE  - indicating that the operation has completed successfully. \n
189  * - NET_ERR_INVALID_PARAM - Invalid parameter\n
190  * - NET_ERR_UNKNOWN - Any other error\n
191  * - NET_ERR_APP_NOT_REGISTERED - Client is invalid may be unregistered\n
192  *
193  * \par Prospective Clients:
194  * Network Connection Setting Applet, WLAN Setting UI Applet.
195  *
196  * \par Example of how this function would be called:
197  *
198  * net_profile_info_t prof_info;\n
199  * int result; \n
200  * result = net_add_profile( NET_SERVICE_MMS, &prof_info ); \n
201  * if(result == NET_ERR_NONE)
202  *
203 ******************************************************************************************/
204 int net_add_profile(net_service_type_t network_type, net_profile_info_t *prof_info);
205
206 /*****************************************************************************************/
207 /* net_delete_profile API function prototype
208  * int net_delete_profile(const char* profile_name);
209  */
210
211 /**
212  * \brief       Delete a specific existing Profile.
213  *              (cellular : Delete profile, wifi : forgot AP)
214  *
215  * \par Sync (or) Async:
216  * This is a Synchronous API.
217  *
218  * \par Important Notes:
219  *
220  * \warning
221  *  None
222  *
223  * \param[in]   profile_name        Profile name to be deleted.
224  *
225  * \par Async Response Message:
226  *        None.
227  *
228  * \return Return Type (int) \n
229  * - NET_ERR_NONE  - indicating that the operation has completed successfully.
230  * - NET_ERR_INVALID_PARAM - Invalid parameter
231  * - NET_ERR_UNKNOWN - Any other error
232  * - NET_ERR_APP_NOT_REGISTERED - Client is invalid may be unregistered
233  *
234  * \par Prospective Clients:
235  * Network Connection Setting Applet, WLAN Setting UI Applet.
236  *
237  * \par Example of how this function would be called:
238  *
239  * int result;\n
240  *
241  * result = net_delete_profile(profile_name);
242  *
243  * if (result == NET_ERR_NONE)
244  *
245 ******************************************************************************************/
246 int net_delete_profile(const char *profile_name);
247
248 /*****************************************************************************************/
249 /* net_get_profile_info API function prototype
250  * int net_get_profile_info(const char *profile_name, net_profile_info_t *prof_info);
251  */
252
253 /**
254  * \brief       Return the profile information referred by Profile Name.
255  *
256  * \par Sync (or) Async:
257  * This is a Synchronous API.
258  *
259  * \par Important Notes:
260  *              On success, profile information shall be copied to prof_info parameter in net_profile_info_t format.
261  *              If profile doesn't exist, error shall be returned.
262  *
263  * \warning
264  *  None
265  *
266  * \param[in]   profile_name  Profile Identifier.
267  * \param[out]  prof_info     Buffer containing the profile.
268  *
269  * \par Async Response Message:
270  *        None.
271  *
272  * \return Return Type (int) \n
273  * - NET_ERR_NONE  - indicating that the operation has completed successfully. \n
274  * - NET_ERR_INVALID_PARAM - Invalid parameter\n
275  * - NET_ERR_UNKNOWN - Any other error\n
276  * - NET_ERR_APP_NOT_REGISTERED - Client is invalid may be unregistered\n
277  *
278  * \par Prospective Clients:
279  * Profile Manager.
280  *
281  * \par Example of how this function would be called:
282  *
283  * net_profile_info_t prof_info;\n
284  * int result;\n
285  *
286  * result = net_get_profile_info(profile_name, &prof_info);\n
287  *
288  * if (result == NET_ERR_NONE)\n
289  *
290 ******************************************************************************************/
291 int net_get_profile_info(const char *profile_name, net_profile_info_t *prof_info);
292
293 /*****************************************************************************************/
294 /* net_modify_profile API function prototype
295  * int net_modify_profile(const char* profile_name, net_profile_info_t* prof_info);
296  */
297
298 /**
299  * \brief       Edit a specific existing Profile.
300  *
301  * \par Sync (or) Async:
302  * This is a Synchronous API.
303  *
304  * \par Important Notes:
305  *
306  * \warning
307  *  None
308  *
309  * \param[in]  profile_name  Profile Identifier.
310  * \param[in]  prof_info     Changed Profile Information to be updated.
311  *
312  *
313  * \par Async Response Message:
314  *        None.
315  *
316  * \return Return Type (int) \n
317  * - NET_ERR_NONE  - indicating that the operation has completed successfully. \n
318  * - NET_ERR_INVALID_PARAM - Invalid parameter\n
319  * - NET_ERR_UNKNOWN - Any other error\n
320  * - NET_ERR_APP_NOT_REGISTERED - Client is invalid may be unregistered\n
321  *
322  * \par Prospective Clients:
323  * Network Connection Setting Applet.
324  *
325  * \par Example of how this function would be called:
326  *
327  * net_profile_info_t prof_info;\n
328  * int result;\n
329  *
330  * result = net_get_profile_info(profile_name, &prof_info);\n
331  * ......(Modifying ProfInfo)\n
332  *
333  * result = net_modify_profile(profile_name, &prof_info);\n
334  *
335  * if (result == NET_ERR_NONE)\n
336  *
337 ******************************************************************************************/
338 int net_modify_profile(const char *profile_name, net_profile_info_t *prof_info);
339
340 /*****************************************************************************************/
341 /**
342  * @fn   int net_get_profile_list(net_device_t device_type, net_profile_info_t **profile_list, int *count)
343  *
344  * This function request service list to ConnMan through dbus.
345  *
346  * \par Sync (or) Async:
347  * This is a Synchronous API.
348  *
349  * \param[in]   device_type     Type of device
350  * \param[out]  profile_list    Profile list. After use this, it should be free()
351  * \param[out]  count           Number of profile
352  *
353  * \return Return Type (int) \n
354  * - NET_ERR_NONE  - indicating that the operation has completed successfully. \n
355  * - NET_ERR_INVALID_PARAM - Invalid parameter\n
356  * - NET_ERR_UNKNOWN - Any other error\n
357  * - NET_ERR_APP_NOT_REGISTERED - Client is invalid may be unregistered\n
358  *
359  * \par Prospective Clients:
360  * External Apps.
361  *
362 ******************************************************************************************/
363 int net_get_profile_list(net_device_t device_type, net_profile_info_t **profile_list, int *count);
364
365 /**
366  * \}
367  */
368
369 #ifdef __cplusplus
370 }
371 #endif /* __cplusplus */
372
373 #endif
374
375