PageRenderTime 43ms CodeModel.GetById 20ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LLTRANSFERTARGETVFILE_H
  27. #define LL_LLTRANSFERTARGETVFILE_H
  28. #include "lltransfermanager.h"
  29. #include "llassetstorage.h"
  30. #include "llvfile.h"
  31. class LLVFile;
  32. // Lame, an S32 for now until I figure out the deal with how we want to do
  33. // error codes.
  34. typedef void (*LLTTVFCompleteCallback)(
  35. S32 status,
  36. const LLUUID& file_id,
  37. LLAssetType::EType file_type,
  38. void* user_data, LLExtStat ext_status );
  39. class LLTransferTargetParamsVFile : public LLTransferTargetParams
  40. {
  41. public:
  42. LLTransferTargetParamsVFile();
  43. void setAsset(const LLUUID& asset_id, LLAssetType::EType asset_type);
  44. void setCallback(LLTTVFCompleteCallback cb, void* user_data);
  45. LLUUID getAssetID() const { return mAssetID; }
  46. LLAssetType::EType getAssetType() const { return mAssetType; }
  47. friend class LLTransferTargetVFile;
  48. protected:
  49. bool unpackParams(LLDataPacker& dp);
  50. LLUUID mAssetID;
  51. LLAssetType::EType mAssetType;
  52. LLTTVFCompleteCallback mCompleteCallback;
  53. void* mUserDatap;
  54. S32 mErrCode;
  55. };
  56. class LLTransferTargetVFile : public LLTransferTarget
  57. {
  58. public:
  59. LLTransferTargetVFile(const LLUUID& uuid, LLTransferSourceType src_type);
  60. virtual ~LLTransferTargetVFile();
  61. //static void requestTransfer(LLTransferTargetChannel* channelp,
  62. // const char* local_filename,
  63. // const LLTransferSourceParams& source_params,
  64. // LLTTVFCompleteCallback callback);
  65. static void updateQueue(bool shutdown = false);
  66. protected:
  67. virtual bool unpackParams(LLDataPacker& dp);
  68. /*virtual*/ void applyParams(const LLTransferTargetParams& params);
  69. /*virtual*/ LLTSCode dataCallback(const S32 packet_id, U8* in_datap, const S32 in_size);
  70. /*virtual*/ void completionCallback(const LLTSCode status);
  71. LLTransferTargetParamsVFile mParams;
  72. BOOL mNeedsCreate;
  73. LLUUID mTempID;
  74. };
  75. #endif // LL_LLTRANSFERTARGETFILE_H