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 NETMANAGER_BASE_HTTP_PROXY_H 17 #define NETMANAGER_BASE_HTTP_PROXY_H 18 19 #include <string> 20 #include <list> 21 22 #include "parcel.h" 23 24 namespace OHOS { 25 namespace NetManagerStandard { 26 #define NET_SYMBOL_VISIBLE __attribute__ ((visibility("default"))) 27 class NET_SYMBOL_VISIBLE HttpProxy final : public Parcelable { 28 public: 29 HttpProxy(); 30 HttpProxy(std::string host, uint16_t port, const std::list<std::string> &exclusionList); 31 32 [[nodiscard]] std::string GetHost() const; 33 [[nodiscard]] uint16_t GetPort() const; 34 [[nodiscard]] std::list<std::string> GetExclusionList() const; 35 [[nodiscard]] std::string ToString() const; SetHost(std::string && host)36 void inline SetHost(std::string &&host) 37 { 38 host_ = host; 39 } SetPort(uint16_t port)40 void inline SetPort(uint16_t port) 41 { 42 port_ = port; 43 } SetExclusionList(const std::list<std::string> & list)44 void inline SetExclusionList(const std::list<std::string> &list) 45 { 46 exclusionList_ = list; 47 } 48 49 bool operator==(const HttpProxy &httpProxy) const; 50 bool operator!=(const HttpProxy &httpProxy) const; 51 bool Marshalling(Parcel &parcel) const override; 52 static bool Unmarshalling(Parcel &parcel, HttpProxy &httpProxy); 53 54 private: 55 std::string host_; 56 uint16_t port_; 57 std::list<std::string> exclusionList_; 58 }; 59 } // namespace NetManagerStandard 60 } // namespace OHOS 61 #endif /* NETMANAGER_BASE_HTTP_PROXY_H */ 62