• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #include "netnative_log_wrapper.h"
17 #include "netsys_net_dns_health_data.h"
18 
19 namespace OHOS {
20 namespace NetsysNative {
21 
Marshalling(Parcel & parcel) const22 bool NetDnsHealthReport::Marshalling(Parcel &parcel) const
23 {
24     if (!parcel.WriteUint32(netid_)) {
25         return false;
26     }
27     if (!parcel.WriteUint32(uid_)) {
28         return false;
29     }
30     if (!parcel.WriteUint32(appid_)) {
31         return false;
32     }
33     if (!parcel.WriteString(host_)) {
34         return false;
35     }
36     if (!parcel.WriteUint16(type_)) {
37         return false;
38     }
39     if (!parcel.WriteBool(result_)) {
40         return false;
41     }
42     return true;
43 }
44 
45 
Unmarshalling(Parcel & parcel,NetDnsHealthReport & healthReport)46 bool NetDnsHealthReport::Unmarshalling(Parcel &parcel, NetDnsHealthReport &healthReport)
47 {
48     if (!parcel.ReadUint32(healthReport.netid_) || !parcel.ReadUint32(healthReport.uid_) ||
49         !parcel.ReadUint32(healthReport.appid_)) {
50         return false;
51     }
52 
53     if (!parcel.ReadString(healthReport.host_)) {
54         return false;
55     }
56 
57     if (!parcel.ReadUint16(healthReport.type_)) {
58         return false;
59     }
60 
61     if (!parcel.ReadBool(healthReport.result_)) {
62         return false;
63     }
64 
65     return true;
66 }
67 } // namespace NetsysNative
68 } // namespace OHOS
69