1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
3 #ifndef HTTPSERVERCONNECTION_H
4 #define HTTPSERVERCONNECTION_H
6 #include "remote/apiuser.hpp"
7 #include "base/string.hpp"
8 #include "base/tlsstream.hpp"
10 #include <boost/asio/deadline_timer.hpp>
11 #include <boost/asio/io_service.hpp>
12 #include <boost/asio/io_service_strand.hpp>
13 #include <boost/asio/spawn.hpp>
19 * An API client connection.
23 class HttpServerConnection final : public Object
26 DECLARE_PTR_TYPEDEFS(HttpServerConnection);
28 HttpServerConnection(const String& identity, bool authenticated, const std::shared_ptr<AsioTlsStream>& stream);
32 void StartStreaming();
37 ApiUser::Ptr m_ApiUser;
38 std::shared_ptr<AsioTlsStream> m_Stream;
41 boost::asio::io_service::strand m_IoStrand;
43 bool m_HasStartedStreaming;
44 boost::asio::deadline_timer m_CheckLivenessTimer;
46 HttpServerConnection(const String& identity, bool authenticated, const std::shared_ptr<AsioTlsStream>& stream, boost::asio::io_service& io);
48 void ProcessMessages(boost::asio::yield_context yc);
49 void CheckLiveness(boost::asio::yield_context yc);
54 #endif /* HTTPSERVERCONNECTION_H */