1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef NET_STATS_DATABASE_DEFINES_H
17 #define NET_STATS_DATABASE_DEFINES_H
18 
19 #include <map>
20 
21 #include "netmanager_base_common_utils.h"
22 #include "net_stats_info.h"
23 
24 namespace OHOS {
25 namespace NetManagerStandard {
26 namespace NetStatsDatabaseDefines {
27 constexpr const char *NET_STATS_DATABASE_PATH = "/data/service/el1/public/netmanager/net_stats_data.db";
28 constexpr const char *VERSION_TABLE_CREATE_PARAM =
29     "Name CHAR(20) NOT NULL UNIQUE,"
30     "Version INTEGER NOT NULL DEFAULT 0";
31 constexpr const char *UID_TABLE_CREATE_PARAM =
32     "UID INTEGER NOT NULL,"
33     "IFace CHAR(50) NOT NULL,"
34     "Date INTEGER NOT NULL,"
35     "RxBytes INTEGER NOT NULL,"
36     "RxPackets INTEGER NOT NULL,"
37     "TxBytes INTEGER NOT NULL,"
38     "TxPackets INTEGER NOT NULL,"
39     "Ident CHAR(100) NOT NULL,"
40     "Flag INTEGER NOT NULL DEFAULT 0";
41 constexpr const char *UID_SIM_TABLE_CREATE_PARAM =
42     "UID INTEGER NOT NULL,"
43     "IFace CHAR(50) NOT NULL,"
44     "Date INTEGER NOT NULL,"
45     "RxBytes INTEGER NOT NULL,"
46     "RxPackets INTEGER NOT NULL,"
47     "TxBytes INTEGER NOT NULL,"
48     "TxPackets INTEGER NOT NULL,"
49     "Ident CHAR(100) NOT NULL,"
50     "Flag INTEGER NOT NULL DEFAULT 0";
51 constexpr const char *IFACE_TABLE_CREATE_PARAM =
52     "IFace CHAR(50) NOT NULL,"
53     "Date INTEGER NOT NULL,"
54     "RxBytes INTEGER NOT NULL,"
55     "RxPackets INTEGER NOT NULL,"
56     "TxBytes INTEGER NOT NULL,"
57     "TxPackets INTEGER NOT NULL";
58 constexpr const char *UID_TABLE_PARAM_LIST = "UID,IFace,Date,RxBytes,RxPackets,TxBytes,TxPackets,Ident,Flag";
59 constexpr const char *UID_SIM_TABLE_PARAM_LIST = "UID,IFace,Date,RxBytes,RxPackets,TxBytes,TxPackets,Ident,Flag";
60 constexpr const char *IFACE_TABLE_PARAM_LIST = "IFace,Date,RxBytes,RxPackets,TxBytes,TxPackets";
61 constexpr const char *VERSION_TABLE = "T_version";
62 constexpr const char *IFACE_TABLE = "T_iface";
63 constexpr const char *UID_TABLE = "T_uid";
64 constexpr const char *UID_SIM_TABLE = "T_uid_sim";
65 
66 constexpr int32_t UID_PARAM_NUM = 9;
67 
68 enum class DataType {
69     UID,
70     IFACE,
71 };
72 } // namespace NetStatsDatabaseDefines
73 } // namespace NetManagerStandard
74 } // namespace OHOS
75 
76 #endif // NET_STATS_DATABASE_DEFINES_H
77