00001
00032 #ifndef LL_LLTRANSFERSOURCEASSET_H
00033 #define LL_LLTRANSFERSOURCEASSET_H
00034
00035 #include "lltransfermanager.h"
00036 #include "llassetstorage.h"
00037
00038 class LLVFile;
00039
00040 class LLTransferSourceParamsAsset : public LLTransferSourceParams
00041 {
00042 public:
00043 LLTransferSourceParamsAsset();
00044 virtual ~LLTransferSourceParamsAsset() {}
00045 void packParams(LLDataPacker &dp) const;
00046 BOOL unpackParams(LLDataPacker &dp);
00047
00048 void setAsset(const LLUUID &asset_id, const LLAssetType::EType asset_type);
00049
00050 LLUUID getAssetID() const { return mAssetID; }
00051 LLAssetType::EType getAssetType() const { return mAssetType; }
00052
00053 protected:
00054 LLUUID mAssetID;
00055 LLAssetType::EType mAssetType;
00056 };
00057
00058 class LLTransferSourceAsset : public LLTransferSource
00059 {
00060 public:
00061 LLTransferSourceAsset(const LLUUID &request_id, const F32 priority);
00062 virtual ~LLTransferSourceAsset();
00063
00064 static void responderCallback(LLVFS *vfs, const LLUUID& uuid, LLAssetType::EType type,
00065 void *user_data, S32 result, LLExtStat ext_status );
00066 protected:
00067 void initTransfer();
00068 F32 updatePriority();
00069 LLTSCode dataCallback(const S32 packet_id,
00070 const S32 max_bytes,
00071 U8 **datap,
00072 S32 &returned_bytes,
00073 BOOL &delete_returned);
00074 void completionCallback(const LLTSCode status);
00075
00076 virtual void packParams(LLDataPacker& dp) const;
00077 BOOL unpackParams(LLDataPacker &dp);
00078
00079 protected:
00080 LLTransferSourceParamsAsset mParams;
00081 BOOL mGotResponse;
00082
00083 S32 mCurPos;
00084 };
00085
00094 bool is_asset_fetch_by_id_allowed(LLAssetType::EType type);
00095
00104 bool is_asset_id_knowable(LLAssetType::EType type);
00105
00106 #endif // LL_LLTRANSFERSOURCEASSET_H