• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     int32_t userId_ = 0;
33 
34     ~PushStatsInfo() override = default;
35 
GetStatsfinal36     inline uint32_t GetStats() const
37     {
38         return rxBytes_ + txBytes_;
39     }
40 
Equalfinal41     inline bool Equal(const PushStatsInfo &info) const
42     {
43         return info.uid_ == uid_ && info.iface_ == iface_ && info.simId_ == simId_;
44     }
45 
46     bool Marshalling(Parcel &parcel) const override;
47     static bool Marshalling(Parcel &parcel, const PushStatsInfo &info);
48     static PushStatsInfo* Unmarshalling(Parcel &parcel);
49     static bool Unmarshalling(Parcel &parcel, PushStatsInfo &info);
50 };
51 } // namespace NetManagerStandard
52 } // namespace OHOS
53 
54 #endif // COMMUNICATION_NETMANAGER_BASE_NET_PUSH_STATS_INFO_H