Apply device policy for wifi and wifi profile
[platform/core/connectivity/libnet-client.git] / include / common / network-cm-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_CM_INTF_H__
21 #define __NETWORK_CM_INTF_H__
22
23 #include "network-pm-intf.h"
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29 #ifndef DEPRECATED
30 #define DEPRECATED __attribute__((deprecated))
31 #endif
32
33 /**
34  * @file network-cm-intf.h
35  * @brief This file defines the interface of Connection Manager with the application.
36 */
37
38 /**
39  * \addtogroup  common_basic
40  * \{
41 */
42
43 /*==================================================================================================
44                                            CONSTANTS
45 ==================================================================================================*/
46
47 /*==================================================================================================
48                                              ENUMS
49 ==================================================================================================*/
50
51 /**
52  * @enum net_event_t
53  * Callback Event
54  */
55
56 typedef enum
57 {
58         /** Open Connection Response Event*/
59         NET_EVENT_OPEN_RSP,
60
61         /** Close Connection Response Event*/
62         NET_EVENT_CLOSE_RSP,
63
64         /** Open connection Indication (auto join) */
65         NET_EVENT_OPEN_IND,
66
67         /** Connection Close Indication Event */
68         NET_EVENT_CLOSE_IND,
69
70         /** Network service(profile) state changed Indication Event*/
71         NET_EVENT_NET_STATE_IND,
72
73         /** Network IP change Indication Event\n
74          *  This is deprecated Event and maintained only for compatibility */
75         NET_EVENT_IP_CHANGE_IND,
76
77         /** Profile modify indication Event\n
78          *  This is deprecated Event and maintained only for compatibility */
79         NET_EVENT_PROFILE_MODIFY_IND,
80
81         /** Network configuration changed Event\n
82          *  This is deprecated Event and maintained only for compatibility */
83         NET_EVENT_NET_CONFIGURE_RSP,
84
85         /* Wi-Fi Specific events */
86
87         /** Wi-Fi interface Scan Response Event */
88         NET_EVENT_WIFI_SCAN_RSP,
89
90         /** Wi-Fi interface Scan Indication Event(BG scan) */
91         NET_EVENT_WIFI_SCAN_IND,
92
93         /** Wi-Fi interface MAC changed Event\n
94          *  This is deprecated Event and maintained only for compatibility */
95         NET_EVENT_WIFI_MAC_ID_IND,
96
97         /** Wi-Fi interface Power On/Off Response Event */
98         NET_EVENT_WIFI_POWER_RSP,
99
100         /** Specific Scan Response Event */
101         NET_EVENT_SPECIFIC_SCAN_RSP,
102
103         /** Wi-Fi interface Scan Indication Event(Specific scan) */
104         NET_EVENT_SPECIFIC_SCAN_IND,
105
106         /** Wi-Fi interface Power On/Off Indication Event */
107         NET_EVENT_WIFI_POWER_IND,
108
109         /** Wi-Fi interface WPS Response Event */
110         NET_EVENT_WIFI_WPS_RSP,
111
112         /** Set default cellular profile Response Event */
113         NET_EVENT_CELLULAR_SET_DEFAULT_RSP,
114
115         /** Reset default cellular profile Response Event */
116         NET_EVENT_CELLULAR_RESET_DEFAULT_RSP,
117
118         /** Wi-Fi interface Scanning Indication Event */
119         NET_EVENT_WIFI_SCANNING_IND,
120
121         /** Wi-Fi interface Scan Indication Event(WPS scan) */
122         NET_EVENT_WPS_SCAN_IND,
123
124         /** Ethernet Cable Attached Event */
125         NET_EVENT_ETHERNET_CABLE_ATTACHED,
126
127         /** Ethernet Cable Detached Event */
128         NET_EVENT_ETHERNET_CABLE_DETACHED,
129
130         /** Wi-Fi TDLS Peer Connected EVENT */
131         NET_EVENT_TDLS_CONNECTED_IND,
132
133         /** Wi-Fi TDLS Peer Disconnect EVENT */
134         NET_EVENT_TDLS_DISCONNECTED_IND,
135 } net_event_t;
136
137 /**
138  * \}
139  */
140
141 /**
142  * \addtogroup  common_info
143  * \{
144 */
145
146 /**
147 * @enum net_cm_network_status_t
148 * This enum indicates network status
149 */
150 typedef enum
151 {
152         /** Service unknown */
153         NET_STATUS_UNKNOWN,
154         /** Not connected / Suspended / Idle / Connecting/ Disconnecting/ Killing*/
155         NET_STATUS_UNAVAILABLE,
156         /** Active */
157         NET_STATUS_AVAILABLE,
158 } net_cm_network_status_t;
159
160 /**
161  * @brief Enumerations of statistics type.
162  */
163 typedef enum
164 {
165         NET_STATISTICS_TYPE_LAST_RECEIVED_DATA = 0,             /**< Last received data */
166         NET_STATISTICS_TYPE_LAST_SENT_DATA = 1,                 /**< Last sent data */
167         NET_STATISTICS_TYPE_TOTAL_RECEIVED_DATA = 2,    /**< Total received data */
168         NET_STATISTICS_TYPE_TOTAL_SENT_DATA = 3,                /**< Total sent data */
169 } net_statistics_type_e;
170
171 /**
172  * \}
173  */
174
175 /**
176  * \addtogroup  common_basic
177  * \{
178 */
179
180 /*==================================================================================================
181                                  STRUCTURES AND OTHER TYPEDEFS
182 ==================================================================================================*/
183
184 /**
185  * Event Info with Event on callback
186  */
187
188 typedef struct
189 {
190         /** CM Asynchronous event */
191         net_event_t     Event;
192         /** Profile Identifier corresponding to the event */
193         char            ProfileName[NET_PROFILE_NAME_LEN_MAX+1];
194         /** Event Status */
195         net_err_t       Error;
196         /** Event data length */
197         int             Datalength;
198         /** Event data: Depending on the event, Event Data will be
199         type-casted to the appropriate event info data structure */
200         void *          Data;
201 } net_event_info_t;
202
203 /**
204  * Technology properties
205  */
206
207 typedef struct
208 {
209         /** powered state */
210         char            powered;
211         /** connected state */
212         char            connected;
213 } net_tech_info_t;
214
215
216 /*****************************************************************************************/
217 /* Callback function prototype
218  * typedef void (*net_event_cb_t)(const net_event_info_t* net_event, void* user_data);
219  */
220
221 /**
222  * \brief callback function: used to notify client application about Asynchronous events.
223  * This callback function will be called in the Network Client Library(NCL) context.
224  *
225  * \par Important Notes:
226  * NCL will allocate the memory for event data.
227  * Once Context will return from callback then NCL will free the memory allocated to event data.
228  * Application is not supposed to free the memory pointed by net_event
229  *
230  * \param[out] net_event    Pointer to net_event_info_t structure
231  * \param[out] user_data    User can transfer the user specific data in callback
232  *
233  * \par Description of each event type(net_event->Event) :
234  *
235  * - NET_EVENT_OPEN_RSP \n
236  *     Response event for (net_open_connection_with_profile(), net_open_connection_with_preference(), net_open_connection_with_wifi_info())
237  *     to notify the result of open connection request.
238  *   - net_event->ProfileName : Profile Identifier corresponding to the event
239  *   - net_event->Error       : Its value will be NET_ERR_NONE in case of success and error cause in case of failure
240  *   - net_event->Data        : Pointer to net_profile_info_t (valid at NET_ERR_NONE, NET_ERR_ACTIVE_CONNECTION_EXISTS)
241  *     - If the connection open successfully or already exists for the given profile name,\n
242  *       application can get the connected profile information \n
243  *       If the connection is failed to establish, net_profile_info_t also contains NULL value
244  *
245  * - NET_EVENT_CLOSE_RSP \n
246  *     Response event for net_close_connection() to notify the result of close connection request.
247  *   - net_event->ProfileName : Profile Identifier corresponding to the event
248  *   - net_event->Error       : Its value will be NET_ERR_NONE in case of success and error cause in case of failure
249  *   - net_event->Data        : NULL (not used in this event)
250  *
251  * - NET_EVENT_OPEN_IND \n
252  *     Indication to notify the activation of a connection by any other application or auto-connection.
253  *   - net_event->ProfileName : Profile Identifier corresponding to the event
254  *   - net_event->Error       : Its value will be NET_ERR_NONE in case of success and error cause in case of failure
255  *   - net_event->Data        : Pointer to net_profile_info_t
256  *     - If NCL can't get profile info from ConnMan, net_profile_info_t contains NULL value
257  *
258  * - NET_EVENT_CLOSE_IND \n
259  *     Indication to notify the closure of an active connection due to network initiated termination or any other transport connectivity loss.
260  *   - net_event->ProfileName : Profile Identifier corresponding to the event
261  *   - net_event->Error       : Its value will be NET_ERR_NONE always
262  *   - net_event->Data        : NULL (not used in this event)
263  *
264  * - NET_EVENT_NET_STATE_IND \n
265  *     Indication to notify that state of each serivce(profile) changed.\n
266  *     You can use this event to get more detailed state, but should be used carefully.\n
267  *     This event comes from ConnMan daemon via NCL, so you have to understand ConnMan's state.\n
268  *     There is no need to handle this event except under special circumstances.
269  *   - net_event->ProfileName : Profile Identifier corresponding to the event
270  *   - net_event->Error       : Its value will be NET_ERR_NONE always
271  *   - net_event->Data        : Pointer to net_state_type_t
272  *
273  * - NET_EVENT_WIFI_SCAN_RSP \n
274  *     Response event for net_scan_wifi() to notify the result of scan request.
275  *   - net_event->ProfileName : NULL (not used in this event)
276  *   - net_event->Error       : NET_ERR_NONE on success, negative values for errors
277  *   - net_event->Data        : NULL (not used in this event)
278  *
279  * - NET_EVENT_WIFI_SCAN_IND \n
280  *     Indication to notify that BG scan has been completed.
281  *   - net_event->ProfileName : NULL (not used in this event)
282  *   - net_event->Error       : NET_ERR_NONE on success, negative values for errors
283  *   - net_event->Data        : NULL (not used in this event)
284  *
285  * - NET_EVENT_WIFI_POWER_RSP \n
286  *     Response event for (net_wifi_power_on(), net_wifi_power_off()) to notify the result of Wi-Fi power on request.
287  *   - net_event->ProfileName : NULL (not used in this event)
288  *   - net_event->Error       : NET_ERR_NONE on success, negative values for errors
289  *   - net_event->Data        : Pointer to net_wifi_state_t (only WIFI_OFF/WIFI_ON/WIFI_UNKNOWN will be set)
290  *
291  * - NET_EVENT_WIFI_POWER_IND \n
292  *     Indication to notify that Wi-Fi power state has been changed.
293  *   - net_event->ProfileName : NULL (not used in this event)
294  *   - net_event->Error       : NET_ERR_NONE on success, negative values for errors
295  *   - net_event->Data        : Pointer to net_wifi_state_t (only WIFI_OFF/WIFI_ON/WIFI_UNKNOWN will be set)
296  *
297  * - NET_EVENT_WIFI_WPS_RSP \n
298  *     Response event for net_wifi_enroll_wps() to notify the result of enroll wps request.
299  *   - net_event->ProfileName : Profile Identifier corresponding to the event
300  *   - net_event->Error       : Its value will be NET_ERR_NONE in case of success and error cause in case of failure
301  *   - net_event->Data        : Pointer to net_profile_info_t
302  *     - If the connection open successfully, application can get the connected profile information \n
303  *       If the connection is failed to establish, net_profile_info_t also contains NULL value
304  *
305  * - NET_EVENT_SPECIFIC_SCAN_IND \n
306  *     Response event for net_specific_scan_wifi() to notify the BSSs which are found.
307  *   - net_event->ProfileName : NULL (not used in this event)
308  *   - net_event->Error       : Its value will be NET_ERR_NONE in case of success and error cause in case of failure
309  *   - net_event->Data        : Pointer to GSList of struct ssid_scan_bss_info_t
310  *   - net_event->Datalength  : The number of BSSs which are found
311  *     - Do not delete and modify Data and Datalength and they are destroyed automatically
312  *
313  */
314
315 typedef void (*net_event_cb_t)(const net_event_info_t* net_event, void* user_data);
316
317 /*==================================================================================================
318                                      FUNCTION PROTOTYPES
319 ==================================================================================================*/
320
321 /*****************************************************************************************/
322 /* net_register_client API function prototype
323  * int net_register_client(net_event_cb_t event_cb, void *user_data);
324  */
325
326 /**
327  * \brief       This API shall register the client application with the ConnMan.
328  *
329  * \par Sync (or) Async:
330  * This is a Synchronous API.
331  *
332  * \par Important Notes:
333  *        It is mandatory for the client application to register with ConnMan with this API before using any of its services.\n
334  *        The value of event_cb cannot be NULL. Otherwise, error NET_ERR_INVALID_PARAM will be returned by the API.\n
335  *        All the Asynchronous Events from ConnMan will be sent to the client App through the callback function (event_cb) registered with this API.
336  *
337  * \warning
338  *  None
339  *
340  * \param[in] event_cb     Application Callback function pointer to receive ConnMan events
341  * \param[in] user_data    user data
342  *
343  * \par Async Response Message:
344  *        None.
345  * \par Precondition:
346  *        None.
347  *
348  * \return Return Type (int) \n
349  * - NET_ERR_NONE  - indicating that the operation has completed successfully.\n
350  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
351  * - NET_ERR_APP_ALREADY_REGISTERED - indicating that client application is already registered,it can't be registered again.\n
352  * - NET_ERR_UNKNOWN - indicating that registration has failed.\n
353  *
354  * \par Prospective Clients:
355  * External Apps.
356  *
357  * \par Example Program:
358  *
359  * int result;
360  *
361  * result = net_register_client(event_cb , user_data);
362  *
363  * if(result == NET_ERR_NONE).........
364  *
365  *
366  *
367 ******************************************************************************************/
368 int net_register_client(net_event_cb_t event_cb, void *user_data);
369
370 /*****************************************************************************************/
371 /* net_deregister_client API function prototype
372 * int net_deregister_client(void);
373 */
374
375 /**
376  * \brief This API shall deregister the client application with the ConnMan.
377  *
378  * \par Sync (or) Async:
379  * This is a Synchronous API.
380  *
381  * \par Important Notes:
382  *        After deregistration, Application will be restricted from using other ConnMan APIs/Services.\n
383  *        De-register is not allowed when any connection is in active or transition state (activation or deactivation in progress).
384  *
385  * \warning
386  *  None
387  *
388  *
389  * \par Async Response Message:
390  *        None
391  *
392  * \par Precondition:
393  *        Application must already be registered with the ConnMan.
394  *
395  * \return Return Type (int) \n
396  * - NET_ERR_NONE  - indicating that the operation has completed successfully. \n
397  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
398  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
399  *
400  *
401  * \par Prospective Clients:
402  * External Apps.
403  *
404  * \par Example Program:
405  *
406  * int result;
407  *
408  * result = net_deregister_client();
409  *
410  * if(result == NET_ERR_NONE).........
411  *
412  *
413  *
414 ******************************************************************************************/
415 int net_deregister_client(void);
416
417 /*****************************************************************************************/
418 /* net_open_connection_with_profile API function prototype
419  * int net_open_connection_with_profile(const char *profile_name);
420  */
421
422 /**
423  * \brief  This API will establish a data connection with specific profile name
424  *
425  * \par Sync (or) Async:
426  * This is an Asynchronous API.
427  *
428  * \par Important Notes:
429  *        This API is a Non-Blocking API. Return value only implies whether the request is sent successfully or not. \n
430  *            Return value Success does not imply that the connection is established successfully. \n
431  *            If application needs to make a connection with specific profile name, it can make a connection with this api. \n
432  *            Get the profile name is referred to net_get_profile_list(). \n
433  *            If Connection is already existed, this API will share the active connection with the calling application. \n
434  *            If Connection is already existed, and same application is trying to open connection, this API will return error.
435  *
436  * \par Notes :
437  *
438  *      ConnMan requests transport plug-in interface to open a new connection only if connection is not already established. \n
439  *      If there is already a connection , then same connection will be shared.
440  *
441  * \warning
442  *  None
443  *
444  * \param [in]  profile_name     specific profile name
445  *
446  * \par Async Response Message:
447  *        NET_EVENT_OPEN_RSP: Connection Establishment response will be sent asynchronously to the App in the callback function registered.\n
448  *        refer to net_event_cb_t()
449  *
450  * \par Precondition:
451  *        Application must already be registered with the ConnMan.
452  *
453  * \return Return Type (int) \n
454  * - NET_ERR_NONE  - indicating that the operation has completed successfully. \n
455  * - NET_ERR_APP_NOT_REGISTERED -indicating that client is not registered with CM and it cannot use CM services.\n
456  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
457  * - NET_ERR_INVALID_OPERATION  - indicating that open connection operation is not allowed in the current state.\n
458  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
459  *
460  *
461  * \par Prospective Clients:
462  * External Apps.
463  *
464  * \par Example Program:
465  *
466  * int result;
467  *
468  * result = net_open_connection_with_profile(profile_name);
469  *
470  * if(result == NET_ERR_NONE)......
471  *
472  *
473  *
474 ******************************************************************************************/
475 int net_open_connection_with_profile(const char *profile_name);
476
477 /*****************************************************************************************/
478 /* net_open_connection_with_preference API function prototype
479  * int net_open_connection_with_preference(net_service_type_t service_type);
480  */
481
482 /**
483  * \brief  This API will establish a data connection with specific service type
484  *
485  * \par Sync (or) Async:
486  * This is an Asynchronous API.
487  *
488  * \par Important Notes:
489  *        This API is a Non-Blocking API. Return value only implies whether the request is sent successfully or not. \n
490  *            Return value Success does not imply that the connection is established successfully. \n
491  *            If application needs to make a connection with specific service type, it can make a connection with this api. \n
492  *            If Connection is already existed, this API will share the active connection with the calling application. \n
493  *            If Connection is already exited, and same application is trying to open connection, this API will return error.
494  *
495  * \par Notes :
496  *
497  *      ConnMan requests transport plug-in interface to open a new connection only if connection is not already established. \n
498  *      If there is already a connection , then same connection will be shared.
499  *
500  * \warning
501  *  None
502  *
503  * \param [in]  service_type     specific service type
504  *
505  * \par Async Response Message:
506  *        NET_EVENT_OPEN_RSP: Connection Establishment response will be sent asynchronously to the App in the callback function registered.\n
507  *        refer to net_event_cb_t()
508  *
509  * \par Precondition:
510  *        Application must already be registered with the ConnMan.
511  *
512  * \return Return Type (int) \n
513  * - NET_ERR_NONE - indicating that the operation has completed successfully. \n
514  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
515  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
516  * - NET_ERR_INVALID_OPERATION - indicating that open connection operation is not allowed in the current state.\n
517  * - NET_ERR_NO_SERVICE - indicating that service is not found.\n
518  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
519  *
520  *
521  * \par Prospective Clients:
522  * External Apps.
523  *
524  * \par Example Program:
525  *
526  * int result;
527  *
528  * result = net_open_connection_with_preference(service_type);
529  *
530  * if(result == NET_ERR_NONE)......
531  *
532  *
533  *
534 ******************************************************************************************/
535 int net_open_connection_with_preference(net_service_type_t service_type);
536
537 /*****************************************************************************************/
538 /* net_close_connection API function prototype
539  * int net_close_connection(const char *profile_name);
540  */
541
542 /**
543  * \brief       This API will terminate the connection. This API can also be used to abort a connection in progress.
544  *
545  * \par Sync (or) Async:
546  * This is an Asynchronous API.
547  *
548  * \par Important Notes:
549  *        This API is an Asynchronous API. Return value only implies whether the request is sent successfully or not. Return value Success doesn't imply that the connection is disconnected successfully.\n
550  *
551  * \warning
552  *  None
553  *
554  * \par Notes :
555  *              Application must be already registered with the ConnMan. \n
556  *
557  * \param [in]  profile_name     specific profile name
558  *
559  * \par Async Response Message:
560  *        NET_EVENT_CLOSE_RSP: Connection Close response will be sent asynchronously to the App in the callback function registered\n
561  *        refer to net_event_cb_t()
562  *
563  * \par Precondition:
564  *        Application must have an active data connection
565  *
566  * \return Return Type (int) \n
567  * - NET_ERR_NONE  - indicating that the operation has completed successfully. \n
568  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
569  * - NET_ERR_INVALID_OPERATION  - indicating that close connection operation is not allowed in the current state.\n
570  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
571  *
572  * \par Prospective Clients:
573  * External Apps.
574  *
575  * \par Example Program:
576  *
577  * int result;
578  *
579  * result = net_close_connection(profile_name);
580  *
581  * if(result == NET_ERR_NONE).........
582  *
583  *
584  *
585 ******************************************************************************************/
586 int net_close_connection(const char *profile_name);
587
588 /**
589  * \}
590  */
591
592 /**
593  * \addtogroup  common_info
594  * \{
595 */
596
597 /*****************************************************************************************/
598 /* net_get_active_net_info API function prototype
599  * int net_get_active_net_info(net_profile_info_t *active_profile_info);
600  */
601
602 /**
603  * \brief  This API returns the information of active(default) network profile.
604  *
605  * \par Sync (or) Async:
606  * This is a Synchronous API.
607  *
608  * \par Important Notes:
609  *              On success, profile information shall be copied to active_profile_info parameter in net_profile_info_t format.
610  *
611  * \par Notes :
612  *  None
613  *
614  * \warning
615  *  None
616  *
617  * \param[out]  active_profile_info     The information of active(default) network profile.
618  *
619  * \par Async Response Message:
620  *  None
621  *
622  * \par Precondition:
623  *        Application must already be registered with the CM server.
624  *
625  * \return Return Type (int) \n
626  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
627  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
628  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
629  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
630  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
631  *
632  * \par Prospective Clients:
633  * External Apps.
634  *
635  * \par Example Program:
636  *
637  * net_profile_info_t active_profile_info;
638  *
639  * int result = net_get_active_net_info(&active_profile_info);
640  *
641  * if(result == NET_ERR_NONE)......
642  *
643  *
644  *
645 ******************************************************************************************/
646 int net_get_active_net_info(net_profile_info_t *active_profile_info);
647
648 /*****************************************************************************************/
649 /**
650  * \brief  This API returns ip address of active(default) network profile.
651  *
652  * \par Sync (or) Async:
653  * These is a Synchronous API.
654  *
655  * \par Important Notes:
656  *              On success, the information shall be copied to the parameter in each format.
657  *
658  * \param[out]  ip_address  ip address of active(default) network profile.
659  *
660  * \par Precondition:
661  *        Application must already be registered with the CM server.
662  *
663  * \return Return Type (int) \n
664  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
665  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
666  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
667  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
668  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
669  *
670  * \par Prospective Clients:
671  * External Apps.
672  *
673  * \par Example Program:
674  *
675  * net_addr_t ip_address;
676  *
677  * int result = net_get_active_ipaddress(&ip_address);
678  *
679  * if(result == NET_ERR_NONE)......
680  *
681 ******************************************************************************************/
682 int net_get_active_ipaddress(net_addr_t *ip_address);
683
684 /*****************************************************************************************/
685 /**
686  * \brief  This API returns netmask address of active(default) network profile.
687  *
688  * \par Sync (or) Async:
689  * These is a Synchronous API.
690  *
691  * \par Important Notes:
692  *              On success, the information shall be copied to the parameter in each format.
693  *
694  * \param[out]  netmask  netmask address of active(default) network profile.
695  *
696  * \par Precondition:
697  *        Application must already be registered with the CM server.
698  *
699  * \return Return Type (int) \n
700  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
701  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
702  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
703  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
704  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
705  *
706  * \par Prospective Clients:
707  * External Apps.
708  *
709  * \par Example Program:
710  *
711  * net_addr_t netmask;
712  *
713  * int result = net_get_active_netmask(&netmask);
714  *
715  * if(result == NET_ERR_NONE)......
716  *
717 ******************************************************************************************/
718 int net_get_active_netmask(net_addr_t *netmask);
719
720 /*****************************************************************************************/
721 /**
722  * \brief  This API returns ipv6 address of active(default) network profile.
723  *
724  * \par Sync (or) Async:
725  * These is a Synchronous API.
726  *
727  * \par Important Notes:
728  *              On success, the information shall be copied to the parameter in each format.
729  *
730  * \param[out]  ip_address6  ipv6 address of active(default) network profile.
731  *
732  * \par Precondition:
733  *        Application must already be registered with the CM server.
734  *
735  * \return Return Type (int) \n
736  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
737  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
738  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
739  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
740  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
741  *
742  * \par Prospective Clients:
743  * External Apps.
744  *
745  * \par Example Program:
746  *
747  * net_addr_t ip_address6;
748  *
749  * int result = net_get_active_ipaddress6(&ip_address6);
750  *
751  * if(result == NET_ERR_NONE)......
752  *
753 ******************************************************************************************/
754 int net_get_active_ipaddress6(net_addr_t *ip_address6);
755
756 /*****************************************************************************************/
757 /**
758  * \brief  This API returns Prefix Length of IPv6 address of active(default) network profile.
759  *
760  * \par Sync (or) Async:
761  * These is a Synchronous API.
762  *
763  * \par Important Notes:
764  *              On success, the information shall be copied to the parameter in each format.
765  *
766  * \param[out]  prefixlen6  Prefix Length of IPv6 address of active(default) network profile.
767  *
768  * \par Precondition:
769  *        Application must already be registered with the CM server.
770  *
771  * \return Return Type (int) \n
772  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
773  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
774  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
775  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
776  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
777  *
778  * \par Prospective Clients:
779  * External Apps.
780  *
781  * \par Example Program:
782  *
783  * int prefixlen6;
784  *
785  * int result = net_get_active_prefixlen6(&prefixlen6);
786  *
787  * if(result == NET_ERR_NONE)......
788  *
789 ******************************************************************************************/
790 int net_get_active_prefixlen6(int *prefixlen6);
791
792 /*****************************************************************************************/
793 /**
794  * \brief  This API returns gateway address of active(default) network profile.
795  *
796  * \par Sync (or) Async:
797  * These is a Synchronous API.
798  *
799  * \par Important Notes:
800  *              On success, the information shall be copied to the parameter in each format.
801  *
802  * \param[out]  gateway  gateway address of active(default) network profile.
803  *
804  * \par Precondition:
805  *        Application must already be registered with the CM server.
806  *
807  * \return Return Type (int) \n
808  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
809  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
810  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
811  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
812  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
813  *
814  * \par Prospective Clients:
815  * External Apps.
816  *
817  * \par Example Program:
818  *
819  * net_addr_t gateway;
820  *
821  * int result = net_get_active_gateway(&gateway);
822  *
823  * if(result == NET_ERR_NONE)......
824  *
825 ******************************************************************************************/
826 int net_get_active_gateway(net_addr_t *gateway);
827
828 /*****************************************************************************************/
829 /**
830  * \brief  This API returns gateway IPv6 address of active(default) network profile.
831  *
832  * \par Sync (or) Async:
833  * These is a Synchronous API.
834  *
835  * \par Important Notes:
836  *              On success, the information shall be copied to the parameter in
837  *              each format.
838  *
839  * \param[out]  gateway6  gateway IPv6 address of active(default) network profile.
840  *
841  * \par Precondition:
842  *        Application must already be registered with the CM server.
843  *
844  * \return Return Type (int) \n
845  * - NET_ERR_NONE  - indicating that the status of queried network interface is
846  *   retrieved. \n
847  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with
848  *   CM and it cannot use CM services.\n
849  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
850  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
851  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
852  *
853  * \par Prospective Clients:
854  * External Apps.
855  *
856  * \par Example Program:
857  *
858  * net_addr_t gateway6;
859  *
860  * int result = net_get_active_gateway6(&gateway6);
861  *
862  * if(result == NET_ERR_NONE)......
863  *
864 ******************************************************************************************/
865 int net_get_active_gateway6(net_addr_t *gateway6);
866
867 /*****************************************************************************************/
868 /**
869  * \brief  This API returns DNS address of active(default) network profile.
870  *
871  * \par Sync (or) Async:
872  * These is a Synchronous API.
873  *
874  * \par Important Notes:
875  *              On success, the information shall be copied to the parameter in each format.
876  *
877  * \param[out]  dns  DNS address of active(default) network profile.
878  *
879  * \par Precondition:
880  *        Application must already be registered with the CM server.
881  *
882  * \return Return Type (int) \n
883  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
884  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
885  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
886  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
887  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
888  *
889  * \par Prospective Clients:
890  * External Apps.
891  *
892  * \par Example Program:
893  *
894  * net_addr_t dns;
895  *
896  * int result = net_get_active_dns(&dns);
897  *
898  * if(result == NET_ERR_NONE)......
899  *
900 ******************************************************************************************/
901 int net_get_active_dns(net_addr_t *dns);
902
903 /*****************************************************************************************/
904 /**
905  * \brief  This API returns ESSID of active(default) network profile.
906  *
907  * \par Sync (or) Async:
908  * These is a Synchronous API.
909  *
910  * \par Important Notes:
911  *              On success, the information shall be copied to the parameter in each format.
912  *
913  * \param[out]  essid  ESSID of active(default) network profile.
914  *
915  * \par Precondition:
916  *        Application must already be registered with the CM server and wifi is connected.
917  *
918  * \return Return Type (int) \n
919  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
920  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
921  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
922  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
923  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
924  *
925  * \par Prospective Clients:
926  * External Apps.
927  *
928  * \par Example Program:
929  *
930  * net_essid_t essid;
931  *
932  * int result = net_get_active_essid(&essid);
933  *
934  * if(result == NET_ERR_NONE)......
935  *
936 ******************************************************************************************/
937 int net_get_active_essid(net_essid_t *essid);
938
939 /*****************************************************************************************/
940 /**
941  * \brief  This API returns proxy string of active(default) network profile.
942  *
943  * \par Sync (or) Async:
944  * These is a Synchronous API.
945  *
946  * \par Important Notes:
947  *              On success, the information shall be copied to the parameter in each format.
948  *
949  * \param[out]  proxy  proxy string of active(default) network profile.
950  *
951  * \par Precondition:
952  *        Application must already be registered with the CM server.
953  *
954  * \return Return Type (int) \n
955  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
956  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
957  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
958  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
959  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
960  *
961  * \par Prospective Clients:
962  * External Apps.
963  *
964  * \par Example Program:
965  *
966  * net_proxy_t proxy;
967  *
968  * int result = net_get_active_proxy(&proxy);
969  *
970  * if(result == NET_ERR_NONE)......
971  *
972 ******************************************************************************************/
973 int net_get_active_proxy(net_proxy_t *proxy);
974
975 /*****************************************************************************************/
976 /* net_get_network_status API function prototype
977  * int net_get_network_status(net_device_t device_type, net_cm_network_status_t* network_status);
978  */
979
980 /**
981  * \brief  This API returns The status of a specific network interface passed as a parameter.
982  *
983  * \par Sync (or) Async:
984  * This is a Synchronous API.
985  *
986  * \par Important Notes:
987  *  None
988  *
989  * \par Notes :
990  *  None
991  *
992  * \warning
993  *  None
994  *
995  * \param[in]   device_type     Queried network interface.
996  * \param[out]  network_status  The status of Queried network interface.
997  *
998  * \par Async Response Message:
999  *  None
1000  *
1001  * \par Precondition:
1002  *        Application must already be registered with the CM server.
1003  *
1004  * \return Return Type (int) \n
1005  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
1006  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
1007  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
1008  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
1009  *
1010  * \par Prospective Clients:
1011  * External Apps.
1012  *
1013  * \par Example Program:
1014  *
1015  * net_cm_network_status_t status;
1016  *
1017  * int result = net_get_network_status(NET_MOBILE_TYPE, &status);
1018  *
1019  * if(result == TRUE)......
1020  *
1021  *
1022  *
1023 ******************************************************************************************/
1024 int net_get_network_status(net_device_t device_type, net_cm_network_status_t* network_status);
1025
1026 /*****************************************************************************************/
1027 /* net_is_connected API function prototype
1028  * int net_is_connected(void);
1029  */
1030
1031 /**
1032  * \brief  This API returns the connection status of process
1033  *
1034  * \par Sync (or) Async:
1035  * This is a Synchronous API.
1036  *
1037  * \par Important Notes:
1038  *  None
1039  *
1040  * \par Notes :
1041  *  None
1042  *
1043  * \warning
1044  *  None
1045  *
1046  *
1047  * \par Async Response Message:
1048  *  None
1049  *
1050  * \par Precondition:
1051  *        Application must already be registered with the CM server.
1052  *
1053  * \return Return Type (int) \n
1054  * - 1  - connected
1055  * - 0 - not connected
1056  *
1057  * \par Prospective Clients:
1058  * External Apps.
1059  *
1060  * \par Example Program:
1061  *
1062  * int result = net_is_connected();
1063  *
1064  * if(result == 1)......
1065  *
1066  *
1067  *
1068 ******************************************************************************************/
1069 int net_is_connected(void);
1070
1071 /**
1072  * \}
1073  */
1074
1075 /**
1076  * \addtogroup  pdp_specific
1077  * \{
1078 */
1079
1080 /**
1081  * \}
1082  */
1083
1084 /**
1085  * \addtogroup  common_extended
1086  * \{
1087 */
1088
1089 /**
1090  * \brief       This API is only for Connection/Wi-Fi CAPI. Don't use this.
1091  *
1092  * \param[in] event_cb     Application Callback function pointer to receive ConnMan events
1093  * \param[in] client_type  NET_DEVICE_DEFAULT : Connection CAPI, NET_DEVICE_WIFI : Wi-Fi CAPI
1094  * \param[in] user_data    user data
1095  *
1096  ******************************************************************************************/
1097 int net_register_client_ext(net_event_cb_t event_cb, net_device_t client_type, void *user_data);
1098
1099 /**
1100  * \brief       This API is only for Connection/Wi-Fi CAPI. Don't use this.
1101  *
1102  * \param[in] client_type  NET_DEVICE_DEFAULT : Connection CAPI, NET_DEVICE_WIFI : Wi-Fi CAPI
1103  *
1104  ******************************************************************************************/
1105 int net_deregister_client_ext(net_device_t client_type);
1106
1107 /**
1108  * \brief       This API is only for Connection/Wi-Fi CAPI. Don't use this.
1109  *
1110  * \param[in]  service_type specific service type
1111  * \param[out] prof_name    The name of profile for the service type.
1112  *
1113  ******************************************************************************************/
1114 int net_open_connection_with_preference_ext(net_service_type_t service_type, net_profile_name_t *prof_name);
1115
1116 /**
1117  * \brief       This API is only for Connection CAPI. Don't use this.
1118  *
1119  * \param[in]  ip_addr     ip address to route.
1120  * \param[in]  interface   interface name.
1121  * \param[in]  address_family address family of ip address.
1122  *
1123  ******************************************************************************************/
1124 int net_add_route(const char *ip_addr, const char *interface, int address_family);
1125
1126 /**
1127  * \brief       This API is only for Connection CAPI. Don't use this.
1128  *
1129  * \param[in]  ip_addr     ip address to route.
1130  * \param[in]  interface   interface name.
1131  * \param[in]  address_family address family of ip address.
1132  *
1133  ******************************************************************************************/
1134 int net_remove_route(const char *ip_addr, const char *interface, int address_family);
1135
1136 /**
1137  * \brief       This API is only for Connection CAPI. Don't use this.
1138  *
1139  * \param[in]  ip_addr     ipv6 address to route.
1140  * \param[in]  interface   interface name.
1141  * \param[in]  address_family address family of ip address.
1142  * \param[in]  gateway  gateway address.
1143  *
1144  ******************************************************************************************/
1145 int net_add_route_ipv6(const char *ip_addr, const char *interface, int address_family, const char *gateway);
1146
1147 /**
1148  * \brief       This API is only for Connection CAPI. Don't use this.
1149  *
1150  * \param[in]  ip_addr     ipv6 address to route.
1151  * \param[in]  interface   interface name.
1152  * \param[in]  address_family address family of ip address.
1153  * \param[in]  gateway  gateway address.
1154  *
1155  ******************************************************************************************/
1156 int net_remove_route_ipv6(const char *ip_addr, const char *interface, int address_family, const char *gateway);
1157
1158 /*****************************************************************************************/
1159 /* net_get_ethernet_cable_state API function prototype
1160  * int net_get_ethernet_cable_state(int *state);
1161  */
1162
1163 /**
1164  * \brief  This API returns the ethernet cable status, 1 = Attached, 0 = Deatached.
1165  *
1166  * \param[out] state - Specifies the State of ethernet cable
1167  *
1168  * \par Sync (or) Async:
1169  * This is a Synchronous API.
1170  *
1171  * \par Important Notes:
1172  *  None
1173  *
1174  * \par Notes :
1175  *  None
1176  *
1177  * \warning
1178  *  None
1179  *
1180  *
1181  * \par Async Response Message:
1182  *  None
1183  *
1184  * \return Return Type (int) \n
1185  * - NET_ERR_NONE - indicating that the status of ethernet plug in/out retrieved successfully.\n
1186  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
1187  * - NET_ERR_INVALID_OPERATION - indicating that the API failed to retrieve the status of ethernet plug.\n
1188  *
1189  * \par Prospective Clients:
1190  * External Apps.
1191  *
1192  *
1193 ******************************************************************************************/
1194 int net_get_ethernet_cable_state(int *state);
1195
1196 /**
1197  * \brief       This API is only for Connection CAPI. Don't use this.
1198  *
1199  * \param[in]  tech_type    specific technology type
1200  * \param[out]  tech_info   technology info.
1201  *
1202  ******************************************************************************************/
1203 int net_get_technology_properties(net_device_t tech_type, net_tech_info_t *tech_info);
1204
1205 /**
1206  * \}
1207  */
1208
1209 /**
1210  * \addtogroup  common_info
1211  * \{
1212 */
1213
1214 /**
1215  * \brief       Gets the statistics information.
1216  *
1217  * \param[in]  device_type     specific device type(cellular/wifi).
1218  * \param[in]  statistics_type specific statistics type.
1219  * \param[out] statistics_type statistics value requested.
1220  *
1221  ******************************************************************************************/
1222 int net_get_statistics(net_device_t device_type, net_statistics_type_e statistics_type, unsigned long long *size);
1223
1224 /**
1225  * \brief       Resets the statistics information.
1226  *
1227  * \param[in]  device_type     specific device type(cellular/wifi).
1228  * \param[in]  statistics_type specific statistics type.
1229  *
1230  ******************************************************************************************/
1231 int net_set_statistics(net_device_t device_type, net_statistics_type_e statistics_type);
1232
1233 /**
1234  * \}
1235  */
1236
1237 #ifdef __cplusplus
1238 }
1239 #endif /* __cplusplus */
1240
1241 #endif