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 INCLUDE_INTERFACE_TYPE_H 17 #define INCLUDE_INTERFACE_TYPE_H 18 19 #include <string> 20 #include <vector> 21 #include <ostream> 22 23 namespace OHOS { 24 namespace nmd { 25 typedef struct InterfaceConfigurationParcel { 26 std::string ifName; 27 std::string hwAddr; 28 std::string ipv4Addr; 29 int prefixLength; 30 std::vector<std::string> flags; 31 friend std::ostream &operator<<(std::ostream &os, const nmd::InterfaceConfigurationParcel &parcel) 32 { 33 os << "ifName: " << parcel.ifName << "\n" 34 << "hwAddr: " << parcel.hwAddr << "\n" 35 << "ipv4Addr: " << parcel.ipv4Addr << "\n" 36 << "prefixLength: " << parcel.prefixLength << "\n" 37 << "flags: [" 38 << "\n"; 39 for (unsigned long i = 0; i < parcel.flags.size(); i++) { 40 os << " " << parcel.flags[i] << "\n"; 41 } 42 os << "] " 43 << "\n"; 44 return os; 45 } 46 } InterfaceConfigurationParcel; 47 } // namespace nmd 48 } // namespace OHOS 49 #endif // INCLUDE_INTERFACE_TYPE_H 50