1 /* 2 * Copyright (c) 2021-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 NETSYS_ADDR_INFO_H 17 #define NETSYS_ADDR_INFO_H 18 19 #include <netdb.h> 20 #include <string> 21 #include <vector> 22 23 #include "message_parcel.h" 24 #include "parcel.h" 25 26 namespace OHOS { 27 namespace NetsysNative { 28 struct NetsysAddrInfoParcel final : public Parcelable { 29 public: 30 NetsysAddrInfoParcel() = default; 31 NetsysAddrInfoParcel(const addrinfo *addr, const uint16_t netId, const std::string Node, 32 const std::string ServData); 33 ~NetsysAddrInfoParcel() = default; 34 virtual bool Marshalling(Parcel &parcel) const override; 35 static sptr<NetsysAddrInfoParcel> Unmarshalling(MessageParcel &parcel); 36 37 addrinfo *addrHead; 38 int32_t aiFamily; 39 int32_t aiSocktype; 40 int32_t aiFlags; 41 int32_t aiProtocol; 42 int32_t aiAddrlen; 43 int32_t netId; 44 int32_t ret; 45 int32_t addrSize; 46 int32_t isHintsNull; 47 std::string hostName; 48 std::string serverName; 49 }; 50 } // namespace NetsysNative 51 } // namespace OHOS 52 #endif // NETSYS_ADDR_INFO_H 53