-
Notifications
You must be signed in to change notification settings - Fork 345
/
filetransfer.h
69 lines (48 loc) · 1.26 KB
/
filetransfer.h
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef FILETRANSFER_H_
#define FILETRANSFER_H_
// ANSI C headers
#include <stdint.h>
// C++ headers
#include <vector>
using namespace std;
// Qt headers
#include <QMutex>
#include <QWaitCondition>
// MythTV headers
#include "referencecounter.h"
class ProgramInfo;
class RingBuffer;
class MythSocket;
class QString;
class FileTransfer : public ReferenceCounter
{
friend class QObject; // quiet OSX gcc warning
public:
FileTransfer(QString &filename, MythSocket *remote,
bool usereadahead, int timeout_ms);
FileTransfer(QString &filename, MythSocket *remote, bool write);
MythSocket *getSocket() { return sock; }
bool isOpen(void);
bool ReOpen(QString newFilename = "");
void Stop(void);
void Pause(void);
void Unpause(void);
int RequestBlock(int size);
int WriteBlock(int size);
long long Seek(long long curpos, long long pos, int whence);
uint64_t GetFileSize(void);
void SetTimeout(bool fast);
private:
~FileTransfer();
volatile bool readthreadlive;
bool readsLocked;
QWaitCondition readsUnlockedCond;
ProgramInfo *pginfo;
RingBuffer *rbuffer;
MythSocket *sock;
bool ateof;
vector<char> requestBuffer;
QMutex lock;
bool writemode;
};
#endif