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 16 #ifndef ROUTE_H 17 #define ROUTE_H 18 19 #include <string> 20 21 #include "inet_addr.h" 22 23 namespace OHOS { 24 namespace NetManagerStandard { 25 enum { 26 RTN_UNICAST = 1, 27 RTN_UNREACHABLE = 7, 28 RTN_THROW = 9 29 }; 30 31 struct Route : public Parcelable { 32 std::string iface_; 33 INetAddr destination_; 34 INetAddr gateway_; 35 int32_t rtnType_ = RTN_UNICAST; 36 int32_t mtu_ = 0; 37 bool isHost_ = false; 38 bool hasGateway_ = true; 39 bool isDefaultRoute_ = false; 40 41 bool operator==(const Route& obj) const; 42 43 virtual bool Marshalling(Parcel &parcel) const override; 44 static sptr<Route> Unmarshalling(Parcel &parcel); 45 static bool Marshalling(Parcel &parcel, const sptr<Route> &object); 46 std::string ToString(const std::string &tab) const; 47 }; 48 } // namespace NetManagerStandard 49 } // namespace OHOS 50 #endif