summaryrefslogtreecommitdiff
path: root/distfoldd/clientagent.h
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2012-09-17 23:03:03 +0200
committerJavier S. Pedro <maemo@javispedro.com>2012-09-17 23:03:03 +0200
commitc3a1946675855b299a2b36550cdf2c2f69d153aa (patch)
treef7adf66404cdc47994225b616bcaf082a07dd168 /distfoldd/clientagent.h
downloaddistfold-c3a1946675855b299a2b36550cdf2c2f69d153aa.tar.gz
distfold-c3a1946675855b299a2b36550cdf2c2f69d153aa.zip
initial import
Diffstat (limited to 'distfoldd/clientagent.h')
-rw-r--r--distfoldd/clientagent.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/distfoldd/clientagent.h b/distfoldd/clientagent.h
new file mode 100644
index 0000000..d54bc69
--- /dev/null
+++ b/distfoldd/clientagent.h
@@ -0,0 +1,37 @@
+#ifndef CLIENTAGENT_H
+#define CLIENTAGENT_H
+
+#include <QtCore/QQueue>
+#include <QtNetwork/QHostAddress>
+
+#include "agent.h"
+
+class ClientAgent : public Agent
+{
+ Q_OBJECT
+public:
+ explicit ClientAgent(const QHostAddress& addr, uint port, const QDir& local_dir, SyncFlags flags, QObject *parent = 0);
+
+ enum State {
+ STATE_HELLO,
+ STATE_FILE_LIST,
+ STATE_FILE_ACTIONS
+ };
+
+protected:
+ void handleMessage(MessageType msg, const QByteArray &data);
+
+private:
+ void sendFileList();
+ void handleActionInfoList(const RemoteActionInfoList& list);
+ void executeNextAction();
+ void handlePulledFile(const QByteArray& data);
+ void handlePushFile(const QString& wire_path);
+ void handleDeleteFile(const QString& wire_path);
+
+private:
+ State _state;
+ RemoteActionInfoList _pendingActions;
+};
+
+#endif // CLIENTAGENT_H