PageRenderTime 30ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llwlhandlers.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 100 lines | 45 code | 14 blank | 41 comment | 0 complexity | 0ee018e8294777591eefb0b5b3bb4952 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llwlhandlers.h
  3. * @brief Headers for classes in llwlhandlers.cpp
  4. *
  5. * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2011, 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_LLWLHANDLERS_H
  27. #define LL_LLWLHANDLERS_H
  28. #include "llviewerprecompiledheaders.h"
  29. #include "llhttpclient.h"
  30. class LLEnvironmentRequest
  31. {
  32. LOG_CLASS(LLEnvironmentRequest);
  33. public:
  34. /// @return true if request was successfully sent
  35. static bool initiate();
  36. private:
  37. static void onRegionCapsReceived(const LLUUID& region_id);
  38. static bool doRequest();
  39. };
  40. class LLEnvironmentRequestResponder: public LLHTTPClient::Responder
  41. {
  42. LOG_CLASS(LLEnvironmentRequestResponder);
  43. public:
  44. virtual void result(const LLSD& content);
  45. virtual void error(U32 status, const std::string& reason);
  46. private:
  47. friend class LLEnvironmentRequest;
  48. LLEnvironmentRequestResponder();
  49. static int sCount;
  50. int mID;
  51. };
  52. class LLEnvironmentApply
  53. {
  54. LOG_CLASS(LLEnvironmentApply);
  55. public:
  56. /// @return true if request was successfully sent
  57. static bool initiateRequest(const LLSD& content);
  58. private:
  59. static clock_t sLastUpdate;
  60. static clock_t UPDATE_WAIT_SECONDS;
  61. };
  62. class LLEnvironmentApplyResponder: public LLHTTPClient::Responder
  63. {
  64. LOG_CLASS(LLEnvironmentApplyResponder);
  65. public:
  66. /*
  67. * Expecting reply from sim in form of:
  68. * {
  69. * regionID : uuid,
  70. * messageID: uuid,
  71. * success : true
  72. * }
  73. * or
  74. * {
  75. * regionID : uuid,
  76. * success : false,
  77. * fail_reason : string
  78. * }
  79. */
  80. virtual void result(const LLSD& content);
  81. virtual void error(U32 status, const std::string& reason); // non-200 errors only
  82. private:
  83. friend class LLEnvironmentApply;
  84. LLEnvironmentApplyResponder() {}
  85. };
  86. #endif // LL_LLWLHANDLERS_H