2 * Copyright (c) 2016 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.
20 #include "stc-manager.h"
22 #define MAX_DB_RETRY_COUNT 20
23 #define MAX_USLEEP_TIMEOUT 500000
24 #define SQLITE_BUSY_TIMEOUT 500000
25 #define MAX_IFACE_LENGTH 32
28 * @brief Commulative structure for holding stc storage information
31 stc_data_counter_s cnt;
32 // stc_db_net_restrictions rst;
38 } stc_db_tm_interval_s;
41 * General structure containing information for storing
42 * app_id - package name as unique application identifier
43 * snd_count - sent bytes
44 * rcv_count - received bytes
45 * pid - process identifier
46 * ifindex - network interface index, iftype holds in key @see stc_iface_type
47 * is_roaming - is traffic consumed at roaming, @see stc_roaming_type
51 long long int rcv_count;
52 long long int snd_count;
54 #ifndef CONFIG_DATAUSAGE_NFACCT
58 stc_roaming_type_e is_roaming;
60 /* foreground/background state is here,
61 * not in classid_iftype_key, it means
62 * we'll not able to handle simultaneously
63 * counter per one application for background and
64 * foreground within one counting cycle,
65 * so every time application goes to background/foreground
66 * we'll request its counter update */
67 stc_app_state_e ground;
73 /* pointer to telephony's subscriber_id */
75 char ifname[MAX_IFACE_LENGTH];
76 } stc_db_classid_iftype_key;
79 * @desc This function init db oversize erase timer.
81 stc_error_e stc_init_db_guard(void);
84 * @desc This function deinit db oversize erase timer.
86 void stc_deinit_db_guard(void);
89 * @desc This function initializes storage module.
91 gboolean stc_db_initialize(void);
94 * @desc This function deinitializes storage module.
96 gboolean stc_db_deinitialize(void);
98 #endif /* _STC_DB_H_ */