PageRenderTime 193ms CodeModel.GetById 101ms app.highlight 5ms RepoModel.GetById 85ms app.codeStats 1ms

/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
  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
 27#ifndef LL_LLWLHANDLERS_H
 28#define LL_LLWLHANDLERS_H
 29
 30#include "llviewerprecompiledheaders.h"
 31#include "llhttpclient.h"
 32
 33class LLEnvironmentRequest
 34{
 35	LOG_CLASS(LLEnvironmentRequest);
 36public:
 37	/// @return true if request was successfully sent
 38	static bool initiate();
 39
 40private:
 41	static void onRegionCapsReceived(const LLUUID& region_id);
 42	static bool doRequest();
 43};
 44
 45class LLEnvironmentRequestResponder: public LLHTTPClient::Responder
 46{
 47	LOG_CLASS(LLEnvironmentRequestResponder);
 48public:
 49	virtual void result(const LLSD& content);
 50	virtual void error(U32 status, const std::string& reason);
 51
 52private:
 53	friend class LLEnvironmentRequest;
 54
 55	LLEnvironmentRequestResponder();
 56	static int sCount;
 57	int mID;
 58};
 59
 60class LLEnvironmentApply
 61{
 62	LOG_CLASS(LLEnvironmentApply);
 63public:
 64	/// @return true if request was successfully sent
 65	static bool initiateRequest(const LLSD& content);
 66
 67private:
 68	static clock_t sLastUpdate;
 69	static clock_t UPDATE_WAIT_SECONDS;
 70};
 71
 72class LLEnvironmentApplyResponder: public LLHTTPClient::Responder
 73{
 74	LOG_CLASS(LLEnvironmentApplyResponder);
 75public:
 76	/*
 77	 * Expecting reply from sim in form of:
 78	 * {
 79	 *   regionID : uuid,
 80	 *   messageID: uuid,
 81	 *   success : true
 82	 * }
 83	 * or
 84	 * {
 85	 *   regionID : uuid,
 86	 *   success : false,
 87	 *   fail_reason : string
 88	 * }
 89	 */
 90	virtual void result(const LLSD& content);
 91
 92	virtual void error(U32 status, const std::string& reason); // non-200 errors only
 93
 94private:
 95	friend class LLEnvironmentApply;
 96	
 97	LLEnvironmentApplyResponder() {}
 98};
 99
100#endif // LL_LLWLHANDLERS_H