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 = new (std::nothrow) DhcpResultParcel(); 38 ptr->iface_ = parcel.ReadString(); 39 ptr->ipAddr_ = parcel.ReadString(); 40 ptr->gateWay_ = parcel.ReadString(); 41 ptr->subNet_ = parcel.ReadString(); 42 ptr->route1_ = parcel.ReadString(); 43 ptr->route2_ = parcel.ReadString(); 44 ptr->dns1_ = parcel.ReadString(); 45 ptr->dns2_ = parcel.ReadString(); 46 return ptr; 47 } 48 } // namespace NetsysNative 49 } // namespace OHOS 50