#include <senf/Utils/Console/Server.hh>
Whenever a new client connects, a new instance of this class is created. This class shows a command prompt, receives the commands, parses them and then passes (using a CommandParser) and passes the commands to an Executor instance.
Definition at line 147 of file Server.hh.
Classes |
|
class | SysBacktrace |
Public Types |
|
typedef Server::ServerHandle::ClientHandle |
ClientHandle |
Public Member Functions |
|
~Client () | |
void | stop () |
Stop the client. |
|
std::string const & | name () const |
Get name of the client instance. |
|
ClientHandle | handle () const |
Get the client's network socket handle. |
|
std::ostream & | stream () |
Get client's output stream. |
|
std::string | promptString () const |
Get the prompt string. |
|
DirectoryNode & | root () const |
Get configured root node. |
|
DirectoryNode & | cwd () const |
Get current directory. |
|
Server::Mode | mode () const |
Get operation mode. |
|
void | write (std::string const &data) const |
Write data to network socket. |
|
std::string const & | backtrace () const |
Get backtrace of last console error, if any. |
|
unsigned | width () const |
Get console width. |
|
Static Public Member Functions |
|
static Client & | get (std::ostream &os) |
Access client instance. |
|
static unsigned | getWidth (std::ostream &os, unsigned defaultWidth=0, unsigned minWidth=0) |
Get width of client console if possible. |
|
Related Functions |
|
(Note that these are not member functions.) |
|
std::ostream & | operator<< (std::ostream &os, Client const &client) |
Output Console Client instance as it's string representation. |
|
std::ostream & | operator<< (std::ostream &os, Client *client) |
Output Console Client instance as it's string representation. |
typedef Server::ServerHandle::ClientHandle senf::console::Client:: | ||||
ClientHandle | ||||
senf::console::Client:: | ||||
~Client | () | |||
Definition at line 113 of file Server.cci.
std::string const & senf::console::Client:: | ||||
backtrace | () | |||
Get backtrace of last console error, if any.
Definition at line 160 of file Server.cci.
senf::console::DirectoryNode & senf::console::Client:: | ||||
cwd | () | |||
Get current directory.
This is the directory, the console currently is changed into by the user of the console.
Definition at line 142 of file Server.cci.
senf::console::Client & senf::console::Client:: | ||||
get | ( | std::ostream & | os | ) |
Access client instance.
Allows to access the client instance from console command implementations. The first argument to a console command is a stream object. If this stream object belongs to a network console client, this call will return the associated Client instance reference.
std::bad_cast | if os is not associated with a Client instance. |
Definition at line 172 of file Server.cci.
unsigned senf::console::Client:: | ||||
getWidth | ( | std::ostream & | os, | |
unsigned |
defaultWidth = 0 , |
|||
unsigned |
minWidth = 0
|
) | ||
senf::console::Client::ClientHandle senf::console::Client:: | ||||
handle | () | |||
Get the client's network socket handle.
Definition at line 177 of file Server.cci.
senf::console::Server::Mode senf::console::Client:: | ||||
mode | () | |||
std::string const & senf::console::Client:: | ||||
name | () | |||
Get name of the client instance.
This name is used in the prompt string and is set by the server.
Definition at line 124 of file Server.cci.
std::string senf::console::Client:: | ||||
promptString | () | |||
Get the prompt string.
Definition at line 130 of file Server.cci.
senf::console::DirectoryNode & senf::console::Client:: | ||||
root | () | |||
Get configured root node.
Definition at line 136 of file Server.cci.
void senf::console::Client:: | ||||
stop | () | |||
std::ostream & senf::console::Client:: | ||||
stream | () | |||
Get client's output stream.
Data sent to this stream is sent out over the network via the client's socket handle. Write operation is non-blocking and data may be dropped. Data is written using Client::write().
Definition at line 183 of file Server.cci.
unsigned senf::console::Client:: | ||||
width | () | |||
Get console width.
If possible, this will be the width of the connected terminal, otherwise a default value (normally 80) is returned.
Definition at line 166 of file Server.cci.
void senf::console::Client:: | ||||
write | ( | std::string const & | data | ) |
Write data to network socket.
The data is automatically filtered depending on the type of connection (e.g. on a telnet connection, specific bytes are quoted).
Definition at line 154 of file Server.cci.
std::ostream & | ||||
operator<< | ( | std::ostream & | os, | |
Client * | client | ) | ||
Output Console Client instance as it's string representation.
std::ostream & | ||||
operator<< | ( | std::ostream & | os, | |
Client const & | client | ) | ||
Output Console Client instance as it's string representation.