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