4 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 * @desc Application stat entity
28 #ifndef _RESOURCED_APPLICATION_STAT_H_
29 #define _RESOURCED_APPLICATION_STAT_H_
31 #include <netinet/in.h>
33 #include <sys/types.h>
36 #include "data_usage.h"
37 #include "daemon-options.h"
38 #include "transmission.h"
40 #define RSML_UNKNOWN_CLASSID 1
43 * General structure containing information for storing
44 * application_id - package name as unique application identifier
45 * snd_count - sent bytes
46 * rcv_count - received bytes
47 * pid - process identifier
48 * ifindex - network interface index, iftype holds in key @see resourced_iface_type
49 * is_roaming - is traffic consumed at roaming, @see resourced_roaming_type
51 struct application_stat {
60 resourced_roaming_type is_roaming;
64 * Structure for holding serialized data from kernel @see traffic_event
71 struct classid_iftype_key
75 char ifname[MAX_NAME_LENGTH];
78 typedef GTree traffic_stat_tree;
80 struct application_stat_tree {
82 time_t last_touch_time;
83 pthread_rwlock_t guard;
86 struct application_stat_tree *create_app_stat_tree(void);
87 void free_app_stat_tree(struct application_stat_tree *tree);
88 void nulify_app_stat_tree(struct application_stat_tree **tree);
90 traffic_stat_tree *create_traffic_stat_tree(void);
91 void free_traffic_stat_tree(traffic_stat_tree *list);
93 resourced_ret_c prepare_application_stat(traffic_stat_tree *tree_in,
94 traffic_stat_tree *tree_out,
95 struct application_stat_tree *result,
96 volatile struct daemon_opts *opts);
99 #endif /* _RESOURCED_APPLICATION_STAT_H_ */