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