PageRenderTime 21ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llmessage/lltransfertargetfile.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 75 lines | 38 code | 12 blank | 25 comment | 0 complexity | 70015a3ee76873d372764697782aa232 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lltransfertargetfile.h
  3. * @brief Transfer system for receiving a file.
  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_LLTRANSFERTARGETFILE_H
  27. #define LL_LLTRANSFERTARGETFILE_H
  28. #include "lltransfermanager.h"
  29. typedef void (*LLTTFCompleteCallback)(const LLTSCode status, void *user_data);
  30. class LLTransferTargetParamsFile : public LLTransferTargetParams
  31. {
  32. public:
  33. LLTransferTargetParamsFile()
  34. : LLTransferTargetParams(LLTTT_FILE),
  35. mCompleteCallback(NULL),
  36. mUserData(NULL)
  37. {}
  38. void setFilename(const std::string& filename) { mFilename = filename; }
  39. void setCallback(LLTTFCompleteCallback cb, void *user_data) { mCompleteCallback = cb; mUserData = user_data; }
  40. friend class LLTransferTargetFile;
  41. protected:
  42. std::string mFilename;
  43. LLTTFCompleteCallback mCompleteCallback;
  44. void * mUserData;
  45. };
  46. class LLTransferTargetFile : public LLTransferTarget
  47. {
  48. public:
  49. LLTransferTargetFile(const LLUUID& uuid, LLTransferSourceType src_type);
  50. virtual ~LLTransferTargetFile();
  51. static void requestTransfer(LLTransferTargetChannel *channelp,
  52. const char *local_filename,
  53. const LLTransferSourceParams &source_params,
  54. LLTTFCompleteCallback callback);
  55. protected:
  56. virtual bool unpackParams(LLDataPacker& dp);
  57. /*virtual*/ void applyParams(const LLTransferTargetParams &params);
  58. /*virtual*/ LLTSCode dataCallback(const S32 packet_id, U8 *in_datap, const S32 in_size);
  59. /*virtual*/ void completionCallback(const LLTSCode status);
  60. LLTransferTargetParamsFile mParams;
  61. LLFILE *mFP;
  62. };
  63. #endif // LL_LLTRANSFERTARGETFILE_H