olp-cpp-sdk  1.23.1
NetworkProxySettings.h
1 /*
2  * Copyright (C) 2019-2021 HERE Europe B.V.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * SPDX-License-Identifier: Apache-2.0
17  * License-Filename: LICENSE
18  */
19 
20 #pragma once
21 
22 #include <cstdint>
23 #include <string>
24 
25 #include <olp/core/CoreApi.h>
26 
27 namespace olp {
28 namespace http {
29 
34 class CORE_API NetworkProxySettings final {
35  public:
37  enum class Type {
38  NONE,
39  HTTP,
40  HTTPS,
41  SOCKS4,
42  SOCKS4A,
43  SOCKS5,
44  SOCKS5_HOSTNAME,
45  };
46 
52  Type GetType() const;
53 
62 
68  const std::string& GetHostname() const;
69 
77  NetworkProxySettings& WithHostname(std::string hostname);
78 
84  std::uint16_t GetPort() const;
85 
93  NetworkProxySettings& WithPort(std::uint16_t port);
94 
100  const std::string& GetUsername() const;
101 
109  NetworkProxySettings& WithUsername(std::string username);
110 
116  const std::string& GetPassword() const;
117 
125  NetworkProxySettings& WithPassword(std::string password);
126 
127  private:
129  Type type_{Type::NONE};
131  std::uint16_t port_{0};
133  std::string hostname_;
135  std::string username_;
137  std::string password_;
138 };
139 
140 } // namespace http
141 } // namespace olp
Contains a proxy configuration for the network interface that is applied per request.
Definition: NetworkProxySettings.h:34
NetworkProxySettings & WithType(Type type)
Sets the proxy type.
Type
The proxy type.
Definition: NetworkProxySettings.h:37
std::uint16_t GetPort() const
Gets the proxy port.
NetworkProxySettings & WithUsername(std::string username)
Sets the username.
const std::string & GetHostname() const
Gets the proxy hostname.
const std::string & GetUsername() const
Gets the username.
NetworkProxySettings & WithPort(std::uint16_t port)
Sets the proxy port.
NetworkProxySettings & WithHostname(std::string hostname)
Sets the proxy hostname.
const std::string & GetPassword() const
Gets the password.
Type GetType() const
Gets the proxy type.
NetworkProxySettings & WithPassword(std::string password)
Sets the password.
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24