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 enum NetStatsResultCode { 30 STATS_DUMP_MESSAGE_FAIL = 2103002, 31 STATS_REMOVE_FILE_FAIL, 32 STATS_ERR_INVALID_TIME_PERIOD, 33 STATS_ERR_READ_BPF_FAIL, 34 STATS_ERR_INVALID_KEY, 35 STATS_ERR_INVALID_IFACE_STATS_MAP, 36 STATS_ERR_INVALID_STATS_VALUE, 37 STATS_ERR_INVALID_STATS_TYPE, 38 STATS_ERR_INVALID_UID_STATS_MAP, 39 STATS_ERR_INVALID_IFACE_NAME_MAP, 40 STATS_ERR_GET_IFACE_NAME_FAILED, 41 STATS_ERR_CLEAR_STATS_DATA_FAIL, 42 STATS_ERR_CREATE_TABLE_FAIL, 43 STATS_ERR_DATABASE_RECV_NO_DATA, 44 STATS_ERR_WRITE_DATA_FAIL, 45 STATS_ERR_READ_DATA_FAIL, 46 STATS_ERR_WRITE_BPF_FAIL, 47 }; 48 49 enum NetStatsDataFlag { 50 STATS_DATA_FLAG_DEFAULT, // The minimum value of DataFlag, Do not less than the limit. No actual meaning. 51 STATS_DATA_FLAG_UNINSTALLED, // the stats of the uninstalled uid. 52 STATS_DATA_FLAG_SIM2, // the stats of the sim2 (hap)uid. 53 STATS_DATA_FLAG_SIM, // the stats of the sim (hap)uid. 54 STATS_DATA_FLAG_SIM_BASIC, // the stats of the sim (basic)uid. 55 STATS_DATA_FLAG_SIM2_BASIC, // the stats of the sim2 (basic)uid. 56 STATS_DATA_FLAG_LIMIT, // The maximum value of DataFlag, Do not exceed the limit. No actual meaning. 57 }; 58 59 enum NetStatsNotificationFlag { 60 NET_STATS_MONTHLY_LIMIT = 0, 61 NET_STATS_MONTHLY_MARK, 62 NET_STATS_DAILY_MARK, 63 NET_STATS_NO_LIMIT_ENABLE, 64 NET_STATS_NOTIFY_TYPE, 65 NET_STATS_BEGIN_DATE, 66 }; 67 } // namespace NetManagerStandard 68 } // namespace OHOS 69 #endif // NET_STATS_CONSTANTS_H 70