upload tizen1.0 source
[framework/api/connection.git] / src / connection.c
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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 #include <stdio.h>
18 #include <string.h>
19 #include <dlog.h>
20 #include <glib.h>
21 #include <vconf/vconf.h>
22 #include <net_connection_private.h>
23
24 #define TIZEN_NET_CONNECTION "CAPI_NETWORK_CONNECTION"
25
26 static GSList *conn_handle_list = NULL;
27
28 static void __connection_cb_state_change_cb(keynode_t *node, void *user_data);
29 static void __connection_cb_ip_change_cb(keynode_t *node, void *user_data);
30 static void __connection_cb_proxy_change_cb(keynode_t *node, void *user_data);
31
32
33 static int __connection_convert_net_state(int status)
34 {
35         switch (status) {
36         case VCONFKEY_NETWORK_CELLULAR:
37                 return CONNECTION_NETWORK_STATE_CELLULAR;
38         case VCONFKEY_NETWORK_WIFI:
39                 return CONNECTION_NETWORK_STATE_WIFI;
40         default:
41                 return CONNECTION_NETWORK_STATE_DISCONNECTED;
42         }
43 }
44
45 static int __connection_convert_cellular_state(int status)
46 {
47         switch (status) {
48         case VCONFKEY_NETWORK_CELLULAR_ON:
49                 return CONNECTION_CELLULAR_STATE_AVAILABLE;
50         case VCONFKEY_NETWORK_CELLULAR_3G_OPTION_OFF:
51                 return CONNECTION_CELLULAR_STATE_CALL_ONLY_AVAILABLE;
52         case VCONFKEY_NETWORK_CELLULAR_ROAMING_OFF:
53                 return CONNECTION_CELLULAR_STATE_ROAMING_OFF;
54         case VCONFKEY_NETWORK_CELLULAR_FLIGHT_MODE:
55                 return CONNECTION_CELLULAR_STATE_FLIGHT_MODE;
56         default:
57                 return CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE;
58         }
59 }
60
61 static int __connection_convert_wifi_state(int status)
62 {
63         switch (status) {
64         case VCONFKEY_NETWORK_WIFI_CONNECTED:
65                 return CONNECTION_WIFI_STATE_CONNECTED;
66         case VCONFKEY_NETWORK_WIFI_NOT_CONNECTED:
67                 return CONNECTION_WIFI_STATE_DISCONNECTED;
68         default:
69                 return CONNECTION_WIFI_STATE_DEACTIVATED;
70         }
71 }
72
73 static int __connection_get_state_changed_callback_count(void)
74 {
75         GSList *list;
76         int count = 0;
77
78         for (list = conn_handle_list; list; list = list->next) {
79                 connection_handle_s *local_handle = (connection_handle_s *)list->data;
80                 if (local_handle->state_changed_callback) count++;
81         }
82
83         return count;
84 }
85
86 static int __connection_get_ip_changed_callback_count(void)
87 {
88         GSList *list;
89         int count = 0;
90
91         for (list = conn_handle_list; list; list = list->next) {
92                 connection_handle_s *local_handle = (connection_handle_s *)list->data;
93                 if (local_handle->ip_changed_callback) count++;
94         }
95
96         return count;
97 }
98
99 static int __connection_get_proxy_changed_callback_count(void)
100 {
101         GSList *list;
102         int count = 0;
103
104         for (list = conn_handle_list; list; list = list->next) {
105                 connection_handle_s *local_handle = (connection_handle_s *)list->data;
106                 if (local_handle->proxy_changed_callback) count++;
107         }
108
109         return count;
110 }
111
112 static int __connection_set_state_changed_callback(connection_h connection, void *callback, void *user_data)
113 {
114         connection_handle_s *local_handle = (connection_handle_s *)connection;
115
116         if (callback) {
117                 if (__connection_get_state_changed_callback_count() == 0)
118                         vconf_notify_key_changed(VCONFKEY_NETWORK_STATUS ,
119                                                 __connection_cb_state_change_cb,
120                                                 NULL);
121
122                 local_handle->state_changed_user_data = user_data;
123         } else {
124                 if (local_handle->state_changed_callback &&
125                     __connection_get_state_changed_callback_count() == 1)
126                         vconf_ignore_key_changed(VCONFKEY_NETWORK_STATUS,
127                                                 __connection_cb_state_change_cb);
128         }
129
130         local_handle->state_changed_callback = callback;
131         return CONNECTION_ERROR_NONE;
132 }
133
134 static int __connection_set_ip_changed_callback(connection_h connection, void *callback, void *user_data)
135 {
136         connection_handle_s *local_handle = (connection_handle_s *)connection;
137
138         if (callback) {
139                 if (__connection_get_ip_changed_callback_count() == 0)
140                         vconf_notify_key_changed(VCONFKEY_NETWORK_IP,
141                                                 __connection_cb_ip_change_cb,
142                                                 NULL);
143
144                 local_handle->ip_changed_user_data = user_data;
145         } else {
146                 if (local_handle->ip_changed_callback &&
147                     __connection_get_ip_changed_callback_count() == 1)
148                         vconf_ignore_key_changed(VCONFKEY_NETWORK_IP,
149                                                 __connection_cb_ip_change_cb);
150         }
151
152         local_handle->ip_changed_callback = callback;
153         return CONNECTION_ERROR_NONE;
154 }
155
156 static int __connection_set_proxy_changed_callback(connection_h connection, void *callback, void *user_data)
157 {
158         connection_handle_s *local_handle = (connection_handle_s *)connection;
159
160         if (callback) {
161                 if (__connection_get_proxy_changed_callback_count() == 0)
162                         vconf_notify_key_changed(VCONFKEY_NETWORK_PROXY,
163                                                 __connection_cb_proxy_change_cb,
164                                                 NULL);
165
166                 local_handle->proxy_changed_callback = user_data;
167         } else {
168                 if (local_handle->proxy_changed_callback &&
169                     __connection_get_proxy_changed_callback_count() == 1)
170                         vconf_ignore_key_changed(VCONFKEY_NETWORK_PROXY,
171                                                 __connection_cb_proxy_change_cb);
172         }
173
174         local_handle->proxy_changed_callback = callback;
175         return CONNECTION_ERROR_NONE;
176 }
177
178 static void __connection_cb_state_change_cb(keynode_t *node, void *user_data)
179 {
180         LOGI(TIZEN_NET_CONNECTION,"Net Status Changed Indication\n");
181
182         GSList *list;
183         int state = vconf_keynode_get_int(node);
184
185         for (list = conn_handle_list; list; list = list->next) {
186                 connection_handle_s *local_handle = (connection_handle_s *)list->data;
187                 if (local_handle->state_changed_callback)
188                         local_handle->state_changed_callback(
189                                         __connection_convert_net_state(state),
190                                         local_handle->state_changed_user_data);
191         }
192 }
193
194 static void __connection_cb_ip_change_cb(keynode_t *node, void *user_data)
195 {
196         LOGI(TIZEN_NET_CONNECTION,"Net IP Changed Indication\n");
197
198         GSList *list;
199         char *ip_addr = vconf_keynode_get_str(node);
200
201         for (list = conn_handle_list; list; list = list->next) {
202                 connection_handle_s *local_handle = (connection_handle_s *)list->data;
203                 if (local_handle->ip_changed_callback)
204                         local_handle->ip_changed_callback(
205                                         ip_addr, NULL,
206                                         local_handle->ip_changed_user_data);
207         }
208 }
209
210 static void __connection_cb_proxy_change_cb(keynode_t *node, void *user_data)
211 {
212         LOGI(TIZEN_NET_CONNECTION,"Net IP Changed Indication\n");
213
214         GSList *list;
215         char *proxy = vconf_keynode_get_str(node);
216
217         for (list = conn_handle_list; list; list = list->next) {
218                 connection_handle_s *local_handle = (connection_handle_s *)list->data;
219                 if (local_handle->proxy_changed_callback)
220                         local_handle->proxy_changed_callback(
221                                         proxy, NULL,
222                                         local_handle->proxy_changed_user_data);
223         }
224 }
225
226 static bool __connection_check_handle_validity(connection_h connection)
227 {
228         GSList *list;
229
230         for (list = conn_handle_list; list; list = list->next)
231                 if (connection == list->data) return true;
232
233         return false;
234 }
235
236 int connection_create(connection_h* connection)
237 {
238         if (connection == NULL || __connection_check_handle_validity(*connection)) {
239                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
240                 return CONNECTION_ERROR_INVALID_PARAMETER;
241         }
242
243         *connection = g_try_malloc0(sizeof(connection_handle_s));
244         if (*connection != NULL) {
245                 LOGI(TIZEN_NET_CONNECTION, "New Handle Created %p\n", *connection);
246         } else {
247                 return CONNECTION_ERROR_OUT_OF_MEMORY;
248         }
249
250         conn_handle_list = g_slist_append(conn_handle_list, *connection);
251
252         return CONNECTION_ERROR_NONE;
253 }
254
255 int connection_destroy(connection_h connection)
256 {
257         if (connection == NULL || !(__connection_check_handle_validity(connection))) {
258                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
259                 return CONNECTION_ERROR_INVALID_PARAMETER;
260         }
261
262         conn_handle_list = g_slist_remove(conn_handle_list, connection);
263
264         LOGI(TIZEN_NET_CONNECTION, "Destroy Handle : %p\n", connection);
265
266         __connection_set_state_changed_callback(connection, NULL, NULL);
267         __connection_set_ip_changed_callback(connection, NULL, NULL);
268         __connection_set_proxy_changed_callback(connection, NULL, NULL);
269
270         g_free(connection);
271
272         return CONNECTION_ERROR_NONE;
273 }
274
275 int connection_get_network_state(connection_h connection, connection_network_state_e* state)
276 {
277         int status = 0;
278
279         if (state == NULL || !(__connection_check_handle_validity(connection))) {
280                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
281                 return CONNECTION_ERROR_INVALID_PARAMETER;
282         }
283
284         if (vconf_get_int(VCONFKEY_NETWORK_STATUS, &status)) {
285                 LOGI(TIZEN_NET_CONNECTION,"vconf_get_int Failed = %d\n", status);
286                 return CONNECTION_ERROR_INVALID_OPERATION;
287         }
288
289         LOGI(TIZEN_NET_CONNECTION,"Connected Network = %d\n", status);
290
291         *state = __connection_convert_net_state(status);
292
293         return CONNECTION_ERROR_NONE;
294 }
295
296 int connection_get_ip_address(connection_h connection, connection_address_family_e address_family, char** ip_address)
297 {
298         if (ip_address == NULL || !(__connection_check_handle_validity(connection))) {
299                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
300                 return CONNECTION_ERROR_INVALID_PARAMETER;
301         }
302
303         switch (address_family) {
304         case CONNECTION_ADDRESS_FAMILY_IPV4:
305                 *ip_address = vconf_get_str(VCONFKEY_NETWORK_IP);
306                 break;
307         case CONNECTION_ADDRESS_FAMILY_IPV6:
308                 LOGI(TIZEN_NET_CONNECTION, "Not supported yet\n");
309                 return CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
310                 break;
311         default:
312                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
313                 return CONNECTION_ERROR_INVALID_PARAMETER;
314         }
315
316         if (*ip_address == NULL) {
317                 LOGI(TIZEN_NET_CONNECTION,"vconf_get_str Failed\n");
318                 return CONNECTION_ERROR_INVALID_OPERATION;
319         }
320
321         LOGI(TIZEN_NET_CONNECTION,"IP Address %s\n", *ip_address);
322
323         return CONNECTION_ERROR_NONE;
324 }
325
326 int connection_get_proxy(connection_h connection, connection_address_family_e address_family, char** proxy)
327 {
328         if (proxy == NULL || !(__connection_check_handle_validity(connection))) {
329                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
330                 return CONNECTION_ERROR_INVALID_PARAMETER;
331         }
332
333         switch (address_family) {
334         case CONNECTION_ADDRESS_FAMILY_IPV4:
335                 *proxy = vconf_get_str(VCONFKEY_NETWORK_PROXY);
336                 break;
337         case CONNECTION_ADDRESS_FAMILY_IPV6:
338                 LOGI(TIZEN_NET_CONNECTION, "Not supported yet\n");
339                 return CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
340                 break;
341         default:
342                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
343                 return CONNECTION_ERROR_INVALID_PARAMETER;
344         }
345
346         if (*proxy == NULL) {
347                 LOGI(TIZEN_NET_CONNECTION,"vconf_get_str Failed\n");
348                 return CONNECTION_ERROR_INVALID_OPERATION;
349         }
350
351         LOGI(TIZEN_NET_CONNECTION,"Proxy Address %s\n", *proxy);
352
353         return CONNECTION_ERROR_NONE;
354 }
355
356 int connection_get_cellular_state(connection_h connection, connection_cellular_state_e* state)
357 {
358         int status = 0;
359
360         if (state == NULL || !(__connection_check_handle_validity(connection))) {
361                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
362                 return CONNECTION_ERROR_INVALID_PARAMETER;
363         }
364
365         if (!vconf_get_int(VCONFKEY_NETWORK_CELLULAR_STATE, &status)) {
366                 LOGI(TIZEN_NET_CONNECTION,"Cellular = %d\n", status);
367                 *state = __connection_convert_cellular_state(status);
368                 return CONNECTION_ERROR_NONE;
369         } else {
370                 LOGI(TIZEN_NET_CONNECTION,"vconf_get_int Failed = %d\n", status);
371                 return CONNECTION_ERROR_INVALID_OPERATION;
372         }
373 }
374
375 int connection_get_wifi_state(connection_h connection, connection_wifi_state_e* state)
376 {
377         int status = 0;
378
379         if (state == NULL || !(__connection_check_handle_validity(connection))) {
380                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
381                 return CONNECTION_ERROR_INVALID_PARAMETER;
382         }
383
384         if (!vconf_get_int(VCONFKEY_NETWORK_WIFI_STATE, &status)) {
385                 LOGI(TIZEN_NET_CONNECTION,"WiFi = %d\n", status);
386                 *state = __connection_convert_wifi_state(status);
387                 return CONNECTION_ERROR_NONE;
388         } else {
389                 LOGI(TIZEN_NET_CONNECTION,"vconf_get_int Failed = %d\n", status);
390                 return CONNECTION_ERROR_INVALID_OPERATION;
391         }
392 }
393
394 int connection_set_network_state_changed_cb(connection_h connection,
395                                 connection_network_state_changed_cb callback, void* user_data)
396 {
397         if (callback == NULL || !(__connection_check_handle_validity(connection))) {
398                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
399                 return CONNECTION_ERROR_INVALID_PARAMETER;
400         }
401
402         return __connection_set_state_changed_callback(connection, callback, user_data);
403 }
404
405 int connection_unset_network_state_changed_cb(connection_h connection)
406 {
407         if (!(__connection_check_handle_validity(connection))) {
408                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
409                 return CONNECTION_ERROR_INVALID_PARAMETER;
410         }
411
412         return __connection_set_state_changed_callback(connection, NULL, NULL);
413 }
414
415 int connection_set_ip_address_changed_cb(connection_h connection,
416                                 connection_address_changed_cb callback, void* user_data)
417 {
418         if (callback == NULL || !(__connection_check_handle_validity(connection))) {
419                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
420                 return CONNECTION_ERROR_INVALID_PARAMETER;
421         }
422
423         return __connection_set_ip_changed_callback(connection, callback, user_data);
424 }
425
426 int connection_unset_ip_address_changed_cb(connection_h connection)
427 {
428         if (!(__connection_check_handle_validity(connection))) {
429                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
430                 return CONNECTION_ERROR_INVALID_PARAMETER;
431         }
432
433         return __connection_set_ip_changed_callback(connection, NULL, NULL);
434 }
435
436 int connection_set_proxy_address_changed_cb(connection_h connection,
437                                 connection_address_changed_cb callback, void* user_data)
438 {
439         if (callback == NULL || !(__connection_check_handle_validity(connection))) {
440                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
441                 return CONNECTION_ERROR_INVALID_PARAMETER;
442         }
443
444         return __connection_set_proxy_changed_callback(connection, callback, user_data);
445 }
446
447 int connection_unset_proxy_address_changed_cb(connection_h connection)
448 {
449         if (!(__connection_check_handle_validity(connection))) {
450                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
451                 return CONNECTION_ERROR_INVALID_PARAMETER;
452         }
453
454         return __connection_set_proxy_changed_callback(connection, NULL, NULL);
455 }
456
457 static int __fill_call_statistic(connection_h connection, stat_request_e member, int *size)
458 {
459         if (size == NULL || !(__connection_check_handle_validity(connection))) {
460                 LOGI(TIZEN_NET_CONNECTION, "Wrong Parameter Passed\n");
461                 return CONNECTION_ERROR_INVALID_PARAMETER;
462         }
463
464         switch (member) {
465         case LAST_SENT_DATA_SIZE:
466                 if (vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_SNT, size)) {
467                         LOGI(TIZEN_NET_CONNECTION,
468                                         "Cannot Get LAST_SENT_DATA_SIZE = %d\n",
469                                         *size);
470                         *size = 0;
471                         return CONNECTION_ERROR_INVALID_OPERATION;
472                 }
473                 LOGI(TIZEN_NET_CONNECTION,"LAST_SENT_DATA_SIZE:%d bytes\n", *size);
474
475                 break;
476         case LAST_RECEIVED_DATA_SIZE:
477                 if (vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_RCV, size)) {
478                         LOGI(TIZEN_NET_CONNECTION,
479                                         "Cannot Get LAST_RECEIVED_DATA_SIZE: = %d\n",
480                                         *size);
481                         *size = 0;
482                         return CONNECTION_ERROR_INVALID_OPERATION;
483                 }
484                 LOGI(TIZEN_NET_CONNECTION,"LAST_RECEIVED_DATA_SIZE:%d bytes\n", *size);
485                 break;
486         case TOTAL_SENT_DATA_SIZE:
487                 if (vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_SNT, size)) {
488                         LOGI(TIZEN_NET_CONNECTION,
489                                         "Cannot Get TOTAL_SENT_DATA_SIZE: = %d\n",
490                                         *size);
491                         *size = 0;
492                         return CONNECTION_ERROR_INVALID_OPERATION;
493                 }
494                 LOGI(TIZEN_NET_CONNECTION,"TOTAL_SENT_DATA_SIZE:%d bytes\n", *size);
495                 break;
496         case TOTAL_RECEIVED_DATA_SIZE:
497                 if (vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_RCV, size)) {
498                         LOGI(TIZEN_NET_CONNECTION,
499                                         "Cannot Get TOTAL_RECEIVED_DATA_SIZE: = %d\n",
500                                         *size);
501                         *size = 0;
502                         return CONNECTION_ERROR_INVALID_OPERATION;
503                 }
504                 LOGI(TIZEN_NET_CONNECTION,"TOTAL_RECEIVED_DATA_SIZE:%d bytes\n", *size);
505                 break;
506         case LAST_WIFI_SENT_DATA_SIZE:
507                 if (vconf_get_int(VCONFKEY_NETWORK_WIFI_PKT_LAST_SNT, size)) {
508                         LOGI(TIZEN_NET_CONNECTION,
509                                         "Cannot Get LAST_WIFI_SENT_DATA_SIZE: = %d\n",
510                                         *size);
511                         *size = 0;
512                         return CONNECTION_ERROR_INVALID_OPERATION;
513                 }
514                 LOGI(TIZEN_NET_CONNECTION,"LAST_WIFI_SENT_DATA_SIZE:%d bytes\n", *size);
515                 break;
516         case LAST_WIFI_RECEIVED_DATA_SIZE:
517                 if (vconf_get_int(VCONFKEY_NETWORK_WIFI_PKT_LAST_RCV, size)) {
518                         LOGI(TIZEN_NET_CONNECTION,
519                                         "Cannot Get LAST_WIFI_RECEIVED_DATA_SIZE: = %d\n",
520                                         *size);
521                         *size = 0;
522                         return CONNECTION_ERROR_INVALID_OPERATION;
523                 }
524                 LOGI(TIZEN_NET_CONNECTION,"LAST_WIFI_RECEIVED_DATA_SIZE:%d bytes\n", *size);
525                 break;
526         case TOTAL_WIFI_SENT_DATA_SIZE:
527                 if (vconf_get_int(VCONFKEY_NETWORK_WIFI_PKT_TOTAL_SNT, size)) {
528                         LOGI(TIZEN_NET_CONNECTION,
529                                         "Cannot Get TOTAL_WIFI_SENT_DATA_SIZE: = %d\n",
530                                         *size);
531                         *size = 0;
532                         return CONNECTION_ERROR_INVALID_OPERATION;
533                 }
534                 LOGI(TIZEN_NET_CONNECTION,"TOTAL_WIFI_SENT_DATA_SIZE:%d bytes\n", *size);
535                 break;
536         case TOTAL_WIFI_RECEIVED_DATA_SIZE:
537                 if (vconf_get_int(VCONFKEY_NETWORK_WIFI_PKT_TOTAL_RCV, size)) {
538                         LOGI(TIZEN_NET_CONNECTION,
539                                         "Cannot Get TOTAL_WIFI_RECEIVED_DATA_SIZE: = %d\n",
540                                         *size);
541                         *size = 0;
542                         return CONNECTION_ERROR_INVALID_OPERATION;
543                 }
544                 LOGI(TIZEN_NET_CONNECTION,"TOTAL_WIFI_RECEIVED_DATA_SIZE:%d bytes\n", *size);
545                 break;
546         }
547         return CONNECTION_ERROR_NONE;
548 }
549
550 int connection_get_last_received_data_size(connection_h connection, int *size)
551 {
552         return __fill_call_statistic(connection, LAST_RECEIVED_DATA_SIZE, size);
553 }
554
555 int connection_get_last_sent_data_size(connection_h connection, int *size)
556 {
557         return __fill_call_statistic(connection, LAST_SENT_DATA_SIZE, size);
558 }
559
560 int connection_get_total_received_data_size (connection_h connection, int *size)
561 {
562         return __fill_call_statistic(connection, TOTAL_RECEIVED_DATA_SIZE, size);
563 }
564
565 int connection_get_total_sent_data_size (connection_h connection, int *size)
566 {
567         return __fill_call_statistic(connection, TOTAL_SENT_DATA_SIZE, size);
568 }
569
570 int connection_get_wifi_last_received_data_size(connection_h connection, int *size)
571 {
572         return __fill_call_statistic(connection, LAST_WIFI_RECEIVED_DATA_SIZE, size);
573 }
574
575 int connection_get_wifi_last_sent_data_size(connection_h connection, int *size)
576 {
577         return __fill_call_statistic(connection, LAST_WIFI_SENT_DATA_SIZE, size);
578 }
579
580 int connection_get_wifi_total_received_data_size (connection_h connection, int *size)
581 {
582         return __fill_call_statistic(connection, TOTAL_WIFI_RECEIVED_DATA_SIZE, size);
583 }
584
585 int connection_get_wifi_total_sent_data_size (connection_h connection, int *size)
586 {
587         return __fill_call_statistic(connection, TOTAL_WIFI_SENT_DATA_SIZE, size);
588 }