MythTV  master
fileserverhandler.h
Go to the documentation of this file.
1 #ifndef FILESERVER_H_
2 #define FILESERVER_H_
3 
4 #include <QMutex>
5 
6 #include "mythsocketmanager.h"
7 #include "filesysteminfo.h"
8 #include "mythprotoserverexp.h"
9 
12 
14 {
15  Q_OBJECT
16  public:
17  bool HandleAnnounce(MythSocket *socket, QStringList &commands,
18  QStringList &slist) override; // SocketRequestHandler
19  bool HandleQuery(SocketHandler *socket, QStringList &commands,
20  QStringList &slist) override; // SocketRequestHandler
21  QString GetHandlerName(void) override // SocketRequestHandler
22  { return "FILETRANSFER"; }
23 
24  void connectionAnnounced(MythSocket *socket, QStringList &commands,
25  QStringList &slist) override; // SocketRequestHandler
26  void connectionClosed(MythSocket *socket) override; // SocketRequestHandler
27 
28  static bool DeleteFile(const QString& filename, const QString& storagegroup);
29 
30  static QList<FileSystemInfo> QueryFileSystems(void);
31  QList<FileSystemInfo> QueryAllFileSystems(void);
32 
33  private:
34  static bool HandleQueryFreeSpace(SocketHandler *socket);
35  bool HandleQueryFreeSpaceList(SocketHandler *socket);
36  bool HandleQueryFreeSpaceSummary(SocketHandler *socket);
37 
38  static bool HandleQueryCheckFile(SocketHandler *socket, QStringList &slist);
39  static bool HandleQueryFileExists(SocketHandler *socket, QStringList &slist);
40  bool HandleQueryFileHash(SocketHandler *socket, QStringList &slist);
41 
42  static bool HandleDeleteFile(SocketHandler *socket, QStringList &slist);
43  static bool HandleDeleteFile(SocketHandler *socket, const QString& filename,
44  const QString& storagegroup);
45  bool HandleDeleteFile(QString filename, QString storagegroup);
46  static bool HandleDeleteFile(DeleteHandler *handler);
47 
48  bool HandleGetFileList(SocketHandler *socket, QStringList &slist);
49  bool HandleFileQuery(SocketHandler *socket, QStringList &slist);
50  bool HandleQueryFileTransfer(SocketHandler *socket, QStringList &commands,
51  QStringList &slist);
52  bool HandleDownloadFile(SocketHandler *socket, QStringList &slist);
53 
54  static QString LocalFilePath(const QString &path, const QString &wantgroup);
55  static void RunDeleteThread(void);
56 
57  QMap<int, FileTransfer*> m_ftMap;
58  QReadWriteLock m_ftLock;
59 
60  QMap<QString, SocketHandler*> m_fsMap;
61  QReadWriteLock m_fsLock;
62 
64  QMap<QString, QString> m_downloadURLs;
65 };
66 
67 #endif
virtual void connectionAnnounced(MythSocket *, QStringList &, QStringList &)
QReadWriteLock m_fsLock
QReadWriteLock m_ftLock
QString GetHandlerName(void) override
QMap< QString, SocketHandler * > m_fsMap
virtual bool HandleAnnounce(MythSocket *, QStringList &, QStringList &)
virtual bool HandleQuery(SocketHandler *, QStringList &, QStringList &)
QMap< QString, QString > m_downloadURLs
#define PROTOSERVER_PUBLIC
virtual void connectionClosed(MythSocket *)
QMap< int, FileTransfer * > m_ftMap
Class for communcating between myth backends and frontends.
Definition: mythsocket.h:26