X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FMainpage.dox;h=9c0ea9a8c2a1041c67dfc74197f18dd62bdb748e;hb=bf1d8ba5ce6fc6a169a938183f8d01c8bdbccf32;hp=f430b75aaa46b06bac51423fd9142427066e016f;hpb=327ff174bdc67db20c64d92c9a171abfa5443333;p=senf.git diff --git a/Console/Mainpage.dox b/Console/Mainpage.dox index f430b75..9c0ea9a 100644 --- a/Console/Mainpage.dox +++ b/Console/Mainpage.dox @@ -26,6 +26,71 @@ configure, control and manipulate a running application in any way. Additionally this library provides support for configuration files and command line parsing which can be used with or without the network console. + + \section console_intro Introduction + + There are two components to the Config/console framework: + + \li Building the node tree by registering objects and callbacks + \li Utilizing the config/console framework by writing configuration files or using the + interactive console. + + Basic data structure of the console and config framework is the config/console node tree. This + tree. This tree works like a file-system. Commands are added to this tree and can then be called + from configuration files or from the interactive console. + + To get started using the config/console library, see + \li \ref node_tree + \li \ref console_parser + + \section console_example Example + + The following example shows a \e very short summary on how to integrate the config/console + library. See above links for more: + + \code + // Define callback function. + void mycommand(std::ostream & os, senf::console::ParseCommandInfo const & command) + { + // ... + os << "!! Important message ...\n"; + } + + int main(int, char**) + { + // Provide global documentation + senf::console::root() + .doc("This is someServer server"); + + // Add a command + senf::console::root() + .add("mycommand", &mycommand) + .doc("mycommand []\n\n" + "If is given, flurgle the , otherwise burgle it"); + + // Start the interactive console server + senf::console::Server::start(senf::INet4SocketAddress(senf::INet4Address::None, 23232u)) + .name("someServer"); + } + \endcode + + after this registration, the console can be accessed easily via telnet: + +
+    $ telnet localhost 23232
+    Trying 127.0.0.1...
+    Connected to localhost.
+    Escape character is '^]'
+    xxxx-xx-xx xx:xx:xx.xxxxxx-0000 [NOTICE][senf::console::Server] Registered new client 0xxxxxxx
+    someServer:/# ls
+    mycommand
+    someServer:/# mycommand
+    !! Important message  ...
+    someServer:/# exit
+    xxxx-xx-xx xx:xx:xx.xxxxxx-0000 [NOTICE][senf::console::Server] Disposing client 0xxxxxxx
+    Connection closed by foreign host.
+    $
+    
*/