Server client instance.
More...
#include <senf/Utils/Console/Server.hh>
|
| ~Client () |
|
void | stop () |
| Stop the client. More...
|
|
std::string const & | name () const |
| Get name of the client instance. More...
|
|
ClientHandle | handle () const |
| Get the client's network socket handle. More...
|
|
std::ostream & | stream () |
| Get client's output stream. More...
|
|
std::string | promptString () const |
| Get the prompt string. More...
|
|
DirectoryNode & | root () const |
| Get configured root node. More...
|
|
DirectoryNode & | cwd () const |
| Get current directory. More...
|
|
Server::Mode | mode () const |
| Get operation mode. More...
|
|
void | write (std::string const &data) const |
| Write data to network socket. More...
|
|
std::string const & | backtrace () const |
| Get backtrace of last console error, if any. More...
|
|
unsigned | width () const |
| Get console width. More...
|
|
void | setProperty (std::string const &key, std::string const &value) |
|
std::string | getProperty (std::string const &key, std::string const &defaultValue) const |
|
boost::optional< std::string > | getProperty (std::string const &key) const |
|
virtual | ~intrusive_refcount_base () |
|
refcount_t | refcount () const |
|
bool | is_shared () const |
|
std::ostream & | stream () const |
|
void | stream (std::ostream &newos) |
|
| IOStreamTarget (std::string const &name, std::ostream &os) |
|
iterator | begin () const |
|
iterator | end () const |
|
RoutingEntry const & | operator[] (size_type i) const |
|
size_type | size () const |
|
bool | empty () const |
|
void | flush () |
|
senf::console::ScopedDirectory & | consoleDir () |
|
std::ostream & | operator<< (std::ostream &os, Target::action_t const &action) |
|
| Target (std::string const &name) |
|
virtual | ~Target () |
|
void | route (action_t action=ACCEPT, int index=-1) |
|
void | route (std::string const &stream, std::string const &area="", unsigned level=NONE::value, action_t action=ACCEPT, int index=-1) |
|
void | unroute (action_t action=ACCEPT) |
|
void | unroute (std::string const &stream, std::string const &area="", unsigned level=NONE::value, action_t action=ACCEPT) |
|
void | unroute (int index=-1) |
|
|
static Client & | get (std::ostream &os) |
| Access client instance. More...
|
|
static unsigned | getWidth (std::ostream &os, unsigned defaultWidth=0, unsigned minWidth=0) |
| Get width of client console if possible. More...
|
|
|
(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. More...
|
|
std::ostream & | operator<< (std::ostream &os, Client *client) |
| Output Console Client instance as it's string representation. More...
|
|
Server client instance.
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 143 of file Server.hh.
◆ ClientHandle
◆ ~Client()
senf::console::Client::~Client |
( |
| ) |
|
◆ backtrace()
std::string const& senf::console::Client::backtrace |
( |
| ) |
const |
Get backtrace of last console error, if any.
◆ cwd()
Get current directory.
This is the directory, the console currently is changed into by the user of the console.
◆ get()
static Client& senf::console::Client::get |
( |
std::ostream & |
os | ) |
|
|
static |
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.
- Exceptions
-
std::bad_cast | if os is not associated with a Client instance. |
◆ getProperty() [1/2]
std::string senf::console::Client::getProperty |
( |
std::string const & |
key, |
|
|
std::string const & |
defaultValue |
|
) |
| const |
◆ getProperty() [2/2]
boost::optional< std::string > senf::console::Client::getProperty |
( |
std::string const & |
key | ) |
const |
◆ getWidth()
unsigned senf::console::Client::getWidth |
( |
std::ostream & |
os, |
|
|
unsigned |
defaultWidth = 0 , |
|
|
unsigned |
minWidth = 0 |
|
) |
| |
|
static |
Get width of client console if possible.
If possible, the width of the client console attached to the stream os is returned. If this is not possible, the defaultValue will be used.
If the width obtained this way is smaller than minWidth, defaultValue will be returned instead.
Definition at line 475 of file Server.cc.
◆ handle()
Get the client's network socket handle.
◆ mode()
◆ name()
std::string const& senf::console::Client::name |
( |
| ) |
const |
Get name of the client instance.
This name is used in the prompt string and is set by the server.
◆ promptString()
std::string senf::console::Client::promptString |
( |
| ) |
const |
◆ root()
Get configured root node.
◆ setProperty()
void senf::console::Client::setProperty |
( |
std::string const & |
key, |
|
|
std::string const & |
value |
|
) |
| |
◆ stop()
void senf::console::Client::stop |
( |
| ) |
|
Stop the client.
This will close the client socket.
◆ stream()
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().
◆ width()
unsigned senf::console::Client::width |
( |
| ) |
const |
Get console width.
If possible, this will be the width of the connected terminal, otherwise a default value (normally 80) is returned.
◆ write()
void senf::console::Client::write |
( |
std::string const & |
data | ) |
const |
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).
◆ operator<<() [1/2]
std::ostream & operator<< |
( |
std::ostream & |
os, |
|
|
Client const & |
client |
|
) |
| |
|
related |
Output Console Client instance as it's string representation.
◆ operator<<() [2/2]
std::ostream & operator<< |
( |
std::ostream & |
os, |
|
|
Client * |
client |
|
) |
| |
|
related |
Output Console Client instance as it's string representation.
The documentation for this class was generated from the following files: