1 /* 2 * Copyright (c) 2022 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 COMMUNICATION_NET_ADJ_INFO_H 17 #define COMMUNICATION_NET_ADJ_INFO_H 18 19 #include <list> 20 21 #include "parcel.h" 22 #include "inet_addr.h" 23 24 namespace OHOS { 25 namespace NetManagerStandard { 26 struct NetAdjInfo final: public Parcelable { 27 enum { 28 // Wi-Fi Station and AP. 29 TYPE_WIFI = 0, 30 // Wi-Fi direct. 31 TYPE_WIFI_P2P = 1, 32 // Bluetooth. 33 TYPE_BLUETOOTH = 2, 34 // Bluetooth low energy. 35 TYPE_BLE = 3, 36 // USB. 37 TYPE_USB = 4, 38 // Ethernet. 39 TYPE_ETHERNET = 5, 40 // Spark link. 41 TYPE_SPARK_LINK = 6, 42 // Remote connection. 43 TYPE_REMOTE = 7, 44 } NetAdjType; 45 46 // Type from {@code net_adj_info::NetAdjType}. 47 uint32_t type_; 48 49 // Identity of network adjacency. 50 std::string identity_; 51 52 // The interface where adjacency came from. 53 std::string fromIface_; 54 55 // Quality of experience of adjacency. 56 uint32_t adjQoeLevel_; 57 58 // The addresses of adjacency. 59 std::list<INetAddr> netAddrList_; 60 61 bool Marshalling(Parcel &parcel) const override; 62 static sptr<NetAdjInfo> Unmarshalling(Parcel &parcel); 63 bool operator==(const NetAdjInfo &rhs) const; 64 bool operator!=(const NetAdjInfo &rhs) const; 65 }; 66 } // namespace NetManagerStandard 67 } // namespace OHOS 68 69 #endif // COMMUNICATION_NET_ADJ_INFO_H 70