#pragma once #include "../../plugin_interface.h" #include "socket.h" #include #include #include #include // automatically reserves ID, and releases it via RAII class FCGI_ID_Guard { FCGI_ID& m_fcgi_id; uint16_t m_id; public: FCGI_ID_Guard(FCGI_ID& fcgi_id): m_fcgi_id(fcgi_id), m_id(fcgi_id.getID()) { } ~FCGI_ID_Guard() { m_fcgi_id.putID(m_id); } uint16_t getID() const { return m_id; } }; struct FCGIContext; class fcgi_plugin: public webserver_plugin_interface { SocketFactory m_socket_factory; std::unordered_map> m_sockets; public: fcgi_plugin(); ~fcgi_plugin(); std::string name() override; std::string generate_page( std::function& GetServerParam, std::function& GetRequestParam, // request including body (POST...) std::function& SetResponseHeader // to be added to result string ) override; bool has_own_authentication() override; std::string fcgiQuery(FCGIContext& context); }; extern "C" BOOST_SYMBOL_EXPORT fcgi_plugin webserver_plugin; fcgi_plugin webserver_plugin;