• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 struct Route : public Parcelable {
37     std::string iface_;
38     INetAddr destination_;
39     INetAddr gateway_;
40     int32_t rtnType_ = RTN_UNICAST;
41     int32_t mtu_ = 0;
42     bool isHost_ = false;
43     bool hasGateway_ = true;
44     bool isDefaultRoute_ = false;
45 
46     bool operator==(const Route& obj) const;
47 
48     virtual bool Marshalling(Parcel &parcel) const override;
49     static sptr<Route> Unmarshalling(Parcel &parcel);
50     static bool Marshalling(Parcel &parcel, const sptr<Route> &object);
51     std::string ToString(const std::string &tab) const;
52 };
53 } // namespace NetManagerStandard
54 } // namespace OHOS
55 #endif