/indra/llmessage/llregionpresenceverifier.h

https://bitbucket.org/lindenlab/viewer-beta/ · C Header · 98 lines · 57 code · 15 blank · 26 comment · 0 complexity · f5ea6bb893b1a05275af88078f64975b MD5 · raw file

  1. /**
  2. * @file llregionpresenceverifier.cpp
  3. * @brief
  4. *
  5. * $LicenseInfo:firstyear=2008&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. /* Macro Definitions */
  27. #ifndef LL_LLREGIONPRESENCEVERIFIER_H
  28. #define LL_LLREGIONPRESENCEVERIFIER_H
  29. #include "llhttpclient.h"
  30. #include <string>
  31. #include "llsd.h"
  32. #include <boost/intrusive_ptr.hpp>
  33. class LLHTTPClientInterface;
  34. class LLRegionPresenceVerifier
  35. {
  36. public:
  37. class Response
  38. {
  39. public:
  40. virtual ~Response() = 0;
  41. virtual bool checkValidity(const LLSD& content) const = 0;
  42. virtual void onRegionVerified(const LLSD& region_details) = 0;
  43. virtual void onRegionVerificationFailed() = 0;
  44. virtual LLHTTPClientInterface& getHttpClient() = 0;
  45. public: /* but not really -- don't touch this */
  46. U32 mReferenceCount;
  47. };
  48. typedef boost::intrusive_ptr<Response> ResponsePtr;
  49. class RegionResponder : public LLHTTPClient::Responder
  50. {
  51. public:
  52. RegionResponder(const std::string& uri, ResponsePtr data,
  53. S32 retry_count);
  54. virtual ~RegionResponder();
  55. virtual void result(const LLSD& content);
  56. virtual void error(U32 status, const std::string& reason);
  57. private:
  58. ResponsePtr mSharedData;
  59. std::string mUri;
  60. S32 mRetryCount;
  61. };
  62. class VerifiedDestinationResponder : public LLHTTPClient::Responder
  63. {
  64. public:
  65. VerifiedDestinationResponder(const std::string& uri, ResponsePtr data,
  66. const LLSD& content, S32 retry_count);
  67. virtual ~VerifiedDestinationResponder();
  68. virtual void result(const LLSD& content);
  69. virtual void error(U32 status, const std::string& reason);
  70. private:
  71. void retry();
  72. ResponsePtr mSharedData;
  73. LLSD mContent;
  74. std::string mUri;
  75. S32 mRetryCount;
  76. };
  77. };
  78. namespace boost
  79. {
  80. void intrusive_ptr_add_ref(LLRegionPresenceVerifier::Response* p);
  81. void intrusive_ptr_release(LLRegionPresenceVerifier::Response* p);
  82. };
  83. #endif //LL_LLREGIONPRESENCEVERIFIER_H