2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __STC_MONITOR_APP_H__
18 #define __STC_MONITOR_APP_H__
22 #include "stc-error.h"
23 #include "stc-manager.h"
24 #include "stc-monitor-context.h"
25 #include "stc-default-connection.h"
27 #define MAC_ADDRESS_LEN 18
28 #define SUBSCRIBERID_NONE "none_subid"
31 uint32_t classid; /**< classid for a package */
32 gchar *pkg_id; /**< package id */
33 gchar *app_id; /**< application id */
34 stc_app_type_e type; /**< type of application */
35 stc_data_counter_s data_usage;
36 stc_data_counter_s counter;
37 GHashTable *processes; /**< applications instances */
38 char mac[MAC_ADDRESS_LEN+1]; /**< application mac address */
41 void stc_monitor_app_update_counter(stc_app_value_s *value,
42 classid_bytes_context_s *context);
44 void stc_monitor_app_update_iface_counter(classid_bytes_context_s *context);
46 gboolean stc_monitor_app_flush_stats_to_db(gpointer user_data);
48 stc_error_e stc_monitor_app_add(uint32_t classid,
51 const stc_app_value_s value);
53 void stc_monitor_app_add_by_iface(const char *app_id);
55 void stc_monitor_app_add_monitor(gpointer key,
56 gpointer value, gpointer data);
58 void stc_monitor_app_add_by_connection(default_connection_s *conn);
60 stc_error_e stc_monitor_app_remove(uint32_t classid, const char *app_id);
62 void stc_monitor_app_remove_monitor(gpointer key,
63 gpointer value, gpointer data);
65 void stc_monitor_app_remove_by_connection(default_connection_s *conn);
67 GHashTable *stc_monitor_apps_init(void);
69 #endif /* __STC_MONITOR_APP_H__ */