summaryrefslogtreecommitdiff
path: root/distfoldd/serveragent.h
blob: b5fd380877eab390e308d6e14adcd285a5c7ab68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef SERVERAGENT_H
#define SERVERAGENT_H

#include "agent.h"

class ServerAgent : public Agent
{
	Q_OBJECT
public:
	explicit ServerAgent(QSslSocket *socket, const QDir& local_dir, const QString& passwd, SyncFlags flags, QObject *parent = 0);

protected:
	void handleMessage(MessageType msg, const QByteArray& data);

private:
	bool checkAuth();
	void handleAuth(const QByteArray& response);
	void handleClientFileList(const RemoteFileInfoList& list);
	void handlePullFile(const QString& path);
	void handlePushedFile(const QByteArray& data);
	void handlePushedMetadata(const RemoteFileInfoList& list);
	void handleDeleteFile(const QString& path);

private:
	QByteArray _challenge;
	QByteArray _clientChallenge;
	bool _authAttempted;
	bool _authOk;
};

#endif // SERVERAGENT_H