senf::console::Server Class Reference
[Accessing the Console/Config tree]

Interactive console server. More...

#include <senf/Utils/Console/Server.hh>

Inheritance diagram for senf::console::Server:
Inheritance graph
[legend]

List of all members.


Detailed Description

Interactive console server.

This class provides an interactive console TCP server.

Idea:
To support blocking commands, we could give the Client 'suspend()' and 'resume()' members. suspend() would probably throw some kind of exception to transfer control back to the Client instance. on resume(), the command would be called again, maybe setting some flag or something. Example for use: Host name resolution: Here we can just built our own little host-name cache. When the name is not found, we ask the resolver to resolve it and call 'resume' when the name is found. Since it is in the cache now, the command will now complete.

Definition at line 63 of file Server.hh.


Public Types

enum   Mode { Automatic, Interactive, Noninteractive }
typedef detail::ServerHandle  ServerHandle

Public Member Functions

std::string const &  name () const
  Get server name.
Server name (std::string const &name)
  Set server name.
DirectoryNode root () const
  Get root node.
Server root (DirectoryNode &root)
  Set root node.
Mode  mode () const
  Get mode.
Server mode (Mode mode)
  Set mode.
void  stop ()
  Stop the server.

Static Public Member Functions

static Server start (senf::INet4SocketAddress const &address)
  Start server on given IPv4 address/port.
static Server start (senf::INet6SocketAddress const &address)
  Start server on given IPv6 address/port.

Member Typedef Documentation

typedef detail::ServerHandle senf::console::Server::
ServerHandle

Definition at line 72 of file Server.hh.


Member Enumeration Documentation

enum senf::console::Server::
Mode
Enumerator:
Automatic 
Interactive 
Noninteractive 

Definition at line 74 of file Server.hh.


Member Function Documentation

senf::console::Server & Server::
mode ( Mode  mode )

Set mode.

There are two Server types:

  • An interactive server displays a command prompt and optionally supports command-line editing.
  • A non-interactive server does not display any prompt and does not allow any interactive editing. This type of server is used for (remote) scripting.
The mode parameter selects between these modes. In Automatic (the default), a client connection is considered to be interactive if there is no data traffic in the first 500ms after the connection is opened.

Definition at line 92 of file Server.cci.

senf::console::Server::Mode Server::
mode ()

Get mode.

See also:
mode(Mode)

Definition at line 98 of file Server.cci.

senf::console::Server & Server::
name ( std::string const &  name )

Set server name.

This information is used in the prompt string.

Definition at line 68 of file Server.cci.

std::string const & Server::
name ()

Get server name.

This information is used in the prompt string.

Definition at line 74 of file Server.cci.

senf::console::Server & Server::
root ( DirectoryNode root )

Set root node.

node will be the root node for all clients launched from this server.

Definition at line 86 of file Server.cci.

senf::console::DirectoryNode & Server::
root ()

Get root node.

Definition at line 80 of file Server.cci.

senf::console::Server & Server::
start ( senf::INet6SocketAddress const &  address )

Start server on given IPv6 address/port.

Definition at line 91 of file Server.cc.

senf::console::Server & Server::
start ( senf::INet4SocketAddress const &  address )

Start server on given IPv4 address/port.

Definition at line 81 of file Server.cc.

void Server::
stop ()

Stop the server.

All clients will be closed

Warning:
The Server instance itself will be deleted

Definition at line 104 of file Server.cci.


The documentation for this class was generated from the following files: