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 enum NetStatsResultCode {
28     STATS_DUMP_MESSAGE_FAIL = 2103002,
29     STATS_REMOVE_FILE_FAIL,
30     STATS_ERR_INVALID_TIME_PERIOD,
31     STATS_ERR_READ_BPF_FAIL,
32     STATS_ERR_INVALID_KEY,
33     STATS_ERR_INVALID_IFACE_STATS_MAP,
34     STATS_ERR_INVALID_STATS_VALUE,
35     STATS_ERR_INVALID_STATS_TYPE,
36     STATS_ERR_INVALID_UID_STATS_MAP,
37     STATS_ERR_INVALID_IFACE_NAME_MAP,
38     STATS_ERR_GET_IFACE_NAME_FAILED,
39     STATS_ERR_CLEAR_STATS_DATA_FAIL,
40     STATS_ERR_CREATE_TABLE_FAIL,
41     STATS_ERR_DATABASE_RECV_NO_DATA,
42     STATS_ERR_WRITE_DATA_FAIL,
43     STATS_ERR_READ_DATA_FAIL,
44     STATS_ERR_WRITE_BPF_FAIL,
45 };
46 
47 enum NetStatsDataFlag {
48     STATS_DATA_FLAG_DEFAULT,     // The minimum value of DataFlag, Do not less than the limit. No actual meaning.
49     STATS_DATA_FLAG_UNINSTALLED, // the stats of the uninstalled uid.
50     STATS_DATA_FLAG_LIMIT,       // The maximum value of DataFlag, Do not exceed the limit. No actual meaning.
51 };
52 } // namespace NetManagerStandard
53 } // namespace OHOS
54 #endif // NET_STATS_CONSTANTS_H
55