]> git.tdb.fi Git - xinema.git/blobdiff - source/client.h
Add a simple networked command interface
[xinema.git] / source / client.h
diff --git a/source/client.h b/source/client.h
new file mode 100644 (file)
index 0000000..1f543fc
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef CLIENT_H_
+#define CLIENT_H_
+
+#include <msp/fs/path.h>
+#include <msp/net/streamsocket.h>
+
+class Xinema;
+
+class Client
+{
+private:
+       Xinema &xinema;
+       Msp::Net::StreamSocket *socket;
+       std::string buffer;
+       bool stale;
+
+public:
+       Client(Xinema &, Msp::Net::StreamSocket *);
+
+       bool is_stale() const { return stale; }
+
+private:
+       void data_available();
+       void end_of_stream();
+
+       void process_command(const std::string &);
+       void send_reply(const std::string &);
+       void list_directory(const Msp::FS::Path &);
+};
+
+#endif