PageRenderTime 30ms CodeModel.GetById 11ms app.highlight 14ms RepoModel.GetById 2ms app.codeStats 0ms

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