summaryrefslogtreecommitdiff
path: root/distfoldd/clientagent.h
diff options
context:
space:
mode:
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