From 0915b3ef56dfac3113cce55a59a5765dc94976be Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:34:54 +0200 Subject: Adding upstream version 2.13.6. Signed-off-by: Daniel Baumann --- lib/remote/httpserverconnection.hpp | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 lib/remote/httpserverconnection.hpp (limited to 'lib/remote/httpserverconnection.hpp') diff --git a/lib/remote/httpserverconnection.hpp b/lib/remote/httpserverconnection.hpp new file mode 100644 index 0000000..9c812e5 --- /dev/null +++ b/lib/remote/httpserverconnection.hpp @@ -0,0 +1,54 @@ +/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */ + +#ifndef HTTPSERVERCONNECTION_H +#define HTTPSERVERCONNECTION_H + +#include "remote/apiuser.hpp" +#include "base/string.hpp" +#include "base/tlsstream.hpp" +#include +#include +#include +#include +#include + +namespace icinga +{ + +/** + * An API client connection. + * + * @ingroup remote + */ +class HttpServerConnection final : public Object +{ +public: + DECLARE_PTR_TYPEDEFS(HttpServerConnection); + + HttpServerConnection(const String& identity, bool authenticated, const Shared::Ptr& stream); + + void Start(); + void Disconnect(); + void StartStreaming(); + + bool Disconnected(); + +private: + ApiUser::Ptr m_ApiUser; + Shared::Ptr m_Stream; + double m_Seen; + String m_PeerAddress; + boost::asio::io_context::strand m_IoStrand; + bool m_ShuttingDown; + bool m_HasStartedStreaming; + boost::asio::deadline_timer m_CheckLivenessTimer; + + HttpServerConnection(const String& identity, bool authenticated, const Shared::Ptr& stream, boost::asio::io_context& io); + + void ProcessMessages(boost::asio::yield_context yc); + void CheckLiveness(boost::asio::yield_context yc); +}; + +} + +#endif /* HTTPSERVERCONNECTION_H */ -- cgit v1.2.3