diff options
Diffstat (limited to 'src/control_interface.hpp')
| -rw-r--r-- | src/control_interface.hpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/control_interface.hpp b/src/control_interface.hpp index 82cc2af..3d11fdf 100644 --- a/src/control_interface.hpp +++ b/src/control_interface.hpp @@ -1,3 +1,9 @@ +/** + * @file environment.hpp + * @author Felix Morgner (felix.morgner@gmail.com) + * @since 1.0.0 + */ + #ifndef WANDA_CONTROL_INTERFACE_HPP #define WANDA_CONTROL_INTERFACE_HPP @@ -19,6 +25,9 @@ namespace wanda { + /** + * @brief An RAII type to delete a socket file upon destruction + */ struct socket_deleter { ~socket_deleter(); @@ -26,19 +35,38 @@ namespace wanda std::filesystem::path path; }; + /** + * @brief The daemon control interface + */ struct control_interface : control_connection::listener, keyed<control_interface>, std::enable_shared_from_this<control_interface> { using protocol = asio::local::stream_protocol; using pointer = std::shared_ptr<control_interface>; + /** + * @brief The interface to be implemented by the control interface listener + */ struct listener { virtual void on_received(control_interface & interface, command command){}; }; + /** + * @internal + * @brief Construct a new control interface object + * + * @note This constructor is keyed on a private key type so it can only be constructed using the #wanda::make_interface factory + */ control_interface(key, asio::io_service & service, protocol::endpoint endpoint, listener & listener); + /** + * @brief Start handling of controller connections + */ std::error_code start(); + + /** + * @brief Stop the control interface + */ std::error_code shutdown(); void on_close(control_connection::pointer connection) override; @@ -58,7 +86,10 @@ namespace wanda std::set<control_connection::pointer> m_connections; }; - control_interface::pointer make_interface(asio::io_service & service, std::filesystem::path file, control_interface::listener & listener); + /** + * @brief A factory to create new #control_interface instances + */ + control_interface::pointer make_interface(asio::io_service & service, std::filesystem::path socket, control_interface::listener & listener); } // namespace wanda |
