da20a58591a7c461b45c1f9efde2638b51907b61
[framework/connectivity/libnet-client.git] / include / common / network-cm-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_CM_INTF_H__        /* To prevent inclusion of a header file twice */
19 #define __NETWORK_CM_INTF_H__
20
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
25
26 /**
27  * @file network-cm-intf.h
28  * @brief This file defines the interface of Connection Manager with the application.
29 */
30
31 /**
32  * \addtogroup  common_basic
33  * \{
34 */
35
36 /*==================================================================================================
37                                          INCLUDE FILES
38 ==================================================================================================*/
39
40
41 #include <sys/time.h>
42 #include <sys/types.h>
43 #include <unistd.h>
44 #include <string.h>
45
46 #include <arpa/inet.h>
47 #include <sys/socket.h>
48 #include <netdb.h>
49 #include <sys/un.h>
50 #include <errno.h>
51
52 #include <netinet/in.h>
53 #include <stdio.h>
54 #include <stdlib.h>
55 #include <stdarg.h>
56
57 #include <pthread.h>
58 #include <signal.h>
59
60 #include <sys/poll.h>
61
62 #include <semaphore.h>
63 #include <linux/unistd.h>
64
65 #include "network-pm-intf.h"
66 #include "network-cm-error.h"
67
68 #ifndef DEPRECATED
69 #define DEPRECATED __attribute__((deprecated))
70 #endif
71
72 /*==================================================================================================
73                                            CONSTANTS
74 ==================================================================================================*/
75
76 /*==================================================================================================
77                                              ENUMS
78 ==================================================================================================*/
79
80 /**
81  * @enum net_event_t
82  * Callback Event
83  */
84
85 typedef enum
86 {
87         /** Open Connection Response Event*/
88         NET_EVENT_OPEN_RSP,
89
90         /** Close Connection Response Event*/ 
91         NET_EVENT_CLOSE_RSP,
92         
93         /** Open connection Indication (auto join) */
94         NET_EVENT_OPEN_IND,
95
96         /** Connection Close Indication Event */
97         NET_EVENT_CLOSE_IND,
98
99         /** Network service(profile) state changed Indication Event*/
100         NET_EVENT_NET_STATE_IND,
101
102         /** Network IP change Indication Event\n
103          *  This is deprecated Event and maintained only for compatibility */
104         NET_EVENT_IP_CHANGE_IND,
105
106         /** Profile modify indication Event\n
107          *  This is deprecated Event and maintained only for compatibility */
108         NET_EVENT_PROFILE_MODIFY_IND,
109         
110         /** Network configuration changed Event\n
111          *  This is deprecated Event and maintained only for compatibility */
112         NET_EVENT_NET_CONFIGURE_RSP,
113
114         /* Wi-Fi Specific events */
115
116         /** Wi-Fi interface Scan Response Event */
117         NET_EVENT_WIFI_SCAN_RSP,
118         
119         /** Wi-Fi interface Scan Indication Event(BG scan) */
120         NET_EVENT_WIFI_SCAN_IND,
121
122         /** Wi-Fi interface MAC changed Event\n
123          *  This is deprecated Event and maintained only for compatibility */
124         NET_EVENT_WIFI_MAC_ID_IND,
125         
126         /** Wi-Fi interface Power On/Off Response Event */
127         NET_EVENT_WIFI_POWER_RSP,
128
129         /** Wi-Fi interface Power On/Off Indication Event */
130         NET_EVENT_WIFI_POWER_IND,
131
132         /** Wi-Fi interface WPS Response Event */
133         NET_EVENT_WIFI_WPS_RSP,
134
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  * \}
162  */
163
164 /**
165  * \addtogroup  common_basic
166  * \{
167 */
168
169 /*==================================================================================================
170                                  STRUCTURES AND OTHER TYPEDEFS
171 ==================================================================================================*/
172
173 /**
174  * Event Info with Event on callback
175  */
176
177 typedef struct
178 {
179         /** CM Asynchronous event */
180         net_event_t     Event;
181         /** Profile Identifier corresponding to the event */
182         char            ProfileName[NET_PROFILE_NAME_LEN_MAX+1];
183         /** Event Status */
184         net_err_t       Error;
185         /** Event data length */
186         int             Datalength;
187         /** Event data: Depending on the event, Event Data will be
188         type-casted to the appropriate event info data structure */
189         void *          Data;
190 } net_event_info_t;
191
192 /*****************************************************************************************/
193 /* Callback function prototype
194  * typedef void (*net_event_cb_t ) ( const net_event_info_t* net_event, void* user_data);
195  */
196
197 /**
198  * \brief callback function: used to notify client application about Asynchronous events.
199  * This callback function will be called in the Network Client Library(NCL) context.
200  *
201  * \par Important Notes:
202  * NCL will allocate the memory for event data.
203  * Once Context will return from callback then NCL will free the memory allocated to event data.
204  * Application is not supposed to free the memory pointed by net_event
205  *
206  * \param[out] net_event    Pointer to net_event_info_t structure
207  * \param[out] user_data    User can transfer the user specific data in callback
208  *
209  * \par Description of each event type(net_event->Event) :
210  *
211  * - NET_EVENT_OPEN_RSP \n
212  *     Response event for (net_open_connection_with_profile(), net_open_connection_with_preference(), net_open_connection_with_wifi_info())
213  *     to notify the result of open connection request.
214  *   - net_event->ProfileName : Profile Identifier corresponding to the event
215  *   - net_event->Error       : Its value will be NET_ERR_NONE in case of success and error cause in case of failure
216  *   - net_event->Data        : Pointer to net_profile_info_t (valid at NET_ERR_NONE, NET_ERR_ACTIVE_CONNECTION_EXISTS)
217  *     - If the connection open successfully or already exists for the given profile name,\n
218  *       application can get the connected profile information \n
219  *       If the connection is failed to establish, net_profile_info_t also contains NULL value
220  *
221  * - NET_EVENT_CLOSE_RSP \n
222  *     Response event for net_close_connection() to notify the result of close connection request.
223  *   - net_event->ProfileName : Profile Identifier corresponding to the event
224  *   - net_event->Error       : Its value will be NET_ERR_NONE in case of success and error cause in case of failure
225  *   - net_event->Data        : NULL (not used in this event)
226  *
227  * - NET_EVENT_OPEN_IND \n
228  *     Indication to notify the activation of a connection by any other application or auto-connection.
229  *   - net_event->ProfileName : Profile Identifier corresponding to the event
230  *   - net_event->Error       : Its value will be NET_ERR_NONE in case of success and error cause in case of failure
231  *   - net_event->Data        : Pointer to net_profile_info_t
232  *     - If NCL can't get profile info from ConnMan, net_profile_info_t contains NULL value
233  *
234  * - NET_EVENT_CLOSE_IND \n
235  *     Indication to notify the closure of an active connection due to network initiated termination or any other transport connectivity loss.
236  *   - net_event->ProfileName : Profile Identifier corresponding to the event
237  *   - net_event->Error       : Its value will be NET_ERR_NONE always
238  *   - net_event->Data        : NULL (not used in this event)
239  *
240  * - NET_EVENT_NET_STATE_IND \n
241  *     Indication to notify that state of each serivce(profile) changed.\n
242  *     You can use this event to get more detailed state, but should be used carefully.\n
243  *     This event comes from ConnMan daemon via NCL, so you have to understand ConnMan's state.\n
244  *     There is no need to handle this event except under special circumstances.
245  *   - net_event->ProfileName : Profile Identifier corresponding to the event
246  *   - net_event->Error       : Its value will be NET_ERR_NONE always
247  *   - net_event->Data        : Pointer to net_state_type_t
248  *
249  * - NET_EVENT_WIFI_SCAN_RSP \n
250  *     Response event for net_scan_wifi() to notify the result of scan request.
251  *   - net_event->ProfileName : NULL (not used in this event)
252  *   - net_event->Error       : NET_ERR_NONE on success, negative values for errors
253  *   - net_event->Data        : NULL (not used in this event)
254  *
255  * - NET_EVENT_WIFI_SCAN_IND \n
256  *     Indication to notify that BG scan has been completed.
257  *   - net_event->ProfileName : NULL (not used in this event)
258  *   - net_event->Error       : NET_ERR_NONE on success, negative values for errors
259  *   - net_event->Data        : NULL (not used in this event)
260  *
261  * - NET_EVENT_WIFI_POWER_RSP \n
262  *     Response event for (net_wifi_power_on(), net_wifi_power_off()) to notify the result of Wi-Fi power on request.
263  *   - net_event->ProfileName : NULL (not used in this event)
264  *   - net_event->Error       : NET_ERR_NONE on success, negative values for errors
265  *   - net_event->Data        : Pointer to net_wifi_state_t (only WIFI_OFF/WIFI_ON/WIFI_UNKNOWN will be set)
266  *
267  * - NET_EVENT_WIFI_POWER_IND \n
268  *     Indication to notify that Wi-Fi power state has been changed.
269  *   - net_event->ProfileName : NULL (not used in this event)
270  *   - net_event->Error       : NET_ERR_NONE on success, negative values for errors
271  *   - net_event->Data        : Pointer to net_wifi_state_t (only WIFI_OFF/WIFI_ON/WIFI_UNKNOWN will be set)
272  *
273  * - NET_EVENT_WIFI_WPS_RSP \n
274  *     Response event for net_wifi_enroll_wps() to notify the result of enroll wps request.
275  *   - net_event->ProfileName : Profile Identifier corresponding to the event
276  *   - net_event->Error       : Its value will be NET_ERR_NONE in case of success and error cause in case of failure
277  *   - net_event->Data        : Pointer to net_profile_info_t
278  *     - If the connection open successfully, application can get the connected profile information \n
279  *       If the connection is failed to establish, net_profile_info_t also contains NULL value
280  *
281  */
282
283 typedef void (*net_event_cb_t ) ( const net_event_info_t* net_event, void* user_data);
284
285 /*==================================================================================================
286                                      FUNCTION PROTOTYPES
287 ==================================================================================================*/
288
289 /*****************************************************************************************/
290 /* net_register_client API function prototype
291  * int net_register_client(net_event_cb_t event_cb, void *user_data);
292  */
293
294 /**
295  * \brief       This API shall register the client application with the ConnMan.
296  *
297  * \par Sync (or) Async:
298  * This is a Synchronous API.
299  *
300  * \par Important Notes:
301  *        It is mandatory for the client application to register with ConnMan with this API before using any of its services.\n
302  *        The value of event_cb cannot be NULL. Otherwise, error NET_ERR_INVALID_PARAM will be returned by the API.\n
303  *        All the Asynchronous Events from ConnMan will be sent to the client App through the callback function (event_cb) registered with this API.
304  *
305  * \warning
306  *  None
307  *
308  * \param[in] event_cb     Application Callback function pointer to receive ConnMan events
309  * \param[in] user_data    user data 
310  *
311  * \par Async Response Message:
312  *        None.
313  * \par Precondition:
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 - indicating that API parameter value is invalid.\n
319  * - NET_ERR_APP_ALREADY_REGISTERED - indicating that client application is already registered,it can't be registered again.\n
320  * - NET_ERR_UNKNOWN - indicating that registration has failed.\n
321  *
322  * \par Prospective Clients:
323  * External Apps.
324  *
325  * \par Example Program:
326  *
327  * int result;
328  *
329  * result = net_register_client(event_cb , user_data);
330  *
331  * if(result == NET_ERR_NONE).........
332  *
333  *
334  *
335 ******************************************************************************************/
336 int net_register_client(net_event_cb_t event_cb, void *user_data);
337
338 /*****************************************************************************************/
339 /* net_deregister_client API function prototype
340 * int net_deregister_client(void);
341 */
342
343 /**
344  * \brief This API shall deregister the client application with the ConnMan.
345  *
346  * \par Sync (or) Async:
347  * This is a Synchronous API.
348  *
349  * \par Important Notes:
350  *        After deregistration, Application will be restricted from using other ConnMan APIs/Services.\n
351  *        De-register is not allowed when any connection is in active or transition state (activation or deactivation in progress).
352  *
353  * \warning
354  *  None
355  *
356  *
357  * \par Async Response Message:
358  *        None
359  *
360  * \par Precondition:
361  *        Application must already be registered with the ConnMan.
362  *
363  * \return Return Type (int) \n
364  * - NET_ERR_NONE  - indicating that the operation has completed successfully. \n
365  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
366  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
367  *
368  *
369  * \par Prospective Clients:
370  * External Apps.
371  *
372  * \par Example Program:
373  *
374  * int result;
375  *
376  * result = net_deregister_client();
377  *
378  * if(result == NET_ERR_NONE).........
379  *
380  *
381  *
382 ******************************************************************************************/
383 int net_deregister_client(void);
384
385 /*****************************************************************************************/
386 /* net_open_connection_with_profile API function prototype
387  * int net_open_connection_with_profile(const char *profile_name);
388  */
389
390 /**
391  * \brief  This API will establish a data connection with specific profile name
392  *
393  * \par Sync (or) Async:
394  * This is an Asynchronous API.
395  *
396  * \par Important Notes:
397  *        This API is a Non-Blocking API. Return value only implies whether the request is sent successfully or not. \n
398  *            Return value Success does not imply that the connection is established successfully. \n
399  *            If application needs to make a connection with specific profile name, it can make a connection with this api. \n
400  *            Get the profile name is referred to net_get_profile_list(). \n
401  *            If Connection is already existed, this API will share the active connection with the calling application. \n
402  *            If Connection is already existed, and same application is trying to open connection, this API will return error.
403  *
404  * \par Notes :
405  *
406  *      ConnMan requests transport plug-in interface to open a new connection only if connection is not already established. \n
407  *      If there is already a connection , then same connection will be shared.
408  *
409  * \warning
410  *  None
411  *
412  * \param [in]  profile_name     specific profile name
413  *
414  * \par Async Response Message:
415  *        NET_EVENT_OPEN_RSP: Connection Establishment response will be sent asynchronously to the App in the callback function registered.\n
416  *        refer to net_event_cb_t()
417  *
418  * \par Precondition:
419  *        Application must already be registered with the ConnMan.
420  *
421  * \return Return Type (int) \n
422  * - NET_ERR_NONE  - indicating that the operation has completed successfully. \n
423  * - NET_ERR_APP_NOT_REGISTERED -indicating that client is not registered with CM and it cannot use CM services.\n
424  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
425  * - NET_ERR_INVALID_OPERATION  - indicating that open connection operation is not allowed in the current state.\n
426  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
427  *
428  *
429  * \par Prospective Clients:
430  * External Apps.
431  *
432  * \par Example Program:
433  *
434  * int result;
435  *
436  * result = net_open_connection_with_profile(profile_name);
437  *
438  * if(result == NET_ERR_NONE)......
439  *
440  *
441  *
442 ******************************************************************************************/
443 int net_open_connection_with_profile(const char *profile_name);
444
445 /*****************************************************************************************/
446 /* net_open_connection_with_preference API function prototype
447  * int net_open_connection_with_preference(net_service_type_t service_type);
448  */
449
450 /**
451  * \brief  This API will establish a data connection with specific service type
452  *
453  * \par Sync (or) Async:
454  * This is an Asynchronous API.
455  *
456  * \par Important Notes:
457  *        This API is a Non-Blocking API. Return value only implies whether the request is sent successfully or not. \n
458  *            Return value Success does not imply that the connection is established successfully. \n
459  *            If application needs to make a connection with specific service type, it can make a connection with this api. \n
460  *            If Connection is already existed, this API will share the active connection with the calling application. \n
461  *            If Connection is already exited, and same application is trying to open connection, this API will return error.
462  *
463  * \par Notes :
464  *
465  *      ConnMan requests transport plug-in interface to open a new connection only if connection is not already established. \n
466  *      If there is already a connection , then same connection will be shared.
467  *
468  * \warning
469  *  None
470  *
471  * \param [in]  service_type     specific service type
472  *
473  * \par Async Response Message:
474  *        NET_EVENT_OPEN_RSP: Connection Establishment response will be sent asynchronously to the App in the callback function registered.\n
475  *        refer to net_event_cb_t()
476  *
477  * \par Precondition:
478  *        Application must already be registered with the ConnMan.
479  *
480  * \return Return Type (int) \n
481  * - NET_ERR_NONE - indicating that the operation has completed successfully. \n
482  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
483  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
484  * - NET_ERR_INVALID_OPERATION - indicating that open connection operation is not allowed in the current state.\n
485  * - NET_ERR_NO_SERVICE - indicating that service is not found.\n
486  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
487  *
488  *
489  * \par Prospective Clients:
490  * External Apps.
491  *
492  * \par Example Program:
493  *
494  * int result;
495  *
496  * result = net_open_connection_with_preference(service_type);
497  *
498  * if(result == NET_ERR_NONE)......
499  *
500  *
501  *
502 ******************************************************************************************/
503 int net_open_connection_with_preference(net_service_type_t service_type);
504
505 /*****************************************************************************************/
506 /* net_close_connection API function prototype
507  * int net_close_connection(const char *profile_name);
508  */
509
510 /**
511  * \brief       This API will terminate the connection. This API can also be used to abort a connection in progress.
512  *
513  * \par Sync (or) Async:
514  * This is an Asynchronous API.
515  *
516  * \par Important Notes:
517  *        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
518  *
519  * \warning
520  *  None
521  *
522  * \par Notes :
523  *              Application must be already registered with the ConnMan. \n
524  *
525  * \param [in]  profile_name     specific profile name
526  *
527  * \par Async Response Message:
528  *        NET_EVENT_CLOSE_RSP: Connection Close response will be sent asynchronously to the App in the callback function registered\n
529  *        refer to net_event_cb_t()
530  *
531  * \par Precondition:
532  *        Application must have an active data connection
533  *
534  * \return Return Type (int) \n
535  * - NET_ERR_NONE  - indicating that the operation has completed successfully. \n
536  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
537  * - NET_ERR_INVALID_OPERATION  - indicating that close connection operation is not allowed in the current state.\n
538  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
539  *
540  * \par Prospective Clients:
541  * External Apps.
542  *
543  * \par Example Program:
544  *
545  * int result;
546  *
547  * result = net_close_connection(profile_name);
548  *
549  * if(result == NET_ERR_NONE).........
550  *
551  *
552  *
553 ******************************************************************************************/
554 int net_close_connection(const char *profile_name);
555
556 /**
557  * \}
558  */
559
560 /**
561  * \addtogroup  common_info
562  * \{
563 */
564
565 /*****************************************************************************************/
566 /* net_get_active_net_info API function prototype
567  * int net_get_active_net_info(net_profile_info_t *active_profile_info);
568  */
569
570 /**
571  * \brief  This API returns the information of active(default) network profile.
572  *
573  * \par Sync (or) Async:
574  * This is a Synchronous API.
575  *
576  * \par Important Notes:
577  *              On success, profile information shall be copied to active_profile_info parameter in net_profile_info_t format.
578  *
579  * \par Notes :
580  *  None
581  *
582  * \warning
583  *  None
584  *
585  * \param[out]  active_profile_info     The information of active(default) network profile.
586  *
587  * \par Async Response Message:
588  *  None
589  *
590  * \par Precondition:
591  *        Application must already be registered with the CM server.
592  *
593  * \return Return Type (int) \n
594  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
595  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
596  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
597  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
598  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
599  *
600  * \par Prospective Clients:
601  * External Apps.
602  *
603  * \par Example Program:
604  *
605  * net_profile_info_t active_profile_info;
606  *
607  * int result = net_get_active_net_info(&active_profile_info);
608  *
609  * if(result == NET_ERR_NONE)......
610  *
611  *
612  *
613 ******************************************************************************************/
614 int net_get_active_net_info(net_profile_info_t *active_profile_info);
615
616 /*****************************************************************************************/
617 /**
618  * \brief  This API returns ip address of active(default) network profile.
619  *
620  * \par Sync (or) Async:
621  * These is a Synchronous API.
622  *
623  * \par Important Notes:
624  *              On success, the information shall be copied to the parameter in each format.
625  *
626  * \param[out]  ip_address  ip address of active(default) network profile.
627  *
628  * \par Precondition:
629  *        Application must already be registered with the CM server.
630  *
631  * \return Return Type (int) \n
632  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
633  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
634  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
635  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
636  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
637  *
638  * \par Prospective Clients:
639  * External Apps.
640  *
641  * \par Example Program:
642  *
643  * net_addr_t ip_address;
644  *
645  * int result = net_get_active_ipaddress(&ip_address);
646  *
647  * if(result == NET_ERR_NONE)......
648  *
649 ******************************************************************************************/
650 int net_get_active_ipaddress(net_addr_t *ip_address);
651
652 /*****************************************************************************************/
653 /**
654  * \brief  This API returns netmask address of active(default) network profile.
655  *
656  * \par Sync (or) Async:
657  * These is a Synchronous API.
658  *
659  * \par Important Notes:
660  *              On success, the information shall be copied to the parameter in each format.
661  *
662  * \param[out]  netmask  netmask address of active(default) network profile.
663  *
664  * \par Precondition:
665  *        Application must already be registered with the CM server.
666  *
667  * \return Return Type (int) \n
668  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
669  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
670  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
671  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
672  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
673  *
674  * \par Prospective Clients:
675  * External Apps.
676  *
677  * \par Example Program:
678  *
679  * net_addr_t netmask;
680  *
681  * int result = net_get_active_netmask(&netmask);
682  *
683  * if(result == NET_ERR_NONE)......
684  *
685 ******************************************************************************************/
686 int net_get_active_netmask(net_addr_t *netmask);
687
688 /*****************************************************************************************/
689 /**
690  * \brief  This API returns gateway address of active(default) network profile.
691  *
692  * \par Sync (or) Async:
693  * These is a Synchronous API.
694  *
695  * \par Important Notes:
696  *              On success, the information shall be copied to the parameter in each format.
697  *
698  * \param[out]  gateway  gateway address of active(default) network profile.
699  *
700  * \par Precondition:
701  *        Application must already be registered with the CM server.
702  *
703  * \return Return Type (int) \n
704  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
705  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
706  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
707  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
708  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
709  *
710  * \par Prospective Clients:
711  * External Apps.
712  *
713  * \par Example Program:
714  *
715  * net_addr_t gateway;
716  *
717  * int result = net_get_active_gateway(&gateway);
718  *
719  * if(result == NET_ERR_NONE)......
720  *
721 ******************************************************************************************/
722 int net_get_active_gateway(net_addr_t *gateway);
723
724 /*****************************************************************************************/
725 /**
726  * \brief  This API returns DNS address of active(default) network profile.
727  *
728  * \par Sync (or) Async:
729  * These is a Synchronous API.
730  *
731  * \par Important Notes:
732  *              On success, the information shall be copied to the parameter in each format.
733  *
734  * \param[out]  dns  DNS address of active(default) network profile.
735  *
736  * \par Precondition:
737  *        Application must already be registered with the CM server.
738  *
739  * \return Return Type (int) \n
740  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
741  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
742  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
743  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
744  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
745  *
746  * \par Prospective Clients:
747  * External Apps.
748  *
749  * \par Example Program:
750  *
751  * net_addr_t dns;
752  *
753  * int result = net_get_active_dns(&dns);
754  *
755  * if(result == NET_ERR_NONE)......
756  *
757 ******************************************************************************************/
758 int net_get_active_dns(net_addr_t *dns);
759
760 /*****************************************************************************************/
761 /**
762  * \brief  This API returns ESSID of active(default) network profile.
763  *
764  * \par Sync (or) Async:
765  * These is a Synchronous API.
766  *
767  * \par Important Notes:
768  *              On success, the information shall be copied to the parameter in each format.
769  *
770  * \param[out]  essid  ESSID of active(default) network profile.
771  *
772  * \par Precondition:
773  *        Application must already be registered with the CM server and wifi is connected.
774  *
775  * \return Return Type (int) \n
776  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
777  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
778  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
779  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
780  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
781  *
782  * \par Prospective Clients:
783  * External Apps.
784  *
785  * \par Example Program:
786  *
787  * net_essid_t essid;
788  *
789  * int result = net_get_active_essid(&essid);
790  *
791  * if(result == NET_ERR_NONE)......
792  *
793 ******************************************************************************************/
794 int net_get_active_essid(net_essid_t *essid);
795
796 /*****************************************************************************************/
797 /**
798  * \brief  This API returns proxy string of active(default) network profile.
799  *
800  * \par Sync (or) Async:
801  * These is a Synchronous API.
802  *
803  * \par Important Notes:
804  *              On success, the information shall be copied to the parameter in each format.
805  *
806  * \param[out]  proxy  proxy string of active(default) network profile.
807  *
808  * \par Precondition:
809  *        Application must already be registered with the CM server.
810  *
811  * \return Return Type (int) \n
812  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
813  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
814  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
815  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
816  * - NET_ERR_NO_SERVICE - indicating that there is no active network.\n
817  *
818  * \par Prospective Clients:
819  * External Apps.
820  *
821  * \par Example Program:
822  *
823  * net_proxy_t proxy;
824  *
825  * int result = net_get_active_proxy(&proxy);
826  *
827  * if(result == NET_ERR_NONE)......
828  *
829 ******************************************************************************************/
830 int net_get_active_proxy(net_proxy_t *proxy);
831
832 /*****************************************************************************************/
833 /* net_get_network_status API function prototype
834  * int net_get_network_status(net_device_t device_type, net_cm_network_status_t* network_status);
835  */
836
837 /**
838  * \brief  This API returns The status of a specific network interface passed as a parameter.
839  *
840  * \par Sync (or) Async:
841  * This is a Synchronous API.
842  *
843  * \par Important Notes:
844  *  None
845  *
846  * \par Notes :
847  *  None
848  *
849  * \warning
850  *  None
851  *
852  * \param[in]   device_type     Queried network interface.
853  * \param[out]  network_status  The status of Queried network interface.
854  *
855  * \par Async Response Message:
856  *  None
857  *
858  * \par Precondition:
859  *        Application must already be registered with the CM server.
860  *
861  * \return Return Type (int) \n
862  * - NET_ERR_NONE  - indicating that the status of queried network interface is retrieved. \n
863  * - NET_ERR_APP_NOT_REGISTERED - indicating that client is not registered with CM and it cannot use CM services.\n
864  * - NET_ERR_UNKNOWN - indicating that an unknown error has occurred.\n
865  * - NET_ERR_INVALID_PARAM - indicating that API parameter value is invalid.\n
866  *
867  * \par Prospective Clients:
868  * External Apps.
869  *
870  * \par Example Program:
871  *
872  * net_cm_network_status_t status;
873  *
874  * int result = net_get_network_status(NET_MOBILE_TYPE, &status);
875  *
876  * if(result == TRUE)......
877  *
878  *
879  *
880 ******************************************************************************************/
881 int net_get_network_status(net_device_t device_type, net_cm_network_status_t* network_status);
882
883 /*****************************************************************************************/
884 /* net_is_connected API function prototype
885  * int net_is_connected(void);
886  */
887
888 /**
889  * \brief  This API returns the connection status of process
890  *
891  * \par Sync (or) Async:
892  * This is a Synchronous API.
893  *
894  * \par Important Notes:
895  *  None
896  *
897  * \par Notes :
898  *  None
899  *
900  * \warning
901  *  None
902  *
903  *
904  * \par Async Response Message:
905  *  None
906  *
907  * \par Precondition:
908  *        Application must already be registered with the CM server.
909  *
910  * \return Return Type (int) \n
911  * - 1  - connected
912  * - 0 - not connected
913  *
914  * \par Prospective Clients:
915  * External Apps.
916  *
917  * \par Example Program:
918  *
919  * int result = net_is_connected();
920  *
921  * if(result == 1)......
922  *
923  *
924  *
925 ******************************************************************************************/
926 int net_is_connected(void);
927
928 /**
929  * \}
930  */
931
932 #ifdef __cplusplus
933 }
934 #endif /* __cplusplus */
935
936 #endif