Add wrapper to send event callback
[platform/core/connectivity/libnet-client.git] / include / internal / network-info.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_INFO_H__
21 #define __NETWORK_INFO_H__
22
23 #include <gio/gio.h>
24
25 #include "network-cm-intf.h"
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 /*****************************************************************************
32  *      Macros and Typedefs
33  *****************************************************************************/
34
35 /*****************************************************************************
36  *      Global Enums
37  *****************************************************************************/
38
39 #define NET_TECH_LENGTH_MAX 64
40
41 /*****************************************************************************
42  *      Global Structures
43  *****************************************************************************/
44
45 typedef enum
46 {
47         NETWORK_REQUEST_TYPE_SCAN = 0x00,
48         NETWORK_REQUEST_TYPE_OPEN_CONNECTION,
49         NETWORK_REQUEST_TYPE_CLOSE_CONNECTION,
50         NETWORK_REQUEST_TYPE_WIFI_POWER,
51         NETWORK_REQUEST_TYPE_ENROLL_WPS,
52         NETWORK_REQUEST_TYPE_SPECIFIC_SCAN,
53         NETWORK_REQUEST_TYPE_SET_DEFAULT,
54         NETWORK_REQUEST_TYPE_RESET_DEFAULT,
55         NETWORK_REQUEST_TYPE_MAX
56 } network_async_request_type_t;
57
58 typedef struct
59 {
60         int flag;
61         char ProfileName[NET_PROFILE_NAME_LEN_MAX+1];
62 } network_request_table_t;
63
64 typedef struct {
65         GDBusConnection *connection;
66         GCancellable *cancellable;
67
68         guint subscribe_id_connman_state;
69         guint subscribe_id_mesh_state;
70         guint subscribe_id_connman_error;
71         guint subscribe_id_netconfig;
72         guint subscribe_id_netconfig_wifi;
73
74         net_state_type_t state_table[NET_DEVICE_MAX];
75         network_request_table_t request_table[NETWORK_REQUEST_TYPE_MAX];
76
77         net_event_cb_t event_callback;
78         void* user_data;
79
80         int refcount;
81 } network_info_t;
82
83 typedef struct
84 {
85         char technology[NET_TECH_LENGTH_MAX];
86         char AvailableTechnology;
87         char EnabledTechnology;
88         char ConnectedTechnology;
89         char DefaultTechnology;
90         /* Connman 1.x */
91         unsigned char Connected;
92         unsigned char Powered;
93 } network_tech_state_info_t;
94
95 /**
96  * This is the profile structure exposed from modman.
97  */
98 typedef struct
99 {
100         /** Profile name(path) */
101         char ProfileName[NET_PROFILE_NAME_LEN_MAX+1];
102         /** Service type of this profile context */
103         net_service_type_t ServiceType;
104         /** Pdn type of this profile context */
105         net_pdn_type_e PdnType;
106         /** Roam Pdn type of this profile context */
107         net_pdn_type_e RoamPdnType;
108         /** Network Access Point Name */
109         char Apn[NET_PDP_APN_LEN_MAX+1];
110         /** Authentication info of the PDP profile */
111         net_auth_info_t AuthInfo;
112         /**Proxy address */
113         char ProxyAddr[NET_PROXY_LEN_MAX+1];
114         /** Browser Home URL or MMS server URL */
115         char HomeURL[NET_HOME_URL_LEN_MAX+1];
116         char Keyword[NET_PDP_APN_LEN_MAX+1];
117         char Hidden;
118         char Editable;
119         char DefaultConn;
120 } net_telephony_profile_info_t;
121
122 /*****************************************************************************
123  *      Global Functions
124  *****************************************************************************/
125 gboolean _network_info_is_ref(network_info_t *network_info);
126 void _network_info_ref(network_info_t *network_info);
127 void _network_info_unref(network_info_t *network_info);
128
129 #ifdef __cplusplus
130 }
131 #endif
132
133 #endif /* __NETWORK_INFO_H__ */