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_app_state_e state;
36 stc_data_counter_s data_usage;
37 stc_data_counter_s counter;
38 GHashTable *processes; /**< applications instances */
39 char mac[MAC_ADDRESS_LEN+1]; /**< application mac address */
42 void stc_monitor_app_update_counter(stc_app_value_s *value,
43 classid_bytes_context_s *context);
45 void stc_monitor_app_update_iface_counter(classid_bytes_context_s *context);
47 gboolean stc_monitor_app_flush_stats_to_db(gpointer user_data);
49 stc_error_e stc_monitor_app_add(uint32_t classid,
52 const stc_app_value_s value);
54 void stc_monitor_app_add_by_iface(const char *app_id);
56 void stc_monitor_app_add_monitor(gpointer key,
57 gpointer value, gpointer data);
59 void stc_monitor_app_add_by_connection(default_connection_s *conn);
61 void stc_monitor_app_add_accept(gpointer key,
62 gpointer value, gpointer data);
64 stc_error_e stc_monitor_app_remove(uint32_t classid, const char *app_id);
66 void stc_monitor_app_remove_monitor(gpointer key,
67 gpointer value, gpointer data);
69 void stc_monitor_app_remove_by_connection(default_connection_s *conn);
71 void stc_monitor_app_remove_accept(gpointer key,
72 gpointer value, gpointer data);
74 gboolean stc_monitor_app_lookup(uint32_t classid);
76 GHashTable *stc_monitor_apps_init(void);
78 #endif /* __STC_MONITOR_APP_H__ */