2019-02-25 08:48:22 -05:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2014-04-11 22:21:09 -04:00
|
|
|
|
2015-08-28 19:16:16 -04:00
|
|
|
#ifndef HTTPSERVERCONNECTION_H
|
|
|
|
|
#define HTTPSERVERCONNECTION_H
|
2014-04-11 22:21:09 -04:00
|
|
|
|
2015-06-22 05:11:21 -04:00
|
|
|
#include "remote/apiuser.hpp"
|
2019-02-14 10:10:41 -05:00
|
|
|
#include "base/string.hpp"
|
2014-10-16 06:27:09 -04:00
|
|
|
#include "base/tlsstream.hpp"
|
2019-02-14 10:10:41 -05:00
|
|
|
#include <memory>
|
|
|
|
|
#include <boost/asio/spawn.hpp>
|
2014-04-11 22:21:09 -04:00
|
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
2014-05-03 14:02:22 -04:00
|
|
|
* An API client connection.
|
2014-04-11 22:21:09 -04:00
|
|
|
*
|
2014-05-03 14:02:22 -04:00
|
|
|
* @ingroup remote
|
2014-04-11 22:21:09 -04:00
|
|
|
*/
|
2018-01-04 00:11:04 -05:00
|
|
|
class HttpServerConnection final : public Object
|
2014-04-11 22:21:09 -04:00
|
|
|
{
|
|
|
|
|
public:
|
2015-08-28 19:16:16 -04:00
|
|
|
DECLARE_PTR_TYPEDEFS(HttpServerConnection);
|
2014-05-03 14:02:22 -04:00
|
|
|
|
2019-02-14 10:10:41 -05:00
|
|
|
HttpServerConnection(const String& identity, bool authenticated, const std::shared_ptr<AsioTlsStream>& stream);
|
2014-05-03 14:02:22 -04:00
|
|
|
|
2018-01-03 22:25:35 -05:00
|
|
|
void Start();
|
2014-05-03 14:02:22 -04:00
|
|
|
|
2014-04-11 22:21:09 -04:00
|
|
|
private:
|
2015-06-22 05:11:21 -04:00
|
|
|
ApiUser::Ptr m_ApiUser;
|
2019-02-14 10:10:41 -05:00
|
|
|
std::shared_ptr<AsioTlsStream> m_Stream;
|
2018-10-09 09:40:16 -04:00
|
|
|
String m_PeerAddress;
|
2014-05-03 14:02:22 -04:00
|
|
|
|
2019-02-14 10:10:41 -05:00
|
|
|
void ProcessMessages(boost::asio::yield_context yc);
|
2014-04-11 22:21:09 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-28 19:16:16 -04:00
|
|
|
#endif /* HTTPSERVERCONNECTION_H */
|