1 /* 2 * Copyright (c) 2021 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 #include "dhcp_result_parcel.h" 16 #include "netnative_log_wrapper.h" 17 18 namespace OHOS { 19 namespace NetsysNative { DhcpResultParcel()20DhcpResultParcel::DhcpResultParcel() {} 21 Marshalling(Parcel & parcel) const22bool DhcpResultParcel::Marshalling(Parcel &parcel) const 23 { 24 parcel.WriteString(iface_); 25 parcel.WriteString(ipAddr_); 26 parcel.WriteString(gateWay_); 27 parcel.WriteString(subNet_); 28 parcel.WriteString(route1_); 29 parcel.WriteString(route2_); 30 parcel.WriteString(dns1_); 31 parcel.WriteString(dns2_); 32 return true; 33 } 34 Unmarshalling(Parcel & parcel)35sptr<DhcpResultParcel> DhcpResultParcel::Unmarshalling(Parcel &parcel) 36 { 37 sptr<DhcpResultParcel> ptr = sptr<DhcpResultParcel>::MakeSptr(); 38 if (ptr == nullptr) { 39 return nullptr; 40 } 41 ptr->iface_ = parcel.ReadString(); 42 ptr->ipAddr_ = parcel.ReadString(); 43 ptr->gateWay_ = parcel.ReadString(); 44 ptr->subNet_ = parcel.ReadString(); 45 ptr->route1_ = parcel.ReadString(); 46 ptr->route2_ = parcel.ReadString(); 47 ptr->dns1_ = parcel.ReadString(); 48 ptr->dns2_ = parcel.ReadString(); 49 return ptr; 50 } 51 } // namespace NetsysNative 52 } // namespace OHOS 53