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