C++ Client-Side SDK
LaunchDarkly SDK
http_properties.hpp
1 #pragma once
2 
3 #include <chrono>
4 #include <map>
5 #include <optional>
6 #include <string>
7 #include <vector>
8 
9 namespace launchdarkly::config::shared::built {
10 
11 class TlsOptions final {
12  public:
13  enum class VerifyMode { kVerifyPeer, kVerifyNone };
14  explicit TlsOptions(VerifyMode verify_mode);
15  TlsOptions(VerifyMode verify_mode,
16  std::optional<std::string> ca_bundle_path);
17  TlsOptions();
18  [[nodiscard]] VerifyMode PeerVerifyMode() const;
19  [[nodiscard]] std::optional<std::string> const& CustomCAFile() const;
20 
21  private:
22  VerifyMode verify_mode_;
23  std::optional<std::string> ca_bundle_path_;
24 };
25 
26 class HttpProperties final {
27  public:
28  HttpProperties(std::chrono::milliseconds connect_timeout,
29  std::chrono::milliseconds read_timeout,
30  std::chrono::milliseconds write_timeout,
31  std::chrono::milliseconds response_timeout,
32  std::map<std::string, std::string> base_headers,
33  TlsOptions tls);
34 
35  [[nodiscard]] std::chrono::milliseconds ConnectTimeout() const;
36  [[nodiscard]] std::chrono::milliseconds ReadTimeout() const;
37  [[nodiscard]] std::chrono::milliseconds WriteTimeout() const;
38 
39  [[nodiscard]] std::chrono::milliseconds ResponseTimeout() const;
40  [[nodiscard]] std::map<std::string, std::string> const& BaseHeaders() const;
41 
42  [[nodiscard]] TlsOptions const& Tls() const;
43 
44  private:
45  std::chrono::milliseconds connect_timeout_;
46  std::chrono::milliseconds read_timeout_;
47  std::chrono::milliseconds write_timeout_;
48  std::chrono::milliseconds response_timeout_;
49  std::map<std::string, std::string> base_headers_;
50  TlsOptions tls_;
51 
52  // TODO: Proxy.
53 };
54 
55 bool operator==(HttpProperties const& lhs, HttpProperties const& rhs);
56 bool operator==(TlsOptions const& lhs, TlsOptions const& rhs);
57 
58 } // namespace launchdarkly::config::shared::built
Definition: http_properties.hpp:26
Definition: http_properties.hpp:11