AWS IoT Device SDK C++ v2  1.33.0
AWS IoT Device SDK C++ v2
HttpConnectionManager.h
Go to the documentation of this file.
1 #pragma once
2 
7 
8 #include <atomic>
9 #include <condition_variable>
10 #include <future>
11 #include <mutex>
12 
13 struct aws_http_connection_manager;
14 
15 namespace Aws
16 {
17  namespace Crt
18  {
19  namespace Http
20  {
27  std::function<void(std::shared_ptr<HttpClientConnection>, int errorCode)>;
28 
33  {
34  public:
38 
41 
46 
51 
60  };
61 
66  : public std::enable_shared_from_this<HttpClientConnectionManager>
67  {
68  public:
70 
81  bool AcquireConnection(const OnClientConnectionAvailable &onClientConnectionAvailable) noexcept;
82 
90  std::future<void> InitiateShutdown() noexcept;
91 
99  static std::shared_ptr<HttpClientConnectionManager> NewClientConnectionManager(
100  const HttpClientConnectionManagerOptions &connectionManagerOptions,
101  Allocator *allocator = ApiAllocator()) noexcept;
102 
103  private:
105  const HttpClientConnectionManagerOptions &options,
106  Allocator *allocator = ApiAllocator()) noexcept;
107 
108  Allocator *m_allocator;
109 
110  aws_http_connection_manager *m_connectionManager;
111 
113  std::promise<void> m_shutdownPromise;
114  std::atomic<bool> m_releaseInvoked;
115 
116  static void s_onConnectionSetup(
117  aws_http_connection *connection,
118  int errorCode,
119  void *userData) noexcept;
120 
121  static void s_shutdownCompleted(void *userData) noexcept;
122 
123  friend class ManagedConnection;
124  };
125  } // namespace Http
126  } // namespace Crt
127 } // namespace Aws
Aws::Crt::Http::ManagedConnection
Definition: HttpConnectionManager.cpp:177
Aws::Crt::Http::HttpClientConnectionManagerOptions
Definition: HttpConnectionManager.h:33
Aws::Crt::ApiAllocator
AWS_CRT_CPP_API Allocator * ApiAllocator() noexcept
Definition: Allocator.cpp:24
Aws::Crt::Http::HttpClientConnectionManagerOptions::ConnectionOptions
HttpClientConnectionOptions ConnectionOptions
Definition: HttpConnectionManager.h:45
Aws::Crt::Http::HttpClientConnectionManagerOptions::EnableBlockingShutdown
bool EnableBlockingShutdown
Definition: HttpConnectionManager.h:59
Aws::Crt::Http::HttpClientConnectionManagerOptions::operator=
HttpClientConnectionManagerOptions & operator=(HttpClientConnectionManagerOptions &&rhs)=default
Aws::Crt::Http::HttpClientConnectionManagerOptions::HttpClientConnectionManagerOptions
HttpClientConnectionManagerOptions(const HttpClientConnectionManagerOptions &rhs)=default
HttpConnection.h
Aws::Crt::Http::HttpClientConnectionManagerOptions::operator=
HttpClientConnectionManagerOptions & operator=(const HttpClientConnectionManagerOptions &rhs)=default
Aws::Crt::Http::HttpClientConnectionOptions
Definition: HttpConnection.h:347
Aws::Crt::Http::HttpClientConnectionManager
Definition: HttpConnectionManager.h:67
Aws::Crt::Http::OnClientConnectionAvailable
std::function< void(std::shared_ptr< HttpClientConnection >, int errorCode)> OnClientConnectionAvailable
Definition: HttpConnectionManager.h:27
Aws::Crt::Http::HttpClientConnectionManagerOptions::MaxConnections
size_t MaxConnections
Definition: HttpConnectionManager.h:50
AWS_CRT_CPP_API
#define AWS_CRT_CPP_API
Definition: Exports.h:37
Aws
Definition: Allocator.h:11
Aws::Crt::Allocator
aws_allocator Allocator
Definition: Allocator.h:14
Aws::Crt::Http::HttpClientConnectionManagerOptions::HttpClientConnectionManagerOptions
HttpClientConnectionManagerOptions(HttpClientConnectionManagerOptions &&rhs)=default