PageRenderTime 27ms CodeModel.GetById 18ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llmessage/lltransfertargetvfile.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 93 lines | 44 code | 18 blank | 31 comment | 0 complexity | 7f87fca577f2c35a83ded30c99a0ae79 MD5 | raw file
 1/** 
 2 * @file lltransfertargetvfile.h
 3 * @brief Transfer system for receiving a vfile.
 4 *
 5 * $LicenseInfo:firstyear=2006&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 */
26
27#ifndef LL_LLTRANSFERTARGETVFILE_H
28#define LL_LLTRANSFERTARGETVFILE_H
29
30#include "lltransfermanager.h"
31#include "llassetstorage.h"
32#include "llvfile.h"
33
34class LLVFile;
35
36// Lame, an S32 for now until I figure out the deal with how we want to do
37// error codes.
38typedef void (*LLTTVFCompleteCallback)(
39	S32 status,
40	const LLUUID& file_id,
41	LLAssetType::EType file_type,
42	void* user_data, LLExtStat ext_status );
43
44class LLTransferTargetParamsVFile : public LLTransferTargetParams
45{
46public:
47	LLTransferTargetParamsVFile();
48
49	void setAsset(const LLUUID& asset_id, LLAssetType::EType asset_type);
50	void setCallback(LLTTVFCompleteCallback cb, void* user_data);
51
52	LLUUID getAssetID() const						{ return mAssetID; }
53	LLAssetType::EType getAssetType() const			{ return mAssetType; }
54
55	friend class LLTransferTargetVFile;
56protected:
57	bool unpackParams(LLDataPacker& dp);
58
59	LLUUID				mAssetID;
60	LLAssetType::EType	mAssetType;
61
62	LLTTVFCompleteCallback	mCompleteCallback;
63	void*					mUserDatap;
64	S32						mErrCode;
65};
66
67
68class LLTransferTargetVFile : public LLTransferTarget
69{
70public:
71	LLTransferTargetVFile(const LLUUID& uuid, LLTransferSourceType src_type);
72	virtual ~LLTransferTargetVFile();
73
74	//static void requestTransfer(LLTransferTargetChannel* channelp,
75	//							const char* local_filename,
76	//							const LLTransferSourceParams& source_params,
77	//							LLTTVFCompleteCallback callback);
78
79	static void updateQueue(bool shutdown = false);
80	
81protected:
82	virtual bool unpackParams(LLDataPacker& dp);
83	/*virtual*/ void applyParams(const LLTransferTargetParams& params);
84	/*virtual*/ LLTSCode dataCallback(const S32 packet_id, U8* in_datap, const S32 in_size);
85	/*virtual*/ void completionCallback(const LLTSCode status);
86
87	LLTransferTargetParamsVFile mParams;
88
89	BOOL mNeedsCreate;
90	LLUUID mTempID;
91};
92
93#endif // LL_LLTRANSFERTARGETFILE_H