Bringing back message logger
This commit is contained in:
@@ -49,6 +49,7 @@ set(llmessage_SOURCE_FILES
|
|||||||
llmail.cpp
|
llmail.cpp
|
||||||
llmessagebuilder.cpp
|
llmessagebuilder.cpp
|
||||||
llmessageconfig.cpp
|
llmessageconfig.cpp
|
||||||
|
llmessagelog.cpp
|
||||||
llmessagereader.cpp
|
llmessagereader.cpp
|
||||||
llmessagetemplate.cpp
|
llmessagetemplate.cpp
|
||||||
llmessagetemplateparser.cpp
|
llmessagetemplateparser.cpp
|
||||||
@@ -62,14 +63,11 @@ set(llmessage_SOURCE_FILES
|
|||||||
llpartdata.cpp
|
llpartdata.cpp
|
||||||
llproxy.cpp
|
llproxy.cpp
|
||||||
llpumpio.cpp
|
llpumpio.cpp
|
||||||
llregionpresenceverifier.cpp
|
|
||||||
llsdappservices.cpp
|
llsdappservices.cpp
|
||||||
llsdhttpserver.cpp
|
llsdhttpserver.cpp
|
||||||
llsdmessage.cpp
|
llsdmessage.cpp
|
||||||
llsdmessagebuilder.cpp
|
llsdmessagebuilder.cpp
|
||||||
llsdmessagereader.cpp
|
llsdmessagereader.cpp
|
||||||
llservicebuilder.cpp
|
|
||||||
llservice.cpp
|
|
||||||
llstoredmessage.cpp
|
llstoredmessage.cpp
|
||||||
lltemplatemessagebuilder.cpp
|
lltemplatemessagebuilder.cpp
|
||||||
lltemplatemessagedispatcher.cpp
|
lltemplatemessagedispatcher.cpp
|
||||||
@@ -94,7 +92,6 @@ set(llmessage_SOURCE_FILES
|
|||||||
message_prehash.cpp
|
message_prehash.cpp
|
||||||
message_string_table.cpp
|
message_string_table.cpp
|
||||||
net.cpp
|
net.cpp
|
||||||
partsyspacket.cpp
|
|
||||||
patch_code.cpp
|
patch_code.cpp
|
||||||
patch_dct.cpp
|
patch_dct.cpp
|
||||||
patch_idct.cpp
|
patch_idct.cpp
|
||||||
@@ -145,6 +142,7 @@ set(llmessage_HEADER_FILES
|
|||||||
llmail.h
|
llmail.h
|
||||||
llmessagebuilder.h
|
llmessagebuilder.h
|
||||||
llmessageconfig.h
|
llmessageconfig.h
|
||||||
|
llmessagelog.h
|
||||||
llmessagereader.h
|
llmessagereader.h
|
||||||
llmessagetemplate.h
|
llmessagetemplate.h
|
||||||
llmessagetemplateparser.h
|
llmessagetemplateparser.h
|
||||||
@@ -162,14 +160,11 @@ set(llmessage_HEADER_FILES
|
|||||||
llqueryflags.h
|
llqueryflags.h
|
||||||
llregionflags.h
|
llregionflags.h
|
||||||
llregionhandle.h
|
llregionhandle.h
|
||||||
llregionpresenceverifier.h
|
|
||||||
llsdappservices.h
|
llsdappservices.h
|
||||||
llsdhttpserver.h
|
llsdhttpserver.h
|
||||||
llsdmessage.h
|
llsdmessage.h
|
||||||
llsdmessagebuilder.h
|
llsdmessagebuilder.h
|
||||||
llsdmessagereader.h
|
llsdmessagereader.h
|
||||||
llservice.h
|
|
||||||
llservicebuilder.h
|
|
||||||
llstoredmessage.h
|
llstoredmessage.h
|
||||||
lltaskname.h
|
lltaskname.h
|
||||||
llteleportflags.h
|
llteleportflags.h
|
||||||
@@ -197,7 +192,6 @@ set(llmessage_HEADER_FILES
|
|||||||
message.h
|
message.h
|
||||||
message_prehash.h
|
message_prehash.h
|
||||||
net.h
|
net.h
|
||||||
partsyspacket.h
|
|
||||||
patch_code.h
|
patch_code.h
|
||||||
patch_dct.h
|
patch_dct.h
|
||||||
sound_ids.h
|
sound_ids.h
|
||||||
@@ -232,7 +226,6 @@ if (LL_TESTS)
|
|||||||
llnamevalue.cpp
|
llnamevalue.cpp
|
||||||
lltrustedmessageservice.cpp
|
lltrustedmessageservice.cpp
|
||||||
lltemplatemessagedispatcher.cpp
|
lltemplatemessagedispatcher.cpp
|
||||||
llregionpresenceverifier.cpp
|
|
||||||
)
|
)
|
||||||
LL_ADD_PROJECT_UNIT_TESTS(llmessage "${llmessage_TEST_SOURCE_FILES}")
|
LL_ADD_PROJECT_UNIT_TESTS(llmessage "${llmessage_TEST_SOURCE_FILES}")
|
||||||
|
|
||||||
|
|||||||
@@ -1229,6 +1229,17 @@ void LLCircuit::getCircuitRange(
|
|||||||
first = mCircuitData.upper_bound(key);
|
first = mCircuitData.upper_bound(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// <edit>
|
||||||
|
std::vector<LLCircuitData*> LLCircuit::getCircuitDataList()
|
||||||
|
{
|
||||||
|
std::vector<LLCircuitData*> list;
|
||||||
|
circuit_data_map::iterator end = mCircuitData.end();
|
||||||
|
for(circuit_data_map::iterator iter = mCircuitData.begin(); iter != end; ++iter)
|
||||||
|
list.push_back((*iter).second);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
// </edit>
|
||||||
|
|
||||||
TPACKETID LLCircuitData::nextPacketOutID()
|
TPACKETID LLCircuitData::nextPacketOutID()
|
||||||
{
|
{
|
||||||
mPacketsOut++;
|
mPacketsOut++;
|
||||||
|
|||||||
@@ -328,6 +328,10 @@ public:
|
|||||||
circuit_data_map::iterator& first,
|
circuit_data_map::iterator& first,
|
||||||
circuit_data_map::iterator& end);
|
circuit_data_map::iterator& end);
|
||||||
|
|
||||||
|
// <edit>
|
||||||
|
std::vector<LLCircuitData*> getCircuitDataList();
|
||||||
|
// </edit>
|
||||||
|
|
||||||
// Lists that optimize how many circuits we need to traverse a frame
|
// Lists that optimize how many circuits we need to traverse a frame
|
||||||
// HACK - this should become protected eventually, but stupid !@$@# message system/circuit classes are jumbling things up.
|
// HACK - this should become protected eventually, but stupid !@$@# message system/circuit classes are jumbling things up.
|
||||||
circuit_data_map mUnackedCircuitMap; // Map of circuits with unacked data
|
circuit_data_map mUnackedCircuitMap; // Map of circuits with unacked data
|
||||||
|
|||||||
@@ -173,10 +173,12 @@ public:
|
|||||||
void freeBuffer() { delete [] mBufferp; mBufferp = mCurBufferp = NULL; mBufferSize = 0; mWriteEnabled = FALSE; }
|
void freeBuffer() { delete [] mBufferp; mBufferp = mCurBufferp = NULL; mBufferSize = 0; mWriteEnabled = FALSE; }
|
||||||
void assignBuffer(U8 *bufferp, S32 size)
|
void assignBuffer(U8 *bufferp, S32 size)
|
||||||
{
|
{
|
||||||
if(mBufferp && mBufferp != bufferp)
|
//No no no no no! This breaks the paradigm of callers handling buffer allocation/deallocation
|
||||||
|
//Also, buffers can be on stack! Calling delete[] on such a buffer would be VERY bad.
|
||||||
|
/*if(mBufferp && mBufferp != bufferp)
|
||||||
{
|
{
|
||||||
freeBuffer() ;
|
freeBuffer() ;
|
||||||
}
|
}*/
|
||||||
mBufferp = bufferp;
|
mBufferp = bufferp;
|
||||||
mCurBufferp = bufferp;
|
mCurBufferp = bufferp;
|
||||||
mBufferSize = size;
|
mBufferSize = size;
|
||||||
|
|||||||
@@ -44,6 +44,10 @@
|
|||||||
#include "timing.h"
|
#include "timing.h"
|
||||||
#include "u64.h"
|
#include "u64.h"
|
||||||
|
|
||||||
|
//<edit>
|
||||||
|
#include "llmessagelog.h"
|
||||||
|
//</edit>
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
LLPacketRing::LLPacketRing () :
|
LLPacketRing::LLPacketRing () :
|
||||||
mUseInThrottle(FALSE),
|
mUseInThrottle(FALSE),
|
||||||
@@ -272,7 +276,11 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host)
|
BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host)
|
||||||
{
|
{
|
||||||
|
//<edit>
|
||||||
|
LLMessageLog::log(LLHost(16777343, gMessageSystem->getListenPort()), host, (U8*)send_buffer, buf_size);
|
||||||
|
//</edit>
|
||||||
|
|
||||||
BOOL status = TRUE;
|
BOOL status = TRUE;
|
||||||
if (!mUseOutThrottle)
|
if (!mUseOutThrottle)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,153 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file llregionpresenceverifier.cpp
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
|
|
||||||
* Second Life Viewer Source Code
|
|
||||||
* Copyright (C) 2010, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation;
|
|
||||||
* version 2.1 of the License only.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
|
||||||
* $/LicenseInfo$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "linden_common.h"
|
|
||||||
|
|
||||||
#include "llregionpresenceverifier.h"
|
|
||||||
#include "llhttpclientinterface.h"
|
|
||||||
#include <sstream>
|
|
||||||
#include "net.h"
|
|
||||||
#include "message.h"
|
|
||||||
|
|
||||||
//namespace boost
|
|
||||||
//{
|
|
||||||
void intrusive_ptr_add_ref(LLRegionPresenceVerifier::Response* p)
|
|
||||||
{
|
|
||||||
++p->mReferenceCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
void intrusive_ptr_release(LLRegionPresenceVerifier::Response* p)
|
|
||||||
{
|
|
||||||
if(p && 0 == --p->mReferenceCount)
|
|
||||||
{
|
|
||||||
delete p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//};
|
|
||||||
|
|
||||||
LLRegionPresenceVerifier::Response::~Response()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
LLRegionPresenceVerifier::RegionResponder::RegionResponder(const std::string&
|
|
||||||
uri,
|
|
||||||
ResponsePtr data,
|
|
||||||
S32 retry_count) :
|
|
||||||
mUri(uri),
|
|
||||||
mSharedData(data),
|
|
||||||
mRetryCount(retry_count)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//virtual
|
|
||||||
LLRegionPresenceVerifier::RegionResponder::~RegionResponder()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLRegionPresenceVerifier::RegionResponder::result(const LLSD& content)
|
|
||||||
{
|
|
||||||
std::string host = content["private_host"].asString();
|
|
||||||
U32 port = content["private_port"].asInteger();
|
|
||||||
LLHost destination(host, port);
|
|
||||||
LLUUID id = content["region_id"];
|
|
||||||
|
|
||||||
lldebugs << "Verifying " << destination.getString() << " is region " << id << llendl;
|
|
||||||
|
|
||||||
std::stringstream uri;
|
|
||||||
uri << "http://" << destination.getString() << "/state/basic/";
|
|
||||||
mSharedData->getHttpClient().get(
|
|
||||||
uri.str(),
|
|
||||||
new VerifiedDestinationResponder(mUri, mSharedData, content, mRetryCount));
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLRegionPresenceVerifier::RegionResponder::error(U32 status,
|
|
||||||
const std::string& reason)
|
|
||||||
{
|
|
||||||
// TODO: babbage: distinguish between region presence service and
|
|
||||||
// region verification errors?
|
|
||||||
mSharedData->onRegionVerificationFailed();
|
|
||||||
}
|
|
||||||
|
|
||||||
LLRegionPresenceVerifier::VerifiedDestinationResponder::VerifiedDestinationResponder(const std::string& uri, ResponsePtr data, const LLSD& content,
|
|
||||||
S32 retry_count):
|
|
||||||
mUri(uri),
|
|
||||||
mSharedData(data),
|
|
||||||
mContent(content),
|
|
||||||
mRetryCount(retry_count)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//virtual
|
|
||||||
LLRegionPresenceVerifier::VerifiedDestinationResponder::~VerifiedDestinationResponder()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLRegionPresenceVerifier::VerifiedDestinationResponder::result(const LLSD& content)
|
|
||||||
{
|
|
||||||
LLUUID actual_region_id = content["region_id"];
|
|
||||||
LLUUID expected_region_id = mContent["region_id"];
|
|
||||||
|
|
||||||
lldebugs << "Actual region: " << content << llendl;
|
|
||||||
lldebugs << "Expected region: " << mContent << llendl;
|
|
||||||
|
|
||||||
if (mSharedData->checkValidity(content) &&
|
|
||||||
(actual_region_id == expected_region_id))
|
|
||||||
{
|
|
||||||
mSharedData->onRegionVerified(mContent);
|
|
||||||
}
|
|
||||||
else if (mRetryCount > 0)
|
|
||||||
{
|
|
||||||
retry();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
llwarns << "Simulator verification failed. Region: " << mUri << llendl;
|
|
||||||
mSharedData->onRegionVerificationFailed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLRegionPresenceVerifier::VerifiedDestinationResponder::retry()
|
|
||||||
{
|
|
||||||
LLSD headers;
|
|
||||||
headers["Cache-Control"] = "no-cache, max-age=0";
|
|
||||||
llinfos << "Requesting region information, get uncached for region "
|
|
||||||
<< mUri << llendl;
|
|
||||||
--mRetryCount;
|
|
||||||
mSharedData->getHttpClient().get(mUri, new RegionResponder(mUri, mSharedData, mRetryCount), headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLRegionPresenceVerifier::VerifiedDestinationResponder::error(U32 status, const std::string& reason)
|
|
||||||
{
|
|
||||||
if(mRetryCount > 0)
|
|
||||||
{
|
|
||||||
retry();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
llwarns << "Failed to contact simulator for verification. Region: " << mUri << llendl;
|
|
||||||
mSharedData->onRegionVerificationFailed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file llregionpresenceverifier.cpp
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
|
|
||||||
* Second Life Viewer Source Code
|
|
||||||
* Copyright (C) 2010, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation;
|
|
||||||
* version 2.1 of the License only.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
|
||||||
* $/LicenseInfo$
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Macro Definitions */
|
|
||||||
#ifndef LL_LLREGIONPRESENCEVERIFIER_H
|
|
||||||
#define LL_LLREGIONPRESENCEVERIFIER_H
|
|
||||||
|
|
||||||
#include "llhttpclient.h"
|
|
||||||
#include <string>
|
|
||||||
#include "llsd.h"
|
|
||||||
#include <boost/intrusive_ptr.hpp>
|
|
||||||
|
|
||||||
class LLHTTPClientInterface;
|
|
||||||
|
|
||||||
class LLRegionPresenceVerifier
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
class Response
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual ~Response() = 0;
|
|
||||||
|
|
||||||
virtual bool checkValidity(const LLSD& content) const = 0;
|
|
||||||
virtual void onRegionVerified(const LLSD& region_details) = 0;
|
|
||||||
virtual void onRegionVerificationFailed() = 0;
|
|
||||||
|
|
||||||
virtual LLHTTPClientInterface& getHttpClient() = 0;
|
|
||||||
|
|
||||||
public: /* but not really -- don't touch this */
|
|
||||||
U32 mReferenceCount;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef boost::intrusive_ptr<Response> ResponsePtr;
|
|
||||||
|
|
||||||
class RegionResponder : public LLHTTPClient::Responder
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RegionResponder(const std::string& uri, ResponsePtr data,
|
|
||||||
S32 retry_count);
|
|
||||||
virtual ~RegionResponder();
|
|
||||||
virtual void result(const LLSD& content);
|
|
||||||
virtual void error(U32 status, const std::string& reason);
|
|
||||||
|
|
||||||
private:
|
|
||||||
ResponsePtr mSharedData;
|
|
||||||
std::string mUri;
|
|
||||||
S32 mRetryCount;
|
|
||||||
};
|
|
||||||
|
|
||||||
class VerifiedDestinationResponder : public LLHTTPClient::Responder
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
VerifiedDestinationResponder(const std::string& uri, ResponsePtr data,
|
|
||||||
const LLSD& content, S32 retry_count);
|
|
||||||
virtual ~VerifiedDestinationResponder();
|
|
||||||
virtual void result(const LLSD& content);
|
|
||||||
|
|
||||||
virtual void error(U32 status, const std::string& reason);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void retry();
|
|
||||||
ResponsePtr mSharedData;
|
|
||||||
LLSD mContent;
|
|
||||||
std::string mUri;
|
|
||||||
S32 mRetryCount;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
//namespace boost
|
|
||||||
//{
|
|
||||||
void intrusive_ptr_add_ref(LLRegionPresenceVerifier::Response* p);
|
|
||||||
void intrusive_ptr_release(LLRegionPresenceVerifier::Response* p);
|
|
||||||
//};
|
|
||||||
|
|
||||||
#endif //LL_LLREGIONPRESENCEVERIFIER_H
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file llservice.cpp
|
|
||||||
* @author Phoenix
|
|
||||||
* @date 2005-04-20
|
|
||||||
*
|
|
||||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
|
||||||
* Second Life Viewer Source Code
|
|
||||||
* Copyright (C) 2010, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation;
|
|
||||||
* version 2.1 of the License only.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
|
||||||
* $/LicenseInfo$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "linden_common.h"
|
|
||||||
#include "llservice.h"
|
|
||||||
|
|
||||||
LLService::creators_t LLService::sCreatorFunctors;
|
|
||||||
|
|
||||||
LLService::LLService()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
LLService::~LLService()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
bool LLService::registerCreator(const std::string& name, creator_t fn)
|
|
||||||
{
|
|
||||||
llinfos << "LLService::registerCreator(" << name << ")" << llendl;
|
|
||||||
if(name.empty())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
creators_t::value_type vt(name, fn);
|
|
||||||
std::pair<creators_t::iterator, bool> rv = sCreatorFunctors.insert(vt);
|
|
||||||
return rv.second;
|
|
||||||
|
|
||||||
// alternately...
|
|
||||||
//std::string name_str(name);
|
|
||||||
//sCreatorFunctors[name_str] = fn;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
LLIOPipe* LLService::activate(
|
|
||||||
const std::string& name,
|
|
||||||
LLPumpIO::chain_t& chain,
|
|
||||||
LLSD context)
|
|
||||||
{
|
|
||||||
if(name.empty())
|
|
||||||
{
|
|
||||||
llinfos << "LLService::activate - no service specified." << llendl;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
creators_t::iterator it = sCreatorFunctors.find(name);
|
|
||||||
LLIOPipe* rv = NULL;
|
|
||||||
if(it != sCreatorFunctors.end())
|
|
||||||
{
|
|
||||||
if((*it).second->build(chain, context))
|
|
||||||
{
|
|
||||||
rv = chain[0].get();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// empty out the chain, because failed service creation
|
|
||||||
// should just discard this stuff.
|
|
||||||
llwarns << "LLService::activate - unable to build chain: " << name
|
|
||||||
<< llendl;
|
|
||||||
chain.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
llwarns << "LLService::activate - unable find factory: " << name
|
|
||||||
<< llendl;
|
|
||||||
}
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
bool LLService::discard(const std::string& name)
|
|
||||||
{
|
|
||||||
if(name.empty())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
creators_t::iterator it = sCreatorFunctors.find(name);
|
|
||||||
if(it != sCreatorFunctors.end())
|
|
||||||
{
|
|
||||||
//(*it).second->discard();
|
|
||||||
sCreatorFunctors.erase(it);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,185 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file llservice.h
|
|
||||||
* @author Phoenix
|
|
||||||
* @date 2004-11-21
|
|
||||||
* @brief Declaration file for LLService and related classes.
|
|
||||||
*
|
|
||||||
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
|
|
||||||
* Second Life Viewer Source Code
|
|
||||||
* Copyright (C) 2010, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation;
|
|
||||||
* version 2.1 of the License only.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
|
||||||
* $/LicenseInfo$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef LL_LLSERVICE_H
|
|
||||||
#define LL_LLSERVICE_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <map>
|
|
||||||
//#include <boost/intrusive_ptr.hpp>
|
|
||||||
//#include <boost/shared_ptr.hpp>
|
|
||||||
|
|
||||||
//#include "llframetimer.h"
|
|
||||||
#include "lliopipe.h"
|
|
||||||
#include "llchainio.h"
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
class LLServiceCreator;
|
|
||||||
/**
|
|
||||||
* intrusive pointer support
|
|
||||||
*/
|
|
||||||
namespace boost
|
|
||||||
{
|
|
||||||
void intrusive_ptr_add_ref(LLServiceCreator* p);
|
|
||||||
void intrusive_ptr_release(LLServiceCreator* p);
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @class LLServiceCreator
|
|
||||||
* @brief This class is an abstract base class for classes which create
|
|
||||||
* new <code>LLService</code> instances.
|
|
||||||
*
|
|
||||||
* Derive classes from this class which appropriately implement the
|
|
||||||
* <code>operator()</code> and destructor.
|
|
||||||
* @see LLService
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
class LLServiceCreator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef boost::intrusive_ptr<LLService> service_t;
|
|
||||||
virtual ~LLServiceCreator() {}
|
|
||||||
virtual service_t activate() = 0;
|
|
||||||
virtual void discard() = 0;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
LLServiceCreator() : mReferenceCount(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend void boost::intrusive_ptr_add_ref(LLServiceCreator* p);
|
|
||||||
friend void boost::intrusive_ptr_release(LLServiceCreator* p);
|
|
||||||
U32 mReferenceCount;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
namespace boost
|
|
||||||
{
|
|
||||||
inline void intrusive_ptr_add_ref(LLServiceCreator* p)
|
|
||||||
{
|
|
||||||
++p->mReferenceCount;
|
|
||||||
}
|
|
||||||
inline void intrusive_ptr_release(LLServiceCreator* p)
|
|
||||||
{
|
|
||||||
if(p && 0 == --p->mReferenceCount)
|
|
||||||
{
|
|
||||||
delete p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @class LLService
|
|
||||||
* @brief This class is the base class for the service classes.
|
|
||||||
* @see LLIOPipe
|
|
||||||
*
|
|
||||||
* The services map a string to a chain factory with a known interface
|
|
||||||
* at the front of the chain. So, to activate a service, call
|
|
||||||
* <code>activate()</code> with the name of the service needed which
|
|
||||||
* will call the associated factory, and return a pointer to the
|
|
||||||
* known interface.
|
|
||||||
* <b>NOTE:</b> If you are implementing a service factory, it is
|
|
||||||
* vitally important that the service pipe is at the front of the
|
|
||||||
* chain.
|
|
||||||
*/
|
|
||||||
class LLService : public LLIOPipe
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
//typedef boost::intrusive_ptr<LLServiceCreator> creator_t;
|
|
||||||
//typedef boost::intrusive_ptr<LLService> service_t;
|
|
||||||
typedef boost::shared_ptr<LLChainIOFactory> creator_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This method is used to register a protocol name with a
|
|
||||||
* a functor that creates the service.
|
|
||||||
*
|
|
||||||
* THOROUGH_DESCRIPTION
|
|
||||||
* @param aParameter A brief description of aParameter.
|
|
||||||
* @return Returns true if a service was successfully registered.
|
|
||||||
*/
|
|
||||||
static bool registerCreator(const std::string& name, creator_t fn);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This method connects to a service by name.
|
|
||||||
*
|
|
||||||
* @param name The name of the service to connect to.
|
|
||||||
* @param chain The constructed chain including the service instance.
|
|
||||||
* @param context Context for the activation.
|
|
||||||
* @return An instance of the service for use or NULL on failure.
|
|
||||||
*/
|
|
||||||
static LLIOPipe* activate(
|
|
||||||
const std::string& name,
|
|
||||||
LLPumpIO::chain_t& chain,
|
|
||||||
LLSD context);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param name The name of the service to discard.
|
|
||||||
* @return true if service creator was found and discarded.
|
|
||||||
*/
|
|
||||||
static bool discard(const std::string& name);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
// The creation factory static data.
|
|
||||||
typedef std::map<std::string, creator_t> creators_t;
|
|
||||||
static creators_t sCreatorFunctors;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
// construction & destruction. since this class is an abstract
|
|
||||||
// base class, it is up to Service implementations to actually
|
|
||||||
// deal with construction and not a public method. How that
|
|
||||||
// construction takes place will be handled by the service
|
|
||||||
// creators.
|
|
||||||
LLService();
|
|
||||||
virtual ~LLService();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
// This frame timer records how long this service has
|
|
||||||
// existed. Useful for derived services to give themselves a
|
|
||||||
// lifetime and expiration.
|
|
||||||
// *NOTE: Phoenix - This functionaity has been moved to the
|
|
||||||
// pump. 2005-12-13
|
|
||||||
//LLFrameTimer mTimer;
|
|
||||||
|
|
||||||
// Since services are designed in an 'ask now, respond later'
|
|
||||||
// idiom which probably crosses thread boundaries, almost all
|
|
||||||
// services will need a handle to a response pipe. It will usually
|
|
||||||
// be the job of the service author to derive a useful
|
|
||||||
// implementation of response, and up to the service subscriber to
|
|
||||||
// further derive that class to do something useful when the
|
|
||||||
// response comes in.
|
|
||||||
LLIOPipe::ptr_t mResponse;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // LL_LLSERVICE_H
|
|
||||||
@@ -1,236 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file llservicebuilder.cpp
|
|
||||||
* @brief Implementation of the LLServiceBuilder class.
|
|
||||||
*
|
|
||||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
|
||||||
* Second Life Viewer Source Code
|
|
||||||
* Copyright (C) 2010, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation;
|
|
||||||
* version 2.1 of the License only.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
|
||||||
* $/LicenseInfo$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "linden_common.h"
|
|
||||||
#include "llapp.h"
|
|
||||||
#include "llfile.h"
|
|
||||||
#include "llservicebuilder.h"
|
|
||||||
#include "llsd.h"
|
|
||||||
#include "llsdserialize.h"
|
|
||||||
|
|
||||||
void LLServiceBuilder::loadServiceDefinitionsFromFile(
|
|
||||||
const std::string& service_filename)
|
|
||||||
{
|
|
||||||
llifstream service_file(service_filename, std::ios::binary);
|
|
||||||
if(service_file.is_open())
|
|
||||||
{
|
|
||||||
LLSD service_data;
|
|
||||||
LLSDSerialize::fromXMLDocument(service_data, service_file);
|
|
||||||
service_file.close();
|
|
||||||
// Load service
|
|
||||||
LLSD service_map = service_data["services"];
|
|
||||||
for(LLSD::array_iterator array_itr = service_map.beginArray();
|
|
||||||
array_itr != service_map.endArray();
|
|
||||||
++array_itr)
|
|
||||||
{
|
|
||||||
LLSD service_llsd = (*array_itr)["service-builder"];
|
|
||||||
std::string service_name = (*array_itr)["name"].asString();
|
|
||||||
createServiceDefinition(service_name, service_llsd);
|
|
||||||
}
|
|
||||||
llinfos << "loaded config file: " << service_filename << llendl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
llwarns << "unable to find config file: " << service_filename << llendl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLServiceBuilder::createServiceDefinition(
|
|
||||||
const std::string& service_name,
|
|
||||||
LLSD& service_llsd)
|
|
||||||
{
|
|
||||||
if(service_llsd.isString())
|
|
||||||
{
|
|
||||||
mServiceMap[ service_name ] = service_llsd.asString();
|
|
||||||
}
|
|
||||||
else if(service_llsd.isMap())
|
|
||||||
{
|
|
||||||
for(LLSD::map_iterator map_itr = service_llsd.beginMap();
|
|
||||||
map_itr != service_llsd.endMap();
|
|
||||||
++map_itr)
|
|
||||||
{
|
|
||||||
std::string compound_builder_name = service_name;
|
|
||||||
compound_builder_name.append("-");
|
|
||||||
compound_builder_name.append((*map_itr).first);
|
|
||||||
mServiceMap[ compound_builder_name ] = (*map_itr).second.asString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
bool starts_with(const std::string& text, const char* prefix)
|
|
||||||
{
|
|
||||||
return text.substr(0, strlen(prefix)) == prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Build a real services.xml for windows development.
|
|
||||||
// and remove the base_url logic below.
|
|
||||||
std::string LLServiceBuilder::buildServiceURI(const std::string& service_name) const
|
|
||||||
{
|
|
||||||
std::ostringstream service_url;
|
|
||||||
// Find the service builder
|
|
||||||
std::map<std::string, std::string>::const_iterator it =
|
|
||||||
mServiceMap.find(service_name);
|
|
||||||
if(it != mServiceMap.end())
|
|
||||||
{
|
|
||||||
// construct the service builder url
|
|
||||||
LLApp* app = LLApp::instance();
|
|
||||||
if(app)
|
|
||||||
{
|
|
||||||
// We define a base-url for some development configurations
|
|
||||||
// In production neither of these are defined and all services have full urls
|
|
||||||
LLSD base_url;
|
|
||||||
|
|
||||||
if (starts_with(service_name,"cap"))
|
|
||||||
{
|
|
||||||
base_url = app->getOption("cap-base-url");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (base_url.asString().empty())
|
|
||||||
{
|
|
||||||
base_url = app->getOption("services-base-url");
|
|
||||||
}
|
|
||||||
service_url << base_url.asString();
|
|
||||||
}
|
|
||||||
service_url << it->second;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
llwarns << "Cannot find service " << service_name << llendl;
|
|
||||||
}
|
|
||||||
return service_url.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string LLServiceBuilder::buildServiceURI(
|
|
||||||
const std::string& service_name,
|
|
||||||
const LLSD& option_map) const
|
|
||||||
{
|
|
||||||
return russ_format(buildServiceURI(service_name), option_map);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string russ_format(const std::string& format_str, const LLSD& context)
|
|
||||||
{
|
|
||||||
std::string service_url(format_str);
|
|
||||||
if(!service_url.empty() && context.isMap())
|
|
||||||
{
|
|
||||||
// throw in a ridiculously large limiter to make sure we don't
|
|
||||||
// loop forever with bad input.
|
|
||||||
int iterations = 100;
|
|
||||||
bool keep_looping = true;
|
|
||||||
while(keep_looping)
|
|
||||||
{
|
|
||||||
if(0 == --iterations)
|
|
||||||
{
|
|
||||||
keep_looping = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int depth = 0;
|
|
||||||
int deepest = 0;
|
|
||||||
bool find_match = false;
|
|
||||||
std::string::iterator iter(service_url.begin());
|
|
||||||
std::string::iterator end(service_url.end());
|
|
||||||
std::string::iterator deepest_node(service_url.end());
|
|
||||||
std::string::iterator deepest_node_end(service_url.end());
|
|
||||||
// parse out the variables to replace by going through {}s
|
|
||||||
// one at a time, starting with the "deepest" in series
|
|
||||||
// {{}}, and otherwise replacing right-to-left
|
|
||||||
for(; iter != end; ++iter)
|
|
||||||
{
|
|
||||||
switch(*iter)
|
|
||||||
{
|
|
||||||
case '{':
|
|
||||||
++depth;
|
|
||||||
if(depth > deepest)
|
|
||||||
{
|
|
||||||
deepest = depth;
|
|
||||||
deepest_node = iter;
|
|
||||||
find_match = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case '}':
|
|
||||||
--depth;
|
|
||||||
if(find_match)
|
|
||||||
{
|
|
||||||
deepest_node_end = iter;
|
|
||||||
find_match = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if((deepest_node == end) || (deepest_node_end == end))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//replace the variable we found in the {} above.
|
|
||||||
// *NOTE: since the c++ implementation only understands
|
|
||||||
// params and straight string substitution, so it's a
|
|
||||||
// known distance of 2 to skip the directive.
|
|
||||||
std::string key(deepest_node + 2, deepest_node_end);
|
|
||||||
LLSD value = context[key];
|
|
||||||
switch(*(deepest_node + 1))
|
|
||||||
{
|
|
||||||
case '$':
|
|
||||||
if(value.isDefined())
|
|
||||||
{
|
|
||||||
service_url.replace(
|
|
||||||
deepest_node,
|
|
||||||
deepest_node_end + 1,
|
|
||||||
value.asString());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
llwarns << "Unknown key: " << key << " in option map: "
|
|
||||||
<< LLSDOStreamer<LLSDNotationFormatter>(context)
|
|
||||||
<< llendl;
|
|
||||||
keep_looping = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case '%':
|
|
||||||
{
|
|
||||||
std::string query_str = LLURI::mapToQueryString(value);
|
|
||||||
service_url.replace(
|
|
||||||
deepest_node,
|
|
||||||
deepest_node_end + 1,
|
|
||||||
query_str);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
llinfos << "Unknown directive: " << *(deepest_node + 1)
|
|
||||||
<< llendl;
|
|
||||||
keep_looping = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (service_url.find('{') != std::string::npos)
|
|
||||||
{
|
|
||||||
llwarns << "Constructed a likely bogus service URL: " << service_url
|
|
||||||
<< llendl;
|
|
||||||
}
|
|
||||||
return service_url;
|
|
||||||
}
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file llservicebuilder.h
|
|
||||||
* @brief Declaration of the LLServiceBuilder class.
|
|
||||||
*
|
|
||||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
|
||||||
* Second Life Viewer Source Code
|
|
||||||
* Copyright (C) 2010, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation;
|
|
||||||
* version 2.1 of the License only.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
|
||||||
* $/LicenseInfo$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef LLSERVICEBUILDER_H
|
|
||||||
#define LLSERVICEBUILDER_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <map>
|
|
||||||
#include "llerror.h"
|
|
||||||
|
|
||||||
class LLSD;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Format format string according to rules for RUSS.
|
|
||||||
*
|
|
||||||
* This function appears alongside the service builder since the
|
|
||||||
* algorithm was originally implemented there. This can eventually be
|
|
||||||
* moved when someone wants to take the time.
|
|
||||||
* @see https://osiris.lindenlab.com/mediawiki/index.php/Recursive_URL_Substitution_Syntax
|
|
||||||
* @param format_str The input string to format.
|
|
||||||
* @param context A map used for string substitutions.
|
|
||||||
* @return Returns the formatted string. If no match is found for a
|
|
||||||
* substitution target, the braces remain intact.
|
|
||||||
*/
|
|
||||||
std::string russ_format(const std::string& format_str, const LLSD& context);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @class LLServiceBuilder
|
|
||||||
* @brief This class builds urls for us to use when making web service calls.
|
|
||||||
*/
|
|
||||||
class LLServiceBuilder
|
|
||||||
{
|
|
||||||
LOG_CLASS(LLServiceBuilder);
|
|
||||||
public:
|
|
||||||
LLServiceBuilder(void) {}
|
|
||||||
~LLServiceBuilder(void) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize this object with the service definitions.
|
|
||||||
*
|
|
||||||
* @param service_filename The services definition files -- services.xml.
|
|
||||||
*/
|
|
||||||
void loadServiceDefinitionsFromFile(const std::string& service_filename);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Build a service url if the url needs no construction parameters.
|
|
||||||
*
|
|
||||||
* @param service_name The name of the service you want to call.
|
|
||||||
*/
|
|
||||||
std::string buildServiceURI(const std::string& service_name) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Build a service url if the url with construction parameters.
|
|
||||||
*
|
|
||||||
* The parameter substitution supports string substituition from RUSS:
|
|
||||||
* [[Recursive_URL_Substitution_Syntax]]
|
|
||||||
* @param service_name The name of the service you want to call.
|
|
||||||
* @param option_map The parameters in a map of name:value for the service.
|
|
||||||
*/
|
|
||||||
std::string buildServiceURI(
|
|
||||||
const std::string& service_name,
|
|
||||||
const LLSD& option_map) const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Helper method which builds construction state for a service
|
|
||||||
*
|
|
||||||
* This method should probably be protected, but we need to test this
|
|
||||||
* method.
|
|
||||||
*/
|
|
||||||
void createServiceDefinition(
|
|
||||||
const std::string& service_name,
|
|
||||||
LLSD& service_url);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
std::map<std::string, std::string> mServiceMap;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -443,7 +443,7 @@ S32 LLTemplateMessageReader::getMessageSize() const
|
|||||||
// Returns template for the message contained in buffer
|
// Returns template for the message contained in buffer
|
||||||
BOOL LLTemplateMessageReader::decodeTemplate(
|
BOOL LLTemplateMessageReader::decodeTemplate(
|
||||||
const U8* buffer, S32 buffer_size, // inputs
|
const U8* buffer, S32 buffer_size, // inputs
|
||||||
LLMessageTemplate** msg_template ) // outputs
|
LLMessageTemplate** msg_template, bool custom ) // outputs
|
||||||
{
|
{
|
||||||
const U8* header = buffer + LL_PACKET_ID_SIZE;
|
const U8* header = buffer + LL_PACKET_ID_SIZE;
|
||||||
|
|
||||||
@@ -485,8 +485,9 @@ BOOL LLTemplateMessageReader::decodeTemplate(
|
|||||||
}
|
}
|
||||||
else // bogus packet received (too short)
|
else // bogus packet received (too short)
|
||||||
{
|
{
|
||||||
llwarns << "Packet with unusable length received (too short): "
|
if(!custom)
|
||||||
<< buffer_size << llendl;
|
llwarns << "Packet with unusable length received (too short): "
|
||||||
|
<< buffer_size << llendl;
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,9 +498,11 @@ BOOL LLTemplateMessageReader::decodeTemplate(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
llwarns << "Message #" << std::hex << num << std::dec
|
if(!custom) {
|
||||||
<< " received but not registered!" << llendl;
|
llwarns << "Message #" << std::hex << num << std::dec
|
||||||
gMessageSystem->callExceptionFunc(MX_UNREGISTERED_MESSAGE);
|
<< " received but not registered!" << llendl;
|
||||||
|
gMessageSystem->callExceptionFunc(MX_UNREGISTERED_MESSAGE);
|
||||||
|
}
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,7 +531,7 @@ void LLTemplateMessageReader::logRanOffEndOfPacket( const LLHost& host, const S3
|
|||||||
static LLFastTimer::DeclareTimer FTM_PROCESS_MESSAGES("Process Messages");
|
static LLFastTimer::DeclareTimer FTM_PROCESS_MESSAGES("Process Messages");
|
||||||
|
|
||||||
// decode a given message
|
// decode a given message
|
||||||
BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender )
|
BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender, bool custom)
|
||||||
{
|
{
|
||||||
llassert( mReceiveSize >= 0 );
|
llassert( mReceiveSize >= 0 );
|
||||||
llassert( mCurrentRMessageTemplate);
|
llassert( mCurrentRMessageTemplate);
|
||||||
@@ -586,7 +589,8 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
llerrs << "Unknown block type" << llendl;
|
if(!custom)
|
||||||
|
llerrs << "Unknown block type" << llendl;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,7 +636,8 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender
|
|||||||
|
|
||||||
if ((decode_pos + data_size) > mReceiveSize)
|
if ((decode_pos + data_size) > mReceiveSize)
|
||||||
{
|
{
|
||||||
logRanOffEndOfPacket(sender, decode_pos, data_size);
|
if (!custom)
|
||||||
|
logRanOffEndOfPacket(sender, decode_pos, data_size);
|
||||||
|
|
||||||
// default to 0 length variable blocks
|
// default to 0 length variable blocks
|
||||||
tsize = 0;
|
tsize = 0;
|
||||||
@@ -668,7 +673,8 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender
|
|||||||
// so, copy data pointer and set data size to fixed size
|
// so, copy data pointer and set data size to fixed size
|
||||||
if ((decode_pos + mvci.getSize()) > mReceiveSize)
|
if ((decode_pos + mvci.getSize()) > mReceiveSize)
|
||||||
{
|
{
|
||||||
logRanOffEndOfPacket(sender, decode_pos, mvci.getSize());
|
if(!custom)
|
||||||
|
logRanOffEndOfPacket(sender, decode_pos, mvci.getSize());
|
||||||
|
|
||||||
// default to 0s.
|
// default to 0s.
|
||||||
U32 size = mvci.getSize();
|
U32 size = mvci.getSize();
|
||||||
@@ -696,6 +702,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!custom)
|
||||||
{
|
{
|
||||||
static LLTimer decode_timer;
|
static LLTimer decode_timer;
|
||||||
|
|
||||||
@@ -751,11 +758,11 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender
|
|||||||
BOOL LLTemplateMessageReader::validateMessage(const U8* buffer,
|
BOOL LLTemplateMessageReader::validateMessage(const U8* buffer,
|
||||||
S32 buffer_size,
|
S32 buffer_size,
|
||||||
const LLHost& sender,
|
const LLHost& sender,
|
||||||
bool trusted)
|
bool trusted, bool custom)
|
||||||
{
|
{
|
||||||
mReceiveSize = buffer_size;
|
mReceiveSize = buffer_size;
|
||||||
BOOL valid = decodeTemplate(buffer, buffer_size, &mCurrentRMessageTemplate );
|
BOOL valid = decodeTemplate(buffer, buffer_size, &mCurrentRMessageTemplate, custom);
|
||||||
if(valid)
|
if(valid && !custom)
|
||||||
{
|
{
|
||||||
mCurrentRMessageTemplate->mReceiveCount++;
|
mCurrentRMessageTemplate->mReceiveCount++;
|
||||||
//lldebugs << "MessageRecvd:"
|
//lldebugs << "MessageRecvd:"
|
||||||
@@ -787,7 +794,7 @@ BOOL LLTemplateMessageReader::validateMessage(const U8* buffer,
|
|||||||
BOOL LLTemplateMessageReader::readMessage(const U8* buffer,
|
BOOL LLTemplateMessageReader::readMessage(const U8* buffer,
|
||||||
const LLHost& sender)
|
const LLHost& sender)
|
||||||
{
|
{
|
||||||
return decodeData(buffer, sender);
|
return decodeData(buffer, sender, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//virtual
|
//virtual
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public:
|
|||||||
virtual void copyToBuilder(LLMessageBuilder&) const;
|
virtual void copyToBuilder(LLMessageBuilder&) const;
|
||||||
|
|
||||||
BOOL validateMessage(const U8* buffer, S32 buffer_size,
|
BOOL validateMessage(const U8* buffer, S32 buffer_size,
|
||||||
const LLHost& sender, bool trusted = false);
|
const LLHost& sender, bool trusted = false, bool custom = false);
|
||||||
BOOL readMessage(const U8* buffer, const LLHost& sender);
|
BOOL readMessage(const U8* buffer, const LLHost& sender);
|
||||||
|
|
||||||
bool isTrusted() const;
|
bool isTrusted() const;
|
||||||
@@ -112,16 +112,18 @@ private:
|
|||||||
S32 size = 0, S32 blocknum = 0, S32 max_size = S32_MAX);
|
S32 size = 0, S32 blocknum = 0, S32 max_size = S32_MAX);
|
||||||
|
|
||||||
BOOL decodeTemplate(const U8* buffer, S32 buffer_size, // inputs
|
BOOL decodeTemplate(const U8* buffer, S32 buffer_size, // inputs
|
||||||
LLMessageTemplate** msg_template ); // outputs
|
LLMessageTemplate** msg_template, // outputs
|
||||||
|
bool custom = false);
|
||||||
|
|
||||||
void logRanOffEndOfPacket( const LLHost& host, const S32 where, const S32 wanted );
|
void logRanOffEndOfPacket( const LLHost& host, const S32 where, const S32 wanted );
|
||||||
|
|
||||||
BOOL decodeData(const U8* buffer, const LLHost& sender );
|
BOOL decodeData(const U8* buffer, const LLHost& sender, bool custom);
|
||||||
|
|
||||||
S32 mReceiveSize;
|
S32 mReceiveSize;
|
||||||
LLMessageTemplate* mCurrentRMessageTemplate;
|
LLMessageTemplate* mCurrentRMessageTemplate;
|
||||||
LLMsgData* mCurrentRMessageData;
|
LLMsgData* mCurrentRMessageData;
|
||||||
message_template_number_map_t& mMessageNumbers;
|
message_template_number_map_t& mMessageNumbers;
|
||||||
|
friend class LLFloaterMessageLogItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_LLTEMPLATEMESSAGEREADER_H
|
#endif // LL_LLTEMPLATEMESSAGEREADER_H
|
||||||
|
|||||||
@@ -552,11 +552,11 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
|
|||||||
S32 true_rcv_size = 0;
|
S32 true_rcv_size = 0;
|
||||||
|
|
||||||
U8* buffer = mTrueReceiveBuffer;
|
U8* buffer = mTrueReceiveBuffer;
|
||||||
|
|
||||||
mTrueReceiveSize = mPacketRing->receivePacket(mSocket, (char *)mTrueReceiveBuffer);
|
mTrueReceiveSize = mPacketRing->receivePacket(mSocket, (char *)mTrueReceiveBuffer);
|
||||||
// If you want to dump all received packets into SecondLife.log, uncomment this
|
// If you want to dump all received packets into SecondLife.log, uncomment this
|
||||||
//dumpPacketToLog();
|
//dumpPacketToLog();
|
||||||
|
|
||||||
receive_size = mTrueReceiveSize;
|
receive_size = mTrueReceiveSize;
|
||||||
mLastSender = mPacketRing->getLastSender();
|
mLastSender = mPacketRing->getLastSender();
|
||||||
mLastReceivingIF = mPacketRing->getLastReceivingInterface();
|
mLastReceivingIF = mPacketRing->getLastReceivingInterface();
|
||||||
|
|||||||
@@ -233,6 +233,8 @@ class LLMessageSystem : public LLMessageSenderInterface
|
|||||||
private:
|
private:
|
||||||
message_template_name_map_t mMessageTemplates;
|
message_template_name_map_t mMessageTemplates;
|
||||||
message_template_number_map_t mMessageNumbers;
|
message_template_number_map_t mMessageNumbers;
|
||||||
|
friend class LLFloaterMessageLogItem;
|
||||||
|
friend class LLFloaterMessageLog;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
S32 mSystemVersionMajor;
|
S32 mSystemVersionMajor;
|
||||||
@@ -341,7 +343,7 @@ public:
|
|||||||
bool addCircuitCode(U32 code, const LLUUID& session_id);
|
bool addCircuitCode(U32 code, const LLUUID& session_id);
|
||||||
|
|
||||||
BOOL poll(F32 seconds); // Number of seconds that we want to block waiting for data, returns if data was received
|
BOOL poll(F32 seconds); // Number of seconds that we want to block waiting for data, returns if data was received
|
||||||
BOOL checkMessages( S64 frame_count = 0 );
|
BOOL checkMessages(S64 frame_count = 0);
|
||||||
void processAcks();
|
void processAcks();
|
||||||
|
|
||||||
BOOL isMessageFast(const char *msg);
|
BOOL isMessageFast(const char *msg);
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ set(viewer_SOURCE_FILES
|
|||||||
llfloatermap.cpp
|
llfloatermap.cpp
|
||||||
llfloatermediabrowser.cpp
|
llfloatermediabrowser.cpp
|
||||||
llfloatermemleak.cpp
|
llfloatermemleak.cpp
|
||||||
|
llfloatermessagelog.cpp
|
||||||
llfloatermodeluploadbase.cpp
|
llfloatermodeluploadbase.cpp
|
||||||
llfloatermute.cpp
|
llfloatermute.cpp
|
||||||
llfloaternamedesc.cpp
|
llfloaternamedesc.cpp
|
||||||
@@ -719,6 +720,7 @@ set(viewer_HEADER_FILES
|
|||||||
llfloatermap.h
|
llfloatermap.h
|
||||||
llfloatermediabrowser.h
|
llfloatermediabrowser.h
|
||||||
llfloatermemleak.h
|
llfloatermemleak.h
|
||||||
|
llfloatermessagelog.h
|
||||||
llfloatermodeluploadbase.h
|
llfloatermodeluploadbase.h
|
||||||
llfloatermute.h
|
llfloatermute.h
|
||||||
llfloaternamedesc.h
|
llfloaternamedesc.h
|
||||||
|
|||||||
@@ -249,6 +249,7 @@
|
|||||||
#include "hgfloatertexteditor.h"
|
#include "hgfloatertexteditor.h"
|
||||||
#include "llfloatervfs.h"
|
#include "llfloatervfs.h"
|
||||||
#include "llfloatervfsexplorer.h"
|
#include "llfloatervfsexplorer.h"
|
||||||
|
#include "llfloatermessagelog.h"
|
||||||
#include "shfloatermediaticker.h"
|
#include "shfloatermediaticker.h"
|
||||||
#include "llpacketring.h"
|
#include "llpacketring.h"
|
||||||
// </edit>
|
// </edit>
|
||||||
@@ -489,7 +490,7 @@ void handle_force_ground_sit(void*);
|
|||||||
void handle_phantom_avatar(void*);
|
void handle_phantom_avatar(void*);
|
||||||
void handle_hide_typing_notification(void*);
|
void handle_hide_typing_notification(void*);
|
||||||
void handle_close_all_notifications(void*);
|
void handle_close_all_notifications(void*);
|
||||||
//void handle_open_message_log(void*);
|
void handle_open_message_log(void*);
|
||||||
void handle_edit_ao(void*);
|
void handle_edit_ao(void*);
|
||||||
void handle_local_assets(void*);
|
void handle_local_assets(void*);
|
||||||
void handle_vfs_explorer(void*);
|
void handle_vfs_explorer(void*);
|
||||||
@@ -818,7 +819,6 @@ void init_menus()
|
|||||||
(void*)"ReSit"));
|
(void*)"ReSit"));
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addChild(new LLMenuItemCallGL( "Object Area Search", &handle_area_search, NULL));
|
menu->addChild(new LLMenuItemCallGL( "Object Area Search", &handle_area_search, NULL));
|
||||||
//menu->addChild(new LLMenuItemCallGL( "Message Log", &handle_open_message_log, NULL));
|
|
||||||
|
|
||||||
menu->addChild(new LLMenuItemCallGL( "Sound Explorer",
|
menu->addChild(new LLMenuItemCallGL( "Sound Explorer",
|
||||||
&handle_sounds_explorer, NULL));
|
&handle_sounds_explorer, NULL));
|
||||||
@@ -1089,6 +1089,8 @@ void init_client_menu(LLMenuGL* menu)
|
|||||||
sub = new LLMenuGL("Network");
|
sub = new LLMenuGL("Network");
|
||||||
sub->setCanTearOff(TRUE);
|
sub->setCanTearOff(TRUE);
|
||||||
|
|
||||||
|
sub->addChild(new LLMenuItemCallGL( "Message Log", &handle_open_message_log, NULL));
|
||||||
|
|
||||||
sub->addChild(new LLMenuItemCallGL("Enable Message Log",
|
sub->addChild(new LLMenuItemCallGL("Enable Message Log",
|
||||||
&handle_viewer_enable_message_log, NULL));
|
&handle_viewer_enable_message_log, NULL));
|
||||||
sub->addChild(new LLMenuItemCallGL("Disable Message Log",
|
sub->addChild(new LLMenuItemCallGL("Disable Message Log",
|
||||||
@@ -3657,10 +3659,10 @@ void process_grant_godlike_powers(LLMessageSystem* msg, void**)
|
|||||||
|
|
||||||
// <edit>
|
// <edit>
|
||||||
|
|
||||||
/*void handle_open_message_log(void*)
|
void handle_open_message_log(void*)
|
||||||
{
|
{
|
||||||
LLFloaterMessageLog::show();
|
LLFloaterMessageLog::show();
|
||||||
}*/
|
}
|
||||||
|
|
||||||
void handle_edit_ao(void*)
|
void handle_edit_ao(void*)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -175,7 +175,6 @@
|
|||||||
#include "message_prehash.h"
|
#include "message_prehash.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
//#include "network.h"
|
//#include "network.h"
|
||||||
#include "partsyspacket.h"
|
|
||||||
#include "patch_code.h"
|
#include "patch_code.h"
|
||||||
#include "patch_dct.h"
|
#include "patch_dct.h"
|
||||||
#include "sound_ids.h"
|
#include "sound_ids.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user