1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:17:34 +00:00

TelnetServer: Implement basic telnet server

Fixes #407

Depends on #530 to run reliably.
This commit is contained in:
Conrad Pankoff 2019-09-08 17:51:28 +10:00 committed by Andreas Kling
parent 423807d772
commit 040947ee47
9 changed files with 521 additions and 0 deletions

View file

@ -0,0 +1,33 @@
#pragma once
#include <AK/Function.h>
#include <AK/String.h>
#include <AK/StringView.h>
#include <AK/Types.h>
#include "Command.h"
#define IAC 0xff
class Parser {
public:
Function<void(const Command&)> on_command;
Function<void(const StringView&)> on_data;
Function<void()> on_error;
void write(const StringView&);
protected:
enum State {
Free,
ReadCommand,
ReadSubcommand,
Error,
};
void write(const String& str);
private:
State m_state { State::Free };
u8 m_command { 0 };
};