X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FServer.ih;h=d31f7133f4187512a421d5cd23c98e69ae7d846d;hb=feeec0e9cd78825120bd52f9ef4e115d383bf6a8;hp=bffdacb0dc5a70c0a773385b89435a0f7ad3b648;hpb=1a7c3a40d3e477b789c3fdfe7cacb01649d47edf;p=senf.git diff --git a/Console/Server.ih b/Console/Server.ih index bffdacb..d31f713 100644 --- a/Console/Server.ih +++ b/Console/Server.ih @@ -55,6 +55,8 @@ namespace detail { NonblockingSocketSink(Client & client); std::streamsize write(const char * s, std::streamsize n); + + Client & client() const; private: Client & client_; @@ -78,13 +80,19 @@ namespace detail { virtual ~ClientReader() = 0; + // Called by subclasses to get information from the Client + Client & client() const; std::string promptString() const; ClientHandle handle() const; std::ostream & stream() const; + + // Called by subclasses to perform actions in the Client + void stopClient(); - - void handleInput(std::string const & input) const; + std::string::size_type handleInput(std::string const & input, bool incremental=false) const; + + // Called by the Client void disablePrompt(); void enablePrompt(); @@ -124,6 +132,28 @@ namespace detail { unsigned promptLen_; bool promptActive_; }; + + /** \brief Internal: Primitive ClientReader implementation + + This implementation uses the cooked telnet mode to read lines from the console. It does not + support explicit line editing or any other advanced features. + */ + class NoninteractiveClientReader + : public ClientReader + { + public: + NoninteractiveClientReader(Client & client); + + private: + virtual void v_disablePrompt(); + virtual void v_enablePrompt(); + virtual void v_translate(std::string & data); + + void newData(senf::Scheduler::EventId event); + + SchedulerBinding binding_; + std::string buffer_; + }; }}}