summaryrefslogtreecommitdiff
path: root/indra/llmessage/lltransfersourcefile.h
blob: eb0ff6f7774ed580feed94ff3d55e62f9f01da71 (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
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
/** 
 * @file lltransfersourcefile.h
 * @brief Transfer system for sending a file.
 *
 * Copyright (c) 2006-$CurrentYear$, Linden Research, Inc.
 * $License$
 */

#ifndef LL_LLTRANSFERSOURCEFILE_H
#define LL_LLTRANSFERSOURCEFILE_H

#include "lltransfermanager.h"

class LLTransferSourceParamsFile : public LLTransferSourceParams
{
public:
	LLTransferSourceParamsFile();
	virtual ~LLTransferSourceParamsFile() {}
	/*virtual*/ void packParams(LLDataPacker &dp) const;
	/*virtual*/ BOOL unpackParams(LLDataPacker &dp);

	void setFilename(const LLString &filename)		{ mFilename = filename; }
	std::string getFilename() const					{ return mFilename; }

	void setDeleteOnCompletion(BOOL enabled)		{ mDeleteOnCompletion = enabled; }
	BOOL getDeleteOnCompletion()					{ return mDeleteOnCompletion; }
protected:
	std::string mFilename;
	// ONLY DELETE THINGS OFF THE SIM IF THE FILENAME BEGINS IN 'TEMP'
	BOOL mDeleteOnCompletion;
};

class LLTransferSourceFile : public LLTransferSource
{
public:
	LLTransferSourceFile(const LLUUID &transfer_id, const F32 priority);
	virtual ~LLTransferSourceFile();

protected:
	/*virtual*/ void initTransfer();
	/*virtual*/ F32 updatePriority();
	/*virtual*/ LLTSCode dataCallback(const S32 packet_id,
									  const S32 max_bytes,
									  U8 **datap,
									  S32 &returned_bytes,
									  BOOL &delete_returned);
	/*virtual*/ void completionCallback(const LLTSCode status);

	virtual void packParams(LLDataPacker& dp) const;
	/*virtual*/ BOOL unpackParams(LLDataPacker &dp);

protected:
	LLTransferSourceParamsFile mParams;
	FILE *mFP;
};

#endif // LL_LLTRANSFERSOURCEFILE_H