diff options
author | Tess Chu <tess@lindenlab.com> | 2007-07-11 21:29:02 +0000 |
---|---|---|
committer | Tess Chu <tess@lindenlab.com> | 2007-07-11 21:29:02 +0000 |
commit | 57b8fef824b6d7f37c5be5812ebffa39ab2e8093 (patch) | |
tree | f89014544fc276b283a36eb2e0cb52e93806a44a /indra | |
parent | a6769f262ff910949a7e1c81cf98e52ddfc2d44a (diff) |
svn merge --ignore-ancestry svn+ssh://svn/svn/linden/release@65088 svn+ssh://svn/svn/linden/branches/release-candidate@65078 -> release Paired by Tess and rdw.
Diffstat (limited to 'indra')
81 files changed, 6382 insertions, 3183 deletions
diff --git a/indra/lib/python/indra/__init__.py b/indra/lib/python/indra/__init__.py index 8f5987696c..7db53666e8 100644 --- a/indra/lib/python/indra/__init__.py +++ b/indra/lib/python/indra/__init__.py @@ -1,6 +1,5 @@ -"""@file __init__.py -@brief - -Copyright (c) 2006-$CurrentYear$, Linden Research, Inc. -$License$ -""" +# @file __init__.py +# @brief Initialization file for the indra module. +# +# Copyright (c) 2006-$CurrentYear$, Linden Research, Inc. +# $License$ diff --git a/indra/llcommon/lldarray.h b/indra/llcommon/lldarray.h index c8b5b7fb14..2ebca78c98 100644 --- a/indra/llcommon/lldarray.h +++ b/indra/llcommon/lldarray.h @@ -169,16 +169,17 @@ public: void reset() { mVector.resize(0); mIndexMap.resize(0); } bool empty() const { return mVector.empty(); } - size_type size() const { return mVector.empty(); } + size_type size() const { return mVector.size(); } Type& operator[](const Key& k) { - typename std::map<Key, U32>::iterator iter = mIndexMap.find(k); + typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); if (iter == mIndexMap.end()) { U32 n = mVector.size(); mIndexMap[k] = n; mVector.resize(n+1); + llassert(mVector.size() == mIndexMap.size()); return mVector[n]; } else @@ -186,7 +187,19 @@ public: return mVector[iter->second]; } } - + + const_iterator find(const Key& k) const + { + typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); + if(iter == mIndexMap.end()) + { + return mVector.end(); + } + else + { + return mVector.begin() + iter->second; + } + } }; #endif diff --git a/indra/llcommon/llstreamtools.h b/indra/llcommon/llstreamtools.h index e4099aac57..3a3ce5d7b1 100644 --- a/indra/llcommon/llstreamtools.h +++ b/indra/llcommon/llstreamtools.h @@ -40,11 +40,13 @@ bool skip_to_end_of_next_keyword(const char* keyword, std::istream& input_stream //bool skip_to_start_of_next_keyword(const char* keyword, std::istream& input_stream); // characters are pulled out of input_stream and appended to output_string +// returns result of input_stream.good() after characters are pulled bool get_word(std::string& output_string, std::istream& input_stream); bool get_line(std::string& output_string, std::istream& input_stream); // characters are pulled out of input_stream (up to a max of 'n') // and appended to output_string +// returns result of input_stream.good() after characters are pulled bool get_word(std::string& output_string, std::istream& input_stream, int n); bool get_line(std::string& output_string, std::istream& input_stream, int n); diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 3c798b25aa..c958e08415 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -1054,9 +1054,6 @@ BOOL LLStringBase<T>::isHead( const std::basic_string<T>& string, const T* s ) template<class T> BOOL LLStringBase<T>::read(std::basic_string<T>& string, const char* filename) /*Flawfinder: ignore*/ { -#ifdef LL_LINUX - printf("STUBBED: LLStringBase<T>::read at %s:%d\n", __FILE__, __LINE__); -#else llifstream ifs(filename, llifstream::binary); if (!ifs.is_open()) { @@ -1071,7 +1068,6 @@ BOOL LLStringBase<T>::read(std::basic_string<T>& string, const char* filename) string = oss.str(); ifs.close(); -#endif return TRUE; } diff --git a/indra/llmath/llv4math.h b/indra/llmath/llv4math.h index f064b39947..65d3aa5b71 100644 --- a/indra/llmath/llv4math.h +++ b/indra/llmath/llv4math.h @@ -1,5 +1,5 @@ /** - * @file llviewerjointmesh.cpp + * @file llv4math.h * @brief LLV4* class header file - vector processor enabled math * * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. @@ -65,10 +65,18 @@ typedef float V4F32 __attribute__((vector_size(16))); //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +<<<<<<< .mine +// Only VS2005 supports the _M_IX86_FP macro to indicate SSE compilation +// enabled. We assume that if you are using Visual Studio, and you include +// this file, you want SSE/vectorization code. +//#if LL_MSVC && _M_IX86_FP +#if LL_MSVC +======= // Only vectorize if the entire Windows build uses SSE. // _M_IX86_FP is set when SSE code generation is turned on, and I have // confirmed this in VS2003, VS2003 SP1, and VS2005. JC #if LL_MSVC && _M_IX86_FP +>>>>>>> .r65110 #define LL_VECTORIZE 1 diff --git a/indra/llmessage/llcircuit.h b/indra/llmessage/llcircuit.h index a02c67e41d..ee8792ea4d 100644 --- a/indra/llmessage/llcircuit.h +++ b/indra/llmessage/llcircuit.h @@ -38,7 +38,11 @@ const F32 LL_AVERAGED_PING_MIN = 100; // msec // IW: increased to avoid ret const U32 INITIAL_PING_VALUE_MSEC = 1000; // initial value for the ping delay, or for ping delay for an unknown circuit const TPACKETID LL_MAX_OUT_PACKET_ID = 0x01000000; -const U8 LL_PACKET_ID_SIZE = 4; + +// 0 - flags +// [1,4] - packetid +// 5 - data offset (after message name) +const U8 LL_PACKET_ID_SIZE = 6; const S32 LL_MAX_RESENT_PACKETS_PER_FRAME = 100; const S32 LL_MAX_ACKED_PACKETS_PER_FRAME = 200; diff --git a/indra/llmessage/llhost.cpp b/indra/llmessage/llhost.cpp index 6a74cfe831..9fa98cf09c 100644 --- a/indra/llmessage/llhost.cpp +++ b/indra/llmessage/llhost.cpp @@ -210,9 +210,9 @@ std::ostream& operator<< (std::ostream& os, const LLHost &hh) } -std::istream& operator>> (std::istream& is, LLHost &rh) -{ - is >> rh.mIP; - is >> rh.mPort; - return is; -} +//std::istream& operator>> (std::istream& is, LLHost &rh) +//{ +// is >> rh.mIP; +// is >> rh.mPort; +// return is; +//} diff --git a/indra/llmessage/llhost.h b/indra/llmessage/llhost.h index 09dbae61b9..df1b6f31f7 100644 --- a/indra/llmessage/llhost.h +++ b/indra/llmessage/llhost.h @@ -83,7 +83,11 @@ public: std::string getIPandPort() const; friend std::ostream& operator<< (std::ostream& os, const LLHost &hh); - friend std::istream& operator>> (std::istream& is, LLHost &hh); + + // This operator is not well defined. does it expect a + // "192.168.1.1:80" notation or "int int" format? Phoenix 2007-05-18 + //friend std::istream& operator>> (std::istream& is, LLHost &hh); + friend bool operator==( const LLHost &lhs, const LLHost &rhs ); friend bool operator!=( const LLHost &lhs, const LLHost &rhs ); friend bool operator<(const LLHost &lhs, const LLHost &rhs); diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index 16586dc9c7..1bc6d742f1 100644 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -23,12 +23,9 @@ #include <curl/curl.h> const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f; - static std::string gCABundle; - - LLHTTPClient::Responder::Responder() : mReferenceCount(0) { diff --git a/indra/llmessage/llhttpsender.cpp b/indra/llmessage/llhttpsender.cpp index 4152dedae5..b9fd8ecbf7 100644 --- a/indra/llmessage/llhttpsender.cpp +++ b/indra/llmessage/llhttpsender.cpp @@ -20,6 +20,7 @@ namespace { typedef std::map<LLHost, LLHTTPSender*> SenderMap; static SenderMap senderMap; + static LLHTTPSender* defaultSender = new LLHTTPSender(); } //virtual @@ -49,11 +50,10 @@ void LLHTTPSender::setSender(const LLHost& host, LLHTTPSender* sender) //static const LLHTTPSender& LLHTTPSender::getSender(const LLHost& host) { - static LLHTTPSender defaultSender; SenderMap::const_iterator iter = senderMap.find(host); if(iter == senderMap.end()) { - return defaultSender; + return *defaultSender; } return *(iter->second); } @@ -68,3 +68,10 @@ void LLHTTPSender::clearSender(const LLHost& host) senderMap.erase(iter); } } + +//static +void LLHTTPSender::setDefaultSender(LLHTTPSender* sender) +{ + delete defaultSender; + defaultSender = sender; +} diff --git a/indra/llmessage/llhttpsender.h b/indra/llmessage/llhttpsender.h index a9f42579c2..0ba8e30945 100644 --- a/indra/llmessage/llhttpsender.h +++ b/indra/llmessage/llhttpsender.h @@ -33,6 +33,9 @@ class LLHTTPSender /** @brief Clear sender for host. */ static void clearSender(const LLHost& host); + + /** @brief Set default sender, takes ownership of sender. */ + static void setDefaultSender(LLHTTPSender* sender); }; #endif // LL_HTTP_SENDER_H diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index e96b23f134..d1e4a8af31 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -401,6 +401,7 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl( PUMP_DEBUG; apr_size_t len; bool done = false; + apr_status_t status = APR_SUCCESS; while(it != end) { @@ -408,9 +409,8 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl( if((*it).isOnChannel(channels.in())) { PUMP_DEBUG; - // *FIX: check return code - sockets will fail (broken, etc.) len = (apr_size_t)segment.size(); - apr_status_t status = apr_socket_send( + status = apr_socket_send( mDestination->getSocket(), (const char*)segment.data(), &len); @@ -418,12 +418,12 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl( // completed immediately' error from apr_socket_send. In this // case we break and the data will be sent the next time the chain // is pumped. -#if LL_WINDOWS - if (status == 730035) + if(APR_STATUS_IS_EAGAIN(status)) + { + ll_apr_warn_status(status); break; -#else - (void) status; -#endif + } + mLastWritten = segment.data() + len - 1; PUMP_DEBUG; diff --git a/indra/llmessage/llmessagebuilder.h b/indra/llmessage/llmessagebuilder.h index 7ae09c54d5..7bbf7ebd56 100644 --- a/indra/llmessage/llmessagebuilder.h +++ b/indra/llmessage/llmessagebuilder.h @@ -1,3 +1,11 @@ +/** + * @file llmessagebuilder.h + * @brief Declaration of LLMessageBuilder class. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + #ifndef LL_LLMESSAGEBUILDER_H #define LL_LLMESSAGEBUILDER_H @@ -20,31 +28,33 @@ public: //CLASS_LOG_TYPE(LLMessageBuilder); virtual ~LLMessageBuilder(); - virtual void newMessage(const char *name) = 0; + virtual void newMessage(const char* name) = 0; virtual void nextBlock(const char* blockname) = 0; virtual BOOL removeLastBlock() = 0; // TODO: babbage: remove this horror /** All add* methods expect pointers to canonical strings. */ - virtual void addBinaryData(const char *varname, const void *data, - S32 size) = 0; + virtual void addBinaryData( + const char* varname, + const void* data, + S32 size) = 0; virtual void addBOOL(const char* varname, BOOL b) = 0; - virtual void addS8(const char *varname, S8 s) = 0; - virtual void addU8(const char *varname, U8 u) = 0; - virtual void addS16(const char *varname, S16 i) = 0; - virtual void addU16(const char *varname, U16 i) = 0; - virtual void addF32(const char *varname, F32 f) = 0; - virtual void addS32(const char *varname, S32 s) = 0; - virtual void addU32(const char *varname, U32 u) = 0; - virtual void addU64(const char *varname, U64 lu) = 0; - virtual void addF64(const char *varname, F64 d) = 0; - virtual void addVector3(const char *varname, const LLVector3& vec) = 0; - virtual void addVector4(const char *varname, const LLVector4& vec) = 0; - virtual void addVector3d(const char *varname, const LLVector3d& vec) = 0; - virtual void addQuat(const char *varname, const LLQuaternion& quat) = 0; - virtual void addUUID(const char *varname, const LLUUID& uuid) = 0; - virtual void addIPAddr(const char *varname, const U32 ip) = 0; - virtual void addIPPort(const char *varname, const U16 port) = 0; + virtual void addS8(const char* varname, S8 s) = 0; + virtual void addU8(const char* varname, U8 u) = 0; + virtual void addS16(const char* varname, S16 i) = 0; + virtual void addU16(const char* varname, U16 i) = 0; + virtual void addF32(const char* varname, F32 f) = 0; + virtual void addS32(const char* varname, S32 s) = 0; + virtual void addU32(const char* varname, U32 u) = 0; + virtual void addU64(const char* varname, U64 lu) = 0; + virtual void addF64(const char* varname, F64 d) = 0; + virtual void addVector3(const char* varname, const LLVector3& vec) = 0; + virtual void addVector4(const char* varname, const LLVector4& vec) = 0; + virtual void addVector3d(const char* varname, const LLVector3d& vec) = 0; + virtual void addQuat(const char* varname, const LLQuaternion& quat) = 0; + virtual void addUUID(const char* varname, const LLUUID& uuid) = 0; + virtual void addIPAddr(const char* varname, const U32 ip) = 0; + virtual void addIPPort(const char* varname, const U16 port) = 0; virtual void addString(const char* varname, const char* s) = 0; virtual void addString(const char* varname, const std::string& s) = 0; @@ -54,7 +64,10 @@ public: virtual BOOL isBuilt() const = 0; virtual BOOL isClear() const = 0; - virtual U32 buildMessage(U8* buffer, U32 buffer_size) = 0; + virtual U32 buildMessage( + U8* buffer, + U32 buffer_size, + U8 offset_to_data) = 0; /**< Return built message size */ virtual void clearMessage() = 0; diff --git a/indra/llmessage/llmessageconfig.cpp b/indra/llmessage/llmessageconfig.cpp index 3cc17d67df..dd2d725d32 100644 --- a/indra/llmessage/llmessageconfig.cpp +++ b/indra/llmessage/llmessageconfig.cpp @@ -12,37 +12,44 @@ #include "llfile.h" #include "lllivefile.h" #include "llsd.h" +#include "llsdutil.h" #include "llsdserialize.h" +#include "message.h" static const char messageConfigFileName[] = "message.xml"; static const F32 messageConfigRefreshRate = 5.0; // seconds + static std::string sServerName = ""; static std::string sConfigDir = ""; +static std::string sServerDefault; +static LLSD sMessages; + + class LLMessageConfigFile : public LLLiveFile { -private: +public: LLMessageConfigFile() - : LLLiveFile(fileName(), messageConfigRefreshRate), - mChanged(false) + : LLLiveFile(fileName(), messageConfigRefreshRate) { } static std::string fileName(); - -public: + + LLSD mMessages; + std::string mServerDefault; + static LLMessageConfigFile& instance(); // return the singleton configuration file -protected: /* virtual */ void loadFile(); void loadServerDefaults(const LLSD& data); void loadMessages(const LLSD& data); + void loadCapBans(const LLSD& blacklist); + void loadMessageBans(const LLSD& blacklist); + bool isCapBanned(const std::string& cap_name) const; public: - bool mChanged; - - std::string mServerDefault; - LLSD mMessages; + LLSD mCapBans; }; std::string LLMessageConfigFile::fileName() @@ -82,26 +89,63 @@ void LLMessageConfigFile::loadFile() } loadServerDefaults(data); loadMessages(data); + loadCapBans(data); + loadMessageBans(data); } void LLMessageConfigFile::loadServerDefaults(const LLSD& data) { mServerDefault = data["serverDefaults"][sServerName].asString(); - lldebugs << "loading default " << mServerDefault << llendl; } void LLMessageConfigFile::loadMessages(const LLSD& data) { - LLPointer<LLSDXMLFormatter> formatter = new LLSDXMLFormatter; - std::ostringstream out; - mMessages = data["messages"]; + +#ifdef DEBUG + std::ostringstream out; + LLSDXMLFormatter *formatter = new LLSDXMLFormatter; formatter->format(mMessages, out); - lldebugs << "loading ... " << out.str() + llinfos << "loading ... " << out.str() << " LLMessageConfigFile::loadMessages loaded " << mMessages.size() << " messages" << llendl; +#endif } +void LLMessageConfigFile::loadCapBans(const LLSD& data) +{ + LLSD bans = data["capBans"]; + if (!bans.isMap()) + { + llinfos << "LLMessageConfigFile::loadCapBans: missing capBans section" + << llendl; + return; + } + + mCapBans = bans; + + llinfos << "LLMessageConfigFile::loadCapBans: " + << bans.size() << " ban tests" << llendl; +} + +void LLMessageConfigFile::loadMessageBans(const LLSD& data) +{ + LLSD bans = data["messageBans"]; + if (!bans.isMap()) + { + llinfos << "LLMessageConfigFile::loadMessageBans: missing messageBans section" + << llendl; + return; + } + + gMessageSystem->setMessageBans(bans["trusted"], bans["untrusted"]); +} + +bool LLMessageConfigFile::isCapBanned(const std::string& cap_name) const +{ + llinfos << "mCapBans is " << LLSDXMLStreamer(mCapBans) << llendl; + return mCapBans[cap_name]; +} //--------------------------------------------------------------- // LLMessageConfig @@ -114,98 +158,77 @@ void LLMessageConfig::initClass(const std::string& server_name, sServerName = server_name; sConfigDir = config_dir; (void) LLMessageConfigFile::instance(); - llinfos << "LLMessageConfig::intiClass config file " + llinfos << "LLMessageConfig::initClass config file " << config_dir << "/" << messageConfigFileName << llendl; } //static -bool LLMessageConfig::isServerDefaultBuilderLLSD() +void LLMessageConfig::useConfig(const LLSD& config) { - if (sServerName.empty()) - { - llerrs << "LLMessageConfig::isServerDefaultBuilderLLSD() before" - << " LLMessageConfig::initClass()" << llendl; - } - LLMessageConfigFile& file = LLMessageConfigFile::instance(); - return (file.mServerDefault == "llsd"); -} + LLMessageConfigFile &the_file = LLMessageConfigFile::instance(); + the_file.loadServerDefaults(config); + the_file.loadMessages(config); + the_file.loadCapBans(config); + the_file.loadMessageBans(config); -//static -bool LLMessageConfig::isServerDefaultBuilderTemplate() -{ - if (sServerName.empty()) - { - llerrs << "LLMessageConfig::isServerDefaultBuilderTemplate() before" - << " LLMessageConfig::initClass()" << llendl; - } - LLMessageConfigFile& file = LLMessageConfigFile::instance(); - return (file.mServerDefault == "template"); } //static -bool LLMessageConfig::isMessageBuiltLLSD(const std::string& msg_name) +LLMessageConfig::Flavor LLMessageConfig::getServerDefaultFlavor() { - if (sServerName.empty()) + LLMessageConfigFile& file = LLMessageConfigFile::instance(); + if (file.mServerDefault == "llsd") { - llerrs << "LLMessageConfig::isMessageBuiltLLSD(name) before" - << " LLMessageConfig::initClass()" << llendl; + return LLSD_FLAVOR; } - LLMessageConfigFile& file = LLMessageConfigFile::instance(); - LLSD config = file.mMessages[msg_name]; - if (!config.has("builder")) + if (file.mServerDefault == "template") { - return isServerDefaultBuilderLLSD(); + return TEMPLATE_FLAVOR; } - return (config["builder"].asString() == "llsd"); + return NO_FLAVOR; } //static -bool LLMessageConfig::isMessageBuiltTemplate(const std::string& msg_name) +LLMessageConfig::Flavor LLMessageConfig::getMessageFlavor(const std::string& msg_name) { - if (sServerName.empty()) - { - llerrs << "LLMessageConfig::isMessageBuiltTemplate(name) before" - << " LLMessageConfig::initClass()" << llendl; - } LLMessageConfigFile& file = LLMessageConfigFile::instance(); LLSD config = file.mMessages[msg_name]; - if (!config.has("builder")) + if (config["flavor"].asString() == "llsd") { - return isServerDefaultBuilderTemplate(); + return LLSD_FLAVOR; } - return (config["builder"].asString() == "template"); + if (config["flavor"].asString() == "template") + { + return TEMPLATE_FLAVOR; + } + return NO_FLAVOR; } //static -bool LLMessageConfig::isMessageTrusted(const std::string& msg_name) +LLMessageConfig::SenderTrust LLMessageConfig::getSenderTrustedness( + const std::string& msg_name) { - if (sServerName.empty()) - { - llerrs << "LLMessageConfig::isMessageTrusted(name) before" - << " LLMessageConfig::initClass()" << llendl; - } LLMessageConfigFile& file = LLMessageConfigFile::instance(); LLSD config = file.mMessages[msg_name]; - if (!config.has("trusted-sender")) + if (config.has("trusted-sender")) { - return false; + return config["trusted-sender"].asBoolean() ? TRUSTED : UNTRUSTED; } - return config["trusted-sender"].asBoolean(); + return NOT_SET; } //static -bool LLMessageConfig::isValidUntrustedMessage(const std::string& msg_name) +bool LLMessageConfig::isValidMessage(const std::string& msg_name) { if (sServerName.empty()) { - llerrs << "LLMessageConfig::isMessageTrusted(name) before" - << " LLMessageConfig::initClass()" << llendl; + llerrs << "LLMessageConfig::initClass() not called" << llendl; } LLMessageConfigFile& file = LLMessageConfigFile::instance(); - LLSD config = file.mMessages[msg_name]; - if (!config.has("trusted-sender")) - { - return false; - } - return !(config["trusted-sender"].asBoolean()); + return file.mMessages.has(msg_name); +} + +bool LLMessageConfig::isCapBanned(const std::string& cap_name) +{ + return LLMessageConfigFile::instance().isCapBanned(cap_name); } diff --git a/indra/llmessage/llmessageconfig.h b/indra/llmessage/llmessageconfig.h index 2fb6f2077e..a99cdc46fa 100644 --- a/indra/llmessage/llmessageconfig.h +++ b/indra/llmessage/llmessageconfig.h @@ -11,21 +11,24 @@ #include <string> +class LLSD; + class LLMessageConfig { public: + enum Flavor { NO_FLAVOR=0, LLSD_FLAVOR=1, TEMPLATE_FLAVOR=2 }; + enum SenderTrust { NOT_SET=0, UNTRUSTED=1, TRUSTED=2 }; + static void initClass(const std::string& server_name, const std::string& config_dir); - // force loading of config file during startup process - // so it can be used for startup features + static void useConfig(const LLSD& config); - static bool isServerDefaultBuilderLLSD(); - static bool isServerDefaultBuilderTemplate(); + static Flavor getServerDefaultFlavor(); // For individual messages - static bool isMessageBuiltLLSD(const std::string& msg_name); - static bool isMessageBuiltTemplate(const std::string& msg_name); - static bool isMessageTrusted(const std::string& msg_name); - static bool isValidUntrustedMessage(const std::string& msg_name); + static Flavor getMessageFlavor(const std::string& msg_name); + static SenderTrust getSenderTrustedness(const std::string& msg_name); + static bool isValidMessage(const std::string& msg_name); + static bool isCapBanned(const std::string& cap_name); }; #endif // LL_MESSAGECONFIG_H diff --git a/indra/llmessage/llmessagereader.cpp b/indra/llmessage/llmessagereader.cpp index 4824480e32..5375fab0f8 100644 --- a/indra/llmessage/llmessagereader.cpp +++ b/indra/llmessage/llmessagereader.cpp @@ -1,3 +1,11 @@ +/** + * @file llmessagereader.cpp + * @brief LLMessageReader class implementation + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + #include "llmessagereader.h" static BOOL sTimeDecodes = FALSE; diff --git a/indra/llmessage/llmessagereader.h b/indra/llmessage/llmessagereader.h index 33ce9289f5..65a7032754 100644 --- a/indra/llmessage/llmessagereader.h +++ b/indra/llmessage/llmessagereader.h @@ -1,3 +1,11 @@ +/** + * @file llmessagereader.h + * @brief Declaration of LLMessageReader class. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + #ifndef LL_LLMESSAGEREADER_H #define LL_LLMESSAGEREADER_H @@ -45,6 +53,7 @@ class LLMessageReader virtual void clearMessage() = 0; + /** Returns pointer to canonical (prehashed) string. */ virtual const char* getMessageName() const = 0; virtual S32 getMessageSize() const = 0; diff --git a/indra/llmessage/llmessagetemplate.cpp b/indra/llmessage/llmessagetemplate.cpp index 026843d6ec..7383308ddd 100644 --- a/indra/llmessage/llmessagetemplate.cpp +++ b/indra/llmessage/llmessagetemplate.cpp @@ -1,3 +1,11 @@ +/** + * @file llmessagetemplate.cpp + * @brief Implementation of message template classes. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + #include "linden_common.h" #include "llmessagetemplate.h" @@ -94,7 +102,7 @@ std::ostream& operator<<(std::ostream& s, LLMessageBlock &msg) for (LLMessageBlock::message_variable_map_t::iterator iter = msg.mMemberVariables.begin(); iter != msg.mMemberVariables.end(); iter++) { - LLMessageVariable& ci = *(iter->second); + LLMessageVariable& ci = *(*iter); s << ci; } @@ -138,7 +146,7 @@ std::ostream& operator<<(std::ostream& s, LLMessageTemplate &msg) for (LLMessageTemplate::message_block_map_t::iterator iter = msg.mMemberBlocks.begin(); iter != msg.mMemberBlocks.end(); iter++) { - LLMessageBlock* ci = iter->second; + LLMessageBlock* ci = *iter; s << *ci; } diff --git a/indra/llmessage/llmessagetemplate.h b/indra/llmessage/llmessagetemplate.h index 8847ddc0d9..b7a661fa1a 100644 --- a/indra/llmessage/llmessagetemplate.h +++ b/indra/llmessage/llmessagetemplate.h @@ -1,3 +1,11 @@ +/** + * @file llmessagetemplate.h + * @brief Declaration of the message template classes. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + #ifndef LL_LLMESSAGETEMPLATE_H #define LL_LLMESSAGETEMPLATE_H @@ -123,7 +131,7 @@ public: mName = name; } - LLMessageVariable(char *name, const EMsgVariableType type, const S32 size) : mType(type), mSize(size) + LLMessageVariable(const char *name, const EMsgVariableType type, const S32 size) : mType(type), mSize(size) { mName = gMessageStringTable.getString(name); } @@ -154,14 +162,14 @@ typedef enum e_message_block_type class LLMessageBlock { public: - LLMessageBlock(char *name, EMsgBlockType type, S32 number = 1) : mType(type), mNumber(number), mTotalSize(0) + LLMessageBlock(const char *name, EMsgBlockType type, S32 number = 1) : mType(type), mNumber(number), mTotalSize(0) { mName = gMessageStringTable.getString(name); } ~LLMessageBlock() { - for_each(mMemberVariables.begin(), mMemberVariables.end(), DeletePairedPointer()); + for_each(mMemberVariables.begin(), mMemberVariables.end(), DeletePointer()); } void addVariable(char *name, const EMsgVariableType type, const S32 size) @@ -193,9 +201,15 @@ public: return (mMemberVariables[name])->getSize(); } + const LLMessageVariable* getVariable(char* name) const + { + message_variable_map_t::const_iterator iter = mMemberVariables.find(name); + return iter != mMemberVariables.end()? *iter : NULL; + } + friend std::ostream& operator<<(std::ostream& s, LLMessageBlock &msg); - typedef std::map<const char *, LLMessageVariable*> message_variable_map_t; + typedef LLDynamicArrayIndexed<LLMessageVariable*, const char *, 8> message_variable_map_t; message_variable_map_t mMemberVariables; char *mName; EMsgBlockType mType; @@ -224,6 +238,13 @@ enum EMsgEncoding ME_ZEROCODED }; +enum EMsgDeprecation +{ + MD_NOTDEPRECATED, + MD_UDPDEPRECATED, + MD_DEPRECATED +}; + class LLMessageTemplate { public: @@ -234,7 +255,8 @@ public: mFrequency(freq), mTrust(MT_NOTRUST), mEncoding(ME_ZEROCODED), - mMessageNumber(message_number), + mDeprecation(MD_NOTDEPRECATED), + mMessageNumber(message_number), mTotalSize(0), mReceiveCount(0), mReceiveBytes(0), @@ -253,8 +275,8 @@ public: ~LLMessageTemplate() { - for_each(mMemberBlocks.begin(), mMemberBlocks.end(), DeletePairedPointer()); - } + for_each(mMemberBlocks.begin(), mMemberBlocks.end(), DeletePointer()); +} void addBlock(LLMessageBlock *blockp) { @@ -289,7 +311,7 @@ public: mTrust = t; } - EMsgTrust getTrust(void) + EMsgTrust getTrust(void) const { return mTrust; } @@ -299,18 +321,28 @@ public: { mEncoding = e; } - EMsgEncoding getEncoding() + EMsgEncoding getEncoding() const { return mEncoding; } + void setDeprecation(EMsgDeprecation d) + { + mDeprecation = d; + } + + EMsgDeprecation getDeprecation() const + { + return mDeprecation; + } + void setHandlerFunc(void (*handler_func)(LLMessageSystem *msgsystem, void **user_data), void **user_data) { mHandlerFunc = handler_func; mUserData = user_data; } - BOOL callHandlerFunc(LLMessageSystem *msgsystem) + BOOL callHandlerFunc(LLMessageSystem *msgsystem) const { if (mHandlerFunc) { @@ -320,20 +352,27 @@ public: return FALSE; } - bool isBanned(bool trustedSource) + bool isBanned(bool trustedSource) const { return trustedSource ? mBanFromTrusted : mBanFromUntrusted; } friend std::ostream& operator<<(std::ostream& s, LLMessageTemplate &msg); + const LLMessageBlock* getBlock(char* name) const + { + message_block_map_t::const_iterator iter = mMemberBlocks.find(name); + return iter != mMemberBlocks.end()? *iter : NULL; + } + public: - typedef std::map<char*, LLMessageBlock*> message_block_map_t; + typedef LLDynamicArrayIndexed<LLMessageBlock*, char*, 8> message_block_map_t; message_block_map_t mMemberBlocks; char *mName; EMsgFrequency mFrequency; EMsgTrust mTrust; EMsgEncoding mEncoding; + EMsgDeprecation mDeprecation; U32 mMessageNumber; S32 mTotalSize; U32 mReceiveCount; // how many of this template have been received since last reset diff --git a/indra/llmessage/llmessagetemplateparser.cpp b/indra/llmessage/llmessagetemplateparser.cpp new file mode 100644 index 0000000000..9c6dd8c73a --- /dev/null +++ b/indra/llmessage/llmessagetemplateparser.cpp @@ -0,0 +1,734 @@ +/** + * @file llmessagetemplateparser.cpp + * @brief LLMessageTemplateParser implementation + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include "llmessagetemplateparser.h" +#include <boost/tokenizer.hpp> + + +// What follows is a bunch of C functions to do validation. + +// Lets support a small subset of regular expressions here +// Syntax is a string made up of: +// a - checks against alphanumeric ([A-Za-z0-9]) +// c - checks against character ([A-Za-z]) +// f - checks against first variable character ([A-Za-z_]) +// v - checks against variable ([A-Za-z0-9_]) +// s - checks against sign of integer ([-0-9]) +// d - checks against integer digit ([0-9]) +// * - repeat last check + +// checks 'a' +BOOL b_return_alphanumeric_ok(char c) +{ + if ( ( (c < 'A') + ||(c > 'Z')) + &&( (c < 'a') + ||(c > 'z')) + &&( (c < '0') + ||(c > '9'))) + { + return FALSE; + } + return TRUE; +} + +// checks 'c' +BOOL b_return_character_ok(char c) +{ + if ( ( (c < 'A') + ||(c > 'Z')) + &&( (c < 'a') + ||(c > 'z'))) + { + return FALSE; + } + return TRUE; +} + +// checks 'f' +BOOL b_return_first_variable_ok(char c) +{ + if ( ( (c < 'A') + ||(c > 'Z')) + &&( (c < 'a') + ||(c > 'z')) + &&(c != '_')) + { + return FALSE; + } + return TRUE; +} + +// checks 'v' +BOOL b_return_variable_ok(char c) +{ + if ( ( (c < 'A') + ||(c > 'Z')) + &&( (c < 'a') + ||(c > 'z')) + &&( (c < '0') + ||(c > '9')) + &&(c != '_')) + { + return FALSE; + } + return TRUE; +} + +// checks 's' +BOOL b_return_signed_integer_ok(char c) +{ + if ( ( (c < '0') + ||(c > '9')) + &&(c != '-')) + { + return FALSE; + } + return TRUE; +} + +// checks 'd' +BOOL b_return_integer_ok(char c) +{ + if ( (c < '0') + ||(c > '9')) + { + return FALSE; + } + return TRUE; +} + +BOOL (*gParseCheckCharacters[])(char c) = +{ + b_return_alphanumeric_ok, + b_return_character_ok, + b_return_first_variable_ok, + b_return_variable_ok, + b_return_signed_integer_ok, + b_return_integer_ok +}; + +S32 get_checker_number(char checker) +{ + switch(checker) + { + case 'a': + return 0; + case 'c': + return 1; + case 'f': + return 2; + case 'v': + return 3; + case 's': + return 4; + case 'd': + return 5; + case '*': + return 9999; + default: + return -1; + } +} + +// check token based on passed simplified regular expression +BOOL b_check_token(const char *token, char *regexp) +{ + S32 tptr, rptr = 0; + S32 current_checker, next_checker = 0; + + current_checker = get_checker_number(regexp[rptr++]); + + if (current_checker == -1) + { + llerrs << "Invalid regular expression value!" << llendl; + return FALSE; + } + + if (current_checker == 9999) + { + llerrs << "Regular expression can't start with *!" << llendl; + return FALSE; + } + + for (tptr = 0; token[tptr]; tptr++) + { + if (current_checker == -1) + { + llerrs << "Input exceeds regular expression!\nDid you forget a *?" << llendl; + return FALSE; + } + + if (!gParseCheckCharacters[current_checker](token[tptr])) + { + return FALSE; + } + if (next_checker != 9999) + { + next_checker = get_checker_number(regexp[rptr++]); + if (next_checker != 9999) + { + current_checker = next_checker; + } + } + } + return TRUE; +} + +// C variable can be made up of upper or lower case letters, underscores, or numbers, but can't start with a number +BOOL b_variable_ok(const char *token) +{ + if (!b_check_token(token, "fv*")) + { + llwarns << "Token '" << token << "' isn't a variable!" << llendl; + return FALSE; + } + return TRUE; +} + +// An integer is made up of the digits 0-9 and may be preceded by a '-' +BOOL b_integer_ok(const char *token) +{ + if (!b_check_token(token, "sd*")) + { + llwarns << "Token isn't an integer!" << llendl; + return FALSE; + } + return TRUE; +} + +// An integer is made up of the digits 0-9 +BOOL b_positive_integer_ok(const char *token) +{ + if (!b_check_token(token, "d*")) + { + llwarns << "Token isn't an integer!" << llendl; + return FALSE; + } + return TRUE; +} + + +// Done with C functions, here's the tokenizer. + +typedef boost::tokenizer< boost::char_separator<char> > tokenizer; + +LLTemplateTokenizer::LLTemplateTokenizer(const std::string & contents) : mStarted(false), mTokens() +{ + boost::char_separator<char> newline("\r\n", "", boost::keep_empty_tokens); + boost::char_separator<char> spaces(" \t"); + U32 line_counter = 1; + + tokenizer line_tokens(contents, newline); + for(tokenizer::iterator line_iter = line_tokens.begin(); + line_iter != line_tokens.end(); + ++line_iter, ++line_counter) + { + tokenizer word_tokens(*line_iter, spaces); + for(tokenizer::iterator word_iter = word_tokens.begin(); + word_iter != word_tokens.end(); + ++word_iter) + { + if((*word_iter)[0] == '/') + { + break; // skip to end of line on comments + } + positioned_token pt;// = new positioned_token(); + pt.str = std::string(*word_iter); + pt.line = line_counter; + mTokens.push_back(pt); + } + } + mCurrent = mTokens.begin(); +} +void LLTemplateTokenizer::inc() +{ + if(atEOF()) + { + error("trying to increment token of EOF"); + } + else if(mStarted) + { + ++mCurrent; + } + else + { + mStarted = true; + mCurrent = mTokens.begin(); + } +} +void LLTemplateTokenizer::dec() +{ + if(mCurrent == mTokens.begin()) + { + if(mStarted) + { + mStarted = false; + } + else + { + error("trying to decrement past beginning of file"); + } + } + else + { + mCurrent--; + } +} + +std::string LLTemplateTokenizer::get() const +{ + if(atEOF()) + { + error("trying to get EOF"); + } + return mCurrent->str; +} + +U32 LLTemplateTokenizer::line() const +{ + if(atEOF()) + { + return 0; + } + return mCurrent->line; +} + +bool LLTemplateTokenizer::atEOF() const +{ + return mCurrent == mTokens.end(); +} + +std::string LLTemplateTokenizer::next() +{ + inc(); + return get(); +} + +bool LLTemplateTokenizer::want(const std::string & token) +{ + if(atEOF()) return false; + inc(); + if(atEOF()) return false; + if(get() != token) + { + dec(); // back up a step + return false; + } + return true; +} + +bool LLTemplateTokenizer::wantEOF() +{ + // see if the next token is EOF + if(atEOF()) return true; + inc(); + if(!atEOF()) + { + dec(); // back up a step + return false; + } + return true; +} + +void LLTemplateTokenizer::error(std::string message) const +{ + if(atEOF()) + { + llerrs << "Unexpected end of file: " << message << llendl; + } + else + { + llerrs << "Problem parsing message template at line " + << line() << ", with token '" << get() << "' : " + << message << llendl; + } +} + + +// Done with tokenizer, next is the parser. + +LLTemplateParser::LLTemplateParser(LLTemplateTokenizer & tokens): + mVersion(0.f), + mMessages() +{ + // the version number should be the first thing in the file + if (tokens.want("version")) + { + // version number + std::string vers_string = tokens.next(); + mVersion = (F32)atof(vers_string.c_str()); + + llinfos << "### Message template version " << mVersion << " ###" << llendl; + } + else + { + llerrs << "Version must be first in the message template, found " + << tokens.next() << llendl; + } + + while(LLMessageTemplate * templatep = parseMessage(tokens)) + { + if (templatep->getDeprecation() != MD_DEPRECATED) + { + mMessages.push_back(templatep); + } + } + + if(!tokens.wantEOF()) + { + llerrs << "Expected end of template or a message, instead found: " + << tokens.next() << " at " << tokens.line() << llendl; + } +} + +F32 LLTemplateParser::getVersion() const +{ + return mVersion; +} + +LLTemplateParser::message_iterator LLTemplateParser::getMessagesBegin() const +{ + return mMessages.begin(); +} + +LLTemplateParser::message_iterator LLTemplateParser::getMessagesEnd() const +{ + return mMessages.end(); +} + + +// static +LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens) +{ + LLMessageTemplate *templatep = NULL; + if(!tokens.want("{")) + { + return NULL; + } + + // name first + std::string template_name = tokens.next(); + + // is name a legit C variable name + if (!b_variable_ok(template_name.c_str())) + { + llerrs << "Not legit variable name: " << template_name << " at " << tokens.line() << llendl; + } + + // ok, now get Frequency ("High", "Medium", or "Low") + EMsgFrequency frequency = MFT_LOW; + std::string freq_string = tokens.next(); + if (freq_string == "High") + { + frequency = MFT_HIGH; + } + else if (freq_string == "Medium") + { + frequency = MFT_MEDIUM; + } + else if (freq_string == "Low" || freq_string == "Fixed") + { + frequency = MFT_LOW; + } + else + { + llerrs << "Expected frequency, got " << freq_string << " at " << tokens.line() << llendl; + } + + // TODO more explicit checking here pls + U32 message_number = strtoul(tokens.next().c_str(),NULL,0); + + switch (frequency) { + case MFT_HIGH: + break; + case MFT_MEDIUM: + message_number = (255 << 8) | message_number; + break; + case MFT_LOW: + message_number = (255 << 24) | (255 << 16) | message_number; + break; + default: + llerrs << "Unknown frequency enum: " << frequency << llendl; + } + + templatep = new LLMessageTemplate( + template_name.c_str(), + message_number, + frequency); + + // Now get trust ("Trusted", "NotTrusted") + std::string trust = tokens.next(); + if (trust == "Trusted") + { + templatep->setTrust(MT_TRUST); + } + else if (trust == "NotTrusted") + { + templatep->setTrust(MT_NOTRUST); + } + else + { + llerrs << "Bad trust " << trust << " at " << tokens.line() << llendl; + } + + // get encoding + std::string encoding = tokens.next(); + if(encoding == "Unencoded") + { + templatep->setEncoding(ME_UNENCODED); + } + else if(encoding == "Zerocoded") + { + templatep->setEncoding(ME_ZEROCODED); + } + else + { + llerrs << "Bad encoding " << encoding << " at " << tokens.line() << llendl; + } + + // get deprecation + if(tokens.want("Deprecated")) + { + templatep->setDeprecation(MD_DEPRECATED); + } + else if (tokens.want("UDPDeprecated")) + { + templatep->setDeprecation(MD_UDPDEPRECATED); + } + else if (tokens.want("NotDeprecated")) + { + // this is the default value, but it can't hurt to set it twice + templatep->setDeprecation(MD_NOTDEPRECATED); + } + else { + // It's probably a brace, let's just start block processing + } + + while(LLMessageBlock * blockp = parseBlock(tokens)) + { + templatep->addBlock(blockp); + } + + if(!tokens.want("}")) + { + llerrs << "Expecting closing } for message " << template_name + << " at " << tokens.line() << llendl; + } + return templatep; +} + +// static +LLMessageBlock * LLTemplateParser::parseBlock(LLTemplateTokenizer & tokens) +{ + LLMessageBlock * blockp = NULL; + + if(!tokens.want("{")) + { + return NULL; + } + + // name first + std::string block_name = tokens.next(); + + // is name a legit C variable name + if (!b_variable_ok(block_name.c_str())) + { + llerrs << "not a legal block name: " << block_name + << " at " << tokens.line() << llendl; + } + + // now, block type ("Single", "Multiple", or "Variable") + std::string block_type = tokens.next(); + // which one is it? + if (block_type == "Single") + { + // ok, we can create a block + blockp = new LLMessageBlock(block_name.c_str(), MBT_SINGLE); + } + else if (block_type == "Multiple") + { + // need to get the number of repeats + std::string repeats = tokens.next(); + + // is it a legal integer + if (!b_positive_integer_ok(repeats.c_str())) + { + llerrs << "not a legal integer for block multiple count: " + << repeats << " at " << tokens.line() << llendl; + } + + // ok, we can create a block + blockp = new LLMessageBlock(block_name.c_str(), + MBT_MULTIPLE, + atoi(repeats.c_str())); + } + else if (block_type == "Variable") + { + // ok, we can create a block + blockp = new LLMessageBlock(block_name.c_str(), MBT_VARIABLE); + } + else + { + llerrs << "bad block type: " << block_type + << " at " << tokens.line() << llendl; + } + + + while(LLMessageVariable * varp = parseVariable(tokens)) + { + blockp->addVariable(varp->getName(), + varp->getType(), + varp->getSize()); + delete varp; + } + + if(!tokens.want("}")) + { + llerrs << "Expecting closing } for block " << block_name + << " at " << tokens.line() << llendl; + } + return blockp; + +} + +// static +LLMessageVariable * LLTemplateParser::parseVariable(LLTemplateTokenizer & tokens) +{ + LLMessageVariable * varp = NULL; + if(!tokens.want("{")) + { + return NULL; + } + + std::string var_name = tokens.next(); + + if (!b_variable_ok(var_name.c_str())) + { + llerrs << "Not a legit variable name: " << var_name + << " at " << tokens.line() << llendl; + } + + std::string var_type = tokens.next(); + + if (var_type == "U8") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_U8, 1); + } + else if (var_type == "U16") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_U16, 2); + } + else if (var_type == "U32") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_U32, 4); + } + else if (var_type == "U64") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_U64, 8); + } + else if (var_type == "S8") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_S8, 1); + } + else if (var_type == "S16") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_S16, 2); + } + else if (var_type == "S32") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_S32, 4); + } + else if (var_type == "S64") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_S64, 8); + } + else if (var_type == "F32") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_F32, 4); + } + else if (var_type == "F64") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_F64, 8); + } + else if (var_type == "LLVector3") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_LLVector3, 12); + } + else if (var_type == "LLVector3d") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_LLVector3d, 24); + } + else if (var_type == "LLVector4") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_LLVector4, 16); + } + else if (var_type == "LLQuaternion") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_LLQuaternion, 12); + } + else if (var_type == "LLUUID") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_LLUUID, 16); + } + else if (var_type == "BOOL") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_BOOL, 1); + } + else if (var_type == "IPADDR") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_IP_ADDR, 4); + } + else if (var_type == "IPPORT") + { + varp = new LLMessageVariable(var_name.c_str(), MVT_IP_PORT, 2); + } + else if (var_type == "Fixed" || var_type == "Variable") + { + std::string variable_size = tokens.next(); + + if (!b_positive_integer_ok(variable_size.c_str())) + { + llerrs << "not a legal integer variable size: " << variable_size + << " at " << tokens.line() << llendl; + } + + EMsgVariableType type_enum; + if(var_type == "Variable") + { + type_enum = MVT_VARIABLE; + } + else if(var_type == "Fixed") + { + type_enum = MVT_FIXED; + } + else + { + type_enum = MVT_FIXED; // removes a warning + llerrs << "bad variable type: " << var_type + << " at " << tokens.line() << llendl; + } + + varp = new LLMessageVariable( + var_name.c_str(), + type_enum, + atoi(variable_size.c_str())); + } + else + { + llerrs << "bad variable type:" << var_type + << " at " << tokens.line() << llendl; + } + + if(!tokens.want("}")) + { + llerrs << "Expecting closing } for variable " << var_name + << " at " << tokens.line() << llendl; + } + return varp; +} diff --git a/indra/llmessage/llmessagetemplateparser.h b/indra/llmessage/llmessagetemplateparser.h new file mode 100644 index 0000000000..0fba42bc41 --- /dev/null +++ b/indra/llmessage/llmessagetemplateparser.h @@ -0,0 +1,62 @@ +/** + * @file llmessagetemplateparser.h + * @brief Classes to parse message template. + * + * Copyright (c) 2000-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#ifndef LL_MESSAGETEMPLATEPARSER_H +#define LL_MESSAGETEMPLATEPARSER_H + +#include <string> +#include "llmessagetemplate.h" + +class LLTemplateTokenizer +{ +public: + LLTemplateTokenizer(const std::string & contents); + + U32 line() const; + bool atEOF() const; + std::string next(); + + bool want(const std::string & token); + bool wantEOF(); +private: + void inc(); + void dec(); + std::string get() const; + void error(std::string message = "generic") const; + + struct positioned_token + { + std::string str; + U32 line; + }; + + bool mStarted; + std::list<positioned_token> mTokens; + std::list<positioned_token>::const_iterator mCurrent; +}; + +class LLTemplateParser +{ +public: + typedef std::list<LLMessageTemplate *>::const_iterator message_iterator; + + static LLMessageTemplate * parseMessage(LLTemplateTokenizer & tokens); + static LLMessageBlock * parseBlock(LLTemplateTokenizer & tokens); + static LLMessageVariable * parseVariable(LLTemplateTokenizer & tokens); + + LLTemplateParser(LLTemplateTokenizer & tokens); + message_iterator getMessagesBegin() const; + message_iterator getMessagesEnd() const; + F32 getVersion() const; + +private: + F32 mVersion; + std::list<LLMessageTemplate *> mMessages; +}; + +#endif diff --git a/indra/llmessage/llmsgvariabletype.h b/indra/llmessage/llmsgvariabletype.h index 360d949690..23370d2f48 100644 --- a/indra/llmessage/llmsgvariabletype.h +++ b/indra/llmessage/llmsgvariabletype.h @@ -1,3 +1,11 @@ +/** + * @file llmsgvariabletype.h + * @brief Declaration of the EMsgVariableType enumeration. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + #ifndef LL_LLMSGVARIABLETYPE_H #define LL_LLMSGVARIABLETYPE_H diff --git a/indra/llmessage/llpacketack.cpp b/indra/llmessage/llpacketack.cpp new file mode 100644 index 0000000000..c0c8028ca3 --- /dev/null +++ b/indra/llmessage/llpacketack.cpp @@ -0,0 +1,64 @@ +/** + * @file llpacketack.cpp + * @author Phoenix + * @date 2007-05-09 + * @brief Implementation of the LLReliablePacket. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include "linden_common.h" +#include "llpacketack.h" + +#if !LL_WINDOWS +#include <netinet/in.h> +#else +#include "winsock2.h" +#endif + +#include "message.h" + +LLReliablePacket::LLReliablePacket( + S32 socket, + U8* buf_ptr, + S32 buf_len, + LLReliablePacketParams* params) : + mBuffer(NULL), + mBufferLength(0) +{ + if (params) + { + mHost = params->mHost; + mRetries = params->mRetries; + mPingBasedRetry = params->mPingBasedRetry; + mTimeout = params->mTimeout; + mCallback = params->mCallback; + mCallbackData = params->mCallbackData; + mMessageName = params->mMessageName; + } + else + { + mRetries = 0; + mPingBasedRetry = TRUE; + mTimeout = 0.f; + mCallback = NULL; + mCallbackData = NULL; + mMessageName = NULL; + } + + mExpirationTime = (F64)((S64)totalTime())/1000000.0 + mTimeout; + mPacketID = ntohl(*((U32*)(&buf_ptr[PHL_PACKET_ID]))); + + mSocket = socket; + if (mRetries) + { + mBuffer = new U8[buf_len]; + if (mBuffer != NULL) + { + memcpy(mBuffer,buf_ptr,buf_len); /*Flawfinder: ignore*/ + mBufferLength = buf_len; + } + + } +} diff --git a/indra/llmessage/llpacketack.h b/indra/llmessage/llpacketack.h index 4c22dc2d62..37675d2df4 100644 --- a/indra/llmessage/llpacketack.h +++ b/indra/llmessage/llpacketack.h @@ -9,37 +9,18 @@ #ifndef LL_LLPACKETACK_H #define LL_LLPACKETACK_H -#include <cstring> -#include <stdio.h> - -#include "llerror.h" -#include "lltimer.h" #include "llhost.h" -//class LLPacketAck -//{ -//public: -// LLHost mHost; -// TPACKETID mPacketID; -//public: -// LLPacketAck(const LLHost &host, TPACKETID packet_id) -// { -// mHost = host; -// mPacketID = packet_id; -// }; -// ~LLPacketAck(){}; -//}; - class LLReliablePacketParams { public: - LLHost mHost; - S32 mRetries; - BOOL mPingBasedRetry; - F32 mTimeout; - void (*mCallback)(void **,S32); - void **mCallbackData; - char *mMessageName; + LLHost mHost; + S32 mRetries; + BOOL mPingBasedRetry; + F32 mTimeout; + void (*mCallback)(void **,S32); + void** mCallbackData; + char* mMessageName; public: LLReliablePacketParams() @@ -60,9 +41,13 @@ public: mMessageName = NULL; }; - void set ( const LLHost &host, S32 retries, BOOL ping_based_retry, - F32 timeout, - void (*callback)(void **,S32), void **callback_data, char *name ) + void set( + const LLHost& host, + S32 retries, + BOOL ping_based_retry, + F32 timeout, + void (*callback)(void**,S32), + void** callback_data, char* name) { mHost = host; mRetries = retries; @@ -77,53 +62,11 @@ public: class LLReliablePacket { public: - LLReliablePacket(S32 socket, U8 *buf_ptr, S32 buf_len, LLReliablePacketParams *params) : - mBuffer(NULL), - mBufferLength(0) - { - if (params) - { - mHost = params->mHost; - mRetries = params->mRetries; - mPingBasedRetry = params->mPingBasedRetry; - mTimeout = params->mTimeout; - mCallback = params->mCallback; - mCallbackData = params->mCallbackData; - mMessageName = params->mMessageName; - } - else - { - mRetries = 0; - mPingBasedRetry = TRUE; - mTimeout = 0.f; - mCallback = NULL; - mCallbackData = NULL; - mMessageName = NULL; - } - - mExpirationTime = (F64)((S64)totalTime())/1000000.0 + mTimeout; - mPacketID = buf_ptr[1] + ((buf_ptr[0] & 0x0f ) * 256); - if (sizeof(TPACKETID) == 4) - { - mPacketID *= 256; - mPacketID += buf_ptr[2]; - mPacketID *= 256; - mPacketID += buf_ptr[3]; - } - - mSocket = socket; - if (mRetries) - { - mBuffer = new U8[buf_len]; - if (mBuffer != NULL) - { - memcpy(mBuffer,buf_ptr,buf_len); /*Flawfinder: ignore*/ - mBufferLength = buf_len; - } - - } - }; - + LLReliablePacket( + S32 socket, + U8* buf_ptr, + S32 buf_len, + LLReliablePacketParams* params); ~LLReliablePacket() { mCallback = NULL; @@ -133,22 +76,21 @@ public: friend class LLCircuitData; protected: - S32 mSocket; - LLHost mHost; - S32 mRetries; - BOOL mPingBasedRetry; - F32 mTimeout; - void (*mCallback)(void **,S32); - void **mCallbackData; - char *mMessageName; - - U8 *mBuffer; - S32 mBufferLength; + S32 mSocket; + LLHost mHost; + S32 mRetries; + BOOL mPingBasedRetry; + F32 mTimeout; + void (*mCallback)(void**,S32); + void** mCallbackData; + char* mMessageName; + + U8* mBuffer; + S32 mBufferLength; - TPACKETID mPacketID; + TPACKETID mPacketID; - F64 mExpirationTime; - + F64 mExpirationTime; }; #endif diff --git a/indra/llmessage/llsdmessagebuilder.cpp b/indra/llmessage/llsdmessagebuilder.cpp index b7deb4817f..94d2378050 100755 --- a/indra/llmessage/llsdmessagebuilder.cpp +++ b/indra/llmessage/llsdmessagebuilder.cpp @@ -1,3 +1,11 @@ +/** + * @file llsdmessagebuilder.cpp + * @brief LLSDMessageBuilder class implementation. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + #include "linden_common.h" #include "llsdmessagebuilder.h" @@ -28,13 +36,13 @@ LLSDMessageBuilder::~LLSDMessageBuilder() // virtual -void LLSDMessageBuilder::newMessage(const char *name) +void LLSDMessageBuilder::newMessage(const char* name) { mbSBuilt = FALSE; mbSClear = FALSE; mCurrentMessage = LLSD::emptyMap(); - mCurrentMessageName = (char *)name; + mCurrentMessageName = (char*)name; } // virtual @@ -74,8 +82,10 @@ BOOL LLSDMessageBuilder::removeLastBlock() return FALSE; } -void LLSDMessageBuilder::addBinaryData(const char *varname, - const void *data, S32 size) +void LLSDMessageBuilder::addBinaryData( + const char* varname, + const void* data, + S32 size) { std::vector<U8> v; v.resize(size); @@ -83,57 +93,57 @@ void LLSDMessageBuilder::addBinaryData(const char *varname, (*mCurrentBlock)[varname] = v; } -void LLSDMessageBuilder::addS8(const char *varname, S8 v) +void LLSDMessageBuilder::addS8(const char* varname, S8 v) { (*mCurrentBlock)[varname] = v; } -void LLSDMessageBuilder::addU8(const char *varname, U8 v) +void LLSDMessageBuilder::addU8(const char* varname, U8 v) { (*mCurrentBlock)[varname] = v; } -void LLSDMessageBuilder::addS16(const char *varname, S16 v) +void LLSDMessageBuilder::addS16(const char* varname, S16 v) { (*mCurrentBlock)[varname] = v; } -void LLSDMessageBuilder::addU16(const char *varname, U16 v) +void LLSDMessageBuilder::addU16(const char* varname, U16 v) { (*mCurrentBlock)[varname] = v; } -void LLSDMessageBuilder::addF32(const char *varname, F32 v) +void LLSDMessageBuilder::addF32(const char* varname, F32 v) { (*mCurrentBlock)[varname] = v; } -void LLSDMessageBuilder::addS32(const char *varname, S32 v) +void LLSDMessageBuilder::addS32(const char* varname, S32 v) { (*mCurrentBlock)[varname] = v; } -void LLSDMessageBuilder::addU32(const char *varname, U32 v) +void LLSDMessageBuilder::addU32(const char* varname, U32 v) { (*mCurrentBlock)[varname] = ll_sd_from_U32(v); } -void LLSDMessageBuilder::addU64(const char *varname, U64 v) +void LLSDMessageBuilder::addU64(const char* varname, U64 v) { (*mCurrentBlock)[varname] = ll_sd_from_U64(v); } -void LLSDMessageBuilder::addF64(const char *varname, F64 v) +void LLSDMessageBuilder::addF64(const char* varname, F64 v) { (*mCurrentBlock)[varname] = v; } -void LLSDMessageBuilder::addIPAddr(const char *varname, U32 v) +void LLSDMessageBuilder::addIPAddr(const char* varname, U32 v) { (*mCurrentBlock)[varname] = ll_sd_from_ipaddr(v); } -void LLSDMessageBuilder::addIPPort(const char *varname, U16 v) +void LLSDMessageBuilder::addIPPort(const char* varname, U16 v) { (*mCurrentBlock)[varname] = v; } @@ -159,27 +169,27 @@ void LLSDMessageBuilder::addString(const char* varname, const std::string& v) (*mCurrentBlock)[varname] = ""; } -void LLSDMessageBuilder::addVector3(const char *varname, const LLVector3& v) +void LLSDMessageBuilder::addVector3(const char* varname, const LLVector3& v) { (*mCurrentBlock)[varname] = ll_sd_from_vector3(v); } -void LLSDMessageBuilder::addVector4(const char *varname, const LLVector4& v) +void LLSDMessageBuilder::addVector4(const char* varname, const LLVector4& v) { (*mCurrentBlock)[varname] = ll_sd_from_vector4(v); } -void LLSDMessageBuilder::addVector3d(const char *varname, const LLVector3d& v) +void LLSDMessageBuilder::addVector3d(const char* varname, const LLVector3d& v) { (*mCurrentBlock)[varname] = ll_sd_from_vector3d(v); } -void LLSDMessageBuilder::addQuat(const char *varname, const LLQuaternion& v) +void LLSDMessageBuilder::addQuat(const char* varname, const LLQuaternion& v) { (*mCurrentBlock)[varname] = ll_sd_from_quaternion(v); } -void LLSDMessageBuilder::addUUID(const char *varname, const LLUUID& v) +void LLSDMessageBuilder::addUUID(const char* varname, const LLUUID& v) { (*mCurrentBlock)[varname] = v; } @@ -193,9 +203,7 @@ BOOL LLSDMessageBuilder::isMessageFull(const char* blockname) const return FALSE; } -// make sure that all the desired data is in place and then copy the data -// into MAX_BUFFER_SIZEd buffer -U32 LLSDMessageBuilder::buildMessage(U8* buffer, U32 buffer_size) +U32 LLSDMessageBuilder::buildMessage(U8*, U32, U8) { return 0; } @@ -205,7 +213,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) // copy the blocks // counting variables used to encode multiple block info S32 block_count = 0; - char *block_name = NULL; + char* block_name = NULL; // loop through msg blocks to loop through variables, totalling up size // data and filling the new (send) message @@ -222,7 +230,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) if (block_count == 0) { block_count = mbci->mBlockNumber; - block_name = (char *)mbci->mName; + block_name = (char*)mbci->mName; } // counting down mutliple blocks @@ -248,7 +256,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) void LLSDMessageBuilder::copyFromLLSD(const LLSD& msg) { mCurrentMessage = msg; - llinfos << LLSDXMLStreamer(mCurrentMessage) << llendl; + lldebugs << LLSDXMLStreamer(mCurrentMessage) << llendl; } const LLSD& LLSDMessageBuilder::getMessage() const diff --git a/indra/llmessage/llsdmessagebuilder.h b/indra/llmessage/llsdmessagebuilder.h index f04194d12f..4e0d71fd8b 100755 --- a/indra/llmessage/llsdmessagebuilder.h +++ b/indra/llmessage/llsdmessagebuilder.h @@ -1,3 +1,11 @@ +/** + * @file llsdmessagebuilder.h + * @brief Declaration of LLSDMessageBuilder class. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + #ifndef LL_LLSDMESSAGEBUILDER_H #define LL_LLSDMESSAGEBUILDER_H @@ -19,31 +27,33 @@ public: LLSDMessageBuilder(); virtual ~LLSDMessageBuilder(); - virtual void newMessage(const char *name); + virtual void newMessage(const char* name); virtual void nextBlock(const char* blockname); virtual BOOL removeLastBlock(); // TODO: babbage: remove this horror... /** All add* methods expect pointers to canonical varname strings. */ - virtual void addBinaryData(const char *varname, const void *data, - S32 size); + virtual void addBinaryData( + const char* varname, + const void* data, + S32 size); virtual void addBOOL(const char* varname, BOOL b); - virtual void addS8(const char *varname, S8 s); - virtual void addU8(const char *varname, U8 u); - virtual void addS16(const char *varname, S16 i); - virtual void addU16(const char *varname, U16 i); - virtual void addF32(const char *varname, F32 f); - virtual void addS32(const char *varname, S32 s); - virtual void addU32(const char *varname, U32 u); - virtual void addU64(const char *varname, U64 lu); - virtual void addF64(const char *varname, F64 d); - virtual void addVector3(const char *varname, const LLVector3& vec); - virtual void addVector4(const char *varname, const LLVector4& vec); - virtual void addVector3d(const char *varname, const LLVector3d& vec); - virtual void addQuat(const char *varname, const LLQuaternion& quat); - virtual void addUUID(const char *varname, const LLUUID& uuid); - virtual void addIPAddr(const char *varname, const U32 ip); - virtual void addIPPort(const char *varname, const U16 port); + virtual void addS8(const char* varname, S8 s); + virtual void addU8(const char* varname, U8 u); + virtual void addS16(const char* varname, S16 i); + virtual void addU16(const char* varname, U16 i); + virtual void addF32(const char* varname, F32 f); + virtual void addS32(const char* varname, S32 s); + virtual void addU32(const char* varname, U32 u); + virtual void addU64(const char* varname, U64 lu); + virtual void addF64(const char* varname, F64 d); + virtual void addVector3(const char* varname, const LLVector3& vec); + virtual void addVector4(const char* varname, const LLVector4& vec); + virtual void addVector3d(const char* varname, const LLVector3d& vec); + virtual void addQuat(const char* varname, const LLQuaternion& quat); + virtual void addUUID(const char* varname, const LLUUID& uuid); + virtual void addIPAddr(const char* varname, const U32 ip); + virtual void addIPPort(const char* varname, const U16 port); virtual void addString(const char* varname, const char* s); virtual void addString(const char* varname, const std::string& s); @@ -52,8 +62,8 @@ public: virtual BOOL isBuilt() const; virtual BOOL isClear() const; - virtual U32 buildMessage(U8* buffer, U32 buffer_size); - /**< Return built message size */ + virtual U32 buildMessage(U8* buffer, U32 buffer_size, U8 offset_to_data); + /**< Null implementation which returns 0. */ virtual void clearMessage(); diff --git a/indra/llmessage/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp index 6312bee0ab..889cb305c2 100755 --- a/indra/llmessage/llsdmessagereader.cpp +++ b/indra/llmessage/llsdmessagereader.cpp @@ -1,7 +1,18 @@ +/** + * @file llsdmessagereader.cpp + * @brief LLSDMessageReader class implementation. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include "linden_common.h" + #include "llsdmessagereader.h" -#include "llsdutil.h" + #include "llmessagebuilder.h" #include "llsdmessagebuilder.h" +#include "llsdutil.h" LLSDMessageReader::LLSDMessageReader() { @@ -15,11 +26,30 @@ LLSDMessageReader::~LLSDMessageReader() LLSD getLLSD(const LLSD& input, const char* block, const char* var, S32 blocknum) { - if(input[block].isArray()) + // babbage: log error to llerrs if variable not found to mimic + // LLTemplateMessageReader::getData behaviour + if(NULL == block) + { + llerrs << "NULL block name" << llendl; + return LLSD(); + } + if(NULL == var) + { + llerrs << "NULL var name" << llendl; + return LLSD(); + } + if(! input[block].isArray()) + { + llerrs << "block " << block << " not found" << llendl; + return LLSD(); + } + + LLSD result = input[block][blocknum][var]; + if(result.isUndefined()) { - return input[block][blocknum][var]; + llerrs << "var " << var << " not found" << llendl; } - return LLSD(); + return result; } //virtual @@ -167,8 +197,12 @@ void LLSDMessageReader::getIPPort(const char *block, const char *var, void LLSDMessageReader::getString(const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum) { + if(buffer_size <= 0) + { + llwarns << "buffer_size <= 0" << llendl; + return; + } std::string data = getLLSD(mMessage, block, var, blocknum); - S32 data_size = data.size(); if (data_size >= buffer_size) { @@ -241,7 +275,7 @@ void LLSDMessageReader::clearMessage() //virtual const char* LLSDMessageReader::getMessageName() const { - return mMessageName.c_str(); + return mMessageName; } // virtual @@ -256,7 +290,7 @@ void LLSDMessageReader::copyToBuilder(LLMessageBuilder& builder) const builder.copyFromLLSD(mMessage); } -void LLSDMessageReader::setMessage(const std::string& name, const LLSD& message) +void LLSDMessageReader::setMessage(const char* name, const LLSD& message) { mMessageName = name; // TODO: Validate diff --git a/indra/llmessage/llsdmessagereader.h b/indra/llmessage/llsdmessagereader.h index 57851941a2..d6d9f3d2f9 100755 --- a/indra/llmessage/llsdmessagereader.h +++ b/indra/llmessage/llsdmessagereader.h @@ -69,10 +69,11 @@ public: virtual void copyToBuilder(LLMessageBuilder&) const; - void setMessage(const std::string& name, const LLSD& msg); + /** Expects a pointer to a canonical name string */ + void setMessage(const char* name, const LLSD& msg); private: - std::string mMessageName; + const char* mMessageName; // Canonical (prehashed) string. LLSD mMessage; }; diff --git a/indra/llmessage/lltemplatemessagebuilder.cpp b/indra/llmessage/lltemplatemessagebuilder.cpp index 806f03422d..18e96f26e4 100644 --- a/indra/llmessage/lltemplatemessagebuilder.cpp +++ b/indra/llmessage/lltemplatemessagebuilder.cpp @@ -1,3 +1,11 @@ +/** + * @file lltemplatemessagebuilder.cpp + * @brief LLTemplateMessageBuilder class implementation. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + #include "linden_common.h" #include "lltemplatemessagebuilder.h" @@ -41,28 +49,30 @@ void LLTemplateMessageBuilder::newMessage(const char *name) delete mCurrentSMessageData; mCurrentSMessageData = NULL; - char *namep = (char *)name; - + char* namep = (char*)name; if (mMessageTemplates.count(namep) > 0) { mCurrentSMessageTemplate = mMessageTemplates[namep]; - if (mCurrentSMessageData) - { - delete mCurrentSMessageData; - } mCurrentSMessageData = new LLMsgData(namep); mCurrentSMessageName = namep; mCurrentSDataBlock = NULL; mCurrentSBlockName = NULL; // add at one of each block - LLMessageTemplate* msg_template = mMessageTemplates[namep]; - for (LLMessageTemplate::message_block_map_t::iterator iter = msg_template->mMemberBlocks.begin(); - iter != msg_template->mMemberBlocks.end(); iter++) + const LLMessageTemplate* msg_template = mMessageTemplates[namep]; + + if (msg_template->getDeprecation() != MD_NOTDEPRECATED) { - LLMessageBlock* ci = iter->second; - LLMsgBlkData *tblockp; - tblockp = new LLMsgBlkData(ci->mName, 0); + llwarns << "Sending deprecated message " << namep << llendl; + } + + LLMessageTemplate::message_block_map_t::const_iterator iter; + for(iter = msg_template->mMemberBlocks.begin(); + iter != msg_template->mMemberBlocks.end(); + ++iter) + { + LLMessageBlock* ci = *iter; + LLMsgBlkData* tblockp = new LLMsgBlkData(ci->mName, 0); mCurrentSMessageData->addBlock(tblockp); } } @@ -102,16 +112,14 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname) } // now, does this block exist? - LLMessageTemplate::message_block_map_t::iterator temp_iter = mCurrentSMessageTemplate->mMemberBlocks.find(bnamep); - if (temp_iter == mCurrentSMessageTemplate->mMemberBlocks.end()) + const LLMessageBlock* template_data = mCurrentSMessageTemplate->getBlock(bnamep); + if (!template_data) { llerrs << "LLTemplateMessageBuilder::nextBlock " << bnamep << " not a block in " << mCurrentSMessageTemplate->mName << llendl; return; } - LLMessageBlock* template_data = temp_iter->second; - // ok, have we already set this block? LLMsgBlkData* block_data = mCurrentSMessageData->mMemberBlocks[bnamep]; if (block_data->mBlockNumber == 0) @@ -122,10 +130,10 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname) mCurrentSBlockName = bnamep; // add placeholders for each of the variables - for (LLMessageBlock::message_variable_map_t::iterator iter = template_data->mMemberVariables.begin(); + for (LLMessageBlock::message_variable_map_t::const_iterator iter = template_data->mMemberVariables.begin(); iter != template_data->mMemberVariables.end(); iter++) { - LLMessageVariable& ci = *(iter->second); + LLMessageVariable& ci = **iter; mCurrentSDataBlock->addVariable(ci.getName(), ci.getType()); } return; @@ -181,12 +189,12 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname) mCurrentSMessageData->mMemberBlocks[nbnamep] = mCurrentSDataBlock; // add placeholders for each of the variables - for (LLMessageBlock::message_variable_map_t::iterator + for (LLMessageBlock::message_variable_map_t::const_iterator iter = template_data->mMemberVariables.begin(), end = template_data->mMemberVariables.end(); iter != end; iter++) { - LLMessageVariable& ci = *(iter->second); + LLMessageVariable& ci = **iter; mCurrentSDataBlock->addVariable(ci.getName(), ci.getType()); } return; @@ -211,12 +219,12 @@ BOOL LLTemplateMessageBuilder::removeLastBlock() // Decrement the sent total by the size of the // data in the message block that we're currently building. - LLMessageBlock* template_data = mCurrentSMessageTemplate->mMemberBlocks[mCurrentSBlockName]; + const LLMessageBlock* template_data = mCurrentSMessageTemplate->getBlock(mCurrentSBlockName); - for (LLMessageBlock::message_variable_map_t::iterator iter = template_data->mMemberVariables.begin(); + for (LLMessageBlock::message_variable_map_t::const_iterator iter = template_data->mMemberVariables.begin(); iter != template_data->mMemberVariables.end(); iter++) { - LLMessageVariable& ci = *(iter->second); + LLMessageVariable& ci = **iter; mCurrentSendTotal -= ci.getSize(); } @@ -276,7 +284,7 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM } // kewl, add the data if it exists - LLMessageVariable* var_data = mCurrentSMessageTemplate->mMemberBlocks[mCurrentSBlockName]->mMemberVariables[vnamep]; + const LLMessageVariable* var_data = mCurrentSMessageTemplate->getBlock(mCurrentSBlockName)->getVariable(vnamep); if (!var_data || !var_data->getName()) { llerrs << vnamep << " not a variable in block " << mCurrentSBlockName << " of " << mCurrentSMessageTemplate->mName << llendl; @@ -336,7 +344,7 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM } // kewl, add the data if it exists - LLMessageVariable* var_data = mCurrentSMessageTemplate->mMemberBlocks[mCurrentSBlockName]->mMemberVariables[vnamep]; + const LLMessageVariable* var_data = mCurrentSMessageTemplate->getBlock(mCurrentSBlockName)->getVariable(vnamep); if (!var_data->getName()) { llerrs << vnamep << " not a variable in block " << mCurrentSBlockName << " of " << mCurrentSMessageTemplate->mName << llendl; @@ -484,7 +492,7 @@ static S32 zero_code(U8 **data, U32 *data_size) // skip the packet id field - for (U32 i=0;i<LL_PACKET_ID_SIZE;i++) + for (U32 ii = 0; ii < LL_PACKET_ID_SIZE ; ++ii) { count--; *outptr++ = *inptr++; @@ -571,7 +579,7 @@ BOOL LLTemplateMessageBuilder::isMessageFull(const char* blockname) const char* bnamep = (char*)blockname; S32 max; - LLMessageBlock* template_data = mCurrentSMessageTemplate->mMemberBlocks[bnamep]; + const LLMessageBlock* template_data = mCurrentSMessageTemplate->getBlock(bnamep); switch(template_data->mType) { @@ -593,138 +601,59 @@ BOOL LLTemplateMessageBuilder::isMessageFull(const char* blockname) const return FALSE; } - -// make sure that all the desired data is in place and then copy the data into MAX_BUFFER_SIZEd buffer -U32 LLTemplateMessageBuilder::buildMessage(U8* buffer, U32 buffer_size) +static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* template_data, LLMsgData* message_data) { - // basic algorithm is to loop through the various pieces, building - // size and offset info if we encounter a -1 for mSize at any - // point that variable wasn't given data - - // do we have a current message? - if (!mCurrentSMessageTemplate) - { - llerrs << "newMessage not called prior to buildMessage" << llendl; - return 0; - } - - // zero out some useful values - - // leave room for circuit counter - U32 result = LL_PACKET_ID_SIZE; - - // encode message number and adjust total_offset - if (mCurrentSMessageTemplate->mFrequency == MFT_HIGH) - { -// old, endian-dependant way -// memcpy(&buffer[result], &mCurrentMessageTemplate->mMessageNumber, sizeof(U8)); - -// new, independant way - buffer[result] = (U8)mCurrentSMessageTemplate->mMessageNumber; - result += sizeof(U8); - } - else if (mCurrentSMessageTemplate->mFrequency == MFT_MEDIUM) - { - U8 temp = 255; - memcpy(&buffer[result], &temp, sizeof(U8)); /*Flawfinder: ignore*/ - result += sizeof(U8); - - // mask off unsightly bits - temp = mCurrentSMessageTemplate->mMessageNumber & 255; - memcpy(&buffer[result], &temp, sizeof(U8)); /*Flawfinder: ignore*/ - result += sizeof(U8); - } - else if (mCurrentSMessageTemplate->mFrequency == MFT_LOW) - { - U8 temp = 255; - U16 message_num; - memcpy(&buffer[result], &temp, sizeof(U8)); /*Flawfinder: ignore*/ - result += sizeof(U8); - memcpy(&buffer[result], &temp, sizeof(U8)); /*Flawfinder: ignore*/ - result += sizeof(U8); - - // mask off unsightly bits - message_num = mCurrentSMessageTemplate->mMessageNumber & 0xFFFF; - - // convert to network byte order - message_num = htons(message_num); - memcpy(&buffer[result], &message_num, sizeof(U16)); /*Flawfinder: ignore*/ - result += sizeof(U16); - } - else - { - llerrs << "unexpected message frequency in buildMessage" << llendl; - return 0; + S32 result = 0; + LLMsgData::msg_blk_data_map_t::const_iterator block_iter = message_data->mMemberBlocks.find(template_data->mName); + const LLMsgBlkData* mbci = block_iter->second; + + // ok, if this is the first block of a repeating pack, set + // block_count and, if it's type MBT_VARIABLE encode a byte + // for how many there are + S32 block_count = mbci->mBlockNumber; + if (template_data->mType == MBT_VARIABLE) + { + // remember that mBlockNumber is a S32 + U8 temp_block_number = (U8)mbci->mBlockNumber; + if ((S32)(result + sizeof(U8)) < MAX_BUFFER_SIZE) + { + memcpy(&buffer[result], &temp_block_number, sizeof(U8)); + result += sizeof(U8); + } + else + { + // Just reporting error is likely not enough. Need + // to check how to abort or error out gracefully + // from this function. XXXTBD + llerrs << "buildBlock failed. Message excedding " + << "sendBuffersize." << llendl; + } } - - // counting variables used to encode multiple block info - S32 block_count = 0; - U8 temp_block_number; - - // loop through msg blocks to loop through variables, - // totalling up size data and copying into buffer - for (LLMsgData::msg_blk_data_map_t::iterator - iter = mCurrentSMessageData->mMemberBlocks.begin(), - end = mCurrentSMessageData->mMemberBlocks.end(); - iter != end; iter++) + else if (template_data->mType == MBT_MULTIPLE) { - LLMsgBlkData* mbci = iter->second; - // do we need to encode a block code? - if (block_count == 0) + if (block_count != template_data->mNumber) { - block_count = mbci->mBlockNumber; - - LLMessageBlock* template_data = - mCurrentSMessageTemplate->mMemberBlocks[mbci->mName]; - - // ok, if this is the first block of a repeating pack, set - // block_count and, if it's type MBT_VARIABLE encode a byte - // for how many there are - if (template_data->mType == MBT_VARIABLE) - { - // remember that mBlockNumber is a S32 - temp_block_number = (U8)mbci->mBlockNumber; - if ((S32)(result + sizeof(U8)) < MAX_BUFFER_SIZE) - { - memcpy(&buffer[result], &temp_block_number, sizeof(U8)); - result += sizeof(U8); - } - else - { - // Just reporting error is likely not enough. Need - // to check how to abort or error out gracefully - // from this function. XXXTBD - llerrs << "buildMessage failed. Message excedding " - << "sendBuffersize." << llendl; - } - } - else if (template_data->mType == MBT_MULTIPLE) - { - if (block_count != template_data->mNumber) - { - // nope! need to fill it in all the way! - llerrs << "Block " << mbci->mName - << " is type MBT_MULTIPLE but only has data for " - << block_count << " out of its " - << template_data->mNumber << " blocks" << llendl; - } - } + // nope! need to fill it in all the way! + llerrs << "Block " << mbci->mName + << " is type MBT_MULTIPLE but only has data for " + << block_count << " out of its " + << template_data->mNumber << " blocks" << llendl; } + } - // counting down multiple blocks - block_count--; - + while(block_count > 0) + { // now loop through the variables - for (LLMsgBlkData::msg_var_data_map_t::iterator iter = mbci->mMemberVarData.begin(); + for (LLMsgBlkData::msg_var_data_map_t::const_iterator iter = mbci->mMemberVarData.begin(); iter != mbci->mMemberVarData.end(); iter++) { - LLMsgVarData& mvci = *iter; + const LLMsgVarData& mvci = *iter; if (mvci.getSize() == -1) { // oops, this variable wasn't ever set! llerrs << "The variable " << mvci.getName() << " in block " << mbci->mName << " of message " - << mCurrentSMessageData->mName + << template_data->mName << " wasn't set prior to buildMessage call" << llendl; } else @@ -774,7 +703,7 @@ U32 LLTemplateMessageBuilder::buildMessage(U8* buffer, U32 buffer_size) // Just reporting error is likely not // enough. Need to check how to abort or error // out gracefully from this function. XXXTBD - llerrs << "LLMessageSystem::buildMessage failed. " + llerrs << "buildBlock failed. " << "Attempted to pack " << result + mvci.getSize() << " bytes into a buffer with size " @@ -783,6 +712,94 @@ U32 LLTemplateMessageBuilder::buildMessage(U8* buffer, U32 buffer_size) } } } + + --block_count; + ++block_iter; + if (block_iter != message_data->mMemberBlocks.end()) + { + mbci = block_iter->second; + } + } + + return result; +} + + +// make sure that all the desired data is in place and then copy the data into MAX_BUFFER_SIZEd buffer +U32 LLTemplateMessageBuilder::buildMessage( + U8* buffer, + U32 buffer_size, + U8 offset_to_data) +{ + // basic algorithm is to loop through the various pieces, building + // size and offset info if we encounter a -1 for mSize at any + // point that variable wasn't given data + + // do we have a current message? + if (!mCurrentSMessageTemplate) + { + llerrs << "newMessage not called prior to buildMessage" << llendl; + return 0; + } + + // leave room for flags, packet sequence #, and data offset + // information. + buffer[PHL_OFFSET] = offset_to_data; + U32 result = LL_PACKET_ID_SIZE; + + // encode message number and adjust total_offset + if (mCurrentSMessageTemplate->mFrequency == MFT_HIGH) + { +// old, endian-dependant way +// memcpy(&buffer[result], &mCurrentMessageTemplate->mMessageNumber, sizeof(U8)); + +// new, independant way + buffer[result] = (U8)mCurrentSMessageTemplate->mMessageNumber; + result += sizeof(U8); + } + else if (mCurrentSMessageTemplate->mFrequency == MFT_MEDIUM) + { + U8 temp = 255; + memcpy(&buffer[result], &temp, sizeof(U8)); /*Flawfinder: ignore*/ + result += sizeof(U8); + + // mask off unsightly bits + temp = mCurrentSMessageTemplate->mMessageNumber & 255; + memcpy(&buffer[result], &temp, sizeof(U8)); /*Flawfinder: ignore*/ + result += sizeof(U8); + } + else if (mCurrentSMessageTemplate->mFrequency == MFT_LOW) + { + U8 temp = 255; + U16 message_num; + memcpy(&buffer[result], &temp, sizeof(U8)); /*Flawfinder: ignore*/ + result += sizeof(U8); + memcpy(&buffer[result], &temp, sizeof(U8)); /*Flawfinder: ignore*/ + result += sizeof(U8); + + // mask off unsightly bits + message_num = mCurrentSMessageTemplate->mMessageNumber & 0xFFFF; + + // convert to network byte order + message_num = htons(message_num); + memcpy(&buffer[result], &message_num, sizeof(U16)); /*Flawfinder: ignore*/ + result += sizeof(U16); + } + else + { + llerrs << "unexpected message frequency in buildMessage" << llendl; + return 0; + } + + // fast forward through the offset and build the message + result += offset_to_data; + for(LLMessageTemplate::message_block_map_t::const_iterator + iter = mCurrentSMessageTemplate->mMemberBlocks.begin(), + end = mCurrentSMessageTemplate->mMemberBlocks.end(); + iter != end; + ++iter) + { + result += buildBlock(buffer + result, buffer_size - result, *iter, mCurrentSMessageData); } mbSBuilt = TRUE; diff --git a/indra/llmessage/lltemplatemessagebuilder.h b/indra/llmessage/lltemplatemessagebuilder.h index ae533288fb..6cc06ee0f3 100644 --- a/indra/llmessage/lltemplatemessagebuilder.h +++ b/indra/llmessage/lltemplatemessagebuilder.h @@ -1,3 +1,11 @@ +/** + * @file lltemplatemessagebuilder.h + * @brief Declaration of LLTemplateMessageBuilder class. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + #ifndef LL_LLTEMPLATEMESSAGEBUILDER_H #define LL_LLTEMPLATEMESSAGEBUILDER_H @@ -15,12 +23,12 @@ class LLTemplateMessageBuilder : public LLMessageBuilder { public: - typedef std::map<const char *, LLMessageTemplate*> message_template_name_map_t; + typedef std::map<const char* , LLMessageTemplate*> message_template_name_map_t; LLTemplateMessageBuilder(message_template_name_map_t&); virtual ~LLTemplateMessageBuilder(); - virtual void newMessage(const char *name); + virtual void newMessage(const char* name); virtual void nextBlock(const char* blockname); virtual BOOL removeLastBlock(); // TODO: babbage: remove this horror... @@ -29,22 +37,22 @@ public: virtual void addBinaryData(const char *varname, const void *data, S32 size); virtual void addBOOL(const char* varname, BOOL b); - virtual void addS8(const char *varname, S8 s); - virtual void addU8(const char *varname, U8 u); - virtual void addS16(const char *varname, S16 i); - virtual void addU16(const char *varname, U16 i); - virtual void addF32(const char *varname, F32 f); - virtual void addS32(const char *varname, S32 s); - virtual void addU32(const char *varname, U32 u); - virtual void addU64(const char *varname, U64 lu); - virtual void addF64(const char *varname, F64 d); - virtual void addVector3(const char *varname, const LLVector3& vec); - virtual void addVector4(const char *varname, const LLVector4& vec); - virtual void addVector3d(const char *varname, const LLVector3d& vec); - virtual void addQuat(const char *varname, const LLQuaternion& quat); - virtual void addUUID(const char *varname, const LLUUID& uuid); - virtual void addIPAddr(const char *varname, const U32 ip); - virtual void addIPPort(const char *varname, const U16 port); + virtual void addS8(const char* varname, S8 s); + virtual void addU8(const char* varname, U8 u); + virtual void addS16(const char* varname, S16 i); + virtual void addU16(const char* varname, U16 i); + virtual void addF32(const char* varname, F32 f); + virtual void addS32(const char* varname, S32 s); + virtual void addU32(const char* varname, U32 u); + virtual void addU64(const char* varname, U64 lu); + virtual void addF64(const char* varname, F64 d); + virtual void addVector3(const char* varname, const LLVector3& vec); + virtual void addVector4(const char* varname, const LLVector4& vec); + virtual void addVector3d(const char* varname, const LLVector3d& vec); + virtual void addQuat(const char* varname, const LLQuaternion& quat); + virtual void addUUID(const char* varname, const LLUUID& uuid); + virtual void addIPAddr(const char* varname, const U32 ip); + virtual void addIPPort(const char* varname, const U16 port); virtual void addString(const char* varname, const char* s); virtual void addString(const char* varname, const std::string& s); @@ -53,7 +61,7 @@ public: virtual BOOL isBuilt() const; virtual BOOL isClear() const; - virtual U32 buildMessage(U8* buffer, U32 buffer_size); + virtual U32 buildMessage(U8* buffer, U32 buffer_size, U8 offset_to_data); /**< Return built message size */ virtual void clearMessage(); @@ -68,14 +76,14 @@ public: virtual void copyFromLLSD(const LLSD&); private: - void addData(const char *varname, const void *data, + void addData(const char* varname, const void* data, EMsgVariableType type, S32 size); - void addData(const char *varname, const void *data, + void addData(const char* varname, const void* data, EMsgVariableType type); LLMsgData* mCurrentSMessageData; - LLMessageTemplate* mCurrentSMessageTemplate; + const LLMessageTemplate* mCurrentSMessageTemplate; LLMsgBlkData* mCurrentSDataBlock; char* mCurrentSMessageName; char* mCurrentSBlockName; diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index bb3f4f4a15..9015be7106 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -1,3 +1,11 @@ +/** + * @file lltemplatemessagereader.cpp + * @brief LLTemplateMessageReader class implementation. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + #include "lltemplatemessagereader.h" #include "llfasttimer.h" @@ -53,7 +61,7 @@ void LLTemplateMessageReader::getData(const char *blockname, const char *varname char *bnamep = (char *)blockname + blocknum; // this works because it's just a hash. The bnamep is never derefference char *vnamep = (char *)varname; - LLMsgData::msg_blk_data_map_t::iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep); + LLMsgData::msg_blk_data_map_t::const_iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep); if (iter == mCurrentRMessageData->mMemberBlocks.end()) { @@ -135,7 +143,7 @@ S32 LLTemplateMessageReader::getNumberOfBlocks(const char *blockname) char *bnamep = (char *)blockname; - LLMsgData::msg_blk_data_map_t::iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep); + LLMsgData::msg_blk_data_map_t::const_iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep); if (iter == mCurrentRMessageData->mMemberBlocks.end()) { @@ -165,7 +173,7 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname) char *bnamep = (char *)blockname; - LLMsgData::msg_blk_data_map_t::iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep); + LLMsgData::msg_blk_data_map_t::const_iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep); if (iter == mCurrentRMessageData->mMemberBlocks.end()) { @@ -214,7 +222,7 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const char *bnamep = (char *)blockname + blocknum; char *vnamep = (char *)varname; - LLMsgData::msg_blk_data_map_t::iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep); + LLMsgData::msg_blk_data_map_t::const_iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep); if (iter == mCurrentRMessageData->mMemberBlocks.end()) { @@ -497,16 +505,21 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender llassert( !mCurrentRMessageData ); delete mCurrentRMessageData; // just to make sure - S32 decode_pos = LL_PACKET_ID_SIZE + (S32)(mCurrentRMessageTemplate->mFrequency); + // The offset tells us how may bytes to skip after the end of the + // message name. + U8 offset = buffer[PHL_OFFSET]; + S32 decode_pos = LL_PACKET_ID_SIZE + (S32)(mCurrentRMessageTemplate->mFrequency) + offset; // create base working data set mCurrentRMessageData = new LLMsgData(mCurrentRMessageTemplate->mName); // loop through the template building the data structure as we go - for (LLMessageTemplate::message_block_map_t::iterator iter = mCurrentRMessageTemplate->mMemberBlocks.begin(); - iter != mCurrentRMessageTemplate->mMemberBlocks.end(); iter++) + LLMessageTemplate::message_block_map_t::const_iterator iter; + for(iter = mCurrentRMessageTemplate->mMemberBlocks.begin(); + iter != mCurrentRMessageTemplate->mMemberBlocks.end(); + ++iter) { - LLMessageBlock* mbci = iter->second; + LLMessageBlock* mbci = *iter; U8 repeat_number; S32 i; @@ -528,11 +541,16 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender // repeat number is a single byte if (decode_pos >= mReceiveSize) { - logRanOffEndOfPacket( sender ); - return FALSE; + logRanOffEndOfPacket(sender); + + // default to 0 repeats + repeat_number = 0; + } + else + { + repeat_number = buffer[decode_pos]; + decode_pos++; } - repeat_number = buffer[decode_pos]; - decode_pos++; } else { @@ -561,10 +579,12 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender mCurrentRMessageData->addBlock(cur_data_block); // now read the variables - for (LLMessageBlock::message_variable_map_t::iterator iter = mbci->mMemberVariables.begin(); + for (LLMessageBlock::message_variable_map_t::const_iterator iter = + mbci->mMemberVariables.begin(); iter != mbci->mMemberVariables.end(); iter++) { - LLMessageVariable& mvci = *(iter->second); + const LLMessageVariable& mvci = **iter; + // ok, build out the variables // add variable block cur_data_block->addVariable(mvci.getName(), mvci.getType()); @@ -580,34 +600,33 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender if ((decode_pos + data_size) > mReceiveSize) { - logRanOffEndOfPacket( sender ); - return FALSE; + logRanOffEndOfPacket(sender); + + // default to 0 length variable blocks + tsize = 0; } - switch(data_size) + else { - case 1: - htonmemcpy(&tsizeb, &buffer[decode_pos], MVT_U8, 1); - tsize = tsizeb; - break; - case 2: - htonmemcpy(&tsizeh, &buffer[decode_pos], MVT_U16, 2); - tsize = tsizeh; - break; - case 4: - htonmemcpy(&tsize, &buffer[decode_pos], MVT_U32, 4); - break; - default: - llerrs << "Attempting to read variable field with unknown size of " << data_size << llendl; - break; - + switch(data_size) + { + case 1: + htonmemcpy(&tsizeb, &buffer[decode_pos], MVT_U8, 1); + tsize = tsizeb; + break; + case 2: + htonmemcpy(&tsizeh, &buffer[decode_pos], MVT_U16, 2); + tsize = tsizeh; + break; + case 4: + htonmemcpy(&tsize, &buffer[decode_pos], MVT_U32, 4); + break; + default: + llerrs << "Attempting to read variable field with unknown size of " << data_size << llendl; + break; + } } decode_pos += data_size; - if ((decode_pos + (S32)tsize) > mReceiveSize) - { - logRanOffEndOfPacket( sender ); - return FALSE; - } cur_data_block->addData(mvci.getName(), &buffer[decode_pos], tsize, mvci.getType()); decode_pos += tsize; } @@ -615,14 +634,24 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender { // fixed! // so, copy data pointer and set data size to fixed size - if ((decode_pos + mvci.getSize()) > mReceiveSize) { - logRanOffEndOfPacket( sender ); - return FALSE; + logRanOffEndOfPacket(sender); + + // default to 0s. + U32 size = mvci.getSize(); + std::vector<U8> data(size); + memset(&(data[0]), 0, size); + cur_data_block->addData(mvci.getName(), &(data[0]), + size, mvci.getType()); + } + else + { + cur_data_block->addData(mvci.getName(), + &buffer[decode_pos], + mvci.getSize(), + mvci.getType()); } - - cur_data_block->addData(mvci.getName(), &buffer[decode_pos], mvci.getSize(), mvci.getType()); decode_pos += mvci.getSize(); } } @@ -644,11 +673,6 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender decode_timer.reset(); } - // if( mCurrentRMessageTemplate->mName == _PREHASH_AgentToNewRegion ) - // { - // VTResume(); // VTune - // } - { LLFastTimer t(LLFastTimer::FTM_PROCESS_MESSAGES); if( !mCurrentRMessageTemplate->callHandlerFunc(gMessageSystem) ) @@ -657,11 +681,6 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender } } - // if( mCurrentRMessageTemplate->mName == _PREHASH_AgentToNewRegion ) - // { - // VTPause(); // VTune - // } - if(LLMessageReader::getTimeDecodes() || gMessageSystem->getTimingCallback()) { F32 decode_time = decode_timer.getElapsedTimeF32(); @@ -723,8 +742,12 @@ BOOL LLTemplateMessageReader::readMessage(const U8* buffer, //virtual const char* LLTemplateMessageReader::getMessageName() const { - static char empty_string[] = ""; - return mCurrentRMessageTemplate ? mCurrentRMessageTemplate->mName : empty_string; + if (!mCurrentRMessageTemplate) + { + llwarns << "no mCurrentRMessageTemplate" << llendl; + return ""; + } + return mCurrentRMessageTemplate->mName; } //virtual diff --git a/indra/llmessage/lltemplatemessagereader.h b/indra/llmessage/lltemplatemessagereader.h index dd5ee393fe..ea8bd52298 100644 --- a/indra/llmessage/lltemplatemessagereader.h +++ b/indra/llmessage/lltemplatemessagereader.h @@ -1,3 +1,11 @@ +/** + * @file lltemplatemessagereader.h + * @brief Declaration of LLTemplateMessageReader class. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + #ifndef LL_LLTEMPLATEMESSAGEREADER_H #define LL_LLTEMPLATEMESSAGEREADER_H diff --git a/indra/llmessage/lltransfermanager.cpp b/indra/llmessage/lltransfermanager.cpp index 36553f8cf1..5b43ea1bad 100644 --- a/indra/llmessage/lltransfermanager.cpp +++ b/indra/llmessage/lltransfermanager.cpp @@ -581,34 +581,6 @@ void LLTransferManager::processTransferAbort(LLMessageSystem *msgp, void **) //static -void LLTransferManager::processTransferPriority(LLMessageSystem *msgp, void **) -{ - //llinfos << "LLTransferManager::processTransferPacket" << llendl; - - LLUUID transfer_id; - LLTransferChannelType channel_type; - F32 priority = 0.f; - msgp->getUUID("TransferInfo", "TransferID", transfer_id); - msgp->getS32("TransferInfo", "ChannelType", (S32 &)channel_type); - msgp->getF32("TransferInfo", "Priority", priority); - - // Hmm, not a target. Maybe it's a source. - LLTransferSourceChannel *tscp = gTransferManager.getSourceChannel(msgp->getSender(), channel_type); - if (tscp) - { - LLTransferSource *tsp = tscp->findTransferSource(transfer_id); - if (tsp) - { - tscp->updatePriority(tsp, priority); - return; - } - } - - llwarns << "Couldn't find transfer " << transfer_id << " to set priority!" << llendl; -} - - -//static void LLTransferManager::reliablePacketCallback(void **user_data, S32 result) { LLUUID *transfer_idp = (LLUUID *)user_data; diff --git a/indra/llmessage/lltransfermanager.h b/indra/llmessage/lltransfermanager.h index d258bd5f92..af2afa0f06 100644 --- a/indra/llmessage/lltransfermanager.h +++ b/indra/llmessage/lltransfermanager.h @@ -109,7 +109,6 @@ public: static void processTransferInfo(LLMessageSystem *mesgsys, void **); static void processTransferPacket(LLMessageSystem *mesgsys, void **); static void processTransferAbort(LLMessageSystem *mesgsys, void **); - static void processTransferPriority(LLMessageSystem *mesgsys, void **); static void reliablePacketCallback(void **, S32 result); diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index 456851a3ec..1a616d9e2b 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -47,9 +47,12 @@ #include "lltemplatemessagebuilder.h" #include "lltemplatemessagereader.h" #include "llmessagetemplate.h" +#include "llmessagetemplateparser.h" #include "llsd.h" #include "llsdmessagebuilder.h" #include "llsdmessagereader.h" +#include "llsdserialize.h" +#include "llstring.h" #include "lltransfermanager.h" #include "lluuid.h" #include "llxfermanager.h" @@ -80,220 +83,28 @@ public: apr_pollfd_t mPollFD; }; -// Lets support a small subset of regular expressions here -// Syntax is a string made up of: -// a - checks against alphanumeric ([A-Za-z0-9]) -// c - checks against character ([A-Za-z]) -// f - checks against first variable character ([A-Za-z_]) -// v - checks against variable ([A-Za-z0-9_]) -// s - checks against sign of integer ([-0-9]) -// d - checks against integer digit ([0-9]) -// * - repeat last check - -// checks 'a' -BOOL b_return_alphanumeric_ok(char c) -{ - if ( ( (c < 'A') - ||(c > 'Z')) - &&( (c < 'a') - ||(c > 'z')) - &&( (c < '0') - ||(c > '9'))) - { - return FALSE; - } - return TRUE; -} - -// checks 'c' -BOOL b_return_character_ok(char c) -{ - if ( ( (c < 'A') - ||(c > 'Z')) - &&( (c < 'a') - ||(c > 'z'))) - { - return FALSE; - } - return TRUE; -} - -// checks 'f' -BOOL b_return_first_variable_ok(char c) -{ - if ( ( (c < 'A') - ||(c > 'Z')) - &&( (c < 'a') - ||(c > 'z')) - &&(c != '_')) - { - return FALSE; - } - return TRUE; -} - -// checks 'v' -BOOL b_return_variable_ok(char c) -{ - if ( ( (c < 'A') - ||(c > 'Z')) - &&( (c < 'a') - ||(c > 'z')) - &&( (c < '0') - ||(c > '9')) - &&(c != '_')) - { - return FALSE; - } - return TRUE; -} - -// checks 's' -BOOL b_return_signed_integer_ok(char c) -{ - if ( ( (c < '0') - ||(c > '9')) - &&(c != '-')) - { - return FALSE; - } - return TRUE; -} - -// checks 'd' -BOOL b_return_integer_ok(char c) -{ - if ( (c < '0') - ||(c > '9')) - { - return FALSE; - } - return TRUE; -} - -BOOL (*gParseCheckCharacters[])(char c) = -{ - b_return_alphanumeric_ok, - b_return_character_ok, - b_return_first_variable_ok, - b_return_variable_ok, - b_return_signed_integer_ok, - b_return_integer_ok -}; - -S32 get_checker_number(char checker) -{ - switch(checker) - { - case 'a': - return 0; - case 'c': - return 1; - case 'f': - return 2; - case 'v': - return 3; - case 's': - return 4; - case 'd': - return 5; - case '*': - return 9999; - default: - return -1; - } -} - -// check token based on passed simplified regular expression -BOOL b_check_token(char *token, char *regexp) -{ - S32 tptr, rptr = 0; - S32 current_checker, next_checker = 0; - - current_checker = get_checker_number(regexp[rptr++]); - - if (current_checker == -1) - { - llerrs << "Invalid regular expression value!" << llendl; - return FALSE; - } - - if (current_checker == 9999) - { - llerrs << "Regular expression can't start with *!" << llendl; - return FALSE; - } - - for (tptr = 0; token[tptr]; tptr++) - { - if (current_checker == -1) - { - llerrs << "Input exceeds regular expression!\nDid you forget a *?" << llendl; - return FALSE; - } - - if (!gParseCheckCharacters[current_checker](token[tptr])) - { - return FALSE; - } - if (next_checker != 9999) - { - next_checker = get_checker_number(regexp[rptr++]); - if (next_checker != 9999) - { - current_checker = next_checker; - } - } - } - return TRUE; -} - -// C variable can be made up of upper or lower case letters, underscores, or numbers, but can't start with a number -BOOL b_variable_ok(char *token) -{ - if (!b_check_token(token, "fv*")) - { - llerrs << "Token '" << token << "' isn't a variable!" << llendl; - return FALSE; - } - return TRUE; -} - -// An integer is made up of the digits 0-9 and may be preceded by a '-' -BOOL b_integer_ok(char *token) -{ - if (!b_check_token(token, "sd*")) - { - llerrs << "Token isn't an integer!" << llendl; - return FALSE; - } - return TRUE; -} - -// An integer is made up of the digits 0-9 -BOOL b_positive_integer_ok(char *token) -{ - if (!b_check_token(token, "d*")) - { - llerrs << "Token isn't an integer!" << llendl; - return FALSE; - } - return TRUE; -} - namespace { class LLFnPtrResponder : public LLHTTPClient::Responder { + LOG_CLASS(LLFnPtrResponder); public: - LLFnPtrResponder(void (*callback)(void **,S32), void **callbackData) : + LLFnPtrResponder(void (*callback)(void **,S32), void **callbackData, const std::string& name) : mCallback(callback), - mCallbackData(callbackData) + mCallbackData(callbackData), + mMessageName(name) { } virtual void error(U32 status, const std::string& reason) { + // don't spam when agent communication disconnected already + if (status != 410) + { + llwarns << "error status " << status + << " for message " << mMessageName + << " reason " << reason << llendl; + } // TODO: Map status in to useful error code. if(NULL != mCallback) mCallback(mCallbackData, LL_ERR_TCP_TIMEOUT); } @@ -307,6 +118,7 @@ namespace void (*mCallback)(void **,S32); void **mCallbackData; + std::string mMessageName; }; } @@ -332,10 +144,28 @@ void LLTrustedMessageService::post(LLHTTPNode::ResponsePtr response, ["x-secondlife-udp-listen-port"]; LLSD message_data; - message_data["sender"] = senderIP + ":" + senderPort; + std::string sender = senderIP + ":" + senderPort; + message_data["sender"] = sender; message_data["body"] = input; - LLMessageSystem::dispatch(name, message_data, response); + // untrusted senders should not have access to the trusted message + // service, but this can happen in development, so check and warn + LLMessageConfig::SenderTrust trust = + LLMessageConfig::getSenderTrustedness(name); + if ((trust == LLMessageConfig::TRUSTED || + (trust == LLMessageConfig::NOT_SET && + gMessageSystem->isTrustedMessage(name))) + && !gMessageSystem->isTrustedSender(LLHost(sender))) + { + llwarns << "trusted message POST to /trusted-message/" + << name << " from unknown or untrusted sender " + << sender << llendl; + response->status(403, "Unknown or untrusted sender"); + } + else + { + LLMessageSystem::dispatch(name, message_data, response); + } } class LLMessageHandlerBridge : public LLHTTPNode @@ -352,14 +182,15 @@ void LLMessageHandlerBridge::post(LLHTTPNode::ResponsePtr response, const LLSD& context, const LLSD& input) const { std::string name = context["request"]["wildcard"]["message-name"]; - + char* namePtr = gMessageStringTable.getString(name.c_str()); + lldebugs << "Setting mLastSender " << input["sender"].asString() << llendl; gMessageSystem->mLastSender = LLHost(input["sender"].asString()); gMessageSystem->mPacketsIn += 1; - gMessageSystem->mLLSDMessageReader->setMessage(name, input["body"]); + gMessageSystem->mLLSDMessageReader->setMessage(namePtr, input["body"]); gMessageSystem->mMessageReader = gMessageSystem->mLLSDMessageReader; - if(gMessageSystem->callHandler(name.c_str(), false, gMessageSystem)) + if(gMessageSystem->callHandler(namePtr, false, gMessageSystem)) { response->result(LLSD()); } @@ -381,6 +212,12 @@ LLUseCircuitCodeResponder::~LLUseCircuitCodeResponder() // even abstract base classes need a concrete destructor } +static const char* nullToEmpty(const char* s) +{ + static char emptyString[] = ""; + return s? s : emptyString; +} + void LLMessageSystem::init() { // initialize member variables @@ -420,7 +257,6 @@ void LLMessageSystem::init() mIncomingCompressedSize = 0; mCurrentRecvPacketID = 0; - mMessageFileChecksum = 0; mMessageFileVersionNumber = 0.f; mTimingCallback = NULL; @@ -434,9 +270,7 @@ void LLMessageSystem::init() LLMessageSystem::LLMessageSystem(const char *filename, U32 port, S32 version_major, S32 version_minor, - S32 version_patch) : - mTemplateConfirmed(FALSE), - mTemplateMatches(FALSE) + S32 version_patch) { init(); @@ -509,6 +343,8 @@ LLMessageSystem::LLMessageSystem(const char *filename, U32 port, mTrueReceiveSize = 0; } + + // Read file and build message templates void LLMessageSystem::loadTemplateFile(const char* filename) { @@ -519,797 +355,23 @@ void LLMessageSystem::loadTemplateFile(const char* filename) return; } - char token[MAX_MESSAGE_INTERNAL_NAME_SIZE]; /* Flawfinder: ignore */ - - // state variables - BOOL b_template_start = TRUE; - BOOL b_template_end = FALSE; - BOOL b_template = FALSE; - BOOL b_block_start = FALSE; - BOOL b_block_end = FALSE; - BOOL b_block = FALSE; - BOOL b_variable_start = FALSE; - BOOL b_variable_end = FALSE; - BOOL b_variable = FALSE; - //BOOL b_in_comment_block = FALSE; // not yet used - - // working temp variables - LLMessageTemplate *templatep = NULL; - char template_name[MAX_MESSAGE_INTERNAL_NAME_SIZE]; /* Flawfinder: ignore */ - - LLMessageBlock *blockp = NULL; - char block_name[MAX_MESSAGE_INTERNAL_NAME_SIZE]; /* Flawfinder: ignore */ - - LLMessageVariable var; - char var_name[MAX_MESSAGE_INTERNAL_NAME_SIZE]; /* Flawfinder: ignore */ - char formatString[MAX_MESSAGE_INTERNAL_NAME_SIZE]; /* Flawfinder: ignore */ - - FILE* messagefilep = NULL; - mMessageFileChecksum = 0; - mMessageFileVersionNumber = 0.f; - S32 checksum_offset = 0; - char* checkp = NULL; - - // scanf needs 1 byte more than width, thus the MAX_... -1. - snprintf( /* Flawfinder: ignore */ - formatString, - sizeof(formatString), - "%%%ds", - MAX_MESSAGE_INTERNAL_NAME_SIZE - 1); - messagefilep = LLFile::fopen(filename, "r"); /* Flawfinder: ignore */ - if (messagefilep) - { -// mName = gMessageStringTable.getString(filename); - - fseek(messagefilep, 0L, SEEK_SET ); - while(fscanf(messagefilep, formatString, token) != EOF) /* Flawfinder: ignore */ - { - // skip comments - if (token[0] == '/') - { - // skip to end of line - while (token[0] != 10) - fscanf(messagefilep, "%c", token); - continue; - } - - checkp = token; - - while (*checkp) - { - mMessageFileChecksum += ((U32)*checkp++) << checksum_offset; - checksum_offset = (checksum_offset + 8) % 32; - } - - // what are we looking for - if (!strcmp(token, "{")) - { - // is that a legit option? - if (b_template_start) - { - // yup! - b_template_start = FALSE; - - // remember that it could be only a signal message, so name is all that it contains - b_template_end = TRUE; - - // start working on it! - b_template = TRUE; - } - else if (b_block_start) - { - // yup! - b_block_start = FALSE; - b_template_end = FALSE; - - // start working on it! - b_block = TRUE; - } - else if (b_variable_start) - { - // yup! - b_variable_start = FALSE; - b_block_end = FALSE; - - // start working on it! - b_variable = TRUE; - } - else - { - llerrs << "Detcted unexpected token '" << token - << "' while parsing template." << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - } - - if (!strcmp(token, "}")) - { - // is that a legit option? - if (b_template_end) - { - // yup! - b_template_end = FALSE; - b_template = FALSE; - b_block_start = FALSE; - - // add data! - // we've gotten a complete variable! hooray! - // add it! - if (NULL == templatep) - { - llerrs << "Trying to addTemplate a NULL templatep during load." << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - addTemplate(templatep); - - //llinfos << "Read template: "templatep->mNametemp_str - // << llendl; - - // look for next one! - b_template_start = TRUE; - } - else if (b_block_end) - { - // yup! - b_block_end = FALSE; - b_variable_start = FALSE; - - // add data! - // we've gotten a complete variable! hooray! - // add it to template - if (NULL == templatep) - { - llerrs << "Trying to addBlock to NULL templatep during load." << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - templatep->addBlock(blockp); - - // start working on it! - b_template_end = TRUE; - b_block_start = TRUE; - } - else if (b_variable_end) - { - // yup! - b_variable_end = FALSE; - - // add data! - // we've gotten a complete variable! hooray! - // add it to block - blockp->addVariable(var.getName(), var.getType(), var.getSize()); - - // start working on it! - b_variable_start = TRUE; - b_block_end = TRUE; - } - else - { - llerrs << "Detcted unexpected token '" << token - << "' while parsing template." << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - } - - // now, are we looking to start a template? - if (b_template) - { - - b_template = FALSE; - - // name first - if (fscanf(messagefilep, formatString, template_name) == EOF) /* Flawfinder: ignore */ - { - // oops, file ended - llerrs << "Expected message template name, but file ended" - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - // debugging to help figure out busted templates - //llinfos << template_name << llendl; - - // is name a legit C variable name - if (!b_variable_ok(template_name)) - { - // nope! - llerrs << "Not legal message template name: " - << template_name << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - checkp = template_name; - while (*checkp) - { - mMessageFileChecksum += ((U32)*checkp++) << checksum_offset; - checksum_offset = (checksum_offset + 8) % 32; - } - - // ok, now get Frequency ("High", "Medium", or "Low") - if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */ - { - // oops, file ended - llerrs << "Expected message template frequency, found EOF." - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - checkp = token; - while (*checkp) - { - mMessageFileChecksum += ((U32)*checkp++) << checksum_offset; - checksum_offset = (checksum_offset + 8) % 32; - } - - // which one is it? - if (!strcmp(token, "High")) - { - if (++mNumberHighFreqMessages == 255) - { - // oops, too many High Frequency messages!! - llerrs << "Message " << template_name - << " exceeded 254 High frequency messages!" - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - // ok, we can create a template! - // message number is just mNumberHighFreqMessages - templatep = new LLMessageTemplate(template_name, mNumberHighFreqMessages, MFT_HIGH); - //lldebugs << "Template " << template_name << " # " - // << std::hex << mNumberHighFreqMessages - // << std::dec << " high" - // << llendl; - } - else if (!strcmp(token, "Medium")) - { - if (++mNumberMediumFreqMessages == 255) - { - // oops, too many Medium Frequency messages!! - llerrs << "Message " << template_name - << " exceeded 254 Medium frequency messages!" - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - // ok, we can create a template! - // message number is ((255 << 8) | mNumberMediumFreqMessages) - templatep = new LLMessageTemplate(template_name, (255 << 8) | mNumberMediumFreqMessages, MFT_MEDIUM); - //lldebugs << "Template " << template_name << " # " - // << std::hex << mNumberMediumFreqMessages - // << std::dec << " medium" - // << llendl; - } - else if (!strcmp(token, "Low")) - { - if (++mNumberLowFreqMessages == 65535) - { - // oops, too many High Frequency messages!! - llerrs << "Message " << template_name - << " exceeded 65534 Low frequency messages!" - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - // ok, we can create a template! - // message number is ((255 << 24) | (255 << 16) | mNumberLowFreqMessages) - templatep = new LLMessageTemplate(template_name, (255 << 24) | (255 << 16) | mNumberLowFreqMessages, MFT_LOW); - //lldebugs << "Template " << template_name << " # " - // << std::hex << mNumberLowFreqMessages - // << std::dec << " low" - // << llendl; - } - else if (!strcmp(token, "Fixed")) - { - U32 message_num = 0; - if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */ - { - // oops, file ended - llerrs << "Expected message template number (fixed)," - << " found EOF." << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - checkp = token; - while (*checkp) - { - mMessageFileChecksum += ((U32)*checkp++) << checksum_offset; - checksum_offset = (checksum_offset + 8) % 32; - } - - message_num = strtoul(token,NULL,0); - - // ok, we can create a template! - // message number is ((255 << 24) | (255 << 16) | mNumberLowFreqMessages) - templatep = new LLMessageTemplate(template_name, message_num, MFT_LOW); - } - else - { - // oops, bad frequency line - llerrs << "Bad frequency! " << token - << " isn't High, Medium, or Low" << llendl - mbError = TRUE; - fclose(messagefilep); - return; - } - - // Now get trust ("Trusted", "NotTrusted") - if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */ - { - // File ended - llerrs << "Expected message template " - "trust, but file ended." - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - checkp = token; - while (*checkp) - { - mMessageFileChecksum += ((U32) *checkp++) << checksum_offset; - checksum_offset = (checksum_offset + 8) % 32; - } - - if (strcmp(token, "Trusted") == 0) - { - if (NULL == templatep) - { - llerrs << "Trying to setTrust for NULL templatep during load." << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - templatep->setTrust(MT_TRUST); - } - else if (strcmp(token, "NotTrusted") == 0) - { - if (NULL == templatep) - { - llerrs << "Trying to setTrust for NULL templatep during load." << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - templatep->setTrust(MT_NOTRUST); - } - else - { - // bad trust token - llerrs << "bad trust: " << token - << " isn't Trusted or NotTrusted" - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - // get encoding - if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */ - { - // File ended - llerrs << "Expected message encoding, but file ended." - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - checkp = token; - while(*checkp) - { - mMessageFileChecksum += ((U32) *checkp++) << checksum_offset; - checksum_offset = (checksum_offset + 8) % 32; - } - - if(0 == strcmp(token, "Unencoded")) - { - if (NULL == templatep) - { - llerrs << "Trying to setEncoding for NULL templatep during load." << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - templatep->setEncoding(ME_UNENCODED); - } - else if(0 == strcmp(token, "Zerocoded")) - { - if (NULL == templatep) - { - llerrs << "Trying to setEncoding for NULL templatep during load." << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - templatep->setEncoding(ME_ZEROCODED); - } - else - { - // bad trust token - llerrs << "bad encoding: " << token - << " isn't Unencoded or Zerocoded" << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - // ok, now we need to look for a block - b_block_start = TRUE; - continue; - } - - // now, are we looking to start a template? - if (b_block) - { - b_block = FALSE; - // ok, need to pull header info - - // name first - if (fscanf(messagefilep, formatString, block_name) == EOF) /* Flawfinder: ignore */ - { - // oops, file ended - llerrs << "Expected block name, but file ended" << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - checkp = block_name; - while (*checkp) - { - mMessageFileChecksum += ((U32)*checkp++) << checksum_offset; - checksum_offset = (checksum_offset + 8) % 32; - } - - // is name a legit C variable name - if (!b_variable_ok(block_name)) - { - // nope! - llerrs << block_name << "is not a legal block name" - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - // now, block type ("Single", "Multiple", or "Variable") - if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */ - { - // oops, file ended - llerrs << "Expected block type, but file ended." << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - checkp = token; - while (*checkp) - { - mMessageFileChecksum += ((U32)*checkp++) << checksum_offset; - checksum_offset = (checksum_offset + 8) % 32; - } - - // which one is it? - if (!strcmp(token, "Single")) - { - // ok, we can create a block - blockp = new LLMessageBlock(block_name, MBT_SINGLE); - } - else if (!strcmp(token, "Multiple")) - { - // need to get the number of repeats - if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */ - { - // oops, file ended - llerrs << "Expected block multiple count," - " but file ended." << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - checkp = token; - while (*checkp) - { - mMessageFileChecksum += ((U32)*checkp++) << checksum_offset; - checksum_offset = (checksum_offset + 8) % 32; - } - - // is it a legal integer - if (!b_positive_integer_ok(token)) - { - // nope! - llerrs << token << "is not a legal integer for" - " block multiple count" << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - // ok, we can create a block - blockp = new LLMessageBlock(block_name, MBT_MULTIPLE, atoi(token)); - } - else if (!strcmp(token, "Variable")) - { - // ok, we can create a block - blockp = new LLMessageBlock(block_name, MBT_VARIABLE); - } - else - { - // oops, bad block type - llerrs << "Bad block type! " << token - << " isn't Single, Multiple, or Variable" << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - // ok, now we need to look for a variable - b_variable_start = TRUE; - continue; - } - - // now, are we looking to start a template? - if (b_variable) - { - b_variable = FALSE; - // ok, need to pull header info - - // name first - if (fscanf(messagefilep, formatString, var_name) == EOF) /* Flawfinder: ignore */ - { - // oops, file ended - llerrs << "Expected variable name, but file ended." - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - checkp = var_name; - while (*checkp) - { - mMessageFileChecksum += ((U32)*checkp++) << checksum_offset; - checksum_offset = (checksum_offset + 8) % 32; - } - - // is name a legit C variable name - if (!b_variable_ok(var_name)) - { - // nope! - llerrs << var_name << " is not a legal variable name" - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - // now, variable type ("Fixed" or "Variable") - if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */ - { - // oops, file ended - llerrs << "Expected variable type, but file ended" - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - checkp = token; - while (*checkp) - { - mMessageFileChecksum += ((U32)*checkp++) << checksum_offset; - checksum_offset = (checksum_offset + 8) % 32; - } - - - // which one is it? - if (!strcmp(token, "U8")) - { - var = LLMessageVariable(var_name, MVT_U8, 1); - } - else if (!strcmp(token, "U16")) - { - var = LLMessageVariable(var_name, MVT_U16, 2); - } - else if (!strcmp(token, "U32")) - { - var = LLMessageVariable(var_name, MVT_U32, 4); - } - else if (!strcmp(token, "U64")) - { - var = LLMessageVariable(var_name, MVT_U64, 8); - } - else if (!strcmp(token, "S8")) - { - var = LLMessageVariable(var_name, MVT_S8, 1); - } - else if (!strcmp(token, "S16")) - { - var = LLMessageVariable(var_name, MVT_S16, 2); - } - else if (!strcmp(token, "S32")) - { - var = LLMessageVariable(var_name, MVT_S32, 4); - } - else if (!strcmp(token, "S64")) - { - var = LLMessageVariable(var_name, MVT_S64, 8); - } - else if (!strcmp(token, "F32")) - { - var = LLMessageVariable(var_name, MVT_F32, 4); - } - else if (!strcmp(token, "F64")) - { - var = LLMessageVariable(var_name, MVT_F64, 8); - } - else if (!strcmp(token, "LLVector3")) - { - var = LLMessageVariable(var_name, MVT_LLVector3, 12); - } - else if (!strcmp(token, "LLVector3d")) - { - var = LLMessageVariable(var_name, MVT_LLVector3d, 24); - } - else if (!strcmp(token, "LLVector4")) - { - var = LLMessageVariable(var_name, MVT_LLVector4, 16); - } - else if (!strcmp(token, "LLQuaternion")) - { - var = LLMessageVariable(var_name, MVT_LLQuaternion, 12); - } - else if (!strcmp(token, "LLUUID")) - { - var = LLMessageVariable(var_name, MVT_LLUUID, 16); - } - else if (!strcmp(token, "BOOL")) - { - var = LLMessageVariable(var_name, MVT_BOOL, 1); - } - else if (!strcmp(token, "IPADDR")) - { - var = LLMessageVariable(var_name, MVT_IP_ADDR, 4); - } - else if (!strcmp(token, "IPPORT")) - { - var = LLMessageVariable(var_name, MVT_IP_PORT, 2); - } - else if (!strcmp(token, "Fixed")) - { - // need to get the variable size - if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */ - { - // oops, file ended - llerrs << "Expected variable size, but file ended" - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - checkp = token; - while (*checkp) - { - mMessageFileChecksum += ((U32)*checkp++) << checksum_offset; - checksum_offset = (checksum_offset + 8) % 32; - } - - // is it a legal integer - if (!b_positive_integer_ok(token)) - { - // nope! - llerrs << token << " is not a legal integer for" - " variable size" << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - // ok, we can create a block - var = LLMessageVariable(var_name, MVT_FIXED, atoi(token)); - } - else if (!strcmp(token, "Variable")) - { - // need to get the variable size - if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */ - { - // oops, file ended - llerrs << "Expected variable size, but file ended" - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - checkp = token; - while (*checkp) - { - mMessageFileChecksum += ((U32)*checkp++) << checksum_offset; - checksum_offset = (checksum_offset + 8) % 32; - } - - // is it a legal integer - if (!b_positive_integer_ok(token)) - { - // nope! - llerrs << token << "is not a legal integer" - " for variable size" << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - // ok, we can create a block - var = LLMessageVariable(var_name, MVT_VARIABLE, atoi(token)); - } - else - { - // oops, bad variable type - llerrs << "Bad variable type! " << token - << " isn't Fixed or Variable" << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - // we got us a variable! - b_variable_end = TRUE; - continue; - } - - // do we have a version number stuck in the file? - if (!strcmp(token, "version")) - { - // version number - if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */ - { - // oops, file ended - llerrs << "Expected version number, but file ended" - << llendl; - mbError = TRUE; - fclose(messagefilep); - return; - } - - checkp = token; - while (*checkp) - { - mMessageFileChecksum += ((U32)*checkp++) << checksum_offset; - checksum_offset = (checksum_offset + 8) % 32; - } - - mMessageFileVersionNumber = (F32)atof(token); - -// llinfos << "### Message template version " << mMessageFileVersionNumber << " ###" << llendl; - continue; - } - } - - llinfos << "Message template checksum = " << std::hex << mMessageFileChecksum << std::dec << llendl; - } - else + LLString template_body; + if(!LLString::read(template_body, filename)) { llwarns << "Failed to open template: " << filename << llendl; mbError = TRUE; return; } - fclose(messagefilep); + + LLTemplateTokenizer tokens(template_body); + LLTemplateParser parsed(tokens); + mMessageFileVersionNumber = parsed.getVersion(); + for(LLTemplateParser::message_iterator iter = parsed.getMessagesBegin(); + iter != parsed.getMessagesEnd(); + iter++) + { + addTemplate(*iter); + } } @@ -1373,6 +435,94 @@ BOOL LLMessageSystem::poll(F32 seconds) } } +bool LLMessageSystem::isTrustedSender(const LLHost& host) const +{ + LLCircuitData* cdp = mCircuitInfo.findCircuit(host); + if(NULL == cdp) + { + return false; + } + return cdp->getTrusted(); +} + +static LLMessageSystem::message_template_name_map_t::const_iterator +findTemplate(const LLMessageSystem::message_template_name_map_t& templates, + std::string name) +{ + const char* namePrehash = gMessageStringTable.getString(name.c_str()); + if(NULL == namePrehash) {return templates.end();} + return templates.find(namePrehash); +} + +bool LLMessageSystem::isTrustedMessage(const std::string& name) const +{ + message_template_name_map_t::const_iterator iter = + findTemplate(mMessageTemplates, name); + if(iter == mMessageTemplates.end()) {return false;} + return iter->second->getTrust() == MT_TRUST; +} + +bool LLMessageSystem::isUntrustedMessage(const std::string& name) const +{ + message_template_name_map_t::const_iterator iter = + findTemplate(mMessageTemplates, name); + if(iter == mMessageTemplates.end()) {return false;} + return iter->second->getTrust() == MT_NOTRUST; +} + +LLCircuitData* LLMessageSystem::findCircuit(const LLHost& host, + bool resetPacketId) +{ + LLCircuitData* cdp = mCircuitInfo.findCircuit(host); + if (!cdp) + { + // This packet comes from a circuit we don't know about. + + // Are we rejecting off-circuit packets? + if (mbProtected) + { + // cdp is already NULL, so we don't need to unset it. + } + else + { + // nope, open the new circuit + cdp = mCircuitInfo.addCircuitData(host, mCurrentRecvPacketID); + + if(resetPacketId) + { + // I added this - I think it's correct - DJS + // reset packet in ID + cdp->setPacketInID(mCurrentRecvPacketID); + } + // And claim the packet is on the circuit we just added. + } + } + else + { + // this is an old circuit. . . is it still alive? + if (!cdp->isAlive()) + { + // nope. don't accept if we're protected + if (mbProtected) + { + // don't accept packets from unexpected sources + cdp = NULL; + } + else + { + // wake up the circuit + cdp->setAlive(TRUE); + + if(resetPacketId) + { + // reset packet in ID + cdp->setPacketInID(mCurrentRecvPacketID); + } + } + } + } + return cdp; +} // Returns TRUE if a valid, on-circuit message has been received. BOOL LLMessageSystem::checkMessages( S64 frame_count ) @@ -1451,71 +601,12 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) } // process the message as normal - - mIncomingCompressedSize = zeroCodeExpand(&buffer,&receive_size); - mCurrentRecvPacketID = buffer[1] + ((buffer[0] & 0x0f ) * 256); - if (sizeof(TPACKETID) == 4) - { - mCurrentRecvPacketID *= 256; - mCurrentRecvPacketID += buffer[2]; - mCurrentRecvPacketID *= 256; - mCurrentRecvPacketID += buffer[3]; - } - + mIncomingCompressedSize = zeroCodeExpand(&buffer, &receive_size); + mCurrentRecvPacketID = ntohl(*((U32*)(&buffer[1]))); host = getSender(); - //llinfos << host << ":" << mCurrentRecvPacketID << llendl; - // For testing the weird case we're having in the office where the first few packets - // on a connection get dropped - //if ((mCurrentRecvPacketID < 8) && !(buffer[0] & LL_RESENT_FLAG)) - //{ - // llinfos << "Evil! Dropping " << mCurrentRecvPacketID << " from " << host << " for fun!" << llendl; - // continue; - //} - - cdp = mCircuitInfo.findCircuit(host); - if (!cdp) - { - // This packet comes from a circuit we don't know about. - - // Are we rejecting off-circuit packets? - if (mbProtected) - { - // cdp is already NULL, so we don't need to unset it. - } - else - { - // nope, open the new circuit - cdp = mCircuitInfo.addCircuitData(host, mCurrentRecvPacketID); - - // I added this - I think it's correct - DJS - // reset packet in ID - cdp->setPacketInID(mCurrentRecvPacketID); - - // And claim the packet is on the circuit we just added. - } - } - else - { - // this is an old circuit. . . is it still alive? - if (!cdp->isAlive()) - { - // nope. don't accept if we're protected - if (mbProtected) - { - // don't accept packets from unexpected sources - cdp = NULL; - } - else - { - // wake up the circuit - cdp->setAlive(TRUE); - - // reset packet in ID - cdp->setPacketInID(mCurrentRecvPacketID); - } - } - } + const bool resetPacketId = true; + cdp = findCircuit(host, resetPacketId); // At this point, cdp is now a pointer to the circuit that // this message came in on if it's valid, and NULL if the @@ -1644,6 +735,10 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) if (valid_packet) { + // enable this for output of message names + //llinfos << "< \"" << mTemplateMessageReader->getMessageName() + //<< "\"" << llendl; + /* Code for dumping the complete contents of a message. Keep for future use in optimizing messages. if( 1 ) { @@ -1748,9 +843,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) { if (mbProtected && (!cdp)) { - llwarns << "Packet " - << mTemplateMessageReader->getMessageName() - << " from invalid circuit " << host << llendl; + llwarns << "Invalid Packet from invalid circuit " << host << llendl; mOffCircuitPackets++; } else @@ -2031,15 +1124,34 @@ S32 LLMessageSystem::flushReliable(const LLHost &host) return send_bytes; } - +LLHTTPClient::ResponderPtr LLMessageSystem::createResponder(const std::string& name) +{ + if(mSendReliable) + { + return new LLFnPtrResponder(mReliablePacketParams.mCallback, + mReliablePacketParams.mCallbackData, + name); + } + else + { + llwarns << "LLMessageSystem::sendMessage: Sending unreliable " + << mMessageBuilder->getMessageName() << " message via HTTP" + << llendl; + return new LLFnPtrResponder(NULL, NULL, + mMessageBuilder->getMessageName()); + } +} + // This can be called from signal handlers, // so should should not use llinfos. S32 LLMessageSystem::sendMessage(const LLHost &host) { if (! mMessageBuilder->isBuilt()) { - mSendSize = mMessageBuilder->buildMessage(mSendBuffer, - MAX_BUFFER_SIZE); + mSendSize = mMessageBuilder->buildMessage( + mSendBuffer, + MAX_BUFFER_SIZE, + 0); } if (!(host.isOk())) // if port and ip are zero, don't bother trying to send the message @@ -2068,6 +1180,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) else { // nope, open the new circuit + cdp = mCircuitInfo.addCircuitData(host, 0); } } @@ -2095,33 +1208,23 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) LLSD message = mLLSDMessageBuilder->getMessage(); const LLHTTPSender& sender = LLHTTPSender::getSender(host); - LLHTTPClient::ResponderPtr responder = NULL; - if(mSendReliable) - { - responder = - new LLFnPtrResponder(mReliablePacketParams.mCallback, - mReliablePacketParams.mCallbackData); - } - else - { - llwarns << "LLMessageSystem::sendMessage: Sending unreliable " << mMessageBuilder->getMessageName() << " message via HTTP" << llendl; - responder = new LLFnPtrResponder(NULL, NULL); - } sender.send(host, mLLSDMessageBuilder->getMessageName(), - message, responder); + message, createResponder(mLLSDMessageBuilder->getMessageName())); mSendReliable = FALSE; mReliablePacketParams.clear(); return 1; } - memset(mSendBuffer,0,LL_PACKET_ID_SIZE); // zero out the packet ID field + // zero out the flags and packetid. Subtract 1 here so that we do + // not overwrite the offset if it was set set in buildMessage(). + memset(mSendBuffer, 0, LL_PACKET_ID_SIZE - 1); // add the send id to the front of the message cdp->nextPacketOutID(); // Packet ID size is always 4 - *((S32*)&mSendBuffer[0]) = htonl(cdp->getPacketOutID()); + *((S32*)&mSendBuffer[PHL_PACKET_ID]) = htonl(cdp->getPacketOutID()); // Compress the message, which will usually reduce its size. U8 * buf_ptr = (U8 *)mSendBuffer; @@ -2264,7 +1367,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re char buffer[MAX_STRING]; /* Flawfinder: ignore */ snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize: mMessageReader->getMessageSize()), mCurrentRecvPacketID); /* Flawfinder: ignore */ str << buffer - << mMessageReader->getMessageName() + << nullToEmpty(mMessageReader->getMessageName()) << (recv_reliable ? " reliable" : "") << " REJECTED"; llinfos << str.str() << llendl; @@ -2287,6 +1390,27 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re } } +S32 LLMessageSystem::sendMessage(const LLHost &host, const char* name, + const LLSD& message) +{ + if (!(host.isOk())) + { + llwarns << "trying to send message to invalid host" << llendl; + return 0; + } + newMessage(name); + if (mMessageBuilder != mLLSDMessageBuilder) + { + llwarns << "trying to send llsd message when builder is not LLSD!" + << llendl; + return 0; + } + + const LLHTTPSender& sender = LLHTTPSender::getSender(host); + sender.send(host, name, message, createResponder(name)); + return 1; +} + void LLMessageSystem::logTrustedMsgFromUntrustedCircuit( const LLHost& host ) { // RequestTrustedCircuit is how we establish trust, so don't spam @@ -2294,9 +1418,9 @@ void LLMessageSystem::logTrustedMsgFromUntrustedCircuit( const LLHost& host ) if (strcmp(mMessageReader->getMessageName(), "RequestTrustedCircuit")) { llwarns << "Received trusted message on untrusted circuit. " - << "Will reply with deny. " - << "Message: " << mMessageReader->getMessageName() - << " Host: " << host << llendl; + << "Will reply with deny. " + << "Message: " << nullToEmpty(mMessageReader->getMessageName()) + << " Host: " << host << llendl; } if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM) @@ -2346,7 +1470,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r char buffer[MAX_STRING]; /* Flawfinder: ignore */ snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize : mMessageReader->getMessageSize()), mCurrentRecvPacketID); /* Flawfinder: ignore */ str << buffer - << mMessageReader->getMessageName() + << nullToEmpty(mMessageReader->getMessageName()) << (recv_reliable ? " reliable" : "") << (recv_resent ? " resent" : "") << (recv_acks ? " acks" : ""); @@ -2486,16 +1610,16 @@ void LLMessageSystem::disableCircuit(const LLHost &host) llinfos << "Host " << LLHost(old_ip, old_port) << " circuit " << code << " removed from lookup table" << llendl; gMessageSystem->mIPPortToCircuitCode.erase(ip_port); } + mCircuitInfo.removeCircuitData(host); } else { // Sigh, since we can open circuits which don't have circuit // codes, it's possible for this to happen... - //llwarns << "Couldn't find circuit code for " << host << llendl; + llwarns << "Couldn't find circuit code for " << host << llendl; } - mCircuitInfo.removeCircuitData(host); } @@ -2917,6 +2041,30 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, } } +// static +void LLMessageSystem::processError(LLMessageSystem* msg, void**) +{ + char buffer[MTUBYTES]; + S32 error_code = 0; + msg->getS32("Data", "Code", error_code); + std::string error_token; + msg->getString("Data", "Token", MTUBYTES, buffer); + error_token.assign(buffer); + LLUUID error_id; + msg->getUUID("Data", "ID", error_id); + std::string error_system; + msg->getString("Data", "System", MTUBYTES, buffer); + error_system.assign(buffer); + std::string error_message; + msg->getString("Data", "Message", MTUBYTES, buffer); + error_message.assign(buffer); + + llwarns << "Message error from " << msg->getSender() << " - " + << error_code << " " << error_token << " " << error_id << " \"" + << error_system << "\" \"" << error_message << "\"" << llendl; +} + + static LLHTTPNode& messageRootNode() { static LLHTTPNode root_node; @@ -2944,10 +2092,13 @@ void LLMessageSystem::dispatch( const LLSD& message, LLHTTPNode::ResponsePtr responsep) { - if (msg_name.empty()) + if ((gMessageSystem->mMessageTemplates.find + (gMessageStringTable.getString(msg_name.c_str())) == + gMessageSystem->mMessageTemplates.end()) && + !LLMessageConfig::isValidMessage(msg_name)) { - llwarns << "LLMessageService::dispatch called with no message name" - << llendl; + llwarns << "Ignoring unknown message " << msg_name << llendl; + responsep->notFound("Invalid message name"); return; } @@ -2960,6 +2111,9 @@ void LLMessageSystem::dispatch( << path << llendl; return; } + // enable this for output of message names + //llinfos << "< \"" << msg_name << "\"" << llendl; + //lldebugs << "data: " << LLSDXMLStreamer(message) << llendl; handler->post(responsep, context, message); } @@ -3024,6 +2178,56 @@ void LLMessageSystem::setMessageBans( check_for_unrecognized_messages("untrusted", untrusted, mMessageTemplates); } +S32 LLMessageSystem::sendError( + const LLHost& host, + const LLUUID& agent_id, + S32 code, + const std::string& token, + const LLUUID& id, + const std::string& system, + const std::string& message, + const LLSD& data) +{ + newMessage("Error"); + nextBlockFast(_PREHASH_AgentData); + addUUIDFast(_PREHASH_AgentID, agent_id); + nextBlockFast(_PREHASH_Data); + addS32("Code", code); + addString("Token", token); + addUUID("ID", id); + addString("System", system); + std::string temp; + temp = message; + if(temp.size() > (size_t)MTUBYTES) temp.resize((size_t)MTUBYTES); + addString("Message", message); + LLPointer<LLSDBinaryFormatter> formatter = new LLSDBinaryFormatter; + std::ostringstream ostr; + formatter->format(data, ostr); + temp = ostr.str(); + bool pack_data = true; + static const std::string ERROR_MESSAGE_NAME("Error"); + if (LLMessageConfig::getMessageFlavor(ERROR_MESSAGE_NAME) == + LLMessageConfig::TEMPLATE_FLAVOR) + { + S32 msg_size = temp.size() + mMessageBuilder->getMessageSize(); + if(msg_size >= ETHERNET_MTU_BYTES) + { + pack_data = false; + } + } + if(pack_data) + { + addBinaryData("Data", (void*)temp.c_str(), temp.size()); + } + else + { + llwarns << "Data and message were too large -- data removed." + << llendl; + addBinaryData("Data", NULL, 0); + } + return sendReliable(host); +} + void process_packet_ack(LLMessageSystem *msgsystem, void** /*user_data*/) { TPACKETID packet_id; @@ -3049,37 +2253,8 @@ void process_packet_ack(LLMessageSystem *msgsystem, void** /*user_data*/) } } -void send_template_reply(LLMessageSystem* msg, const LLUUID& token) -{ - msg->newMessageFast(_PREHASH_TemplateChecksumReply); - msg->nextBlockFast(_PREHASH_DataBlock); - msg->addU32Fast(_PREHASH_Checksum, msg->mMessageFileChecksum); - msg->addU8Fast(_PREHASH_MajorVersion, U8(msg->mSystemVersionMajor) ); - msg->addU8Fast(_PREHASH_MinorVersion, U8(msg->mSystemVersionMinor) ); - msg->addU8Fast(_PREHASH_PatchVersion, U8(msg->mSystemVersionPatch) ); - msg->addU8Fast(_PREHASH_ServerVersion, U8(msg->mSystemVersionServer) ); - msg->addU32Fast(_PREHASH_Flags, msg->mVersionFlags); - msg->nextBlockFast(_PREHASH_TokenBlock); - msg->addUUIDFast(_PREHASH_Token, token); - msg->sendMessage(msg->getSender()); -} - -void process_template_checksum_request(LLMessageSystem* msg, void**) -{ - llinfos << "Message template checksum request received from " - << msg->getSender() << llendl; - send_template_reply(msg, LLUUID::null); -} - -void process_secured_template_checksum_request(LLMessageSystem* msg, void**) -{ - llinfos << "Secured message template checksum request received from " - << msg->getSender() << llendl; - LLUUID token; - msg->getUUIDFast(_PREHASH_TokenBlock, _PREHASH_Token, token); - send_template_reply(msg, token); -} +/* void process_log_messages(LLMessageSystem* msg, void**) { U8 log_message; @@ -3096,7 +2271,7 @@ void process_log_messages(LLMessageSystem* msg, void**) llinfos << "Stopping logging via message" << llendl; msg->stopLogging(); } -} +}*/ // Make circuit trusted if the MD5 Digest matches, otherwise // notify remote end that they are not trusted. @@ -3329,15 +2504,14 @@ BOOL start_messaging_system( //gMessageSystem->setHandlerFuncFast(_PREHASH_AckAddCircuitCode, ack_add_circuit_code, NULL); gMessageSystem->setHandlerFuncFast(_PREHASH_UseCircuitCode, LLMessageSystem::processUseCircuitCode, (void**)responder); gMessageSystem->setHandlerFuncFast(_PREHASH_PacketAck, process_packet_ack, NULL); - gMessageSystem->setHandlerFuncFast(_PREHASH_TemplateChecksumRequest, process_template_checksum_request, NULL); - gMessageSystem->setHandlerFuncFast(_PREHASH_SecuredTemplateChecksumRequest, process_secured_template_checksum_request, NULL); - gMessageSystem->setHandlerFuncFast(_PREHASH_LogMessages, process_log_messages, NULL); + //gMessageSystem->setHandlerFuncFast(_PREHASH_LogMessages, process_log_messages, NULL); gMessageSystem->setHandlerFuncFast(_PREHASH_CreateTrustedCircuit, process_create_trusted_circuit, NULL); gMessageSystem->setHandlerFuncFast(_PREHASH_DenyTrustedCircuit, process_deny_trusted_circuit, NULL); + gMessageSystem->setHandlerFunc("Error", LLMessageSystem::processError); // We can hand this to the null_message_callback since it is a // trusted message, so it will automatically be denied if it isn't @@ -3451,11 +2625,11 @@ void LLMessageSystem::summarizeLogs(std::ostream& str) snprintf(buffer, MAX_STRING, "%35s%10s%10s%10s%10s", "Message", "Count", "Time", "Max", "Avg"); /* Flawfinder: ignore */ str << buffer << std:: endl; F32 avg; - for (message_template_name_map_t::iterator iter = mMessageTemplates.begin(), + for (message_template_name_map_t::const_iterator iter = mMessageTemplates.begin(), end = mMessageTemplates.end(); iter != end; iter++) { - LLMessageTemplate* mt = iter->second; + const LLMessageTemplate* mt = iter->second; if(mt->mTotalDecoded > 0) { avg = mt->mTotalDecodeTime / (F32)mt->mTotalDecoded; @@ -3529,11 +2703,11 @@ void LLMessageSystem::dumpReceiveCounts() if(mNumMessageCounts > 0) { llinfos << "Dump: " << mNumMessageCounts << " messages processed in " << mReceiveTime << " seconds" << llendl; - for (message_template_name_map_t::iterator iter = mMessageTemplates.begin(), + for (message_template_name_map_t::const_iterator iter = mMessageTemplates.begin(), end = mMessageTemplates.end(); iter != end; iter++) { - LLMessageTemplate* mt = iter->second; + const LLMessageTemplate* mt = iter->second; if (mt->mReceiveCount > 0) { llinfos << "Num: " << std::setw(3) << mt->mReceiveCount << " Bytes: " << std::setw(6) << mt->mReceiveBytes @@ -3581,8 +2755,10 @@ S32 LLMessageSystem::zeroCodeAdjustCurrentSendTotal() if (! mMessageBuilder->isBuilt()) { - mSendSize = mMessageBuilder->buildMessage(mSendBuffer, - MAX_BUFFER_SIZE); + mSendSize = mMessageBuilder->buildMessage( + mSendBuffer, + MAX_BUFFER_SIZE, + 0); } // TODO: babbage: remove this horror mMessageBuilder->setBuilt(FALSE); @@ -3596,7 +2772,7 @@ S32 LLMessageSystem::zeroCodeAdjustCurrentSendTotal() // skip the packet id field - for (U32 i=0;i<LL_PACKET_ID_SIZE;i++) + for (U32 ii = 0; ii < LL_PACKET_ID_SIZE; ++ii) { count--; inptr++; @@ -3647,19 +2823,20 @@ S32 LLMessageSystem::zeroCodeAdjustCurrentSendTotal() -S32 LLMessageSystem::zeroCodeExpand(U8 **data, S32 *data_size) +S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size) { - - if ((*data_size ) < LL_PACKET_ID_SIZE) + if ((*data_size ) < LL_MINIMUM_VALID_PACKET_SIZE) { - llwarns << "zeroCodeExpand() called with data_size of " << *data_size << llendl; + llwarns << "zeroCodeExpand() called with data_size of " << *data_size + << llendl; } - + mTotalBytesIn += *data_size; - if (!(*data[0] & LL_ZERO_CODE_FLAG)) // if we're not zero-coded, just go 'way + // if we're not zero-coded, simply return. + if (!(*data[0] & LL_ZERO_CODE_FLAG)) { - return(0); + return 0; } S32 in_size = *data_size; @@ -3675,7 +2852,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8 **data, S32 *data_size) // skip the packet id field - for (U32 i=0;i<LL_PACKET_ID_SIZE;i++) + for (U32 ii = 0; ii < LL_PACKET_ID_SIZE; ++ii) { count--; *outptr++ = *inptr++; @@ -3769,14 +2946,16 @@ bool LLMessageSystem::callHandler(const char *name, bool trustedSource, LLMessageSystem* msg) { name = gMessageStringTable.getString(name); - LLMessageTemplate* msg_template = mMessageTemplates[(char*)name]; - if (!msg_template) + message_template_name_map_t::const_iterator iter; + iter = mMessageTemplates.find(name); + if(iter == mMessageTemplates.end()) { llwarns << "LLMessageSystem::callHandler: unknown message " << name << llendl; return false; } - + + const LLMessageTemplate* msg_template = iter->second; if (msg_template->isBanned(trustedSource)) { llwarns << "LLMessageSystem::callHandler: banned message " @@ -3832,14 +3011,13 @@ BOOL LLMessageSystem::isCircuitCodeKnown(U32 code) const BOOL LLMessageSystem::isMessageFast(const char *msg) { - return(msg == mMessageReader->getMessageName()); + return msg == mMessageReader->getMessageName(); } char* LLMessageSystem::getMessageName() { - const char* name = mMessageReader->getMessageName(); - return name[0] == '\0'? NULL : const_cast<char*>(name); + return const_cast<char*>(mMessageReader->getMessageName()); } const LLUUID& LLMessageSystem::getSenderID() const @@ -4168,120 +3346,6 @@ void LLMessageSystem::dumpPacketToLog() } } -//static -BOOL LLMessageSystem::isTemplateConfirmed() -{ - return gMessageSystem->mTemplateConfirmed; -} - -//static -BOOL LLMessageSystem::doesTemplateMatch() -{ - if (!isTemplateConfirmed()) - { - return FALSE; - } - return gMessageSystem->mTemplateMatches; -} - -//static -void LLMessageSystem::sendMessageTemplateChecksum(const LLHost ¤tHost) -{ - gMessageSystem->mTemplateConfirmed = FALSE; - gMessageSystem->mTemplateMatches = FALSE; - gMessageSystem->newMessageFast(_PREHASH_TemplateChecksumRequest); - // Don't use ping-based retry - gMessageSystem->sendReliable(currentHost, 40, FALSE, 3, NULL, NULL); -} - -//static -void LLMessageSystem::processMessageTemplateChecksumReply(LLMessageSystem *msg, - void** user_data) -{ - U32 remote_template_checksum = 0; - msg->getU32Fast(_PREHASH_DataBlock, _PREHASH_Checksum, remote_template_checksum); - msg->mTemplateConfirmed = TRUE; - if ((remote_template_checksum) != msg->mMessageFileChecksum) - { - llwarns << "out of sync message template!" << llendl; - - msg->mTemplateMatches = FALSE; - msg->newMessageFast(_PREHASH_CloseCircuit); - msg->sendMessage(msg->getSender()); - return; - } - - msg->mTemplateMatches = TRUE; - llinfos << "According to " << msg->getSender() - << " the message template is current!" - << llendl; -} - -//static -void LLMessageSystem::sendSecureMessageTemplateChecksum(const LLHost& host) -{ - // generate an token for use during template checksum requests to - // prevent DOS attacks from injected bad template checksum replies. - LLUUID *template_tokenp = new LLUUID; - template_tokenp->generate(); - lldebugs << "random token: " << *template_tokenp << llendl; - - // register the handler for the reply while saving off template_token - gMessageSystem->setHandlerFuncFast(_PREHASH_TemplateChecksumReply, - LLMessageSystem::processSecureTemplateChecksumReply, - (void**)template_tokenp); - - // send checksum request - gMessageSystem->mTemplateConfirmed = FALSE; - gMessageSystem->newMessageFast(_PREHASH_SecuredTemplateChecksumRequest); - gMessageSystem->nextBlockFast(_PREHASH_TokenBlock); - gMessageSystem->addUUIDFast(_PREHASH_Token, *template_tokenp); - gMessageSystem->sendReliable(host); -} - -//static -void LLMessageSystem::processSecureTemplateChecksumReply(LLMessageSystem *msg, - void** user_data) -{ - // copy the token out into the stack and delete allocated memory - LLUUID template_token = *((LLUUID*)user_data); - delete user_data; - - LLUUID received_token; - msg->getUUID("TokenBlock", "Token", received_token); - - if(received_token != template_token) - { - llwarns << "Incorrect token in template checksum reply: " - << received_token << llendl; - //return do_normal_idle; - return; - } - - U32 remote_template_checksum = 0; - U8 major_version = 0; - U8 minor_version = 0; - U8 patch_version = 0; - U8 server_version = 0; - U32 flags = 0x0; - msg->getU32("DataBlock", "Checksum", remote_template_checksum); - msg->getU8 ("DataBlock", "MajorVersion", major_version); - msg->getU8 ("DataBlock", "MinorVersion", minor_version); - msg->getU8 ("DataBlock", "PatchVersion", patch_version); - msg->getU8 ("DataBlock", "ServerVersion", server_version); - msg->getU32("DataBlock", "Flags", flags); - - msg->mTemplateConfirmed = TRUE; - if (remote_template_checksum != gMessageSystem->mMessageFileChecksum) - { - llinfos << "Message template out of sync" << llendl; - msg->mTemplateMatches = FALSE; - } - else - { - msg->mTemplateMatches = TRUE; - } -} //static U64 LLMessageSystem::getMessageTimeUsecs(const BOOL update) @@ -4332,14 +3396,32 @@ typedef std::map<const char*, LLMessageBuilder*> BuilderMap; void LLMessageSystem::newMessageFast(const char *name) { - if(LLMessageConfig::isMessageBuiltTemplate(name)) + LLMessageConfig::Flavor message_flavor = + LLMessageConfig::getMessageFlavor(name); + LLMessageConfig::Flavor server_flavor = + LLMessageConfig::getServerDefaultFlavor(); + + if(message_flavor == LLMessageConfig::TEMPLATE_FLAVOR) { mMessageBuilder = mTemplateMessageBuilder; } - else + else if (message_flavor == LLMessageConfig::LLSD_FLAVOR) { mMessageBuilder = mLLSDMessageBuilder; } + // NO_FLAVOR + else + { + if (server_flavor == LLMessageConfig::LLSD_FLAVOR) + { + mMessageBuilder = mLLSDMessageBuilder; + } + // TEMPLATE_FLAVOR or NO_FLAVOR + else + { + mMessageBuilder = mTemplateMessageBuilder; + } + } mSendReliable = FALSE; mMessageBuilder->newMessage(name); } @@ -4802,6 +3884,10 @@ void LLMessageSystem::getIPPort(const char *block, const char *var, U16 &u, void LLMessageSystem::getStringFast(const char *block, const char *var, S32 buffer_size, char *s, S32 blocknum) { + if(buffer_size <= 0) + { + llwarns << "buffer_size <= 0" << llendl; + } mMessageReader->getString(block, var, buffer_size, s, blocknum); } diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index a4a8022631..9c07227a67 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -1,5 +1,5 @@ /** - * @FILE message.h + * @file message.h * @brief LLMessageSystem class header file * * Copyright (c) 2001-$CurrentYear$, Linden Research, Inc. @@ -30,11 +30,13 @@ #include "lltimer.h" #include "llpacketring.h" #include "llhost.h" +#include "llhttpclient.h" #include "llhttpnode.h" #include "llpacketack.h" #include "message_prehash.h" #include "llstl.h" #include "llmsgvariabletype.h" +#include "llmsgvariabletype.h" const U32 MESSAGE_MAX_STRINGS_LENGTH = 64; const U32 MESSAGE_NUMBER_OF_HASH_BUCKETS = 8192; @@ -106,7 +108,16 @@ const U8 LL_RELIABLE_FLAG = 0x40; const U8 LL_RESENT_FLAG = 0x20; const U8 LL_ACK_FLAG = 0x10; -const S32 LL_MINIMUM_VALID_PACKET_SIZE = LL_PACKET_ID_SIZE + 1; // 4 bytes id + 1 byte message name (high) +// 1 byte flags, 4 bytes sequence, 1 byte offset + 1 byte message name (high) +const S32 LL_MINIMUM_VALID_PACKET_SIZE = LL_PACKET_ID_SIZE + 1; +enum EPacketHeaderLayout +{ + PHL_FLAGS = 0, + PHL_PACKET_ID = 1, + PHL_OFFSET = 5, + PHL_NAME = 6 +}; + const S32 LL_DEFAULT_RELIABLE_RETRIES = 3; const F32 LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS = 1.f; @@ -135,8 +146,6 @@ class LLUUID; class LLMessageSystem; class LLPumpIO; -// message data pieces are used to collect the data called for by the message template - // message system exceptional condition handlers. enum EMessageException { @@ -148,6 +157,7 @@ enum EMessageException typedef void (*msg_exception_callback)(LLMessageSystem*,void*,EMessageException); +// message data pieces are used to collect the data called for by the message template class LLMsgData; class LLMsgBlkData; class LLMessageTemplate; @@ -160,6 +170,8 @@ class LLMessageReader; class LLTemplateMessageReader; class LLSDMessageReader; + + class LLUseCircuitCodeResponder { LOG_CLASS(LLMessageSystem); @@ -184,7 +196,6 @@ class LLMessageSystem // Set this flag to TRUE when you want *very* verbose logs. BOOL mVerboseLog; - U32 mMessageFileChecksum; F32 mMessageFileVersionNumber; typedef std::map<const char *, LLMessageTemplate*> message_template_name_map_t; @@ -430,8 +441,11 @@ public: void forwardReliable(const LLHost &host); void forwardReliable(const U32 circuit_code); + LLHTTPClient::ResponderPtr createResponder(const std::string& name); S32 sendMessage(const LLHost &host); S32 sendMessage(const U32 circuit); + S32 sendMessage(const LLHost &host, const char* name, + const LLSD& message); // BOOL decodeData(const U8 *buffer, const LLHost &host); @@ -508,6 +522,15 @@ public: // The actual sending is done by reallySendDenyTrustedCircuit() void sendDenyTrustedCircuit(const LLHost &host); + /** Return false if host is unknown or untrusted */ + bool isTrustedSender(const LLHost& host) const; + + /** Return false true if name is unknown or untrusted */ + bool isTrustedMessage(const std::string& name) const; + + /** Return false true if name is unknown or trusted */ + bool isUntrustedMessage(const std::string& name) const; + private: // A list of the circuits that need to be sent DenyTrustedCircuit messages. typedef std::set<LLHost> host_set_t; @@ -517,7 +540,6 @@ private: // related to sendDenyTrustedCircuit() void reallySendDenyTrustedCircuit(const LLHost &host); - public: // Use this to establish trust to and from a host. This blocks // until trust has been established, and probably should only be @@ -574,15 +596,6 @@ public: void setMaxMessageTime(const F32 seconds); // Max time to process messages before warning and dumping (neg to disable) void setMaxMessageCounts(const S32 num); // Max number of messages before dumping (neg to disable) - // statics - static BOOL isTemplateConfirmed(); - static BOOL doesTemplateMatch(); - static void sendMessageTemplateChecksum(const LLHost&); - static void processMessageTemplateChecksumReply(LLMessageSystem *msg, - void** user_data); - static void sendSecureMessageTemplateChecksum(const LLHost&); - static void processSecureTemplateChecksumReply(LLMessageSystem *msg, - void** user_data); static U64 getMessageTimeUsecs(const BOOL update = FALSE); // Get the current message system time in microseconds static F64 getMessageTimeSeconds(const BOOL update = FALSE); // Get the current message system time in seconds @@ -593,6 +606,7 @@ public: //static void processAssignCircuitCode(LLMessageSystem* msg, void**); static void processAddCircuitCode(LLMessageSystem* msg, void**); static void processUseCircuitCode(LLMessageSystem* msg, void**); + static void processError(LLMessageSystem* msg, void**); // dispatch llsd message to http node tree static void dispatch(const std::string& msg_name, @@ -603,13 +617,33 @@ public: void setMessageBans(const LLSD& trusted, const LLSD& untrusted); + /** + * @brief send an error message to the host. This is a helper method. + * + * @param host Destination host. + * @param agent_id Destination agent id (may be null) + * @param code An HTTP status compatible error code. + * @param token A specific short string based message + * @param id The transactionid/uniqueid/sessionid whatever. + * @param system The hierarchical path to the system (255 bytes) + * @param message Human readable message (1200 bytes) + * @param data Extra info. + * @return Returns value returned from sendReliable(). + */ + S32 sendError( + const LLHost& host, + const LLUUID& agent_id, + S32 code, + const std::string& token, + const LLUUID& id, + const std::string& system, + const std::string& message, + const LLSD& data); + // Check UDP messages and pump http_pump to receive HTTP messages. bool checkAllMessages(S64 frame_count, LLPumpIO* http_pump); private: - // data used in those internal handlers - BOOL mTemplateConfirmed; - BOOL mTemplateMatches; // The mCircuitCodes is a map from circuit codes to session // ids. This allows us to verify sessions on connect. @@ -619,7 +653,7 @@ private: // Viewers need to track a process session in order to make sure // that no one gives them a bad circuit code. LLUUID mSessionID; - + void addTemplate(LLMessageTemplate *templatep); void clearReceiveState(); BOOL decodeTemplate( const U8* buffer, S32 buffer_size, LLMessageTemplate** msg_template ); @@ -690,6 +724,10 @@ private: bool callHandler(const char *name, bool trustedSource, LLMessageSystem* msg); + + + /** Find, create or revive circuit for host as needed */ + LLCircuitData* findCircuit(const LLHost& host, bool resetPacketId); }; diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index e153114d1d..67ee5d5675 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -7,14 +7,14 @@ */ /** - * Generated from message template version number 1.053 + * Generated from message template version number 2.000 */ #include "linden_common.h" #include "message.h" -F32 gPrehashVersionNumber = 1.053f; +F32 gPrehashVersionNumber = 2.000f; char * _PREHASH_X; char * _PREHASH_Y; @@ -39,7 +39,6 @@ char * _PREHASH_ScriptAnswerYes; char * _PREHASH_PartnerID; char * _PREHASH_DirLandQuery; char * _PREHASH_TeleportStart; -char * _PREHASH_LogMessages; char * _PREHASH_AboutText; char * _PREHASH_VisualParam; char * _PREHASH_GroupPrims; @@ -47,10 +46,8 @@ char * _PREHASH_SelectedPrims; char * _PREHASH_ID; char * _PREHASH_UUIDNameRequest; char * _PREHASH_UUIDGroupNameRequest; -char * _PREHASH_MoneyTransactionsRequest; char * _PREHASH_GroupAccountTransactionsRequest; char * _PREHASH_MapNameRequest; -char * _PREHASH_MailTaskSimRequest; char * _PREHASH_UpdateSimulator; char * _PREHASH_BillableFactor; char * _PREHASH_ObjectBonusFactor; @@ -60,7 +57,6 @@ char * _PREHASH_ConfirmEnableSimulator; char * _PREHASH_LayerType; char * _PREHASH_OwnerRole; char * _PREHASH_ParcelOverlay; -char * _PREHASH_AdjustBalance; char * _PREHASH_GroupOwned; char * _PREHASH_IP; char * _PREHASH_ChatFromViewer; @@ -95,8 +91,8 @@ char * _PREHASH_SensedData; char * _PREHASH_UpdateBlock; char * _PREHASH_ClassifiedGodDelete; char * _PREHASH_ObjectGrabUpdate; -char * _PREHASH_TaxDate; char * _PREHASH_LocationPos; +char * _PREHASH_TaxDate; char * _PREHASH_StartDateTime; char * _PREHASH_ObjectUpdateCached; char * _PREHASH_Packets; @@ -128,14 +124,11 @@ char * _PREHASH_AABBMin; char * _PREHASH_ClassifiedFlags; char * _PREHASH_ControlFlags; char * _PREHASH_TeleportRequest; -char * _PREHASH_SpaceLocationTeleportRequest; -char * _PREHASH_LeaderBoardRequest; char * _PREHASH_ScriptTeleportRequest; +char * _PREHASH_EstateCovenantRequest; char * _PREHASH_DateUTC; char * _PREHASH_TaskIDs; -char * _PREHASH_EstateCovenantRequest; char * _PREHASH_RequestResult; -char * _PREHASH_ReputationAgentAssign; char * _PREHASH_CanAcceptAgents; char * _PREHASH_ObjectSaleInfo; char * _PREHASH_KillChildAgents; @@ -147,7 +140,6 @@ char * _PREHASH_InfoBlock; char * _PREHASH_OwnershipCost; char * _PREHASH_AvatarNotesUpdate; char * _PREHASH_PID; -char * _PREHASH_TimeString; char * _PREHASH_DirPopularReply; char * _PREHASH_TerrainHeightRange00; char * _PREHASH_SimData; @@ -173,7 +165,6 @@ char * _PREHASH_Objects; char * _PREHASH_URL; char * _PREHASH_CreationDate; char * _PREHASH_JointPivot; -char * _PREHASH_RateeID; char * _PREHASH_FPS; char * _PREHASH_HasTelehub; char * _PREHASH_PathEnd; @@ -198,7 +189,6 @@ char * _PREHASH_GroupNoticesListReply; char * _PREHASH_ParcelAccessListReply; char * _PREHASH_RpcChannelReply; char * _PREHASH_RegionPresenceResponse; -char * _PREHASH_AgentPresenceResponse; char * _PREHASH_CharterMember; char * _PREHASH_EdgeData; char * _PREHASH_NameData; @@ -212,14 +202,12 @@ char * _PREHASH_Mag; char * _PREHASH_ParcelPropertiesRequestByID; char * _PREHASH_ObjectLink; char * _PREHASH_RpcScriptReplyInbound; -char * _PREHASH_BoardData; char * _PREHASH_RezData; char * _PREHASH_RemoveInventoryObjects; char * _PREHASH_GroupProposalBallot; char * _PREHASH_RPCServerIP; char * _PREHASH_Far; char * _PREHASH_GodSessionID; -char * _PREHASH_ViewerDigest; char * _PREHASH_FLAboutText; char * _PREHASH_RegionHandshakeReply; char * _PREHASH_GroupActiveProposalItemReply; @@ -231,7 +219,6 @@ char * _PREHASH_Set; char * _PREHASH_NewName; char * _PREHASH_Key; char * _PREHASH_AgentID; -char * _PREHASH_OnlineStatusRequest; char * _PREHASH_EventNotificationRemoveRequest; char * _PREHASH_NewFolderID; char * _PREHASH_Arc; @@ -243,7 +230,6 @@ char * _PREHASH_Top; char * _PREHASH_MiscStats; char * _PREHASH_ImageID; char * _PREHASH_DataPacket; -char * _PREHASH_ObjectDehinge; char * _PREHASH_You; char * _PREHASH_ScriptControlChange; char * _PREHASH_LoadURL; @@ -260,9 +246,9 @@ char * _PREHASH_Contribution; char * _PREHASH_SetGroupContribution; char * _PREHASH_Offline; char * _PREHASH_AgentIsNowWearing; -char * _PREHASH_SecPerDay; char * _PREHASH_Members; char * _PREHASH_FailedResends; +char * _PREHASH_SecPerDay; char * _PREHASH_CameraCenter; char * _PREHASH_CameraLeftAxis; char * _PREHASH_ExBlock; @@ -270,7 +256,6 @@ char * _PREHASH_Channel; char * _PREHASH_NetTest; char * _PREHASH_DiscardLevel; char * _PREHASH_LayerID; -char * _PREHASH_RatorID; char * _PREHASH_GrabOffset; char * _PREHASH_SimPort; char * _PREHASH_PricePerMeter; @@ -290,21 +275,16 @@ char * _PREHASH_SitName; char * _PREHASH_RegionsVisited; char * _PREHASH_DirClassifiedReply; char * _PREHASH_AvatarClassifiedReply; -char * _PREHASH_ReputationIndividualReply; char * _PREHASH_MediaURL; char * _PREHASH_CompleteAgentMovement; -char * _PREHASH_SpaceIP; char * _PREHASH_ClassifiedID; char * _PREHASH_LocalID; +char * _PREHASH_SpaceIP; char * _PREHASH_RemoveItem; char * _PREHASH_LogFailedMoneyTransaction; char * _PREHASH_ViewerStartAuction; char * _PREHASH_StartAuction; -char * _PREHASH_NameValueName; -char * _PREHASH_AngVelX; char * _PREHASH_DuplicateFlags; -char * _PREHASH_AngVelY; -char * _PREHASH_AngVelZ; char * _PREHASH_TextColor; char * _PREHASH_SlaveID; char * _PREHASH_Charter; @@ -315,21 +295,16 @@ char * _PREHASH_ParcelAuctions; char * _PREHASH_OwnerIsGroup; char * _PREHASH_NameValuePair; char * _PREHASH_RemoveNameValuePair; -char * _PREHASH_GetNameValuePair; char * _PREHASH_BulkUpdateInventory; char * _PREHASH_UpdateTaskInventory; char * _PREHASH_RemoveTaskInventory; char * _PREHASH_MoveTaskInventory; char * _PREHASH_RequestTaskInventory; char * _PREHASH_ReplyTaskInventory; -char * _PREHASH_DeclineInventory; char * _PREHASH_AggregatePermInventory; -char * _PREHASH_SimulatorInfo; -char * _PREHASH_MoneyTransactionsReply; char * _PREHASH_GroupAccountTransactionsReply; -char * _PREHASH_MailTaskSimReply; +char * _PREHASH_SimulatorInfo; char * _PREHASH_WearableData; -char * _PREHASH_StatisticsData; char * _PREHASH_Enabled; char * _PREHASH_Savings; char * _PREHASH_SimulatorLoad; @@ -341,15 +316,12 @@ char * _PREHASH_JoinGroupRequest; char * _PREHASH_LeaveGroupRequest; char * _PREHASH_InviteGroupRequest; char * _PREHASH_LiveHelpGroupRequest; -char * _PREHASH_ServerVersion; char * _PREHASH_PriceParcelClaimFactor; char * _PREHASH_BillableArea; char * _PREHASH_ObjectID; char * _PREHASH_ObjectFlagUpdate; char * _PREHASH_GroupRoleUpdate; char * _PREHASH_RequestInventoryAsset; -char * _PREHASH_RedoLand; -char * _PREHASH_TravelAccess; char * _PREHASH_ChangedGrid; char * _PREHASH_AgentDropGroup; char * _PREHASH_Details; @@ -382,7 +354,6 @@ char * _PREHASH_Timestamp; char * _PREHASH_GlobalPos; char * _PREHASH_GrabOffsetInitial; char * _PREHASH_IsTrial; -char * _PREHASH_FinalizeLogout; char * _PREHASH_ObjectDuplicateOnRay; char * _PREHASH_GroupMembershipCount; char * _PREHASH_MethodData; @@ -418,32 +389,26 @@ char * _PREHASH_TaskData; char * _PREHASH_SimWideMaxPrims; char * _PREHASH_TotalPrims; char * _PREHASH_ProfileBegin; -char * _PREHASH_MoneyDetailsRequest; char * _PREHASH_Request; char * _PREHASH_GroupAccountDetailsRequest; char * _PREHASH_GroupActiveProposalsRequest; char * _PREHASH_StringValue; -char * _PREHASH_ClosestSimulator; char * _PREHASH_Version; char * _PREHASH_OtherCount; char * _PREHASH_MemberCount; char * _PREHASH_ChatData; char * _PREHASH_IsGroupOwned; char * _PREHASH_EnergyEfficiency; -char * _PREHASH_MaxPlace; char * _PREHASH_PickInfoUpdate; char * _PREHASH_PickDelete; char * _PREHASH_ScriptReset; char * _PREHASH_Requester; char * _PREHASH_ForSale; char * _PREHASH_NearestLandingRegionReply; -char * _PREHASH_RecordAgentPresence; -char * _PREHASH_EraseAgentPresence; char * _PREHASH_ParcelID; char * _PREHASH_Godlike; char * _PREHASH_TotalDebits; char * _PREHASH_Direction; -char * _PREHASH_Appearance; char * _PREHASH_HealthData; char * _PREHASH_LeftAxis; char * _PREHASH_LocationBlock; @@ -451,41 +416,31 @@ char * _PREHASH_ObjectImage; char * _PREHASH_TerrainStartHeight00; char * _PREHASH_TerrainStartHeight01; char * _PREHASH_TerrainStartHeight10; -char * _PREHASH_ObjectHinge; char * _PREHASH_TerrainStartHeight11; -char * _PREHASH_MetersPerGrid; char * _PREHASH_WaterHeight; char * _PREHASH_FetchInventoryReply; -char * _PREHASH_MoneySummaryReply; char * _PREHASH_GroupAccountSummaryReply; char * _PREHASH_AttachedSound; char * _PREHASH_ParamInUse; char * _PREHASH_GodKickUser; char * _PREHASH_PickName; char * _PREHASH_TaskName; -char * _PREHASH_SubType; char * _PREHASH_ObjectCount; char * _PREHASH_RegionPresenceRequestByHandle; char * _PREHASH_RezSingleAttachmentFromInv; char * _PREHASH_ChildAgentUpdate; -char * _PREHASH_ToID; -char * _PREHASH_ViewerPort; char * _PREHASH_IsOwnerGroup; char * _PREHASH_AgentHeightWidth; char * _PREHASH_VerticalAngle; char * _PREHASH_WearableType; char * _PREHASH_AggregatePermNextOwner; char * _PREHASH_ShowInList; -char * _PREHASH_PositionSuggestion; char * _PREHASH_UpdateParcel; -char * _PREHASH_ClearAgentSessions; char * _PREHASH_SetAlwaysRun; char * _PREHASH_NVPair; char * _PREHASH_SearchType; char * _PREHASH_ObjectSpinStart; char * _PREHASH_UseEstateSun; -char * _PREHASH_LogoutBlock; -char * _PREHASH_RelayLogControl; char * _PREHASH_RegionID; char * _PREHASH_AbuseRegionID; char * _PREHASH_Creator; @@ -494,14 +449,12 @@ char * _PREHASH_DirEventsReply; char * _PREHASH_EventInfoReply; char * _PREHASH_UserInfoReply; char * _PREHASH_PathRadiusOffset; -char * _PREHASH_SessionInfo; char * _PREHASH_TextureData; char * _PREHASH_ChatPass; char * _PREHASH_TargetID; char * _PREHASH_DefaultPayPrice; char * _PREHASH_UserLocation; char * _PREHASH_MaxPrims; -char * _PREHASH_RegionIP; char * _PREHASH_LandmarkID; char * _PREHASH_InitiateDownload; char * _PREHASH_Name; @@ -509,18 +462,13 @@ char * _PREHASH_OtherCleanTime; char * _PREHASH_ParcelSetOtherCleanTime; char * _PREHASH_TeleportPriceExponent; char * _PREHASH_Gain; -char * _PREHASH_VelX; char * _PREHASH_PacketAck; char * _PREHASH_PathSkew; -char * _PREHASH_Negative; -char * _PREHASH_VelY; char * _PREHASH_SimulatorShutdownRequest; char * _PREHASH_NearestLandingRegionRequest; -char * _PREHASH_VelZ; char * _PREHASH_OtherID; char * _PREHASH_MemberID; char * _PREHASH_MapLayerRequest; -char * _PREHASH_PatchVersion; char * _PREHASH_ObjectScale; char * _PREHASH_TargetIP; char * _PREHASH_Redo; @@ -563,27 +511,20 @@ char * _PREHASH_Perp; char * _PREHASH_Code; char * _PREHASH_InvType; char * _PREHASH_AgentFOV; -char * _PREHASH_BulkMoneyTransfer; char * _PREHASH_Audible; char * _PREHASH_AuctionData; char * _PREHASH_IDBlock; -char * _PREHASH_ReputationData; char * _PREHASH_West; char * _PREHASH_Undo; char * _PREHASH_TotalNumItems; char * _PREHASH_Info; char * _PREHASH_Area; -char * _PREHASH_Behavior; char * _PREHASH_SimCrashed; char * _PREHASH_Text; -char * _PREHASH_AgentToNewRegion; char * _PREHASH_PriceGroupCreate; char * _PREHASH_ObjectShape; char * _PREHASH_GroupRoleDataReply; -char * _PREHASH_PosX; -char * _PREHASH_PosY; char * _PREHASH_MuteCRC; -char * _PREHASH_PosZ; char * _PREHASH_Size; char * _PREHASH_FromAddress; char * _PREHASH_Body; @@ -601,16 +542,14 @@ char * _PREHASH_Stat; char * _PREHASH_SoundID; char * _PREHASH_Item; char * _PREHASH_User; -char * _PREHASH_RemoteInfos; char * _PREHASH_Prey; -char * _PREHASH_UsecSinceStart; char * _PREHASH_RayStart; +char * _PREHASH_UsecSinceStart; char * _PREHASH_ParcelData; char * _PREHASH_CameraUpAxis; char * _PREHASH_ScriptDialog; char * _PREHASH_MasterParcelData; char * _PREHASH_Invalid; -char * _PREHASH_MinPlace; char * _PREHASH_ProfileCurve; char * _PREHASH_ParcelAccessListUpdate; char * _PREHASH_MuteListUpdate; @@ -629,14 +568,12 @@ char * _PREHASH_DeRezObject; char * _PREHASH_IsTemporary; char * _PREHASH_InsigniaID; char * _PREHASH_CheckFlags; -char * _PREHASH_TransferPriority; char * _PREHASH_EventID; char * _PREHASH_Selected; char * _PREHASH_FromAgentId; char * _PREHASH_Type; char * _PREHASH_ChatType; char * _PREHASH_ReportData; -char * _PREHASH_LeaderBoardData; char * _PREHASH_RequestBlock; char * _PREHASH_GrantData; char * _PREHASH_DetachAttachmentIntoInv; @@ -652,12 +589,9 @@ char * _PREHASH_OnlineNotification; char * _PREHASH_OfflineNotification; char * _PREHASH_SendPostcard; char * _PREHASH_RequestFlags; -char * _PREHASH_MoneyHistoryRequest; -char * _PREHASH_MoneySummaryRequest; char * _PREHASH_GroupAccountSummaryRequest; char * _PREHASH_GroupVoteHistoryRequest; char * _PREHASH_ParamValue; -char * _PREHASH_Checksum; char * _PREHASH_MaxAgents; char * _PREHASH_CreateNewOutfitAttachments; char * _PREHASH_RegionHandle; @@ -667,12 +601,10 @@ char * _PREHASH_AvatarInterestsUpdate; char * _PREHASH_GroupNoticeID; char * _PREHASH_ParcelName; char * _PREHASH_PriceObjectRent; -char * _PREHASH_ConnectAgentToUserserver; -char * _PREHASH_ConnectToUserserver; char * _PREHASH_OfferCallingCard; -char * _PREHASH_AgentAccess; char * _PREHASH_AcceptCallingCard; char * _PREHASH_DeclineCallingCard; +char * _PREHASH_AgentAccess; char * _PREHASH_DataHomeLocationReply; char * _PREHASH_EventLocationReply; char * _PREHASH_TerseDateID; @@ -690,8 +622,8 @@ char * _PREHASH_Invoice; char * _PREHASH_IntervalDays; char * _PREHASH_PathScaleX; char * _PREHASH_FromTaskID; -char * _PREHASH_TimeInfo; char * _PREHASH_PathScaleY; +char * _PREHASH_TimeInfo; char * _PREHASH_PublicCount; char * _PREHASH_ParcelJoin; char * _PREHASH_GroupRolesCount; @@ -716,7 +648,6 @@ char * _PREHASH_NearestLandingRegionUpdated; char * _PREHASH_PassToAgent; char * _PREHASH_PreyAgent; char * _PREHASH_SimStats; -char * _PREHASH_Options; char * _PREHASH_LogoutReply; char * _PREHASH_FeatureDisabled; char * _PREHASH_ObjectLocalID; @@ -727,10 +658,8 @@ char * _PREHASH_Destination; char * _PREHASH_MasterID; char * _PREHASH_TransferData; char * _PREHASH_WantToMask; -char * _PREHASH_AvatarData; char * _PREHASH_ParcelSelectObjects; char * _PREHASH_ExtraParams; -char * _PREHASH_LogLogin; char * _PREHASH_CreatorID; char * _PREHASH_Summary; char * _PREHASH_BuyObjectInventory; @@ -771,8 +700,8 @@ char * _PREHASH_ButtonLabel; char * _PREHASH_GranterID; char * _PREHASH_WantToText; char * _PREHASH_ReportType; -char * _PREHASH_DataBlock; char * _PREHASH_SimulatorReady; +char * _PREHASH_DataBlock; char * _PREHASH_AnimationSourceList; char * _PREHASH_SubscribeLoad; char * _PREHASH_UnsubscribeLoad; @@ -799,9 +728,8 @@ char * _PREHASH_Header; char * _PREHASH_GestureFlags; char * _PREHASH_XferID; char * _PREHASH_StatValue; -char * _PREHASH_PickID; char * _PREHASH_TaskID; -char * _PREHASH_GridsPerEdge; +char * _PREHASH_PickID; char * _PREHASH_RayEnd; char * _PREHASH_Throttles; char * _PREHASH_RebakeAvatarTextures; @@ -814,30 +742,24 @@ char * _PREHASH_Access; char * _PREHASH_TitleRoleID; char * _PREHASH_SquareMetersCredit; char * _PREHASH_Filename; -char * _PREHASH_SecuredTemplateChecksumRequest; -char * _PREHASH_TemplateChecksumRequest; -char * _PREHASH_AgentPresenceRequest; char * _PREHASH_ClassifiedInfoRequest; char * _PREHASH_ParcelInfoRequest; char * _PREHASH_ParcelObjectOwnersRequest; char * _PREHASH_TeleportLandmarkRequest; char * _PREHASH_EventInfoRequest; -char * _PREHASH_ChatFromSimulator; -char * _PREHASH_PickInfoRequest; char * _PREHASH_MoneyBalanceRequest; char * _PREHASH_GroupMembersRequest; char * _PREHASH_GroupRoleMembersRequest; +char * _PREHASH_ChatFromSimulator; char * _PREHASH_OldFolderID; char * _PREHASH_UserInfoRequest; char * _PREHASH_TextureID; char * _PREHASH_ProfileURL; char * _PREHASH_Handle; -char * _PREHASH_StartParcelRenameAck; char * _PREHASH_ButtonIndex; char * _PREHASH_GetScriptRunning; char * _PREHASH_SetScriptRunning; char * _PREHASH_Health; -char * _PREHASH_FileID; char * _PREHASH_CircuitInfo; char * _PREHASH_ObjectBuy; char * _PREHASH_ProfileEnd; @@ -862,7 +784,6 @@ char * _PREHASH_PingID; char * _PREHASH_Change; char * _PREHASH_Height; char * _PREHASH_Region; -char * _PREHASH_MoneyHistoryReply; char * _PREHASH_TelehubInfo; char * _PREHASH_StateSave; char * _PREHASH_RoleData; @@ -873,11 +794,10 @@ char * _PREHASH_ParcelGodMarkAsContent; char * _PREHASH_UsePhysics; char * _PREHASH_RegionDenyTransacted; char * _PREHASH_JointType; -char * _PREHASH_TaxEstimate; char * _PREHASH_ObjectTaxEstimate; char * _PREHASH_LightTaxEstimate; -char * _PREHASH_TeleportLandingStatusChanged; char * _PREHASH_LandTaxEstimate; +char * _PREHASH_TeleportLandingStatusChanged; char * _PREHASH_GroupTaxEstimate; char * _PREHASH_AvgViewerFPS; char * _PREHASH_Buttons; @@ -909,8 +829,6 @@ char * _PREHASH_WinnerID; char * _PREHASH_ChannelType; char * _PREHASH_NonExemptMembers; char * _PREHASH_Agents; -char * _PREHASH_SimulatorStart; -char * _PREHASH_Enable; char * _PREHASH_MemberData; char * _PREHASH_ToGroupID; char * _PREHASH_ImageNotInDatabase; @@ -918,27 +836,21 @@ char * _PREHASH_StartDate; char * _PREHASH_AnimID; char * _PREHASH_Serial; char * _PREHASH_AbuseRegionName; -char * _PREHASH_ControlPort; char * _PREHASH_ModifyLand; char * _PREHASH_Digest; char * _PREHASH_Victim; char * _PREHASH_Script; -char * _PREHASH_TemplateChecksumReply; char * _PREHASH_PickInfoReply; char * _PREHASH_MoneyBalanceReply; char * _PREHASH_RoutedMoneyBalanceReply; char * _PREHASH_RoleID; char * _PREHASH_RegionInfo; -char * _PREHASH_Sequence; char * _PREHASH_GodUpdateRegionInfo; -char * _PREHASH_LocalX; -char * _PREHASH_LocalY; char * _PREHASH_StartAnim; -char * _PREHASH_Location; char * _PREHASH_Action; +char * _PREHASH_Location; char * _PREHASH_Rights; char * _PREHASH_SearchDir; -char * _PREHASH_Active; char * _PREHASH_TransferRequest; char * _PREHASH_ScriptSensorRequest; char * _PREHASH_MoneyTransferRequest; @@ -949,8 +861,6 @@ char * _PREHASH_Center; char * _PREHASH_SharedData; char * _PREHASH_PSBlock; char * _PREHASH_UUIDNameBlock; -char * _PREHASH_Viewer; -char * _PREHASH_GroupNoticeDelete; char * _PREHASH_GroupTitleUpdate; char * _PREHASH_Method; char * _PREHASH_TouchName; @@ -962,11 +872,9 @@ char * _PREHASH_GodlikeMessage; char * _PREHASH_SystemMessage; char * _PREHASH_BodyRotation; char * _PREHASH_SearchRegions; -char * _PREHASH_Ignore; char * _PREHASH_AnimationData; char * _PREHASH_StatID; char * _PREHASH_ItemID; -char * _PREHASH_AvatarStatisticsReply; char * _PREHASH_ScriptDialogReply; char * _PREHASH_RegionIDAndHandleReply; char * _PREHASH_CameraAtOffset; @@ -991,7 +899,6 @@ char * _PREHASH_OldItemID; char * _PREHASH_RegionPort; char * _PREHASH_PriceEnergyUnit; char * _PREHASH_Bitmap; -char * _PREHASH_TrackAgentSession; char * _PREHASH_CacheMissType; char * _PREHASH_VFileID; char * _PREHASH_GroupInsigniaID; @@ -1039,7 +946,6 @@ char * _PREHASH_MeanCollisionAlert; char * _PREHASH_CanAcceptTasks; char * _PREHASH_ItemData; char * _PREHASH_AnimationList; -char * _PREHASH_PassObject; char * _PREHASH_Reputation; char * _PREHASH_IntValue; char * _PREHASH_TargetType; @@ -1062,10 +968,8 @@ char * _PREHASH_ParcelBuy; char * _PREHASH_DirFindQueryBackend; char * _PREHASH_DirPlacesQueryBackend; char * _PREHASH_DirClassifiedQueryBackend; -char * _PREHASH_DirPicksQueryBackend; char * _PREHASH_DirLandQueryBackend; char * _PREHASH_DirPopularQueryBackend; -char * _PREHASH_LogoutDemand; char * _PREHASH_HistoryData; char * _PREHASH_SnapshotID; char * _PREHASH_Aspect; @@ -1073,7 +977,6 @@ char * _PREHASH_ParamSize; char * _PREHASH_VoteCast; char * _PREHASH_CastsShadows; char * _PREHASH_EveryoneMask; -char * _PREHASH_SetSunPhase; char * _PREHASH_ObjectSpinUpdate; char * _PREHASH_MaturePublish; char * _PREHASH_UseExistingAsset; @@ -1082,7 +985,6 @@ char * _PREHASH_ParcelLocalID; char * _PREHASH_TeleportCancel; char * _PREHASH_UnixTime; char * _PREHASH_QueryFlags; -char * _PREHASH_LastExecFroze; char * _PREHASH_AlwaysRun; char * _PREHASH_Bottom; char * _PREHASH_ButtonData; @@ -1101,7 +1003,6 @@ char * _PREHASH_NVPairs; char * _PREHASH_GroupNoticesListRequest; char * _PREHASH_ParcelAccessListRequest; char * _PREHASH_MuteListRequest; -char * _PREHASH_StartPeriod; char * _PREHASH_RpcChannelRequest; char * _PREHASH_LandStatRequest; char * _PREHASH_PlacesQuery; @@ -1129,34 +1030,27 @@ char * _PREHASH_SnapSelection; char * _PREHASH_SoundTrigger; char * _PREHASH_TerrainRaiseLimit; char * _PREHASH_Quorum; -char * _PREHASH_TokenBlock; char * _PREHASH_AgentBlock; char * _PREHASH_CommandBlock; char * _PREHASH_PricePublicObjectDecay; char * _PREHASH_SpawnPointPos; -char * _PREHASH_AttachedSoundCutoffRadius; char * _PREHASH_VolumeDetail; char * _PREHASH_FromAgentName; char * _PREHASH_Range; char * _PREHASH_DirectoryVisibility; char * _PREHASH_PublicIP; char * _PREHASH_TeleportFailed; -char * _PREHASH_OnlineStatusReply; -char * _PREHASH_RequestAvatarInfo; char * _PREHASH_PreloadSound; char * _PREHASH_ScreenshotID; char * _PREHASH_CovenantTimestamp; char * _PREHASH_OldestUnacked; char * _PREHASH_SimulatorIP; -char * _PREHASH_ObjectImport; char * _PREHASH_Value; char * _PREHASH_JointAxisOrAnchor; char * _PREHASH_Test0; char * _PREHASH_Test1; char * _PREHASH_Test2; char * _PREHASH_SunPhase; -char * _PREHASH_Place; -char * _PREHASH_Phase; char * _PREHASH_ParcelDivide; char * _PREHASH_PriceObjectClaim; char * _PREHASH_Field; @@ -1166,7 +1060,6 @@ char * _PREHASH_LiveHelpGroupReply; char * _PREHASH_Score; char * _PREHASH_Image; char * _PREHASH_ObjectClickAction; -char * _PREHASH_Delta; char * _PREHASH_Parameter; char * _PREHASH_Flags; char * _PREHASH_Plane; @@ -1176,26 +1069,24 @@ char * _PREHASH_DirFindQuery; char * _PREHASH_Textures; char * _PREHASH_EventData; char * _PREHASH_Final; +char * _PREHASH_System; char * _PREHASH_TelehubPos; char * _PREHASH_ReportAutosaveCrash; char * _PREHASH_CreateTrustedCircuit; char * _PREHASH_DenyTrustedCircuit; char * _PREHASH_RequestTrustedCircuit; char * _PREHASH_Codec; -char * _PREHASH_Level; char * _PREHASH_Modal; char * _PREHASH_ChildAgentUnknown; char * _PREHASH_LandingType; char * _PREHASH_ScriptRunningReply; -char * _PREHASH_MoneyDetailsReply; char * _PREHASH_Reply; +char * _PREHASH_GroupAccountDetailsReply; char * _PREHASH_TelehubRot; -char * _PREHASH_RequestFriendship; char * _PREHASH_AcceptFriendship; -char * _PREHASH_GroupAccountDetailsReply; +char * _PREHASH_ItemType; char * _PREHASH_DwellInfo; char * _PREHASH_AgentResume; -char * _PREHASH_ItemType; char * _PREHASH_MailFilter; char * _PREHASH_Disconnect; char * _PREHASH_SimPosition; @@ -1222,7 +1113,6 @@ char * _PREHASH_VoteType; char * _PREHASH_CategoryID; char * _PREHASH_Token; char * _PREHASH_AggregatePerms; -char * _PREHASH_StartParcelRemoveAck; char * _PREHASH_ObjectSelect; char * _PREHASH_ForceObjectSelect; char * _PREHASH_Price; @@ -1251,7 +1141,6 @@ char * _PREHASH_Notes; char * _PREHASH_AvatarID; char * _PREHASH_FounderID; char * _PREHASH_EndPointID; -char * _PREHASH_StipendEstimate; char * _PREHASH_LocationLookAt; char * _PREHASH_Sound; char * _PREHASH_Cover; @@ -1271,12 +1160,12 @@ char * _PREHASH_ProfileHollow; char * _PREHASH_GroupRoleChanges; char * _PREHASH_Count; char * _PREHASH_South; -char * _PREHASH_Entry; char * _PREHASH_ObjectUpdateCompressed; char * _PREHASH_MuteFlags; char * _PREHASH_Group; char * _PREHASH_AgentPause; char * _PREHASH_LanguagesText; +char * _PREHASH_Error; char * _PREHASH_InternalScriptMail; char * _PREHASH_FindAgent; char * _PREHASH_AgentData; @@ -1285,7 +1174,6 @@ char * _PREHASH_AssetBlock; char * _PREHASH_AcceptNotices; char * _PREHASH_SetGroupAcceptNotices; char * _PREHASH_CloseCircuit; -char * _PREHASH_LogControl; char * _PREHASH_TeleportFinish; char * _PREHASH_PathRevolutions; char * _PREHASH_ClassifiedInfoReply; @@ -1302,7 +1190,6 @@ char * _PREHASH_DataHomeLocationRequest; char * _PREHASH_EventNotificationAddRequest; char * _PREHASH_ParcelDwellRequest; char * _PREHASH_EventLocationRequest; -char * _PREHASH_EndPeriod; char * _PREHASH_SetStartLocationRequest; char * _PREHASH_QueryStart; char * _PREHASH_EjectData; @@ -1315,7 +1202,6 @@ char * _PREHASH_ParcelRelease; char * _PREHASH_VFileType; char * _PREHASH_EjectGroupMemberReply; char * _PREHASH_ImageData; -char * _PREHASH_SpaceServerSimulatorTimeMessage; char * _PREHASH_SimulatorViewerTimeMessage; char * _PREHASH_Rotation; char * _PREHASH_Selection; @@ -1323,7 +1209,6 @@ char * _PREHASH_TransactionData; char * _PREHASH_OperationData; char * _PREHASH_ExpirationDate; char * _PREHASH_ParcelDeedToGroup; -char * _PREHASH_DirPicksReply; char * _PREHASH_AvatarPicksReply; char * _PREHASH_GroupTitlesReply; char * _PREHASH_AgentInfo; @@ -1334,8 +1219,8 @@ char * _PREHASH_PassPrice; char * _PREHASH_SourceID; char * _PREHASH_ChangeUserRights; char * _PREHASH_TeleportFlags; -char * _PREHASH_AssetData; char * _PREHASH_SlaveParcelData; +char * _PREHASH_AssetData; char * _PREHASH_MultipleObjectUpdate; char * _PREHASH_ObjectUpdate; char * _PREHASH_ImprovedTerseObjectUpdate; @@ -1351,7 +1236,6 @@ char * _PREHASH_TaskLocalID; char * _PREHASH_ClaimDate; char * _PREHASH_MergeParcel; char * _PREHASH_Priority; -char * _PREHASH_Building; char * _PREHASH_QueryText; char * _PREHASH_GroupNoticeAdd; char * _PREHASH_ReturnType; @@ -1361,7 +1245,6 @@ char * _PREHASH_HeaderData; char * _PREHASH_RequestMultipleObjects; char * _PREHASH_RetrieveInstantMessages; char * _PREHASH_OpenCircuit; -char * _PREHASH_SecureSessionID; char * _PREHASH_CrossedRegion; char * _PREHASH_DirGroupsReply; char * _PREHASH_AvatarGroupsReply; @@ -1372,18 +1255,14 @@ char * _PREHASH_Position; char * _PREHASH_ParentEstate; char * _PREHASH_EstateName; char * _PREHASH_MuteName; -char * _PREHASH_StartParcelRename; -char * _PREHASH_BulkParcelRename; char * _PREHASH_ParcelRename; char * _PREHASH_ViewerFilename; -char * _PREHASH_Positive; char * _PREHASH_UserReportInternal; char * _PREHASH_AvatarPropertiesRequest; char * _PREHASH_ParcelPropertiesRequest; char * _PREHASH_GroupProfileRequest; char * _PREHASH_AgentDataUpdateRequest; char * _PREHASH_PriceObjectScaleFactor; -char * _PREHASH_DirPicksQuery; char * _PREHASH_OpenEnrollment; char * _PREHASH_GroupData; char * _PREHASH_RequestGodlikePowers; @@ -1394,7 +1273,6 @@ char * _PREHASH_Controls; char * _PREHASH_FirstDetachAll; char * _PREHASH_EstateID; char * _PREHASH_ImprovedInstantMessage; -char * _PREHASH_AgentQuit; char * _PREHASH_CheckParcelSales; char * _PREHASH_ParcelSales; char * _PREHASH_CurrentInterval; @@ -1411,12 +1289,8 @@ char * _PREHASH_OwnerIDs; char * _PREHASH_SystemKickUser; char * _PREHASH_TransactionTime; char * _PREHASH_TimeToLive; -char * _PREHASH_StartParcelRemove; -char * _PREHASH_BulkParcelRemove; char * _PREHASH_OldAgentID; -char * _PREHASH_BonusEstimate; char * _PREHASH_MusicURL; -char * _PREHASH_CompleteLure; char * _PREHASH_ParcelPrimBonus; char * _PREHASH_EjectUser; char * _PREHASH_CoarseLocationUpdate; @@ -1449,10 +1323,6 @@ char * _PREHASH_ParcelProperties; char * _PREHASH_EstateOwnerID; char * _PREHASH_LogoutRequest; char * _PREHASH_AssetUploadRequest; -char * _PREHASH_ReputationIndividualRequest; -char * _PREHASH_MajorVersion; -char * _PREHASH_MinorVersion; -char * _PREHASH_SimulatorAssign; char * _PREHASH_TransactionType; char * _PREHASH_AvatarPropertiesUpdate; char * _PREHASH_ParcelPropertiesUpdate; @@ -1461,7 +1331,6 @@ char * _PREHASH_AbortXfer; char * _PREHASH_DeRezAck; char * _PREHASH_TakeControls; char * _PREHASH_DirLandReply; -char * _PREHASH_SpaceLocationTeleportReply; char * _PREHASH_MuteType; char * _PREHASH_IMViaEMail; char * _PREHASH_RentPrice; @@ -1502,7 +1371,6 @@ void init_prehash_data() _PREHASH_PartnerID = gMessageStringTable.getString("PartnerID"); _PREHASH_DirLandQuery = gMessageStringTable.getString("DirLandQuery"); _PREHASH_TeleportStart = gMessageStringTable.getString("TeleportStart"); - _PREHASH_LogMessages = gMessageStringTable.getString("LogMessages"); _PREHASH_AboutText = gMessageStringTable.getString("AboutText"); _PREHASH_VisualParam = gMessageStringTable.getString("VisualParam"); _PREHASH_GroupPrims = gMessageStringTable.getString("GroupPrims"); @@ -1510,10 +1378,8 @@ void init_prehash_data() _PREHASH_ID = gMessageStringTable.getString("ID"); _PREHASH_UUIDNameRequest = gMessageStringTable.getString("UUIDNameRequest"); _PREHASH_UUIDGroupNameRequest = gMessageStringTable.getString("UUIDGroupNameRequest"); - _PREHASH_MoneyTransactionsRequest = gMessageStringTable.getString("MoneyTransactionsRequest"); _PREHASH_GroupAccountTransactionsRequest = gMessageStringTable.getString("GroupAccountTransactionsRequest"); _PREHASH_MapNameRequest = gMessageStringTable.getString("MapNameRequest"); - _PREHASH_MailTaskSimRequest = gMessageStringTable.getString("MailTaskSimRequest"); _PREHASH_UpdateSimulator = gMessageStringTable.getString("UpdateSimulator"); _PREHASH_BillableFactor = gMessageStringTable.getString("BillableFactor"); _PREHASH_ObjectBonusFactor = gMessageStringTable.getString("ObjectBonusFactor"); @@ -1523,7 +1389,6 @@ void init_prehash_data() _PREHASH_LayerType = gMessageStringTable.getString("LayerType"); _PREHASH_OwnerRole = gMessageStringTable.getString("OwnerRole"); _PREHASH_ParcelOverlay = gMessageStringTable.getString("ParcelOverlay"); - _PREHASH_AdjustBalance = gMessageStringTable.getString("AdjustBalance"); _PREHASH_GroupOwned = gMessageStringTable.getString("GroupOwned"); _PREHASH_IP = gMessageStringTable.getString("IP"); _PREHASH_ChatFromViewer = gMessageStringTable.getString("ChatFromViewer"); @@ -1558,8 +1423,8 @@ void init_prehash_data() _PREHASH_UpdateBlock = gMessageStringTable.getString("UpdateBlock"); _PREHASH_ClassifiedGodDelete = gMessageStringTable.getString("ClassifiedGodDelete"); _PREHASH_ObjectGrabUpdate = gMessageStringTable.getString("ObjectGrabUpdate"); - _PREHASH_TaxDate = gMessageStringTable.getString("TaxDate"); _PREHASH_LocationPos = gMessageStringTable.getString("LocationPos"); + _PREHASH_TaxDate = gMessageStringTable.getString("TaxDate"); _PREHASH_StartDateTime = gMessageStringTable.getString("StartDateTime"); _PREHASH_ObjectUpdateCached = gMessageStringTable.getString("ObjectUpdateCached"); _PREHASH_Packets = gMessageStringTable.getString("Packets"); @@ -1591,14 +1456,11 @@ void init_prehash_data() _PREHASH_ClassifiedFlags = gMessageStringTable.getString("ClassifiedFlags"); _PREHASH_ControlFlags = gMessageStringTable.getString("ControlFlags"); _PREHASH_TeleportRequest = gMessageStringTable.getString("TeleportRequest"); - _PREHASH_SpaceLocationTeleportRequest = gMessageStringTable.getString("SpaceLocationTeleportRequest"); - _PREHASH_LeaderBoardRequest = gMessageStringTable.getString("LeaderBoardRequest"); _PREHASH_ScriptTeleportRequest = gMessageStringTable.getString("ScriptTeleportRequest"); + _PREHASH_EstateCovenantRequest = gMessageStringTable.getString("EstateCovenantRequest"); _PREHASH_DateUTC = gMessageStringTable.getString("DateUTC"); _PREHASH_TaskIDs = gMessageStringTable.getString("TaskIDs"); - _PREHASH_EstateCovenantRequest = gMessageStringTable.getString("EstateCovenantRequest"); _PREHASH_RequestResult = gMessageStringTable.getString("RequestResult"); - _PREHASH_ReputationAgentAssign = gMessageStringTable.getString("ReputationAgentAssign"); _PREHASH_CanAcceptAgents = gMessageStringTable.getString("CanAcceptAgents"); _PREHASH_ObjectSaleInfo = gMessageStringTable.getString("ObjectSaleInfo"); _PREHASH_KillChildAgents = gMessageStringTable.getString("KillChildAgents"); @@ -1610,7 +1472,6 @@ void init_prehash_data() _PREHASH_OwnershipCost = gMessageStringTable.getString("OwnershipCost"); _PREHASH_AvatarNotesUpdate = gMessageStringTable.getString("AvatarNotesUpdate"); _PREHASH_PID = gMessageStringTable.getString("PID"); - _PREHASH_TimeString = gMessageStringTable.getString("TimeString"); _PREHASH_DirPopularReply = gMessageStringTable.getString("DirPopularReply"); _PREHASH_TerrainHeightRange00 = gMessageStringTable.getString("TerrainHeightRange00"); _PREHASH_SimData = gMessageStringTable.getString("SimData"); @@ -1636,7 +1497,6 @@ void init_prehash_data() _PREHASH_URL = gMessageStringTable.getString("URL"); _PREHASH_CreationDate = gMessageStringTable.getString("CreationDate"); _PREHASH_JointPivot = gMessageStringTable.getString("JointPivot"); - _PREHASH_RateeID = gMessageStringTable.getString("RateeID"); _PREHASH_FPS = gMessageStringTable.getString("FPS"); _PREHASH_HasTelehub = gMessageStringTable.getString("HasTelehub"); _PREHASH_PathEnd = gMessageStringTable.getString("PathEnd"); @@ -1661,7 +1521,6 @@ void init_prehash_data() _PREHASH_ParcelAccessListReply = gMessageStringTable.getString("ParcelAccessListReply"); _PREHASH_RpcChannelReply = gMessageStringTable.getString("RpcChannelReply"); _PREHASH_RegionPresenceResponse = gMessageStringTable.getString("RegionPresenceResponse"); - _PREHASH_AgentPresenceResponse = gMessageStringTable.getString("AgentPresenceResponse"); _PREHASH_CharterMember = gMessageStringTable.getString("CharterMember"); _PREHASH_EdgeData = gMessageStringTable.getString("EdgeData"); _PREHASH_NameData = gMessageStringTable.getString("NameData"); @@ -1675,14 +1534,12 @@ void init_prehash_data() _PREHASH_ParcelPropertiesRequestByID = gMessageStringTable.getString("ParcelPropertiesRequestByID"); _PREHASH_ObjectLink = gMessageStringTable.getString("ObjectLink"); _PREHASH_RpcScriptReplyInbound = gMessageStringTable.getString("RpcScriptReplyInbound"); - _PREHASH_BoardData = gMessageStringTable.getString("BoardData"); _PREHASH_RezData = gMessageStringTable.getString("RezData"); _PREHASH_RemoveInventoryObjects = gMessageStringTable.getString("RemoveInventoryObjects"); _PREHASH_GroupProposalBallot = gMessageStringTable.getString("GroupProposalBallot"); _PREHASH_RPCServerIP = gMessageStringTable.getString("RPCServerIP"); _PREHASH_Far = gMessageStringTable.getString("Far"); _PREHASH_GodSessionID = gMessageStringTable.getString("GodSessionID"); - _PREHASH_ViewerDigest = gMessageStringTable.getString("ViewerDigest"); _PREHASH_FLAboutText = gMessageStringTable.getString("FLAboutText"); _PREHASH_RegionHandshakeReply = gMessageStringTable.getString("RegionHandshakeReply"); _PREHASH_GroupActiveProposalItemReply = gMessageStringTable.getString("GroupActiveProposalItemReply"); @@ -1694,7 +1551,6 @@ void init_prehash_data() _PREHASH_NewName = gMessageStringTable.getString("NewName"); _PREHASH_Key = gMessageStringTable.getString("Key"); _PREHASH_AgentID = gMessageStringTable.getString("AgentID"); - _PREHASH_OnlineStatusRequest = gMessageStringTable.getString("OnlineStatusRequest"); _PREHASH_EventNotificationRemoveRequest = gMessageStringTable.getString("EventNotificationRemoveRequest"); _PREHASH_NewFolderID = gMessageStringTable.getString("NewFolderID"); _PREHASH_Arc = gMessageStringTable.getString("Arc"); @@ -1706,7 +1562,6 @@ void init_prehash_data() _PREHASH_MiscStats = gMessageStringTable.getString("MiscStats"); _PREHASH_ImageID = gMessageStringTable.getString("ImageID"); _PREHASH_DataPacket = gMessageStringTable.getString("DataPacket"); - _PREHASH_ObjectDehinge = gMessageStringTable.getString("ObjectDehinge"); _PREHASH_You = gMessageStringTable.getString("You"); _PREHASH_ScriptControlChange = gMessageStringTable.getString("ScriptControlChange"); _PREHASH_LoadURL = gMessageStringTable.getString("LoadURL"); @@ -1723,9 +1578,9 @@ void init_prehash_data() _PREHASH_SetGroupContribution = gMessageStringTable.getString("SetGroupContribution"); _PREHASH_Offline = gMessageStringTable.getString("Offline"); _PREHASH_AgentIsNowWearing = gMessageStringTable.getString("AgentIsNowWearing"); - _PREHASH_SecPerDay = gMessageStringTable.getString("SecPerDay"); _PREHASH_Members = gMessageStringTable.getString("Members"); _PREHASH_FailedResends = gMessageStringTable.getString("FailedResends"); + _PREHASH_SecPerDay = gMessageStringTable.getString("SecPerDay"); _PREHASH_CameraCenter = gMessageStringTable.getString("CameraCenter"); _PREHASH_CameraLeftAxis = gMessageStringTable.getString("CameraLeftAxis"); _PREHASH_ExBlock = gMessageStringTable.getString("ExBlock"); @@ -1733,7 +1588,6 @@ void init_prehash_data() _PREHASH_NetTest = gMessageStringTable.getString("NetTest"); _PREHASH_DiscardLevel = gMessageStringTable.getString("DiscardLevel"); _PREHASH_LayerID = gMessageStringTable.getString("LayerID"); - _PREHASH_RatorID = gMessageStringTable.getString("RatorID"); _PREHASH_GrabOffset = gMessageStringTable.getString("GrabOffset"); _PREHASH_SimPort = gMessageStringTable.getString("SimPort"); _PREHASH_PricePerMeter = gMessageStringTable.getString("PricePerMeter"); @@ -1753,21 +1607,16 @@ void init_prehash_data() _PREHASH_RegionsVisited = gMessageStringTable.getString("RegionsVisited"); _PREHASH_DirClassifiedReply = gMessageStringTable.getString("DirClassifiedReply"); _PREHASH_AvatarClassifiedReply = gMessageStringTable.getString("AvatarClassifiedReply"); - _PREHASH_ReputationIndividualReply = gMessageStringTable.getString("ReputationIndividualReply"); _PREHASH_MediaURL = gMessageStringTable.getString("MediaURL"); _PREHASH_CompleteAgentMovement = gMessageStringTable.getString("CompleteAgentMovement"); - _PREHASH_SpaceIP = gMessageStringTable.getString("SpaceIP"); _PREHASH_ClassifiedID = gMessageStringTable.getString("ClassifiedID"); _PREHASH_LocalID = gMessageStringTable.getString("LocalID"); + _PREHASH_SpaceIP = gMessageStringTable.getString("SpaceIP"); _PREHASH_RemoveItem = gMessageStringTable.getString("RemoveItem"); _PREHASH_LogFailedMoneyTransaction = gMessageStringTable.getString("LogFailedMoneyTransaction"); _PREHASH_ViewerStartAuction = gMessageStringTable.getString("ViewerStartAuction"); _PREHASH_StartAuction = gMessageStringTable.getString("StartAuction"); - _PREHASH_NameValueName = gMessageStringTable.getString("NameValueName"); - _PREHASH_AngVelX = gMessageStringTable.getString("AngVelX"); _PREHASH_DuplicateFlags = gMessageStringTable.getString("DuplicateFlags"); - _PREHASH_AngVelY = gMessageStringTable.getString("AngVelY"); - _PREHASH_AngVelZ = gMessageStringTable.getString("AngVelZ"); _PREHASH_TextColor = gMessageStringTable.getString("TextColor"); _PREHASH_SlaveID = gMessageStringTable.getString("SlaveID"); _PREHASH_Charter = gMessageStringTable.getString("Charter"); @@ -1778,21 +1627,16 @@ void init_prehash_data() _PREHASH_OwnerIsGroup = gMessageStringTable.getString("OwnerIsGroup"); _PREHASH_NameValuePair = gMessageStringTable.getString("NameValuePair"); _PREHASH_RemoveNameValuePair = gMessageStringTable.getString("RemoveNameValuePair"); - _PREHASH_GetNameValuePair = gMessageStringTable.getString("GetNameValuePair"); _PREHASH_BulkUpdateInventory = gMessageStringTable.getString("BulkUpdateInventory"); _PREHASH_UpdateTaskInventory = gMessageStringTable.getString("UpdateTaskInventory"); _PREHASH_RemoveTaskInventory = gMessageStringTable.getString("RemoveTaskInventory"); _PREHASH_MoveTaskInventory = gMessageStringTable.getString("MoveTaskInventory"); _PREHASH_RequestTaskInventory = gMessageStringTable.getString("RequestTaskInventory"); _PREHASH_ReplyTaskInventory = gMessageStringTable.getString("ReplyTaskInventory"); - _PREHASH_DeclineInventory = gMessageStringTable.getString("DeclineInventory"); _PREHASH_AggregatePermInventory = gMessageStringTable.getString("AggregatePermInventory"); - _PREHASH_SimulatorInfo = gMessageStringTable.getString("SimulatorInfo"); - _PREHASH_MoneyTransactionsReply = gMessageStringTable.getString("MoneyTransactionsReply"); _PREHASH_GroupAccountTransactionsReply = gMessageStringTable.getString("GroupAccountTransactionsReply"); - _PREHASH_MailTaskSimReply = gMessageStringTable.getString("MailTaskSimReply"); + _PREHASH_SimulatorInfo = gMessageStringTable.getString("SimulatorInfo"); _PREHASH_WearableData = gMessageStringTable.getString("WearableData"); - _PREHASH_StatisticsData = gMessageStringTable.getString("StatisticsData"); _PREHASH_Enabled = gMessageStringTable.getString("Enabled"); _PREHASH_Savings = gMessageStringTable.getString("Savings"); _PREHASH_SimulatorLoad = gMessageStringTable.getString("SimulatorLoad"); @@ -1804,15 +1648,12 @@ void init_prehash_data() _PREHASH_LeaveGroupRequest = gMessageStringTable.getString("LeaveGroupRequest"); _PREHASH_InviteGroupRequest = gMessageStringTable.getString("InviteGroupRequest"); _PREHASH_LiveHelpGroupRequest = gMessageStringTable.getString("LiveHelpGroupRequest"); - _PREHASH_ServerVersion = gMessageStringTable.getString("ServerVersion"); _PREHASH_PriceParcelClaimFactor = gMessageStringTable.getString("PriceParcelClaimFactor"); _PREHASH_BillableArea = gMessageStringTable.getString("BillableArea"); _PREHASH_ObjectID = gMessageStringTable.getString("ObjectID"); _PREHASH_ObjectFlagUpdate = gMessageStringTable.getString("ObjectFlagUpdate"); _PREHASH_GroupRoleUpdate = gMessageStringTable.getString("GroupRoleUpdate"); _PREHASH_RequestInventoryAsset = gMessageStringTable.getString("RequestInventoryAsset"); - _PREHASH_RedoLand = gMessageStringTable.getString("RedoLand"); - _PREHASH_TravelAccess = gMessageStringTable.getString("TravelAccess"); _PREHASH_ChangedGrid = gMessageStringTable.getString("ChangedGrid"); _PREHASH_AgentDropGroup = gMessageStringTable.getString("AgentDropGroup"); _PREHASH_Details = gMessageStringTable.getString("Details"); @@ -1845,7 +1686,6 @@ void init_prehash_data() _PREHASH_GlobalPos = gMessageStringTable.getString("GlobalPos"); _PREHASH_GrabOffsetInitial = gMessageStringTable.getString("GrabOffsetInitial"); _PREHASH_IsTrial = gMessageStringTable.getString("IsTrial"); - _PREHASH_FinalizeLogout = gMessageStringTable.getString("FinalizeLogout"); _PREHASH_ObjectDuplicateOnRay = gMessageStringTable.getString("ObjectDuplicateOnRay"); _PREHASH_GroupMembershipCount = gMessageStringTable.getString("GroupMembershipCount"); _PREHASH_MethodData = gMessageStringTable.getString("MethodData"); @@ -1881,32 +1721,26 @@ void init_prehash_data() _PREHASH_SimWideMaxPrims = gMessageStringTable.getString("SimWideMaxPrims"); _PREHASH_TotalPrims = gMessageStringTable.getString("TotalPrims"); _PREHASH_ProfileBegin = gMessageStringTable.getString("ProfileBegin"); - _PREHASH_MoneyDetailsRequest = gMessageStringTable.getString("MoneyDetailsRequest"); _PREHASH_Request = gMessageStringTable.getString("Request"); _PREHASH_GroupAccountDetailsRequest = gMessageStringTable.getString("GroupAccountDetailsRequest"); _PREHASH_GroupActiveProposalsRequest = gMessageStringTable.getString("GroupActiveProposalsRequest"); _PREHASH_StringValue = gMessageStringTable.getString("StringValue"); - _PREHASH_ClosestSimulator = gMessageStringTable.getString("ClosestSimulator"); _PREHASH_Version = gMessageStringTable.getString("Version"); _PREHASH_OtherCount = gMessageStringTable.getString("OtherCount"); _PREHASH_MemberCount = gMessageStringTable.getString("MemberCount"); _PREHASH_ChatData = gMessageStringTable.getString("ChatData"); _PREHASH_IsGroupOwned = gMessageStringTable.getString("IsGroupOwned"); _PREHASH_EnergyEfficiency = gMessageStringTable.getString("EnergyEfficiency"); - _PREHASH_MaxPlace = gMessageStringTable.getString("MaxPlace"); _PREHASH_PickInfoUpdate = gMessageStringTable.getString("PickInfoUpdate"); _PREHASH_PickDelete = gMessageStringTable.getString("PickDelete"); _PREHASH_ScriptReset = gMessageStringTable.getString("ScriptReset"); _PREHASH_Requester = gMessageStringTable.getString("Requester"); _PREHASH_ForSale = gMessageStringTable.getString("ForSale"); _PREHASH_NearestLandingRegionReply = gMessageStringTable.getString("NearestLandingRegionReply"); - _PREHASH_RecordAgentPresence = gMessageStringTable.getString("RecordAgentPresence"); - _PREHASH_EraseAgentPresence = gMessageStringTable.getString("EraseAgentPresence"); _PREHASH_ParcelID = gMessageStringTable.getString("ParcelID"); _PREHASH_Godlike = gMessageStringTable.getString("Godlike"); _PREHASH_TotalDebits = gMessageStringTable.getString("TotalDebits"); _PREHASH_Direction = gMessageStringTable.getString("Direction"); - _PREHASH_Appearance = gMessageStringTable.getString("Appearance"); _PREHASH_HealthData = gMessageStringTable.getString("HealthData"); _PREHASH_LeftAxis = gMessageStringTable.getString("LeftAxis"); _PREHASH_LocationBlock = gMessageStringTable.getString("LocationBlock"); @@ -1914,41 +1748,31 @@ void init_prehash_data() _PREHASH_TerrainStartHeight00 = gMessageStringTable.getString("TerrainStartHeight00"); _PREHASH_TerrainStartHeight01 = gMessageStringTable.getString("TerrainStartHeight01"); _PREHASH_TerrainStartHeight10 = gMessageStringTable.getString("TerrainStartHeight10"); - _PREHASH_ObjectHinge = gMessageStringTable.getString("ObjectHinge"); _PREHASH_TerrainStartHeight11 = gMessageStringTable.getString("TerrainStartHeight11"); - _PREHASH_MetersPerGrid = gMessageStringTable.getString("MetersPerGrid"); _PREHASH_WaterHeight = gMessageStringTable.getString("WaterHeight"); _PREHASH_FetchInventoryReply = gMessageStringTable.getString("FetchInventoryReply"); - _PREHASH_MoneySummaryReply = gMessageStringTable.getString("MoneySummaryReply"); _PREHASH_GroupAccountSummaryReply = gMessageStringTable.getString("GroupAccountSummaryReply"); _PREHASH_AttachedSound = gMessageStringTable.getString("AttachedSound"); _PREHASH_ParamInUse = gMessageStringTable.getString("ParamInUse"); _PREHASH_GodKickUser = gMessageStringTable.getString("GodKickUser"); _PREHASH_PickName = gMessageStringTable.getString("PickName"); _PREHASH_TaskName = gMessageStringTable.getString("TaskName"); - _PREHASH_SubType = gMessageStringTable.getString("SubType"); _PREHASH_ObjectCount = gMessageStringTable.getString("ObjectCount"); _PREHASH_RegionPresenceRequestByHandle = gMessageStringTable.getString("RegionPresenceRequestByHandle"); _PREHASH_RezSingleAttachmentFromInv = gMessageStringTable.getString("RezSingleAttachmentFromInv"); _PREHASH_ChildAgentUpdate = gMessageStringTable.getString("ChildAgentUpdate"); - _PREHASH_ToID = gMessageStringTable.getString("ToID"); - _PREHASH_ViewerPort = gMessageStringTable.getString("ViewerPort"); _PREHASH_IsOwnerGroup = gMessageStringTable.getString("IsOwnerGroup"); _PREHASH_AgentHeightWidth = gMessageStringTable.getString("AgentHeightWidth"); _PREHASH_VerticalAngle = gMessageStringTable.getString("VerticalAngle"); _PREHASH_WearableType = gMessageStringTable.getString("WearableType"); _PREHASH_AggregatePermNextOwner = gMessageStringTable.getString("AggregatePermNextOwner"); _PREHASH_ShowInList = gMessageStringTable.getString("ShowInList"); - _PREHASH_PositionSuggestion = gMessageStringTable.getString("PositionSuggestion"); _PREHASH_UpdateParcel = gMessageStringTable.getString("UpdateParcel"); - _PREHASH_ClearAgentSessions = gMessageStringTable.getString("ClearAgentSessions"); _PREHASH_SetAlwaysRun = gMessageStringTable.getString("SetAlwaysRun"); _PREHASH_NVPair = gMessageStringTable.getString("NVPair"); _PREHASH_SearchType = gMessageStringTable.getString("SearchType"); _PREHASH_ObjectSpinStart = gMessageStringTable.getString("ObjectSpinStart"); _PREHASH_UseEstateSun = gMessageStringTable.getString("UseEstateSun"); - _PREHASH_LogoutBlock = gMessageStringTable.getString("LogoutBlock"); - _PREHASH_RelayLogControl = gMessageStringTable.getString("RelayLogControl"); _PREHASH_RegionID = gMessageStringTable.getString("RegionID"); _PREHASH_AbuseRegionID = gMessageStringTable.getString("AbuseRegionID"); _PREHASH_Creator = gMessageStringTable.getString("Creator"); @@ -1957,14 +1781,12 @@ void init_prehash_data() _PREHASH_EventInfoReply = gMessageStringTable.getString("EventInfoReply"); _PREHASH_UserInfoReply = gMessageStringTable.getString("UserInfoReply"); _PREHASH_PathRadiusOffset = gMessageStringTable.getString("PathRadiusOffset"); - _PREHASH_SessionInfo = gMessageStringTable.getString("SessionInfo"); _PREHASH_TextureData = gMessageStringTable.getString("TextureData"); _PREHASH_ChatPass = gMessageStringTable.getString("ChatPass"); _PREHASH_TargetID = gMessageStringTable.getString("TargetID"); _PREHASH_DefaultPayPrice = gMessageStringTable.getString("DefaultPayPrice"); _PREHASH_UserLocation = gMessageStringTable.getString("UserLocation"); _PREHASH_MaxPrims = gMessageStringTable.getString("MaxPrims"); - _PREHASH_RegionIP = gMessageStringTable.getString("RegionIP"); _PREHASH_LandmarkID = gMessageStringTable.getString("LandmarkID"); _PREHASH_InitiateDownload = gMessageStringTable.getString("InitiateDownload"); _PREHASH_Name = gMessageStringTable.getString("Name"); @@ -1972,18 +1794,13 @@ void init_prehash_data() _PREHASH_ParcelSetOtherCleanTime = gMessageStringTable.getString("ParcelSetOtherCleanTime"); _PREHASH_TeleportPriceExponent = gMessageStringTable.getString("TeleportPriceExponent"); _PREHASH_Gain = gMessageStringTable.getString("Gain"); - _PREHASH_VelX = gMessageStringTable.getString("VelX"); _PREHASH_PacketAck = gMessageStringTable.getString("PacketAck"); _PREHASH_PathSkew = gMessageStringTable.getString("PathSkew"); - _PREHASH_Negative = gMessageStringTable.getString("Negative"); - _PREHASH_VelY = gMessageStringTable.getString("VelY"); _PREHASH_SimulatorShutdownRequest = gMessageStringTable.getString("SimulatorShutdownRequest"); _PREHASH_NearestLandingRegionRequest = gMessageStringTable.getString("NearestLandingRegionRequest"); - _PREHASH_VelZ = gMessageStringTable.getString("VelZ"); _PREHASH_OtherID = gMessageStringTable.getString("OtherID"); _PREHASH_MemberID = gMessageStringTable.getString("MemberID"); _PREHASH_MapLayerRequest = gMessageStringTable.getString("MapLayerRequest"); - _PREHASH_PatchVersion = gMessageStringTable.getString("PatchVersion"); _PREHASH_ObjectScale = gMessageStringTable.getString("ObjectScale"); _PREHASH_TargetIP = gMessageStringTable.getString("TargetIP"); _PREHASH_Redo = gMessageStringTable.getString("Redo"); @@ -2026,27 +1843,20 @@ void init_prehash_data() _PREHASH_Code = gMessageStringTable.getString("Code"); _PREHASH_InvType = gMessageStringTable.getString("InvType"); _PREHASH_AgentFOV = gMessageStringTable.getString("AgentFOV"); - _PREHASH_BulkMoneyTransfer = gMessageStringTable.getString("BulkMoneyTransfer"); _PREHASH_Audible = gMessageStringTable.getString("Audible"); _PREHASH_AuctionData = gMessageStringTable.getString("AuctionData"); _PREHASH_IDBlock = gMessageStringTable.getString("IDBlock"); - _PREHASH_ReputationData = gMessageStringTable.getString("ReputationData"); _PREHASH_West = gMessageStringTable.getString("West"); _PREHASH_Undo = gMessageStringTable.getString("Undo"); _PREHASH_TotalNumItems = gMessageStringTable.getString("TotalNumItems"); _PREHASH_Info = gMessageStringTable.getString("Info"); _PREHASH_Area = gMessageStringTable.getString("Area"); - _PREHASH_Behavior = gMessageStringTable.getString("Behavior"); _PREHASH_SimCrashed = gMessageStringTable.getString("SimCrashed"); _PREHASH_Text = gMessageStringTable.getString("Text"); - _PREHASH_AgentToNewRegion = gMessageStringTable.getString("AgentToNewRegion"); _PREHASH_PriceGroupCreate = gMessageStringTable.getString("PriceGroupCreate"); _PREHASH_ObjectShape = gMessageStringTable.getString("ObjectShape"); _PREHASH_GroupRoleDataReply = gMessageStringTable.getString("GroupRoleDataReply"); - _PREHASH_PosX = gMessageStringTable.getString("PosX"); - _PREHASH_PosY = gMessageStringTable.getString("PosY"); _PREHASH_MuteCRC = gMessageStringTable.getString("MuteCRC"); - _PREHASH_PosZ = gMessageStringTable.getString("PosZ"); _PREHASH_Size = gMessageStringTable.getString("Size"); _PREHASH_FromAddress = gMessageStringTable.getString("FromAddress"); _PREHASH_Body = gMessageStringTable.getString("Body"); @@ -2064,16 +1874,14 @@ void init_prehash_data() _PREHASH_SoundID = gMessageStringTable.getString("SoundID"); _PREHASH_Item = gMessageStringTable.getString("Item"); _PREHASH_User = gMessageStringTable.getString("User"); - _PREHASH_RemoteInfos = gMessageStringTable.getString("RemoteInfos"); _PREHASH_Prey = gMessageStringTable.getString("Prey"); - _PREHASH_UsecSinceStart = gMessageStringTable.getString("UsecSinceStart"); _PREHASH_RayStart = gMessageStringTable.getString("RayStart"); + _PREHASH_UsecSinceStart = gMessageStringTable.getString("UsecSinceStart"); _PREHASH_ParcelData = gMessageStringTable.getString("ParcelData"); _PREHASH_CameraUpAxis = gMessageStringTable.getString("CameraUpAxis"); _PREHASH_ScriptDialog = gMessageStringTable.getString("ScriptDialog"); _PREHASH_MasterParcelData = gMessageStringTable.getString("MasterParcelData"); _PREHASH_Invalid = gMessageStringTable.getString("Invalid"); - _PREHASH_MinPlace = gMessageStringTable.getString("MinPlace"); _PREHASH_ProfileCurve = gMessageStringTable.getString("ProfileCurve"); _PREHASH_ParcelAccessListUpdate = gMessageStringTable.getString("ParcelAccessListUpdate"); _PREHASH_MuteListUpdate = gMessageStringTable.getString("MuteListUpdate"); @@ -2092,14 +1900,12 @@ void init_prehash_data() _PREHASH_IsTemporary = gMessageStringTable.getString("IsTemporary"); _PREHASH_InsigniaID = gMessageStringTable.getString("InsigniaID"); _PREHASH_CheckFlags = gMessageStringTable.getString("CheckFlags"); - _PREHASH_TransferPriority = gMessageStringTable.getString("TransferPriority"); _PREHASH_EventID = gMessageStringTable.getString("EventID"); _PREHASH_Selected = gMessageStringTable.getString("Selected"); _PREHASH_FromAgentId = gMessageStringTable.getString("FromAgentId"); _PREHASH_Type = gMessageStringTable.getString("Type"); _PREHASH_ChatType = gMessageStringTable.getString("ChatType"); _PREHASH_ReportData = gMessageStringTable.getString("ReportData"); - _PREHASH_LeaderBoardData = gMessageStringTable.getString("LeaderBoardData"); _PREHASH_RequestBlock = gMessageStringTable.getString("RequestBlock"); _PREHASH_GrantData = gMessageStringTable.getString("GrantData"); _PREHASH_DetachAttachmentIntoInv = gMessageStringTable.getString("DetachAttachmentIntoInv"); @@ -2115,12 +1921,9 @@ void init_prehash_data() _PREHASH_OfflineNotification = gMessageStringTable.getString("OfflineNotification"); _PREHASH_SendPostcard = gMessageStringTable.getString("SendPostcard"); _PREHASH_RequestFlags = gMessageStringTable.getString("RequestFlags"); - _PREHASH_MoneyHistoryRequest = gMessageStringTable.getString("MoneyHistoryRequest"); - _PREHASH_MoneySummaryRequest = gMessageStringTable.getString("MoneySummaryRequest"); _PREHASH_GroupAccountSummaryRequest = gMessageStringTable.getString("GroupAccountSummaryRequest"); _PREHASH_GroupVoteHistoryRequest = gMessageStringTable.getString("GroupVoteHistoryRequest"); _PREHASH_ParamValue = gMessageStringTable.getString("ParamValue"); - _PREHASH_Checksum = gMessageStringTable.getString("Checksum"); _PREHASH_MaxAgents = gMessageStringTable.getString("MaxAgents"); _PREHASH_CreateNewOutfitAttachments = gMessageStringTable.getString("CreateNewOutfitAttachments"); _PREHASH_RegionHandle = gMessageStringTable.getString("RegionHandle"); @@ -2130,12 +1933,10 @@ void init_prehash_data() _PREHASH_GroupNoticeID = gMessageStringTable.getString("GroupNoticeID"); _PREHASH_ParcelName = gMessageStringTable.getString("ParcelName"); _PREHASH_PriceObjectRent = gMessageStringTable.getString("PriceObjectRent"); - _PREHASH_ConnectAgentToUserserver = gMessageStringTable.getString("ConnectAgentToUserserver"); - _PREHASH_ConnectToUserserver = gMessageStringTable.getString("ConnectToUserserver"); _PREHASH_OfferCallingCard = gMessageStringTable.getString("OfferCallingCard"); - _PREHASH_AgentAccess = gMessageStringTable.getString("AgentAccess"); _PREHASH_AcceptCallingCard = gMessageStringTable.getString("AcceptCallingCard"); _PREHASH_DeclineCallingCard = gMessageStringTable.getString("DeclineCallingCard"); + _PREHASH_AgentAccess = gMessageStringTable.getString("AgentAccess"); _PREHASH_DataHomeLocationReply = gMessageStringTable.getString("DataHomeLocationReply"); _PREHASH_EventLocationReply = gMessageStringTable.getString("EventLocationReply"); _PREHASH_TerseDateID = gMessageStringTable.getString("TerseDateID"); @@ -2153,8 +1954,8 @@ void init_prehash_data() _PREHASH_IntervalDays = gMessageStringTable.getString("IntervalDays"); _PREHASH_PathScaleX = gMessageStringTable.getString("PathScaleX"); _PREHASH_FromTaskID = gMessageStringTable.getString("FromTaskID"); - _PREHASH_TimeInfo = gMessageStringTable.getString("TimeInfo"); _PREHASH_PathScaleY = gMessageStringTable.getString("PathScaleY"); + _PREHASH_TimeInfo = gMessageStringTable.getString("TimeInfo"); _PREHASH_PublicCount = gMessageStringTable.getString("PublicCount"); _PREHASH_ParcelJoin = gMessageStringTable.getString("ParcelJoin"); _PREHASH_GroupRolesCount = gMessageStringTable.getString("GroupRolesCount"); @@ -2179,7 +1980,6 @@ void init_prehash_data() _PREHASH_PassToAgent = gMessageStringTable.getString("PassToAgent"); _PREHASH_PreyAgent = gMessageStringTable.getString("PreyAgent"); _PREHASH_SimStats = gMessageStringTable.getString("SimStats"); - _PREHASH_Options = gMessageStringTable.getString("Options"); _PREHASH_LogoutReply = gMessageStringTable.getString("LogoutReply"); _PREHASH_FeatureDisabled = gMessageStringTable.getString("FeatureDisabled"); _PREHASH_ObjectLocalID = gMessageStringTable.getString("ObjectLocalID"); @@ -2190,10 +1990,8 @@ void init_prehash_data() _PREHASH_MasterID = gMessageStringTable.getString("MasterID"); _PREHASH_TransferData = gMessageStringTable.getString("TransferData"); _PREHASH_WantToMask = gMessageStringTable.getString("WantToMask"); - _PREHASH_AvatarData = gMessageStringTable.getString("AvatarData"); _PREHASH_ParcelSelectObjects = gMessageStringTable.getString("ParcelSelectObjects"); _PREHASH_ExtraParams = gMessageStringTable.getString("ExtraParams"); - _PREHASH_LogLogin = gMessageStringTable.getString("LogLogin"); _PREHASH_CreatorID = gMessageStringTable.getString("CreatorID"); _PREHASH_Summary = gMessageStringTable.getString("Summary"); _PREHASH_BuyObjectInventory = gMessageStringTable.getString("BuyObjectInventory"); @@ -2234,8 +2032,8 @@ void init_prehash_data() _PREHASH_GranterID = gMessageStringTable.getString("GranterID"); _PREHASH_WantToText = gMessageStringTable.getString("WantToText"); _PREHASH_ReportType = gMessageStringTable.getString("ReportType"); - _PREHASH_DataBlock = gMessageStringTable.getString("DataBlock"); _PREHASH_SimulatorReady = gMessageStringTable.getString("SimulatorReady"); + _PREHASH_DataBlock = gMessageStringTable.getString("DataBlock"); _PREHASH_AnimationSourceList = gMessageStringTable.getString("AnimationSourceList"); _PREHASH_SubscribeLoad = gMessageStringTable.getString("SubscribeLoad"); _PREHASH_UnsubscribeLoad = gMessageStringTable.getString("UnsubscribeLoad"); @@ -2262,9 +2060,8 @@ void init_prehash_data() _PREHASH_GestureFlags = gMessageStringTable.getString("GestureFlags"); _PREHASH_XferID = gMessageStringTable.getString("XferID"); _PREHASH_StatValue = gMessageStringTable.getString("StatValue"); - _PREHASH_PickID = gMessageStringTable.getString("PickID"); _PREHASH_TaskID = gMessageStringTable.getString("TaskID"); - _PREHASH_GridsPerEdge = gMessageStringTable.getString("GridsPerEdge"); + _PREHASH_PickID = gMessageStringTable.getString("PickID"); _PREHASH_RayEnd = gMessageStringTable.getString("RayEnd"); _PREHASH_Throttles = gMessageStringTable.getString("Throttles"); _PREHASH_RebakeAvatarTextures = gMessageStringTable.getString("RebakeAvatarTextures"); @@ -2277,30 +2074,24 @@ void init_prehash_data() _PREHASH_TitleRoleID = gMessageStringTable.getString("TitleRoleID"); _PREHASH_SquareMetersCredit = gMessageStringTable.getString("SquareMetersCredit"); _PREHASH_Filename = gMessageStringTable.getString("Filename"); - _PREHASH_SecuredTemplateChecksumRequest = gMessageStringTable.getString("SecuredTemplateChecksumRequest"); - _PREHASH_TemplateChecksumRequest = gMessageStringTable.getString("TemplateChecksumRequest"); - _PREHASH_AgentPresenceRequest = gMessageStringTable.getString("AgentPresenceRequest"); _PREHASH_ClassifiedInfoRequest = gMessageStringTable.getString("ClassifiedInfoRequest"); _PREHASH_ParcelInfoRequest = gMessageStringTable.getString("ParcelInfoRequest"); _PREHASH_ParcelObjectOwnersRequest = gMessageStringTable.getString("ParcelObjectOwnersRequest"); _PREHASH_TeleportLandmarkRequest = gMessageStringTable.getString("TeleportLandmarkRequest"); _PREHASH_EventInfoRequest = gMessageStringTable.getString("EventInfoRequest"); - _PREHASH_ChatFromSimulator = gMessageStringTable.getString("ChatFromSimulator"); - _PREHASH_PickInfoRequest = gMessageStringTable.getString("PickInfoRequest"); _PREHASH_MoneyBalanceRequest = gMessageStringTable.getString("MoneyBalanceRequest"); _PREHASH_GroupMembersRequest = gMessageStringTable.getString("GroupMembersRequest"); _PREHASH_GroupRoleMembersRequest = gMessageStringTable.getString("GroupRoleMembersRequest"); + _PREHASH_ChatFromSimulator = gMessageStringTable.getString("ChatFromSimulator"); _PREHASH_OldFolderID = gMessageStringTable.getString("OldFolderID"); _PREHASH_UserInfoRequest = gMessageStringTable.getString("UserInfoRequest"); _PREHASH_TextureID = gMessageStringTable.getString("TextureID"); _PREHASH_ProfileURL = gMessageStringTable.getString("ProfileURL"); _PREHASH_Handle = gMessageStringTable.getString("Handle"); - _PREHASH_StartParcelRenameAck = gMessageStringTable.getString("StartParcelRenameAck"); _PREHASH_ButtonIndex = gMessageStringTable.getString("ButtonIndex"); _PREHASH_GetScriptRunning = gMessageStringTable.getString("GetScriptRunning"); _PREHASH_SetScriptRunning = gMessageStringTable.getString("SetScriptRunning"); _PREHASH_Health = gMessageStringTable.getString("Health"); - _PREHASH_FileID = gMessageStringTable.getString("FileID"); _PREHASH_CircuitInfo = gMessageStringTable.getString("CircuitInfo"); _PREHASH_ObjectBuy = gMessageStringTable.getString("ObjectBuy"); _PREHASH_ProfileEnd = gMessageStringTable.getString("ProfileEnd"); @@ -2325,7 +2116,6 @@ void init_prehash_data() _PREHASH_Change = gMessageStringTable.getString("Change"); _PREHASH_Height = gMessageStringTable.getString("Height"); _PREHASH_Region = gMessageStringTable.getString("Region"); - _PREHASH_MoneyHistoryReply = gMessageStringTable.getString("MoneyHistoryReply"); _PREHASH_TelehubInfo = gMessageStringTable.getString("TelehubInfo"); _PREHASH_StateSave = gMessageStringTable.getString("StateSave"); _PREHASH_RoleData = gMessageStringTable.getString("RoleData"); @@ -2336,11 +2126,10 @@ void init_prehash_data() _PREHASH_UsePhysics = gMessageStringTable.getString("UsePhysics"); _PREHASH_RegionDenyTransacted = gMessageStringTable.getString("RegionDenyTransacted"); _PREHASH_JointType = gMessageStringTable.getString("JointType"); - _PREHASH_TaxEstimate = gMessageStringTable.getString("TaxEstimate"); _PREHASH_ObjectTaxEstimate = gMessageStringTable.getString("ObjectTaxEstimate"); _PREHASH_LightTaxEstimate = gMessageStringTable.getString("LightTaxEstimate"); - _PREHASH_TeleportLandingStatusChanged = gMessageStringTable.getString("TeleportLandingStatusChanged"); _PREHASH_LandTaxEstimate = gMessageStringTable.getString("LandTaxEstimate"); + _PREHASH_TeleportLandingStatusChanged = gMessageStringTable.getString("TeleportLandingStatusChanged"); _PREHASH_GroupTaxEstimate = gMessageStringTable.getString("GroupTaxEstimate"); _PREHASH_AvgViewerFPS = gMessageStringTable.getString("AvgViewerFPS"); _PREHASH_Buttons = gMessageStringTable.getString("Buttons"); @@ -2372,8 +2161,6 @@ void init_prehash_data() _PREHASH_ChannelType = gMessageStringTable.getString("ChannelType"); _PREHASH_NonExemptMembers = gMessageStringTable.getString("NonExemptMembers"); _PREHASH_Agents = gMessageStringTable.getString("Agents"); - _PREHASH_SimulatorStart = gMessageStringTable.getString("SimulatorStart"); - _PREHASH_Enable = gMessageStringTable.getString("Enable"); _PREHASH_MemberData = gMessageStringTable.getString("MemberData"); _PREHASH_ToGroupID = gMessageStringTable.getString("ToGroupID"); _PREHASH_ImageNotInDatabase = gMessageStringTable.getString("ImageNotInDatabase"); @@ -2381,27 +2168,21 @@ void init_prehash_data() _PREHASH_AnimID = gMessageStringTable.getString("AnimID"); _PREHASH_Serial = gMessageStringTable.getString("Serial"); _PREHASH_AbuseRegionName = gMessageStringTable.getString("AbuseRegionName"); - _PREHASH_ControlPort = gMessageStringTable.getString("ControlPort"); _PREHASH_ModifyLand = gMessageStringTable.getString("ModifyLand"); _PREHASH_Digest = gMessageStringTable.getString("Digest"); _PREHASH_Victim = gMessageStringTable.getString("Victim"); _PREHASH_Script = gMessageStringTable.getString("Script"); - _PREHASH_TemplateChecksumReply = gMessageStringTable.getString("TemplateChecksumReply"); _PREHASH_PickInfoReply = gMessageStringTable.getString("PickInfoReply"); _PREHASH_MoneyBalanceReply = gMessageStringTable.getString("MoneyBalanceReply"); _PREHASH_RoutedMoneyBalanceReply = gMessageStringTable.getString("RoutedMoneyBalanceReply"); _PREHASH_RoleID = gMessageStringTable.getString("RoleID"); _PREHASH_RegionInfo = gMessageStringTable.getString("RegionInfo"); - _PREHASH_Sequence = gMessageStringTable.getString("Sequence"); _PREHASH_GodUpdateRegionInfo = gMessageStringTable.getString("GodUpdateRegionInfo"); - _PREHASH_LocalX = gMessageStringTable.getString("LocalX"); - _PREHASH_LocalY = gMessageStringTable.getString("LocalY"); _PREHASH_StartAnim = gMessageStringTable.getString("StartAnim"); - _PREHASH_Location = gMessageStringTable.getString("Location"); _PREHASH_Action = gMessageStringTable.getString("Action"); + _PREHASH_Location = gMessageStringTable.getString("Location"); _PREHASH_Rights = gMessageStringTable.getString("Rights"); _PREHASH_SearchDir = gMessageStringTable.getString("SearchDir"); - _PREHASH_Active = gMessageStringTable.getString("Active"); _PREHASH_TransferRequest = gMessageStringTable.getString("TransferRequest"); _PREHASH_ScriptSensorRequest = gMessageStringTable.getString("ScriptSensorRequest"); _PREHASH_MoneyTransferRequest = gMessageStringTable.getString("MoneyTransferRequest"); @@ -2412,8 +2193,6 @@ void init_prehash_data() _PREHASH_SharedData = gMessageStringTable.getString("SharedData"); _PREHASH_PSBlock = gMessageStringTable.getString("PSBlock"); _PREHASH_UUIDNameBlock = gMessageStringTable.getString("UUIDNameBlock"); - _PREHASH_Viewer = gMessageStringTable.getString("Viewer"); - _PREHASH_GroupNoticeDelete = gMessageStringTable.getString("GroupNoticeDelete"); _PREHASH_GroupTitleUpdate = gMessageStringTable.getString("GroupTitleUpdate"); _PREHASH_Method = gMessageStringTable.getString("Method"); _PREHASH_TouchName = gMessageStringTable.getString("TouchName"); @@ -2425,11 +2204,9 @@ void init_prehash_data() _PREHASH_SystemMessage = gMessageStringTable.getString("SystemMessage"); _PREHASH_BodyRotation = gMessageStringTable.getString("BodyRotation"); _PREHASH_SearchRegions = gMessageStringTable.getString("SearchRegions"); - _PREHASH_Ignore = gMessageStringTable.getString("Ignore"); _PREHASH_AnimationData = gMessageStringTable.getString("AnimationData"); _PREHASH_StatID = gMessageStringTable.getString("StatID"); _PREHASH_ItemID = gMessageStringTable.getString("ItemID"); - _PREHASH_AvatarStatisticsReply = gMessageStringTable.getString("AvatarStatisticsReply"); _PREHASH_ScriptDialogReply = gMessageStringTable.getString("ScriptDialogReply"); _PREHASH_RegionIDAndHandleReply = gMessageStringTable.getString("RegionIDAndHandleReply"); _PREHASH_CameraAtOffset = gMessageStringTable.getString("CameraAtOffset"); @@ -2454,7 +2231,6 @@ void init_prehash_data() _PREHASH_RegionPort = gMessageStringTable.getString("RegionPort"); _PREHASH_PriceEnergyUnit = gMessageStringTable.getString("PriceEnergyUnit"); _PREHASH_Bitmap = gMessageStringTable.getString("Bitmap"); - _PREHASH_TrackAgentSession = gMessageStringTable.getString("TrackAgentSession"); _PREHASH_CacheMissType = gMessageStringTable.getString("CacheMissType"); _PREHASH_VFileID = gMessageStringTable.getString("VFileID"); _PREHASH_GroupInsigniaID = gMessageStringTable.getString("GroupInsigniaID"); @@ -2502,7 +2278,6 @@ void init_prehash_data() _PREHASH_CanAcceptTasks = gMessageStringTable.getString("CanAcceptTasks"); _PREHASH_ItemData = gMessageStringTable.getString("ItemData"); _PREHASH_AnimationList = gMessageStringTable.getString("AnimationList"); - _PREHASH_PassObject = gMessageStringTable.getString("PassObject"); _PREHASH_Reputation = gMessageStringTable.getString("Reputation"); _PREHASH_IntValue = gMessageStringTable.getString("IntValue"); _PREHASH_TargetType = gMessageStringTable.getString("TargetType"); @@ -2525,10 +2300,8 @@ void init_prehash_data() _PREHASH_DirFindQueryBackend = gMessageStringTable.getString("DirFindQueryBackend"); _PREHASH_DirPlacesQueryBackend = gMessageStringTable.getString("DirPlacesQueryBackend"); _PREHASH_DirClassifiedQueryBackend = gMessageStringTable.getString("DirClassifiedQueryBackend"); - _PREHASH_DirPicksQueryBackend = gMessageStringTable.getString("DirPicksQueryBackend"); _PREHASH_DirLandQueryBackend = gMessageStringTable.getString("DirLandQueryBackend"); _PREHASH_DirPopularQueryBackend = gMessageStringTable.getString("DirPopularQueryBackend"); - _PREHASH_LogoutDemand = gMessageStringTable.getString("LogoutDemand"); _PREHASH_HistoryData = gMessageStringTable.getString("HistoryData"); _PREHASH_SnapshotID = gMessageStringTable.getString("SnapshotID"); _PREHASH_Aspect = gMessageStringTable.getString("Aspect"); @@ -2536,7 +2309,6 @@ void init_prehash_data() _PREHASH_VoteCast = gMessageStringTable.getString("VoteCast"); _PREHASH_CastsShadows = gMessageStringTable.getString("CastsShadows"); _PREHASH_EveryoneMask = gMessageStringTable.getString("EveryoneMask"); - _PREHASH_SetSunPhase = gMessageStringTable.getString("SetSunPhase"); _PREHASH_ObjectSpinUpdate = gMessageStringTable.getString("ObjectSpinUpdate"); _PREHASH_MaturePublish = gMessageStringTable.getString("MaturePublish"); _PREHASH_UseExistingAsset = gMessageStringTable.getString("UseExistingAsset"); @@ -2545,7 +2317,6 @@ void init_prehash_data() _PREHASH_TeleportCancel = gMessageStringTable.getString("TeleportCancel"); _PREHASH_UnixTime = gMessageStringTable.getString("UnixTime"); _PREHASH_QueryFlags = gMessageStringTable.getString("QueryFlags"); - _PREHASH_LastExecFroze = gMessageStringTable.getString("LastExecFroze"); _PREHASH_AlwaysRun = gMessageStringTable.getString("AlwaysRun"); _PREHASH_Bottom = gMessageStringTable.getString("Bottom"); _PREHASH_ButtonData = gMessageStringTable.getString("ButtonData"); @@ -2564,7 +2335,6 @@ void init_prehash_data() _PREHASH_GroupNoticesListRequest = gMessageStringTable.getString("GroupNoticesListRequest"); _PREHASH_ParcelAccessListRequest = gMessageStringTable.getString("ParcelAccessListRequest"); _PREHASH_MuteListRequest = gMessageStringTable.getString("MuteListRequest"); - _PREHASH_StartPeriod = gMessageStringTable.getString("StartPeriod"); _PREHASH_RpcChannelRequest = gMessageStringTable.getString("RpcChannelRequest"); _PREHASH_LandStatRequest = gMessageStringTable.getString("LandStatRequest"); _PREHASH_PlacesQuery = gMessageStringTable.getString("PlacesQuery"); @@ -2592,34 +2362,27 @@ void init_prehash_data() _PREHASH_SoundTrigger = gMessageStringTable.getString("SoundTrigger"); _PREHASH_TerrainRaiseLimit = gMessageStringTable.getString("TerrainRaiseLimit"); _PREHASH_Quorum = gMessageStringTable.getString("Quorum"); - _PREHASH_TokenBlock = gMessageStringTable.getString("TokenBlock"); _PREHASH_AgentBlock = gMessageStringTable.getString("AgentBlock"); _PREHASH_CommandBlock = gMessageStringTable.getString("CommandBlock"); _PREHASH_PricePublicObjectDecay = gMessageStringTable.getString("PricePublicObjectDecay"); _PREHASH_SpawnPointPos = gMessageStringTable.getString("SpawnPointPos"); - _PREHASH_AttachedSoundCutoffRadius = gMessageStringTable.getString("AttachedSoundCutoffRadius"); _PREHASH_VolumeDetail = gMessageStringTable.getString("VolumeDetail"); _PREHASH_FromAgentName = gMessageStringTable.getString("FromAgentName"); _PREHASH_Range = gMessageStringTable.getString("Range"); _PREHASH_DirectoryVisibility = gMessageStringTable.getString("DirectoryVisibility"); _PREHASH_PublicIP = gMessageStringTable.getString("PublicIP"); _PREHASH_TeleportFailed = gMessageStringTable.getString("TeleportFailed"); - _PREHASH_OnlineStatusReply = gMessageStringTable.getString("OnlineStatusReply"); - _PREHASH_RequestAvatarInfo = gMessageStringTable.getString("RequestAvatarInfo"); _PREHASH_PreloadSound = gMessageStringTable.getString("PreloadSound"); _PREHASH_ScreenshotID = gMessageStringTable.getString("ScreenshotID"); _PREHASH_CovenantTimestamp = gMessageStringTable.getString("CovenantTimestamp"); _PREHASH_OldestUnacked = gMessageStringTable.getString("OldestUnacked"); _PREHASH_SimulatorIP = gMessageStringTable.getString("SimulatorIP"); - _PREHASH_ObjectImport = gMessageStringTable.getString("ObjectImport"); _PREHASH_Value = gMessageStringTable.getString("Value"); _PREHASH_JointAxisOrAnchor = gMessageStringTable.getString("JointAxisOrAnchor"); _PREHASH_Test0 = gMessageStringTable.getString("Test0"); _PREHASH_Test1 = gMessageStringTable.getString("Test1"); _PREHASH_Test2 = gMessageStringTable.getString("Test2"); _PREHASH_SunPhase = gMessageStringTable.getString("SunPhase"); - _PREHASH_Place = gMessageStringTable.getString("Place"); - _PREHASH_Phase = gMessageStringTable.getString("Phase"); _PREHASH_ParcelDivide = gMessageStringTable.getString("ParcelDivide"); _PREHASH_PriceObjectClaim = gMessageStringTable.getString("PriceObjectClaim"); _PREHASH_Field = gMessageStringTable.getString("Field"); @@ -2629,7 +2392,6 @@ void init_prehash_data() _PREHASH_Score = gMessageStringTable.getString("Score"); _PREHASH_Image = gMessageStringTable.getString("Image"); _PREHASH_ObjectClickAction = gMessageStringTable.getString("ObjectClickAction"); - _PREHASH_Delta = gMessageStringTable.getString("Delta"); _PREHASH_Parameter = gMessageStringTable.getString("Parameter"); _PREHASH_Flags = gMessageStringTable.getString("Flags"); _PREHASH_Plane = gMessageStringTable.getString("Plane"); @@ -2639,26 +2401,24 @@ void init_prehash_data() _PREHASH_Textures = gMessageStringTable.getString("Textures"); _PREHASH_EventData = gMessageStringTable.getString("EventData"); _PREHASH_Final = gMessageStringTable.getString("Final"); + _PREHASH_System = gMessageStringTable.getString("System"); _PREHASH_TelehubPos = gMessageStringTable.getString("TelehubPos"); _PREHASH_ReportAutosaveCrash = gMessageStringTable.getString("ReportAutosaveCrash"); _PREHASH_CreateTrustedCircuit = gMessageStringTable.getString("CreateTrustedCircuit"); _PREHASH_DenyTrustedCircuit = gMessageStringTable.getString("DenyTrustedCircuit"); _PREHASH_RequestTrustedCircuit = gMessageStringTable.getString("RequestTrustedCircuit"); _PREHASH_Codec = gMessageStringTable.getString("Codec"); - _PREHASH_Level = gMessageStringTable.getString("Level"); _PREHASH_Modal = gMessageStringTable.getString("Modal"); _PREHASH_ChildAgentUnknown = gMessageStringTable.getString("ChildAgentUnknown"); _PREHASH_LandingType = gMessageStringTable.getString("LandingType"); _PREHASH_ScriptRunningReply = gMessageStringTable.getString("ScriptRunningReply"); - _PREHASH_MoneyDetailsReply = gMessageStringTable.getString("MoneyDetailsReply"); _PREHASH_Reply = gMessageStringTable.getString("Reply"); + _PREHASH_GroupAccountDetailsReply = gMessageStringTable.getString("GroupAccountDetailsReply"); _PREHASH_TelehubRot = gMessageStringTable.getString("TelehubRot"); - _PREHASH_RequestFriendship = gMessageStringTable.getString("RequestFriendship"); _PREHASH_AcceptFriendship = gMessageStringTable.getString("AcceptFriendship"); - _PREHASH_GroupAccountDetailsReply = gMessageStringTable.getString("GroupAccountDetailsReply"); + _PREHASH_ItemType = gMessageStringTable.getString("ItemType"); _PREHASH_DwellInfo = gMessageStringTable.getString("DwellInfo"); _PREHASH_AgentResume = gMessageStringTable.getString("AgentResume"); - _PREHASH_ItemType = gMessageStringTable.getString("ItemType"); _PREHASH_MailFilter = gMessageStringTable.getString("MailFilter"); _PREHASH_Disconnect = gMessageStringTable.getString("Disconnect"); _PREHASH_SimPosition = gMessageStringTable.getString("SimPosition"); @@ -2685,7 +2445,6 @@ void init_prehash_data() _PREHASH_CategoryID = gMessageStringTable.getString("CategoryID"); _PREHASH_Token = gMessageStringTable.getString("Token"); _PREHASH_AggregatePerms = gMessageStringTable.getString("AggregatePerms"); - _PREHASH_StartParcelRemoveAck = gMessageStringTable.getString("StartParcelRemoveAck"); _PREHASH_ObjectSelect = gMessageStringTable.getString("ObjectSelect"); _PREHASH_ForceObjectSelect = gMessageStringTable.getString("ForceObjectSelect"); _PREHASH_Price = gMessageStringTable.getString("Price"); @@ -2714,7 +2473,6 @@ void init_prehash_data() _PREHASH_AvatarID = gMessageStringTable.getString("AvatarID"); _PREHASH_FounderID = gMessageStringTable.getString("FounderID"); _PREHASH_EndPointID = gMessageStringTable.getString("EndPointID"); - _PREHASH_StipendEstimate = gMessageStringTable.getString("StipendEstimate"); _PREHASH_LocationLookAt = gMessageStringTable.getString("LocationLookAt"); _PREHASH_Sound = gMessageStringTable.getString("Sound"); _PREHASH_Cover = gMessageStringTable.getString("Cover"); @@ -2734,12 +2492,12 @@ void init_prehash_data() _PREHASH_GroupRoleChanges = gMessageStringTable.getString("GroupRoleChanges"); _PREHASH_Count = gMessageStringTable.getString("Count"); _PREHASH_South = gMessageStringTable.getString("South"); - _PREHASH_Entry = gMessageStringTable.getString("Entry"); _PREHASH_ObjectUpdateCompressed = gMessageStringTable.getString("ObjectUpdateCompressed"); _PREHASH_MuteFlags = gMessageStringTable.getString("MuteFlags"); _PREHASH_Group = gMessageStringTable.getString("Group"); _PREHASH_AgentPause = gMessageStringTable.getString("AgentPause"); _PREHASH_LanguagesText = gMessageStringTable.getString("LanguagesText"); + _PREHASH_Error = gMessageStringTable.getString("Error"); _PREHASH_InternalScriptMail = gMessageStringTable.getString("InternalScriptMail"); _PREHASH_FindAgent = gMessageStringTable.getString("FindAgent"); _PREHASH_AgentData = gMessageStringTable.getString("AgentData"); @@ -2748,7 +2506,6 @@ void init_prehash_data() _PREHASH_AcceptNotices = gMessageStringTable.getString("AcceptNotices"); _PREHASH_SetGroupAcceptNotices = gMessageStringTable.getString("SetGroupAcceptNotices"); _PREHASH_CloseCircuit = gMessageStringTable.getString("CloseCircuit"); - _PREHASH_LogControl = gMessageStringTable.getString("LogControl"); _PREHASH_TeleportFinish = gMessageStringTable.getString("TeleportFinish"); _PREHASH_PathRevolutions = gMessageStringTable.getString("PathRevolutions"); _PREHASH_ClassifiedInfoReply = gMessageStringTable.getString("ClassifiedInfoReply"); @@ -2765,7 +2522,6 @@ void init_prehash_data() _PREHASH_EventNotificationAddRequest = gMessageStringTable.getString("EventNotificationAddRequest"); _PREHASH_ParcelDwellRequest = gMessageStringTable.getString("ParcelDwellRequest"); _PREHASH_EventLocationRequest = gMessageStringTable.getString("EventLocationRequest"); - _PREHASH_EndPeriod = gMessageStringTable.getString("EndPeriod"); _PREHASH_SetStartLocationRequest = gMessageStringTable.getString("SetStartLocationRequest"); _PREHASH_QueryStart = gMessageStringTable.getString("QueryStart"); _PREHASH_EjectData = gMessageStringTable.getString("EjectData"); @@ -2778,7 +2534,6 @@ void init_prehash_data() _PREHASH_VFileType = gMessageStringTable.getString("VFileType"); _PREHASH_EjectGroupMemberReply = gMessageStringTable.getString("EjectGroupMemberReply"); _PREHASH_ImageData = gMessageStringTable.getString("ImageData"); - _PREHASH_SpaceServerSimulatorTimeMessage = gMessageStringTable.getString("SpaceServerSimulatorTimeMessage"); _PREHASH_SimulatorViewerTimeMessage = gMessageStringTable.getString("SimulatorViewerTimeMessage"); _PREHASH_Rotation = gMessageStringTable.getString("Rotation"); _PREHASH_Selection = gMessageStringTable.getString("Selection"); @@ -2786,7 +2541,6 @@ void init_prehash_data() _PREHASH_OperationData = gMessageStringTable.getString("OperationData"); _PREHASH_ExpirationDate = gMessageStringTable.getString("ExpirationDate"); _PREHASH_ParcelDeedToGroup = gMessageStringTable.getString("ParcelDeedToGroup"); - _PREHASH_DirPicksReply = gMessageStringTable.getString("DirPicksReply"); _PREHASH_AvatarPicksReply = gMessageStringTable.getString("AvatarPicksReply"); _PREHASH_GroupTitlesReply = gMessageStringTable.getString("GroupTitlesReply"); _PREHASH_AgentInfo = gMessageStringTable.getString("AgentInfo"); @@ -2797,8 +2551,8 @@ void init_prehash_data() _PREHASH_SourceID = gMessageStringTable.getString("SourceID"); _PREHASH_ChangeUserRights = gMessageStringTable.getString("ChangeUserRights"); _PREHASH_TeleportFlags = gMessageStringTable.getString("TeleportFlags"); - _PREHASH_AssetData = gMessageStringTable.getString("AssetData"); _PREHASH_SlaveParcelData = gMessageStringTable.getString("SlaveParcelData"); + _PREHASH_AssetData = gMessageStringTable.getString("AssetData"); _PREHASH_MultipleObjectUpdate = gMessageStringTable.getString("MultipleObjectUpdate"); _PREHASH_ObjectUpdate = gMessageStringTable.getString("ObjectUpdate"); _PREHASH_ImprovedTerseObjectUpdate = gMessageStringTable.getString("ImprovedTerseObjectUpdate"); @@ -2814,7 +2568,6 @@ void init_prehash_data() _PREHASH_ClaimDate = gMessageStringTable.getString("ClaimDate"); _PREHASH_MergeParcel = gMessageStringTable.getString("MergeParcel"); _PREHASH_Priority = gMessageStringTable.getString("Priority"); - _PREHASH_Building = gMessageStringTable.getString("Building"); _PREHASH_QueryText = gMessageStringTable.getString("QueryText"); _PREHASH_GroupNoticeAdd = gMessageStringTable.getString("GroupNoticeAdd"); _PREHASH_ReturnType = gMessageStringTable.getString("ReturnType"); @@ -2824,7 +2577,6 @@ void init_prehash_data() _PREHASH_RequestMultipleObjects = gMessageStringTable.getString("RequestMultipleObjects"); _PREHASH_RetrieveInstantMessages = gMessageStringTable.getString("RetrieveInstantMessages"); _PREHASH_OpenCircuit = gMessageStringTable.getString("OpenCircuit"); - _PREHASH_SecureSessionID = gMessageStringTable.getString("SecureSessionID"); _PREHASH_CrossedRegion = gMessageStringTable.getString("CrossedRegion"); _PREHASH_DirGroupsReply = gMessageStringTable.getString("DirGroupsReply"); _PREHASH_AvatarGroupsReply = gMessageStringTable.getString("AvatarGroupsReply"); @@ -2835,18 +2587,14 @@ void init_prehash_data() _PREHASH_ParentEstate = gMessageStringTable.getString("ParentEstate"); _PREHASH_EstateName = gMessageStringTable.getString("EstateName"); _PREHASH_MuteName = gMessageStringTable.getString("MuteName"); - _PREHASH_StartParcelRename = gMessageStringTable.getString("StartParcelRename"); - _PREHASH_BulkParcelRename = gMessageStringTable.getString("BulkParcelRename"); _PREHASH_ParcelRename = gMessageStringTable.getString("ParcelRename"); _PREHASH_ViewerFilename = gMessageStringTable.getString("ViewerFilename"); - _PREHASH_Positive = gMessageStringTable.getString("Positive"); _PREHASH_UserReportInternal = gMessageStringTable.getString("UserReportInternal"); _PREHASH_AvatarPropertiesRequest = gMessageStringTable.getString("AvatarPropertiesRequest"); _PREHASH_ParcelPropertiesRequest = gMessageStringTable.getString("ParcelPropertiesRequest"); _PREHASH_GroupProfileRequest = gMessageStringTable.getString("GroupProfileRequest"); _PREHASH_AgentDataUpdateRequest = gMessageStringTable.getString("AgentDataUpdateRequest"); _PREHASH_PriceObjectScaleFactor = gMessageStringTable.getString("PriceObjectScaleFactor"); - _PREHASH_DirPicksQuery = gMessageStringTable.getString("DirPicksQuery"); _PREHASH_OpenEnrollment = gMessageStringTable.getString("OpenEnrollment"); _PREHASH_GroupData = gMessageStringTable.getString("GroupData"); _PREHASH_RequestGodlikePowers = gMessageStringTable.getString("RequestGodlikePowers"); @@ -2857,7 +2605,6 @@ void init_prehash_data() _PREHASH_FirstDetachAll = gMessageStringTable.getString("FirstDetachAll"); _PREHASH_EstateID = gMessageStringTable.getString("EstateID"); _PREHASH_ImprovedInstantMessage = gMessageStringTable.getString("ImprovedInstantMessage"); - _PREHASH_AgentQuit = gMessageStringTable.getString("AgentQuit"); _PREHASH_CheckParcelSales = gMessageStringTable.getString("CheckParcelSales"); _PREHASH_ParcelSales = gMessageStringTable.getString("ParcelSales"); _PREHASH_CurrentInterval = gMessageStringTable.getString("CurrentInterval"); @@ -2874,12 +2621,8 @@ void init_prehash_data() _PREHASH_SystemKickUser = gMessageStringTable.getString("SystemKickUser"); _PREHASH_TransactionTime = gMessageStringTable.getString("TransactionTime"); _PREHASH_TimeToLive = gMessageStringTable.getString("TimeToLive"); - _PREHASH_StartParcelRemove = gMessageStringTable.getString("StartParcelRemove"); - _PREHASH_BulkParcelRemove = gMessageStringTable.getString("BulkParcelRemove"); _PREHASH_OldAgentID = gMessageStringTable.getString("OldAgentID"); - _PREHASH_BonusEstimate = gMessageStringTable.getString("BonusEstimate"); _PREHASH_MusicURL = gMessageStringTable.getString("MusicURL"); - _PREHASH_CompleteLure = gMessageStringTable.getString("CompleteLure"); _PREHASH_ParcelPrimBonus = gMessageStringTable.getString("ParcelPrimBonus"); _PREHASH_EjectUser = gMessageStringTable.getString("EjectUser"); _PREHASH_CoarseLocationUpdate = gMessageStringTable.getString("CoarseLocationUpdate"); @@ -2912,10 +2655,6 @@ void init_prehash_data() _PREHASH_EstateOwnerID = gMessageStringTable.getString("EstateOwnerID"); _PREHASH_LogoutRequest = gMessageStringTable.getString("LogoutRequest"); _PREHASH_AssetUploadRequest = gMessageStringTable.getString("AssetUploadRequest"); - _PREHASH_ReputationIndividualRequest = gMessageStringTable.getString("ReputationIndividualRequest"); - _PREHASH_MajorVersion = gMessageStringTable.getString("MajorVersion"); - _PREHASH_MinorVersion = gMessageStringTable.getString("MinorVersion"); - _PREHASH_SimulatorAssign = gMessageStringTable.getString("SimulatorAssign"); _PREHASH_TransactionType = gMessageStringTable.getString("TransactionType"); _PREHASH_AvatarPropertiesUpdate = gMessageStringTable.getString("AvatarPropertiesUpdate"); _PREHASH_ParcelPropertiesUpdate = gMessageStringTable.getString("ParcelPropertiesUpdate"); @@ -2924,7 +2663,6 @@ void init_prehash_data() _PREHASH_DeRezAck = gMessageStringTable.getString("DeRezAck"); _PREHASH_TakeControls = gMessageStringTable.getString("TakeControls"); _PREHASH_DirLandReply = gMessageStringTable.getString("DirLandReply"); - _PREHASH_SpaceLocationTeleportReply = gMessageStringTable.getString("SpaceLocationTeleportReply"); _PREHASH_MuteType = gMessageStringTable.getString("MuteType"); _PREHASH_IMViaEMail = gMessageStringTable.getString("IMViaEMail"); _PREHASH_RentPrice = gMessageStringTable.getString("RentPrice"); diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index 209b399ce8..71661ef83d 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -10,7 +10,7 @@ #define LL_MESSAGE_PREHASH_H /** - * Generated from message template version number 1.053 + * Generated from message template version number 2.000 */ @@ -39,7 +39,6 @@ extern char * _PREHASH_ScriptAnswerYes; extern char * _PREHASH_PartnerID; extern char * _PREHASH_DirLandQuery; extern char * _PREHASH_TeleportStart; -extern char * _PREHASH_LogMessages; extern char * _PREHASH_AboutText; extern char * _PREHASH_VisualParam; extern char * _PREHASH_GroupPrims; @@ -47,10 +46,8 @@ extern char * _PREHASH_SelectedPrims; extern char * _PREHASH_ID; extern char * _PREHASH_UUIDNameRequest; extern char * _PREHASH_UUIDGroupNameRequest; -extern char * _PREHASH_MoneyTransactionsRequest; extern char * _PREHASH_GroupAccountTransactionsRequest; extern char * _PREHASH_MapNameRequest; -extern char * _PREHASH_MailTaskSimRequest; extern char * _PREHASH_UpdateSimulator; extern char * _PREHASH_BillableFactor; extern char * _PREHASH_ObjectBonusFactor; @@ -60,7 +57,6 @@ extern char * _PREHASH_ConfirmEnableSimulator; extern char * _PREHASH_LayerType; extern char * _PREHASH_OwnerRole; extern char * _PREHASH_ParcelOverlay; -extern char * _PREHASH_AdjustBalance; extern char * _PREHASH_GroupOwned; extern char * _PREHASH_IP; extern char * _PREHASH_ChatFromViewer; @@ -95,8 +91,8 @@ extern char * _PREHASH_SensedData; extern char * _PREHASH_UpdateBlock; extern char * _PREHASH_ClassifiedGodDelete; extern char * _PREHASH_ObjectGrabUpdate; -extern char * _PREHASH_TaxDate; extern char * _PREHASH_LocationPos; +extern char * _PREHASH_TaxDate; extern char * _PREHASH_StartDateTime; extern char * _PREHASH_ObjectUpdateCached; extern char * _PREHASH_Packets; @@ -128,14 +124,11 @@ extern char * _PREHASH_AABBMin; extern char * _PREHASH_ClassifiedFlags; extern char * _PREHASH_ControlFlags; extern char * _PREHASH_TeleportRequest; -extern char * _PREHASH_SpaceLocationTeleportRequest; -extern char * _PREHASH_LeaderBoardRequest; extern char * _PREHASH_ScriptTeleportRequest; +extern char * _PREHASH_EstateCovenantRequest; extern char * _PREHASH_DateUTC; extern char * _PREHASH_TaskIDs; -extern char * _PREHASH_EstateCovenantRequest; extern char * _PREHASH_RequestResult; -extern char * _PREHASH_ReputationAgentAssign; extern char * _PREHASH_CanAcceptAgents; extern char * _PREHASH_ObjectSaleInfo; extern char * _PREHASH_KillChildAgents; @@ -147,7 +140,6 @@ extern char * _PREHASH_InfoBlock; extern char * _PREHASH_OwnershipCost; extern char * _PREHASH_AvatarNotesUpdate; extern char * _PREHASH_PID; -extern char * _PREHASH_TimeString; extern char * _PREHASH_DirPopularReply; extern char * _PREHASH_TerrainHeightRange00; extern char * _PREHASH_SimData; @@ -173,7 +165,6 @@ extern char * _PREHASH_Objects; extern char * _PREHASH_URL; extern char * _PREHASH_CreationDate; extern char * _PREHASH_JointPivot; -extern char * _PREHASH_RateeID; extern char * _PREHASH_FPS; extern char * _PREHASH_HasTelehub; extern char * _PREHASH_PathEnd; @@ -198,7 +189,6 @@ extern char * _PREHASH_GroupNoticesListReply; extern char * _PREHASH_ParcelAccessListReply; extern char * _PREHASH_RpcChannelReply; extern char * _PREHASH_RegionPresenceResponse; -extern char * _PREHASH_AgentPresenceResponse; extern char * _PREHASH_CharterMember; extern char * _PREHASH_EdgeData; extern char * _PREHASH_NameData; @@ -212,14 +202,12 @@ extern char * _PREHASH_Mag; extern char * _PREHASH_ParcelPropertiesRequestByID; extern char * _PREHASH_ObjectLink; extern char * _PREHASH_RpcScriptReplyInbound; -extern char * _PREHASH_BoardData; extern char * _PREHASH_RezData; extern char * _PREHASH_RemoveInventoryObjects; extern char * _PREHASH_GroupProposalBallot; extern char * _PREHASH_RPCServerIP; extern char * _PREHASH_Far; extern char * _PREHASH_GodSessionID; -extern char * _PREHASH_ViewerDigest; extern char * _PREHASH_FLAboutText; extern char * _PREHASH_RegionHandshakeReply; extern char * _PREHASH_GroupActiveProposalItemReply; @@ -231,7 +219,6 @@ extern char * _PREHASH_Set; extern char * _PREHASH_NewName; extern char * _PREHASH_Key; extern char * _PREHASH_AgentID; -extern char * _PREHASH_OnlineStatusRequest; extern char * _PREHASH_EventNotificationRemoveRequest; extern char * _PREHASH_NewFolderID; extern char * _PREHASH_Arc; @@ -243,7 +230,6 @@ extern char * _PREHASH_Top; extern char * _PREHASH_MiscStats; extern char * _PREHASH_ImageID; extern char * _PREHASH_DataPacket; -extern char * _PREHASH_ObjectDehinge; extern char * _PREHASH_You; extern char * _PREHASH_ScriptControlChange; extern char * _PREHASH_LoadURL; @@ -260,9 +246,9 @@ extern char * _PREHASH_Contribution; extern char * _PREHASH_SetGroupContribution; extern char * _PREHASH_Offline; extern char * _PREHASH_AgentIsNowWearing; -extern char * _PREHASH_SecPerDay; extern char * _PREHASH_Members; extern char * _PREHASH_FailedResends; +extern char * _PREHASH_SecPerDay; extern char * _PREHASH_CameraCenter; extern char * _PREHASH_CameraLeftAxis; extern char * _PREHASH_ExBlock; @@ -270,7 +256,6 @@ extern char * _PREHASH_Channel; extern char * _PREHASH_NetTest; extern char * _PREHASH_DiscardLevel; extern char * _PREHASH_LayerID; -extern char * _PREHASH_RatorID; extern char * _PREHASH_GrabOffset; extern char * _PREHASH_SimPort; extern char * _PREHASH_PricePerMeter; @@ -290,21 +275,16 @@ extern char * _PREHASH_SitName; extern char * _PREHASH_RegionsVisited; extern char * _PREHASH_DirClassifiedReply; extern char * _PREHASH_AvatarClassifiedReply; -extern char * _PREHASH_ReputationIndividualReply; extern char * _PREHASH_MediaURL; extern char * _PREHASH_CompleteAgentMovement; -extern char * _PREHASH_SpaceIP; extern char * _PREHASH_ClassifiedID; extern char * _PREHASH_LocalID; +extern char * _PREHASH_SpaceIP; extern char * _PREHASH_RemoveItem; extern char * _PREHASH_LogFailedMoneyTransaction; extern char * _PREHASH_ViewerStartAuction; extern char * _PREHASH_StartAuction; -extern char * _PREHASH_NameValueName; -extern char * _PREHASH_AngVelX; extern char * _PREHASH_DuplicateFlags; -extern char * _PREHASH_AngVelY; -extern char * _PREHASH_AngVelZ; extern char * _PREHASH_TextColor; extern char * _PREHASH_SlaveID; extern char * _PREHASH_Charter; @@ -315,21 +295,16 @@ extern char * _PREHASH_ParcelAuctions; extern char * _PREHASH_OwnerIsGroup; extern char * _PREHASH_NameValuePair; extern char * _PREHASH_RemoveNameValuePair; -extern char * _PREHASH_GetNameValuePair; extern char * _PREHASH_BulkUpdateInventory; extern char * _PREHASH_UpdateTaskInventory; extern char * _PREHASH_RemoveTaskInventory; extern char * _PREHASH_MoveTaskInventory; extern char * _PREHASH_RequestTaskInventory; extern char * _PREHASH_ReplyTaskInventory; -extern char * _PREHASH_DeclineInventory; extern char * _PREHASH_AggregatePermInventory; -extern char * _PREHASH_SimulatorInfo; -extern char * _PREHASH_MoneyTransactionsReply; extern char * _PREHASH_GroupAccountTransactionsReply; -extern char * _PREHASH_MailTaskSimReply; +extern char * _PREHASH_SimulatorInfo; extern char * _PREHASH_WearableData; -extern char * _PREHASH_StatisticsData; extern char * _PREHASH_Enabled; extern char * _PREHASH_Savings; extern char * _PREHASH_SimulatorLoad; @@ -341,15 +316,12 @@ extern char * _PREHASH_JoinGroupRequest; extern char * _PREHASH_LeaveGroupRequest; extern char * _PREHASH_InviteGroupRequest; extern char * _PREHASH_LiveHelpGroupRequest; -extern char * _PREHASH_ServerVersion; extern char * _PREHASH_PriceParcelClaimFactor; extern char * _PREHASH_BillableArea; extern char * _PREHASH_ObjectID; extern char * _PREHASH_ObjectFlagUpdate; extern char * _PREHASH_GroupRoleUpdate; extern char * _PREHASH_RequestInventoryAsset; -extern char * _PREHASH_RedoLand; -extern char * _PREHASH_TravelAccess; extern char * _PREHASH_ChangedGrid; extern char * _PREHASH_AgentDropGroup; extern char * _PREHASH_Details; @@ -382,7 +354,6 @@ extern char * _PREHASH_Timestamp; extern char * _PREHASH_GlobalPos; extern char * _PREHASH_GrabOffsetInitial; extern char * _PREHASH_IsTrial; -extern char * _PREHASH_FinalizeLogout; extern char * _PREHASH_ObjectDuplicateOnRay; extern char * _PREHASH_GroupMembershipCount; extern char * _PREHASH_MethodData; @@ -418,32 +389,26 @@ extern char * _PREHASH_TaskData; extern char * _PREHASH_SimWideMaxPrims; extern char * _PREHASH_TotalPrims; extern char * _PREHASH_ProfileBegin; -extern char * _PREHASH_MoneyDetailsRequest; extern char * _PREHASH_Request; extern char * _PREHASH_GroupAccountDetailsRequest; extern char * _PREHASH_GroupActiveProposalsRequest; extern char * _PREHASH_StringValue; -extern char * _PREHASH_ClosestSimulator; extern char * _PREHASH_Version; extern char * _PREHASH_OtherCount; extern char * _PREHASH_MemberCount; extern char * _PREHASH_ChatData; extern char * _PREHASH_IsGroupOwned; extern char * _PREHASH_EnergyEfficiency; -extern char * _PREHASH_MaxPlace; extern char * _PREHASH_PickInfoUpdate; extern char * _PREHASH_PickDelete; extern char * _PREHASH_ScriptReset; extern char * _PREHASH_Requester; extern char * _PREHASH_ForSale; extern char * _PREHASH_NearestLandingRegionReply; -extern char * _PREHASH_RecordAgentPresence; -extern char * _PREHASH_EraseAgentPresence; extern char * _PREHASH_ParcelID; extern char * _PREHASH_Godlike; extern char * _PREHASH_TotalDebits; extern char * _PREHASH_Direction; -extern char * _PREHASH_Appearance; extern char * _PREHASH_HealthData; extern char * _PREHASH_LeftAxis; extern char * _PREHASH_LocationBlock; @@ -451,41 +416,31 @@ extern char * _PREHASH_ObjectImage; extern char * _PREHASH_TerrainStartHeight00; extern char * _PREHASH_TerrainStartHeight01; extern char * _PREHASH_TerrainStartHeight10; -extern char * _PREHASH_ObjectHinge; extern char * _PREHASH_TerrainStartHeight11; -extern char * _PREHASH_MetersPerGrid; extern char * _PREHASH_WaterHeight; extern char * _PREHASH_FetchInventoryReply; -extern char * _PREHASH_MoneySummaryReply; extern char * _PREHASH_GroupAccountSummaryReply; extern char * _PREHASH_AttachedSound; extern char * _PREHASH_ParamInUse; extern char * _PREHASH_GodKickUser; extern char * _PREHASH_PickName; extern char * _PREHASH_TaskName; -extern char * _PREHASH_SubType; extern char * _PREHASH_ObjectCount; extern char * _PREHASH_RegionPresenceRequestByHandle; extern char * _PREHASH_RezSingleAttachmentFromInv; extern char * _PREHASH_ChildAgentUpdate; -extern char * _PREHASH_ToID; -extern char * _PREHASH_ViewerPort; extern char * _PREHASH_IsOwnerGroup; extern char * _PREHASH_AgentHeightWidth; extern char * _PREHASH_VerticalAngle; extern char * _PREHASH_WearableType; extern char * _PREHASH_AggregatePermNextOwner; extern char * _PREHASH_ShowInList; -extern char * _PREHASH_PositionSuggestion; extern char * _PREHASH_UpdateParcel; -extern char * _PREHASH_ClearAgentSessions; extern char * _PREHASH_SetAlwaysRun; extern char * _PREHASH_NVPair; extern char * _PREHASH_SearchType; extern char * _PREHASH_ObjectSpinStart; extern char * _PREHASH_UseEstateSun; -extern char * _PREHASH_LogoutBlock; -extern char * _PREHASH_RelayLogControl; extern char * _PREHASH_RegionID; extern char * _PREHASH_AbuseRegionID; extern char * _PREHASH_Creator; @@ -494,14 +449,12 @@ extern char * _PREHASH_DirEventsReply; extern char * _PREHASH_EventInfoReply; extern char * _PREHASH_UserInfoReply; extern char * _PREHASH_PathRadiusOffset; -extern char * _PREHASH_SessionInfo; extern char * _PREHASH_TextureData; extern char * _PREHASH_ChatPass; extern char * _PREHASH_TargetID; extern char * _PREHASH_DefaultPayPrice; extern char * _PREHASH_UserLocation; extern char * _PREHASH_MaxPrims; -extern char * _PREHASH_RegionIP; extern char * _PREHASH_LandmarkID; extern char * _PREHASH_InitiateDownload; extern char * _PREHASH_Name; @@ -509,18 +462,13 @@ extern char * _PREHASH_OtherCleanTime; extern char * _PREHASH_ParcelSetOtherCleanTime; extern char * _PREHASH_TeleportPriceExponent; extern char * _PREHASH_Gain; -extern char * _PREHASH_VelX; extern char * _PREHASH_PacketAck; extern char * _PREHASH_PathSkew; -extern char * _PREHASH_Negative; -extern char * _PREHASH_VelY; extern char * _PREHASH_SimulatorShutdownRequest; extern char * _PREHASH_NearestLandingRegionRequest; -extern char * _PREHASH_VelZ; extern char * _PREHASH_OtherID; extern char * _PREHASH_MemberID; extern char * _PREHASH_MapLayerRequest; -extern char * _PREHASH_PatchVersion; extern char * _PREHASH_ObjectScale; extern char * _PREHASH_TargetIP; extern char * _PREHASH_Redo; @@ -563,27 +511,20 @@ extern char * _PREHASH_Perp; extern char * _PREHASH_Code; extern char * _PREHASH_InvType; extern char * _PREHASH_AgentFOV; -extern char * _PREHASH_BulkMoneyTransfer; extern char * _PREHASH_Audible; extern char * _PREHASH_AuctionData; extern char * _PREHASH_IDBlock; -extern char * _PREHASH_ReputationData; extern char * _PREHASH_West; extern char * _PREHASH_Undo; extern char * _PREHASH_TotalNumItems; extern char * _PREHASH_Info; extern char * _PREHASH_Area; -extern char * _PREHASH_Behavior; extern char * _PREHASH_SimCrashed; extern char * _PREHASH_Text; -extern char * _PREHASH_AgentToNewRegion; extern char * _PREHASH_PriceGroupCreate; extern char * _PREHASH_ObjectShape; extern char * _PREHASH_GroupRoleDataReply; -extern char * _PREHASH_PosX; -extern char * _PREHASH_PosY; extern char * _PREHASH_MuteCRC; -extern char * _PREHASH_PosZ; extern char * _PREHASH_Size; extern char * _PREHASH_FromAddress; extern char * _PREHASH_Body; @@ -601,16 +542,14 @@ extern char * _PREHASH_Stat; extern char * _PREHASH_SoundID; extern char * _PREHASH_Item; extern char * _PREHASH_User; -extern char * _PREHASH_RemoteInfos; extern char * _PREHASH_Prey; -extern char * _PREHASH_UsecSinceStart; extern char * _PREHASH_RayStart; +extern char * _PREHASH_UsecSinceStart; extern char * _PREHASH_ParcelData; extern char * _PREHASH_CameraUpAxis; extern char * _PREHASH_ScriptDialog; extern char * _PREHASH_MasterParcelData; extern char * _PREHASH_Invalid; -extern char * _PREHASH_MinPlace; extern char * _PREHASH_ProfileCurve; extern char * _PREHASH_ParcelAccessListUpdate; extern char * _PREHASH_MuteListUpdate; @@ -629,14 +568,12 @@ extern char * _PREHASH_DeRezObject; extern char * _PREHASH_IsTemporary; extern char * _PREHASH_InsigniaID; extern char * _PREHASH_CheckFlags; -extern char * _PREHASH_TransferPriority; extern char * _PREHASH_EventID; extern char * _PREHASH_Selected; extern char * _PREHASH_FromAgentId; extern char * _PREHASH_Type; extern char * _PREHASH_ChatType; extern char * _PREHASH_ReportData; -extern char * _PREHASH_LeaderBoardData; extern char * _PREHASH_RequestBlock; extern char * _PREHASH_GrantData; extern char * _PREHASH_DetachAttachmentIntoInv; @@ -652,12 +589,9 @@ extern char * _PREHASH_OnlineNotification; extern char * _PREHASH_OfflineNotification; extern char * _PREHASH_SendPostcard; extern char * _PREHASH_RequestFlags; -extern char * _PREHASH_MoneyHistoryRequest; -extern char * _PREHASH_MoneySummaryRequest; extern char * _PREHASH_GroupAccountSummaryRequest; extern char * _PREHASH_GroupVoteHistoryRequest; extern char * _PREHASH_ParamValue; -extern char * _PREHASH_Checksum; extern char * _PREHASH_MaxAgents; extern char * _PREHASH_CreateNewOutfitAttachments; extern char * _PREHASH_RegionHandle; @@ -667,12 +601,10 @@ extern char * _PREHASH_AvatarInterestsUpdate; extern char * _PREHASH_GroupNoticeID; extern char * _PREHASH_ParcelName; extern char * _PREHASH_PriceObjectRent; -extern char * _PREHASH_ConnectAgentToUserserver; -extern char * _PREHASH_ConnectToUserserver; extern char * _PREHASH_OfferCallingCard; -extern char * _PREHASH_AgentAccess; extern char * _PREHASH_AcceptCallingCard; extern char * _PREHASH_DeclineCallingCard; +extern char * _PREHASH_AgentAccess; extern char * _PREHASH_DataHomeLocationReply; extern char * _PREHASH_EventLocationReply; extern char * _PREHASH_TerseDateID; @@ -690,8 +622,8 @@ extern char * _PREHASH_Invoice; extern char * _PREHASH_IntervalDays; extern char * _PREHASH_PathScaleX; extern char * _PREHASH_FromTaskID; -extern char * _PREHASH_TimeInfo; extern char * _PREHASH_PathScaleY; +extern char * _PREHASH_TimeInfo; extern char * _PREHASH_PublicCount; extern char * _PREHASH_ParcelJoin; extern char * _PREHASH_GroupRolesCount; @@ -716,7 +648,6 @@ extern char * _PREHASH_NearestLandingRegionUpdated; extern char * _PREHASH_PassToAgent; extern char * _PREHASH_PreyAgent; extern char * _PREHASH_SimStats; -extern char * _PREHASH_Options; extern char * _PREHASH_LogoutReply; extern char * _PREHASH_FeatureDisabled; extern char * _PREHASH_ObjectLocalID; @@ -727,10 +658,8 @@ extern char * _PREHASH_Destination; extern char * _PREHASH_MasterID; extern char * _PREHASH_TransferData; extern char * _PREHASH_WantToMask; -extern char * _PREHASH_AvatarData; extern char * _PREHASH_ParcelSelectObjects; extern char * _PREHASH_ExtraParams; -extern char * _PREHASH_LogLogin; extern char * _PREHASH_CreatorID; extern char * _PREHASH_Summary; extern char * _PREHASH_BuyObjectInventory; @@ -771,8 +700,8 @@ extern char * _PREHASH_ButtonLabel; extern char * _PREHASH_GranterID; extern char * _PREHASH_WantToText; extern char * _PREHASH_ReportType; -extern char * _PREHASH_DataBlock; extern char * _PREHASH_SimulatorReady; +extern char * _PREHASH_DataBlock; extern char * _PREHASH_AnimationSourceList; extern char * _PREHASH_SubscribeLoad; extern char * _PREHASH_UnsubscribeLoad; @@ -799,9 +728,8 @@ extern char * _PREHASH_Header; extern char * _PREHASH_GestureFlags; extern char * _PREHASH_XferID; extern char * _PREHASH_StatValue; -extern char * _PREHASH_PickID; extern char * _PREHASH_TaskID; -extern char * _PREHASH_GridsPerEdge; +extern char * _PREHASH_PickID; extern char * _PREHASH_RayEnd; extern char * _PREHASH_Throttles; extern char * _PREHASH_RebakeAvatarTextures; @@ -814,30 +742,24 @@ extern char * _PREHASH_Access; extern char * _PREHASH_TitleRoleID; extern char * _PREHASH_SquareMetersCredit; extern char * _PREHASH_Filename; -extern char * _PREHASH_SecuredTemplateChecksumRequest; -extern char * _PREHASH_TemplateChecksumRequest; -extern char * _PREHASH_AgentPresenceRequest; extern char * _PREHASH_ClassifiedInfoRequest; extern char * _PREHASH_ParcelInfoRequest; extern char * _PREHASH_ParcelObjectOwnersRequest; extern char * _PREHASH_TeleportLandmarkRequest; extern char * _PREHASH_EventInfoRequest; -extern char * _PREHASH_ChatFromSimulator; -extern char * _PREHASH_PickInfoRequest; extern char * _PREHASH_MoneyBalanceRequest; extern char * _PREHASH_GroupMembersRequest; extern char * _PREHASH_GroupRoleMembersRequest; +extern char * _PREHASH_ChatFromSimulator; extern char * _PREHASH_OldFolderID; extern char * _PREHASH_UserInfoRequest; extern char * _PREHASH_TextureID; extern char * _PREHASH_ProfileURL; extern char * _PREHASH_Handle; -extern char * _PREHASH_StartParcelRenameAck; extern char * _PREHASH_ButtonIndex; extern char * _PREHASH_GetScriptRunning; extern char * _PREHASH_SetScriptRunning; extern char * _PREHASH_Health; -extern char * _PREHASH_FileID; extern char * _PREHASH_CircuitInfo; extern char * _PREHASH_ObjectBuy; extern char * _PREHASH_ProfileEnd; @@ -862,7 +784,6 @@ extern char * _PREHASH_PingID; extern char * _PREHASH_Change; extern char * _PREHASH_Height; extern char * _PREHASH_Region; -extern char * _PREHASH_MoneyHistoryReply; extern char * _PREHASH_TelehubInfo; extern char * _PREHASH_StateSave; extern char * _PREHASH_RoleData; @@ -873,11 +794,10 @@ extern char * _PREHASH_ParcelGodMarkAsContent; extern char * _PREHASH_UsePhysics; extern char * _PREHASH_RegionDenyTransacted; extern char * _PREHASH_JointType; -extern char * _PREHASH_TaxEstimate; extern char * _PREHASH_ObjectTaxEstimate; extern char * _PREHASH_LightTaxEstimate; -extern char * _PREHASH_TeleportLandingStatusChanged; extern char * _PREHASH_LandTaxEstimate; +extern char * _PREHASH_TeleportLandingStatusChanged; extern char * _PREHASH_GroupTaxEstimate; extern char * _PREHASH_AvgViewerFPS; extern char * _PREHASH_Buttons; @@ -909,8 +829,6 @@ extern char * _PREHASH_WinnerID; extern char * _PREHASH_ChannelType; extern char * _PREHASH_NonExemptMembers; extern char * _PREHASH_Agents; -extern char * _PREHASH_SimulatorStart; -extern char * _PREHASH_Enable; extern char * _PREHASH_MemberData; extern char * _PREHASH_ToGroupID; extern char * _PREHASH_ImageNotInDatabase; @@ -918,27 +836,21 @@ extern char * _PREHASH_StartDate; extern char * _PREHASH_AnimID; extern char * _PREHASH_Serial; extern char * _PREHASH_AbuseRegionName; -extern char * _PREHASH_ControlPort; extern char * _PREHASH_ModifyLand; extern char * _PREHASH_Digest; extern char * _PREHASH_Victim; extern char * _PREHASH_Script; -extern char * _PREHASH_TemplateChecksumReply; extern char * _PREHASH_PickInfoReply; extern char * _PREHASH_MoneyBalanceReply; extern char * _PREHASH_RoutedMoneyBalanceReply; extern char * _PREHASH_RoleID; extern char * _PREHASH_RegionInfo; -extern char * _PREHASH_Sequence; extern char * _PREHASH_GodUpdateRegionInfo; -extern char * _PREHASH_LocalX; -extern char * _PREHASH_LocalY; extern char * _PREHASH_StartAnim; -extern char * _PREHASH_Location; extern char * _PREHASH_Action; +extern char * _PREHASH_Location; extern char * _PREHASH_Rights; extern char * _PREHASH_SearchDir; -extern char * _PREHASH_Active; extern char * _PREHASH_TransferRequest; extern char * _PREHASH_ScriptSensorRequest; extern char * _PREHASH_MoneyTransferRequest; @@ -949,8 +861,6 @@ extern char * _PREHASH_Center; extern char * _PREHASH_SharedData; extern char * _PREHASH_PSBlock; extern char * _PREHASH_UUIDNameBlock; -extern char * _PREHASH_Viewer; -extern char * _PREHASH_GroupNoticeDelete; extern char * _PREHASH_GroupTitleUpdate; extern char * _PREHASH_Method; extern char * _PREHASH_TouchName; @@ -962,11 +872,9 @@ extern char * _PREHASH_GodlikeMessage; extern char * _PREHASH_SystemMessage; extern char * _PREHASH_BodyRotation; extern char * _PREHASH_SearchRegions; -extern char * _PREHASH_Ignore; extern char * _PREHASH_AnimationData; extern char * _PREHASH_StatID; extern char * _PREHASH_ItemID; -extern char * _PREHASH_AvatarStatisticsReply; extern char * _PREHASH_ScriptDialogReply; extern char * _PREHASH_RegionIDAndHandleReply; extern char * _PREHASH_CameraAtOffset; @@ -991,7 +899,6 @@ extern char * _PREHASH_OldItemID; extern char * _PREHASH_RegionPort; extern char * _PREHASH_PriceEnergyUnit; extern char * _PREHASH_Bitmap; -extern char * _PREHASH_TrackAgentSession; extern char * _PREHASH_CacheMissType; extern char * _PREHASH_VFileID; extern char * _PREHASH_GroupInsigniaID; @@ -1039,7 +946,6 @@ extern char * _PREHASH_MeanCollisionAlert; extern char * _PREHASH_CanAcceptTasks; extern char * _PREHASH_ItemData; extern char * _PREHASH_AnimationList; -extern char * _PREHASH_PassObject; extern char * _PREHASH_Reputation; extern char * _PREHASH_IntValue; extern char * _PREHASH_TargetType; @@ -1062,10 +968,8 @@ extern char * _PREHASH_ParcelBuy; extern char * _PREHASH_DirFindQueryBackend; extern char * _PREHASH_DirPlacesQueryBackend; extern char * _PREHASH_DirClassifiedQueryBackend; -extern char * _PREHASH_DirPicksQueryBackend; extern char * _PREHASH_DirLandQueryBackend; extern char * _PREHASH_DirPopularQueryBackend; -extern char * _PREHASH_LogoutDemand; extern char * _PREHASH_HistoryData; extern char * _PREHASH_SnapshotID; extern char * _PREHASH_Aspect; @@ -1073,7 +977,6 @@ extern char * _PREHASH_ParamSize; extern char * _PREHASH_VoteCast; extern char * _PREHASH_CastsShadows; extern char * _PREHASH_EveryoneMask; -extern char * _PREHASH_SetSunPhase; extern char * _PREHASH_ObjectSpinUpdate; extern char * _PREHASH_MaturePublish; extern char * _PREHASH_UseExistingAsset; @@ -1082,7 +985,6 @@ extern char * _PREHASH_ParcelLocalID; extern char * _PREHASH_TeleportCancel; extern char * _PREHASH_UnixTime; extern char * _PREHASH_QueryFlags; -extern char * _PREHASH_LastExecFroze; extern char * _PREHASH_AlwaysRun; extern char * _PREHASH_Bottom; extern char * _PREHASH_ButtonData; @@ -1101,7 +1003,6 @@ extern char * _PREHASH_NVPairs; extern char * _PREHASH_GroupNoticesListRequest; extern char * _PREHASH_ParcelAccessListRequest; extern char * _PREHASH_MuteListRequest; -extern char * _PREHASH_StartPeriod; extern char * _PREHASH_RpcChannelRequest; extern char * _PREHASH_LandStatRequest; extern char * _PREHASH_PlacesQuery; @@ -1129,34 +1030,27 @@ extern char * _PREHASH_SnapSelection; extern char * _PREHASH_SoundTrigger; extern char * _PREHASH_TerrainRaiseLimit; extern char * _PREHASH_Quorum; -extern char * _PREHASH_TokenBlock; extern char * _PREHASH_AgentBlock; extern char * _PREHASH_CommandBlock; extern char * _PREHASH_PricePublicObjectDecay; extern char * _PREHASH_SpawnPointPos; -extern char * _PREHASH_AttachedSoundCutoffRadius; extern char * _PREHASH_VolumeDetail; extern char * _PREHASH_FromAgentName; extern char * _PREHASH_Range; extern char * _PREHASH_DirectoryVisibility; extern char * _PREHASH_PublicIP; extern char * _PREHASH_TeleportFailed; -extern char * _PREHASH_OnlineStatusReply; -extern char * _PREHASH_RequestAvatarInfo; extern char * _PREHASH_PreloadSound; extern char * _PREHASH_ScreenshotID; extern char * _PREHASH_CovenantTimestamp; extern char * _PREHASH_OldestUnacked; extern char * _PREHASH_SimulatorIP; -extern char * _PREHASH_ObjectImport; extern char * _PREHASH_Value; extern char * _PREHASH_JointAxisOrAnchor; extern char * _PREHASH_Test0; extern char * _PREHASH_Test1; extern char * _PREHASH_Test2; extern char * _PREHASH_SunPhase; -extern char * _PREHASH_Place; -extern char * _PREHASH_Phase; extern char * _PREHASH_ParcelDivide; extern char * _PREHASH_PriceObjectClaim; extern char * _PREHASH_Field; @@ -1166,7 +1060,6 @@ extern char * _PREHASH_LiveHelpGroupReply; extern char * _PREHASH_Score; extern char * _PREHASH_Image; extern char * _PREHASH_ObjectClickAction; -extern char * _PREHASH_Delta; extern char * _PREHASH_Parameter; extern char * _PREHASH_Flags; extern char * _PREHASH_Plane; @@ -1176,26 +1069,24 @@ extern char * _PREHASH_DirFindQuery; extern char * _PREHASH_Textures; extern char * _PREHASH_EventData; extern char * _PREHASH_Final; +extern char * _PREHASH_System; extern char * _PREHASH_TelehubPos; extern char * _PREHASH_ReportAutosaveCrash; extern char * _PREHASH_CreateTrustedCircuit; extern char * _PREHASH_DenyTrustedCircuit; extern char * _PREHASH_RequestTrustedCircuit; extern char * _PREHASH_Codec; -extern char * _PREHASH_Level; extern char * _PREHASH_Modal; extern char * _PREHASH_ChildAgentUnknown; extern char * _PREHASH_LandingType; extern char * _PREHASH_ScriptRunningReply; -extern char * _PREHASH_MoneyDetailsReply; extern char * _PREHASH_Reply; +extern char * _PREHASH_GroupAccountDetailsReply; extern char * _PREHASH_TelehubRot; -extern char * _PREHASH_RequestFriendship; extern char * _PREHASH_AcceptFriendship; -extern char * _PREHASH_GroupAccountDetailsReply; +extern char * _PREHASH_ItemType; extern char * _PREHASH_DwellInfo; extern char * _PREHASH_AgentResume; -extern char * _PREHASH_ItemType; extern char * _PREHASH_MailFilter; extern char * _PREHASH_Disconnect; extern char * _PREHASH_SimPosition; @@ -1222,7 +1113,6 @@ extern char * _PREHASH_VoteType; extern char * _PREHASH_CategoryID; extern char * _PREHASH_Token; extern char * _PREHASH_AggregatePerms; -extern char * _PREHASH_StartParcelRemoveAck; extern char * _PREHASH_ObjectSelect; extern char * _PREHASH_ForceObjectSelect; extern char * _PREHASH_Price; @@ -1251,7 +1141,6 @@ extern char * _PREHASH_Notes; extern char * _PREHASH_AvatarID; extern char * _PREHASH_FounderID; extern char * _PREHASH_EndPointID; -extern char * _PREHASH_StipendEstimate; extern char * _PREHASH_LocationLookAt; extern char * _PREHASH_Sound; extern char * _PREHASH_Cover; @@ -1271,12 +1160,12 @@ extern char * _PREHASH_ProfileHollow; extern char * _PREHASH_GroupRoleChanges; extern char * _PREHASH_Count; extern char * _PREHASH_South; -extern char * _PREHASH_Entry; extern char * _PREHASH_ObjectUpdateCompressed; extern char * _PREHASH_MuteFlags; extern char * _PREHASH_Group; extern char * _PREHASH_AgentPause; extern char * _PREHASH_LanguagesText; +extern char * _PREHASH_Error; extern char * _PREHASH_InternalScriptMail; extern char * _PREHASH_FindAgent; extern char * _PREHASH_AgentData; @@ -1285,7 +1174,6 @@ extern char * _PREHASH_AssetBlock; extern char * _PREHASH_AcceptNotices; extern char * _PREHASH_SetGroupAcceptNotices; extern char * _PREHASH_CloseCircuit; -extern char * _PREHASH_LogControl; extern char * _PREHASH_TeleportFinish; extern char * _PREHASH_PathRevolutions; extern char * _PREHASH_ClassifiedInfoReply; @@ -1302,7 +1190,6 @@ extern char * _PREHASH_DataHomeLocationRequest; extern char * _PREHASH_EventNotificationAddRequest; extern char * _PREHASH_ParcelDwellRequest; extern char * _PREHASH_EventLocationRequest; -extern char * _PREHASH_EndPeriod; extern char * _PREHASH_SetStartLocationRequest; extern char * _PREHASH_QueryStart; extern char * _PREHASH_EjectData; @@ -1315,7 +1202,6 @@ extern char * _PREHASH_ParcelRelease; extern char * _PREHASH_VFileType; extern char * _PREHASH_EjectGroupMemberReply; extern char * _PREHASH_ImageData; -extern char * _PREHASH_SpaceServerSimulatorTimeMessage; extern char * _PREHASH_SimulatorViewerTimeMessage; extern char * _PREHASH_Rotation; extern char * _PREHASH_Selection; @@ -1323,7 +1209,6 @@ extern char * _PREHASH_TransactionData; extern char * _PREHASH_OperationData; extern char * _PREHASH_ExpirationDate; extern char * _PREHASH_ParcelDeedToGroup; -extern char * _PREHASH_DirPicksReply; extern char * _PREHASH_AvatarPicksReply; extern char * _PREHASH_GroupTitlesReply; extern char * _PREHASH_AgentInfo; @@ -1334,8 +1219,8 @@ extern char * _PREHASH_PassPrice; extern char * _PREHASH_SourceID; extern char * _PREHASH_ChangeUserRights; extern char * _PREHASH_TeleportFlags; -extern char * _PREHASH_AssetData; extern char * _PREHASH_SlaveParcelData; +extern char * _PREHASH_AssetData; extern char * _PREHASH_MultipleObjectUpdate; extern char * _PREHASH_ObjectUpdate; extern char * _PREHASH_ImprovedTerseObjectUpdate; @@ -1351,7 +1236,6 @@ extern char * _PREHASH_TaskLocalID; extern char * _PREHASH_ClaimDate; extern char * _PREHASH_MergeParcel; extern char * _PREHASH_Priority; -extern char * _PREHASH_Building; extern char * _PREHASH_QueryText; extern char * _PREHASH_GroupNoticeAdd; extern char * _PREHASH_ReturnType; @@ -1361,7 +1245,6 @@ extern char * _PREHASH_HeaderData; extern char * _PREHASH_RequestMultipleObjects; extern char * _PREHASH_RetrieveInstantMessages; extern char * _PREHASH_OpenCircuit; -extern char * _PREHASH_SecureSessionID; extern char * _PREHASH_CrossedRegion; extern char * _PREHASH_DirGroupsReply; extern char * _PREHASH_AvatarGroupsReply; @@ -1372,18 +1255,14 @@ extern char * _PREHASH_Position; extern char * _PREHASH_ParentEstate; extern char * _PREHASH_EstateName; extern char * _PREHASH_MuteName; -extern char * _PREHASH_StartParcelRename; -extern char * _PREHASH_BulkParcelRename; extern char * _PREHASH_ParcelRename; extern char * _PREHASH_ViewerFilename; -extern char * _PREHASH_Positive; extern char * _PREHASH_UserReportInternal; extern char * _PREHASH_AvatarPropertiesRequest; extern char * _PREHASH_ParcelPropertiesRequest; extern char * _PREHASH_GroupProfileRequest; extern char * _PREHASH_AgentDataUpdateRequest; extern char * _PREHASH_PriceObjectScaleFactor; -extern char * _PREHASH_DirPicksQuery; extern char * _PREHASH_OpenEnrollment; extern char * _PREHASH_GroupData; extern char * _PREHASH_RequestGodlikePowers; @@ -1394,7 +1273,6 @@ extern char * _PREHASH_Controls; extern char * _PREHASH_FirstDetachAll; extern char * _PREHASH_EstateID; extern char * _PREHASH_ImprovedInstantMessage; -extern char * _PREHASH_AgentQuit; extern char * _PREHASH_CheckParcelSales; extern char * _PREHASH_ParcelSales; extern char * _PREHASH_CurrentInterval; @@ -1411,12 +1289,8 @@ extern char * _PREHASH_OwnerIDs; extern char * _PREHASH_SystemKickUser; extern char * _PREHASH_TransactionTime; extern char * _PREHASH_TimeToLive; -extern char * _PREHASH_StartParcelRemove; -extern char * _PREHASH_BulkParcelRemove; extern char * _PREHASH_OldAgentID; -extern char * _PREHASH_BonusEstimate; extern char * _PREHASH_MusicURL; -extern char * _PREHASH_CompleteLure; extern char * _PREHASH_ParcelPrimBonus; extern char * _PREHASH_EjectUser; extern char * _PREHASH_CoarseLocationUpdate; @@ -1449,10 +1323,6 @@ extern char * _PREHASH_ParcelProperties; extern char * _PREHASH_EstateOwnerID; extern char * _PREHASH_LogoutRequest; extern char * _PREHASH_AssetUploadRequest; -extern char * _PREHASH_ReputationIndividualRequest; -extern char * _PREHASH_MajorVersion; -extern char * _PREHASH_MinorVersion; -extern char * _PREHASH_SimulatorAssign; extern char * _PREHASH_TransactionType; extern char * _PREHASH_AvatarPropertiesUpdate; extern char * _PREHASH_ParcelPropertiesUpdate; @@ -1461,7 +1331,6 @@ extern char * _PREHASH_AbortXfer; extern char * _PREHASH_DeRezAck; extern char * _PREHASH_TakeControls; extern char * _PREHASH_DirLandReply; -extern char * _PREHASH_SpaceLocationTeleportReply; extern char * _PREHASH_MuteType; extern char * _PREHASH_IMViaEMail; extern char * _PREHASH_RentPrice; diff --git a/indra/newview/English.lproj/InfoPlist.strings b/indra/newview/English.lproj/InfoPlist.strings index 794f869468..a0320e3f1d 100644 --- a/indra/newview/English.lproj/InfoPlist.strings +++ b/indra/newview/English.lproj/InfoPlist.strings @@ -1,5 +1,5 @@ /* Localized versions of Info.plist keys */ CFBundleName = "Second Life"; -CFBundleShortVersionString = "Second Life version 1.17.3.0"; -CFBundleGetInfoString = "Second Life version 1.17.3.0, Copyright 2004-2007 Linden Research, Inc."; +CFBundleShortVersionString = "Second Life version 1.18.0.4"; +CFBundleGetInfoString = "Second Life version 1.18.0.4, Copyright 2004-2007 Linden Research, Inc."; diff --git a/indra/newview/Info-SecondLife.plist b/indra/newview/Info-SecondLife.plist index 5d351bb122..0536589d7a 100644 --- a/indra/newview/Info-SecondLife.plist +++ b/indra/newview/Info-SecondLife.plist @@ -32,7 +32,7 @@ </dict> </array> <key>CFBundleVersion</key> - <string>1.17.3.0</string> + <string>1.18.0.4</string> <key>CSResourcesFileMapped</key> <true/> </dict> diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 6713ea3eb2..dbbe1affb9 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -5701,7 +5701,6 @@ void LLAgent::requestEnterGodMode() // simulator and userserver need to know about your request sendReliableMessage(); - msg->sendReliable(gUserServer); } void LLAgent::requestLeaveGodMode() @@ -5717,7 +5716,6 @@ void LLAgent::requestLeaveGodMode() // simulator and userserver need to know about your request sendReliableMessage(); - msg->sendReliable(gUserServer); } // wearables diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 79faec1211..0fcf28ee6c 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -1,6 +1,10 @@ -// llassetuploadresponders.cpp -// Copyright 2006, Linden Research, Inc. -// Processes responses received for asset upload requests. +/** + * @file llassetuploadresponders.cpp + * @brief Processes responses received for asset upload requests. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ #include "llviewerprecompiledheaders.h" diff --git a/indra/newview/llassetuploadresponders.h b/indra/newview/llassetuploadresponders.h index ef8cd3834a..90d29019f1 100644 --- a/indra/newview/llassetuploadresponders.h +++ b/indra/newview/llassetuploadresponders.h @@ -1,6 +1,10 @@ -// llassetuploadresponders.h -// Copyright 2006, Linden Research, Inc. -// Processes responses received for asset upload requests. +/** + * @file llassetuploadresponders.h + * @brief Processes responses received for asset upload requests. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ #ifndef LL_LLASSETUPLOADRESPONDER_H #define LL_LLASSETUPLOADRESPONDER_H diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp index 4452a134ae..8c362a0ac5 100644 --- a/indra/newview/lleventpoll.cpp +++ b/indra/newview/lleventpoll.cpp @@ -16,155 +16,162 @@ #include "llviewerregion.h" #include "message.h" -class LLEventPoll::Impl : LLHTTPClient::Responder +namespace { -public: - static Impl& start(const std::string& pollURL); - void stop(); - -private: - Impl(const std::string& pollURL); - ~Impl(); - - void makeRequest(); - void handleMessage(const LLSD& content); - virtual void error(U32 status, const std::string& reason); - virtual void result(const LLSD& content); - -private: - typedef LLHTTPClient::ResponderPtr Ptr; - - Ptr mPtr; - bool mDone; - - std::string mPollURL; - std::string mSender; - - LLSD mAcknowledge; - - // these are only here for debugging so we can see which poller is which - static int sCount; - int mCount; -}; - -//static -LLEventPoll::Impl& LLEventPoll::Impl::start( - const std::string& pollURL) -{ - Impl* i = new Impl(pollURL); - llinfos << "LLEventPoll::Impl::start <" << i->mCount << "> " - << pollURL << llendl; - return *i; -} - -void LLEventPoll::Impl::stop() -{ - lldebugs << "LLEventPoll::Impl::stop <" << mCount << "> " - << mPollURL << llendl; - // there should be a way to stop a LLHTTPClient request in progress - mDone = true; - mPtr = NULL; -} - -int LLEventPoll::Impl::sCount = 0; - -LLEventPoll::Impl::Impl(const std::string& pollURL) - : mPtr(NULL), mDone(false), - mPollURL(pollURL), - mCount(++sCount) -{ - mPtr = this; - //extract host and port of simulator to set as sender - LLViewerRegion *regionp = gAgent.getRegion(); - if (!regionp) + class LLEventPollResponder : public LLHTTPClient::Responder + { + public: + + static LLHTTPClient::ResponderPtr start(const std::string& pollURL, const LLHost& sender); + void stop(); + + private: + LLEventPollResponder(const std::string& pollURL, const LLHost& sender); + ~LLEventPollResponder(); + + void makeRequest(); + void handleMessage(const LLSD& content); + virtual void error(U32 status, const std::string& reason); + virtual void result(const LLSD& content); + + private: + + bool mDone; + + std::string mPollURL; + std::string mSender; + + LLSD mAcknowledge; + + // these are only here for debugging so we can see which poller is which + static int sCount; + int mCount; + }; + + //static + LLHTTPClient::ResponderPtr LLEventPollResponder::start( + const std::string& pollURL, const LLHost& sender) { - llerrs << "LLEventPoll initialized before region is added." << llendl; + LLHTTPClient::ResponderPtr result = new LLEventPollResponder(pollURL, sender); + llinfos << "LLEventPollResponder::start <" << sCount << "> " + << pollURL << llendl; + return result; } - mSender = regionp->getHost().getIPandPort(); - llinfos << "LLEventPoll initialized with sender " << mSender << llendl; - makeRequest(); -} -LLEventPoll::Impl::~Impl() -{ - lldebugs << "LLEventPoll::Impl::~Impl <" << mCount << "> " - << mPollURL << llendl; -} - -void LLEventPoll::Impl::makeRequest() -{ - LLSD request; - request["ack"] = mAcknowledge; - request["done"] = mDone; - - lldebugs << "LLEventPoll::Impl::makeRequest <" << mCount << "> ack = " - << LLSDXMLStreamer(mAcknowledge) << llendl; - LLHTTPClient::post(mPollURL, request, mPtr); -} + void LLEventPollResponder::stop() + { + llinfos << "LLEventPollResponder::stop <" << mCount << "> " + << mPollURL << llendl; + // there should be a way to stop a LLHTTPClient request in progress + mDone = true; + } -void LLEventPoll::Impl::handleMessage(const LLSD& content) -{ - std::string msg_name = content["message"]; - LLSD message; - message["sender"] = mSender; - message["body"] = content["body"]; - LLMessageSystem::dispatch(msg_name, message); -} + int LLEventPollResponder::sCount = 0; -//virtual -void LLEventPoll::Impl::error(U32 status, const std::string& reason) -{ - if (mDone) return; + LLEventPollResponder::LLEventPollResponder(const std::string& pollURL, const LLHost& sender) + : mDone(false), + mPollURL(pollURL), + mCount(++sCount) + { + //extract host and port of simulator to set as sender + LLViewerRegion *regionp = gAgent.getRegion(); + if (!regionp) + { + llerrs << "LLEventPoll initialized before region is added." << llendl; + } + mSender = sender.getIPandPort(); + llinfos << "LLEventPoll initialized with sender " << mSender << llendl; + makeRequest(); + } - if(status != 499) + LLEventPollResponder::~LLEventPollResponder() { - llwarns << "LLEventPoll::Impl::error: <" << mCount << "> got " - << status << ": " << reason - << (mDone ? " -- done" : "") << llendl; stop(); - return; + lldebugs << "LLEventPollResponder::~Impl <" << mCount << "> " + << mPollURL << llendl; } - makeRequest(); -} + void LLEventPollResponder::makeRequest() + { + LLSD request; + request["ack"] = mAcknowledge; + request["done"] = mDone; + + lldebugs << "LLEventPollResponder::makeRequest <" << mCount << "> ack = " + << LLSDXMLStreamer(mAcknowledge) << llendl; + LLHTTPClient::post(mPollURL, request, this); + } -//virtual -void LLEventPoll::Impl::result(const LLSD& content) -{ - lldebugs << "LLEventPoll::Impl::result <" << mCount << ">" - << (mDone ? " -- done" : "") << llendl; - - if (mDone) return; - - mAcknowledge = content["id"]; - LLSD events = content["events"]; - - if(mAcknowledge.isUndefined()) + void LLEventPollResponder::handleMessage(const LLSD& content) { - llwarns << "LLEventPoll::Impl: id undefined" << llendl; + std::string msg_name = content["message"]; + LLSD message; + message["sender"] = mSender; + message["body"] = content["body"]; + LLMessageSystem::dispatch(msg_name, message); } - - llinfos << "LLEventPoll::Impl::completed <" << mCount << "> " << events.size() << "events (id " - << LLSDXMLStreamer(mAcknowledge) << ")" << llendl; - - LLSD::array_const_iterator i = events.beginArray(); - LLSD::array_const_iterator end = events.endArray(); - for (; i != end; ++i) + + //virtual + void LLEventPollResponder::error(U32 status, const std::string& reason) { - if (i->has("message")) + if (mDone) return; + + if(status != 499) { - handleMessage(*i); + llwarns << "LLEventPollResponder::error: <" << mCount << "> got " + << status << ": " << reason + << (mDone ? " -- done" : "") << llendl; + stop(); + return; } + + makeRequest(); } - - makeRequest(); + + //virtual + void LLEventPollResponder::result(const LLSD& content) + { + lldebugs << "LLEventPollResponder::result <" << mCount << ">" + << (mDone ? " -- done" : "") << llendl; + + if (mDone) return; + + if (!content.get("events") || + !content.get("id")) + { + llwarns << "received event poll with no events or id key" << llendl; + return; + } + + mAcknowledge = content["id"]; + LLSD events = content["events"]; + + if(mAcknowledge.isUndefined()) + { + llwarns << "LLEventPollResponder: id undefined" << llendl; + } + + llinfos << "LLEventPollResponder::completed <" << mCount << "> " << events.size() << "events (id " + << LLSDXMLStreamer(mAcknowledge) << ")" << llendl; + + LLSD::array_const_iterator i = events.beginArray(); + LLSD::array_const_iterator end = events.endArray(); + for (; i != end; ++i) + { + if (i->has("message")) + { + handleMessage(*i); + } + } + + makeRequest(); + } } -LLEventPoll::LLEventPoll(const std::string& pollURL) - : impl(Impl::start(pollURL)) +LLEventPoll::LLEventPoll(const std::string& pollURL, const LLHost& sender) + : mImpl(LLEventPollResponder::start(pollURL, sender)) { } LLEventPoll::~LLEventPoll() { - impl.stop(); } diff --git a/indra/newview/lleventpoll.h b/indra/newview/lleventpoll.h index c2d798360f..a9c9d2ceab 100644 --- a/indra/newview/lleventpoll.h +++ b/indra/newview/lleventpoll.h @@ -9,11 +9,13 @@ #ifndef LL_LLEVENTPOLL_H #define LL_LLEVENTPOLL_H +#include "llhttpclient.h" + class LLEventPoll ///< implements the viewer side of server-to-viewer pushed events. { public: - LLEventPoll(const std::string& pollURL); + LLEventPoll(const std::string& pollURL, const LLHost& sender); ///< Start polling the URL. virtual ~LLEventPoll(); @@ -21,8 +23,7 @@ public: private: - class Impl; - Impl& impl; + LLHTTPClient::ResponderPtr mImpl; }; diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index c34f14a813..f7aa4d4251 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -2092,173 +2092,6 @@ void LLInventoryModel::registerCallbacks(LLMessageSystem* msg) msg->setHandlerFunc("FetchInventoryReply", processFetchInventoryReply); } -/* -//struct LLUpdateInventoryInfo -{ - LLString mFilenameAndPath; - BOOL mIsComplete; -}; - -// static -void LLInventoryModel::processInventoryUpdate(LLMessageSystem* msg, void**) -{ - lldebugs << "LLInventoryModel::processInventoryUpdate()" << llendl; - LLUUID agent_id; - msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_AgentID, agent_id); - if(agent_id != gAgent.getID()) - { - llwarns << "Got an inventory update for the wrong agent." << llendl; - return; - } - - BOOL is_complete; - msg->getBOOLFast(_PREHASH_InventoryData, _PREHASH_IsComplete, is_complete); - char filename[MAX_STRING]; - msg->getStringFast(_PREHASH_InventoryData, _PREHASH_Filename, MAX_STRING, filename); - - LLUpdateInventoryInfo* info = new LLUpdateInventoryInfo; - info->mFilenameAndPath = gDirUtilp->getExpandedFilename( LL_PATH_TEMP, filename ); - info->mIsComplete = is_complete; - - gXferManager->requestFile(info->mFilenameAndPath, - filename, - LL_PATH_CACHE, // The remote file is in the data directory - gUserServer, - TRUE, // Delete the remote file after the transfer - processInventoryFile, - (void*)info, - LLXferManager::HIGH_PRIORITY); -} - -// static -void LLInventoryModel::processInventoryFile(void** user_data, S32 error_code) -{ - llinfos << "LLInventoryModel::processInventoryFile()" << llendl; - //gInventory.dumpInventory(); - LLUpdateInventoryInfo* info = (LLUpdateInventoryInfo*)user_data; - if(info && (0 == error_code)) - { - if(info->mIsComplete) - { - if(gInventory.isLoaded()) - { - // it's a complete update, and we've already loaded - // everything. Therefore, we need to blow away - // everything. - gInventory.empty(); - } - else - { - // We want to merge with anything that's happened - // before the load. Therefore, we only want to get rid - // of the root category. - gInventory.deleteObject(gAgent.getInventoryRootID()); - } - } - - // decompress if necessary - const char* filename = info->mFilenameAndPath.c_str(); - const char* ext = filename + strlen(filename) - 6; - char dst_filename[LL_MAX_PATH]; - if(0 == strnicmp(ext, "gz", 2)) - { - // it's a gz file. decmpress it. - dst_filename[0] = '\0'; - strncat(dst_filename, filename, (ext - filename)); - strcat(dst_filename, "tmp"); - BOOL success = gunzip_file(filename, dst_filename); - LLFile::remove(filename); - if(!success) - { - llwarns << "Error loading inventory file. Return code: " << error_code << llendl; - LLNotifyBox::showXml("InventoryNetworkCorruption"); - goto exit; - } - filename = dst_filename; - } - -#ifdef DIFF_INVENTORY_FILES - char agent_id_string[UUID_STR_LENGTH]; - char inventory_filename[LL_MAX_PATH]; - gAgent.getID().toString(agent_id_string); - sprintf(inventory_filename, CACHE_FORMAT_STRING, gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string).c_str()); - char buffer[MAX_STRING]; - sprintf(buffer, - "c:/cygwin/bin/diff %s %s", - inventory_filename, - filename); - llinfos << buffer << llendl; - system(buffer); - -#endif - - // load it all up. - gInventory.loadFromFile(filename); - gInventory.buildParentChildMap(); - //gInventory.recalculateCloneInformation(); - gInventory.addChangedMask(LLInventoryObserver::ALL); - if(info->mIsComplete) - { - // Set loaded to true if it's a complete set because it's - // poosible for someone to accept an inventory category - // before they have their complete inventory. If we marked - // it loaded at that point, when the real inventory - // arrived, it would erase (on the client anyway) the - // existence of that inventory. - gInventory.mIsLoaded = TRUE; - - //retrieveIM(gMessageSystem); - llinfos << "complete inventory update" << llendl; - - // If we promised you a message on load, here it is - if (gViewerStats->getStat(LLViewerStats::ST_INVENTORY_TOO_LONG) > 0.0) - { - LLNotifyBox::showXml("InventoryLoaded"); - } - } - else - { - llinfos << "incomplete inventory update" << llendl; - } - gInventory.notifyObservers(); - LLFile::remove(filename); - } - else - { - llwarns << "Eror loading inventory file. Return code: " << error_code - << llendl; - if(error_code == LL_ERR_TCP_TIMEOUT) - { - //llwarns << "Re-requesting inventory" << llendl; - //gInventory.requestFromServer(gAgent.getID()); - } - } - -exit: - delete info; - //gInventory.dumpInventory(); -} - -// static -void LLInventoryModel::processUseCachedInventory(LLMessageSystem* msg, void**) -{ - llinfos << "LLInventoryModel::processUseCachedInventory()" << llendl; - char agent_id_string[UUID_STR_LENGTH]; - gAgent.getID().toString(agent_id_string); - char filename[LL_MAX_PATH]; - sprintf(filename, CACHE_FORMAT_STRING, gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string).c_str()); - // We want to merge with anything that's happened before the - // load. Therefore, we only want to get rid of the root category. - gInventory.deleteObject(gAgent.getInventoryRootID()); - gInventory.loadFromFile(filename); - gInventory.buildParentChildMap(); - //gInventory.recalculateCloneInformation(); - gInventory.addChangedMask(LLInventoryObserver::ALL); - gInventory.mIsLoaded = TRUE; - gInventory.notifyObservers(); - //retrieveIM(); -} -*/ // static void LLInventoryModel::processUpdateCreateInventoryItem(LLMessageSystem* msg, void**) diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 274da6d3d1..0ab674dfcd 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -3668,6 +3668,7 @@ void LLSelectMgr::sendDelink() // Hinges //---------------------------------------------------------------------- +/* void LLSelectMgr::sendHinge(U8 type) { if (!mSelectedObjects->getNumNodes()) @@ -3697,7 +3698,7 @@ void LLSelectMgr::sendDehinge() packObjectLocalID, NULL, SEND_ONLY_ROOTS); -} +}*/ void LLSelectMgr::sendSelect() { diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 33c8371cb7..283516671d 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -449,8 +449,8 @@ public: void sendDropAttachment(); void sendLink(); void sendDelink(); - void sendHinge(U8 type); - void sendDehinge(); + //void sendHinge(U8 type); + //void sendDehinge(); void sendSelect(); void requestObjectPropertiesFamily(LLViewerObject* object); // asks sim for creator, permissions, resources, etc. diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index cce0d17e96..be6756ad98 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -30,6 +30,7 @@ #include "llerrorcontrol.h" #include "llfiltersd2xmlrpc.h" #include "llfocusmgr.h" +#include "llhttpsender.h" #include "imageids.h" #include "lllandmark.h" #include "llloginflags.h" @@ -203,7 +204,6 @@ BOOL is_hex_string(U8* str, S32 len); void show_first_run_dialog(); void first_run_dialog_callback(S32 option, void* userdata); void set_startup_status(const F32 frac, const char* string, const char* msg); -void on_userserver_name_resolved( BOOL success, const LLString& host_name, U32 ip, void* userdata ); void login_alert_status(S32 option, void* user_data); void update_app(BOOL mandatory, const std::string& message); void update_dialog_callback(S32 option, void *userdata); @@ -216,7 +216,6 @@ void dialog_choose_gender_first_start(); void callback_choose_gender(S32 option, void* userdata); void init_start_screen(S32 location_id); void release_start_screen(); -void process_connect_to_userserver(LLMessageSystem* msg, void**); void reset_login(); // @@ -226,6 +225,21 @@ void reset_login(); // // local classes // + +namespace +{ + class LLNullHTTPSender : public LLHTTPSender + { + virtual void send(const LLHost& host, + const char* message, const LLSD& body, + LLHTTPClient::ResponderPtr response) const + { + llwarns << " attemped to send " << message << " to " << host + << " with null sender" << llendl; + } + }; +} + class LLGestureInventoryFetchObserver : public LLInventoryFetchObserver { public: @@ -402,7 +416,7 @@ BOOL idle_startup() port = gSavedSettings.getU32("ConnectionPort"); } - LLMessageConfig::initClass("viewer", gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "")); + LLHTTPSender::setDefaultSender(new LLNullHTTPSender()); if(!start_messaging_system( message_template_path, port, @@ -415,6 +429,7 @@ BOOL idle_startup() std::string msg = llformat("Unable to start networking, error %d", gMessageSystem->getErrorCode()); app_early_exit(msg); } + LLMessageConfig::initClass("viewer", gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "")); } else { @@ -432,9 +447,13 @@ BOOL idle_startup() msg->setExceptionFunc(MX_PACKET_TOO_SHORT, invalid_message_callback, NULL); - msg->setExceptionFunc(MX_RAN_OFF_END_OF_PACKET, + + // running off end of a packet is now valid in the case + // when a reader has a newer message template than + // the sender + /*msg->setExceptionFunc(MX_RAN_OFF_END_OF_PACKET, invalid_message_callback, - NULL); + NULL);*/ msg->setExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE, invalid_message_callback, NULL); @@ -456,7 +475,7 @@ BOOL idle_startup() gXferManager->setUseAckThrottling(TRUE); gXferManager->setAckThrottleBPS(xfer_throttle_bps); } - gAssetStorage = new LLViewerAssetStorage(msg, gXferManager, gVFS, gUserServer); + gAssetStorage = new LLViewerAssetStorage(msg, gXferManager, gVFS); msg->mPacketRing.setDropPercentage(gPacketDropPercentage); if (gInBandwidth != 0.f) @@ -758,7 +777,6 @@ BOOL idle_startup() gSavedSettings.setS32("ServerChoice", gUserServerChoice); if (gUserServerChoice == USERSERVER_OTHER) { - gUserServer.setHostByName( server_label.c_str() ); snprintf(gUserServerName, MAX_STRING, "%s", server_label.c_str()); /* Flawfinder: ignore */ } } @@ -825,231 +843,15 @@ BOOL idle_startup() // color init must be after saved settings loaded init_colors(); - // Request userserver domain name - set_startup_status(0.05f, "Finding Server Domain Name...", NULL); - - // We're prematurely switching out of this state because the - // userserver name resolver can potentiallly occur before reaching the end of the - // switch statement. Also, if it's done at the bottom, sometimes we will - // skip the userserver resolved step (in the local cases) - djs 09/24/03 - gStartupState++; - timeout.reset(); - - switch( gUserServerChoice ) - { - case USERSERVER_AGNI: - gInProductionGrid = TRUE; - case USERSERVER_DMZ: - case USERSERVER_ADITI: - case USERSERVER_SIVA: - case USERSERVER_SHAKTI: - case USERSERVER_DURGA: - case USERSERVER_SOMA: - case USERSERVER_VAAK: - case USERSERVER_GANGA: - case USERSERVER_UMA: - { - const char* host_name = gUserServerDomainName[gUserServerChoice].mName; - snprintf(gUserServerName, MAX_STRING, "%s", host_name); /* Flawfinder: ignore */ - llinfos << "Resolving " << - gUserServerDomainName[gUserServerChoice].mLabel << - " userserver domain name " << host_name << llendl; - - BOOL requested_domain_name = gAsyncHostByName.startRequest( host_name, on_userserver_name_resolved, NULL ); - if( !requested_domain_name ) - //BOOL resolved_domain_name = gUserServer.setHostByName( host_name ); - //if( !resolved_domain_name ) - { - llwarns << "setHostByName failed" << llendl; - - LLStringBase<char>::format_map_t args; - args["[HOST_NAME]"] = host_name; - - gViewerWindow->alertXml("UnableToConnect", args, login_alert_done ); - reset_login(); - return FALSE; - } - break; - } - - case USERSERVER_LOCAL: - llinfos << "Using local userserver" << llendl; - gUserServer.setAddress( LOOPBACK_ADDRESS_STRING ); - gStartupState = STATE_USERSERVER_RESOLVED; - break; - - case USERSERVER_OTHER: - llinfos << "Userserver set explicitly" << llendl; - gStartupState = STATE_USERSERVER_RESOLVED; - break; - - case USERSERVER_NONE: - default: - llerrs << "No userserver IP address specified" << llendl; - break; - } - return do_normal_idle; - } - - if (STATE_RESOLVING_USERSERVER == gStartupState) - { - // Don't do anything. Wait for LL_WM_HOST_RESOLVED which is handled by LLAsyncHostByName, - // which calls on_userserver_name_resolved, which will push us to the next state. - if (timeout.getElapsedTimeF32() > TIMEOUT_SECONDS*3.f) - { - // Cancel the pending asynchostbyname request - - gViewerWindow->alertXml("CanNotFindServer", - login_alert_status, NULL); - - // Back up to login screen - reset_login(); - gViewerStats->incStat(LLViewerStats::ST_LOGIN_TIMEOUT_COUNT); - } - ms_sleep(1); - return do_normal_idle; - } - - if (STATE_USERSERVER_RESOLVED == gStartupState) - { - if (!gUserServer.isOk()) - { - LLStringBase<char>::format_map_t args; - args["[IP_ADDRESS]"] = u32_to_ip_string( gUserServer.getAddress() ); - - gViewerWindow->alertXml("PleaseSelectServer", args, login_alert_done ); - - reset_login(); - return FALSE; - } - - write_debug("Userserver: "); - char tmp_str[256]; /* Flawfinder: ignore */ - gUserServer.getIPString(tmp_str, 256); - write_debug(tmp_str); - write_debug("\n"); - - gStartupState++; - } - - if (STATE_MESSAGE_TEMPLATE_SEND == gStartupState) - { - set_startup_status(0.10f, "Verifying protocol version...", NULL); - - LLHost mt_host; - if (!gRunLocal) - { - // open up user server circuit (trusted) - gMessageSystem->enableCircuit(gUserServer, TRUE); - mt_host = gUserServer; - } - else - { - mt_host = gAgentSimHost; - } - - llinfos << "Verifying message template..." << llendl; - LLMessageSystem::sendSecureMessageTemplateChecksum(mt_host); - - timeout.reset(); - gStartupState++; - return do_normal_idle; - } - - if (STATE_MESSAGE_TEMPLATE_WAIT == gStartupState) - { - LLMessageSystem* msg = gMessageSystem; - while (msg->checkAllMessages(gFrameCount, gServicePump)) - { - if (msg->isTemplateConfirmed()) - { - BOOL update_available = FALSE; - BOOL mandatory = FALSE; - - if (!LLMessageSystem::doesTemplateMatch()) - { - // Mandatory update -- message template checksum doesn't match - update_available = TRUE; - mandatory = TRUE; - } - - BOOL quit = FALSE; - if (update_available) - { - if (show_connect_box) - { - update_app(mandatory, ""); - gStartupState = STATE_UPDATE_CHECK; - return FALSE; - } - else - { - quit = TRUE; - } - } - - // Bail out and clean up circuit - if (quit) - { - msg->newMessageFast(_PREHASH_CloseCircuit); - msg->sendMessage( msg->getSender() ); - app_force_quit(NULL); - return FALSE; - } - - // If we get here, we've got a compatible message template - if (!mandatory) - { - llinfos << "Message template is current!" << llendl; - } - gStartupState = STATE_LOGIN_AUTH_INIT; - timeout.reset(); - // unregister with the message system so it knows we're no longer expecting this message - msg->setHandlerFuncFast(_PREHASH_TemplateChecksumReply, NULL, NULL); - - msg->newMessageFast(_PREHASH_CloseCircuit); - msg->sendMessage(gUserServer); - msg->disableCircuit(gUserServer); - if (gRunLocal) - { - msg->enableCircuit(gAgentSimHost, TRUE); - - // Don't use a session token, and generate a random user id - gAgentID.generate(); - gAgentSessionID = LLUUID::null; - - // Skip userserver queries. - gStartupState = STATE_WORLD_INIT; - } - } - } - gMessageSystem->processAcks(); - - if (timeout.getElapsedTimeF32() > TIMEOUT_SECONDS) - { - if (timeout_count > MAX_TIMEOUT_COUNT) - { - gViewerWindow->alertXml("SystemMayBeDown", - login_alert_status, - NULL); - - // Back up to login screen - reset_login(); - gViewerStats->incStat(LLViewerStats::ST_LOGIN_TIMEOUT_COUNT); - } - else - { - llinfos << "Resending on timeout" << llendl; - gStartupState--; - timeout_count++; - } - } + // skipping over STATE_UPDATE_CHECK because that just waits for input + gStartupState = STATE_LOGIN_AUTH_INIT; return do_normal_idle; } if (STATE_UPDATE_CHECK == gStartupState) { + // wait for user to give input via dialog box return do_normal_idle; } @@ -1657,9 +1459,7 @@ BOOL idle_startup() // // Initialize classes w/graphics stuff. // - gImageList.doPrefetchImages(); - update_texture_fetch(); - + gImageList.doPrefetchImages(); LLSurface::initClasses(); LLFace::initClass(); @@ -1690,6 +1490,7 @@ BOOL idle_startup() LLViewerRegion *regionp = gWorldp->getRegionFromHandle(first_sim_handle); llinfos << "Adding initial simulator " << regionp->getOriginGlobal() << llendl; + gStartupState = STATE_SEED_GRANTED_WAIT; regionp->setSeedCapability(first_sim_seed_cap); // Set agent's initial region to be the one we just created. @@ -1705,9 +1506,32 @@ BOOL idle_startup() // VEFFECT: Login gWorldp->addRegion(0, gAgentSimHost); gAgent.setRegion(gWorldp->getRegionFromHandle(0)); + + gStartupState = STATE_SEED_CAP_GRANTED; } display_startup(); + return do_normal_idle; + } + + + //--------------------------------------------------------------------- + // Wait for Seed Cap Grant + //--------------------------------------------------------------------- + if(STATE_SEED_GRANTED_WAIT == gStartupState) + { + llinfos << "Waiting for seed grant ...." << llendl; + return do_normal_idle; + } + + + //--------------------------------------------------------------------- + // Seed Capability Granted + // no newMessage calls should happen before this point + //--------------------------------------------------------------------- + if (STATE_SEED_CAP_GRANTED == gStartupState) + { + update_texture_fetch(); // Initialize UI if (!gNoRender) @@ -2175,21 +1999,6 @@ BOOL idle_startup() return do_normal_idle; } - //--------------------------------------------------------------------- - // Assert agent to userserver - //--------------------------------------------------------------------- - if (STATE_CONNECT_USERSERVER == gStartupState) - { - LLMessageSystem* msg = gMessageSystem; - msg->enableCircuit(gUserServer, TRUE); - msg->newMessage("ConnectAgentToUserserver"); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->sendReliable(gUserServer); - gStartupState++; - return do_normal_idle; - } //--------------------------------------------------------------------- // Misc @@ -2314,9 +2123,6 @@ BOOL idle_startup() msg->setHandlerFuncFast(_PREHASH_AttachedSound, process_attached_sound); msg->setHandlerFuncFast(_PREHASH_AttachedSoundGainChange, process_attached_sound_gain_change); //msg->setHandlerFuncFast(_PREHASH_AttachedSoundCutoffRadius, process_attached_sound_cutoff_radius); - msg->setHandlerFunc( - "ConnectToUserserver", - process_connect_to_userserver); llinfos << "Initialization complete" << llendl; gInitializationComplete = TRUE; @@ -2756,31 +2562,6 @@ void set_startup_status(const F32 frac, const char *string, const char* msg) gViewerWindow->setProgressMessage(msg); } -void on_userserver_name_resolved( BOOL success, const LLString& host_name, U32 ip, void* userdata ) -{ - if( STATE_RESOLVING_USERSERVER != gStartupState ) - { - llwarns << "Userserver name callback returned during invalid state!" << llendl; - return; - } - - if( success ) - { - gUserServer.setAddress( ip ); - llinfos << "...Userserver resolved to " << gUserServer << llendl; - gStartupState = STATE_USERSERVER_RESOLVED; - } - else - { - llwarns << "setHostByName failed" << llendl; - - LLStringBase<char>::format_map_t args; - args["[HOST_NAME]"] = host_name; - gViewerWindow->alertXml("SetByHostFail", args, login_alert_done ); - reset_login(); - } -} - void login_alert_status(S32 option, void* user_data) { if (0 == option) @@ -2904,8 +2685,6 @@ void update_dialog_callback(S32 option, void *userdata) LLURI update_url = LLURI::buildHTTP("secondlife.com", 80, "update.php", query_map); #if LL_WINDOWS - char ip[MAX_STRING]; /* Flawfinder: ignore */ - update_exe_path = gDirUtilp->getTempFilename(); if (update_exe_path.empty()) { @@ -2932,7 +2711,6 @@ void update_dialog_callback(S32 option, void *userdata) app_force_quit(NULL); return; } - u32_to_ip_string(gUserServer.getAddress(), ip); // if a sim name was passed in via command line parameter (typically through a SLURL) if ( LLURLSimString::sInstance.mSimString.length() ) @@ -3060,7 +2838,7 @@ void register_viewer_callbacks(LLMessageSystem* msg) msg->setHandlerFuncFast(_PREHASH_MeanCollisionAlert, process_mean_collision_alert_message, NULL); msg->setHandlerFunc("ViewerFrozenMessage", process_frozen_message); - msg->setHandlerFuncFast(_PREHASH_RequestAvatarInfo, process_avatar_info_request); + //msg->setHandlerFuncFast(_PREHASH_RequestAvatarInfo, process_avatar_info_request); msg->setHandlerFuncFast(_PREHASH_NameValuePair, process_name_value); msg->setHandlerFuncFast(_PREHASH_RemoveNameValuePair, process_remove_name_value); msg->setHandlerFuncFast(_PREHASH_AvatarAnimation, process_avatar_animation); @@ -3924,19 +3702,6 @@ void release_start_screen() gStartImageGL = NULL; } -void process_connect_to_userserver(LLMessageSystem* msg, void**) -{ - // Sent unreliably since if we've become disconnected, the - // userserver will get back to us eventually. By sending reliable, - // we also may accidently induce two separate validations under - // conditions where the userserver is already lagged. - msg->newMessage("ConnectAgentToUserserver"); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->sendMessage(gUserServer); -} - bool LLStartUp::canGoFullscreen() { return gStartupState >= STATE_WORLD_INIT; diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h index 75a525f241..4137c62a92 100644 --- a/indra/newview/llstartup.h +++ b/indra/newview/llstartup.h @@ -26,27 +26,20 @@ enum EStartupState{ STATE_LOGIN_SHOW, STATE_LOGIN_WAIT, STATE_LOGIN_CLEANUP, - STATE_RESOLVING_USERSERVER, - STATE_USERSERVER_RESOLVED, - STATE_MESSAGE_TEMPLATE_SEND, - STATE_MESSAGE_TEMPLATE_WAIT, STATE_UPDATE_CHECK, STATE_LOGIN_AUTH_INIT, STATE_LOGIN_AUTHENTICATE, STATE_LOGIN_NO_DATA_YET, STATE_LOGIN_DOWNLOADING, STATE_LOGIN_PROCESS_RESPONSE, - //STATE_USERSERVER_SEND, - //STATE_USERSERVER_WAIT, - //STATE_LOCATION_SEND, - //STATE_LOCATION_WAIT, STATE_WORLD_INIT, + STATE_SEED_GRANTED_WAIT, + STATE_SEED_CAP_GRANTED, STATE_QUICKTIME_INIT, STATE_WORLD_WAIT, STATE_AGENT_SEND, STATE_AGENT_WAIT, STATE_INVENTORY_SEND, - STATE_CONNECT_USERSERVER, STATE_MISC, STATE_PRECACHE, STATE_WEARABLES_WAIT, diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp index 69de1142a4..051376d94f 100644 --- a/indra/newview/lltoolbrush.cpp +++ b/indra/newview/lltoolbrush.cpp @@ -548,6 +548,7 @@ void LLToolBrushLand::undo() } // static +/* void LLToolBrushLand::redo() { for(LLViewerRegion* regionp = mLastAffectedRegions.getFirstData(); @@ -560,7 +561,7 @@ void LLToolBrushLand::redo() gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); gMessageSystem->sendMessage(regionp->getHost()); } -} +}*/ // static bool LLToolBrushLand::canTerraform(LLViewerRegion* regionp) const diff --git a/indra/newview/lltoolbrush.h b/indra/newview/lltoolbrush.h index 3cae7559a3..81b2c61ef5 100644 --- a/indra/newview/lltoolbrush.h +++ b/indra/newview/lltoolbrush.h @@ -53,7 +53,7 @@ public: virtual void undo(); virtual BOOL canUndo() { return TRUE; } - virtual void redo(); + //virtual void redo(); virtual BOOL canRedo() { return FALSE; } diff --git a/indra/newview/llviewerjointmesh_sse.cpp b/indra/newview/llviewerjointmesh_sse.cpp index 579c5d2687..d1ded78f06 100644 --- a/indra/newview/llviewerjointmesh_sse.cpp +++ b/indra/newview/llviewerjointmesh_sse.cpp @@ -31,8 +31,6 @@ #if LL_VECTORIZE -static LLV4Matrix4 sJointMat[32]; - inline void matrix_translate(LLV4Matrix4& m, const LLMatrix4* w, const LLVector3& j) { m.mV[VX] = _mm_loadu_ps(w->mMatrix[VX]); @@ -47,6 +45,9 @@ inline void matrix_translate(LLV4Matrix4& m, const LLMatrix4* w, const LLVector3 // static void LLViewerJointMesh::updateGeometrySSE(LLFace *face, LLPolyMesh *mesh) { + // This cannot be a file-level static because it will be initialized + // before main() using SSE code, which will crash on non-SSE processors. + static LLV4Matrix4 sJointMat[32]; LLDynamicArray<LLJointRenderData*>& joint_data = mesh->getReferenceMesh()->mJointRenderData; //upload joint pivots/matrices diff --git a/indra/newview/llviewerjointmesh_sse2.cpp b/indra/newview/llviewerjointmesh_sse2.cpp index 9ef2b4692a..41f86d363f 100644 --- a/indra/newview/llviewerjointmesh_sse2.cpp +++ b/indra/newview/llviewerjointmesh_sse2.cpp @@ -9,6 +9,10 @@ * $License$ */ +// Visual Studio required settings for this file: +// Precompiled Headers OFF +// Code Generation: SSE2 + //----------------------------------------------------------------------------- // Header Files //----------------------------------------------------------------------------- @@ -50,6 +54,9 @@ inline void matrix_translate(LLV4Matrix4& m, const LLMatrix4* w, const LLVector3 // static void LLViewerJointMesh::updateGeometrySSE2(LLFace *face, LLPolyMesh *mesh) { + // This cannot be a file-level static because it will be initialized + // before main() using SSE code, which will crash on non-SSE processors. + static LLV4Matrix4 sJointMat[32]; LLDynamicArray<LLJointRenderData*>& joint_data = mesh->getReferenceMesh()->mJointRenderData; //upload joint pivots/matrices diff --git a/indra/newview/llviewerjointmesh_vec.cpp b/indra/newview/llviewerjointmesh_vec.cpp index 69ddad63fc..c04c323800 100644 --- a/indra/newview/llviewerjointmesh_vec.cpp +++ b/indra/newview/llviewerjointmesh_vec.cpp @@ -25,11 +25,10 @@ // Generic vectorized code, uses compiler defaults, works well for Altivec // on PowerPC. -static LLV4Matrix4 sJointMat[32]; - // static void LLViewerJointMesh::updateGeometryVectorized(LLFace *face, LLPolyMesh *mesh) { + static LLV4Matrix4 sJointMat[32]; LLDynamicArray<LLJointRenderData*>& joint_data = mesh->getReferenceMesh()->mJointRenderData; S32 j, joint_num, joint_end = joint_data.count(); LLV4Vector3 pivot; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 7ad4f1d70b..d6bfe66dc8 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -258,7 +258,7 @@ void handle_leave_group(void *); // File Menu const char* upload_pick(void* data); void handle_upload(void* data); -void handle_upload_object(void* data); +//void handle_upload_object(void* data); void handle_compress_image(void*); BOOL enable_save_as(void *); @@ -375,11 +375,11 @@ void slow_mo_animations(void *); void handle_disconnect_viewer(void *); void handle_stopall(void*); -void handle_hinge(void*); -void handle_ptop(void*); -void handle_lptop(void*); -void handle_wheel(void*); -void handle_dehinge(void*); +//void handle_hinge(void*); +//void handle_ptop(void*); +//void handle_lptop(void*); +//void handle_wheel(void*); +//void handle_dehinge(void*); BOOL enable_dehinge(void*); void handle_force_delete(void*); void print_object_info(void*); @@ -4530,36 +4530,36 @@ class LLToolsStopAllAnimations : public view_listener_t } }; -void handle_hinge(void*) -{ - gSelectMgr->sendHinge(1); -} +//void handle_hinge(void*) +//{ +// gSelectMgr->sendHinge(1); +//} -void handle_ptop(void*) -{ - gSelectMgr->sendHinge(2); -} +//void handle_ptop(void*) +//{ +// gSelectMgr->sendHinge(2); +//} -void handle_lptop(void*) -{ - gSelectMgr->sendHinge(3); -} +//void handle_lptop(void*) +//{ +// gSelectMgr->sendHinge(3); +//} -void handle_wheel(void*) -{ - gSelectMgr->sendHinge(4); -} +//void handle_wheel(void*) +//{ +// gSelectMgr->sendHinge(4); +//} -void handle_dehinge(void*) -{ - gSelectMgr->sendDehinge(); -} +//void handle_dehinge(void*) +//{ +// gSelectMgr->sendDehinge(); +//} -BOOL enable_dehinge(void*) -{ - LLViewerObject* obj = gSelectMgr->getSelection()->getFirstEditableObject(); - return obj && !obj->isAttachment(); -} +//BOOL enable_dehinge(void*) +//{ +// LLViewerObject* obj = gSelectMgr->getSelection()->getFirstEditableObject(); +// return obj && !obj->isAttachment(); +//} class LLEditEnableCut : public view_listener_t diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 600d7d3ca2..44f5cbb9db 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -186,6 +186,7 @@ const char* upload_pick(void* data) return filename; } +/* void handle_upload_object(void* data) { const char* filename = upload_pick(data); @@ -195,7 +196,7 @@ void handle_upload_object(void* data) LLFloaterImport* floaterp = new LLFloaterImport(filename); gUICtrlFactory->buildFloater(floaterp, "floater_import.xml"); } -} +}*/ class LLFileUploadImage : public view_listener_t { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 9f034b6afd..7adfba7776 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2318,82 +2318,6 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) } } -/* -void process_agent_to_new_region(LLMessageSystem *mesgsys, void **user_data) -{ -// LLFastTimer t(LLFastTimer::FTM_TEMP8); - - U64 handle; - U32 ip; - U16 port; - LLUUID session_id; - - // Actually, the agent itself should process this message. - // From a "AgentToNewRegion" message - mesgsys->getIPAddrFast(_PREHASH_RegionData, _PREHASH_IP, ip); - mesgsys->getIPPortFast(_PREHASH_RegionData, _PREHASH_Port, port); - mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_Handle, handle); - mesgsys->getUUIDFast(_PREHASH_RegionData, _PREHASH_SessionID, session_id); - - if (gAgent.getSessionID() != session_id) - { - llwarns << "Got AgentToNewRegion with invalid session ID, ignoring" << llendl; - return; - } - - LLViewerRegion *regionp; - - F32 x, y; - from_region_handle(handle, &x, &y); - regionp = gWorldp->getRegionFromHandle(handle); - if (!regionp) - { - if (gAgent.getRegion()) - { - llwarns << "current region " << gAgent.getRegion()->getOriginGlobal() << llendl; - } - - llwarns << "Agent being sent to invalid home region: " - << x << ":" << y - << " current pos " << gAgent.getPositionGlobal() - << llendl; - do_disconnect("You were sent to an invalid region."); - return; - - } - - if (regionp == gAgent.getRegion()) - { - llinfos << "Agent being sent to current home region, skipping." << llendl; - return; - } - - - llinfos << "AgentToNewRegion - being sent to " << x << ":" << y - << "" - - LLVector3 shift_vector = regionp->getPosRegionFromGlobal(gAgent.getRegion()->getOriginGlobal()); - - gAgent.setRegion(regionp); - - gObjectList.shiftObjects(shift_vector); - - llinfos << "Changing home region to " << x << ":" << y << llendl; - - // send camera update to new region - - send_agent_update(TRUE, TRUE); - - // set our upstream asset provider to the new simulator - LLHost upstream(ip, port); - gAssetStorage->setUpstream(upstream); - gCacheName->setUpstream(upstream); - - // Not needed, as simulator will always send request as it creates the new - // agent in the new region. - // send_current_avatar_info(); -} -*/ // Simulator we're on is informing the viewer that the agent // is starting to teleport (perhaps to another sim, perhaps to the @@ -3536,6 +3460,7 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data) // This info is requested by the simulator when the agent first logs in // or when it moves into a simulator in which it did not already have // a child agent. +/* void process_avatar_info_request(LLMessageSystem *mesgsys, void **user_data) { llinfos << "process_avatar_info_request()" << llendl; @@ -3543,7 +3468,7 @@ void process_avatar_info_request(LLMessageSystem *mesgsys, void **user_data) // Send the avatar appearance (parameters and texture entry UUIDs) gAgent.sendAgentSetAppearance(); send_agent_update(TRUE, TRUE); -} +}*/ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h index 9eb2d9fcdd..4717c30f7a 100644 --- a/indra/newview/llviewernetwork.h +++ b/indra/newview/llviewernetwork.h @@ -39,8 +39,6 @@ struct LLUserServerData const char* mHelperURI; }; -extern LLHost gUserServer; - extern F32 gPacketDropPercentage; extern F32 gInBandwidth; extern F32 gOutBandwidth; diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 556e0bc79b..21365fa3b9 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -1038,7 +1038,9 @@ public: // for parcel buys S32 mParcelID; - + S32 mPrice; + S32 mArea; + // for land claims F32 mWest; F32 mSouth; @@ -1096,6 +1098,8 @@ LLViewerParcelMgr::ParcelBuyInfo* LLViewerParcelMgr::setupParcelBuy( info->mIsClaim = is_claim; info->mRemoveContribution = remove_contribution; info->mHost = region->getHost(); + info->mPrice = mCurrentParcel->getSalePrice(); + info->mArea = mCurrentParcel->getArea(); if (!is_claim) { @@ -1141,6 +1145,12 @@ void LLViewerParcelMgr::sendParcelBuy(ParcelBuyInfo* info) msg->addF32("East", info->mEast); msg->addF32("North", info->mNorth); } + else // ParcelBuy + { + msg->nextBlock("ParcelData"); + msg->addS32("Price",info->mPrice); + msg->addS32("Area",info->mArea); + } msg->sendReliable(info->mHost); } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 6fd31f3e72..7fed7ebe94 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -31,6 +31,7 @@ #include "llfloaterregioninfo.h" #include "llhttpnode.h" #include "llnetmap.h" +#include "llstartup.h" #include "llviewerobjectlist.h" #include "llviewerparceloverlay.h" #include "llvlmanager.h" @@ -1156,6 +1157,10 @@ void LLViewerRegion::unpackRegionHandshake() setBillableFactor(billable_factor); setCacheID(cache_id); + LLUUID region_id; + msg->getUUID("RegionInfo2", "RegionID", region_id); + setRegionID(region_id); + LLVLComposition *compp = getComposition(); if (compp) { @@ -1232,6 +1237,11 @@ public: { llinfos << "BaseCapabilitiesComplete::error " << statusNum << ": " << reason << llendl; + + if (STATE_SEED_GRANTED_WAIT == gStartupState) + { + gStartupState = STATE_SEED_CAP_GRANTED; + } } void result(const LLSD& content) @@ -1243,6 +1253,11 @@ public: llinfos << "BaseCapabilitiesComplete::result got capability for " << iter->first << llendl; } + + if (STATE_SEED_GRANTED_WAIT == gStartupState) + { + gStartupState = STATE_SEED_CAP_GRANTED; + } } static boost::intrusive_ptr<BaseCapabilitiesComplete> build( @@ -1259,6 +1274,11 @@ private: void LLViewerRegion::setSeedCapability(const std::string& url) { + if (getCapability("Seed") == url) + { + llwarns << "Ignoring duplicate seed capability" << llendl; + return; + } delete mEventPoll; mEventPoll = NULL; @@ -1286,23 +1306,18 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("ParcelVoiceInfoRequest"); capabilityNames.append("ChatSessionRequest"); + llinfos << "posting to seed " << url << llendl; + LLHTTPClient::post(url, capabilityNames, BaseCapabilitiesComplete::build(this)); } -static -LLEventPoll* createViewerEventPoll(const std::string& url) -{ - return new LLEventPoll(url); -} - - void LLViewerRegion::setCapability(const std::string& name, const std::string& url) { if(name == "EventQueueGet") { delete mEventPoll; mEventPoll = NULL; - mEventPoll = createViewerEventPoll(url); + mEventPoll = new LLEventPoll(url, getHost()); } else if(name == "UntrustedSimulatorMessage") { @@ -1326,14 +1341,15 @@ std::string LLViewerRegion::getCapability(const std::string& name) const void LLViewerRegion::logActiveCapabilities() const { + int count = 0; CapabilityMap::const_iterator iter; - for (iter = mCapabilities.begin(); iter != mCapabilities.end(); iter++) + for (iter = mCapabilities.begin(); iter != mCapabilities.end(); iter++, count++) { if (!iter->second.empty()) { - // llinfos << "Active capability is " << iter->first << llendl; llinfos << iter->first << " URL is " << iter->second << llendl; } } + llinfos << "Dumped " << count << " entries." << llendl; } diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 05c37fe08f..e971efeedf 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -176,6 +176,10 @@ public: LLSurface &getLand() const { return *mLandp; } + // set and get the region id + const LLUUID& getRegionID() const { return mRegionID; } + void setRegionID(const LLUUID& region_id) { mRegionID = region_id; } + BOOL pointInRegionGlobal(const LLVector3d &point_global) const; LLVector3 getPosRegionFromGlobal(const LLVector3d &point_global) const; LLVector3 getPosRegionFromAgent(const LLVector3 &agent_pos) const; @@ -250,6 +254,9 @@ protected: U64 mHandle; LLHost mHost; + // The unique ID for this region. + LLUUID mRegionID; + F32 mTimeDilation; // time dilation of physics simulation on simulator // simulator name diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 1d2e9af3b6..c667ffabfc 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -17,6 +17,7 @@ #include "llviewercontrol.h" #include "lldrawpool.h" #include "llglheaders.h" +#include "llhttpnode.h" #include "llregionhandle.h" #include "llsurface.h" #include "llviewercamera.h" @@ -742,15 +743,6 @@ void LLWorld::printPacketsLost() << " packets lost: " << cdp->getPacketsLost() << llendl; } } - - llinfos << "UserServer:" << llendl; - llinfos << "-----------" << llendl; - - cdp = gMessageSystem->mCircuitInfo.findCircuit(gUserServer); - if (cdp) - { - llinfos << gUserServer << " packets lost: " << cdp->getPacketsLost() << llendl; - } } void LLWorld::processCoarseUpdate(LLMessageSystem* msg, void** user_data) @@ -1023,6 +1015,41 @@ void process_enable_simulator(LLMessageSystem *msg, void **user_data) msg->sendReliable(sim); } +class LLEstablishAgentCommunication : public LLHTTPNode +{ + LOG_CLASS(LLEstablishAgentCommunication); +public: + virtual void describe(Description& desc) const + { + desc.shortInfo("seed capability info for a region"); + desc.postAPI(); + desc.input( + "{ seed-capability: ..., sim-ip: ..., sim-port }"); + desc.source(__FILE__, __LINE__); + } + + virtual void post(ResponsePtr response, const LLSD& context, const LLSD& input) const + { + if (!input["body"].has("agent-id") || + !input["body"].has("sim-ip-and-port") || + !input["body"].has("seed-capability")) + { + llwarns << "invalid parameters" << llendl; + return; + } + + LLHost sim(input["body"]["sim-ip-and-port"].asString()); + + LLViewerRegion* regionp = gWorldp->getRegion(sim); + if (!regionp) + { + llwarns << "Got EstablishAgentCommunication for unknown region " + << sim << llendl; + return; + } + regionp->setSeedCapability(input["body"]["seed-capability"]); + } +}; // disable the circuit to this simulator // Called in response to "DisableSimulator" message. @@ -1075,8 +1102,6 @@ void send_agent_pause() gMessageSystem->sendReliable(regionp->getHost()); } - gMessageSystem->sendReliable(gUserServer); - gObjectList.mWasPaused = TRUE; } @@ -1102,10 +1127,11 @@ void send_agent_resume() gMessageSystem->sendReliable(regionp->getHost()); } - gMessageSystem->sendReliable(gUserServer); - // Reset the FPS counter to avoid an invalid fps gViewerStats->mFPSStat.start(); } +LLHTTPRegistration<LLEstablishAgentCommunication> + gHTTPRegistrationEstablishAgentCommunication( + "/message/EstablishAgentCommunication"); diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 23a2c0b758..332b72fa54 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -20,6 +20,7 @@ class ViewerManifest(LLManifest): super(ViewerManifest, self).construct() self.exclude("*.svn*") self.path(src="../../scripts/messages/message_template.msg", dst="app_settings/message_template.msg") + self.path(src="../../etc/message.xml", dst="app_settings/message.xml") if self.prefix(src="app_settings"): self.exclude("logcontrol.xml") diff --git a/indra/test/llbuffer_tut.cpp b/indra/test/llbuffer_tut.cpp new file mode 100644 index 0000000000..f403181efa --- /dev/null +++ b/indra/test/llbuffer_tut.cpp @@ -0,0 +1,250 @@ +/** + * @file llbuffer_tut.cpp + * @author Adroit + * @date 2007-03 + * @brief llbuffer test cases. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include <tut/tut.h> +#include "lltut.h" +#include "llbuffer.h" +#include "llmemtype.h" + +namespace tut +{ + struct buffer + { + }; + + typedef test_group<buffer> buffer_t; + typedef buffer_t::object buffer_object_t; + tut::buffer_t tut_buffer("buffer"); + + template<> template<> + void buffer_object_t::test<1>() + { + LLChannelDescriptors channelDescriptors; + ensure("in() and out() functions Failed", (0 == channelDescriptors.in() && 1 == channelDescriptors.out())); + + S32 val = 50; + LLChannelDescriptors channelDescriptors1(val); + ensure("LLChannelDescriptors in() and out() functions Failed", (50 == channelDescriptors1.in() && 51 == channelDescriptors1.out())); + } + + template<> template<> + void buffer_object_t::test<2>() + { + LLSegment segment; + ensure("LLSegment get functions failed", (0 == segment.getChannel() && NULL == segment.data() && 0 == segment.size())); + segment.setChannel(50); + ensure_equals("LLSegment setChannel() function failed", segment.getChannel(), 50); + ensure("LLSegment isOnChannel() function failed", (TRUE == segment.isOnChannel(50))); + } + + template<> template<> + void buffer_object_t::test<3>() + { + S32 channel = 30; + const char str[] = "SecondLife"; + S32 len = sizeof(str); + LLSegment segment(channel, (U8*)str, len); + ensure("LLSegment get functions failed", (30 == segment.getChannel() && len == segment.size() && (U8*)str == segment.data())); + ensure_memory_matches("LLSegment::data() failed", segment.data(), segment.size(), (U8*)str, len); + ensure("LLSegment isOnChannel() function failed", (TRUE == segment.isOnChannel(channel))); + } + + template<> template<> + void buffer_object_t::test<4>() + { + S32 channel = 50; + S32 bigSize = 16384*2; + char str[] = "SecondLife"; + S32 smallSize = sizeof(str); + + LLSegment segment; + LLHeapBuffer buf; // use default size of DEFAULT_HEAP_BUFFER_SIZE = 16384 + + S32 requestSize; + + requestSize = 16384-1; + ensure("1. LLHeapBuffer createSegment failed", (TRUE == buf.createSegment(channel, requestSize, segment)) && segment.size() == requestSize); + // second request for remainign 1 byte + + requestSize = 1; + ensure("2. LLHeapBuffer createSegment failed", (TRUE == buf.createSegment(channel, requestSize, segment)) && segment.size() == requestSize); + + // it should fail now. + requestSize = 1; + ensure("3. LLHeapBuffer createSegment failed", (FALSE == buf.createSegment(channel, requestSize, segment))); + + LLHeapBuffer buf1(bigSize); + + // requst for more than default size but less than total sizeit should fail now. + requestSize = 16384 + 1; + ensure("4. LLHeapBuffer createSegment failed", (TRUE == buf1.createSegment(channel, requestSize, segment)) && segment.size() == requestSize); + + LLHeapBuffer buf2((U8*) str, smallSize); + requestSize = smallSize; + ensure("5. LLHeapBuffer createSegment failed", (TRUE == buf2.createSegment(channel, requestSize, segment)) && segment.size() == requestSize && memcmp(segment.data(), (U8*) str, requestSize) == 0); + requestSize = smallSize+1; + ensure("6. LLHeapBuffer createSegment failed", (FALSE == buf2.createSegment(channel, requestSize, segment))); + } + + //makeChannelConsumer() + template<> template<> + void buffer_object_t::test<5>() + { + LLChannelDescriptors inchannelDescriptors(20); + LLChannelDescriptors outchannelDescriptors = LLBufferArray::makeChannelConsumer(inchannelDescriptors); + ensure("LLBufferArray::makeChannelConsumer() function Failed", (21 == outchannelDescriptors.in())); + } + + template<> template<> + void buffer_object_t::test<6>() + { + LLBufferArray bufferArray; + const char array[] = "SecondLife"; + S32 len = strlen(array); + LLChannelDescriptors channelDescriptors = bufferArray.nextChannel(); + bufferArray.append(channelDescriptors.in(), (U8*)array, len); + S32 count = bufferArray.countAfter(channelDescriptors.in(), NULL); + ensure_equals("Appended size is:", count, len); + } + + //append() and prepend() + template<> template<> + void buffer_object_t::test<7>() + { + LLBufferArray bufferArray; + const char array[] = "SecondLife"; + S32 len = strlen(array); + const char array1[] = "LindenLabs"; + S32 len1 = strlen(array1); + + std::string str(array1); + str.append(array); + + LLChannelDescriptors channelDescriptors = bufferArray.nextChannel(); + bufferArray.append(channelDescriptors.in(), (U8*)array, len); + bufferArray.prepend(channelDescriptors.in(), (U8*)array1, len1); + char buf[100]; + S32 len2 = 20; + bufferArray.readAfter(channelDescriptors.in(), NULL, (U8*)buf, len2); + ensure_equals("readAfter length failed", len2, 20); + + buf[len2] = '\0'; + ensure_equals("readAfter/prepend/append failed", buf, str); + } + + //append() + template<> template<> + void buffer_object_t::test<8>() + { + LLBufferArray bufferArray; + const char array[] = "SecondLife"; + S32 len = strlen(array); + const char array1[] = "LindenLabs"; + S32 len1 = strlen(array1); + + std::string str(array); + str.append(array1); + + LLChannelDescriptors channelDescriptors = bufferArray.nextChannel(); + bufferArray.append(channelDescriptors.in(), (U8*)array, len); + bufferArray.append(channelDescriptors.in(), (U8*)array1, len1); + char buf[100]; + S32 len2 = 20; + bufferArray.readAfter(channelDescriptors.in(), NULL, (U8*)buf, len2); + ensure_equals("readAfter length failed", len2, 20); + + buf[len2] = '\0'; + ensure_equals("readAfter/append/append failed", buf, str); + } + + template<> template<> + void buffer_object_t::test<9>() + { + LLBufferArray bufferArray; + const char array[] = "SecondLife"; + S32 len = strlen(array) + 1; + std::string str(array); + LLChannelDescriptors channelDescriptors = bufferArray.nextChannel(); + bufferArray.append(channelDescriptors.in(), (U8*)array, len); + LLBufferArray bufferArray1; + ensure("Contents are not copied and the source buffer is not empty", (1 == bufferArray1.takeContents(bufferArray))); + + char buf[100]; + S32 len2 = len; + bufferArray1.readAfter(channelDescriptors.in(), NULL, (U8*)buf, len2); + ensure_equals("takeContents failed to copy", buf, str); + } + + //seek() + template<> template<> + void buffer_object_t::test<10>() + { + const char array[] = "SecondLife is a Virtual World"; + S32 len = strlen(array); + LLBufferArray bufferArray; + bufferArray.append(0, (U8*)array, len); + + char buf[255]; + S32 len1 = 16; + U8* last = bufferArray.readAfter(0, 0, (U8*)buf, len1); + buf[len1] = '\0'; + last = bufferArray.seek(0, last, -2); + + len1 = 15; + last = bufferArray.readAfter(0, last, (U8*)buf, len1); + buf[len1] = '\0'; + std::string str(buf); + ensure_equals("Seek does'nt worked", str, std::string("a Virtual World")); + } + + template<> template<> + void buffer_object_t::test<11>() + { + const char array[] = "SecondLife is a Virtual World"; + S32 len = strlen(array); + LLBufferArray bufferArray; + bufferArray.append(0, (U8*)array, len); + + char buf[255]; + S32 len1 = 10; + U8* last = bufferArray.readAfter(0, 0, (U8*)buf, len1); + bufferArray.splitAfter(last); + LLBufferArray::segment_iterator_t iterator = bufferArray.beginSegment(); + ++iterator; + std::string str(((char*)(*iterator).data()), (*iterator).size()); + ensure_equals("Strings are not equal;splitAfter() operation failed", str, std::string(" is a Virtual World")); + } + + //makeSegment()->eraseSegment() + template<> template<> + void buffer_object_t::test<12>() + { + LLBufferArray bufferArray; + LLChannelDescriptors channelDescriptors; + LLBufferArray::segment_iterator_t it; + S32 length = 1000; + it = bufferArray.makeSegment(channelDescriptors.out(), length); + ensure("makeSegment() function failed", (it != bufferArray.endSegment())); + ensure("eraseSegment() function failed", bufferArray.eraseSegment(it)); + ensure("eraseSegment() begin/end should now be same", bufferArray.beginSegment() == bufferArray.endSegment()); + } + + // constructSegmentAfter() + template<> template<> + void buffer_object_t::test<13>() + { + LLBufferArray bufferArray; + LLBufferArray::segment_iterator_t it; + LLSegment segment; + LLBufferArray::segment_iterator_t end = bufferArray.endSegment(); + it = bufferArray.constructSegmentAfter(NULL, segment); + ensure("constructSegmentAfter() function failed", (it == end)); + } +} diff --git a/indra/test/lldatapacker_tut.cpp b/indra/test/lldatapacker_tut.cpp index 71def354f9..5e81185f29 100644 --- a/indra/test/lldatapacker_tut.cpp +++ b/indra/test/lldatapacker_tut.cpp @@ -1,30 +1,11 @@ /** * @file lldatapacker_tut.cpp * @author Adroit - * @date February 2007 + * @date 2007-02 * @brief LLDataPacker test cases. * - * Copyright (c) 2007-2007, Linden Research, Inc. - * - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ */ #include <tut/tut.h> diff --git a/indra/test/llmessageconfig_tut.cpp b/indra/test/llmessageconfig_tut.cpp index f7eede73a3..1e9f861b25 100644 --- a/indra/test/llmessageconfig_tut.cpp +++ b/indra/test/llmessageconfig_tut.cpp @@ -12,41 +12,46 @@ #include "llmessageconfig.h" #include "llsdserialize.h" #include "llfile.h" +#include "lldir.h" #include "lltimer.h" #include "llframetimer.h" namespace tut { - ///var/tmp/babbage/dev/message-liberation/etc - static const char file_name[] = "/tmp/message.xml"; - static const long refreshRateMillis = 6000; - struct LLMessageConfigTestData { + std::string mTestConfigDir; - LLSD getCurrentConfig() + LLMessageConfigTestData() { - LLSD data; - // store aside the current config to overwrite the test ones - // when the test finishes - llifstream in_file(file_name); - if (in_file.is_open()) - { - LLSDSerialize::fromXML(data, in_file); - } - return data; + // generate temp dir + mTestConfigDir = "/tmp/llmessage-config-test"; + LLFile::mkdir(mTestConfigDir.c_str()); + + LLMessageConfig::initClass("simulator", mTestConfigDir); + } + + ~LLMessageConfigTestData() + { + // rm contents of temp dir + gDirUtilp->deleteFilesInDir(mTestConfigDir, "*"); + // rm temp dir + LLFile::rmdir(mTestConfigDir.c_str()); } + void reloadConfig(const LLSD& config) + { + LLMessageConfig::useConfig(config); + } + void writeConfigFile(const LLSD& config) { - LLMessageConfig::initClass("simulator", "/tmp"); - llofstream file(file_name); + std::string configFile = mTestConfigDir + "/message.xml"; + llofstream file(configFile.c_str()); if (file.is_open()) { LLSDSerialize::toPrettyXML(config, file); } file.close(); - ms_sleep(refreshRateMillis); - LLFrameTimer::updateFrameTime(); } }; @@ -58,150 +63,116 @@ namespace tut void LLMessageConfigTestObject::test<1>() // tests server defaults { - LLSD config_backup = getCurrentConfig(); LLSD config; config["serverDefaults"]["simulator"] = "template"; - writeConfigFile(config); - ensure_equals("Ensure server default is not llsd", - LLMessageConfig::isServerDefaultBuilderLLSD(), - false); - ensure_equals("Ensure server default is template", - LLMessageConfig::isServerDefaultBuilderTemplate(), - true); - writeConfigFile(config_backup); + reloadConfig(config); + ensure_equals("Ensure server default is not template", + LLMessageConfig::getServerDefaultFlavor(), + LLMessageConfig::TEMPLATE_FLAVOR); } template<> template<> void LLMessageConfigTestObject::test<2>() - // tests message builders + // tests message flavors { - LLSD config_backup = getCurrentConfig(); LLSD config; config["serverDefaults"]["simulator"] = "template"; - config["messages"]["msg1"]["builder"] = "template"; - config["messages"]["msg2"]["builder"] = "llsd"; - writeConfigFile(config); - ensure_equals("Ensure msg template builder not llsd", - LLMessageConfig::isMessageBuiltLLSD("msg1"), - false); - ensure_equals("Ensure msg template builder", - LLMessageConfig::isMessageBuiltTemplate("msg1"), - true); - ensure_equals("Ensure msg llsd builder", - LLMessageConfig::isMessageBuiltLLSD("msg2"), - true); - ensure_equals("Ensure msg llsd builder not template", - LLMessageConfig::isMessageBuiltTemplate("msg2"), - false); - writeConfigFile(config_backup); + config["messages"]["msg1"]["flavor"] = "template"; + config["messages"]["msg2"]["flavor"] = "llsd"; + reloadConfig(config); + ensure_equals("Ensure msg template flavor", + LLMessageConfig::getMessageFlavor("msg1"), + LLMessageConfig::TEMPLATE_FLAVOR); + ensure_equals("Ensure msg llsd flavor", + LLMessageConfig::getMessageFlavor("msg2"), + LLMessageConfig::LLSD_FLAVOR); } template<> template<> void LLMessageConfigTestObject::test<4>() - // tests message builder defaults + // tests message flavor defaults { - LLSD config_backup = getCurrentConfig(); LLSD config; config["serverDefaults"]["simulator"] = "llsd"; config["messages"]["msg1"]["trusted-sender"] = true; - writeConfigFile(config); - ensure_equals("Ensure missing message defaults to server builder, not template", - LLMessageConfig::isMessageBuiltTemplate("Test"), - false); - ensure_equals("Ensure missing message default to server builder llsd", - LLMessageConfig::isMessageBuiltLLSD("Test"), - true); - ensure_equals("Ensure missing builder defaults to server builder, not template", - LLMessageConfig::isMessageBuiltTemplate("msg1"), - false); - ensure_equals("Ensure missing builder default to server builder llsd", - LLMessageConfig::isMessageBuiltLLSD("msg1"), - true); - - ensure_equals("Ensure server default is not llsd", - LLMessageConfig::isServerDefaultBuilderLLSD(), - true); - ensure_equals("Ensure server default is template", - LLMessageConfig::isServerDefaultBuilderTemplate(), - false); - - writeConfigFile(config_backup); + reloadConfig(config); + ensure_equals("Ensure missing message gives no flavor", + LLMessageConfig::getMessageFlavor("Test"), + LLMessageConfig::NO_FLAVOR); + ensure_equals("Ensure missing flavor is NO_FLAVOR even with sender trustedness set", + LLMessageConfig::getMessageFlavor("msg1"), + LLMessageConfig::NO_FLAVOR); + ensure_equals("Ensure server default is llsd", + LLMessageConfig::getServerDefaultFlavor(), + LLMessageConfig::LLSD_FLAVOR); } template<> template<> void LLMessageConfigTestObject::test<3>() // tests trusted/untrusted senders { - LLSD config_backup = getCurrentConfig(); LLSD config; config["serverDefaults"]["simulator"] = "template"; - config["messages"]["msg1"]["builder"] = "llsd"; + config["messages"]["msg1"]["flavor"] = "llsd"; config["messages"]["msg1"]["trusted-sender"] = false; - config["messages"]["msg2"]["builder"] = "llsd"; + config["messages"]["msg2"]["flavor"] = "llsd"; config["messages"]["msg2"]["trusted-sender"] = true; - writeConfigFile(config); - ensure_equals("Ensure untrusted is not trusted", - LLMessageConfig::isMessageTrusted("msg1"), - false); + reloadConfig(config); ensure_equals("Ensure untrusted is untrusted", - LLMessageConfig::isValidUntrustedMessage("msg1"), - true); + LLMessageConfig::getSenderTrustedness("msg1"), + LLMessageConfig::UNTRUSTED); ensure_equals("Ensure trusted is trusted", - LLMessageConfig::isMessageTrusted("msg2"), - true); - ensure_equals("Ensure trusted is not untrusted", - LLMessageConfig::isValidUntrustedMessage("msg2"), - false); - writeConfigFile(config_backup); + LLMessageConfig::getSenderTrustedness("msg2"), + LLMessageConfig::TRUSTED); + ensure_equals("Ensure missing trustedness is NOT_SET", + LLMessageConfig::getSenderTrustedness("msg3"), + LLMessageConfig::NOT_SET); } template<> template<> void LLMessageConfigTestObject::test<5>() - // tests trusted/untrusted without flag, only builder + // tests trusted/untrusted without flag, only flavor { - LLSD config_backup = getCurrentConfig(); LLSD config; config["serverDefaults"]["simulator"] = "template"; - config["messages"]["msg1"]["builder"] = "llsd"; - writeConfigFile(config); - ensure_equals("Ensure missing trusted is not trusted", - LLMessageConfig::isMessageTrusted("msg1"), - false); - ensure_equals("Ensure missing trusted is not untrusted", - LLMessageConfig::isValidUntrustedMessage("msg1"), - false); - writeConfigFile(config_backup); + config["messages"]["msg1"]["flavor"] = "llsd"; + reloadConfig(config); + ensure_equals("Ensure msg1 exists, has llsd flavor", + LLMessageConfig::getMessageFlavor("msg1"), + LLMessageConfig::LLSD_FLAVOR); + ensure_equals("Ensure missing trusted is not set", + LLMessageConfig::getSenderTrustedness("msg1"), + LLMessageConfig::NOT_SET); } template<> template<> void LLMessageConfigTestObject::test<6>() - // tests message builder defaults { - LLSD config_backup = getCurrentConfig(); LLSD config; - config["serverDefaults"]["simulator"] = "template"; - config["messages"]["msg1"]["trusted-sender"] = true; - writeConfigFile(config); - ensure_equals("Ensure missing message defaults to server builder, not template", - LLMessageConfig::isMessageBuiltTemplate("Test"), - true); - ensure_equals("Ensure missing message default to server builder llsd", - LLMessageConfig::isMessageBuiltLLSD("Test"), - false); - ensure_equals("Ensure missing builder defaults to server builder, not template", - LLMessageConfig::isMessageBuiltTemplate("msg1"), + config["capBans"]["MapLayer"] = true; + config["capBans"]["MapLayerGod"] = false; + reloadConfig(config); + ensure_equals("Ensure cap ban true MapLayer", + LLMessageConfig::isCapBanned("MapLayer"), true); - ensure_equals("Ensure missing builder default to server builder llsd", - LLMessageConfig::isMessageBuiltLLSD("msg1"), + ensure_equals("Ensure cap ban false", + LLMessageConfig::isCapBanned("MapLayerGod"), false); + } - ensure_equals("Ensure server default is not llsd", - LLMessageConfig::isServerDefaultBuilderLLSD(), - false); - ensure_equals("Ensure server default is template", - LLMessageConfig::isServerDefaultBuilderTemplate(), - true); + template<> template<> + void LLMessageConfigTestObject::test<7>() + // tests that config changes are picked up/refreshed periodically + { + LLSD config; + config["serverDefaults"]["simulator"] = "llsd"; + writeConfigFile(config); - writeConfigFile(config_backup); + // wait for it to reload after N seconds + ms_sleep(6*1000); + LLFrameTimer::updateFrameTime(); + ensure_equals("Ensure reload after 6 seconds", + LLMessageConfig::getServerDefaultFlavor(), + LLMessageConfig::LLSD_FLAVOR); } } diff --git a/indra/test/llmessagetemplateparser_tut.cpp b/indra/test/llmessagetemplateparser_tut.cpp new file mode 100644 index 0000000000..2f76d7fb20 --- /dev/null +++ b/indra/test/llmessagetemplateparser_tut.cpp @@ -0,0 +1,350 @@ +/** + * @file llmessagetemplateparser_tut.cpp + * @date April 2007 + * @brief LLMessageTemplateParser unit tests + * + * Copyright (c) 2006-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include <tut/tut.h> +#include "lltut.h" +#include "llmessagetemplateparser.h" + +namespace tut +{ + struct LLMessageTemplateParserTestData { + LLMessageTemplateParserTestData() : mMessage("unset message") + { + } + + ~LLMessageTemplateParserTestData() + { + } + + void ensure_next(LLTemplateTokenizer & tokens, + std::string value, + U32 line) + { + std::string next = tokens.next(); + ensure_equals(mMessage + " token matches", next, value); + ensure_equals(mMessage + " line matches", tokens.line(), line); + } + + char * prehash(const char * name) + { + return gMessageStringTable.getString(name); + } + + void ensure_block_attributes(std::string identifier, + const LLMessageTemplate * message, + const char * name, + EMsgBlockType type, + S32 number, + S32 total_size) + { + const LLMessageBlock * block = message->getBlock(prehash(name)); + identifier = identifier + ":" + message->mName + ":" + name + " block"; + ensure(identifier + " exists", block != NULL); + ensure_equals(identifier + " name", block->mName, prehash(name)); + ensure_equals(identifier + " type", block->mType, type); + ensure_equals(identifier + " number", block->mNumber, number); + ensure_equals(identifier + " total size", block->mTotalSize, total_size); + } + + void ensure_variable_attributes(std::string identifier, + const LLMessageBlock * block, + const char * name, + EMsgVariableType type, + S32 size) + { + const LLMessageVariable * var = block->getVariable(prehash(name)); + identifier = identifier + ":" + block->mName + ":" + name + " variable"; + ensure(identifier + " exists", var != NULL); + ensure_equals( + identifier + " name", var->getName(), prehash(name)); + ensure_equals( + identifier + " type", var->getType(), type); + ensure_equals(identifier + " size", var->getSize(), size); + } + + std::string mMessage; + + }; + + typedef test_group<LLMessageTemplateParserTestData> LLMessageTemplateParserTestGroup; + typedef LLMessageTemplateParserTestGroup::object LLMessageTemplateParserTestObject; + LLMessageTemplateParserTestGroup llMessageTemplateParserTestGroup("LLMessageTemplateParser"); + + template<> template<> + void LLMessageTemplateParserTestObject::test<1>() + // tests tokenizer constructor and next methods + { + mMessage = "test method 1 walkthrough"; + LLTemplateTokenizer tokens("first line\nnext\t line\n\nfourth"); + ensure_next(tokens, "first", 1); + ensure_next(tokens, "line", 1); + ensure_next(tokens, "next", 2); + ensure_next(tokens, "line", 2); + ensure_next(tokens, "fourth", 4); + + tokens = LLTemplateTokenizer("\n\t{ \t Test1 Fixed \n 523 }\n\n"); + ensure(tokens.want("{")); + ensure_next(tokens, "Test1", 2); + ensure_next(tokens, "Fixed", 2); + ensure_next(tokens, "523", 3); + ensure(tokens.want("}")); + + tokens = LLTemplateTokenizer("first line\nnext\t line\n\nfourth"); + ensure(tokens.want("first")); + ensure_next(tokens, "line", 1); + ensure_next(tokens, "next", 2); + ensure_next(tokens, "line", 2); + ensure(tokens.want("fourth")); + } + + template<> template<> + void LLMessageTemplateParserTestObject::test<2>() + // tests tokenizer want method + { + // *NOTE: order matters + LLTemplateTokenizer tokens("first line\nnext\t line\n\nfourth"); + ensure_equals("wants first token", tokens.want("first"), true); + ensure_equals("doesn't want blar token", tokens.want("blar"), false); + ensure_equals("wants line token", tokens.want("line"), true); + } + + template<> template<> + void LLMessageTemplateParserTestObject::test<3>() + // tests tokenizer eof methods + { + LLTemplateTokenizer tokens("single\n\n"); + ensure_equals("is not at eof at beginning", tokens.atEOF(), false); + ensure_equals("doesn't want eof", tokens.wantEOF(), false); + ensure_equals("wants the first token just to consume it", + tokens.want("single"), true); + ensure_equals("is not at eof in middle", tokens.atEOF(), false); + ensure_equals("wants eof", tokens.wantEOF(), true); + ensure_equals("is at eof at end", tokens.atEOF(), true); + } + + template<> template<> + void LLMessageTemplateParserTestObject::test<4>() + // tests variable parsing method + { + LLTemplateTokenizer tokens(std::string("{ Test0 \n\t\n U32 \n\n }")); + LLMessageVariable * var = LLTemplateParser::parseVariable(tokens); + + ensure("test0 var parsed", var != 0); + ensure_equals("name of variable", std::string(var->getName()), std::string("Test0")); + ensure_equals("type of variable is U32", var->getType(), MVT_U32); + ensure_equals("size of variable", var->getSize(), 4); + + delete var; + + std::string message_string("\n\t{ \t Test1 Fixed \n 523 }\n\n"); + tokens = LLTemplateTokenizer(message_string); + var = LLTemplateParser::parseVariable(tokens); + + ensure("test1 var parsed", var != 0); + ensure_equals("name of variable", std::string(var->getName()), std::string("Test1")); + ensure_equals("type of variable is Fixed", var->getType(), MVT_FIXED); + ensure_equals("size of variable", var->getSize(), 523); + + delete var; + + // *NOTE: the parsers call llerrs on invalid input, so we can't really + // test that :-( + } + + template<> template<> + void LLMessageTemplateParserTestObject::test<5>() + // tests block parsing method + { + LLTemplateTokenizer tokens("{ BlockA Single { VarX F32 } }"); + LLMessageBlock * block = LLTemplateParser::parseBlock(tokens); + + ensure("blockA block parsed", block != 0); + ensure_equals("name of block", std::string(block->mName), std::string("BlockA")); + ensure_equals("type of block is Single", block->mType, MBT_SINGLE); + ensure_equals("total size of block", block->mTotalSize, 4); + ensure_equals("number of block defaults to 1", block->mNumber, 1); + ensure_equals("variable type of VarX is F32", + block->getVariableType(prehash("VarX")), MVT_F32); + ensure_equals("variable size of VarX", + block->getVariableSize(prehash("VarX")), 4); + + delete block; + + tokens = LLTemplateTokenizer("{ Stuff Variable { Id LLUUID } }"); + block = LLTemplateParser::parseBlock(tokens); + + ensure("stuff block parsed", block != 0); + ensure_equals("name of block", std::string(block->mName), std::string("Stuff")); + ensure_equals("type of block is Multiple", block->mType, MBT_VARIABLE); + ensure_equals("total size of block", block->mTotalSize, 16); + ensure_equals("number of block defaults to 1", block->mNumber, 1); + ensure_equals("variable type of Id is LLUUID", + block->getVariableType(prehash("Id")), MVT_LLUUID); + ensure_equals("variable size of Id", + block->getVariableSize(prehash("Id")), 16); + + delete block; + + tokens = LLTemplateTokenizer("{ Stuff2 Multiple 45 { Shid LLVector3d } }"); + block = LLTemplateParser::parseBlock(tokens); + + ensure("stuff2 block parsed", block != 0); + ensure_equals("name of block", std::string(block->mName), std::string("Stuff2")); + ensure_equals("type of block is Multiple", block->mType, MBT_MULTIPLE); + ensure_equals("total size of block", block->mTotalSize, 24); + ensure_equals("number of blocks", block->mNumber, 45); + ensure_equals("variable type of Shid is Vector3d", + block->getVariableType(prehash("Shid")), MVT_LLVector3d); + ensure_equals("variable size of Shid", + block->getVariableSize(prehash("Shid")), 24); + + delete block; + } + + template<> template<> + void LLMessageTemplateParserTestObject::test<6>() + // tests message parsing method on a simple message + { + std::string message_skel( + "{\n" + "TestMessage Low 1 NotTrusted Zerocoded\n" + "// comment \n" + " {\n" + "TestBlock1 Single\n" + " { Test1 U32 }\n" + " }\n" + " {\n" + " NeighborBlock Multiple 4\n" + " { Test0 U32 }\n" + " { Test1 U32 }\n" + " { Test2 U32 }\n" + " }\n" + "}"); + LLTemplateTokenizer tokens(message_skel); + LLMessageTemplate * message = LLTemplateParser::parseMessage(tokens); + + ensure("simple message parsed", message != 0); + ensure_equals("name of message", std::string(message->mName), std::string("TestMessage")); + ensure_equals("frequency is Low", message->mFrequency, MFT_LOW); + ensure_equals("trust is untrusted", message->mTrust, MT_NOTRUST); + ensure_equals("message number", message->mMessageNumber, (U32)((255 << 24) | (255 << 16) | 1)); + ensure_equals("message encoding is zerocoded", message->mEncoding, ME_ZEROCODED); + ensure_equals("message deprecation is notdeprecated", message->mDeprecation, MD_NOTDEPRECATED); + + LLMessageBlock * block = message->getBlock(prehash("NonexistantBlock")); + ensure("Nonexistant block does not exist", block == 0); + + delete message; + } + + template<> template<> + void LLMessageTemplateParserTestObject::test<7>() + // tests message parsing method on a deprecated message + { + std::string message_skel( + "{\n" + "TestMessageDeprecated High 34 Trusted Unencoded Deprecated\n" + " {\n" + "TestBlock2 Single\n" + " { Test2 S32 }\n" + " }\n" + "}"); + LLTemplateTokenizer tokens(message_skel); + LLMessageTemplate * message = LLTemplateParser::parseMessage(tokens); + + ensure("deprecated message parsed", message != 0); + ensure_equals("name of message", std::string(message->mName), std::string("TestMessageDeprecated")); + ensure_equals("frequency is High", message->mFrequency, MFT_HIGH); + ensure_equals("trust is trusted", message->mTrust, MT_TRUST); + ensure_equals("message number", message->mMessageNumber, (U32)34); + ensure_equals("message encoding is unencoded", message->mEncoding, ME_UNENCODED); + ensure_equals("message deprecation is deprecated", message->mDeprecation, MD_DEPRECATED); + + delete message; + } + + void LLMessageTemplateParserTestObject::test<8>() + // tests message parsing on RezMultipleAttachmentsFromInv, a possibly-faulty message + { + std::string message_skel( + "{\n\ + RezMultipleAttachmentsFromInv Low 452 NotTrusted Zerocoded\n\ + {\n\ + AgentData Single\n\ + { AgentID LLUUID }\n\ + { SessionID LLUUID }\n\ + } \n\ + {\n\ + HeaderData Single\n\ + { CompoundMsgID LLUUID } // All messages a single \"compound msg\" must have the same id\n\ + { TotalObjects U8 }\n\ + { FirstDetachAll BOOL }\n\ + }\n\ + {\n\ + ObjectData Variable // 1 to 4 of these per packet\n\ + { ItemID LLUUID }\n\ + { OwnerID LLUUID }\n\ + { AttachmentPt U8 } // 0 for default\n\ + { ItemFlags U32 }\n\ + { GroupMask U32 }\n\ + { EveryoneMask U32 }\n\ + { NextOwnerMask U32 }\n\ + { Name Variable 1 }\n\ + { Description Variable 1 }\n\ + }\n\ + }\n\ + "); + LLTemplateTokenizer tokens(message_skel); + LLMessageTemplate * message = LLTemplateParser::parseMessage(tokens); + + ensure("RezMultipleAttachmentsFromInv message parsed", message != 0); + ensure_equals("name of message", message->mName, prehash("RezMultipleAttachmentsFromInv")); + ensure_equals("frequency is low", message->mFrequency, MFT_LOW); + ensure_equals("trust is not trusted", message->mTrust, MT_NOTRUST); + ensure_equals("message number", message->mMessageNumber, (U32)((255 << 24) | (255 << 16) | 452)); + ensure_equals("message encoding is zerocoded", message->mEncoding, ME_ZEROCODED); + + ensure_block_attributes( + "RMAFI", message, "AgentData", MBT_SINGLE, 1, 16+16); + LLMessageBlock * block = message->getBlock(prehash("AgentData")); + ensure_variable_attributes("RMAFI", + block, "AgentID", MVT_LLUUID, 16); + ensure_variable_attributes("RMAFI", + block, "SessionID", MVT_LLUUID, 16); + + ensure_block_attributes( + "RMAFI", message, "HeaderData", MBT_SINGLE, 1, 16+1+1); + block = message->getBlock(prehash("HeaderData")); + ensure_variable_attributes( + "RMAFI", block, "CompoundMsgID", MVT_LLUUID, 16); + ensure_variable_attributes( + "RMAFI", block, "TotalObjects", MVT_U8, 1); + ensure_variable_attributes( + "RMAFI", block, "FirstDetachAll", MVT_BOOL, 1); + + + ensure_block_attributes( + "RMAFI", message, "ObjectData", MBT_VARIABLE, 1, -1); + block = message->getBlock(prehash("ObjectData")); + ensure_variable_attributes("RMAFI", block, "ItemID", MVT_LLUUID, 16); + ensure_variable_attributes("RMAFI", block, "OwnerID", MVT_LLUUID, 16); + ensure_variable_attributes("RMAFI", block, "AttachmentPt", MVT_U8, 1); + ensure_variable_attributes("RMAFI", block, "ItemFlags", MVT_U32, 4); + ensure_variable_attributes("RMAFI", block, "GroupMask", MVT_U32, 4); + ensure_variable_attributes("RMAFI", block, "EveryoneMask", MVT_U32, 4); + ensure_variable_attributes("RMAFI", block, "NextOwnerMask", MVT_U32, 4); + ensure_variable_attributes("RMAFI", block, "Name", MVT_VARIABLE, 1); + ensure_variable_attributes("RMAFI", block, "Description", MVT_VARIABLE, 1); + + delete message; + } + + + +} diff --git a/indra/test/llpermissions_tut.cpp b/indra/test/llpermissions_tut.cpp new file mode 100644 index 0000000000..1a1e392a65 --- /dev/null +++ b/indra/test/llpermissions_tut.cpp @@ -0,0 +1,533 @@ +/** + * @file llpermissions_tut.cpp + * @author Adroit + * @date March 2007 + * @brief llpermissions test cases. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include <tut/tut.h> +#include "lltut.h" +#include "message.h" +#include "llpermissions.h" + + +namespace tut +{ + struct permission + { + }; + typedef test_group<permission> permission_t; + typedef permission_t::object permission_object_t; + tut::permission_t tut_permission("permission"); + + template<> template<> + void permission_object_t::test<1>() + { + LLPermissions permissions; + LLUUID uuid = permissions.getCreator(); + LLUUID uuid1 = permissions.getOwner(); + LLUUID uuid2 = permissions.getGroup(); + LLUUID uuid3 = permissions.getLastOwner(); + + ensure("LLPermission Get Functions failed", (uuid == LLUUID::null && uuid1 == LLUUID::null && + uuid2 == LLUUID::null && uuid3 == LLUUID::null)); + ensure("LLPermission Get Functions failed", (permissions.getMaskBase() == PERM_ALL && permissions.getMaskOwner() == PERM_ALL && + permissions.getMaskGroup() == PERM_ALL && permissions.getMaskEveryone() == PERM_ALL && permissions.getMaskNextOwner() == PERM_ALL)); + ensure("Ownership functions failed", (permissions.isGroupOwned() == FALSE && permissions.isOwned() == FALSE)); + } + + template<> template<> + void permission_object_t::test<2>() + { + LLPermissions permissions; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + permissions.init(creator, owner, lastOwner, group); + + ensure_equals("init/getCreator():failed to return the creator ", creator, permissions.getCreator()); + ensure_equals("init/getOwner():failed to return the owner ", owner, permissions.getOwner()); + ensure_equals("init/getLastOwner():failed to return the group ", lastOwner, permissions.getLastOwner()); + ensure_equals("init/getGroup():failed to return the group ", group, permissions.getGroup()); + } + + template<> template<> + void permission_object_t::test<3>() + { + LLPermissions permissions; + U32 base = PERM_ALL; + U32 owner = PERM_ITEM_UNRESTRICTED; //PERM_ITEM_UNRESTRICTED = PERM_MODIFY | PERM_COPY | PERM_TRANSFER; + U32 group = PERM_TRANSFER | PERM_MOVE | PERM_COPY|PERM_MODIFY; + U32 everyone = PERM_TRANSFER | PERM_MOVE | PERM_MODIFY; + U32 next = PERM_NONE; + + U32 fixedbase = base; + U32 fixedowner = PERM_ITEM_UNRESTRICTED; //owner & fixedbase + U32 fixedgroup = PERM_ITEM_UNRESTRICTED; // no PERM_MOVE as owner does not have that perm either + U32 fixedeveryone = PERM_TRANSFER; // no PERM_MOVE. Everyone can never modify. + U32 fixednext = PERM_NONE; + + permissions.initMasks(base, owner, everyone, group, next); // will fix perms if not allowed. + ensure_equals("initMasks/getMaskBase():failed to return the MaskBase ", fixedbase, permissions.getMaskBase()); + ensure_equals("initMasks/getMaskOwner():failed to return the MaskOwner ", fixedowner, permissions.getMaskOwner()); + ensure_equals("initMasks/getMaskEveryone():failed to return the MaskGroup ", fixedgroup, permissions.getMaskGroup()); + ensure_equals("initMasks/getMaskEveryone():failed to return the MaskEveryone ", fixedeveryone, permissions.getMaskEveryone()); + ensure_equals("initMasks/getMaskNextOwner():failed to return the MaskNext ", fixednext, permissions.getMaskNextOwner()); + + // explictly set should maintain the values + permissions.setMaskBase(base); //no fixing + ensure_equals("setMaskBase/getMaskBase():failed to return the MaskBase ", base, permissions.getMaskBase()); + + permissions.setMaskOwner(owner); + ensure_equals("setMaskOwner/getMaskOwner():failed to return the MaskOwner ", owner, permissions.getMaskOwner()); + + permissions.setMaskEveryone(everyone); + ensure_equals("setMaskEveryone/getMaskEveryone():failed to return the MaskEveryone ", everyone, permissions.getMaskEveryone()); + + permissions.setMaskGroup(group); + ensure_equals("setMaskGroup/getMaskEveryone():failed to return the MaskGroup ", group, permissions.getMaskGroup()); + + permissions.setMaskNext(next); + ensure_equals("setMaskNext/getMaskNextOwner():failed to return the MaskNext ", next, permissions.getMaskNextOwner()); + + // further tests can be added to ensure perms for owner/group/everyone etc. get properly fixed. + // code however suggests that there is no explict check if the perms are correct and the user of this + // class is expected to know how to use them correctly. skipping further test cases for now for various + // perm combinations. + } + + template<> template<> + void permission_object_t::test<4>() + { + LLPermissions perm,perm1; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm1.init(creator,owner,lastOwner,group); + perm.set(perm1); + ensure("set():failed to set ", (creator == perm.getCreator()) && (owner == perm.getOwner())&& + (lastOwner == perm.getLastOwner())&& (group == perm.getGroup())); + } + + template<> template<> + void permission_object_t::test<5>() + { + LLPermissions perm,perm1; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm1.init(creator,owner,lastOwner,group); + + U32 base = PERM_TRANSFER; + U32 ownerp = PERM_TRANSFER; + U32 groupp = PERM_TRANSFER; + U32 everyone = PERM_TRANSFER; + U32 next = PERM_NONE; + + perm1.initMasks(base, ownerp, everyone, groupp, next); + + base = PERM_ALL; + ownerp = PERM_ITEM_UNRESTRICTED; //PERM_ITEM_UNRESTRICTED = PERM_MODIFY | PERM_COPY | PERM_TRANSFER; + groupp = PERM_TRANSFER | PERM_COPY|PERM_MODIFY; + everyone = PERM_TRANSFER; + next = PERM_NONE; + + perm.init(creator,owner,lastOwner,group); + perm.initMasks(base, ownerp, everyone, groupp, next); + + // restrict permissions by accumulation + perm.accumulate(perm1); + + U32 fixedbase = PERM_TRANSFER | PERM_MOVE; + U32 fixedowner = PERM_TRANSFER; + U32 fixedgroup = PERM_TRANSFER; + U32 fixedeveryone = PERM_TRANSFER; + U32 fixednext = PERM_NONE; + + ensure_equals("accumulate failed ", fixedbase, perm.getMaskBase()); + ensure_equals("accumulate failed ", fixedowner, perm.getMaskOwner()); + ensure_equals("accumulate failed ", fixedgroup, perm.getMaskGroup()); + ensure_equals("accumulate failed ", fixedeveryone, perm.getMaskEveryone()); + ensure_equals("accumulate failed ", fixednext, perm.getMaskNextOwner()); + } + + template<> template<> + void permission_object_t::test<6>() + { + LLPermissions perm; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm.init(creator,owner,lastOwner,group); + ensure_equals("getSafeOwner:failed ", owner,perm.getSafeOwner()); + + ///NULL Owner + perm.init(creator,LLUUID::null,lastOwner,group); + ensure_equals("getSafeOwner:failed ", group, perm.getSafeOwner()); + } + + template<> template<> + void permission_object_t::test<7>() + { + LLPermissions perm1; + LLUUID uuid; + BOOL is_group_owned = FALSE; + ensure("1:getOwnership:failed ", (FALSE == perm1.getOwnership(uuid,is_group_owned))); + + LLPermissions perm; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm.init(creator,owner,lastOwner,group); + perm.getOwnership(uuid,is_group_owned); + ensure("2:getOwnership:failed ", ((uuid == owner) && (FALSE == is_group_owned))); + + perm.init(creator,LLUUID::null,lastOwner,group); + perm.getOwnership(uuid,is_group_owned); + ensure("3:getOwnership:failed ", ((uuid == group) && (TRUE == is_group_owned))); + } + + template<> template<> + void permission_object_t::test<8>() + { + LLPermissions perm,perm1; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm.init(creator,owner,lastOwner,group); + perm1.init(creator,owner,lastOwner,group); + ensure_equals("getCRC32:failed ", perm.getCRC32(),perm1.getCRC32()); + } + + template<> template<> + void permission_object_t::test<9>() + { + LLPermissions perm; + LLUUID agent("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + bool is_atomic = TRUE; + ensure("setOwnerAndGroup():failed ", (TRUE == perm.setOwnerAndGroup(agent,owner,group,is_atomic))); + + LLUUID owner2("68edcf47-ccd7-45b8-9f90-1649d7f12807"); + LLUUID group2("9c8eca51-53d5-42a7-bb58-cef070395db9"); + + // cant change - agent need to be current owner + ensure("setOwnerAndGroup():failed ", (FALSE == perm.setOwnerAndGroup(agent,owner2,group2,is_atomic))); + + // should be able to change - agent and owner same as current owner + ensure("setOwnerAndGroup():failed ", (TRUE == perm.setOwnerAndGroup(owner,owner,group2,is_atomic))); + } + + template<> template<> + void permission_object_t::test<10>() + { + LLPermissions perm; + LLUUID agent; + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + ensure("deedToGroup():failed ", (TRUE == perm.deedToGroup(agent,group))); + } + template<> template<> + void permission_object_t::test<11>() + { + LLPermissions perm; + LLUUID agent; + BOOL set = 1; + U32 bits = PERM_TRANSFER | PERM_MODIFY; + ensure("setBaseBits():failed ", (TRUE == perm.setBaseBits(agent, set, bits))); + ensure("setOwnerBits():failed ", (TRUE == perm.setOwnerBits(agent, set, bits))); + + LLUUID agent1("9c8eca51-53d5-42a7-bb58-cef070395db8"); + ensure("setBaseBits():failed ", (FALSE == perm.setBaseBits(agent1, set, bits))); + ensure("setOwnerBits():failed ", (FALSE == perm.setOwnerBits(agent1, set, bits))); + } + + template<> template<> + void permission_object_t::test<12>() + { + LLPermissions perm; + LLUUID agent; + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + BOOL set = 1; + U32 bits = 10; + ensure("setGroupBits():failed ", (TRUE == perm.setGroupBits(agent,group, set, bits))); + ensure("setEveryoneBits():failed ", (TRUE == perm.setEveryoneBits(agent,group, set, bits))); + ensure("setNextOwnerBits():failed ", (TRUE == perm.setNextOwnerBits(agent,group, set, bits))); + + LLUUID agent1("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + ensure("setGroupBits():failed ", (FALSE == perm.setGroupBits(agent1,group, set, bits))); + ensure("setEveryoneBits():failed ", (FALSE == perm.setEveryoneBits(agent1,group, set, bits))); + ensure("setNextOwnerBits():failed ", (FALSE == perm.setNextOwnerBits(agent1,group, set, bits))); + } + + template<> template<> + void permission_object_t::test<13>() + { + LLPermissions perm; + LLUUID agent; + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + U32 bits = 10; + ensure("allowOperationBy():failed ", (TRUE == perm.allowOperationBy(bits,agent,group))); + + LLUUID agent1("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + perm.init(creator,owner,lastOwner,group); + ensure("allowOperationBy():failed ", (TRUE == perm.allowOperationBy(bits,agent1,group))); + } + + template<> template<> + void permission_object_t::test<14>() + { + LLPermissions perm; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner; + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm.init(creator,owner,lastOwner,group); + LLUUID agent; + ensure("1:allowModifyBy():failed ", (TRUE == perm.allowModifyBy(agent))); + ensure("2:allowModifyBy():failed ", (TRUE == perm.allowModifyBy(agent,group))); + + U32 val1 = 0x7FFFFFFF; + S32 sVal = 1 << 14; + sVal = val1 & sVal; + LLUUID agent1("9c8eca51-53d5-42a7-bb58-cef070395db8"); + ensure("3:allowModifyBy():failed ", (sVal == perm.allowModifyBy(agent1))); + ensure("4:allowModifyBy():failed ", (sVal == perm.allowModifyBy(agent1,group))); + } + + template<> template<> + void permission_object_t::test<15>() + { + LLPermissions perm; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner; + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm.init(creator,owner,lastOwner,group); + LLUUID agent; + ensure("1:allowCopyBy():failed ", (TRUE == perm.allowModifyBy(agent))); + ensure("2:allowCopyBy():failed ", (TRUE == perm.allowModifyBy(agent,group))); + + U32 val1 = 0x7FFFFFFF; + S32 sVal = 1 << 15; + sVal = val1 & sVal; + LLUUID agent1("9c8eca51-53d5-42a7-bb58-cef070395db8"); + ensure("3:allowCopyBy():failed ", (sVal == perm.allowCopyBy(agent1))); + ensure("4:allowCopyBy():failed ", (sVal == perm.allowCopyBy(agent1,group))); + } + + template<> template<> + void permission_object_t::test<16>() + { + LLPermissions perm; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner; + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm.init(creator,owner,lastOwner,group); + LLUUID agent; + ensure("1:allowMoveBy():failed ", (TRUE == perm.allowMoveBy(agent))); + ensure("2:allowMoveBy():failed ", (TRUE == perm.allowMoveBy(agent,group))); + + U32 val1 = 0x7FFFFFFF; + S32 sVal = 1 << 19; + sVal = val1 & sVal; + LLUUID agent1("9c8eca51-53d5-42a7-bb58-cef070395db8"); + ensure("3:allowMoveBy():failed ", (sVal == perm.allowMoveBy(agent1))); + ensure("4:allowMoveBy():failed ", (sVal == perm.allowMoveBy(agent1,group))); + } + + template<> template<> + void permission_object_t::test<17>() + { + LLPermissions perm; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner; + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + LLUUID agent; + ensure("1:allowMoveBy():failed ", (TRUE == perm.allowTransferTo(agent))); + + perm.init(creator,owner,lastOwner,group); + U32 val1 = 0x7FFFFFFF; + S32 sVal = 1 << 13; + sVal = val1 & sVal; + ensure("2:allowMoveBy():failed ", (sVal == perm.allowTransferTo(agent))); + } + + template<> template<> + void permission_object_t::test<18>() + { + LLPermissions perm,perm1; + ensure("1:Operator==:failed ", perm == perm1); + + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm.init(creator,owner,lastOwner,group); + perm = perm1; + ensure("2:Operator==:failed ", perm == perm1); + } + + template<> template<> + void permission_object_t::test<19>() + { + LLPermissions perm,perm1; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm.init(creator,owner,lastOwner,group); + ensure("2:Operator==:failed ", perm != perm1); + } + + template<> template<> + void permission_object_t::test<20>() + { + FILE* fp = fopen("linden_file.dat","w+"); + if(!fp) + { + llerrs << "file coudnt be opened\n" << llendl; + return; + } + LLPermissions perm,perm1; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm.init(creator,owner,lastOwner,group); + + U32 base = PERM_TRANSFER | PERM_COPY; + U32 ownerp = PERM_TRANSFER; + U32 groupp = PERM_TRANSFER; + U32 everyone = PERM_TRANSFER; + U32 next = PERM_NONE; + + perm.initMasks(base, ownerp, everyone, groupp, next); + + perm.exportFile(fp); + fclose(fp); + fp = fopen("linden_file.dat","r+"); + if(!fp) + { + llerrs << "file coudnt be opened\n" << llendl; + return; + } + perm1.importFile(fp); + fclose(fp); + ensure("exportFile()/importFile():failed to export and import the data ", perm1 == perm); +} + + template<> template<> + void permission_object_t::test<21>() + { + LLPermissions perm,perm1; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm.init(creator,owner,lastOwner,group); + + U32 base = PERM_TRANSFER | PERM_COPY; + U32 ownerp = PERM_TRANSFER; + U32 groupp = PERM_TRANSFER; + U32 everyone = PERM_TRANSFER; + U32 next = PERM_NONE; + + perm.initMasks(base, ownerp, everyone, groupp, next); + + std::ostringstream ostream; + perm.exportLegacyStream(ostream); + std::istringstream istream(ostream.str()); + perm1.importLegacyStream(istream); + + ensure("exportLegacyStream()/importLegacyStream():failed to export and import the data ", perm1 == perm); + } + + template<> template<> + void permission_object_t::test<22>() + { + LLPermissions perm,perm1; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm.init(creator,owner,lastOwner,group); + LLXMLNode* xml_node = perm.exportFileXML(); + perm1.importXML(xml_node); + ensure("exportFileXML()/importXML():failed to export and import the data ", perm1 == perm); + } + + template<> template<> + void permission_object_t::test<23>() + { + LLPermissions perm,perm1; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm.init(creator,owner,lastOwner,group); + std::ostringstream stream1, stream2; + stream1 << perm; + perm1.init(creator,owner,lastOwner,group); + stream2 << perm1; + ensure("1:operator << failed",(stream1.str() == stream2.str())); + } + + template<> template<> + void permission_object_t::test<24>() + { + LLPermissions perm,perm1; + LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); + LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); + LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); + LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); + perm.init(creator,owner,lastOwner,group); + + U32 base = PERM_TRANSFER | PERM_COPY; + U32 ownerp = PERM_TRANSFER; + U32 groupp = PERM_TRANSFER; + U32 everyone = PERM_TRANSFER; + U32 next = PERM_NONE; + + perm.initMasks(base, ownerp, everyone, groupp, next); + + LLSD sd = ll_create_sd_from_permissions(perm); + perm1 = ll_permissions_from_sd(sd); + ensure_equals("ll_permissions_from_sd() and ll_create_sd_from_permissions()functions failed", perm, perm1); + } + + template<> template<> + void permission_object_t::test<25>() + { + LLAggregatePermissions AggrPermission; + LLAggregatePermissions AggrPermission1; + ensure("getU8() function failed", (AggrPermission.getU8() == 0)); + ensure("isEmpty() function failed", (AggrPermission.isEmpty() == TRUE)); + AggrPermission.getValue(PERM_TRANSFER); + ensure_equals("getValue() function failed", AggrPermission.getValue(PERM_TRANSFER), 0x00); + + AggrPermission.aggregate(PERM_ITEM_UNRESTRICTED); + ensure("aggregate() function failed", (AggrPermission.isEmpty() == FALSE)); + + AggrPermission1.aggregate(AggrPermission); + ensure("aggregate() function failed", (AggrPermission1.isEmpty() == FALSE)); + + std::ostringstream stream1; + stream1 << AggrPermission; + ensure("operator<< failed", (stream1.str() == "{PI_COPY=All, PI_MODIFY=All, PI_TRANSFER=All}")); + } +} diff --git a/indra/test/llsaleinfo_tut.cpp b/indra/test/llsaleinfo_tut.cpp new file mode 100644 index 0000000000..ef6e1cc94b --- /dev/null +++ b/indra/test/llsaleinfo_tut.cpp @@ -0,0 +1,228 @@ +/** + * @file LLSaleInfo_tut.cpp + * @author Adroit + * @date 2007-03 + * @brief Test cases of llsaleinfo.h + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include <tut/tut.h> +#include "lltut.h" +#include "linden_common.h" +#include "llsaleinfo.h" + +namespace tut +{ + struct llsaleinfo_tut + { + }; + typedef test_group<llsaleinfo_tut> llsaleinfo_tut_t; + typedef llsaleinfo_tut_t::object llsaleinfo_test_t; + tut::llsaleinfo_tut_t tut_llsaleinfo_test("llsaleinfo"); + + template<> template<> + void llsaleinfo_test_t::test<1>() + { + //test case for getSaleType(), getSalePrice(), getCRC32() fn. + //test case for setSaleType(), setSalePrice() fn. + + S32 sale_price = 10000; + LLSaleInfo llsaleinfo(LLSaleInfo::FS_COPY, sale_price); + char* sale= "copy"; + + LLSD llsd_obj1 = ll_create_sd_from_sale_info(llsaleinfo); + LLSaleInfo saleinfo1 = ll_sale_info_from_sd(llsd_obj1); + + ensure("1. The getSaleType() fn failed", LLSaleInfo::FS_COPY == llsaleinfo.getSaleType()); + ensure("2. LLSaleInfo::isForSale() fn failed", TRUE == llsaleinfo.isForSale()); + ensure("3. The getSalePrice() fn failed", sale_price == llsaleinfo.getSalePrice()); + ensure("4. The getCRC32() fn failed", 235833404 == llsaleinfo.getCRC32()); + ensure("5. LLSaleInfo::lookup(const char* name) fn failed", LLSaleInfo::FS_COPY == llsaleinfo.lookup(sale)); + ensure_equals("6. ll_create_sd_from_sale_info() fn failed", llsaleinfo.getSalePrice(), saleinfo1.getSalePrice()); + ensure_equals("7. ll_create_sd_from_sale_info() fn failed", llsaleinfo.getSaleType(), saleinfo1.getSaleType()); + + llsaleinfo.setSalePrice(10000000); + llsaleinfo.setSaleType(LLSaleInfo::FS_ORIGINAL); + sale = "cntn"; + llsd_obj1 = ll_create_sd_from_sale_info(llsaleinfo); + saleinfo1 = ll_sale_info_from_sd(llsd_obj1); + + ensure("8. The getSaleType() and setSaleType() fn failed", LLSaleInfo::FS_ORIGINAL == llsaleinfo.getSaleType()); + ensure("9. LLSaleInfo::isForSale() fn failed", TRUE == llsaleinfo.isForSale()); + ensure("10. The getSalePrice() fn failed", 10000000 == llsaleinfo.getSalePrice()); + ensure("11. The getCRC32() fn failed", 127911702 == llsaleinfo.getCRC32()); + ensure("12. LLSaleInfo::lookup(const char* name) fn failed", LLSaleInfo::FS_CONTENTS == llsaleinfo.lookup(sale)); + ensure_equals("13. ll_create_sd_from_sale_info() fn failed", llsaleinfo.getSalePrice(), saleinfo1.getSalePrice()); + ensure_equals("14. ll_create_sd_from_sale_info() fn failed", llsaleinfo.getSaleType(), saleinfo1.getSaleType()); + + llsaleinfo.setSalePrice(55000550); + llsaleinfo.setSaleType(LLSaleInfo::FS_CONTENTS); + sale = "orig"; + llsd_obj1 = ll_create_sd_from_sale_info(llsaleinfo); + saleinfo1 = ll_sale_info_from_sd(llsd_obj1); + + ensure("15. The getSaleType() and setSaleType() fn failed", LLSaleInfo::FS_CONTENTS == llsaleinfo.getSaleType()); + ensure("16. LLSaleInfo::isForSale() fn failed", TRUE == llsaleinfo.isForSale()); + ensure("17. The getSalePrice() fn failed", 55000550 == llsaleinfo.getSalePrice()); + ensure("18. The getCRC32() fn failed", 408735656 == llsaleinfo.getCRC32()); + ensure("19. LLSaleInfo::lookup(const char* name) fn failed", LLSaleInfo::FS_ORIGINAL == llsaleinfo.lookup(sale)); + ensure_equals("20. ll_create_sd_from_sale_info() fn failed", llsaleinfo.getSalePrice(), saleinfo1.getSalePrice()); + ensure_equals("21. ll_create_sd_from_sale_info() fn failed", llsaleinfo.getSaleType(), saleinfo1.getSaleType()); + + llsaleinfo.setSalePrice(-6432); + llsaleinfo.setSaleType(LLSaleInfo::FS_NOT); + sale = "not"; + llsd_obj1 = ll_create_sd_from_sale_info(llsaleinfo); + saleinfo1 = ll_sale_info_from_sd(llsd_obj1); + + ensure("22. The getSaleType() and setSaleType() fn failed", LLSaleInfo::FS_NOT == llsaleinfo.getSaleType()); + ensure("23. LLSaleInfo::isForSale() fn failed", FALSE == llsaleinfo.isForSale()); + ensure("24. The getSalePrice() fn failed", 0 == llsaleinfo.getSalePrice()); + ensure("25. The getCRC32() fn failed", 0 == llsaleinfo.getCRC32()); + ensure("26. LLSaleInfo::lookup(const char* name) fn failed", LLSaleInfo::FS_NOT == llsaleinfo.lookup(sale)); + ensure_equals("27. ll_create_sd_from_sale_info() fn failed", llsaleinfo.getSalePrice(), saleinfo1.getSalePrice()); + ensure_equals("28. ll_create_sd_from_sale_info() fn failed", llsaleinfo.getSaleType(), saleinfo1.getSaleType()); + } + + template<> template<> + void llsaleinfo_test_t::test<2>() + { + + FILE* fp = fopen("linden_file.dat","w+"); + if(!fp) + { + llerrs << "file could not be opened\n" << llendl; + return; + } + + S32 sale_price = 43500; + LLSaleInfo llsaleinfo(LLSaleInfo::FS_COPY, sale_price); + + llsaleinfo.exportFile(fp); + fclose(fp); + + LLSaleInfo llsaleinfo1; + U32 perm_mask; + BOOL has_perm_mask; + fp = fopen("linden_file.dat","r"); + + if(!fp) + { + llerrs << "file coudnt be opened\n" << llendl; + return; + } + + llsaleinfo1.importFile(fp, has_perm_mask, perm_mask); + fclose(fp); + + ensure("importFile() fn failed ", llsaleinfo.getSaleType() == llsaleinfo1.getSaleType() && + llsaleinfo.getSalePrice() == llsaleinfo1.getSalePrice()); + } + + template<> template<> + void llsaleinfo_test_t::test<3>() + { + S32 sale_price = 525452; + LLSaleInfo llsaleinfo(LLSaleInfo::FS_ORIGINAL, sale_price); + + std::ostringstream ostream; + llsaleinfo.exportLegacyStream(ostream); + + std::istringstream istream(ostream.str()); + LLSaleInfo llsaleinfo1; + U32 perm_mask = 0; + BOOL has_perm_mask = FALSE; + llsaleinfo1.importLegacyStream(istream, has_perm_mask, perm_mask); + + ensure("importLegacyStream() fn failed ", llsaleinfo.getSalePrice() == llsaleinfo1.getSalePrice() && + llsaleinfo.getSaleType() == llsaleinfo1.getSaleType()); + } + + template<> template<> + void llsaleinfo_test_t::test<4>() + { +// LLXMLNode is teh suck. +#if 0 + S32 sale_price = 23445; + LLSaleInfo saleinfo(LLSaleInfo::FS_CONTENTS, sale_price); + + LLXMLNode* x_node = saleinfo.exportFileXML(); + + LLSaleInfo saleinfo1(LLSaleInfo::FS_NOT, 0); + + saleinfo1.importXML(x_node); + ensure_equals("1.importXML() fn failed", saleinfo.getSalePrice(), saleinfo1.getSalePrice()); + ensure_equals("2.importXML() fn failed", saleinfo.getSaleType(), saleinfo1.getSaleType()); +#endif + } + + template<> template<> + void llsaleinfo_test_t::test<5>() + { + S32 sale_price = 99000; + LLSaleInfo saleinfo(LLSaleInfo::FS_ORIGINAL, sale_price); + + LLSD sd_result = saleinfo.asLLSD(); + + U32 perm_mask = 0 ; + BOOL has_perm_mask = FALSE; + + LLSaleInfo saleinfo1; + saleinfo1.fromLLSD( sd_result, has_perm_mask, perm_mask); + + ensure_equals("asLLSD and fromLLSD failed", saleinfo.getSalePrice(), saleinfo1.getSalePrice()); + ensure_equals("asLLSD and fromLLSD failed", saleinfo.getSaleType(), saleinfo1.getSaleType()); + } + + //static EForSale lookup(const char* name) fn test + template<> template<> + void llsaleinfo_test_t::test<6>() + { + S32 sale_price = 233223; + LLSaleInfo::EForSale ret_type = LLSaleInfo::lookup("orig"); + + ensure_equals("lookup(const char* name) fn failed", ret_type, LLSaleInfo::FS_ORIGINAL); + + LLSaleInfo saleinfo(LLSaleInfo::FS_COPY, sale_price); + const char* result = LLSaleInfo::lookup(LLSaleInfo::FS_COPY); + ensure("char* lookup(EForSale type) fn failed", 0 == strcmp("copy", result)); + } + + //void LLSaleInfo::accumulate(const LLSaleInfo& sale_info) fn test + template<> template<> + void llsaleinfo_test_t::test<7>() + { + S32 sale_price = 20; + LLSaleInfo saleinfo(LLSaleInfo::FS_COPY, sale_price); + LLSaleInfo saleinfo1(LLSaleInfo::FS_COPY, sale_price); + saleinfo1.accumulate(saleinfo); + ensure_equals("LLSaleInfo::accumulate(const LLSaleInfo& sale_info) fn failed", saleinfo1.getSalePrice(), 40); + + } + + // test cases of bool operator==(const LLSaleInfo &rhs) fn + // test case of bool operator!=(const LLSaleInfo &rhs) fn + template<> template<> + void llsaleinfo_test_t::test<8>() + { + S32 sale_price = 55000; + LLSaleInfo saleinfo(LLSaleInfo::FS_ORIGINAL, sale_price); + LLSaleInfo saleinfoequal(LLSaleInfo::FS_ORIGINAL, sale_price); + LLSaleInfo saleinfonotequal(LLSaleInfo::FS_ORIGINAL, sale_price*2); + + ensure("operator == fn. failed", true == (saleinfo == saleinfoequal)); + ensure("operator != fn. failed", true == (saleinfo != saleinfonotequal)); + } + + template<> template<> + void llsaleinfo_test_t::test<9>() + { + + //TBD: void LLSaleInfo::packMessage(LLMessageSystem* msg) const + //TBD: void LLSaleInfo::unpackMessage(LLMessageSystem* msg, const char* block) + //TBD: void LLSaleInfo::unpackMultiMessage(LLMessageSystem* msg, const char* block, S32 block_num) + } + +} diff --git a/indra/test/llsdmessagebuilder_tut.cpp b/indra/test/llsdmessagebuilder_tut.cpp index b153292abc..900de1f2dd 100755 --- a/indra/test/llsdmessagebuilder_tut.cpp +++ b/indra/test/llsdmessagebuilder_tut.cpp @@ -114,7 +114,7 @@ namespace tut void LLSDMessageBuilderTestObject::test<7>() // F32 { - F32 outValue, inValue = 121.44; + F32 outValue, inValue = 121.44f; LLSDMessageBuilder builder = defaultBuilder(); builder.addF32("var", inValue); LLSDMessageReader reader = setReader(builder); diff --git a/indra/test/llsdmessagereader_tut.cpp b/indra/test/llsdmessagereader_tut.cpp index 31810ae00e..60a4ea0f29 100755 --- a/indra/test/llsdmessagereader_tut.cpp +++ b/indra/test/llsdmessagereader_tut.cpp @@ -10,6 +10,7 @@ #include <tut/tut.h> #include "lltut.h" +#include "message.h" #include "llsdmessagereader.h" #include "llsdutil.h" @@ -21,7 +22,7 @@ namespace tut const std::string& expected_name) { LLSDMessageReader msg; - msg.setMessage(msg_name, msg_data); + msg.setMessage(gMessageStringTable.getString(msg_name.c_str()), msg_data); ensure_equals("Ensure name", std::string(msg.getMessageName()), expected_name); } @@ -169,7 +170,7 @@ namespace tut void LLSDMessageReaderTestObject::test<9>() // F32 { - F32 outValue, inValue = 121.44; + F32 outValue, inValue = 121.44f; LLSDMessageReader msg = testType(inValue); msg.getF32("block", "var", outValue); ensure_equals("Ensure F32", outValue, inValue); @@ -297,4 +298,3 @@ namespace tut ensure_equals("Ensure Binary", outValue, inValue); } } - diff --git a/indra/test/llsdtraits.h b/indra/test/llsdtraits.h index 2e6a96a425..955a5b2036 100644 --- a/indra/test/llsdtraits.h +++ b/indra/test/llsdtraits.h @@ -1,3 +1,11 @@ +/** + * @file llsdtraits.h + * @brief Unit test helpers + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + #ifndef LLSDTRAITS_H #define LLSDTRAITS_H diff --git a/indra/test/llsdutil_tut.cpp b/indra/test/llsdutil_tut.cpp new file mode 100644 index 0000000000..db476840bf --- /dev/null +++ b/indra/test/llsdutil_tut.cpp @@ -0,0 +1,132 @@ +/** + * @file llsdutil_tut.cpp + * @author Adroit + * @date 2007-02 + * @brief LLSD conversion routines test cases. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include "linden_common.h" +#include "lltut.h" +#include "v3color.h" +#include "v4math.h" +#include "m4math.h" +#include "llsdutil.h" + + +namespace tut +{ + struct llsdutil_data + { + }; + typedef test_group<llsdutil_data> llsdutil_test;; + typedef llsdutil_test::object llsdutil_object; + tut::llsdutil_test tutil("llsdutil"); + + template<> template<> + void llsdutil_object::test<1>() + { + LLSD sd; + U64 valueIn , valueOut; + valueIn = U64L(0xFEDCBA9876543210); + sd = ll_sd_from_U64(valueIn); + valueOut = ll_U64_from_sd(sd); + ensure_equals("U64 valueIn->sd->valueOut", valueIn, valueOut); + } + + template<> template<> + void llsdutil_object::test<2>() + { + LLSD sd; + U32 valueIn, valueOut; + valueIn = 0x87654321; + sd = ll_sd_from_U32(valueIn); + valueOut = ll_U32_from_sd(sd); + ensure_equals("U32 valueIn->sd->valueOut", valueIn, valueOut); + } + + template<> template<> + void llsdutil_object::test<3>() + { + U32 valueIn, valueOut; + valueIn = 0x87654321; + LLSD sd; + sd = ll_sd_from_ipaddr(valueIn); + valueOut = ll_ipaddr_from_sd(sd); + ensure_equals("valueIn->sd->valueOut", valueIn, valueOut); + } + + template<> template<> + void llsdutil_object::test<4>() + { + LLSD sd; + LLVector3 vec1(-1.0, 2.0, -3.0); + sd = ll_sd_from_vector3(vec1); + LLVector3 vec2 = ll_vector3_from_sd(sd); + ensure_equals("vector3 -> sd -> vector3: 1", vec1, vec2); + + LLVector3 vec3(sd); + ensure_equals("vector3 -> sd -> vector3: 2", vec1, vec3); + + sd.clear(); + vec1.setVec(0., 0., 0.); + sd = ll_sd_from_vector3(vec1); + vec2 = ll_vector3_from_sd(sd); + ensure_equals("vector3 -> sd -> vector3: 3", vec1, vec2); + sd.clear(); + } + + template<> template<> + void llsdutil_object::test<5>() + { + LLSD sd; + LLVector3d vec1((F64)(U64L(0xFEDCBA9876543210) << 2), -1., 0); + sd = ll_sd_from_vector3d(vec1); + LLVector3d vec2 = ll_vector3d_from_sd(sd); + ensure_equals("vector3d -> sd -> vector3d: 1", vec1, vec2); + + LLVector3d vec3(sd); + ensure_equals("vector3d -> sd -> vector3d : 2", vec1, vec3); + } + + template<> template<> + void llsdutil_object::test<6>() + { + LLSD sd; + LLVector2 vec((F32) -3., (F32) 4.2); + sd = ll_sd_from_vector2(vec); + LLVector2 vec1 = ll_vector2_from_sd(sd); + ensure_equals("vector2 -> sd -> vector2", vec, vec1); + + LLSD sd2 = ll_sd_from_vector2(vec1); + ensure_equals("sd -> vector2 -> sd: 2", sd, sd2); + } + + template<> template<> + void llsdutil_object::test<7>() + { + LLSD sd; + LLQuaternion quat((F32) 1., (F32) -0.98, (F32) 2.3, (F32) 0xffff); + sd = ll_sd_from_quaternion(quat); + LLQuaternion quat1 = ll_quaternion_from_sd(sd); + ensure_equals("LLQuaternion -> sd -> LLQuaternion", quat, quat1); + + LLSD sd2 = ll_sd_from_quaternion(quat1); + ensure_equals("sd -> LLQuaternion -> sd ", sd, sd2); + } + + template<> template<> + void llsdutil_object::test<8>() + { + LLSD sd; + LLColor4 c(1.0f, 2.2f, 4.0f, 7.f); + sd = ll_sd_from_color4(c); + LLColor4 c1 =ll_color4_from_sd(sd); + ensure_equals("LLColor4 -> sd -> LLColor4", c, c1); + + LLSD sd1 = ll_sd_from_color4(c1); + ensure_equals("sd -> LLColor4 -> sd", sd, sd1); + } +} diff --git a/indra/test/llstreamtools_tut.cpp b/indra/test/llstreamtools_tut.cpp new file mode 100644 index 0000000000..17e5c7cc2c --- /dev/null +++ b/indra/test/llstreamtools_tut.cpp @@ -0,0 +1,908 @@ +/** + * @file llstreamtools_tut.cpp + * @author Adroit + * @date February 2007 + * @brief llstreamtools test cases. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include <tut/tut.h> +#include <fstream> +#include "llstreamtools.h" +#include "lltut.h" + + +namespace tut +{ + struct streamtools_data + { + }; + typedef test_group<streamtools_data> streamtools_test; + typedef streamtools_test::object streamtools_object; + tut::streamtools_test streamtools_testcase("streamtools"); + + //test cases for skip_whitespace() + template<> template<> + void streamtools_object::test<1>() + { + char arr[255]; + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + + is.str(str = ""); + ensure("skip_whitespace: empty string", (false == skip_whitespace(is))); + + is.clear(); + is.str(str = " SecondLife is a 3D World"); + skip_whitespace(is); + is.get(arr, 255, '\0'); + expected_result = "SecondLife is a 3D World"; + ensure_equals("skip_whitespace: space", arr, expected_result); + + is.clear(); + is.str(str = "\t \tSecondLife is a 3D World"); + skip_whitespace(is); + is.get(arr, 255, '\0'); + expected_result = "SecondLife is a 3D World"; + ensure_equals("skip_whitespace: space and tabs", arr, expected_result); + + is.clear(); + is.str(str = "\t \tSecondLife is a 3D World "); + skip_whitespace(is); + is.get(arr, 255, '\0'); + expected_result = "SecondLife is a 3D World "; + ensure_equals("skip_whitespace: space at end", arr, expected_result); + + is.clear(); + is.str(str = "\t \r\nSecondLife is a 3D World"); + skip_whitespace(is); + is.get(arr, 255, '\0'); + expected_result = "\r\nSecondLife is a 3D World"; + ensure_equals("skip_whitespace: space at end", arr, expected_result); + } + + //testcases for skip_emptyspaces() + template<> template<> + void streamtools_object::test<2>() + { + char arr[255]; + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + bool ret; + + is.clear(); + is.str(str = " \tSecondLife is a 3D World.\n"); + skip_emptyspace(is); + is.get(arr, 255, '\0'); + expected_result = "SecondLife is a 3D World.\n"; + ensure_equals("skip_emptyspace: space and tabs", arr, expected_result); + + is.clear(); + is.str(str = " \t\r\n \r SecondLife is a 3D World.\n"); + skip_emptyspace(is); + is.get(arr, 255, '\0'); + expected_result = "SecondLife is a 3D World.\n"; + ensure_equals("skip_emptyspace: space, tabs, carriage return, newline", arr, expected_result); + + is.clear(); + is.str(str = ""); + ret = skip_emptyspace(is); + is.get(arr, 255, '\0'); + ensure("skip_emptyspace: empty string", ret == false); + + is.clear(); + is.str(str = " \r\n \t "); + ret = skip_emptyspace(is); + is.get(arr, 255, '\0'); + ensure("skip_emptyspace: space newline empty", ret == false); + } + + //testcases for skip_comments_and_emptyspace() + template<> template<> + void streamtools_object::test<3>() + { + char arr[255]; + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + bool ret; + + is.clear(); + is.str(str = " \t\r\n \r SecondLife is a 3D World.\n"); + skip_comments_and_emptyspace(is); + is.get(arr, 255, '\0'); + expected_result = "SecondLife is a 3D World.\n"; + ensure_equals("skip_comments_and_emptyspace: space, tabs, carriage return, newline", arr, expected_result); + + is.clear(); + is.str(str = "# \r\n SecondLife is a 3D World."); + skip_comments_and_emptyspace(is); + is.get(arr, 255, '\0'); + expected_result = "SecondLife is a 3D World."; + ensure_equals("skip_comments_and_emptyspace: skip comment - 1", arr, expected_result); + + is.clear(); + is.str(str = "# \r\n # SecondLife is a 3D World. ##"); + skip_comments_and_emptyspace(is); + is.get(arr, 255, '\0'); + expected_result = ""; + ensure_equals("skip_comments_and_emptyspace: skip comment - 2", arr, expected_result); + + is.clear(); + is.str(str = " \r\n SecondLife is a 3D World. ##"); + skip_comments_and_emptyspace(is); + is.get(arr, 255, '\0'); + expected_result = "SecondLife is a 3D World. ##"; + ensure_equals("skip_comments_and_emptyspace: skip comment - 3", arr, expected_result); + + is.clear(); + is.str(str = ""); + ret = skip_comments_and_emptyspace(is); + is.get(arr, 255, '\0'); + ensure("skip_comments_and_emptyspace: empty string", ret == false); + + is.clear(); + is.str(str = " \r\n \t # SecondLife is a 3D World"); + ret = skip_comments_and_emptyspace(is); + is.get(arr, 255, '\0'); + ensure("skip_comments_and_emptyspace: space newline comment empty", ret == false); + } + + //testcases for skip_line() + template<> template<> + void streamtools_object::test<4>() + { + char arr[255]; + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + bool ret; + + is.clear(); + is.str(str = "SecondLife is a 3D World.\n\n It provides an opportunity to the site \nuser to perform real life activities in virtual world."); + skip_line(is); + is.get(arr, 255, '\0'); + expected_result = "\n It provides an opportunity to the site \nuser to perform real life activities in virtual world."; + ensure_equals("skip_line: 1 newline", arr, expected_result); + + is.clear(); + is.str(expected_result); + skip_line(is); + is.get(arr, 255, '\0'); + expected_result = " It provides an opportunity to the site \nuser to perform real life activities in virtual world."; + ensure_equals("skip_line: 2 newline", arr, expected_result); + + is.clear(); + is.str(expected_result); + skip_line(is); + is.get(arr, 255, '\0'); + expected_result = "user to perform real life activities in virtual world."; + ensure_equals("skip_line: 3 newline", arr, expected_result); + + is.clear(); + is.str(str = ""); + ret = skip_line(is); + ensure("skip_line: empty string", ret == false); + } + + + // testcases for skip_to_next_word() + template<> template<> + void streamtools_object::test<5>() + { + char arr[255]; + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + bool ret; + + is.clear(); + is.str(str = "SecondLife is a 3D_World.\n\n It-provides an opportunity to the site \nuser to perform real life activities in virtual world."); + skip_to_next_word(is); // get past SecondLife + is.get(arr, 255, '\0'); + expected_result = "is a 3D_World.\n\n It-provides an opportunity to the site \nuser to perform real life activities in virtual world."; + ensure_equals("skip_to_next_word: 1", arr, expected_result); + + is.clear(); + is.str(expected_result); + skip_to_next_word(is); // get past is + skip_to_next_word(is); // get past a + skip_to_next_word(is); // get past 3D_World.\n\n + is.get(arr, 255, '\0'); + expected_result = "It-provides an opportunity to the site \nuser to perform real life activities in virtual world."; + ensure_equals("skip_to_next_word: get past .\n\n 2", arr, expected_result); + + is.clear(); + is.str(expected_result); + skip_to_next_word(is); // get past It- + expected_result = "provides an opportunity to the site \nuser to perform real life activities in virtual world."; + is.get(arr, 255, '\0'); + ensure_equals("skip_to_next_word: get past -", arr, expected_result); + + is.clear(); + is.str(str = ""); + ret = skip_to_next_word(is); + ensure("skip_line: empty string", ret == false); + + is.clear(); + is.str(str = " \r\n\r\n"); + ret = skip_to_next_word(is); + ensure("skip_line: space new lines", ret == false); + } + + + //testcases for skip_to_end_of_next_keyword() + template<> template<> + void streamtools_object::test<6>() + { + char arr[255]; + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + bool ret; + + is.clear(); + is.str(str = "FIRSTKEY followed by second delimiter\nSECONDKEY\t SecondValue followed by third delimiter \nSECONDKEY\nFOURTHKEY FOURTHVALUEis a 3DWorld."); + ret = skip_to_end_of_next_keyword("FIRSTKEY", is); + is.get(arr, 255, '\0'); + expected_result = " followed by second delimiter\nSECONDKEY\t SecondValue followed by third delimiter \nSECONDKEY\nFOURTHKEY FOURTHVALUEis a 3DWorld."; + ensure_equals("skip_to_end_of_next_keyword: 1", arr, expected_result); + + is.clear(); + is.str(expected_result); + ret = skip_to_end_of_next_keyword("SECONDKEY", is); + is.get(arr, 255, '\0'); + expected_result = "\t SecondValue followed by third delimiter \nSECONDKEY\nFOURTHKEY FOURTHVALUEis a 3DWorld."; + ensure_equals("skip_to_end_of_next_keyword: 2", arr, expected_result); + + is.clear(); + is.str(expected_result); + ret = skip_to_end_of_next_keyword("SECONDKEY", is); + is.get(arr, 255, '\0'); + expected_result = "\nFOURTHKEY FOURTHVALUEis a 3DWorld."; + ensure_equals("skip_to_end_of_next_keyword: 3", arr, expected_result); + + is.clear(); + is.str(expected_result); + ret = skip_to_end_of_next_keyword("FOURTHKEY", is); + is.get(arr, 255, '\0'); + expected_result = " FOURTHVALUEis a 3DWorld."; + ensure_equals("skip_to_end_of_next_keyword: 4", arr, expected_result); + + is.clear(); + is.str(str = "{should be skipped as newline/space/tab does not follow but this one should be picked\n { Does it?\n"); + ret = skip_to_end_of_next_keyword("{", is); + is.get(arr, 255, '\0'); + expected_result = " Does it?\n"; + ensure_equals("skip_to_end_of_next_keyword: multiple delim matches on same line", arr, expected_result); + + is.clear(); + is.str(str = "Delim { could not be found at start"); + ret = skip_to_end_of_next_keyword("{", is); + ensure("skip_to_end_of_next_keyword: delim should not be present", ret == false); + + is.clear(); + is.str(str = "Empty Delim"); + ret = skip_to_end_of_next_keyword("", is); + ensure("skip_to_end_of_next_keyword: empty delim should not be valid", ret == false); + + is.clear(); + is.str(str = ""); + ret = skip_to_end_of_next_keyword("}", is); + ensure("skip_to_end_of_next_keyword: empty string", ret == false); + } + + //testcases for get_word(std::string& output_string, std::istream& input_stream) + template<> template<> + void streamtools_object::test<7>() + { + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + bool ret; + + is.clear(); + is.str(str = " First Second \t \r \n Third Fourth-ShouldThisBePartOfFourth Fifth\n"); + actual_result = ""; + ret = get_word(actual_result, is); + expected_result = "First"; + ensure_equals("get_word: 1", actual_result, expected_result); + + actual_result = ""; + ret = get_word(actual_result, is); + expected_result = "Second"; + ensure_equals("get_word: 2", actual_result, expected_result); + + actual_result = ""; + ret = get_word(actual_result, is); + expected_result = "Third"; + ensure_equals("get_word: 3", actual_result, expected_result); + + // the current implementation of get_word seems inconsistent with + // skip_to_next_word. skip_to_next_word treats any character other + // than alhpa-numeric and '_' as a delimter, while get_word() + // treats only isspace() (i.e. space, form-feed('\f'), newline ('\n'), + // carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v') + // as delimiters + actual_result = ""; + ret = get_word(actual_result, is); // will copy Fourth-ShouldThisBePartOfFourth + expected_result = "Fourth-ShouldThisBePartOfFourth"; // as per current impl. + ensure_equals("get_word: 4", actual_result, expected_result); + + actual_result = ""; + ret = get_word(actual_result, is); // will copy Fifth + expected_result = "Fifth"; // as per current impl. + ensure_equals("get_word: 5", actual_result, expected_result); + + is.clear(); + is.str(str = " \t \r \n "); + actual_result = ""; + ret = get_word(actual_result, is); + ensure("get_word: empty all spaces, newline tabs", ret == false); + + is.clear(); + is.str(str = ""); + actual_result = ""; + ret = get_word(actual_result, is); + ensure("get_word: empty string", ret == false); + } + + // testcase for get_word and skip_to_next_word compatibility + template<> template<> + void streamtools_object::test<8>() + { + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + bool ret; + + is.clear(); + is.str(str = " First Second \t \r \n Third Fourth-ShouldThisBePartOfFourth Fifth\n"); + actual_result = ""; + ret = get_word(actual_result, is); // First + actual_result = ""; + ret = get_word(actual_result, is); // Second + actual_result = ""; + ret = get_word(actual_result, is); // Third + + // the current implementation of get_word seems inconsistent with + // skip_to_next_word. skip_to_next_word treats any character other + // than alhpa-numeric and '_' as a delimter, while get_word() + // treats only isspace() (i.e. space, form-feed('\f'), newline ('\n'), + // carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v') + // as delimiters + actual_result = ""; + ret = get_word(actual_result, is); // will copy Fourth-ShouldThisBePartOfFourth + + actual_result = ""; + ret = get_word(actual_result, is); // will copy Fifth + + is.clear(); + is.str(str = " First Second \t \r \n Third Fourth_ShouldThisBePartOfFourth Fifth\n"); + ret = skip_to_next_word(is); // should now point to First + ret = skip_to_next_word(is); // should now point to Second + ret = skip_to_next_word(is); // should now point to Third + ret = skip_to_next_word(is); // should now point to Fourth + ret = skip_to_next_word(is); // should now point to ShouldThisBePartOfFourth + expected_result = ""; + // will copy ShouldThisBePartOfFourth, the fifth word, + // while using get_word above five times result in getting "Fifth" + ret = get_word(expected_result, is); + ensure_equals("get_word: skip_to_next_word compatibility", actual_result, expected_result); + } + + //testcases for get_word(std::string& output_string, std::istream& input_stream, int n) + template<> template<> + void streamtools_object::test<9>() + { + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + bool ret; + + is.clear(); + is.str(str = " First Second \t \r \n Third Fourth-ShouldThisBePartOfFourth Fifth\n"); + actual_result = ""; + ret = get_word(actual_result, is, 255); + expected_result = "First"; + ensure_equals("get_word: 1", actual_result, expected_result); + + actual_result = ""; + ret = get_word(actual_result, is, 4); + expected_result = "Seco"; // should be cut short + ensure_equals("get_word: 2", actual_result, expected_result); + + actual_result = ""; + ret = get_word(actual_result, is, 255); + expected_result = "nd"; // get remainder of Second + ensure_equals("get_word: 3", actual_result, expected_result); + + actual_result = ""; + ret = get_word(actual_result, is, 0); // 0 size string + expected_result = ""; // get remainder of Second + ensure_equals("get_word: 0 sized output", actual_result, expected_result); + + actual_result = ""; + ret = get_word(actual_result, is, 255); + expected_result = "Third"; + ensure_equals("get_word: 4", actual_result, expected_result); + + is.clear(); + is.str(str = " \t \r \n "); + actual_result = ""; + ret = get_word(actual_result, is, 255); + ensure("get_word: empty all spaces, newline tabs", ret == false); + + is.clear(); + is.str(str = ""); + actual_result = ""; + ret = get_word(actual_result, is, 255); + ensure("get_word: empty string", ret == false); + } + + //test cases for get_line(std::string& output_string, std::istream& input_stream) + template<> template<> + void streamtools_object::test<10>() + { + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + bool ret; + + is.clear(); + is.str(str = "First Second \t \r\n Third Fourth-ShouldThisBePartOfFourth IsThisFifth\n"); + actual_result = ""; + ret = get_line(actual_result, is); + expected_result = "First Second \t \n"; + ensure_equals("get_line: 1", actual_result, expected_result); + + actual_result = ""; + ret = get_line(actual_result, is); + expected_result = " Third Fourth-ShouldThisBePartOfFourth IsThisFifth\n"; + ensure_equals("get_line: 2", actual_result, expected_result); + + is.clear(); + is.str(str = "\nFirst Line.\n\nSecond Line.\n"); + actual_result = ""; + ret = get_line(actual_result, is); + expected_result = "\n"; + ensure_equals("get_line: First char as newline", actual_result, expected_result); + + actual_result = ""; + ret = get_line(actual_result, is); + expected_result = "First Line.\n"; + ensure_equals("get_line: 3", actual_result, expected_result); + + actual_result = ""; + ret = get_line(actual_result, is); + expected_result = "\n"; + ensure_equals("get_line: 4", actual_result, expected_result); + + actual_result = ""; + ret = get_line(actual_result, is); + expected_result = "Second Line.\n"; + ensure_equals("get_line: 5", actual_result, expected_result); + } + + //test cases for get_line(std::string& output_string, std::istream& input_stream) + template<> template<> + void streamtools_object::test<11>() + { + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + bool ret; + + is.clear(); + is.str(str = "One Line only with no newline"); + actual_result = ""; + ret = get_line(actual_result, is); + expected_result = "One Line only with no newline"; + ensure_equals("get_line: No newline", actual_result, expected_result); + ensure_equals("return value is good state of stream", ret, is.good()); + } + + //test cases for get_line(std::string& output_string, std::istream& input_stream) + template<> template<> + void streamtools_object::test<12>() + { + skip_fail("get_line() incorrectly handles lone carriage return."); + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + bool ret; + + // need to be check if this test case is wrong or the implementation is wrong. + is.clear(); + is.str(str = "Should not skip \r unless they are followed with newline .\r\n"); + actual_result = ""; + ret = get_line(actual_result, is); + expected_result = "Should not skip \r unless they are followed with newline .\n"; + ensure_equals("get_line: carriage return skipped even though not followed by newline", actual_result, expected_result); + } + + //test cases for get_line(std::string& output_string, std::istream& input_stream) + template<> template<> + void streamtools_object::test<13>() + { + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + bool ret; + + is.clear(); + is.str(str = "\n"); + actual_result = ""; + ret = get_line(actual_result, is); + expected_result = "\n"; + ensure_equals("get_line: Just newline", actual_result, expected_result); + } + + + //testcases for get_line(std::string& output_string, std::istream& input_stream, int n) + template<> template<> + void streamtools_object::test<14>() + { + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + bool ret; + + is.clear(); + is.str(str = "First Line.\nSecond Line.\n"); + actual_result = ""; + ret = get_line(actual_result, is, 255); + expected_result = "First Line.\n"; + ensure_equals("get_line: Basic Operation", actual_result, expected_result); + + actual_result = ""; + ret = get_line(actual_result, is, sizeof("Second")-1); + expected_result = "Second\n"; + ensure_equals("get_line: Insufficient length 1", actual_result, expected_result); + + actual_result = ""; + ret = get_line(actual_result, is, 255); + expected_result = " Line.\n"; + ensure_equals("get_line: Remainder after earlier insufficient length", actual_result, expected_result); + + is.clear(); + is.str(str = "One Line only with no newline with limited length"); + actual_result = ""; + ret = get_line(actual_result, is, sizeof("One Line only with no newline with limited length")-1); + expected_result = "One Line only with no newline with limited length\n"; + ensure_equals("get_line: No newline with limited length", actual_result, expected_result); + + is.clear(); + is.str(str = "One Line only with no newline"); + actual_result = ""; + ret = get_line(actual_result, is, 255); + expected_result = "One Line only with no newline"; + ensure_equals("get_line: No newline", actual_result, expected_result); + } + + //testcases for get_line(std::string& output_string, std::istream& input_stream, int n) + template<> template<> + void streamtools_object::test<15>() + { + std::string str; + std::string expected_result; + std::string actual_result; + std::istringstream is; + bool ret; + + is.clear(); + is.str(str = "One Line only with no newline"); + actual_result = ""; + ret = get_line(actual_result, is, 255); + expected_result = "One Line only with no newline"; + ensure_equals("get_line: No newline", actual_result, expected_result); + ensure_equals("return value is good state of stream", ret, is.good()); + } + + //testcases for remove_last_char() + template<> template<> + void streamtools_object::test<16>() + { + std::string str; + std::string expected_result; + bool ret; + + str = "SecondLife is a 3D World"; + + ret = remove_last_char('d',str); + expected_result = "SecondLife is a 3D Worl"; + ensure_equals("remove_last_char: should remove last char", str, expected_result); + + str = "SecondLife is a 3D World"; + ret = remove_last_char('W',str); + expected_result = "SecondLife is a 3D World"; + ensure_equals("remove_last_char: should not remove as it is not last char", str, expected_result); + ensure("remove_last_char: should return false", ret == false); + + str = "SecondLife is a 3D World\n"; + ret = remove_last_char('\n',str); + expected_result = "SecondLife is a 3D World"; + ensure_equals("remove_last_char: should remove last newline", str, expected_result); + ensure("remove_last_char: should remove newline and return true", ret == true); + } + + + //testcases for unescaped_string() + template<> template<> + void streamtools_object::test<17>() + { + std::string str; + std::string expected_result; + + str = "SecondLife is a 3D world \\n"; + unescape_string(str); + expected_result = "SecondLife is a 3D world \n"; + ensure_equals("unescape_string: newline", str, expected_result); + + str = "SecondLife is a 3D world \\\\t \\n"; + unescape_string(str); + expected_result = "SecondLife is a 3D world \\t \n"; + ensure_equals("unescape_string: backslash and newline", str, expected_result); + + str = "SecondLife is a 3D world \\ "; + unescape_string(str); + expected_result = "SecondLife is a 3D world \\ "; + ensure_equals("unescape_string: insufficient to unescape", str, expected_result); + + str = "SecondLife is a 3D world \\n \\n \\n \\\\\\n"; + unescape_string(str); + expected_result = "SecondLife is a 3D world \n \n \n \\\n"; + ensure_equals("unescape_string: multipel newline and backslash", str, expected_result); + + str = "SecondLife is a 3D world \\t"; + unescape_string(str); + expected_result = "SecondLife is a 3D world \\t"; + ensure_equals("unescape_string: leaves tab as is", str, expected_result); + + str = "\\n"; + unescape_string(str); + expected_result = "\n"; + ensure_equals("unescape_string: only a newline", str, expected_result); + } + + //testcases for escape_string() + template<> template<> + void streamtools_object::test<18>() + { + std::string str; + std::string expected_result; + + str = "SecondLife is a 3D world \n"; + escape_string(str); + expected_result = "SecondLife is a 3D world \\n"; + ensure_equals("escape_string: newline", str, expected_result); + + str = "SecondLife is a 3D world \\t \n"; + escape_string(str); + expected_result = "SecondLife is a 3D world \\\\t \\n"; + ensure_equals("escape_string: backslash and newline", str, expected_result); + + str = "SecondLife is a 3D world \n \n \n \\\n"; + escape_string(str); + expected_result = "SecondLife is a 3D world \\n \\n \\n \\\\\\n"; + ensure_equals("escape_string: multipel newline and backslash", str, expected_result); + + str = "SecondLife is a 3D world \t"; + escape_string(str); + expected_result = "SecondLife is a 3D world \t"; + ensure_equals("unescape_string: leaves tab as is", str, expected_result); + + str = "\n"; + escape_string(str); + expected_result = "\\n"; + ensure_equals("unescape_string: only a newline", str, expected_result); + + // serialization/deserialization escape->unescape + str = "SecondLife is a 3D world \n \n \n \\\n"; + escape_string(str); + unescape_string(str); + expected_result = "SecondLife is a 3D world \n \n \n \\\n"; + ensure_equals("escape_string: should preserve with escape/unescape", str, expected_result); + + // serialization/deserialization unescape->escape + str = "SecondLife is a 3D world \\n \\n \\n \\\\"; + unescape_string(str); + escape_string(str); + expected_result = "SecondLife is a 3D world \\n \\n \\n \\\\"; + ensure_equals("escape_string: should preserve with unescape/escape", str, expected_result); + } + + // testcases for replace_newlines_with_whitespace() + template<> template<> + void streamtools_object::test<19>() + { + std::string str; + std::string expected_result; + + str = "SecondLife is a 3D \n\nworld\n"; + replace_newlines_with_whitespace(str); + expected_result = "SecondLife is a 3D world "; + ensure_equals("replace_newlines_with_whitespace: replace all newline", str, expected_result); + + str = "\nSecondLife is a 3D world\n"; + replace_newlines_with_whitespace(str); + expected_result = " SecondLife is a 3D world "; + ensure_equals("replace_newlines_with_whitespace: begin and newline", str, expected_result); + + str = "SecondLife is a 3D world\r\t"; + replace_newlines_with_whitespace(str); + expected_result = "SecondLife is a 3D world\r\t"; + ensure_equals("replace_newlines_with_whitespace: should only replace newline", str, expected_result); + + str = ""; + replace_newlines_with_whitespace(str); + expected_result = ""; + ensure_equals("replace_newlines_with_whitespace: empty string", str, expected_result); + } + + //testcases for remove_double_quotes() + template<> template<> + void streamtools_object::test<20>() + { + std::string str; + std::string expected_result; + + str = "SecondLife is a \"\"3D world"; + remove_double_quotes(str); + expected_result = "SecondLife is a 3D world"; + ensure_equals("remove_double_quotes: replace empty doube quotes", str, expected_result); + + str = "SecondLife is a \"3D world"; + remove_double_quotes(str); + expected_result = "SecondLife is a 3D world"; + ensure_equals("remove_double_quotes: keep as is it matching quote not found", str, expected_result); + } + + // testcases for get_brace_count() + template<> template<> + void streamtools_object::test<21>() + { + skip_fail("get_brace_count() has bugs."); + + std::string str; + std::string expected_result; + int count; + + str = " { "; + count = get_brace_count(str); + ensure("get_brace_count: 1 for {", count == 1); + + str = "\t}\t\t \n"; + count = get_brace_count(str); + ensure("get_brace_count: 1 for {", count == -1); + + str = "\t\t\t \n"; + count = get_brace_count(str); + ensure("get_brace_count: 0 for no braces", count == 0); + + str = "{ Remaining line not empty\n"; + count = get_brace_count(str); + ensure("get_brace_count: 0 for remainign line not empty", count == 0); + + /* shouldn't this return 1? */ + str = "{ /*Remaining line in comment*/\n"; + count = get_brace_count(str); + ensure("get_brace_count: 1 for { with remaining line in comment", count == 1); + + /* shouldn't this return -1? */ + str = " } //Remaining line in comment \n"; + count = get_brace_count(str); + ensure("get_brace_count: -1 for } with remaining line in comment", count == -1); + } + + //testcases for get_keyword_and_value() + template<> template<> + void streamtools_object::test<22>() + { + std::string s = "SecondLife is a 3D World"; + std::string keyword; + std::string value; + get_keyword_and_value(keyword, value, s); + ensure("get_keyword_and_value: Unable to get Keyword and Value", ((keyword == "SecondLife") && (value == "is a 3D World"))); + + s = "SecondLife"; + get_keyword_and_value(keyword, value, s); + ensure("get_keyword_and_value: value should be empty", ((keyword == "SecondLife") && (value == ""))); + + s = "SecondLife \t is cool! \n"; + get_keyword_and_value(keyword, value, s); + ensure("get_keyword_and_value: remove space before value but not after", ((keyword == "SecondLife") && (value == "is cool! "))); + } + + //testcases for get_keyword_and_value() + template<> template<> + void streamtools_object::test<23>() + { + skip_fail("get_keyword_and_value() has bugs."); + + std::string s; + std::string keyword = "SOME PRIOR KEYWORD"; + std::string value = "SOME PRIOR VALUE"; + + s = "SecondLife\n"; + get_keyword_and_value(keyword, value, s); + ensure("get_keyword_and_value: terminated with newline. value should be empty", ((keyword == "SecondLife") && (value == ""))); + } + + //testcases for get_keyword_and_value() + template<> template<> + void streamtools_object::test<24>() + { + skip_fail("get_keyword_and_value() has bugs."); + + std::string s; + std::string keyword = "SOME PRIOR KEYWORD"; + std::string value = "SOME PRIOR VALUE"; + + s = ""; + get_keyword_and_value(keyword, value, s); + ensure("get_keyword_and_value: empty string. keyword value should empty", ((keyword == "") && (value == ""))); + } + + //testcase for fullread() + template<> template<> + void streamtools_object::test<25>() + { + std::string str = "First Line.\nSecond Line\n"; + std::istringstream is(str); + char buf[255] = {0}; + + fullread(is, buf, 255); + ensure_memory_matches("fullread: read with newlines", (void*) buf, str.size()-1, (void*) str.c_str(), str.size()-1); + + is.clear(); + is.str(str = "First Line.\nSecond Line\n"); + memset(buf, 0, 255); + + char expected_string[] = "First Line.\nSecond"; + int len = sizeof(expected_string)-1; + fullread(is, buf, len); + ensure_memory_matches("fullread: read with newlines", (void*) buf, len, (void*) &expected_string, len); + } + + +// testcases for operator >> + + template<> template<> + void streamtools_object::test<26>() + { + char arr[255]; + std::string str; + std::string toCheck = "SecondLife" ; + std::string expected_result; + std::istringstream stream("SecondLife is a 3D World"); + stream >> toCheck.c_str(); + stream.get(arr, 255, '\0'); + expected_result = " is a 3D World"; + ensure_equals("istream << operator", arr, expected_result); + + stream.clear(); + stream.str(str = "SecondLife is a 3D World"); + toCheck = "is"; + stream >> toCheck.c_str(); + ensure("istream << operator should have failed", stream.good() == false); + } +} diff --git a/indra/test/lltemplatemessagebuilder_tut.cpp b/indra/test/lltemplatemessagebuilder_tut.cpp new file mode 100644 index 0000000000..67ca9320ba --- /dev/null +++ b/indra/test/lltemplatemessagebuilder_tut.cpp @@ -0,0 +1,944 @@ +/** + * @file lltemplatemessagebuilder_tut.cpp + * @date 2007-04 + * @brief Tests for building messages. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include <tut/tut.h> +#include "lltut.h" + +#include "llapr.h" +#include "llmessagetemplate.h" +#include "llquaternion.h" +#include "lltemplatemessagebuilder.h" +#include "lltemplatemessagereader.h" +#include "llversion.h" +#include "message_prehash.h" +#include "u64.h" +#include "v3dmath.h" +#include "v3math.h" +#include "v4math.h" + +namespace tut +{ + static LLTemplateMessageBuilder::message_template_name_map_t nameMap; + static LLTemplateMessageReader::message_template_number_map_t numberMap; + + struct LLTemplateMessageBuilderTestData + { + static LLMessageTemplate defaultTemplate() + { + static bool init = false; + if(! init) + { + ll_init_apr(); + start_messaging_system("notafile", 13035, + LL_VERSION_MAJOR, + LL_VERSION_MINOR, + LL_VERSION_PATCH, + FALSE, + "notasharedsecret"); + init_prehash_data(); + init = true; + } + return LLMessageTemplate(_PREHASH_TestMessage, 1, MFT_HIGH); + } + + static LLMessageBlock* defaultBlock(const EMsgVariableType type = MVT_NULL, const S32 size = 0, EMsgBlockType block = MBT_VARIABLE) + { + return createBlock(_PREHASH_Test0, type, size, block); + } + + static LLMessageBlock* createBlock(char* name, const EMsgVariableType type = MVT_NULL, const S32 size = 0, EMsgBlockType block = MBT_VARIABLE) + { + LLMessageBlock* result = new LLMessageBlock(name, block); + if(type != MVT_NULL) + { + result->addVariable(_PREHASH_Test0, type, size); + } + return result; + } + + static LLTemplateMessageBuilder* defaultBuilder(LLMessageTemplate& messageTemplate, char* name = _PREHASH_Test0) + { + nameMap[_PREHASH_TestMessage] = &messageTemplate; + LLTemplateMessageBuilder* builder = new LLTemplateMessageBuilder(nameMap); + builder->newMessage(_PREHASH_TestMessage); + builder->nextBlock(name); + return builder; + } + + /** Takes ownership of builder */ + static LLTemplateMessageReader* setReader( + LLMessageTemplate& messageTemplate, + LLTemplateMessageBuilder* builder, + U8 offset = 0) + { + numberMap[1] = &messageTemplate; + const U32 bufferSize = 1024; + U8 buffer[bufferSize]; + // zero out the packet ID field + memset(buffer, 0, LL_PACKET_ID_SIZE); + U32 builtSize = builder->buildMessage(buffer, bufferSize, offset); + delete builder; + LLTemplateMessageReader* reader = new LLTemplateMessageReader(numberMap); + reader->validateMessage(buffer, builtSize, LLHost()); + reader->readMessage(buffer, LLHost()); + return reader; + } + + }; + + typedef test_group<LLTemplateMessageBuilderTestData> LLTemplateMessageBuilderTestGroup; + typedef LLTemplateMessageBuilderTestGroup::object LLTemplateMessageBuilderTestObject; + LLTemplateMessageBuilderTestGroup templateMessageBuilderTestGroup("LLTemplateMessageBuilder"); + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<1>() + // construction and test of undefined + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock()); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<2>() + // BOOL + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_BOOL, 1)); + BOOL outValue, inValue = TRUE; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addBOOL(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getBOOL(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure BOOL", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<3>() + // U8 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_U8, 1)); + U8 outValue, inValue = 2; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addU8(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getU8(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure U8", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<4>() + // S16 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_S16, 2)); + S16 outValue, inValue = 90; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addS16(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getS16(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure S16", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<5>() + // U16 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_U16, 2)); + U16 outValue, inValue = 3; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addU16(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getU16(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure U16", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<6>() + // S32 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_S32, 4)); + S32 outValue, inValue = 44; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addS32(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getS32(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure S32", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<7>() + // F32 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_F32, 4)); + F32 outValue, inValue = 121.44f; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addF32(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getF32(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure F32", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<8>() + // U32 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_U32, 4)); + U32 outValue, inValue = 88; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addU32(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getU32(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure U32", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<9>() + // U64 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_U64, 8)); + U64 outValue, inValue = 121; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addU64(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getU64(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure U64", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<10>() + // F64 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_F64, 8)); + F64 outValue, inValue = 3232143.33; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addF64(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getF64(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure F64", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<11>() + // Vector3 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_LLVector3, 12)); + LLVector3 outValue, inValue = LLVector3(1,2,3); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addVector3(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getVector3(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure LLVector3", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<12>() + // Vector4 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_LLVector4, 16)); + LLVector4 outValue, inValue = LLVector4(1,2,3,4); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addVector4(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getVector4(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure LLVector4", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<13>() + // Vector3d + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_LLVector3d, 24)); + LLVector3d outValue, inValue = LLVector3d(1,2,3); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addVector3d(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getVector3d(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure LLVector3d", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<14>() + // Quaternion + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_LLQuaternion, 12)); + LLQuaternion outValue, inValue = LLQuaternion(1,2,3,0); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addQuat(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getQuat(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure LLQuaternion", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<15>() + // UUID + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_LLUUID, 16)); + LLUUID outValue, inValue; + inValue.generate(); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addUUID(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getUUID(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure UUID", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<16>() + // IPAddr + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_IP_ADDR, 4)); + U32 outValue, inValue = 12344556; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addIPAddr(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getIPAddr(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure IPAddr", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<17>() + // IPPort + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_IP_PORT, 2)); + U16 outValue, inValue = 80; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addIPPort(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getIPPort(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure IPPort", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<18>() + // String + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_VARIABLE, 1)); + std::string outValue, inValue = "testing"; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addString(_PREHASH_Test0, inValue.c_str()); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + char buffer[MAX_STRING]; + reader->getString(_PREHASH_Test0, _PREHASH_Test0, MAX_STRING, buffer); + outValue = buffer; + ensure_equals("Ensure String", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<19>() + // block name !-> binary order + { + U8 buffer1[MAX_BUFFER_SIZE]; + memset(buffer1, 0, MAX_BUFFER_SIZE); + U8 buffer2[MAX_BUFFER_SIZE]; + memset(buffer2, 0, MAX_BUFFER_SIZE); + U32 bufferSize1, bufferSize2; + + // build template: Test0 before Test1 + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(createBlock(_PREHASH_Test0, MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4, MBT_SINGLE)); + + // build message: 1st declared block var == 0xaaaa, 2nd declared block var == 0xbbbb + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate, _PREHASH_Test0); + builder->addU32(_PREHASH_Test0, 0xaaaa); + builder->nextBlock(_PREHASH_Test1); + builder->addU32(_PREHASH_Test0, 0xbbbb); + bufferSize1 = builder->buildMessage(buffer1, MAX_BUFFER_SIZE, 0); + delete builder; + + // build template: Test1 before Test0 + messageTemplate = defaultTemplate(); + messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(_PREHASH_Test0, MVT_U32, 4, MBT_SINGLE)); + + // build message: 1st declared block var == 0xaaaa, 2nd declared block var == 0xbbbb + builder = defaultBuilder(messageTemplate, _PREHASH_Test1); + builder->addU32(_PREHASH_Test0, 0xaaaa); + builder->nextBlock(_PREHASH_Test0); + builder->addU32(_PREHASH_Test0, 0xbbbb); + bufferSize2 = builder->buildMessage(buffer2, MAX_BUFFER_SIZE, 0); + delete builder; + + ensure_equals("Ensure Buffer Sizes Equal", bufferSize1, bufferSize2); + ensure_equals("Ensure Buffer Contents Equal", memcmp(buffer1, buffer2, bufferSize1), 0); + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<20>() + // block build order !-> binary order + { + U8 buffer1[MAX_BUFFER_SIZE]; + memset(buffer1, 0, MAX_BUFFER_SIZE); + U8 buffer2[MAX_BUFFER_SIZE]; + memset(buffer2, 0, MAX_BUFFER_SIZE); + U32 bufferSize1, bufferSize2; + + // build template: Test0 before Test1 + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(createBlock(_PREHASH_Test0, MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4, MBT_SINGLE)); + + // build message: 1st declared block var == 0xaaaa, 2nd declared block var == 0xbbbb + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate, _PREHASH_Test0); + builder->addU32(_PREHASH_Test0, 0xaaaa); + builder->nextBlock(_PREHASH_Test1); + builder->addU32(_PREHASH_Test0, 0xbbbb); + bufferSize1 = builder->buildMessage(buffer1, MAX_BUFFER_SIZE, 0); + delete builder; + + // build message: 1st declared block var == 0xaaaa, 2nd declared block var == 0xbbbb + builder = defaultBuilder(messageTemplate, _PREHASH_Test1); + builder->addU32(_PREHASH_Test0, 0xbbbb); + builder->nextBlock(_PREHASH_Test0); + builder->addU32(_PREHASH_Test0, 0xaaaa); + bufferSize2 = builder->buildMessage(buffer2, MAX_BUFFER_SIZE, 0); + delete builder; + + ensure_equals("Ensure Buffer Sizes Equal", bufferSize1, bufferSize2); + ensure_equals("Ensure Buffer Contents Equal", memcmp(buffer1, buffer2, bufferSize1), 0); + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<21>() + // block appended in declaration -> data appended in binary + { + U8 buffer1[MAX_BUFFER_SIZE]; + memset(buffer1, 0, MAX_BUFFER_SIZE); + U8 buffer2[MAX_BUFFER_SIZE]; + memset(buffer2, 0, MAX_BUFFER_SIZE); + U32 bufferSize1, bufferSize2; + + // Build template: Test0 only + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(createBlock(_PREHASH_Test0, MVT_U32, 4, MBT_SINGLE)); + + // Build message + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate, _PREHASH_Test0); + builder->addU32(_PREHASH_Test0, 0xaaaa); + bufferSize1 = builder->buildMessage(buffer1, MAX_BUFFER_SIZE, 0); + delete builder; + + // Build template: Test0 before Test1 + messageTemplate = defaultTemplate(); + messageTemplate.addBlock(createBlock(_PREHASH_Test0, MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4, MBT_SINGLE)); + + // Build message + builder = defaultBuilder(messageTemplate, _PREHASH_Test0); + builder->addU32(_PREHASH_Test0, 0xaaaa); + builder->nextBlock(_PREHASH_Test1); + builder->addU32(_PREHASH_Test0, 0xbbbb); + bufferSize2 = builder->buildMessage(buffer2, MAX_BUFFER_SIZE, 0); + delete builder; + + ensure_not_equals("Ensure Buffer Sizes Not Equal", bufferSize1, bufferSize2); + ensure_equals("Ensure Buffer Prefix Equal", memcmp(buffer1, buffer2, bufferSize1), 0); + ensure_not_equals("Ensure Buffer Contents Not Equal", memcmp(buffer1, buffer2, bufferSize2), 0); + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<22>() + // repeated penultimate block (crashes when data in LLDynamicArrayIndexed) + { + U32 inTest00 = 0, inTest01 = 1, inTest1 = 2; + U32 outTest00, outTest01, outTest1; + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(createBlock(_PREHASH_Test0, MVT_U32, 4)); + messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4)); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addU32(_PREHASH_Test0, inTest00); + builder->nextBlock(_PREHASH_Test0); + builder->addU32(_PREHASH_Test0, inTest01); + builder->nextBlock(_PREHASH_Test1); + builder->addU32(_PREHASH_Test0, inTest1); + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getU32(_PREHASH_Test0, _PREHASH_Test0, outTest00, 0); + reader->getU32(_PREHASH_Test0, _PREHASH_Test0, outTest01, 1); + reader->getU32(_PREHASH_Test1, _PREHASH_Test0, outTest1); + ensure_equals("Ensure Test0[0]", inTest00, outTest00); + ensure_equals("Ensure Test0[1]", inTest01, outTest01); + ensure_equals("Ensure Test1", inTest1, outTest1); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<23>() + // variable repeated block name never accessed + { + U32 inTest = 1, outTest; + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock( + createBlock(_PREHASH_Test0, MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4)); + + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addU32(_PREHASH_Test0, inTest); + + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + reader->getU32(_PREHASH_Test0, _PREHASH_Test0, outTest); + S32 blockCount = reader->getNumberOfBlocks(_PREHASH_Test1); + ensure_equals("Ensure block count", blockCount, 0); + ensure_equals("Ensure Test0", inTest, outTest); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<24>() + // forwarding message + { + // build template + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(createBlock(_PREHASH_Test0, MVT_U32, 4)); + + // build message + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addU32(_PREHASH_Test0, 42); + + // read message + LLTemplateMessageReader* reader = setReader(messageTemplate, builder); + + // forward message + builder = defaultBuilder(messageTemplate); + builder->newMessage(_PREHASH_TestMessage); + reader->copyToBuilder(*builder); + U8 buffer[MAX_BUFFER_SIZE]; + builder->buildMessage(buffer, MAX_BUFFER_SIZE, 0); + + delete builder; + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<25>() + // non-zero offset with undefined + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock()); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 10); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<26>() + // non-zero offset with BOOL + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_BOOL, 1)); + BOOL outValue, inValue = TRUE; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addBOOL(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 1); + reader->getBOOL(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure BOOL", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<27>() + // non-zero offset with U8 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_U8, 1)); + U8 outValue, inValue = 2; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addU8(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 255); + reader->getU8(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure U8", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<28>() + // non-zero offset with S16 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_S16, 2)); + S16 outValue, inValue = 90; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addS16(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 2); + reader->getS16(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure S16", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<29>() + // non-zero offset with U16 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_U16, 2)); + U16 outValue, inValue = 3; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addU16(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 4); + reader->getU16(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure U16", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<30>() + // non-zero offset with S32 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_S32, 4)); + S32 outValue, inValue = 44; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addS32(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 4); + reader->getS32(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure S32", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<31>() + // non-zero offset with F32 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_F32, 4)); + F32 outValue, inValue = 121.44f; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addF32(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 16); + reader->getF32(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure F32", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<32>() + // non-zero offset with U32 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_U32, 4)); + U32 outValue, inValue = 88; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addU32(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 127); + reader->getU32(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure U32", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<33>() + // non-zero offset with U64 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_U64, 8)); + U64 outValue, inValue = 121; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addU64(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 32); + reader->getU64(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure U64", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<34>() + // non-zero offset with F64 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_F64, 8)); + F64 outValue, inValue = 3232143.33; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addF64(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 128); + reader->getF64(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure F64", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<35>() + // non-zero offset with Vector3 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_LLVector3, 12)); + LLVector3 outValue, inValue = LLVector3(1,2,3); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addVector3(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 63); + reader->getVector3(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure LLVector3", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<36>() + // non-zero offset with Vector4 + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_LLVector4, 16)); + LLVector4 outValue, inValue = LLVector4(1,2,3,4); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addVector4(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 64); + reader->getVector4(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure LLVector4", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<37>() + // non-zero offset with Vector3d + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_LLVector3d, 24)); + LLVector3d outValue, inValue = LLVector3d(1,2,3); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addVector3d(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 64); + reader->getVector3d(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure LLVector3d", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<38>() + // non-zero offset with Quaternion + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_LLQuaternion, 12)); + LLQuaternion outValue, inValue = LLQuaternion(1,2,3,0); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addQuat(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 12); + reader->getQuat(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure LLQuaternion", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<39>() + // non-zero offset with UUID + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_LLUUID, 16)); + LLUUID outValue, inValue; + inValue.generate(); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addUUID(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 31); + reader->getUUID(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure UUID", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<40>() + // non-zero offset with IPAddr + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_IP_ADDR, 4)); + U32 outValue, inValue = 12344556; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addIPAddr(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 32); + reader->getIPAddr(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure IPAddr", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<41>() + // non-zero offset with IPPort + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_IP_PORT, 2)); + U16 outValue, inValue = 80; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addIPPort(_PREHASH_Test0, inValue); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 6); + reader->getIPPort(_PREHASH_Test0, _PREHASH_Test0, outValue); + ensure_equals("Ensure IPPort", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<42>() + // non-zero offset with String + { + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_VARIABLE, 1)); + std::string outValue, inValue = "testing"; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addString(_PREHASH_Test0, inValue.c_str()); + LLTemplateMessageReader* reader = setReader( + messageTemplate, builder, 255); + char buffer[MAX_STRING]; + reader->getString(_PREHASH_Test0, _PREHASH_Test0, MAX_STRING, buffer); + outValue = buffer; + ensure_equals("Ensure String", inValue, outValue); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<43>() + // read past end of message -> default values (forward compatibility) + { + // build message with single block + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_U32, 4, MBT_SINGLE)); + U32 outValue, outValue2, inValue = 0xbbbbbbbb; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addU32(_PREHASH_Test0, inValue); + const U32 bufferSize = 1024; + U8 buffer[bufferSize]; + memset(buffer, 0xaa, bufferSize); + memset(buffer, 0, LL_PACKET_ID_SIZE); + U32 builtSize = builder->buildMessage(buffer, bufferSize, 0); + delete builder; + + // add block to reader template + messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4, MBT_SINGLE)); + + // read message value and default value + numberMap[1] = &messageTemplate; + LLTemplateMessageReader* reader = + new LLTemplateMessageReader(numberMap); + reader->validateMessage(buffer, builtSize, LLHost()); + reader->readMessage(buffer, LLHost()); + reader->getU32(_PREHASH_Test0, _PREHASH_Test0, outValue); + reader->getU32(_PREHASH_Test1, _PREHASH_Test0, outValue2); + ensure_equals("Ensure present value ", outValue, inValue); + ensure_equals("Ensure default value ", outValue2, 0); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<44>() + // read variable block past end of message -> 0 repeats + { + // build message with single block + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_U32, 4, MBT_SINGLE)); + U32 outValue, outValue2, inValue = 0xbbbbbbbb; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addU32(_PREHASH_Test0, inValue); + const U32 bufferSize = 1024; + U8 buffer[bufferSize]; + memset(buffer, 0xaa, bufferSize); + memset(buffer, 0, LL_PACKET_ID_SIZE); + U32 builtSize = builder->buildMessage(buffer, bufferSize, 0); + delete builder; + + // add variable block to reader template + messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4)); + + // read message value and check block repeat count + numberMap[1] = &messageTemplate; + LLTemplateMessageReader* reader = + new LLTemplateMessageReader(numberMap); + reader->validateMessage(buffer, builtSize, LLHost()); + reader->readMessage(buffer, LLHost()); + reader->getU32(_PREHASH_Test0, _PREHASH_Test0, outValue); + outValue2 = reader->getNumberOfBlocks(_PREHASH_Test1); + ensure_equals("Ensure present value ", outValue, inValue); + ensure_equals("Ensure 0 repeats ", outValue2, 0); + delete reader; + } + + template<> template<> + void LLTemplateMessageBuilderTestObject::test<45>() + // read variable length data past end of message -> 0 length + { + // build message with single block + LLMessageTemplate messageTemplate = defaultTemplate(); + messageTemplate.addBlock(defaultBlock(MVT_U32, 4, MBT_SINGLE)); + U32 outValue, outValue2, inValue = 0xbbbbbbbb; + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); + builder->addU32(_PREHASH_Test0, inValue); + const U32 bufferSize = 1024; + U8 buffer[bufferSize]; + memset(buffer, 0xaa, bufferSize); + memset(buffer, 0, LL_PACKET_ID_SIZE); + U32 builtSize = builder->buildMessage(buffer, bufferSize, 0); + delete builder; + + // add variable block to reader template + messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_VARIABLE, 4, + MBT_SINGLE)); + + // read message value and default string + numberMap[1] = &messageTemplate; + LLTemplateMessageReader* reader = + new LLTemplateMessageReader(numberMap); + reader->validateMessage(buffer, builtSize, LLHost()); + reader->readMessage(buffer, LLHost()); + reader->getU32(_PREHASH_Test0, _PREHASH_Test0, outValue); + char outBuffer[bufferSize]; + memset(buffer, 0xcc, bufferSize); + reader->getString(_PREHASH_Test1, _PREHASH_Test0, bufferSize, + outBuffer); + outValue2 = reader->getNumberOfBlocks(_PREHASH_Test1); + ensure_equals("Ensure present value ", outValue, inValue); + ensure_equals("Ensure unchanged buffer ", strlen(outBuffer), 0); + delete reader; + } +} + diff --git a/indra/test/lltut.h b/indra/test/lltut.h index 6f1fee2b2f..58de355453 100644 --- a/indra/test/lltut.h +++ b/indra/test/lltut.h @@ -8,12 +8,6 @@ * $License$ */ -/** - * - * THOROUGH_DESCRIPTION - * - */ - #ifndef LL_LLTUT_H #define LL_LLTUT_H diff --git a/indra/test/lluuidhashmap_tut.cpp b/indra/test/lluuidhashmap_tut.cpp new file mode 100644 index 0000000000..c9736d4d4b --- /dev/null +++ b/indra/test/lluuidhashmap_tut.cpp @@ -0,0 +1,339 @@ +/** + * @file lluuidhashmap_tut.cpp + * @author Adroit + * @date 2007-02 + * @brief Test cases for LLUUIDHashMap + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include <tut/tut.h> +#include "linden_common.h" +#include "lluuidhashmap.h" +#include "llsdserialize.h" + +namespace tut +{ + class UUIDTableEntry + { + public: + UUIDTableEntry() + { + mID.setNull(); + mValue = 0; + } + + UUIDTableEntry(const LLUUID& id, U32 value) + { + mID = id; + mValue = value; + } + + ~UUIDTableEntry(){}; + + static BOOL uuidEq(const LLUUID &uuid, const UUIDTableEntry &id_pair) + { + if (uuid == id_pair.mID) + { + return TRUE; + } + return FALSE; + } + + const LLUUID& getID() { return mID; } + const U32& getValue() { return mValue; } + + protected: + LLUUID mID; + U32 mValue; + }; + + struct hashmap_test + { + }; + + typedef test_group<hashmap_test> hash_index_t; + typedef hash_index_t::object hash_index_object_t; + tut::hash_index_t tut_hash_index("hashmap_test"); + + // stress test + template<> template<> + void hash_index_object_t::test<1>() + { + LLUUIDHashMap<UUIDTableEntry, 32> hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry()); + const int numElementsToCheck = 32*256*32; + std::vector<LLUUID> idList(numElementsToCheck); + int i; + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID id; + id.generate(); + UUIDTableEntry entry(id, i); + hashTable.set(id, entry); + idList[i] = id; + } + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID idToCheck = idList[i]; + UUIDTableEntry entryToCheck = hashTable.get(idToCheck); + ensure("set/get did not work", entryToCheck.getID() == idToCheck && entryToCheck.getValue() == (size_t)i); + } + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID idToCheck = idList[i]; + if (i % 2 != 0) + { + hashTable.remove(idToCheck); + } + } + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID idToCheck = idList[i]; + ensure("remove or check did not work", (i % 2 == 0 && hashTable.check(idToCheck)) || (i % 2 != 0 && !hashTable.check(idToCheck))); + } + } + + // test removing all but one element. + template<> template<> + void hash_index_object_t::test<2>() + { + LLUUIDHashMap<UUIDTableEntry, 2> hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry()); + const int numElementsToCheck = 5; + std::vector<LLUUID> idList(numElementsToCheck*10); + int i; + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID id; + id.generate(); + UUIDTableEntry entry(id, i); + hashTable.set(id, entry); + idList[i] = id; + } + + ensure("getLength failed", hashTable.getLength() == numElementsToCheck); + + // remove all but the last element + for (i = 0; i < numElementsToCheck-1; i++) + { + LLUUID idToCheck = idList[i]; + hashTable.remove(idToCheck); + } + + // there should only be one element left now. + ensure("getLength failed", hashTable.getLength() == 1); + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID idToCheck = idList[i]; + if (i != numElementsToCheck - 1) + { + ensure("remove did not work", hashTable.check(idToCheck) == FALSE); + } + else + { + UUIDTableEntry entryToCheck = hashTable.get(idToCheck); + ensure("remove did not work", entryToCheck.getID() == idToCheck && entryToCheck.getValue() == (size_t)i); + } + } + } + + // test overriding of value already set. + template<> template<> + void hash_index_object_t::test<3>() + { + LLUUIDHashMap<UUIDTableEntry, 5> hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry()); + const int numElementsToCheck = 10; + std::vector<LLUUID> idList(numElementsToCheck); + int i; + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID id; + id.generate(); + UUIDTableEntry entry(id, i); + hashTable.set(id, entry); + idList[i] = id; + } + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID id = idList[i]; + // set new entry with value = i+numElementsToCheck + UUIDTableEntry entry(id, i+numElementsToCheck); + hashTable.set(id, entry); + } + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID idToCheck = idList[i]; + UUIDTableEntry entryToCheck = hashTable.get(idToCheck); + ensure("set/get did not work", entryToCheck.getID() == idToCheck && entryToCheck.getValue() == (size_t)(i+numElementsToCheck)); + } + } + + // test removeAll() + template<> template<> + void hash_index_object_t::test<4>() + { + LLUUIDHashMap<UUIDTableEntry, 5> hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry()); + const int numElementsToCheck = 10; + std::vector<LLUUID> idList(numElementsToCheck); + int i; + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID id; + id.generate(); + UUIDTableEntry entry(id, i); + hashTable.set(id, entry); + idList[i] = id; + } + + hashTable.removeAll(); + ensure("removeAll failed", hashTable.getLength() == 0); + } + + + // test sparse map - force it by creating 256 entries that fall into 256 different nodes + template<> template<> + void hash_index_object_t::test<5>() + { + LLUUIDHashMap<UUIDTableEntry, 2> hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry()); + const int numElementsToCheck = 256; + std::vector<LLUUID> idList(numElementsToCheck); + int i; + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID id; + id.generate(); + // LLUUIDHashMap uses mData[0] to pick the bucket + // overwrite mData[0] so that it ranges from 0 to 255 + id.mData[0] = i; + UUIDTableEntry entry(id, i); + hashTable.set(id, entry); + idList[i] = id; + } + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID idToCheck = idList[i]; + UUIDTableEntry entryToCheck = hashTable.get(idToCheck); + ensure("set/get did not work for sparse map", entryToCheck.getID() == idToCheck && entryToCheck.getValue() == (size_t)i); + } + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID idToCheck = idList[i]; + if (i % 2 != 0) + { + hashTable.remove(idToCheck); + } + } + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID idToCheck = idList[i]; + ensure("remove or check did not work for sparse map", (i % 2 == 0 && hashTable.check(idToCheck)) || (i % 2 != 0 && !hashTable.check(idToCheck))); + } + } + + // iterator + template<> template<> + void hash_index_object_t::test<6>() + { + LLUUIDHashMap<UUIDTableEntry, 2> hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry()); + LLUUIDHashMapIter<UUIDTableEntry, 2> hashIter(&hashTable); + const int numElementsToCheck = 256; + std::vector<LLUUID> idList(numElementsToCheck); + int i; + + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID id; + id.generate(); + // LLUUIDHashMap uses mData[0] to pick the bucket + // overwrite mData[0] so that it ranges from 0 to 255 + // to create a sparse map + id.mData[0] = i; + UUIDTableEntry entry(id, i); + hashTable.set(id, entry); + idList[i] = id; + } + + hashIter.first(); + int numElementsIterated = 0; + while(!hashIter.done()) + { + numElementsIterated++; + UUIDTableEntry tableEntry = *hashIter; + LLUUID id = tableEntry.getID(); + hashIter.next(); + ensure("Iteration failed for sparse map", tableEntry.getValue() < (size_t)numElementsToCheck && idList[tableEntry.getValue()] == tableEntry.getID()); + } + + ensure("iteration count failed", numElementsIterated == numElementsToCheck); + } + + // remove after middle of iteration + template<> template<> + void hash_index_object_t::test<7>() + { + LLUUIDHashMap<UUIDTableEntry, 2> hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry()); + LLUUIDHashMapIter<UUIDTableEntry, 2> hashIter(&hashTable); + const int numElementsToCheck = 256; + std::vector<LLUUID> idList(numElementsToCheck); + int i; + + LLUUID uuidtoSearch; + for (i = 0; i < numElementsToCheck; i++) + { + LLUUID id; + id.generate(); + // LLUUIDHashMap uses mData[0] to pick the bucket + // overwrite mData[0] so that it ranges from 0 to 255 + // to create a sparse map + id.mData[0] = i; + UUIDTableEntry entry(id, i); + hashTable.set(id, entry); + idList[i] = id; + + // pick uuid somewhere in the middle + if (i == 5) + { + uuidtoSearch = id; + } + } + + hashIter.first(); + int numElementsIterated = 0; + while(!hashIter.done()) + { + numElementsIterated++; + UUIDTableEntry tableEntry = *hashIter; + LLUUID id = tableEntry.getID(); + if (uuidtoSearch == id) + { + break; + } + hashIter.next(); + } + + // current iterator implementation will not allow any remove operations + // until ALL elements have been iterated over. this seems to be + // an unnecessary restriction. Iterator should have a method to + // reset() its state so that further operations (inckuding remove) + // can be performed on the HashMap without having to iterate thru + // all the remaining nodes. + +// hashIter.reset(); +// hashTable.remove(uuidtoSearch); +// ensure("remove after iteration reset failed", hashTable.check(uuidtoSearch) == FALSE); + } +} diff --git a/indra/test/llxorcipher_tut.cpp b/indra/test/llxorcipher_tut.cpp new file mode 100644 index 0000000000..6fe5176cb0 --- /dev/null +++ b/indra/test/llxorcipher_tut.cpp @@ -0,0 +1,113 @@ +/** + * @file llxorcipher_tut.cpp + * @author Adroit + * @date 2007-03 + * @brief llxorcipher, llnullcipher test cases. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include <tut/tut.h> +#include "lltut.h" +#include "llxorcipher.h" +#include "llnullcipher.h" + +namespace tut +{ + struct cipher + { + }; + typedef test_group<cipher> cipher_t; + typedef cipher_t::object cipher_object_t; + tut::cipher_t tut_cipher("cipher"); + + //encrypt->decrypt + template<> template<> + void cipher_object_t::test<1>() + { + const U32 len = 3; + const U8 pad[] = "abc"; + const char str[] = "SecondLife"; + const S32 str_len = sizeof(str); + U8 encrypted[str_len]; + U8 decrypted[str_len]; + LLXORCipher xorCipher(pad, len); + LLXORCipher xorCipher1(pad, len); + + U32 length = xorCipher.requiredEncryptionSpace(50); + ensure("requiredEncryptionSpace() function failed", (length == 50)); + + U32 lenEncrypted = xorCipher.encrypt((U8 *) str, str_len, encrypted, str_len); + ensure("Encryption failed", (lenEncrypted == str_len)); + U32 lenDecrypted = xorCipher1.decrypt(encrypted, str_len, decrypted, str_len); + ensure("Decryption failed", (lenDecrypted == str_len)); + ensure_memory_matches("LLXORCipher Encrypt/Decrypt failed", str, str_len, decrypted, lenDecrypted); + } + + // operator= + template<> template<> + void cipher_object_t::test<2>() + { + const U8 pad[] = "ABCDEFGHIJKLMNOPQ"; // pad len longer than data to be ciphered + const U32 pad_len = sizeof(pad); + const U8 pad1[] = "SecondLife"; + const U32 pad_len1 = sizeof(pad1); + const char str[] = "To Be Ciphered"; + const S32 str_len = sizeof(str); + U8 encrypted[str_len]; + U8 decrypted[str_len]; + + LLXORCipher xorCipher(pad, pad_len); + LLXORCipher xorCipher1(pad1, pad_len1); + + xorCipher.encrypt((U8 *) str, str_len, encrypted, str_len); + // make xorCipher1 same as xorCipher..so that xorCipher1 can decrypt what was + // encrypted using xorCipher + xorCipher1 = xorCipher; + U32 lenDecrypted = xorCipher1.decrypt(encrypted, str_len, decrypted, str_len); + ensure_memory_matches("LLXORCipher operator= failed", str, str_len, decrypted, lenDecrypted); + } + + //in place encrypt->decrypt + template<> template<> + void cipher_object_t::test<3>() + { + U32 padNum = 0x12349087; + const U8* pad = (U8*) &padNum; + const U32 pad_len = sizeof(U32); + char str[] = "To Be Ciphered a long string.........!!!."; + char str1[] = "To Be Ciphered a long string.........!!!."; // same as str + const S32 str_len = sizeof(str); + + LLXORCipher xorCipher(pad, pad_len); + LLXORCipher xorCipher1(pad, pad_len); + xorCipher.encrypt((U8 *) str, str_len); + // it should not be the same as original data! + ensure("LLXORCipher: In Place encrypt failed", memcmp(str, str1, str_len) != 0); + xorCipher1.decrypt((U8 *) str, str_len); + // it should not be the same as original data! + ensure_memory_matches("LLXORCipher: In Place decrypt failed", str, str_len, str1, str_len); + } + + //LLNullCipher encrypt->decrypt + template<> template<> + void cipher_object_t::test<4>() + { + const char str[] = "SecondLife"; + const S32 str_len = sizeof(str); + U8 encrypted[str_len]; + U8 decrypted[str_len]; + LLNullCipher nullCipher; + LLNullCipher nullCipher1; + + U32 length = nullCipher.requiredEncryptionSpace(50); + ensure("LLNullCipher::requiredEncryptionSpace() function failed", (length == 50)); + + U32 len1 = nullCipher.encrypt((U8 *) str, str_len, encrypted, str_len); + ensure_memory_matches("LLNullCipher - Source transformed during encryption.", encrypted, len1, str, str_len); + + U32 len2 = nullCipher1.decrypt(encrypted, str_len, decrypted, str_len); + ensure_memory_matches("LLNullCipher - Decryption failed", decrypted, len2, str, str_len); + } +} diff --git a/indra/test/message_tut.cpp b/indra/test/message_tut.cpp new file mode 100644 index 0000000000..a08c3130f1 --- /dev/null +++ b/indra/test/message_tut.cpp @@ -0,0 +1,77 @@ +/** + * @file lldatapacker_tut.cpp + * @date 2007-04 + * @brief LLDataPacker test cases. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include <tut/tut.h> +#include "lltut.h" + +#include "llapr.h" +#include "llversion.h" +#include "message.h" +#include "message_prehash.h" + +namespace +{ + struct Response : public LLHTTPNode::Response + { + virtual void result(const LLSD&) {} + virtual void status(S32 code, const std::string& message) + { + mStatus = code; + } + S32 mStatus; + }; +} + +namespace tut +{ + struct LLMessageSystemTestData + { + LLMessageSystemTestData() + { + static bool init = false; + if(! init) + { + ll_init_apr(); + init_prehash_data(); + init = true; + } + + // currently test disconnected message system + start_messaging_system("notafile", 13035, + LL_VERSION_MAJOR, + LL_VERSION_MINOR, + LL_VERSION_PATCH, + FALSE, + "notasharedsecret"); + } + + ~LLMessageSystemTestData() + { + // not end_messaging_system() + delete gMessageSystem; + gMessageSystem = NULL; + } + }; + + typedef test_group<LLMessageSystemTestData> LLMessageSystemTestGroup; + typedef LLMessageSystemTestGroup::object LLMessageSystemTestObject; + LLMessageSystemTestGroup messageTestGroup("LLMessageSystem"); + + template<> template<> + void LLMessageSystemTestObject::test<1>() + // dispatch unknown message + { + const char* name = "notamessasge"; + const LLSD message; + const LLPointer<Response> response = new Response(); + gMessageSystem->dispatch(name, message, response); + ensure_equals(response->mStatus, 404); + } +} + diff --git a/indra/test/test.cpp b/indra/test/test.cpp index b60abdf587..24a0c27a5e 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -44,7 +44,8 @@ public: mTotalTests(0), mPassedTests(0), mFailedTests(0), - mSkippedTests(0) + mSkippedTests(0), + mSkipedFailTests(0) { } @@ -66,7 +67,7 @@ public: break; case tut::test_result::fail: ++mFailedTests; - out << "fail '" << tr.message << "'"; + out << "fail"; break; case tut::test_result::ex: ++mFailedTests; @@ -84,12 +85,20 @@ public: ++mSkippedTests; out << "skipped"; break; + case tut::test_result::skip_fail: + ++mSkipedFailTests; + out << "skipped known failure"; + break; default: ++mFailedTests; out << "unknown"; } if(mVerboseMode || (tr.result != tut::test_result::ok)) { + if(!tr.message.empty()) + { + out << ": '" << tr.message << "'"; + } std::cout << out.str() << std::endl; } } @@ -98,11 +107,17 @@ public: { std::cout << std::endl; std::cout << "Total Tests: " << mTotalTests << std::endl; - std::cout << "Passed Tests : " << mPassedTests << std::endl; + std::cout << "Passed Tests: " << mPassedTests << std::endl; if (mSkippedTests > 0) { - std::cout << "Skipped Tests : " << mSkippedTests << std::endl; + std::cout << "Skipped Tests: " << mSkippedTests << std::endl; + } + + if (mSkipedFailTests > 0) + { + std::cout << "Skipped known failures: " << mSkipedFailTests + << std::endl; } if(mFailedTests > 0) @@ -117,10 +132,11 @@ public: protected: bool mVerboseMode; - S32 mTotalTests; - S32 mPassedTests; - S32 mFailedTests; - S32 mSkippedTests; + int mTotalTests; + int mPassedTests; + int mFailedTests; + int mSkippedTests; + int mSkipedFailTests; }; static const apr_getopt_option_t TEST_CL_OPTIONS[] = |