• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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_CONSTANTS_H
17 #define NET_STATS_CONSTANTS_H
18 
19 #include "net_manager_constants.h"
20 #include <limits>
21 
22 namespace OHOS {
23 namespace NetManagerStandard {
24 constexpr int16_t LIMIT_STATS_CALLBACK_NUM = 200;
25 constexpr uint32_t Sim_UID = std::numeric_limits<uint32_t>::max();
26 constexpr uint32_t UNINSTALLED_UID = std::numeric_limits<uint32_t>::max() - 1;
27 constexpr uint32_t SIM2_UID = std::numeric_limits<uint32_t>::max() - 2;
28 constexpr uint32_t IPTABLES_UID = std::numeric_limits<uint32_t>::max() - 3;
29 constexpr uint32_t DEFAULT_ACCOUNT_UID = std::numeric_limits<uint32_t>::max() - 4;
30 constexpr uint32_t OTHER_ACCOUNT_UID = std::numeric_limits<uint32_t>::max() - 5;
31 constexpr uint32_t USER_ID_DIVIDOR = 200000;
32 constexpr uint32_t SYSTEM_DEFAULT_USERID = 0;
33 enum NetStatsResultCode {
34     STATS_DUMP_MESSAGE_FAIL = 2103002,
35     STATS_REMOVE_FILE_FAIL,
36     STATS_ERR_INVALID_TIME_PERIOD,
37     STATS_ERR_READ_BPF_FAIL,
38     STATS_ERR_INVALID_KEY,
39     STATS_ERR_INVALID_IFACE_STATS_MAP,
40     STATS_ERR_INVALID_STATS_VALUE,
41     STATS_ERR_INVALID_STATS_TYPE,
42     STATS_ERR_INVALID_UID_STATS_MAP,
43     STATS_ERR_INVALID_IFACE_NAME_MAP,
44     STATS_ERR_GET_IFACE_NAME_FAILED,
45     STATS_ERR_CLEAR_STATS_DATA_FAIL,
46     STATS_ERR_CREATE_TABLE_FAIL,
47     STATS_ERR_DATABASE_RECV_NO_DATA,
48     STATS_ERR_WRITE_DATA_FAIL,
49     STATS_ERR_READ_DATA_FAIL,
50     STATS_ERR_WRITE_BPF_FAIL,
51 };
52 
53 enum NetStatsDataFlag {
54     STATS_DATA_FLAG_DEFAULT,        // The minimum value of DataFlag, Do not less than the limit. No actual meaning.
55     STATS_DATA_FLAG_UNINSTALLED,    // the stats of the uninstalled uid.
56     STATS_DATA_FLAG_SIM2,           // the stats of the sim2 (hap)uid.
57     STATS_DATA_FLAG_SIM,            // the stats of the sim (hap)uid.
58     STATS_DATA_FLAG_SIM_BASIC,      // the stats of the sim (basic)uid.
59     STATS_DATA_FLAG_SIM2_BASIC,     // the stats of the sim2 (basic)uid.
60     STATS_DATA_FLAG_LIMIT,          // The maximum value of DataFlag, Do not exceed the limit. No actual meaning.
61 };
62 
63 enum NetStatsNotificationFlag {
64     NET_STATS_MONTHLY_LIMIT = 0,
65     NET_STATS_MONTHLY_MARK,
66     NET_STATS_DAILY_MARK,
67     NET_STATS_NO_LIMIT_ENABLE,
68     NET_STATS_NOTIFY_TYPE,
69     NET_STATS_BEGIN_DATE,
70 };
71 } // namespace NetManagerStandard
72 } // namespace OHOS
73 #endif // NET_STATS_CONSTANTS_H
74