From c3a1946675855b299a2b36550cdf2c2f69d153aa Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Mon, 17 Sep 2012 23:03:03 +0200 Subject: initial import --- distfoldd/clientagent.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 distfoldd/clientagent.h (limited to 'distfoldd/clientagent.h') 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 +#include + +#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 -- cgit v1.2.3