DA: Applying secure log
[platform/core/connectivity/net-config.git] / include / plugin.h
1 /*
2  * Network Configuration Module
3  *
4  * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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 __NETCONFIG_PLUGIN_H__
21 #define __NETCONFIG_PLUGIN_H__
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #include <glib.h>
28 #include <gio/gio.h>
29 #include <glib-object.h>
30
31 #include "neterror.h"
32
33 #define NETCONFIG_ADD_FOUND_AP_NOTI             "add_found_ap_noti"
34 #define NETCONFIG_DEL_FOUND_AP_NOTI             "del_found_ap_noti"
35 #define NETCONFIG_ADD_PORTAL_NOTI               "add_portal_noti"
36 #define NETCONFIG_DEL_PORTAL_NOTI               "del_portal_noti"
37 #define NETCONFIG_ADD_IP_CONFLICT_NOTI          "add_ip_conflict_noti"
38 #define NETCONFIG_DEL_IP_CONFLICT_NOTI          "del_ip_conflict_noti"
39
40 struct wifi_authentication_data {
41         int auth_result;
42         int resp_length;
43         int authentication_key_length;
44         int cipher_length;
45         int integrity_length;
46         char *resp_data;
47         char *authentication_key;
48         char *cipher_data;
49         char *integrity_data;
50 };
51
52 struct netconfig_headed_plugin_t {
53         void(*pop_device_picker) (void);
54         gboolean(*send_notification_to_net_popup) (const char *, const char *);
55         int(*send_message_to_net_popup) (const char *, const char *, const char *, const char *);
56         int(*send_restriction_to_net_popup) (const char *, const char *, const char *);
57         void(*set_system_event) (int, int, int);
58         void(*pop_wifi_connected_poppup) (const char *);
59 };
60
61 struct netconfig_telephony_plugin_t {
62         void(*get_telephony_network_type) (int *svctype, int *pstype);
63         gboolean(*wifi_get_sim_imsi) (void *wifi, GDBusMethodInvocation *context);
64         netconfig_error_e(*wifi_req_aka_auth) (GArray *rand_data, GArray *autn_data,
65                         GDBusMethodInvocation *context, struct wifi_authentication_data **data);
66         gboolean(*wifi_req_sim_auth) (GArray *rand_data,
67                         GDBusMethodInvocation *context, struct wifi_authentication_data **data);
68         gboolean(*tapi_check_sim_state) (void);
69         gboolean(*wifi_get_aka_authdata) (void *wifi,
70                         GDBusMethodInvocation *context, struct wifi_authentication_data **data);
71         gboolean(*wifi_get_sim_authdata) (void *wifi,
72                         GDBusMethodInvocation *context, struct wifi_authentication_data **data);
73 };
74
75 struct netconfig_stc_plugin_t {
76         void (*get_stc_dn_stats) (time_t, time_t, GSList **);
77         void (*get_stc_wifi_stats) (time_t, time_t, GSList **);
78 };
79
80 #define BATTERY_ATM_LIST            "atm_list"
81 #define BATTERY_ATM_APP_ID          "atm_app_id"
82 #define BATTERY_ATM_RX              "atm_rx"
83 #define BATTERY_ATM_TX              "atm_tx"
84
85 #define BATTERY_DN_TIME_LEVEL_0     "time_level_0"
86 #define BATTERY_DN_TIME_LEVEL_1     "time_level_1"
87 #define BATTERY_DN_TIME_LEVEL_2     "time_level_2"
88 #define BATTERY_DN_TIME_LEVEL_3     "time_level_3"
89 #define BATTERY_DN_TIME_LEVEL_4     "time_level_4"
90 #define BATTERY_DN_TIME_LEVEL_5     "time_level_5"
91 #define BATTERY_DN_TIME_LEVEL_6     "time_level_6"
92
93 #define BATTERY_WIFI_TIME_LEVEL_0   "time_level_0"
94 #define BATTERY_WIFI_TIME_LEVEL_1   "time_level_1"
95 #define BATTERY_WIFI_TIME_LEVEL_2   "time_level_2"
96 #define BATTERY_WIFI_TIME_LEVEL_3   "time_level_3"
97 #define BATTERY_WIFI_TIME_LEVEL_4   "time_level_4"
98 #define BATTERY_WIFI_START_TIME     "start_time"
99 #define BATTERY_WIFI_END_TIME       "end_time"
100 #define BATTERY_WIFI_SCAN_TIME      "scan_time"
101
102 typedef struct {
103         char *app_id;
104         uint time;
105         uint rx;
106         uint tx;
107 } battery_app_data_s;
108
109 typedef struct {
110         uint time_level_0;
111         uint time_level_1;
112         uint time_level_2;
113         uint time_level_3;
114         uint time_level_4;
115         uint time_level_5;
116         uint time_level_6;
117         GSList *atm_list;
118         GSList *data_list;
119         time_t start_time;
120         time_t end_time;
121 } battery_dn_data_s;
122
123 typedef struct {
124         uint time_level_0;
125         uint time_level_1;
126         uint time_level_2;
127         uint time_level_3;
128         uint time_level_4;
129         time_t start_time;
130         time_t end_time;
131         uint scan_time;
132         GSList *atm_list;
133         GSList *data_list;
134 } battery_wifi_data_s;
135
136 typedef void (*stc_get_stats_cb) (time_t from, time_t to, GSList **list);
137
138 struct netconfig_battery_plugin_t {
139         void (*start_dn_data) (void);
140         void (*end_dn_data) (int, stc_get_stats_cb);
141         void (*update_dn_rssi) (int);
142
143         void (*start_wifi_data) (void);
144         void (*end_wifi_data) (int, stc_get_stats_cb);
145         void (*update_wifi_scan) (int);
146         void (*update_wifi_rssi) (int);
147
148         void (*get_battery_dn_list) (void *, stc_get_stats_cb);
149         void (*get_battery_wifi_list) (void *, stc_get_stats_cb);
150 };
151
152 typedef void *bm_data_h;
153 typedef enum {
154         BM_DATA_TYPE_BLE,
155         BM_DATA_TYPE_WIFI,
156         BM_DATA_TYPE_CPU,
157         BM_DATA_TYPE_DISPLAY,
158         BM_DATA_TYPE_DEVICE_NETWORK,
159         BM_DATA_TYPE_GPS_SENSOR,
160         BM_DATA_TYPE_HRM_SENSOR,
161         BM_DATA_TYPE_BATTERY,
162         BM_DATA_TYPE_MAX
163 } bm_plugin_data_type_e;
164
165 struct netconfig_bm_plugin_t {
166         int (*init) (void);
167         int (*deinit) (void);
168         int (*get_feature_data) (bm_data_h *, bm_plugin_data_type_e);
169 };
170
171 struct netconfig_online_monitor_plugin_t {
172         int (*init) (void);
173         int (*deinit) (void);
174         int (*notify_online_state) (char *, gboolean);
175 };
176
177 typedef enum {
178         SYS_EVT_NETWORK_STATUS = 0,
179         SYS_EVT_WIFI_STATE = 1,
180         EKEY_NETWORK_STATUS = 10,
181         EKEY_WIFI_STATE = 11,
182         EVAL_NETWORK_WIFI = 20,
183         EVAL_NETWORK_CELLULAR = 21,
184         EVAL_NETWORK_ETHERNET = 22,
185         EVAL_NETWORK_BT = 23,
186         EVAL_NETWORK_DISCONNECTED = 24,
187         EVAL_WIFI_CONNECTED = 25,
188         EVAL_WIFI_ON = 26,
189         EVAL_WIFI_OFF = 27,
190 } sys_evt_t;
191
192 void netconfig_complete_get_sim_imsi(void *wifi, GDBusMethodInvocation *context, char *imsi);
193 void netconfig_complete_get_aka_auth(void *wifi, GDBusMethodInvocation *context, GArray *array);
194 void netconfig_complete_get_sim_auth(void *wifi, GDBusMethodInvocation *context, GArray *array);
195 void netconfig_wifi_power_on();
196
197 #ifdef __cplusplus
198 }
199 #endif
200
201 #endif /* __NETCONFIG_PLUGIN_H__ */