diff options
Diffstat (limited to 'src/control_connection.hpp')
| -rw-r--r-- | src/control_connection.hpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/control_connection.hpp b/src/control_connection.hpp index 679a2ff..24d3276 100644 --- a/src/control_connection.hpp +++ b/src/control_connection.hpp @@ -27,6 +27,13 @@ struct control_connection : keyed<control_connection>, std::enable_shared_from_t virtual void on_error(pointer connection, boost::system::error_code) {} }; + enum struct state : std::underlying_type_t<std::byte> + { + unknown, + fresh, + established, + }; + /** * @internal * @brief Construct a new control connection object @@ -40,14 +47,14 @@ struct control_connection : keyed<control_connection>, std::enable_shared_from_t * * @returns <code>true</code> iff. the listener was not already in the listener set */ - bool add(listener * listener); + bool add(listener *listener); /** * @brief Remove the given listener from this control connection's listener set * * @return <code>true</code> iff. the listener was previously registered with this control connection */ - bool remove(listener * listener); + bool remove(listener *listener); /** * @brief Start I/O processing for this control connection @@ -61,6 +68,10 @@ struct control_connection : keyed<control_connection>, std::enable_shared_from_t void send(message message); + void update(state state); + + state current_state() const; + private: friend pointer make_control_connection(protocol::socket &&socket); @@ -72,7 +83,7 @@ struct control_connection : keyed<control_connection>, std::enable_shared_from_t std::istream m_input{&m_in}; std::ostream m_output{&m_out}; std::set<listener *> m_listeners{}; - bool m_running{}; + state m_state{}; }; control_connection::pointer make_control_connection(control_connection::protocol::socket &&socket); |
