/* * Copyright (c) 2018-2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include "Command.h" #define IAC 0xff class Parser { public: Function on_command; Function on_data; Function on_error; void write(StringView); protected: enum State { Free, ReadCommand, ReadSubcommand, Error, }; private: State m_state { State::Free }; u8 m_command { 0 }; };