1 /* 2 * Copyright (c) 2024 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 #ifndef COMMUNICATION_NETMANAGER_BASE_NET_PUSH_STATS_INFO_H 16 #define COMMUNICATION_NETMANAGER_BASE_NET_PUSH_STATS_INFO_H 17 18 #include "parcel.h" 19 20 namespace OHOS { 21 namespace NetManagerStandard { 22 #define NET_SYMBOL_VISIBLE_PUSH __attribute__((visibility("default"))) 23 struct NET_SYMBOL_VISIBLE_PUSH PushStatsInfo final : public Parcelable { 24 uint32_t uid_ = 0; 25 std::string iface_ = "rmnet_push"; 26 uint32_t simId_ = 0; 27 uint32_t netBearType_ = 0; 28 uint32_t beginTime_ = 0; 29 uint32_t endTime_ = 0; 30 uint32_t rxBytes_ = 0; 31 uint32_t txBytes_ = 0; 32 33 ~PushStatsInfo() override = default; 34 GetStatsfinal35 inline uint32_t GetStats() const 36 { 37 return rxBytes_ + txBytes_; 38 } 39 Equalfinal40 inline bool Equal(const PushStatsInfo &info) const 41 { 42 return info.uid_ == uid_ && info.iface_ == iface_ && info.simId_ == simId_; 43 } 44 45 bool Marshalling(Parcel &parcel) const override; 46 static bool Marshalling(Parcel &parcel, const PushStatsInfo &info); 47 static bool Unmarshalling(Parcel &parcel, PushStatsInfo &info); 48 }; 49 } // namespace NetManagerStandard 50 } // namespace OHOS 51 52 #endif // COMMUNICATION_NETMANAGER_BASE_NET_PUSH_STATS_INFO_H