summaryrefslogtreecommitdiff
path: root/commands.h
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-01-01 21:04:17 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2011-01-01 21:04:17 +0100
commit14500d43760661ffc3ffb67d929088c27fe46c64 (patch)
tree75d9471a61b00eb56b7ee75b3a785a392edb0dad /commands.h
parent0e7f2cef26bde782a5758b5e9a3dfe20f745df8f (diff)
Implemented a simple 'ls' command for the telnet server.
Diffstat (limited to 'commands.h')
-rw-r--r--commands.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/commands.h b/commands.h
new file mode 100644
index 0000000..bc4092f
--- /dev/null
+++ b/commands.h
@@ -0,0 +1,24 @@
+#ifndef COMMANDS_H
+#define COMMANDS_H
+
+#include <boost/function.hpp>
+
+#include <string>
+#include <vector>
+#include <map>
+#include <stdexcept>
+
+namespace commands {
+ typedef boost::function<std::vector<std::string> (const std::vector<std::string>&)> Handler;
+ extern std::map<std::string, commands::Handler> handlers;
+
+ class CommandException : public std::runtime_error {
+ public:
+ CommandException(const char *s) : std::runtime_error(s) {};
+ };
+
+ void init();
+ std::vector<std::string> execute(const std::vector<std::string>& args);
+};
+
+#endif