17 #ifndef HH_SENF_Utils_Console_Server_ 18 #define HH_SENF_Utils_Console_Server_ 1 22 #include <boost/scoped_ptr.hpp> 73 std::string
const &
name()
const;
112 Server(ServerHandle handle);
116 void newClient(
int event);
117 void removeClient(
Client & client);
118 boost::shared_ptr<DirectoryNode> consoleSelf(std::ostream & os);
121 ServerHandle handle_;
127 typedef std::set< boost::intrusive_ptr<Client> > Clients;
130 std::string welcomeMsg_;
145 private boost::base_from_member< detail::SocketStreamOStream >,
148 typedef boost::base_from_member< detail::SocketStreamOStream > out_t;
153 static const unsigned INTERACTIVE_TIMEOUT = 500;
163 std::string
const &
name()
const;
166 ClientHandle handle()
const;
167 std::ostream & stream();
172 std::string promptString()
const;
179 void write(std::string
const & data)
const;
185 unsigned width()
const;
190 static Client &
get(std::ostream & os);
199 static unsigned getWidth(std::ostream & os,
unsigned defaultWidth = 0,
200 unsigned minWidth = 0);
209 void setProperty(std::string
const & key, std::string
const & value);
210 std::string getProperty(std::string
const & key, std::string
const & defaultValue)
const;
211 boost::optional<std::string> getProperty(std::string
const & key)
const;
216 void setInteractive();
217 void setNoninteractive();
219 size_t handleInput(std::string input,
bool incremental =
false);
220 virtual void v_write(senf::log::time_type timestamp, std::string
const & stream,
221 std::string
const & area,
unsigned level,
222 std::string
const & message);
224 void dumpProperties(std::ostream & os)
const;
228 ClientHandle handle_;
234 boost::scoped_ptr<detail::ClientReader> reader_;
236 std::string backtrace_;
237 typedef std::map<std::string, std::string> PropertyMap;
238 PropertyMap properties_;
241 friend class detail::ClientReader;
242 friend class detail::SocketStreamSink;
247 static void backtrace(std::ostream & os);
248 static SysBacktrace instance_;
ScopedDirectory public header.
static Server & start(senf::INet4SocketAddress const &address)
Start server on given IPv4 address/port.
#define SENF_LOG_CLASS_AREA()
boost::shared_ptr< DirectoryNode > ptr
Config/console tree directory node.
Mode mode() const
Get mode.
Server::ServerHandle::ClientHandle ClientHandle
DirectoryNode member proxy.
std::ostream & operator<<(std::ostream &os, Token const &token)
void stop()
Stop the server.
Execute config/console commands.
#define SENF_LOG_DEFAULT_LEVEL(level)
DirectoryNode & root() const
Get root node.
std::string const & name() const
Get server name.
Interactive console server.
void backtrace(std::ostream &os, int numEntries)
Server & welcomeMessage(std::string const &message)
Set server welcome message.
detail::ServerHandle ServerHandle