diff options
Diffstat (limited to 'indra/llmessage')
200 files changed, 14886 insertions, 9269 deletions
diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt new file mode 100644 index 0000000000..1cad0f6d22 --- /dev/null +++ b/indra/llmessage/CMakeLists.txt @@ -0,0 +1,258 @@ +# -*- cmake -*- + +project(llmessage) + +include(00-Common) +include(GoogleMock) +include(LLAddBuildTest) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLVFS) +include(LLAddBuildTest) +include(Tut) + +include_directories (${CMAKE_CURRENT_SOURCE_DIR}) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ) + +set(llmessage_SOURCE_FILES + llares.cpp + llareslistener.cpp + llassetstorage.cpp + llavatarnamecache.cpp + llblowfishcipher.cpp + llbuffer.cpp + llbufferstream.cpp + llcachename.cpp + llchainio.cpp + llcircuit.cpp + llclassifiedflags.cpp + llcurl.cpp + lldatapacker.cpp + lldispatcher.cpp + llfiltersd2xmlrpc.cpp + llhost.cpp + llhttpassetstorage.cpp + llhttpclient.cpp + llhttpclientadapter.cpp + llhttpnode.cpp + llhttpsender.cpp + llinstantmessage.cpp + lliobuffer.cpp + lliohttpserver.cpp + lliopipe.cpp + lliosocket.cpp + llioutil.cpp + llmail.cpp + llmessagebuilder.cpp + llmessageconfig.cpp + llmessagereader.cpp + llmessagetemplate.cpp + llmessagetemplateparser.cpp + llmessagethrottle.cpp + llmime.cpp + llnamevalue.cpp + llnullcipher.cpp + llpacketack.cpp + llpacketbuffer.cpp + llpacketring.cpp + llpartdata.cpp + llpumpio.cpp + llregionpresenceverifier.cpp + llsdappservices.cpp + llsdhttpserver.cpp + llsdmessage.cpp + llsdmessagebuilder.cpp + llsdmessagereader.cpp + llsdrpcclient.cpp + llsdrpcserver.cpp + llservicebuilder.cpp + llservice.cpp + llstoredmessage.cpp + lltemplatemessagebuilder.cpp + lltemplatemessagedispatcher.cpp + lltemplatemessagereader.cpp + llthrottle.cpp + lltransfermanager.cpp + lltransfersourceasset.cpp + lltransfersourcefile.cpp + lltransfertargetfile.cpp + lltransfertargetvfile.cpp + lltrustedmessageservice.cpp + llurlrequest.cpp + lluseroperation.cpp + llxfer.cpp + llxfer_file.cpp + llxfermanager.cpp + llxfer_mem.cpp + llxfer_vfile.cpp + llxorcipher.cpp + machine.cpp + message.cpp + message_prehash.cpp + message_string_table.cpp + net.cpp + partsyspacket.cpp + patch_code.cpp + patch_dct.cpp + patch_idct.cpp + sound_ids.cpp + ) + +set(llmessage_HEADER_FILES + CMakeLists.txt + + llares.h + llareslistener.h + llassetstorage.h + llavatarnamecache.h + llblowfishcipher.h + llbuffer.h + llbufferstream.h + llcachename.h + llchainio.h + llcipher.h + llcircuit.h + llclassifiedflags.h + llcurl.h + lldatapacker.h + lldbstrings.h + lldispatcher.h + lleventflags.h + llfiltersd2xmlrpc.h + llfollowcamparams.h + llhost.h + llhttpassetstorage.h + llhttpclient.h + llhttpclientinterface.h + llhttpclientadapter.h + llhttpnode.h + llhttpnodeadapter.h + llhttpsender.h + llinstantmessage.h + llinvite.h + lliobuffer.h + lliohttpserver.h + lliopipe.h + lliosocket.h + llioutil.h + llloginflags.h + llmail.h + llmessagebuilder.h + llmessageconfig.h + llmessagereader.h + llmessagetemplate.h + llmessagetemplateparser.h + llmessagethrottle.h + llmime.h + llmsgvariabletype.h + llnamevalue.h + llnullcipher.h + llpacketack.h + llpacketbuffer.h + llpacketring.h + llpartdata.h + llpumpio.h + llqueryflags.h + llregionflags.h + llregionhandle.h + llregionpresenceverifier.h + llsdappservices.h + llsdhttpserver.h + llsdmessage.h + llsdmessagebuilder.h + llsdmessagereader.h + llsdrpcclient.h + llsdrpcserver.h + llservice.h + llservicebuilder.h + llstoredmessage.h + lltaskname.h + llteleportflags.h + lltemplatemessagebuilder.h + lltemplatemessagedispatcher.h + lltemplatemessagereader.h + llthrottle.h + lltransfermanager.h + lltransfersourceasset.h + lltransfersourcefile.h + lltransfertargetfile.h + lltransfertargetvfile.h + lltrustedmessageservice.h + llurlrequest.h + lluseroperation.h + llvehicleparams.h + llxfer.h + llxfermanager.h + llxfer_file.h + llxfer_mem.h + llxfer_vfile.h + llxorcipher.h + machine.h + mean_collision_data.h + message.h + message_prehash.h + net.h + partsyspacket.h + patch_code.h + patch_dct.h + sound_ids.h + ) + +set_source_files_properties(${llmessage_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llmessage_SOURCE_FILES ${llmessage_HEADER_FILES}) + +add_library (llmessage ${llmessage_SOURCE_FILES}) +target_link_libraries( + llmessage + ${CURL_LIBRARIES} + ${CARES_LIBRARIES} + ${OPENSSL_LIBRARIES} + ${CRYPTO_LIBRARIES} + ${XMLRPCEPI_LIBRARIES} + ) + +# tests +if (LL_TESTS) + SET(llmessage_TEST_SOURCE_FILES + # llhttpclientadapter.cpp + llmime.cpp + llnamevalue.cpp + lltrustedmessageservice.cpp + lltemplatemessagedispatcher.cpp + llregionpresenceverifier.cpp + ) + LL_ADD_PROJECT_UNIT_TESTS(llmessage "${llmessage_TEST_SOURCE_FILES}") + + # set(TEST_DEBUG on) + set(test_libs + ${LLMESSAGE_LIBRARIES} + ${WINDOWS_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLCOMMON_LIBRARIES} + ${GOOGLEMOCK_LIBRARIES} + ) + + LL_ADD_INTEGRATION_TEST( + llsdmessage + "llsdmessage.cpp" + "${test_libs}" + ${PYTHON_EXECUTABLE} + "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_llsdmessage_peer.py" + ) + + LL_ADD_INTEGRATION_TEST(llavatarnamecache "" "${test_libs}") + LL_ADD_INTEGRATION_TEST(llhost "" "${test_libs}") + LL_ADD_INTEGRATION_TEST(llpartdata "" "${test_libs}") + LL_ADD_INTEGRATION_TEST(llxfer_file "" "${test_libs}") +endif (LL_TESTS) + diff --git a/indra/llmessage/llares.cpp b/indra/llmessage/llares.cpp new file mode 100644 index 0000000000..5a67035ed1 --- /dev/null +++ b/indra/llmessage/llares.cpp @@ -0,0 +1,815 @@ +/** + * @file llares.cpp + * @author Bryan O'Sullivan + * @date 2007-08-15 + * @brief Wrapper for asynchronous DNS lookups. + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "llares.h" + +#include <ares_dns.h> +#include <ares_version.h> + +#include "apr_portable.h" +#include "apr_network_io.h" +#include "apr_poll.h" + +#include "llapr.h" +#include "llareslistener.h" + +#if defined(LL_WINDOWS) +#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally +# define ns_c_in 1 +# define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ +# define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ +# define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ +#else +# include <arpa/nameser.h> +#endif + +LLAres::HostResponder::~HostResponder() +{ +} + +void LLAres::HostResponder::hostResult(const hostent *ent) +{ + llinfos << "LLAres::HostResponder::hostResult not implemented" << llendl; +} + +void LLAres::HostResponder::hostError(int code) +{ + llinfos << "LLAres::HostResponder::hostError " << code << ": " + << LLAres::strerror(code) << llendl; +} + +LLAres::NameInfoResponder::~NameInfoResponder() +{ +} + +void LLAres::NameInfoResponder::nameInfoResult(const char *node, + const char *service) +{ + llinfos << "LLAres::NameInfoResponder::nameInfoResult not implemented" + << llendl; +} + +void LLAres::NameInfoResponder::nameInfoError(int code) +{ + llinfos << "LLAres::NameInfoResponder::nameInfoError " << code << ": " + << LLAres::strerror(code) << llendl; +} + +LLAres::QueryResponder::~QueryResponder() +{ +} + +void LLAres::QueryResponder::queryResult(const char *buf, size_t len) +{ + llinfos << "LLAres::QueryResponder::queryResult not implemented" + << llendl; +} + +void LLAres::QueryResponder::queryError(int code) +{ + llinfos << "LLAres::QueryResponder::queryError " << code << ": " + << LLAres::strerror(code) << llendl; +} + +LLAres::LLAres() : + chan_(NULL), + mInitSuccess(false), + mListener(new LLAresListener(this)) +{ + if (ares_library_init( ARES_LIB_INIT_ALL ) != ARES_SUCCESS || + ares_init(&chan_) != ARES_SUCCESS) + { + llwarns << "Could not succesfully initialize ares!" << llendl; + return; + } + + mInitSuccess = true; +} + +LLAres::~LLAres() +{ + ares_destroy(chan_); + ares_library_cleanup(); +} + +void LLAres::cancel() +{ + ares_cancel(chan_); +} + +static void host_callback_1_5(void *arg, int status, int timeouts, + struct hostent *ent) +{ + LLPointer<LLAres::HostResponder> *resp = + (LLPointer<LLAres::HostResponder> *) arg; + + if (status == ARES_SUCCESS) + { + (*resp)->hostResult(ent); + } else { + (*resp)->hostError(status); + } + + delete resp; +} + +#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4 +static void host_callback(void *arg, int status, struct hostent *ent) +{ + host_callback_1_5(arg, status, 0, ent); +} +#else +# define host_callback host_callback_1_5 +#endif + +void LLAres::getHostByName(const char *name, HostResponder *resp, + int family) +{ + ares_gethostbyname(chan_, name, family, host_callback, + new LLPointer<LLAres::HostResponder>(resp)); +} + +void LLAres::getSrvRecords(const std::string &name, SrvResponder *resp) +{ + search(name, RES_SRV, resp); +} + +void LLAres::rewriteURI(const std::string &uri, UriRewriteResponder *resp) +{ + llinfos << "Rewriting " << uri << llendl; + + resp->mUri = LLURI(uri); + search("_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName(), + RES_SRV, resp); +} + +LLQueryResponder::LLQueryResponder() + : LLAres::QueryResponder(), + mResult(ARES_ENODATA), + mType(RES_INVALID) +{ +} + +int LLQueryResponder::parseRR(const char *buf, size_t len, const char *&pos, + LLPointer<LLDnsRecord> &r) +{ + std::string rrname; + size_t enclen; + int ret; + + // RR name. + + ret = LLAres::expandName(pos, buf, len, rrname, enclen); + if (ret != ARES_SUCCESS) + { + return ret; + } + + pos += enclen; + + if (pos + NS_RRFIXEDSZ > buf + len) + { + return ARES_EBADRESP; + } + + int rrtype = DNS_RR_TYPE(pos); + int rrclass = DNS_RR_CLASS(pos); + int rrttl = DNS_RR_TTL(pos); + int rrlen = DNS_RR_LEN(pos); + + if (rrclass != ns_c_in) + { + return ARES_EBADRESP; + } + + pos += NS_RRFIXEDSZ; + + if (pos + rrlen > buf + len) + { + return ARES_EBADRESP; + } + + switch (rrtype) + { + case RES_A: + r = new LLARecord(rrname, rrttl); + break; + case RES_NS: + r = new LLNsRecord(rrname, rrttl); + break; + case RES_CNAME: + r = new LLCnameRecord(rrname, rrttl); + break; + case RES_PTR: + r = new LLPtrRecord(rrname, rrttl); + break; + case RES_AAAA: + r = new LLAaaaRecord(rrname, rrttl); + break; + case RES_SRV: + r = new LLSrvRecord(rrname, rrttl); + break; + default: + llinfos << "LLQueryResponder::parseRR got unknown RR type " << rrtype + << llendl; + return ARES_EBADRESP; + } + + ret = r->parse(buf, len, pos, rrlen); + + if (ret == ARES_SUCCESS) + { + pos += rrlen; + } else { + r = NULL; + } + + return ret; +} + +int LLQueryResponder::parseSection(const char *buf, size_t len, + size_t count, const char *&pos, + dns_rrs_t &rrs) +{ + int ret = ARES_SUCCESS; + + for (size_t i = 0; i < count; i++) + { + LLPointer<LLDnsRecord> r; + ret = parseRR(buf, len, pos, r); + if (ret != ARES_SUCCESS) + { + break; + } + rrs.push_back(r); + } + + return ret; +} + +void LLQueryResponder::queryResult(const char *buf, size_t len) +{ + const char *pos = buf; + int qdcount = DNS_HEADER_QDCOUNT(pos); + int ancount = DNS_HEADER_ANCOUNT(pos); + int nscount = DNS_HEADER_NSCOUNT(pos); + int arcount = DNS_HEADER_ARCOUNT(pos); + int ret; + + if (qdcount == 0 || ancount + nscount + arcount == 0) + { + ret = ARES_ENODATA; + goto bail; + } + + pos += NS_HFIXEDSZ; + + for (int i = 0; i < qdcount; i++) + { + std::string ignore; + size_t enclen; + + ret = LLAres::expandName(pos, buf, len, i == 0 ? mQuery : ignore, + enclen); + if (ret != ARES_SUCCESS) + { + goto bail; + } + + pos += enclen; + + if (i == 0) + { + int t = DNS_QUESTION_TYPE(pos); + switch (t) + { + case RES_A: + case RES_NS: + case RES_CNAME: + case RES_PTR: + case RES_AAAA: + case RES_SRV: + mType = (LLResType) t; + break; + default: + llinfos << "Cannot grok query type " << t << llendl; + ret = ARES_EBADQUERY; + goto bail; + } + } + + pos += NS_QFIXEDSZ; + if (pos > buf + len) + { + ret = ARES_EBADRESP; + goto bail; + } + } + + ret = parseSection(buf, len, ancount, pos, mAnswers); + if (ret != ARES_SUCCESS) + { + goto bail; + } + + ret = parseSection(buf, len, nscount, pos, mAuthorities); + if (ret != ARES_SUCCESS) + { + goto bail; + } + + ret = parseSection(buf, len, arcount, pos, mAdditional); + +bail: + mResult = ret; + if (mResult == ARES_SUCCESS) + { + querySuccess(); + } else { + queryError(mResult); + } +} + +void LLQueryResponder::querySuccess() +{ + llinfos << "LLQueryResponder::queryResult not implemented" << llendl; +} + +void LLAres::SrvResponder::querySuccess() +{ + if (mType == RES_SRV) + { + srvResult(mAnswers); + } else { + srvError(ARES_EBADRESP); + } +} + +void LLAres::SrvResponder::queryError(int code) +{ + srvError(code); +} + +void LLAres::SrvResponder::srvResult(const dns_rrs_t &ents) +{ + llinfos << "LLAres::SrvResponder::srvResult not implemented" << llendl; + + for (size_t i = 0; i < ents.size(); i++) + { + const LLSrvRecord *s = (const LLSrvRecord *) ents[i].get(); + + llinfos << "[" << i << "] " << s->host() << ":" << s->port() + << " priority " << s->priority() + << " weight " << s->weight() + << llendl; + } +} + +void LLAres::SrvResponder::srvError(int code) +{ + llinfos << "LLAres::SrvResponder::srvError " << code << ": " + << LLAres::strerror(code) << llendl; +} + +static void nameinfo_callback_1_5(void *arg, int status, int timeouts, + char *node, char *service) +{ + LLPointer<LLAres::NameInfoResponder> *resp = + (LLPointer<LLAres::NameInfoResponder> *) arg; + + if (status == ARES_SUCCESS) + { + (*resp)->nameInfoResult(node, service); + } else { + (*resp)->nameInfoError(status); + } + + delete resp; +} + +#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4 +static void nameinfo_callback(void *arg, int status, char *node, char *service) +{ + nameinfo_callback_1_5(arg, status, 0, node, service); +} +#else +# define nameinfo_callback nameinfo_callback_1_5 +#endif + +void LLAres::getNameInfo(const struct sockaddr &sa, socklen_t salen, int flags, + NameInfoResponder *resp) +{ + ares_getnameinfo(chan_, &sa, salen, flags, nameinfo_callback, + new LLPointer<NameInfoResponder>(resp)); +} + +static void search_callback_1_5(void *arg, int status, int timeouts, + unsigned char *abuf, int alen) +{ + LLPointer<LLAres::QueryResponder> *resp = + (LLPointer<LLAres::QueryResponder> *) arg; + + if (status == ARES_SUCCESS) + { + (*resp)->queryResult((const char *) abuf, alen); + } else { + (*resp)->queryError(status); + } + + delete resp; +} + +#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4 +static void search_callback(void *arg, int status, unsigned char *abuf, + int alen) +{ + search_callback_1_5(arg, status, 0, abuf, alen); +} +#else +# define search_callback search_callback_1_5 +#endif + +void LLAres::search(const std::string &query, LLResType type, + QueryResponder *resp) +{ + ares_search(chan_, query.c_str(), ns_c_in, type, search_callback, + new LLPointer<QueryResponder>(resp)); +} + +bool LLAres::process(U64 timeout) +{ + if (!gAPRPoolp) + { + ll_init_apr(); + } + + ares_socket_t socks[ARES_GETSOCK_MAXNUM]; + apr_pollfd_t aprFds[ARES_GETSOCK_MAXNUM]; + apr_int32_t nsds = 0; + int nactive = 0; + int bitmask; + + bitmask = ares_getsock(chan_, socks, ARES_GETSOCK_MAXNUM); + + if (bitmask == 0) + { + return nsds > 0; + } + + apr_status_t status; + LLAPRPool pool; + status = pool.getStatus() ; + ll_apr_assert_status(status); + + for (int i = 0; i < ARES_GETSOCK_MAXNUM; i++) + { + if (ARES_GETSOCK_READABLE(bitmask, i)) + { + aprFds[nactive].reqevents = APR_POLLIN | APR_POLLERR; + } + else if (ARES_GETSOCK_WRITABLE(bitmask, i)) + { + aprFds[nactive].reqevents = APR_POLLOUT | APR_POLLERR; + } else { + continue; + } + + apr_socket_t *aprSock = NULL; + + status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], pool.getAPRPool()); + if (status != APR_SUCCESS) + { + ll_apr_warn_status(status); + return nsds > 0; + } + + aprFds[nactive].desc.s = aprSock; + aprFds[nactive].desc_type = APR_POLL_SOCKET; + aprFds[nactive].p = pool.getAPRPool(); + aprFds[nactive].rtnevents = 0; + aprFds[nactive].client_data = &socks[i]; + + nactive++; + } + + if (nactive > 0) + { + status = apr_poll(aprFds, nactive, &nsds, timeout); + + if (status != APR_SUCCESS && status != APR_TIMEUP) + { + ll_apr_warn_status(status); + } + + for (int i = 0; i < nactive; i++) + { + int evts = aprFds[i].rtnevents; + int ifd = (evts & (APR_POLLIN | APR_POLLERR)) + ? *((int *) aprFds[i].client_data) : ARES_SOCKET_BAD; + int ofd = (evts & (APR_POLLOUT | APR_POLLERR)) + ? *((int *) aprFds[i].client_data) : ARES_SOCKET_BAD; + + ares_process_fd(chan_, ifd, ofd); + } + } + + return nsds > 0; +} + +bool LLAres::processAll() +{ + bool anyProcessed = false, ret; + + do { + timeval tv; + + ret = ares_timeout(chan_, NULL, &tv) != NULL; + + if (ret) + { + ret = process(tv.tv_sec * 1000000LL + tv.tv_usec); + anyProcessed |= ret; + } + } while (ret); + + return anyProcessed; +} + +int LLAres::expandName(const char *encoded, const char *abuf, size_t alen, + std::string &s, size_t &enclen) +{ + char *t; + int ret; + long e; + + ret = ares_expand_name((const unsigned char *) encoded, + (const unsigned char *) abuf, alen, &t, &e); + if (ret == ARES_SUCCESS) + { + s.assign(t); + enclen = e; + ares_free_string(t); + } + return ret; +} + +const char *LLAres::strerror(int code) +{ + return ares_strerror(code); +} + +LLAres *gAres; + +LLAres *ll_init_ares() +{ + if (gAres == NULL) + { + gAres = new LLAres(); + } + return gAres; +} + +LLDnsRecord::LLDnsRecord(LLResType type, const std::string &name, + unsigned ttl) + : LLRefCount(), + mType(type), + mName(name), + mTTL(ttl) +{ +} + +LLHostRecord::LLHostRecord(LLResType type, const std::string &name, + unsigned ttl) + : LLDnsRecord(type, name, ttl) +{ +} + +int LLHostRecord::parse(const char *buf, size_t len, const char *pos, + size_t rrlen) +{ + int ret; + + ret = LLAres::expandName(pos, buf, len, mHost); + if (ret != ARES_SUCCESS) + { + goto bail; + } + + ret = ARES_SUCCESS; + +bail: + return ret; +} + +LLCnameRecord::LLCnameRecord(const std::string &name, unsigned ttl) + : LLHostRecord(RES_CNAME, name, ttl) +{ +} + +LLPtrRecord::LLPtrRecord(const std::string &name, unsigned ttl) + : LLHostRecord(RES_PTR, name, ttl) +{ +} + +LLAddrRecord::LLAddrRecord(LLResType type, const std::string &name, + unsigned ttl) + : LLDnsRecord(type, name, ttl), + + mSize(0) +{ +} + +LLARecord::LLARecord(const std::string &name, unsigned ttl) + : LLAddrRecord(RES_A, name, ttl) +{ +} + +int LLARecord::parse(const char *buf, size_t len, const char *pos, + size_t rrlen) +{ + int ret; + + if (rrlen != sizeof(mSA.sin.sin_addr.s_addr)) + { + ret = ARES_EBADRESP; + goto bail; + } + + memset(&mSA, 0, sizeof(mSA)); + memcpy(&mSA.sin.sin_addr.s_addr, pos, rrlen); + mSA.sin.sin_family = AF_INET6; + mSize = sizeof(mSA.sin); + + ret = ARES_SUCCESS; + +bail: + return ret; +} + +LLAaaaRecord::LLAaaaRecord(const std::string &name, unsigned ttl) + : LLAddrRecord(RES_AAAA, name, ttl) +{ +} + +int LLAaaaRecord::parse(const char *buf, size_t len, const char *pos, + size_t rrlen) +{ + int ret; + + if (rrlen != sizeof(mSA.sin6.sin6_addr)) + { + ret = ARES_EBADRESP; + goto bail; + } + + memset(&mSA, 0, sizeof(mSA)); + memcpy(&mSA.sin6.sin6_addr.s6_addr, pos, rrlen); + mSA.sin6.sin6_family = AF_INET6; + mSize = sizeof(mSA.sin6); + + ret = ARES_SUCCESS; + +bail: + return ret; +} + +LLSrvRecord::LLSrvRecord(const std::string &name, unsigned ttl) + : LLHostRecord(RES_SRV, name, ttl), + + mPriority(0), + mWeight(0), + mPort(0) +{ +} + +int LLSrvRecord::parse(const char *buf, size_t len, const char *pos, + size_t rrlen) +{ + int ret; + + if (rrlen < 6) + { + ret = ARES_EBADRESP; + goto bail; + } + + memcpy(&mPriority, pos, 2); + memcpy(&mWeight, pos + 2, 2); + memcpy(&mPort, pos + 4, 2); + + mPriority = ntohs(mPriority); + mWeight = ntohs(mWeight); + mPort = ntohs(mPort); + + ret = LLHostRecord::parse(buf, len, pos + 6, rrlen - 6); + +bail: + return ret; +} + +LLNsRecord::LLNsRecord(const std::string &name, unsigned ttl) + : LLHostRecord(RES_NS, name, ttl) +{ +} + +void LLAres::UriRewriteResponder::queryError(int code) +{ + std::vector<std::string> uris; + uris.push_back(mUri.asString()); + rewriteResult(uris); +} + +void LLAres::UriRewriteResponder::querySuccess() +{ + std::vector<std::string> uris; + + if (mType != RES_SRV) + { + goto bail; + } + + for (size_t i = 0; i < mAnswers.size(); i++) + { + const LLSrvRecord *r = (const LLSrvRecord *) mAnswers[i].get(); + + if (r->type() == RES_SRV) + { + // Check the domain in the response to ensure that it's + // the same as the domain in the request, so that bad guys + // can't forge responses that point to their own login + // servers with their own certificates. + + // Hard-coding the domain to check here is a bit of a + // hack. Hoist it to an outer caller if anyone ever needs + // this functionality on other domains. + + static const std::string domain(".lindenlab.com"); + const std::string &host = r->host(); + + std::string::size_type s = host.find(domain) + domain.length(); + + if (s != host.length() && s != host.length() - 1) + { + continue; + } + + LLURI uri(mUri.scheme(), + mUri.userName(), + mUri.password(), + r->host(), + mUri.defaultPort() ? r->port() : mUri.hostPort(), + mUri.escapedPath(), + mUri.escapedQuery()); + uris.push_back(uri.asString()); + } + } + + if (!uris.empty()) + { + goto done; + } + +bail: + uris.push_back(mUri.asString()); + +done: + rewriteResult(uris); +} + +void LLAres::UriRewriteResponder::rewriteResult( + const std::vector<std::string> &uris) +{ + llinfos << "LLAres::UriRewriteResponder::rewriteResult not implemented" + << llendl; + + for (size_t i = 0; i < uris.size(); i++) + { + llinfos << "[" << i << "] " << uris[i] << llendl; + } +} diff --git a/indra/llmessage/llares.h b/indra/llmessage/llares.h new file mode 100644 index 0000000000..800781ee88 --- /dev/null +++ b/indra/llmessage/llares.h @@ -0,0 +1,582 @@ +/** + * @file llares.h + * @author Bryan O'Sullivan + * @date 2007-08-15 + * @brief Wrapper for asynchronous DNS lookups. + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLARES_H +#define LL_LLARES_H + +#ifdef LL_WINDOWS +// ares.h is broken on windows in that it depends on types defined in ws2tcpip.h +// we need to include them first to work around it, but the headers issue warnings +# pragma warning(push) +# pragma warning(disable:4996) +# include <winsock2.h> +# include <ws2tcpip.h> +# pragma warning(pop) +#endif + +#ifdef LL_STANDALONE +# include <ares.h> +#else +# include <ares/ares.h> +#endif + +#include "llpointer.h" +#include "llrefcount.h" +#include "lluri.h" + +#include <boost/shared_ptr.hpp> + +class LLQueryResponder; +class LLAresListener; + +/** + * @brief Supported DNS RR types. + */ +enum LLResType +{ + RES_INVALID = 0, /**< Cookie. */ + RES_A = 1, /**< "A" record. IPv4 address. */ + RES_NS = 2, /**< "NS" record. Authoritative server. */ + RES_CNAME = 5, /**< "CNAME" record. Canonical name. */ + RES_PTR = 12, /**< "PTR" record. Domain name pointer. */ + RES_AAAA = 28, /**< "AAAA" record. IPv6 Address. */ + RES_SRV = 33, /**< "SRV" record. Server Selection. */ + RES_MAX = 65536 /**< Sentinel; RR types are 16 bits wide. */ +}; + +/** + * @class LLDnsRecord + * @brief Base class for all DNS RR types. + */ +class LLDnsRecord : public LLRefCount +{ +protected: + friend class LLQueryResponder; + + LLResType mType; + std::string mName; + unsigned mTTL; + + virtual int parse(const char *buf, size_t len, const char *pos, + size_t rrlen) = 0; + + LLDnsRecord(LLResType type, const std::string &name, unsigned ttl); + +public: + /** + * @brief Record name. + */ + const std::string &name() const { return mName; } + + /** + * @brief Time-to-live value, in seconds. + */ + unsigned ttl() const { return mTTL; } + + /** + * @brief RR type. + */ + LLResType type() const { return mType; } +}; + +/** + * @class LLAddrRecord + * @brief Base class for address-related RRs. + */ +class LLAddrRecord : public LLDnsRecord +{ +protected: + friend class LLQueryResponder; + + LLAddrRecord(LLResType type, const std::string &name, unsigned ttl); + + union + { + sockaddr sa; + sockaddr_in sin; + sockaddr_in6 sin6; + } mSA; + + socklen_t mSize; + +public: + /** + * @brief Generic socket address. + */ + const sockaddr &addr() const { return mSA.sa; } + + /** + * @brief Size of the socket structure. + */ + socklen_t size() const { return mSize; } +}; + +/** + * @class LLARecord + * @brief A RR, for IPv4 addresses. + */ +class LLARecord : public LLAddrRecord +{ +protected: + friend class LLQueryResponder; + + LLARecord(const std::string &name, unsigned ttl); + + int parse(const char *buf, size_t len, const char *pos, size_t rrlen); + +public: + /** + * @brief Socket address. + */ + const sockaddr_in &addr_in() const { return mSA.sin; } +}; + +/** + * @class LLAaaaRecord + * @brief AAAA RR, for IPv6 addresses. + */ +class LLAaaaRecord : public LLAddrRecord +{ +protected: + friend class LLQueryResponder; + + LLAaaaRecord(const std::string &name, unsigned ttl); + + int parse(const char *buf, size_t len, const char *pos, size_t rrlen); + +public: + /** + * @brief Socket address. + */ + const sockaddr_in6 &addr_in6() const { return mSA.sin6; } +}; + +/** + * @class LLHostRecord + * @brief Base class for host-related RRs. + */ +class LLHostRecord : public LLDnsRecord +{ +protected: + LLHostRecord(LLResType type, const std::string &name, unsigned ttl); + + int parse(const char *buf, size_t len, const char *pos, size_t rrlen); + + std::string mHost; + +public: + /** + * @brief Host name. + */ + const std::string &host() const { return mHost; } +}; + +/** + * @class LLCnameRecord + * @brief CNAME RR. + */ +class LLCnameRecord : public LLHostRecord +{ +protected: + friend class LLQueryResponder; + + LLCnameRecord(const std::string &name, unsigned ttl); +}; + +/** + * @class LLPtrRecord + * @brief PTR RR. + */ +class LLPtrRecord : public LLHostRecord +{ +protected: + friend class LLQueryResponder; + + LLPtrRecord(const std::string &name, unsigned ttl); +}; + +/** + * @class LLSrvRecord + * @brief SRV RR. + */ +class LLSrvRecord : public LLHostRecord +{ +protected: + U16 mPriority; + U16 mWeight; + U16 mPort; + + int parse(const char *buf, size_t len, const char *pos, size_t rrlen); + +public: + LLSrvRecord(const std::string &name, unsigned ttl); + + /** + * @brief Service priority. + */ + U16 priority() const { return mPriority; } + + /** + * @brief Service weight. + */ + U16 weight() const { return mWeight; } + + /** + * @brief Port number of service. + */ + U16 port() const { return mPort; } + + /** + * @brief Functor for sorting SRV records by priority. + */ + struct ComparePriorityLowest + { + bool operator()(const LLSrvRecord& lhs, const LLSrvRecord& rhs) + { + return lhs.mPriority < rhs.mPriority; + } + }; +}; + +/** + * @class LLNsRecord + * @brief NS RR. + */ +class LLNsRecord : public LLHostRecord +{ +public: + LLNsRecord(const std::string &name, unsigned ttl); +}; + +class LLQueryResponder; + +/** + * @class LLAres + * @brief Asynchronous address resolver. + */ +class LLAres +{ +public: + /** + * @class HostResponder + * @brief Base class for responding to hostname lookups. + * @see LLAres::getHostByName + */ + class HostResponder : public LLRefCount + { + public: + virtual ~HostResponder(); + + virtual void hostResult(const hostent *ent); + virtual void hostError(int code); + }; + + /** + * @class NameInfoResponder + * @brief Base class for responding to address lookups. + * @see LLAres::getNameInfo + */ + class NameInfoResponder : public LLRefCount + { + public: + virtual ~NameInfoResponder(); + + virtual void nameInfoResult(const char *node, const char *service); + virtual void nameInfoError(int code); + }; + + /** + * @class QueryResponder + * @brief Base class for responding to custom searches. + * @see LLAres::search + */ + class QueryResponder : public LLRefCount + { + public: + virtual ~QueryResponder(); + + virtual void queryResult(const char *buf, size_t len); + virtual void queryError(int code); + }; + + class SrvResponder; + class UriRewriteResponder; + + LLAres(); + + ~LLAres(); + + /** + * Cancel all outstanding requests. The error methods of the + * corresponding responders will be called, with ARES_ETIMEOUT. + */ + void cancel(); + + /** + * Look up the address of a host. + * + * @param name name of host to look up + * @param resp responder to call with result + * @param family AF_INET for IPv4 addresses, AF_INET6 for IPv6 + */ + void getHostByName(const std::string &name, HostResponder *resp, + int family = AF_INET) { + getHostByName(name.c_str(), resp, family); + } + + /** + * Look up the address of a host. + * + * @param name name of host to look up + * @param resp responder to call with result + * @param family AF_INET for IPv4 addresses, AF_INET6 for IPv6 + */ + void getHostByName(const char *name, HostResponder *resp, + int family = PF_INET); + + /** + * Look up the name associated with a socket address. + * + * @param sa socket address to look up + * @param salen size of socket address + * @param flags flags to use + * @param resp responder to call with result + */ + void getNameInfo(const struct sockaddr &sa, socklen_t salen, int flags, + NameInfoResponder *resp); + + /** + * Look up SRV (service location) records for a service name. + * + * @param name service name (e.g. "_https._tcp.login.agni.lindenlab.com") + * @param resp responder to call with result + */ + void getSrvRecords(const std::string &name, SrvResponder *resp); + + /** + * Rewrite a URI, using SRV (service location) records for its + * protocol if available. If no SRV records are published, the + * existing URI is handed to the responder. + * + * @param uri URI to rewrite + * @param resp responder to call with result + */ + void rewriteURI(const std::string &uri, + UriRewriteResponder *resp); + + /** + * Start a custom search. + * + * @param query query to make + * @param type type of query to perform + * @param resp responder to call with result + */ + void search(const std::string &query, LLResType type, + QueryResponder *resp); + + /** + * Process any outstanding queries. This method takes an optional + * timeout parameter (specified in microseconds). If provided, it + * will block the calling thread for that length of time to await + * possible responses. A timeout of zero will return immediately + * if there are no responses or timeouts to process. + * + * @param timeoutUsecs number of microseconds to block before timing out + * @return whether any responses were processed + */ + bool process(U64 timeoutUsecs = 0); + + /** + * Process all outstanding queries, blocking the calling thread + * until all have either been responded to or timed out. + * + * @return whether any responses were processed + */ + bool processAll(); + + /** + * Expand a DNS-encoded compressed string into a normal string. + * + * @param encoded the encoded name (null-terminated) + * @param abuf the response buffer in which the string is embedded + * @param alen the length of the response buffer + * @param s the string into which to place the result + * @return ARES_SUCCESS on success, otherwise an error indicator + */ + static int expandName(const char *encoded, const char *abuf, size_t alen, + std::string &s) { + size_t ignore; + return expandName(encoded, abuf, alen, s, ignore); + } + + static int expandName(const char *encoded, const char *abuf, size_t alen, + std::string &s, size_t &enclen); + + /** + * Return a string describing an error code. + */ + static const char *strerror(int code); + + bool isInitialized(void) { return mInitSuccess; } + +protected: + ares_channel chan_; + bool mInitSuccess; + // boost::scoped_ptr would actually fit the requirement better, but it + // can't handle incomplete types as boost::shared_ptr can. + boost::shared_ptr<LLAresListener> mListener; +}; + +/** + * An ordered collection of DNS resource records. + */ +typedef std::vector<LLPointer<LLDnsRecord> > dns_rrs_t; + +/** + * @class LLQueryResponder + * @brief Base class for friendly handling of DNS query responses. + * + * This class parses a DNS response and represents it in a friendly + * manner. + * + * @see LLDnsRecord + * @see LLARecord + * @see LLNsRecord + * @see LLCnameRecord + * @see LLPtrRecord + * @see LLAaaaRecord + * @see LLSrvRecord + */ +class LLQueryResponder : public LLAres::QueryResponder +{ +protected: + int mResult; + std::string mQuery; + LLResType mType; + + dns_rrs_t mAnswers; + dns_rrs_t mAuthorities; + dns_rrs_t mAdditional; + + /** + * Parse a single RR. + */ + int parseRR(const char *buf, size_t len, const char *&pos, + LLPointer<LLDnsRecord> &r); + /** + * Parse one section of a response. + */ + int parseSection(const char *buf, size_t len, + size_t count, const char *& pos, dns_rrs_t &rrs); + + void queryResult(const char *buf, size_t len); + virtual void querySuccess(); + +public: + LLQueryResponder(); + + /** + * Indicate whether the response could be parsed successfully. + */ + bool valid() const { return mResult == ARES_SUCCESS; } + + /** + * The more detailed result of parsing the response. + */ + int result() const { return mResult; } + + /** + * Return the query embedded in the response. + */ + const std::string &query() const { return mQuery; } + + /** + * Return the contents of the "answers" section of the response. + */ + const dns_rrs_t &answers() const { return mAnswers; } + + /** + * Return the contents of the "authorities" section of the + * response. + */ + const dns_rrs_t &authorities() const { return mAuthorities; } + + /** + * Return the contents of the "additional records" section of the + * response. + */ + const dns_rrs_t &additional() const { return mAdditional; } +}; + +/** + * @class LLAres::SrvResponder + * @brief Class for handling SRV query responses. + */ +class LLAres::SrvResponder : public LLQueryResponder +{ +public: + friend void LLAres::getSrvRecords(const std::string &name, + SrvResponder *resp); + void querySuccess(); + void queryError(int code); + + virtual void srvResult(const dns_rrs_t &ents); + virtual void srvError(int code); +}; + +/** + * @class LLAres::UriRewriteResponder + * @brief Class for handling URI rewrites based on SRV records. + */ +class LLAres::UriRewriteResponder : public LLQueryResponder +{ +protected: + LLURI mUri; + +public: + friend void LLAres::rewriteURI(const std::string &uri, + UriRewriteResponder *resp); + void querySuccess(); + void queryError(int code); + + virtual void rewriteResult(const std::vector<std::string> &uris); +}; + +/** + * Singleton responder. + */ +extern LLAres *gAres; + +/** + * Set up the singleton responder. It's safe to call this more than + * once from within a single thread, but this function is not + * thread safe. + */ +extern LLAres *ll_init_ares(); + +#endif // LL_LLARES_H diff --git a/indra/llmessage/llareslistener.cpp b/indra/llmessage/llareslistener.cpp new file mode 100644 index 0000000000..58b8a05a9e --- /dev/null +++ b/indra/llmessage/llareslistener.cpp @@ -0,0 +1,97 @@ +/** + * @file llareslistener.cpp + * @author Nat Goodspeed + * @date 2009-03-18 + * @brief Implementation for llareslistener. + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +// Precompiled header +#include "linden_common.h" +// associated header +#include "llareslistener.h" +// STL headers +// std headers +// external library headers +// other Linden headers +#include "llares.h" +#include "llerror.h" +#include "llevents.h" +#include "llsdutil.h" + +LLAresListener::LLAresListener(LLAres* llares): + LLEventAPI("LLAres", + "LLAres listener to request DNS operations"), + mAres(llares) +{ + // add() every method we want to be able to invoke via this event API. + // Optional last parameter validates expected LLSD request structure. + add("rewriteURI", + "Given [\"uri\"], return on [\"reply\"] an array of alternative URIs.\n" + "On failure, returns an array containing only the original URI, so\n" + "failure case can be processed like success case.", + &LLAresListener::rewriteURI, + LLSD().with("uri", LLSD()).with("reply", LLSD())); +} + +/// This UriRewriteResponder subclass packages returned URIs as an LLSD +/// array to send back to the requester. +class UriRewriteResponder: public LLAres::UriRewriteResponder +{ +public: + /** + * Specify the request, containing the event pump name on which to send + * the reply. + */ + UriRewriteResponder(const LLSD& request): + mReqID(request), + mPumpName(request["reply"]) + {} + + /// Called by base class with results. This is called in both the + /// success and error cases. On error, the calling logic passes the + /// original URI. + virtual void rewriteResult(const std::vector<std::string>& uris) + { + LLSD result; + for (std::vector<std::string>::const_iterator ui(uris.begin()), uend(uris.end()); + ui != uend; ++ui) + { + result.append(*ui); + } + // This call knows enough to avoid trying to insert a map key into an + // LLSD array. It's there so that if, for any reason, we ever decide + // to change the response from array to map, it will Just Start Working. + mReqID.stamp(result); + LLEventPumps::instance().obtain(mPumpName).post(result); + } + +private: + LLReqID mReqID; + const std::string mPumpName; +}; + +void LLAresListener::rewriteURI(const LLSD& data) +{ + mAres->rewriteURI(data["uri"], new UriRewriteResponder(data)); +} diff --git a/indra/llmessage/llareslistener.h b/indra/llmessage/llareslistener.h new file mode 100644 index 0000000000..780dcdd9c5 --- /dev/null +++ b/indra/llmessage/llareslistener.h @@ -0,0 +1,53 @@ +/** + * @file llareslistener.h + * @author Nat Goodspeed + * @date 2009-03-18 + * @brief LLEventPump API for LLAres. This header doesn't actually define the + * API; the API is defined by the pump name on which this class + * listens, and by the expected content of LLSD it receives. + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLARESLISTENER_H) +#define LL_LLARESLISTENER_H + +#include "lleventapi.h" + +class LLAres; +class LLSD; + +/// Listen on an LLEventPump with specified name for LLAres request events. +class LLAresListener: public LLEventAPI +{ +public: + /// Bind the LLAres instance to use (e.g. gAres) + LLAresListener(LLAres* llares); + +private: + /// command["op"] == "rewriteURI" + void rewriteURI(const LLSD& data); + + LLAres* mAres; +}; + +#endif /* ! defined(LL_LLARESLISTENER_H) */ diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index e2043144b8..b26d412e9f 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -2,30 +2,25 @@ * @file llassetstorage.cpp * @brief Implementation of the base asset storage system. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -42,6 +37,7 @@ #include "llstring.h" #include "lldir.h" #include "llsd.h" +#include "llframetimer.h" // this library includes #include "message.h" @@ -58,7 +54,13 @@ LLAssetStorage *gAssetStorage = NULL; LLMetrics *LLAssetStorage::metric_recipient = NULL; -const LLUUID CATEGORIZE_LOST_AND_FOUND_ID("00000000-0000-0000-0000-000000000010"); +const LLUUID CATEGORIZE_LOST_AND_FOUND_ID(std::string("00000000-0000-0000-0000-000000000010")); + +const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds + +LLTempAssetStorage::~LLTempAssetStorage() +{ +} ///---------------------------------------------------------------------------- /// LLAssetInfo @@ -133,20 +135,20 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv ) str.assign( nv.mName ); pos1 = str.find('|'); buf.assign( str, 0, pos1++ ); - mType = LLAssetType::lookup( buf.c_str() ); + mType = LLAssetType::lookup( buf ); buf.assign( str, pos1, std::string::npos ); - mUuid.set( buf.c_str() ); + mUuid.set( buf ); // convert the value to useful information str.assign( nv.getAsset() ); pos1 = str.find('|'); buf.assign( str, 0, pos1++ ); - mCreatorID.set( buf.c_str() ); + mCreatorID.set( buf ); pos2 = str.find( '|', pos1 ); buf.assign( str, pos1, (pos2++) - pos1 ); - setName( buf.c_str() ); + setName( buf ); buf.assign( str, pos2, std::string::npos ); - setDescription( buf.c_str() ); + setDescription( buf ); llinfos << "uuid: " << mUuid << llendl; llinfos << "creator: " << mCreatorID << llendl; } @@ -275,28 +277,30 @@ LLEstateAssetRequest::~LLEstateAssetRequest() // TODO: rework tempfile handling? -LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, const LLHost &upstream_host) +LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, LLVFS *static_vfs, const LLHost &upstream_host) { - _init(msg, xfer, vfs, upstream_host); + _init(msg, xfer, vfs, static_vfs, upstream_host); } LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, - LLVFS *vfs) + LLVFS *vfs, LLVFS *static_vfs) { - _init(msg, xfer, vfs, LLHost::invalid); + _init(msg, xfer, vfs, static_vfs, LLHost::invalid); } void LLAssetStorage::_init(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, + LLVFS *static_vfs, const LLHost &upstream_host) { mShutDown = FALSE; mMessageSys = msg; mXferManager = xfer; mVFS = vfs; + mStaticVFS = static_vfs; setUpstream(upstream_host); msg->setHandlerFuncFast(_PREHASH_AssetUploadComplete, processUploadComplete, (void **)this); @@ -314,11 +318,14 @@ LLAssetStorage::~LLAssetStorage() // unregister our callbacks with the message system gMessageSystem->setHandlerFuncFast(_PREHASH_AssetUploadComplete, NULL, NULL); } + + // Clear the toxic asset map + mToxicAssetMap.clear(); } void LLAssetStorage::setUpstream(const LLHost &upstream_host) { - llinfos << "AssetStorage: Setting upstream provider to " << upstream_host << llendl; + LL_DEBUGS("AppInit") << "AssetStorage: Setting upstream provider to " << upstream_host << LL_ENDL; mUpstreamHost = upstream_host; } @@ -385,7 +392,33 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error) BOOL LLAssetStorage::hasLocalAsset(const LLUUID &uuid, const LLAssetType::EType type) { - return mVFS->getExists(uuid, type); + return mStaticVFS->getExists(uuid, type) || mVFS->getExists(uuid, type); +} + +bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAssetType::EType type, + LLGetAssetCallback callback, void *user_data) +{ + BOOL exists = mStaticVFS->getExists(uuid, type); + if (exists) + { + LLVFile file(mStaticVFS, uuid, type); + U32 size = file.getSize(); + if (size > 0) + { + // we've already got the file + if (callback) + { + callback(mStaticVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); + } + return true; + } + else + { + llwarns << "Asset vfile " << uuid << ":" << type + << " found in static cache with bad size " << file.getSize() << ", ignoring" << llendl; + } + } + return false; } /////////////////////////////////////////////////////////////////////////// @@ -393,12 +426,15 @@ BOOL LLAssetStorage::hasLocalAsset(const LLUUID &uuid, const LLAssetType::EType /////////////////////////////////////////////////////////////////////////// // IW - uuid is passed by value to avoid side effects, please don't re-add & -void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, void (*callback)(LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), void *user_data, BOOL is_priority) +void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LLGetAssetCallback callback, void *user_data, BOOL is_priority) { lldebugs << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl; + llinfos << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl; + if (mShutDown) { + llinfos << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << llendl; return; // don't get the asset or do any callbacks, we are shutting down } @@ -412,11 +448,30 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo return; } + // Try static VFS first. + if (findInStaticVFSAndInvokeCallback(uuid,type,callback,user_data)) + { + llinfos << "ASSET_TRACE asset " << uuid << " found in static VFS" << llendl; + return; + } + BOOL exists = mVFS->getExists(uuid, type); LLVFile file(mVFS, uuid, type); U32 size = exists ? file.getSize() : 0; - if (size < 1) + if (size > 0) + { + // we've already got the file + // theoretically, partial files w/o a pending request shouldn't happen + // unless there's a weird error + if (callback) + { + callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); + } + + llinfos << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl; + } + else { if (exists) { @@ -455,16 +510,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo // This can be overridden by subclasses _queueDataRequest(uuid, type, callback, user_data, duplicate, is_priority); } - else - { - // we've already got the file - // theoretically, partial files w/o a pending request shouldn't happen - // unless there's a weird error - if (callback) - { - callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); - } - } + } void LLAssetStorage::_queueDataRequest(const LLUUID& uuid, LLAssetType::EType atype, @@ -517,6 +563,8 @@ void LLAssetStorage::downloadCompleteCallback( LLAssetType::EType file_type, void* user_data, LLExtStat ext_status) { + llinfos << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << llendl; + lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id << "," << LLAssetType::lookup(file_type) << llendl; LLAssetRequest* req = (LLAssetRequest*)user_data; @@ -532,8 +580,19 @@ void LLAssetStorage::downloadCompleteCallback( return; } - req->setUUID(file_id); - req->setType(file_type); + // Inefficient since we're doing a find through a list that may have thousands of elements. + // This is due for refactoring; we will probably change mPendingDownloads into a set. + request_list_t::iterator download_iter = std::find(gAssetStorage->mPendingDownloads.begin(), + gAssetStorage->mPendingDownloads.end(), + req); + // If the LLAssetRequest doesn't exist in the downloads queue, then it either has already been deleted + // by _cleanupRequests, or it's a transfer. + if (download_iter != gAssetStorage->mPendingDownloads.end()) + { + req->setUUID(file_id); + req->setType(file_type); + } + if (LL_ERR_NOERR == result) { // we might have gotten a zero-size file @@ -556,7 +615,7 @@ void LLAssetStorage::downloadCompleteCallback( { request_list_t::iterator curiter = iter++; LLAssetRequest* tmp = *curiter; - if ((tmp->getUUID() == req->getUUID()) && (tmp->getType()== req->getType())) + if ((tmp->getUUID() == file_id) && (tmp->getType()== file_type)) { requests.push_front(tmp); iter = gAssetStorage->mPendingDownloads.erase(curiter); @@ -594,11 +653,27 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen return; } + // Try static VFS first. + if (findInStaticVFSAndInvokeCallback(asset_id,atype,callback,user_data)) + { + return; + } + BOOL exists = mVFS->getExists(asset_id, atype); LLVFile file(mVFS, asset_id, atype); U32 size = exists ? file.getSize() : 0; - if (size < 1) + if (size > 0) + { + // we've already got the file + // theoretically, partial files w/o a pending request shouldn't happen + // unless there's a weird error + if (callback) + { + callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); + } + } + else { if (exists) { @@ -649,16 +724,6 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen } } } - else - { - // we've already got the file - // theoretically, partial files w/o a pending request shouldn't happen - // unless there's a weird error - if (callback) - { - callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); - } - } } void LLAssetStorage::downloadEstateAssetCompleteCallback( @@ -725,6 +790,12 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age if(asset_id.notNull()) { + // Try static VFS first. + if (findInStaticVFSAndInvokeCallback( asset_id, atype, callback, user_data)) + { + return; + } + exists = mVFS->getExists(asset_id, atype); LLVFile file(mVFS, asset_id, atype); size = exists ? file.getSize() : 0; @@ -736,7 +807,17 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age } - if (size < 1) + if (size > 0) + { + // we've already got the file + // theoretically, partial files w/o a pending request shouldn't happen + // unless there's a weird error + if (callback) + { + callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); + } + } + else { // See whether we should talk to the object's originating sim, // or the upstream provider. @@ -785,16 +866,6 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age } } } - else - { - // we've already got the file - // theoretically, partial files w/o a pending request shouldn't happen - // unless there's a weird error - if (callback) - { - callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); - } - } } @@ -1006,12 +1077,12 @@ LLSD LLAssetStorage::getPendingDetails(LLAssetStorage::ERequestType rt, { const request_list_t* requests = getRequestList(rt); LLSD sd; - sd["requests"] = getPendingDetails(requests, asset_type, detail_prefix); + sd["requests"] = getPendingDetailsImpl(requests, asset_type, detail_prefix); return sd; } // virtual -LLSD LLAssetStorage::getPendingDetails(const LLAssetStorage::request_list_t* requests, +LLSD LLAssetStorage::getPendingDetailsImpl(const LLAssetStorage::request_list_t* requests, LLAssetType::EType asset_type, const std::string& detail_prefix) const { @@ -1094,11 +1165,11 @@ LLSD LLAssetStorage::getPendingRequest(LLAssetStorage::ERequestType rt, const LLUUID& asset_id) const { const request_list_t* requests = getRequestList(rt); - return getPendingRequest(requests, asset_type, asset_id); + return getPendingRequestImpl(requests, asset_type, asset_id); } // virtual -LLSD LLAssetStorage::getPendingRequest(const LLAssetStorage::request_list_t* requests, +LLSD LLAssetStorage::getPendingRequestImpl(const LLAssetStorage::request_list_t* requests, LLAssetType::EType asset_type, const LLUUID& asset_id) const { @@ -1117,7 +1188,7 @@ bool LLAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt, const LLUUID& asset_id) { request_list_t* requests = getRequestList(rt); - if (deletePendingRequest(requests, asset_type, asset_id)) + if (deletePendingRequestImpl(requests, asset_type, asset_id)) { llinfos << "Asset " << getRequestName(rt) << " request for " << asset_id << "." << LLAssetType::lookup(asset_type) @@ -1128,7 +1199,7 @@ bool LLAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt, } // virtual -bool LLAssetStorage::deletePendingRequest(LLAssetStorage::request_list_t* requests, +bool LLAssetStorage::deletePendingRequestImpl(LLAssetStorage::request_list_t* requests, LLAssetType::EType asset_type, const LLUUID& asset_id) { @@ -1191,6 +1262,9 @@ const char* LLAssetStorage::getErrorString(S32 status) case LL_ERR_CIRCUIT_GONE: return "Circuit gone"; + case LL_ERR_PRICE_MISMATCH: + return "Viewer and server do not agree on price"; + default: return "Unknown status"; } @@ -1231,18 +1305,22 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, void *user_data, S32 status, LLExtStat ext_status) { LLLegacyAssetRequest *legacy = (LLLegacyAssetRequest *)user_data; - char filename[LL_MAX_PATH] = ""; /* Flawfinder: ignore */ + std::string filename; - if (! status) + // Check if the asset is marked toxic, and don't load bad stuff + BOOL toxic = gAssetStorage->isAssetToxic( uuid ); + + if ( !status + && !toxic ) { LLVFile file(vfs, uuid, type); - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; uuid.toString(uuid_str); - snprintf(filename,sizeof(filename),"%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type)); /* Flawfinder: ignore */ + filename = llformat("%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type)); - FILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ + LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ if (fp) { const S32 buf_size = 65536; @@ -1264,7 +1342,7 @@ void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAss } } - legacy->mDownCallback(filename, uuid, legacy->mUserData, status, ext_status); + legacy->mDownCallback(filename.c_str(), uuid, legacy->mUserData, status, ext_status); delete legacy; } @@ -1283,7 +1361,7 @@ void LLAssetStorage::storeAssetData( { llwarns << "storeAssetData: wrong version called" << llendl; // LLAssetStorage metric: Virtual base call - reportMetric( LLUUID::null, asset_type, NULL, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 1" ); + reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 1" ); } // virtual @@ -1302,13 +1380,13 @@ void LLAssetStorage::storeAssetData( { llwarns << "storeAssetData: wrong version called" << llendl; // LLAssetStorage metric: Virtual base call - reportMetric( asset_id, asset_type, NULL, requesting_agent_id, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 2" ); + reportMetric( asset_id, asset_type, LLStringUtil::null, requesting_agent_id, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 2" ); } // virtual // this does nothing, viewer and sim both override this. void LLAssetStorage::storeAssetData( - const char* filename, + const std::string& filename, const LLUUID& asset_id, LLAssetType::EType asset_type, LLStoreAssetCallback callback, @@ -1320,13 +1398,13 @@ void LLAssetStorage::storeAssetData( { llwarns << "storeAssetData: wrong version called" << llendl; // LLAssetStorage metric: Virtual base call - reportMetric( asset_id, asset_type, NULL, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 3" ); + reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 3" ); } // virtual // this does nothing, viewer and sim both override this. void LLAssetStorage::storeAssetData( - const char* filename, + const std::string& filename, const LLTransactionID &transactoin_id, LLAssetType::EType asset_type, LLStoreAssetCallback callback, @@ -1338,7 +1416,7 @@ void LLAssetStorage::storeAssetData( { llwarns << "storeAssetData: wrong version called" << llendl; // LLAssetStorage metric: Virtual base call - reportMetric( LLUUID::null, asset_type, NULL, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 4" ); + reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 4" ); } // static @@ -1385,9 +1463,9 @@ void LLAssetStorage::clearTempAssetData() { } // static -void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const char *filename, +void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const std::string& in_filename, const LLUUID& agent_id, S32 asset_size, EMetricResult result, - const char *file, const S32 line, const char *message ) + const char *file, const S32 line, const std::string& in_message ) { if( !metric_recipient ) { @@ -1395,18 +1473,13 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET return; } - filename = filename ? filename : ""; - file = file ? file : ""; - - // Create revised message - message = "message :: file:line" - std::string new_message; //( message ); - new_message = message; // << " " << file << " " << line; - new_message += " :: "; - new_message += filename; - char line_string[16]; - sprintf( line_string, ":%d", line ); - new_message += line_string; - message = new_message.c_str(); + std::string filename(in_filename); + if (filename.empty()) + filename = ll_safe_string(file); + + // Create revised message - new_message = "in_message :: file:line" + std::stringstream new_message; + new_message << in_message << " :: " << filename << ":" << line; // Change always_report to true if debugging... do not check it in this way static bool always_report = false; @@ -1419,15 +1492,68 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET LLSD stats; stats["asset_id"] = asset_id; stats["asset_type"] = asset_type; - stats["filename"] = filename? filename : ""; + stats["filename"] = filename; stats["agent_id"] = agent_id; stats["asset_size"] = (S32)asset_size; stats["result"] = (S32)result; - metric_recipient->recordEventDetails( metric_name, message, success, stats); + metric_recipient->recordEventDetails( metric_name, new_message.str(), success, stats); } else { - metric_recipient->recordEvent(metric_name, message, success); + metric_recipient->recordEvent(metric_name, new_message.str(), success); } } + + +// Check if an asset is in the toxic map. If it is, the entry is updated +BOOL LLAssetStorage::isAssetToxic( const LLUUID& uuid ) +{ + BOOL is_toxic = FALSE; + + if ( !uuid.isNull() ) + { + toxic_asset_map_t::iterator iter = mToxicAssetMap.find( uuid ); + if ( iter != mToxicAssetMap.end() ) + { // Found toxic asset + (*iter).second = LLFrameTimer::getTotalTime() + TOXIC_ASSET_LIFETIME; + is_toxic = TRUE; + } + } + return is_toxic; +} + + + + +// Clean the toxic asset list, remove old entries +void LLAssetStorage::flushOldToxicAssets( BOOL force_it ) +{ + // Scan and look for old entries + U64 now = LLFrameTimer::getTotalTime(); + toxic_asset_map_t::iterator iter = mToxicAssetMap.begin(); + while ( iter != mToxicAssetMap.end() ) + { + if ( force_it + || (*iter).second < now ) + { // Too old - remove it + mToxicAssetMap.erase( iter++ ); + } + else + { + iter++; + } + } +} + + +// Add an item to the toxic asset map +void LLAssetStorage::markAssetToxic( const LLUUID& uuid ) +{ + if ( !uuid.isNull() ) + { + // Set the value to the current time. Creates a new entry if needed + mToxicAssetMap[ uuid ] = LLFrameTimer::getTotalTime() + TOXIC_ASSET_LIFETIME; + } +} + diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h index 8da3926c63..563ff9e077 100644 --- a/indra/llmessage/llassetstorage.h +++ b/indra/llmessage/llassetstorage.h @@ -3,30 +3,25 @@ * @brief definition of LLAssetStorage class which allows simple * up/downloads of uuid,type asets * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -197,16 +192,27 @@ public: }; - +// Map of known bad assets +typedef std::map<LLUUID,U64,lluuid_less> toxic_asset_map_t; typedef void (*LLGetAssetCallback)(LLVFS *vfs, const LLUUID &asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status); -class LLAssetStorage +class LLTempAssetStorage +{ +public: + virtual ~LLTempAssetStorage() =0; + virtual void addTempAssetData(const LLUUID& asset_id, + const LLUUID& agent_id, + const std::string& host_name) = 0; +}; + +class LLAssetStorage : public LLTempAssetStorage { public: // VFS member is public because static child methods need it :( LLVFS *mVFS; + LLVFS *mStaticVFS; typedef void (*LLStoreAssetCallback)(const LLUUID &asset_id, void *user_data, S32 status, LLExtStat ext_status); enum ERequestType @@ -231,12 +237,15 @@ protected: request_list_t mPendingUploads; request_list_t mPendingLocalUploads; + // Map of toxic assets - these caused problems when recently rezzed, so avoid them + toxic_asset_map_t mToxicAssetMap; // Objects in this list are known to cause problems and are not loaded + public: LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, - LLVFS *vfs, const LLHost &upstream_host); + LLVFS *vfs, LLVFS *static_vfs, const LLHost &upstream_host); LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, - LLVFS *vfs); + LLVFS *vfs, LLVFS *static_vfs); virtual ~LLAssetStorage(); void setUpstream(const LLHost &upstream_host); @@ -291,16 +300,28 @@ public: const LLUUID &asset_id, LLAssetType::EType atype, LLGetAssetCallback cb, void *user_data, BOOL is_priority = FALSE); // Get a particular inventory item. + // Check if an asset is in the toxic map. If it is, the entry is updated + BOOL isAssetToxic( const LLUUID& uuid ); + + // Clean the toxic asset list, remove old entries + void flushOldToxicAssets( BOOL force_it ); + + // Add an item to the toxic asset map + void markAssetToxic( const LLUUID& uuid ); + protected: - virtual LLSD getPendingDetails(const request_list_t* requests, + bool findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAssetType::EType type, + LLGetAssetCallback callback, void *user_data); + + virtual LLSD getPendingDetailsImpl(const request_list_t* requests, LLAssetType::EType asset_type, const std::string& detail_prefix) const; - virtual LLSD getPendingRequest(const request_list_t* requests, + virtual LLSD getPendingRequestImpl(const request_list_t* requests, LLAssetType::EType asset_type, const LLUUID& asset_id) const; - virtual bool deletePendingRequest(request_list_t* requests, + virtual bool deletePendingRequestImpl(request_list_t* requests, LLAssetType::EType asset_type, const LLUUID& asset_id); @@ -365,7 +386,7 @@ public: * AssetID version. */ virtual void storeAssetData( - const char* filename, + const std::string& filename, const LLUUID& asset_id, LLAssetType::EType type, LLStoreAssetCallback callback, @@ -379,7 +400,7 @@ public: * TransactionID version */ virtual void storeAssetData( - const char * filename, + const std::string& filename, const LLTransactionID &transaction_id, LLAssetType::EType type, LLStoreAssetCallback callback, @@ -419,6 +440,7 @@ private: void _init(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, + LLVFS *static_vfs, const LLHost &upstream_host); protected: @@ -438,9 +460,9 @@ protected: static class LLMetrics *metric_recipient; - static void reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const char *filename, - const LLUUID& agent_id, S32 asset_size, EMetricResult result, - const char *file, const S32 line, const char *message ); + static void reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const std::string& filename, + const LLUUID& agent_id, S32 asset_size, EMetricResult result, + const char* file, const S32 line, const std::string& message ); public: static void setMetricRecipient( LLMetrics *recip ) { diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp new file mode 100644 index 0000000000..2f2d9099a3 --- /dev/null +++ b/indra/llmessage/llavatarnamecache.cpp @@ -0,0 +1,822 @@ +/** + * @file llavatarnamecache.cpp + * @brief Provides lookup of avatar SLIDs ("bobsmith123") and display names + * ("James Cook") from avatar UUIDs. + * + * $LicenseInfo:firstyear=2010&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "linden_common.h" + +#include "llavatarnamecache.h" + +#include "llcachename.h" // we wrap this system +#include "llframetimer.h" +#include "llhttpclient.h" +#include "llsd.h" +#include "llsdserialize.h" + +#include <boost/tokenizer.hpp> + +#include <map> +#include <set> + +namespace LLAvatarNameCache +{ + use_display_name_signal_t mUseDisplayNamesSignal; + + // Manual override for display names - can disable even if the region + // supports it. + bool sUseDisplayNames = true; + + // Cache starts in a paused state until we can determine if the + // current region supports display names. + bool sRunning = false; + + // Base lookup URL for name service. + // On simulator, loaded from indra.xml + // On viewer, usually a simulator capability (at People API team's request) + // Includes the trailing slash, like "http://pdp60.lindenlab.com:8000/agents/" + std::string sNameLookupURL; + + // accumulated agent IDs for next query against service + typedef std::set<LLUUID> ask_queue_t; + ask_queue_t sAskQueue; + + // agent IDs that have been requested, but with no reply + // maps agent ID to frame time request was made + typedef std::map<LLUUID, F64> pending_queue_t; + pending_queue_t sPendingQueue; + + // Callbacks to fire when we received a name. + // May have multiple callbacks for a single ID, which are + // represented as multiple slots bound to the signal. + // Avoid copying signals via pointers. + typedef std::map<LLUUID, callback_signal_t*> signal_map_t; + signal_map_t sSignalMap; + + // names we know about + typedef std::map<LLUUID, LLAvatarName> cache_t; + cache_t sCache; + + // Send bulk lookup requests a few times a second at most + // only need per-frame timing resolution + LLFrameTimer sRequestTimer; + + // Periodically clean out expired entries from the cache + //LLFrameTimer sEraseExpiredTimer; + + //----------------------------------------------------------------------- + // Internal methods + //----------------------------------------------------------------------- + + // Handle name response off network. + // Optionally skip adding to cache, used when this is a fallback to the + // legacy name system. + void processName(const LLUUID& agent_id, + const LLAvatarName& av_name, + bool add_to_cache); + + void requestNamesViaCapability(); + + // Legacy name system callback + void legacyNameCallback(const LLUUID& agent_id, + const std::string& full_name, + bool is_group); + + void requestNamesViaLegacy(); + + // Fill in an LLAvatarName with the legacy name data + void buildLegacyName(const std::string& full_name, + LLAvatarName* av_name); + + // Do a single callback to a given slot + void fireSignal(const LLUUID& agent_id, + const callback_slot_t& slot, + const LLAvatarName& av_name); + + // Is a request in-flight over the network? + bool isRequestPending(const LLUUID& agent_id); + + // Erase expired names from cache + void eraseExpired(); + + bool expirationFromCacheControl(LLSD headers, F64 *expires); +} + +/* Sample response: +<?xml version="1.0"?> +<llsd> + <map> + <key>agents</key> + <array> + <map> + <key>display_name_next_update</key> + <date>2010-04-16T21:34:02+00:00Z</date> + <key>display_name_expires</key> + <date>2010-04-16T21:32:26.142178+00:00Z</date> + <key>display_name</key> + <string>MickBot390 LLQABot</string> + <key>sl_id</key> + <string>mickbot390.llqabot</string> + <key>id</key> + <string>0012809d-7d2d-4c24-9609-af1230a37715</string> + <key>is_display_name_default</key> + <boolean>false</boolean> + </map> + <map> + <key>display_name_next_update</key> + <date>2010-04-16T21:34:02+00:00Z</date> + <key>display_name_expires</key> + <date>2010-04-16T21:32:26.142178+00:00Z</date> + <key>display_name</key> + <string>Bjork Gudmundsdottir</string> + <key>sl_id</key> + <string>sardonyx.linden</string> + <key>id</key> + <string>3941037e-78ab-45f0-b421-bd6e77c1804d</string> + <key>is_display_name_default</key> + <boolean>true</boolean> + </map> + </array> + </map> +</llsd> +*/ + +class LLAvatarNameResponder : public LLHTTPClient::Responder +{ +private: + // need to store agent ids that are part of this request in case of + // an error, so we can flag them as unavailable + std::vector<LLUUID> mAgentIDs; + + // Need the headers to look up Expires: and Retry-After: + LLSD mHeaders; + +public: + LLAvatarNameResponder(const std::vector<LLUUID>& agent_ids) + : mAgentIDs(agent_ids), + mHeaders() + { } + + /*virtual*/ void completedHeader(U32 status, const std::string& reason, + const LLSD& headers) + { + mHeaders = headers; + } + + /*virtual*/ void result(const LLSD& content) + { + // Pull expiration out of headers if available + F64 expires = LLAvatarNameCache::nameExpirationFromHeaders(mHeaders); + + LLSD agents = content["agents"]; + LLSD::array_const_iterator it = agents.beginArray(); + for ( ; it != agents.endArray(); ++it) + { + const LLSD& row = *it; + LLUUID agent_id = row["id"].asUUID(); + + LLAvatarName av_name; + av_name.fromLLSD(row); + + // Use expiration time from header + av_name.mExpires = expires; + + // Some avatars don't have explicit display names set + if (av_name.mDisplayName.empty()) + { + av_name.mDisplayName = av_name.mUsername; + } + + // cache it and fire signals + LLAvatarNameCache::processName(agent_id, av_name, true); + } + + // Same logic as error response case + LLSD unresolved_agents = content["bad_ids"]; + if (unresolved_agents.size() > 0) + { + const std::string DUMMY_NAME("\?\?\?"); + LLAvatarName av_name; + av_name.mUsername = DUMMY_NAME; + av_name.mDisplayName = DUMMY_NAME; + av_name.mIsDisplayNameDefault = false; + av_name.mIsDummy = true; + av_name.mExpires = expires; + + it = unresolved_agents.beginArray(); + for ( ; it != unresolved_agents.endArray(); ++it) + { + const LLUUID& agent_id = *it; + // cache it and fire signals + LLAvatarNameCache::processName(agent_id, av_name, true); + } + } + } + + /*virtual*/ void error(U32 status, const std::string& reason) + { + // We're going to construct a dummy record and cache it for a while, + // either briefly for a 503 Service Unavailable, or longer for other + // errors. + F64 retry_timestamp = errorRetryTimestamp(status); + + // *NOTE: "??" starts trigraphs in C/C++, escape the question marks. + const std::string DUMMY_NAME("\?\?\?"); + LLAvatarName av_name; + av_name.mUsername = DUMMY_NAME; + av_name.mDisplayName = DUMMY_NAME; + av_name.mIsDisplayNameDefault = false; + av_name.mIsDummy = true; + av_name.mExpires = retry_timestamp; + + // Add dummy records for all agent IDs in this request + std::vector<LLUUID>::const_iterator it = mAgentIDs.begin(); + for ( ; it != mAgentIDs.end(); ++it) + { + const LLUUID& agent_id = *it; + // cache it and fire signals + LLAvatarNameCache::processName(agent_id, av_name, true); + } + } + + // Return time to retry a request that generated an error, based on + // error type and headers. Return value is seconds-since-epoch. + F64 errorRetryTimestamp(S32 status) + { + F64 now = LLFrameTimer::getTotalSeconds(); + + // Retry-After takes priority + LLSD retry_after = mHeaders["retry-after"]; + if (retry_after.isDefined()) + { + // We only support the delta-seconds type + S32 delta_seconds = retry_after.asInteger(); + if (delta_seconds > 0) + { + // ...valid delta-seconds + return now + F64(delta_seconds); + } + } + + // If no Retry-After, look for Cache-Control max-age + F64 expires = 0.0; + if (LLAvatarNameCache::expirationFromCacheControl(mHeaders, &expires)) + { + return expires; + } + + // No information in header, make a guess + if (status == 503) + { + // ...service unavailable, retry soon + const F64 SERVICE_UNAVAILABLE_DELAY = 600.0; // 10 min + return now + SERVICE_UNAVAILABLE_DELAY; + } + else + { + // ...other unexpected error + const F64 DEFAULT_DELAY = 3600.0; // 1 hour + return now + DEFAULT_DELAY; + } + } +}; + +void LLAvatarNameCache::processName(const LLUUID& agent_id, + const LLAvatarName& av_name, + bool add_to_cache) +{ + if (add_to_cache) + { + sCache[agent_id] = av_name; + } + + sPendingQueue.erase(agent_id); + + // signal everyone waiting on this name + signal_map_t::iterator sig_it = sSignalMap.find(agent_id); + if (sig_it != sSignalMap.end()) + { + callback_signal_t* signal = sig_it->second; + (*signal)(agent_id, av_name); + + sSignalMap.erase(agent_id); + + delete signal; + signal = NULL; + } +} + +void LLAvatarNameCache::requestNamesViaCapability() +{ + F64 now = LLFrameTimer::getTotalSeconds(); + + // URL format is like: + // http://pdp60.lindenlab.com:8000/agents/?ids=3941037e-78ab-45f0-b421-bd6e77c1804d&ids=0012809d-7d2d-4c24-9609-af1230a37715&ids=0019aaba-24af-4f0a-aa72-6457953cf7f0 + // + // Apache can handle URLs of 4096 chars, but let's be conservative + const U32 NAME_URL_MAX = 4096; + const U32 NAME_URL_SEND_THRESHOLD = 3000; + std::string url; + url.reserve(NAME_URL_MAX); + + std::vector<LLUUID> agent_ids; + agent_ids.reserve(128); + + ask_queue_t::const_iterator it = sAskQueue.begin(); + for ( ; it != sAskQueue.end(); ++it) + { + const LLUUID& agent_id = *it; + + if (url.empty()) + { + // ...starting new request + url += sNameLookupURL; + url += "?ids="; + } + else + { + // ...continuing existing request + url += "&ids="; + } + url += agent_id.asString(); + agent_ids.push_back(agent_id); + + // mark request as pending + sPendingQueue[agent_id] = now; + + if (url.size() > NAME_URL_SEND_THRESHOLD) + { + //llinfos << "requestNames " << url << llendl; + LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids)); + url.clear(); + agent_ids.clear(); + } + } + + if (!url.empty()) + { + //llinfos << "requestNames " << url << llendl; + LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids)); + url.clear(); + agent_ids.clear(); + } + + // We've moved all asks to the pending request queue + sAskQueue.clear(); +} + +void LLAvatarNameCache::legacyNameCallback(const LLUUID& agent_id, + const std::string& full_name, + bool is_group) +{ + // Construct a dummy record for this name. By convention, SLID is blank + // Never expires, but not written to disk, so lasts until end of session. + LLAvatarName av_name; + buildLegacyName(full_name, &av_name); + + // Don't add to cache, the data already exists in the legacy name system + // cache and we don't want or need duplicate storage, because keeping the + // two copies in sync is complex. + processName(agent_id, av_name, false); +} + +void LLAvatarNameCache::requestNamesViaLegacy() +{ + F64 now = LLFrameTimer::getTotalSeconds(); + std::string full_name; + ask_queue_t::const_iterator it = sAskQueue.begin(); + for (; it != sAskQueue.end(); ++it) + { + const LLUUID& agent_id = *it; + + // Mark as pending first, just in case the callback is immediately + // invoked below. This should never happen in practice. + sPendingQueue[agent_id] = now; + + gCacheName->get(agent_id, false, // legacy compatibility + boost::bind(&LLAvatarNameCache::legacyNameCallback, + _1, _2, _3)); + } + + // We've either answered immediately or moved all asks to the + // pending queue + sAskQueue.clear(); +} + +void LLAvatarNameCache::initClass(bool running) +{ + sRunning = running; +} + +void LLAvatarNameCache::cleanupClass() +{ +} + +void LLAvatarNameCache::importFile(std::istream& istr) +{ + LLSD data; + S32 parse_count = LLSDSerialize::fromXMLDocument(data, istr); + if (parse_count < 1) return; + + // by convention LLSD storage is a map + // we only store one entry in the map + LLSD agents = data["agents"]; + + LLUUID agent_id; + LLAvatarName av_name; + LLSD::map_const_iterator it = agents.beginMap(); + for ( ; it != agents.endMap(); ++it) + { + agent_id.set(it->first); + av_name.fromLLSD( it->second ); + sCache[agent_id] = av_name; + } + // entries may have expired since we last ran the viewer, just + // clean them out now + eraseExpired(); + llinfos << "loaded " << sCache.size() << llendl; +} + +void LLAvatarNameCache::exportFile(std::ostream& ostr) +{ + LLSD agents; + cache_t::const_iterator it = sCache.begin(); + for ( ; it != sCache.end(); ++it) + { + const LLUUID& agent_id = it->first; + const LLAvatarName& av_name = it->second; + if (!av_name.mIsDummy) + { + // key must be a string + agents[agent_id.asString()] = av_name.asLLSD(); + } + } + LLSD data; + data["agents"] = agents; + LLSDSerialize::toPrettyXML(data, ostr); +} + +void LLAvatarNameCache::setNameLookupURL(const std::string& name_lookup_url) +{ + sNameLookupURL = name_lookup_url; +} + +bool LLAvatarNameCache::hasNameLookupURL() +{ + return !sNameLookupURL.empty(); +} + +void LLAvatarNameCache::idle() +{ + // By convention, start running at first idle() call + sRunning = true; + + // *TODO: Possibly re-enabled this based on People API load measurements + // 100 ms is the threshold for "user speed" operations, so we can + // stall for about that long to batch up requests. + //const F32 SECS_BETWEEN_REQUESTS = 0.1f; + //if (!sRequestTimer.checkExpirationAndReset(SECS_BETWEEN_REQUESTS)) + //{ + // return; + //} + + // Must be large relative to above + + // No longer deleting expired entries, just re-requesting in the get + // this way first synchronous get call on an expired entry won't return + // legacy name. LF + + //const F32 ERASE_EXPIRED_TIMEOUT = 60.f; // seconds + //if (sEraseExpiredTimer.checkExpirationAndReset(ERASE_EXPIRED_TIMEOUT)) + //{ + // eraseExpired(); + //} + + if (sAskQueue.empty()) + { + return; + } + + if (useDisplayNames()) + { + requestNamesViaCapability(); + } + else + { + // ...fall back to legacy name cache system + requestNamesViaLegacy(); + } +} + +bool LLAvatarNameCache::isRequestPending(const LLUUID& agent_id) +{ + const F64 PENDING_TIMEOUT_SECS = 5.0 * 60.0; + F64 now = LLFrameTimer::getTotalSeconds(); + F64 expire_time = now - PENDING_TIMEOUT_SECS; + + pending_queue_t::const_iterator it = sPendingQueue.find(agent_id); + if (it != sPendingQueue.end()) + { + bool request_expired = (it->second < expire_time); + return !request_expired; + } + return false; +} + +void LLAvatarNameCache::eraseExpired() +{ + F64 now = LLFrameTimer::getTotalSeconds(); + cache_t::iterator it = sCache.begin(); + while (it != sCache.end()) + { + cache_t::iterator cur = it; + ++it; + const LLAvatarName& av_name = cur->second; + if (av_name.mExpires < now) + { + sCache.erase(cur); + } + } +} + +void LLAvatarNameCache::buildLegacyName(const std::string& full_name, + LLAvatarName* av_name) +{ + llassert(av_name); + av_name->mUsername = ""; + av_name->mDisplayName = full_name; + av_name->mIsDisplayNameDefault = true; + av_name->mIsDummy = true; + av_name->mExpires = F64_MAX; +} + +// fills in av_name if it has it in the cache, even if expired (can check expiry time) +// returns bool specifying if av_name was filled, false otherwise +bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name) +{ + if (sRunning) + { + // ...only do immediate lookups when cache is running + if (useDisplayNames()) + { + // ...use display names cache + std::map<LLUUID,LLAvatarName>::iterator it = sCache.find(agent_id); + if (it != sCache.end()) + { + *av_name = it->second; + + // re-request name if entry is expired + if (av_name->mExpires < LLFrameTimer::getTotalSeconds()) + { + if (!isRequestPending(agent_id)) + { + sAskQueue.insert(agent_id); + } + } + + return true; + } + } + else + { + // ...use legacy names cache + std::string full_name; + if (gCacheName->getFullName(agent_id, full_name)) + { + buildLegacyName(full_name, av_name); + return true; + } + } + } + + if (!isRequestPending(agent_id)) + { + sAskQueue.insert(agent_id); + } + + return false; +} + +void LLAvatarNameCache::fireSignal(const LLUUID& agent_id, + const callback_slot_t& slot, + const LLAvatarName& av_name) +{ + callback_signal_t signal; + signal.connect(slot); + signal(agent_id, av_name); +} + +void LLAvatarNameCache::get(const LLUUID& agent_id, callback_slot_t slot) +{ + if (sRunning) + { + // ...only do immediate lookups when cache is running + if (useDisplayNames()) + { + // ...use new cache + std::map<LLUUID,LLAvatarName>::iterator it = sCache.find(agent_id); + if (it != sCache.end()) + { + const LLAvatarName& av_name = it->second; + + if (av_name.mExpires > LLFrameTimer::getTotalSeconds()) + { + // ...name already exists in cache, fire callback now + fireSignal(agent_id, slot, av_name); + + return; + } + } + } + else + { + // ...use old name system + std::string full_name; + if (gCacheName->getFullName(agent_id, full_name)) + { + LLAvatarName av_name; + buildLegacyName(full_name, &av_name); + fireSignal(agent_id, slot, av_name); + return; + } + } + } + + // schedule a request + if (!isRequestPending(agent_id)) + { + sAskQueue.insert(agent_id); + } + + // always store additional callback, even if request is pending + signal_map_t::iterator sig_it = sSignalMap.find(agent_id); + if (sig_it == sSignalMap.end()) + { + // ...new callback for this id + callback_signal_t* signal = new callback_signal_t(); + signal->connect(slot); + sSignalMap[agent_id] = signal; + } + else + { + // ...existing callback, bind additional slot + callback_signal_t* signal = sig_it->second; + signal->connect(slot); + } +} + + +void LLAvatarNameCache::setUseDisplayNames(bool use) +{ + if (use != sUseDisplayNames) + { + sUseDisplayNames = use; + // flush our cache + sCache.clear(); + + mUseDisplayNamesSignal(); + } +} + +bool LLAvatarNameCache::useDisplayNames() +{ + // Must be both manually set on and able to look up names. + return sUseDisplayNames && !sNameLookupURL.empty(); +} + +void LLAvatarNameCache::erase(const LLUUID& agent_id) +{ + sCache.erase(agent_id); +} + +void LLAvatarNameCache::fetch(const LLUUID& agent_id) +{ + // re-request, even if request is already pending + sAskQueue.insert(agent_id); +} + +void LLAvatarNameCache::insert(const LLUUID& agent_id, const LLAvatarName& av_name) +{ + // *TODO: update timestamp if zero? + sCache[agent_id] = av_name; +} + +F64 LLAvatarNameCache::nameExpirationFromHeaders(LLSD headers) +{ + F64 expires = 0.0; + if (expirationFromCacheControl(headers, &expires)) + { + return expires; + } + else + { + // With no expiration info, default to an hour + const F64 DEFAULT_EXPIRES = 60.0 * 60.0; + F64 now = LLFrameTimer::getTotalSeconds(); + return now + DEFAULT_EXPIRES; + } +} + +bool LLAvatarNameCache::expirationFromCacheControl(LLSD headers, F64 *expires) +{ + // Allow the header to override the default + LLSD cache_control_header = headers["cache-control"]; + if (cache_control_header.isDefined()) + { + S32 max_age = 0; + std::string cache_control = cache_control_header.asString(); + if (max_age_from_cache_control(cache_control, &max_age)) + { + F64 now = LLFrameTimer::getTotalSeconds(); + *expires = now + (F64)max_age; + return true; + } + } + return false; +} + + +void LLAvatarNameCache::addUseDisplayNamesCallback(const use_display_name_signal_t::slot_type& cb) +{ + mUseDisplayNamesSignal.connect(cb); +} + + +static const std::string MAX_AGE("max-age"); +static const boost::char_separator<char> EQUALS_SEPARATOR("="); +static const boost::char_separator<char> COMMA_SEPARATOR(","); + +bool max_age_from_cache_control(const std::string& cache_control, S32 *max_age) +{ + // Split the string on "," to get a list of directives + typedef boost::tokenizer<boost::char_separator<char> > tokenizer; + tokenizer directives(cache_control, COMMA_SEPARATOR); + + tokenizer::iterator token_it = directives.begin(); + for ( ; token_it != directives.end(); ++token_it) + { + // Tokens may have leading or trailing whitespace + std::string token = *token_it; + LLStringUtil::trim(token); + + if (token.compare(0, MAX_AGE.size(), MAX_AGE) == 0) + { + // ...this token starts with max-age, so let's chop it up by "=" + tokenizer subtokens(token, EQUALS_SEPARATOR); + tokenizer::iterator subtoken_it = subtokens.begin(); + + // Must have a token + if (subtoken_it == subtokens.end()) return false; + std::string subtoken = *subtoken_it; + + // Must exactly equal "max-age" + LLStringUtil::trim(subtoken); + if (subtoken != MAX_AGE) return false; + + // Must have another token + ++subtoken_it; + if (subtoken_it == subtokens.end()) return false; + subtoken = *subtoken_it; + + // Must be a valid integer + // *NOTE: atoi() returns 0 for invalid values, so we have to + // check the string first. + // *TODO: Do servers ever send "0000" for zero? We don't handle it + LLStringUtil::trim(subtoken); + if (subtoken == "0") + { + *max_age = 0; + return true; + } + S32 val = atoi( subtoken.c_str() ); + if (val > 0 && val < S32_MAX) + { + *max_age = val; + return true; + } + return false; + } + } + return false; +} + diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h new file mode 100644 index 0000000000..8f21ace96a --- /dev/null +++ b/indra/llmessage/llavatarnamecache.h @@ -0,0 +1,103 @@ +/** + * @file llavatarnamecache.h + * @brief Provides lookup of avatar SLIDs ("bobsmith123") and display names + * ("James Cook") from avatar UUIDs. + * + * $LicenseInfo:firstyear=2010&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LLAVATARNAMECACHE_H +#define LLAVATARNAMECACHE_H + +#include "llavatarname.h" // for convenience + +#include <boost/signals2.hpp> + +class LLSD; +class LLUUID; + +namespace LLAvatarNameCache +{ + + typedef boost::signals2::signal<void (void)> use_display_name_signal_t; + + // Until the cache is set running, immediate lookups will fail and + // async lookups will be queued. This allows us to block requests + // until we know if the first region supports display names. + void initClass(bool running); + void cleanupClass(); + + void importFile(std::istream& istr); + void exportFile(std::ostream& ostr); + + // On the viewer, usually a simulator capabilitity + // If empty, name cache will fall back to using legacy name + // lookup system + void setNameLookupURL(const std::string& name_lookup_url); + + // Do we have a valid lookup URL, hence are we trying to use the + // new display name lookup system? + bool hasNameLookupURL(); + + // Periodically makes a batch request for display names not already in + // cache. Call once per frame. + void idle(); + + // If name is in cache, returns true and fills in provided LLAvatarName + // otherwise returns false + bool get(const LLUUID& agent_id, LLAvatarName *av_name); + + // Callback types for get() below + typedef boost::signals2::signal< + void (const LLUUID& agent_id, const LLAvatarName& av_name)> + callback_signal_t; + typedef callback_signal_t::slot_type callback_slot_t; + + // Fetches name information and calls callback. + // If name information is in cache, callback will be called immediately. + void get(const LLUUID& agent_id, callback_slot_t slot); + + // Allow display names to be explicitly disabled for testing. + void setUseDisplayNames(bool use); + bool useDisplayNames(); + + void erase(const LLUUID& agent_id); + + // Force a re-fetch of the most recent data, but keep the current + // data in cache + void fetch(const LLUUID& agent_id); + + void insert(const LLUUID& agent_id, const LLAvatarName& av_name); + + // Compute name expiration time from HTTP Cache-Control header, + // or return default value, in seconds from epoch. + F64 nameExpirationFromHeaders(LLSD headers); + + void addUseDisplayNamesCallback(const use_display_name_signal_t::slot_type& cb); +} + +// Parse a cache-control header to get the max-age delta-seconds. +// Returns true if header has max-age param and it parses correctly. +// Exported here to ease unit testing. +bool max_age_from_cache_control(const std::string& cache_control, S32 *max_age); + +#endif diff --git a/indra/llmessage/llblowfishcipher.cpp b/indra/llmessage/llblowfishcipher.cpp index 7c9194d603..88aaf7c52a 100644 --- a/indra/llmessage/llblowfishcipher.cpp +++ b/indra/llmessage/llblowfishcipher.cpp @@ -2,39 +2,31 @@ * @file llblowfishcipher.cpp * @brief Wrapper around OpenSSL Blowfish encryption algorithm. * - * We do not have OpenSSL headers or libraries on Windows, so this - * class only works on Linux. - * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #include "linden_common.h" - #include "llblowfishcipher.h" +#include <openssl/evp.h> LLBlowfishCipher::LLBlowfishCipher(const U8* secret, size_t secret_size) @@ -53,11 +45,6 @@ LLBlowfishCipher::~LLBlowfishCipher() mSecret = NULL; } - -#if LL_LINUX - -#include <openssl/evp.h> - // virtual U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) { @@ -136,29 +123,3 @@ U32 LLBlowfishCipher::requiredEncryptionSpace(U32 len) const len -= (len % BLOCK_SIZE); return len; } - -#else // !LL_LINUX - -// virtual -U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) -{ - llerrs << "LLBlowfishCipher only supported on Linux" << llendl; - return 0; -} - -// virtual -U32 LLBlowfishCipher::decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) -{ - llerrs << "LLBlowfishCipher only supported on Linux" << llendl; - return 0; -} - -// virtual -U32 LLBlowfishCipher::requiredEncryptionSpace(U32 len) const -{ - llerrs << "LLBlowfishCipher only supported on Linux" << llendl; - return 0; -} - -#endif - diff --git a/indra/llmessage/llblowfishcipher.h b/indra/llmessage/llblowfishcipher.h index f477184856..e2e54526e8 100644 --- a/indra/llmessage/llblowfishcipher.h +++ b/indra/llmessage/llblowfishcipher.h @@ -5,30 +5,25 @@ * two UUIDs and a timestamp (16x2 + 4 = 36 bytes) with only 40 bytes of * output. AES has a block size of 32 bytes, so this would require 64 bytes. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llbuffer.cpp b/indra/llmessage/llbuffer.cpp index c3433e9ac3..0316797f00 100644 --- a/indra/llmessage/llbuffer.cpp +++ b/indra/llmessage/llbuffer.cpp @@ -4,30 +4,25 @@ * @date 2005-09-20 * @brief Implementation of the segments, buffers, and buffer arrays. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llbuffer.h b/indra/llmessage/llbuffer.h index 52fc769be9..1c42b6fbc6 100644 --- a/indra/llmessage/llbuffer.h +++ b/indra/llmessage/llbuffer.h @@ -4,30 +4,25 @@ * @date 2005-09-20 * @brief Declaration of buffer and buffer arrays primarily used in I/O. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llbufferstream.cpp b/indra/llmessage/llbufferstream.cpp index 72310a5777..6257983c43 100644 --- a/indra/llmessage/llbufferstream.cpp +++ b/indra/llmessage/llbufferstream.cpp @@ -4,30 +4,25 @@ * @date 2005-10-10 * @brief Implementation of the buffer iostream classes * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llbufferstream.h b/indra/llmessage/llbufferstream.h index 78b7f3c979..19749612f3 100644 --- a/indra/llmessage/llbufferstream.h +++ b/indra/llmessage/llbufferstream.h @@ -4,30 +4,25 @@ * @date 2005-10-10 * @brief Classes to treat an LLBufferArray as a c++ iostream. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 274bf5cc04..4a66a31c35 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -2,30 +2,25 @@ * @file llcachename.cpp * @brief A hierarchical cache of first and last names queried based on UUID. * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -41,11 +36,7 @@ #include "llsdserialize.h" #include "lluuid.h" #include "message.h" - -// Constants -const char* CN_WAITING = "(waiting)"; -const char* CN_NOBODY = "(nobody)"; -const char* CN_NONE = "(none)"; +#include "llmemtype.h" // llsd serialization constants static const std::string AGENTS("agents"); @@ -64,6 +55,7 @@ const S32 CN_FILE_VERSION = 2; // Globals LLCacheName* gCacheName = NULL; +std::map<std::string, std::string> LLCacheName::sCacheName; /// --------------------------------------------------------------------------- /// class LLCacheNameEntry @@ -77,16 +69,17 @@ public: public: bool mIsGroup; U32 mCreateTime; // unix time_t - char mFirstName[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char mLastName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char mGroupName[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + // IDEVO TODO collapse names to one field, which will eliminate + // many string compares on "Resident" + std::string mFirstName; + std::string mLastName; + std::string mGroupName; }; LLCacheNameEntry::LLCacheNameEntry() + : mIsGroup(false), + mCreateTime(0) { - mFirstName[0] = '\0'; - mLastName[0] = '\0'; - mGroupName[0] = '\0'; } @@ -94,17 +87,19 @@ class PendingReply { public: LLUUID mID; - LLCacheNameCallback mCallback; + LLCacheNameSignal mSignal; LLHost mHost; - void* mData; - PendingReply(const LLUUID& id, LLCacheNameCallback callback, void* data = NULL) - : mID(id), mCallback(callback), mData(data) - { } - + PendingReply(const LLUUID& id, const LLHost& host) - : mID(id), mCallback(0), mHost(host) - { } - + : mID(id), mHost(host) + { + } + + boost::signals2::connection setCallback(const LLCacheNameCallback& cb) + { + return mSignal.connect(cb); + } + void done() { mID.setNull(); } bool isDone() const { return mID.isNull() != FALSE; } }; @@ -128,7 +123,7 @@ private: }; ReplySender::ReplySender(LLMessageSystem* msg) - : mMsg(msg), mPending(false) + : mMsg(msg), mPending(false), mCurrIsGroup(false) { } ReplySender::~ReplySender() @@ -189,10 +184,10 @@ void ReplySender::flush() typedef std::set<LLUUID> AskQueue; -typedef std::vector<PendingReply> ReplyQueue; +typedef std::list<PendingReply*> ReplyQueue; typedef std::map<LLUUID,U32> PendingQueue; typedef std::map<LLUUID, LLCacheNameEntry*> Cache; -typedef std::vector<LLCacheNameCallback> Observers; +typedef std::map<std::string, LLUUID> ReverseCache; class LLCacheName::Impl { @@ -202,7 +197,9 @@ public: Cache mCache; // the map of UUIDs to names - + ReverseCache mReverseCache; + // map of names to UUIDs + AskQueue mAskNameQueue; AskQueue mAskGroupQueue; // UUIDs to ask our upstream host about @@ -213,13 +210,18 @@ public: ReplyQueue mReplyQueue; // requests awaiting replies from us - Observers mObservers; + LLCacheNameSignal mSignal; LLFrameTimer mProcessTimer; Impl(LLMessageSystem* msg); ~Impl(); + BOOL getName(const LLUUID& id, std::string& first, std::string& last); + + boost::signals2::connection addPending(const LLUUID& id, const LLCacheNameCallback& callback); + void addPending(const LLUUID& id, const LLHost& host); + void processPendingAsks(); void processPendingReplies(); void sendRequest(const char* msg_name, const AskQueue& queue); @@ -233,8 +235,6 @@ public: static void handleUUIDNameReply(LLMessageSystem* msg, void** userdata); static void handleUUIDGroupNameRequest(LLMessageSystem* msg, void** userdata); static void handleUUIDGroupNameReply(LLMessageSystem* msg, void** userdata); - - void notifyObservers(const LLUUID& id, const char* first, const char* last, BOOL group); }; @@ -249,6 +249,9 @@ LLCacheName::LLCacheName(LLMessageSystem* msg) LLCacheName::LLCacheName(LLMessageSystem* msg, const LLHost& upstream_host) : impl(* new Impl(msg)) { + sCacheName["waiting"] = "(Loading...)"; + sCacheName["nobody"] = "(nobody)"; + sCacheName["none"] = "(none)"; setUpstream(upstream_host); } @@ -274,135 +277,37 @@ LLCacheName::Impl::Impl(LLMessageSystem* msg) LLCacheName::Impl::~Impl() { for_each(mCache.begin(), mCache.end(), DeletePairedPointer()); + for_each(mReplyQueue.begin(), mReplyQueue.end(), DeletePointer()); } - -void LLCacheName::setUpstream(const LLHost& upstream_host) +boost::signals2::connection LLCacheName::Impl::addPending(const LLUUID& id, const LLCacheNameCallback& callback) { - impl.mUpstreamHost = upstream_host; + PendingReply* reply = new PendingReply(id, LLHost()); + boost::signals2::connection res = reply->setCallback(callback); + mReplyQueue.push_back(reply); + return res; } -void LLCacheName::addObserver(LLCacheNameCallback callback) +void LLCacheName::Impl::addPending(const LLUUID& id, const LLHost& host) { - impl.mObservers.push_back(callback); + PendingReply* reply = new PendingReply(id, host); + mReplyQueue.push_back(reply); } -void LLCacheName::removeObserver(LLCacheNameCallback callback) -{ - Observers::iterator it = impl.mObservers.begin(); - Observers::iterator end = impl.mObservers.end(); - - for ( ; it != end; ++it) - { - const LLCacheNameCallback& cb = (*it); - if (cb == callback) - { - impl.mObservers.erase(it); - return; - } - } -} - -void LLCacheName::cancelCallback(const LLUUID& id, LLCacheNameCallback callback, void* user_data) +void LLCacheName::setUpstream(const LLHost& upstream_host) { - ReplyQueue::iterator it = impl.mReplyQueue.begin(); - ReplyQueue::iterator end = impl.mReplyQueue.end(); - - for(; it != end; ++it) - { - const PendingReply& reply = (*it); - - if ((callback == reply.mCallback) - && (id == reply.mID) - && (user_data == reply.mData) ) - { - impl.mReplyQueue.erase(it); - return; - } - } + impl.mUpstreamHost = upstream_host; } -void LLCacheName::importFile(FILE* fp) +boost::signals2::connection LLCacheName::addObserver(const LLCacheNameCallback& callback) { - S32 count = 0; - - const S32 BUFFER_SIZE = 1024; - char buffer[BUFFER_SIZE]; /*Flawfinder: ignore*/ - - // *NOTE: These buffer sizes are hardcoded into sscanf() below - char id_string[MAX_STRING]; /*Flawfinder: ignore*/ - char firstname[MAX_STRING]; /*Flawfinder: ignore*/ - char lastname[MAX_STRING]; /*Flawfinder: ignore*/ - U32 create_time; - - // This is OK if the first line is actually a name. We just don't load it. - char* valid = fgets(buffer, BUFFER_SIZE, fp); - if (!valid) return; - - // *NOTE: This buffer size is hardcoded into sscanf() below - char version_string[BUFFER_SIZE]; /*Flawfinder: ignore*/ - S32 version = 0; - S32 match = sscanf( /* Flawfinder: ignore */ - buffer, - "%1023s %d", - version_string, &version); - if ( match != 2 - || strcmp(version_string, "version") - || version != CN_FILE_VERSION) - { - llwarns << "Ignoring old cache name file format" << llendl; - return; - } - - // We'll expire entries more than a week old - U32 now = (U32)time(NULL); - const U32 SECS_PER_DAY = 60 * 60 * 24; - U32 delete_before_time = now - (7 * SECS_PER_DAY); - - while(!feof(fp)) - { - valid = fgets(buffer, BUFFER_SIZE, fp); - if (!valid) break; - - match = sscanf( /* Flawfinder: ignore */ - buffer, - "%254s %u %254s %254s", - id_string, - &create_time, - firstname, - lastname); - if (4 != match) continue; - - LLUUID id(id_string); - if (id.isNull()) continue; - - // undo trivial XOR - S32 i; - for (i = 0; i < UUID_BYTES; i++) - { - id.mData[i] ^= 0x33; - } - - // Don't load entries that are more than a week old - if (create_time < delete_before_time) continue; - - LLCacheNameEntry* entry = new LLCacheNameEntry(); - entry->mIsGroup = false; - entry->mCreateTime = create_time; - LLString::copy(entry->mFirstName, firstname, DB_FIRST_NAME_BUF_SIZE); - LLString::copy(entry->mLastName, lastname, DB_LAST_NAME_BUF_SIZE); - impl.mCache[id] = entry; - - count++; - } - - llinfos << "LLCacheName loaded " << count << " names" << llendl; + return impl.mSignal.connect(callback); } bool LLCacheName::importFile(std::istream& istr) { LLSD data; - if(LLSDSerialize::fromXML(data, istr) < 1) + if(LLSDSerialize::fromXMLDocument(data, istr) < 1) return false; // We'll expire entries more than a week old @@ -425,13 +330,12 @@ bool LLCacheName::importFile(std::istream& istr) LLCacheNameEntry* entry = new LLCacheNameEntry(); entry->mIsGroup = false; entry->mCreateTime = ctime; - std::string first = agent[FIRST].asString(); - first.copy(entry->mFirstName, DB_FIRST_NAME_BUF_SIZE, 0); - entry->mFirstName[llmin(first.size(),(std::string::size_type)DB_FIRST_NAME_BUF_SIZE-1)] = '\0'; - std::string last = agent[LAST].asString(); - last.copy(entry->mLastName, DB_LAST_NAME_BUF_SIZE, 0); - entry->mLastName[llmin(last.size(),(std::string::size_type)DB_LAST_NAME_BUF_SIZE-1)] = '\0'; + entry->mFirstName = agent[FIRST].asString(); + entry->mLastName = agent[LAST].asString(); impl.mCache[id] = entry; + std::string fullname = buildFullName(entry->mFirstName, entry->mLastName); + impl.mReverseCache[fullname] = id; + ++count; } llinfos << "LLCacheName loaded " << count << " agent names" << llendl; @@ -450,10 +354,9 @@ bool LLCacheName::importFile(std::istream& istr) LLCacheNameEntry* entry = new LLCacheNameEntry(); entry->mIsGroup = true; entry->mCreateTime = ctime; - std::string name = group[NAME].asString(); - name.copy(entry->mGroupName, DB_GROUP_NAME_BUF_SIZE, 0); - entry->mGroupName[llmin(name.size(), (std::string::size_type)DB_GROUP_NAME_BUF_SIZE-1)] = '\0'; + entry->mGroupName = group[NAME].asString(); impl.mCache[id] = entry; + impl.mReverseCache[entry->mGroupName] = id; ++count; } llinfos << "LLCacheName loaded " << count << " group names" << llendl; @@ -470,8 +373,8 @@ void LLCacheName::exportFile(std::ostream& ostr) // Only write entries for which we have valid data. LLCacheNameEntry* entry = iter->second; if(!entry - || (NULL != strchr(entry->mFirstName, '?')) - || (NULL != strchr(entry->mGroupName, '?'))) + || (std::string::npos != entry->mFirstName.find('?')) + || (std::string::npos != entry->mGroupName.find('?'))) { continue; } @@ -479,13 +382,14 @@ void LLCacheName::exportFile(std::ostream& ostr) // store it LLUUID id = iter->first; std::string id_str = id.asString(); - if(entry->mFirstName[0] && entry->mLastName[0]) + // IDEVO TODO: Should we store SLIDs with last name "Resident" or not? + if(!entry->mFirstName.empty() && !entry->mLastName.empty()) { data[AGENTS][id_str][FIRST] = entry->mFirstName; data[AGENTS][id_str][LAST] = entry->mLastName; data[AGENTS][id_str][CTIME] = (S32)entry->mCreateTime; } - else if(entry->mIsGroup && entry->mGroupName[0]) + else if(entry->mIsGroup && !entry->mGroupName.empty()) { data[GROUPS][id_str][NAME] = entry->mGroupName; data[GROUPS][id_str][CTIME] = (S32)entry->mCreateTime; @@ -496,16 +400,16 @@ void LLCacheName::exportFile(std::ostream& ostr) } -BOOL LLCacheName::getName(const LLUUID& id, std::string& first, std::string& last) +BOOL LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::string& last) { if(id.isNull()) { - first = CN_NOBODY; + first = sCacheName["nobody"]; last.clear(); - return FALSE; + return TRUE; } - LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id ); + LLCacheNameEntry* entry = get_ptr_in_map(mCache, id ); if (entry) { first = entry->mFirstName; @@ -514,45 +418,46 @@ BOOL LLCacheName::getName(const LLUUID& id, std::string& first, std::string& las } else { - first = CN_WAITING; + first = sCacheName["waiting"]; last.clear(); - if (!impl.isRequestPending(id)) + if (!isRequestPending(id)) { - impl.mAskNameQueue.insert(id); + mAskNameQueue.insert(id); } return FALSE; } } -BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname) +// static +void LLCacheName::localizeCacheName(std::string key, std::string value) { - std::string first_name, last_name; - BOOL res = getName(id, first_name, last_name); - fullname = first_name + " " + last_name; - return res; + if (key!="" && value!= "" ) + sCacheName[key]=value; + else + llwarns<< " Error localizing cache key " << key << " To "<< value<<llendl; } -// *TODO: Deprecate -BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last) +BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname) { std::string first_name, last_name; - BOOL res = getName(id, first_name, last_name); - strcpy(first, first_name.c_str()); - strcpy(last, last_name.c_str()); + BOOL res = impl.getName(id, first_name, last_name); + fullname = buildFullName(first_name, last_name); return res; } + + BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) { if(id.isNull()) { - group = CN_NONE; - return FALSE; + group = sCacheName["none"]; + return TRUE; } LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache,id); - if (entry && !entry->mGroupName[0]) + if (entry && entry->mGroupName.empty()) { // COUNTER-HACK to combat James' HACK in exportFile()... // this group name was loaded from a name cache that did not @@ -568,7 +473,7 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) } else { - group = CN_WAITING; + group = sCacheName["waiting"]; if (!impl.isRequestPending(id)) { impl.mAskGroupQueue.insert(id); @@ -577,36 +482,109 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) } } -// *TODO: Deprecate -BOOL LLCacheName::getGroupName(const LLUUID& id, char* group) +BOOL LLCacheName::getUUID(const std::string& first, const std::string& last, LLUUID& id) { - std::string group_name; - BOOL res = getGroupName(id, group_name); - strcpy(group, group_name.c_str()); - return res; + std::string full_name = buildFullName(first, last); + return getUUID(full_name, id); +} + +BOOL LLCacheName::getUUID(const std::string& full_name, LLUUID& id) +{ + ReverseCache::iterator iter = impl.mReverseCache.find(full_name); + if (iter != impl.mReverseCache.end()) + { + id = iter->second; + return TRUE; + } + else + { + return FALSE; + } +} + +//static +std::string LLCacheName::buildFullName(const std::string& first, const std::string& last) +{ + std::string fullname = first; + if (!last.empty() + && last != "Resident") + { + fullname += ' '; + fullname += last; + } + return fullname; } +//static +std::string LLCacheName::cleanFullName(const std::string& full_name) +{ + return full_name.substr(0, full_name.find(" Resident")); +} -// TODO: Make the cache name callback take a SINGLE std::string, -// not a separate first and last name. -void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callback, void* user_data) +//static +std::string LLCacheName::buildUsername(const std::string& full_name) { + // rare, but handle hard-coded error names returned from server + if (full_name == "(\?\?\?) (\?\?\?)") + { + return "(\?\?\?)"; + } + + std::string::size_type index = full_name.find(' '); + + if (index != std::string::npos) + { + std::string username; + username = full_name.substr(0, index); + std::string lastname = full_name.substr(index+1); + + if (lastname != "Resident") + { + username = username + "." + lastname; + } + + LLStringUtil::toLower(username); + return username; + } + + // if the input wasn't a correctly formatted legacy name just return it unchanged + return full_name; +} + +// This is a little bit kludgy. LLCacheNameCallback is a slot instead of a function pointer. +// The reason it is a slot is so that the legacy get() function below can bind an old callback +// and pass it as a slot. The reason it isn't a boost::function is so that trackable behavior +// doesn't get lost. As a result, we have to bind the slot to a signal to call it, even when +// we call it immediately. -Steve +// NOTE: Even though passing first and last name is a bit of extra overhead, it eliminates the +// potential need for any parsing should any code need to handle first and last name independently. +boost::signals2::connection LLCacheName::get(const LLUUID& id, bool is_group, const LLCacheNameCallback& callback) +{ + boost::signals2::connection res; + if(id.isNull()) { - callback(id, CN_NOBODY, "", is_group, user_data); + LLCacheNameSignal signal; + signal.connect(callback); + signal(id, sCacheName["nobody"], is_group); + return res; } LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id ); if (entry) { + LLCacheNameSignal signal; + signal.connect(callback); // id found in map therefore we can call the callback immediately. if (entry->mIsGroup) { - callback(id, entry->mGroupName, "", entry->mIsGroup, user_data); + signal(id, entry->mGroupName, entry->mIsGroup); } else { - callback(id, entry->mFirstName, entry->mLastName, entry->mIsGroup, user_data); + std::string fullname = + buildFullName(entry->mFirstName, entry->mLastName); + signal(id, fullname, entry->mIsGroup); } } else @@ -623,12 +601,25 @@ void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callb impl.mAskNameQueue.insert(id); } } - impl.mReplyQueue.push_back(PendingReply(id, callback, user_data)); + res = impl.addPending(id, callback); } + return res; +} + +boost::signals2::connection LLCacheName::getGroup(const LLUUID& group_id, + const LLCacheNameCallback& callback) +{ + return get(group_id, true, callback); +} + +boost::signals2::connection LLCacheName::get(const LLUUID& id, bool is_group, old_callback_t callback, void* user_data) +{ + return get(id, is_group, boost::bind(callback, _1, _2, _3, user_data)); } void LLCacheName::processPending() { + LLMemType mt_pp(LLMemType::MTYPE_CACHE_PROCESS_PENDING); const F32 SECS_BETWEEN_PROCESS = 0.1f; if(!impl.mProcessTimer.checkExpirationAndReset(SECS_BETWEEN_PROCESS)) { @@ -695,7 +686,7 @@ void LLCacheName::dump() { llinfos << iter->first << " = " - << entry->mFirstName << " " << entry->mLastName + << buildFullName(entry->mFirstName, entry->mLastName) << " @ " << entry->mCreateTime << llendl; } @@ -710,18 +701,31 @@ void LLCacheName::dumpStats() << " AskGroup=" << impl.mAskGroupQueue.size() << " Pending=" << impl.mPendingQueue.size() << " Reply=" << impl.mReplyQueue.size() - << " Observers=" << impl.mObservers.size() +// << " Observers=" << impl.mSignal.size() << llendl; } +void LLCacheName::clear() +{ + for_each(impl.mCache.begin(), impl.mCache.end(), DeletePairedPointer()); + impl.mCache.clear(); +} + //static -LLString LLCacheName::getDefaultName() +std::string LLCacheName::getDefaultName() { - return LLString(CN_WAITING); + return sCacheName["waiting"]; +} + +//static +std::string LLCacheName::getDefaultLastName() +{ + return "Resident"; } void LLCacheName::Impl::processPendingAsks() { + LLMemType mt_ppa(LLMemType::MTYPE_CACHE_PROCESS_PENDING_ASKS); sendRequest(_PREHASH_UUIDNameRequest, mAskNameQueue); sendRequest(_PREHASH_UUIDGroupNameRequest, mAskGroupQueue); mAskNameQueue.clear(); @@ -730,50 +734,52 @@ void LLCacheName::Impl::processPendingAsks() void LLCacheName::Impl::processPendingReplies() { - ReplyQueue::iterator it = mReplyQueue.begin(); - ReplyQueue::iterator end = mReplyQueue.end(); - + LLMemType mt_ppr(LLMemType::MTYPE_CACHE_PROCESS_PENDING_REPLIES); // First call all the callbacks, because they might send messages. - for(; it != end; ++it) + for(ReplyQueue::iterator it = mReplyQueue.begin(); it != mReplyQueue.end(); ++it) { - LLCacheNameEntry* entry = get_ptr_in_map(mCache, it->mID); + PendingReply* reply = *it; + LLCacheNameEntry* entry = get_ptr_in_map(mCache, reply->mID); if(!entry) continue; - if (it->mCallback) + if (!entry->mIsGroup) { - if (!entry->mIsGroup) - { - (it->mCallback)(it->mID, - entry->mFirstName, entry->mLastName, - FALSE, it->mData); - } - else { - (it->mCallback)(it->mID, - entry->mGroupName, "", - TRUE, it->mData); - } + std::string fullname = + LLCacheName::buildFullName(entry->mFirstName, entry->mLastName); + (reply->mSignal)(reply->mID, fullname, false); + } + else + { + (reply->mSignal)(reply->mID, entry->mGroupName, true); } } // Forward on all replies, if needed. ReplySender sender(mMsg); - for (it = mReplyQueue.begin(); it != end; ++it) + for(ReplyQueue::iterator it = mReplyQueue.begin(); it != mReplyQueue.end(); ++it) { - LLCacheNameEntry* entry = get_ptr_in_map(mCache, it->mID); + PendingReply* reply = *it; + LLCacheNameEntry* entry = get_ptr_in_map(mCache, reply->mID); if(!entry) continue; - if (it->mHost.isOk()) + if (reply->mHost.isOk()) { - sender.send(it->mID, *entry, it->mHost); + sender.send(reply->mID, *entry, reply->mHost); } - it->done(); + reply->done(); + } + + for(ReplyQueue::iterator it = mReplyQueue.begin(); it != mReplyQueue.end(); ) + { + ReplyQueue::iterator curit = it++; + PendingReply* reply = *curit; + if (reply->isDone()) + { + delete reply; + mReplyQueue.erase(curit); + } } - - mReplyQueue.erase( - remove_if(mReplyQueue.begin(), mReplyQueue.end(), - std::mem_fun_ref(&PendingReply::isDone)), - mReplyQueue.end()); } @@ -811,18 +817,6 @@ void LLCacheName::Impl::sendRequest( } } -void LLCacheName::Impl::notifyObservers(const LLUUID& id, - const char* first, const char* last, BOOL is_group) -{ - for (Observers::const_iterator i = mObservers.begin(), - end = mObservers.end(); - i != end; - ++i) - { - (**i)(id, first, last, is_group, NULL); - } -} - bool LLCacheName::Impl::isRequestPending(const LLUUID& id) { U32 now = (U32)time(NULL); @@ -889,7 +883,7 @@ void LLCacheName::Impl::processUUIDRequest(LLMessageSystem* msg, bool isGroup) } } - mReplyQueue.push_back(PendingReply(id, fromHost)); + addPending(id, fromHost); } } } @@ -916,23 +910,39 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup) entry->mCreateTime = (U32)time(NULL); if (!isGroup) { - msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_FirstName, DB_FIRST_NAME_BUF_SIZE, entry->mFirstName, i); - msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, DB_LAST_NAME_BUF_SIZE, entry->mLastName, i); + msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_FirstName, entry->mFirstName, i); + msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, entry->mLastName, i); } else - { - msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_GroupName, DB_GROUP_NAME_BUF_SIZE, entry->mGroupName, i); + { // is group + msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_GroupName, entry->mGroupName, i); + LLStringFn::replace_ascii_controlchars(entry->mGroupName, LL_UNKNOWN_CHAR); } if (!isGroup) { - notifyObservers(id, - entry->mFirstName, entry->mLastName, - FALSE); + // NOTE: Very occasionally the server sends down a full name + // in the first name field with an empty last name, for example, + // first = "Ladanie1 Resident", last = "". + // I cannot reproduce this, nor can I find a bug in the server code. + // Ensure "Resident" does not appear via cleanFullName, because + // buildFullName only checks last name. JC + std::string full_name; + if (entry->mLastName.empty()) + { + full_name = cleanFullName(entry->mFirstName); + } + else + { + full_name = LLCacheName::buildFullName(entry->mFirstName, entry->mLastName); + } + mSignal(id, full_name, false); + mReverseCache[full_name] = id; } else { - notifyObservers(id, entry->mGroupName, "", TRUE); + mSignal(id, entry->mGroupName, true); + mReverseCache[entry->mGroupName] = id; } } } @@ -960,4 +970,3 @@ void LLCacheName::Impl::handleUUIDGroupNameReply(LLMessageSystem* msg, void** us { ((LLCacheName::Impl*)userData)->processUUIDReply(msg, true); } - diff --git a/indra/llmessage/llcachename.h b/indra/llmessage/llcachename.h index d9518e0f91..b469803060 100644 --- a/indra/llmessage/llcachename.h +++ b/indra/llmessage/llcachename.h @@ -2,42 +2,46 @@ * @file llcachename.h * @brief A cache of names from UUIDs. * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #ifndef LL_LLCACHENAME_H #define LL_LLCACHENAME_H +#include <boost/bind.hpp> +#include <boost/signals2.hpp> + class LLMessageSystem; class LLHost; class LLUUID; -// agent_id/group_id, first_name, last_name, is_group, user_data -typedef void (*LLCacheNameCallback)(const LLUUID&, const char*, const char*, BOOL, void*); + +typedef boost::signals2::signal<void (const LLUUID& id, + const std::string& name, + bool is_group)> LLCacheNameSignal; +typedef LLCacheNameSignal::slot_type LLCacheNameCallback; + +// Old callback with user data for compatability +typedef void (*old_callback_t)(const LLUUID&, const std::string&, bool, void*); // Here's the theory: // If you request a name that isn't in the cache, it returns "waiting" @@ -58,44 +62,53 @@ public: // for simulators, this is the data server void setUpstream(const LLHost& upstream_host); - void addObserver(LLCacheNameCallback callback); - void removeObserver(LLCacheNameCallback callback); - - void cancelCallback(const LLUUID& id, LLCacheNameCallback callback, void* user_data = NULL); - - // janky old format. Remove after a while. Phoenix. 2008-01-30 - void importFile(FILE* fp); + boost::signals2::connection addObserver(const LLCacheNameCallback& callback); // storing cache on disk; for viewer, in name.cache bool importFile(std::istream& istr); void exportFile(std::ostream& ostr); - // If available, copies the first and last name into the strings provided. - // first must be at least DB_FIRST_NAME_BUF_SIZE characters. - // last must be at least DB_LAST_NAME_BUF_SIZE characters. + // If available, copies name ("bobsmith123" or "James Linden") into string // If not available, copies the string "waiting". // Returns TRUE iff available. - BOOL getName(const LLUUID& id, char* first, char* last); - BOOL getName(const LLUUID& id, std::string& first, std::string& last); - BOOL getFullName(const LLUUID& id, std::string& fullname); + BOOL getFullName(const LLUUID& id, std::string& full_name); + + // Reverse lookup of UUID from name + BOOL getUUID(const std::string& first, const std::string& last, LLUUID& id); + BOOL getUUID(const std::string& fullname, LLUUID& id); + + // IDEVO Temporary code + // Clean up new-style "bobsmith123 Resident" names to "bobsmith123" for display + static std::string buildFullName(const std::string& first, const std::string& last); + + // Clean up legacy "bobsmith123 Resident" to "bobsmith123" + // If name does not contain "Resident" returns it unchanged. + static std::string cleanFullName(const std::string& full_name); + + // Converts a standard legacy name to a username + // "bobsmith123 Resident" -> "bobsmith" + // "Random Linden" -> "random.linden" + static std::string buildUsername(const std::string& name); // If available, this method copies the group name into the string // provided. The caller must allocate at least // DB_GROUP_NAME_BUF_SIZE characters. If not available, this // method copies the string "waiting". Returns TRUE iff available. - BOOL getGroupName(const LLUUID& id, char* group); BOOL getGroupName(const LLUUID& id, std::string& group); // Call the callback with the group or avatar name. // If the data is currently available, may call the callback immediatly // otherwise, will request the data, and will call the callback when // available. There is no garuntee the callback will ever be called. - void get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callback, void* user_data = NULL); - - // LEGACY - void getName(const LLUUID& id, LLCacheNameCallback callback, void* user_data = NULL) - { get(id, FALSE, callback, user_data); } + boost::signals2::connection get(const LLUUID& id, bool is_group, const LLCacheNameCallback& callback); + + // Convenience method for looking up a group name, so you can + // tell the difference between avatar lookup and group lookup + // in global searches + boost::signals2::connection getGroup(const LLUUID& group_id, const LLCacheNameCallback& callback); + // LEGACY + boost::signals2::connection get(const LLUUID& id, bool is_group, old_callback_t callback, void* user_data); // This method needs to be called from time to time to send out // requests. void processPending(); @@ -106,9 +119,16 @@ public: // Debugging void dump(); // Dumps the contents of the cache void dumpStats(); // Dumps the sizes of the cache and associated queues. + void clear(); // Deletes all entries from the cache + + static std::string getDefaultName(); - static LLString getDefaultName(); + // Returns "Resident", the default last name for SLID-based accounts + // that have no last name. + static std::string getDefaultLastName(); + static void localizeCacheName(std::string key, std::string value); + static std::map<std::string, std::string> sCacheName; private: class Impl; diff --git a/indra/llmessage/llchainio.cpp b/indra/llmessage/llchainio.cpp index 226ee10a5e..bcda6746a1 100644 --- a/indra/llmessage/llchainio.cpp +++ b/indra/llmessage/llchainio.cpp @@ -4,30 +4,25 @@ * @date 2005-08-04 * @brief Implementaiton of the chain factory. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llchainio.h b/indra/llmessage/llchainio.h index 3e32956362..6e4d6c2013 100644 --- a/indra/llmessage/llchainio.h +++ b/indra/llmessage/llchainio.h @@ -4,30 +4,25 @@ * @date 2005-08-04 * @brief This class declares the interface for constructing io chains. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llcipher.h b/indra/llmessage/llcipher.h index 669c8aa7ca..76e3a7a5a3 100644 --- a/indra/llmessage/llcipher.h +++ b/indra/llmessage/llcipher.h @@ -2,30 +2,25 @@ * @file llcipher.h * @brief Abstract base class for encryption ciphers. * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp index 0db9f8e2f1..3ba2dfb104 100644 --- a/indra/llmessage/llcircuit.cpp +++ b/indra/llmessage/llcircuit.cpp @@ -2,30 +2,25 @@ * @file llcircuit.cpp * @brief Class to track UDP endpoints for the message system. * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -60,8 +55,8 @@ #include "llrand.h" #include "llstl.h" #include "lltransfermanager.h" +#include "llmodularmath.h" -const F32 PING_INTERVAL = 5.f; // seconds const S32 PING_START_BLOCK = 3; // How many pings behind we have to be to consider ourself blocked. const S32 PING_RELEASE_BLOCK = 2; // How many pings behind we have to be to consider ourself unblocked. @@ -69,12 +64,15 @@ const F32 TARGET_PERIOD_LENGTH = 5.f; // seconds const F32 LL_DUPLICATE_SUPPRESSION_TIMEOUT = 60.f; //seconds - this can be long, as time-based cleanup is // only done when wrapping packetids, now... -LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id) +LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id, + const F32 circuit_heartbeat_interval, const F32 circuit_timeout) : mHost (host), mWrapID(0), mPacketsOutID(0), mPacketsInID(in_id), mHighestPacketID(in_id), + mTimeoutCallback(NULL), + mTimeoutUserData(NULL), mTrusted(FALSE), mbAllowTimeout(TRUE), mbAlive(TRUE), @@ -100,11 +98,14 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id) mBytesOutLastPeriod(0), mBytesInThisPeriod(0), mBytesOutThisPeriod(0), - mPeakBPSIn(0), - mPeakBPSOut(0), + mPeakBPSIn(0.f), + mPeakBPSOut(0.f), mPeriodTime(0.0), mExistenceTimer(), - mCurrentResendCount(0) + mCurrentResendCount(0), + mLastPacketGap(0), + mHeartbeatInterval(circuit_heartbeat_interval), + mHeartbeatTimeout(circuit_timeout) { // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been // running a message system loop. @@ -112,14 +113,11 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id) F32 distribution_offset = ll_frand(); mPingTime = mt_sec; - mLastPingSendTime = mt_sec + PING_INTERVAL * distribution_offset; + mLastPingSendTime = mt_sec + mHeartbeatInterval * distribution_offset; mLastPingReceivedTime = mt_sec; - mNextPingSendTime = mLastPingSendTime + 0.95*PING_INTERVAL + ll_frand(0.1f*PING_INTERVAL); + mNextPingSendTime = mLastPingSendTime + 0.95*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval); mPeriodTime = mt_sec; - mTimeoutCallback = NULL; - mTimeoutUserData = NULL; - mLocalEndPointID.generate(); } @@ -184,7 +182,7 @@ LLCircuitData::~LLCircuitData() std::ostream_iterator<TPACKETID> append(str, " "); str << "MSG: -> " << mHost << "\tABORTING RELIABLE:\t"; std::copy(doomed.begin(), doomed.end(), append); - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } } @@ -204,7 +202,7 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num) std::ostringstream str; str << "MSG: <- " << packetp->mHost << "\tRELIABLE ACKED:\t" << packetp->mPacketID; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } if (packetp->mCallback) { @@ -238,7 +236,7 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num) std::ostringstream str; str << "MSG: <- " << packetp->mHost << "\tRELIABLE ACKED:\t" << packetp->mPacketID; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } if (packetp->mCallback) { @@ -342,7 +340,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) std::ostringstream str; str << "MSG: -> " << packetp->mHost << "\tRESENDING RELIABLE:\t" << packetp->mPacketID; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } packetp->mBuffer[0] |= LL_RESENT_FLAG; // tag packet id as being a resend @@ -403,7 +401,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) std::ostringstream str; str << "MSG: -> " << packetp->mHost << "\tABORTING RELIABLE:\t" << packetp->mPacketID; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } if (packetp->mCallback) @@ -428,7 +426,8 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) } -LLCircuit::LLCircuit() : mLastCircuit(NULL) +LLCircuit::LLCircuit(const F32 circuit_heartbeat_interval, const F32 circuit_timeout) : mLastCircuit(NULL), + mHeartbeatInterval(circuit_heartbeat_interval), mHeartbeatTimeout(circuit_timeout) { } @@ -446,7 +445,7 @@ LLCircuitData *LLCircuit::addCircuitData(const LLHost &host, TPACKETID in_id) { // This should really validate if one already exists llinfos << "LLCircuit::addCircuitData for " << host << llendl; - LLCircuitData *tempp = new LLCircuitData(host, in_id); + LLCircuitData *tempp = new LLCircuitData(host, in_id, mHeartbeatInterval, mHeartbeatTimeout); mCircuitData.insert(circuit_data_map::value_type(host, tempp)); mPingSet.insert(tempp); @@ -676,6 +675,8 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) mPacketsIn++; setPacketInID((id + 1) % LL_MAX_OUT_PACKET_ID); + mLastPacketGap = 0; + mOutOfOrderRate.count(0); return; } @@ -683,6 +684,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) // now, check to see if we've got a gap + U32 gap = 0; if ((mPacketsInID == id)) { // nope! bump and wrap the counter, then return @@ -704,13 +706,18 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) // otherwise, walk from mCurrentCircuit->mPacketsInID to id with wrapping, adding the values to the map // and setting mPacketsInID to id + 1 % LL_MAX_OUT_PACKET_ID + // babbage: all operands in expression are unsigned, so modular + // arithmetic will always find correct gap, regardless of wrap arounds. + const U8 width = 24; + gap = LLModularMath::subtract<width>(mPacketsInID, id); + if (mPotentialLostPackets.find(id) != mPotentialLostPackets.end()) { if(gMessageSystem->mVerboseLog) { std::ostringstream str; str << "MSG: <- " << mHost << "\tRECOVERING LOST:\t" << id; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } // llinfos << "removing potential lost: " << id << llendl; mPotentialLostPackets.erase(id); @@ -729,7 +736,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) std::ostringstream str; str << "MSG: <- " << mHost << "\tPACKET GAP:\t" << index; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } // llinfos << "adding potential lost: " << index << llendl; @@ -747,7 +754,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) std::ostringstream str; str << "MSG: <- " << mHost << "\tPACKET GAP:\t" << id << " expected " << index; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } } @@ -765,6 +772,8 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) } } + mOutOfOrderRate.count(gap); + mLastPacketGap = gap; } @@ -790,7 +799,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys) // Always remember to remove it from the set before changing the sorting // key (mNextPingSendTime) mPingSet.erase(psit); - cdp->mNextPingSendTime = cur_time + PING_INTERVAL; + cdp->mNextPingSendTime = cur_time + mHeartbeatInterval; mPingSet.insert(cdp); continue; } @@ -808,7 +817,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys) if (cdp->updateWatchDogTimers(msgsys)) { // Randomize our pings a bit by doing some up to 5% early or late - F64 dt = 0.95f*PING_INTERVAL + ll_frand(0.1f*PING_INTERVAL); + F64 dt = 0.95f*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval); // Remove it, and reinsert it with the new next ping time. // Always remove before changing the sorting key. @@ -969,7 +978,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) std::ostringstream str; str << "MSG: <- " << mHost << "\tLOST PACKET:\t" << (*it).first; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } mPotentialLostPackets.erase(it++); } @@ -1036,7 +1045,7 @@ BOOL LLCircuitData::checkCircuitTimeout() F64 time_since_last_ping = LLMessageSystem::getMessageTimeSeconds() - mLastPingReceivedTime; // Nota Bene: This needs to be turned off if you are debugging multiple simulators - if (time_since_last_ping > PING_INTERVAL_MAX) + if (time_since_last_ping > mHeartbeatTimeout) { llwarns << "LLCircuitData::checkCircuitTimeout for " << mHost << " last ping " << time_since_last_ping << " seconds ago." <<llendl; setAlive(FALSE); @@ -1052,10 +1061,7 @@ BOOL LLCircuitData::checkCircuitTimeout() return FALSE; } } - else if (time_since_last_ping > PING_INTERVAL_ALARM) - { - //llwarns << "Unresponsive circuit: " << mHost << ": " << time_since_last_ping << " seconds since last ping."<< llendl; - } + return TRUE; } @@ -1114,7 +1120,7 @@ void LLCircuit::sendAcks() str << "MSG: -> " << cd->mHost << "\tPACKET ACKS:\t"; std::ostream_iterator<TPACKETID> append(str, " "); std::copy(cd->mAcks.begin(), cd->mAcks.end(), append); - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } // empty out the acks list @@ -1269,7 +1275,7 @@ void LLCircuitData::pingTimerStop(const U8 ping_id) delta_ping += 256; } - U32 msec = (U32) ((delta_ping*PING_INTERVAL + time) * 1000.f); + U32 msec = (U32) ((delta_ping*mHeartbeatInterval + time) * 1000.f); setPingDelay(msec); mPingsInTransit = delta_ping; @@ -1360,7 +1366,8 @@ F32 LLCircuitData::getPingInTransitTime() if (mPingsInTransit) { - time_since_ping_was_sent = (F32)((mPingsInTransit*PING_INTERVAL - 1) + (LLMessageSystem::getMessageTimeSeconds() - mPingTime))*1000.f; + time_since_ping_was_sent = (F32)((mPingsInTransit*mHeartbeatInterval - 1) + + (LLMessageSystem::getMessageTimeSeconds() - mPingTime))*1000.f; } return time_since_ping_was_sent; diff --git a/indra/llmessage/llcircuit.h b/indra/llmessage/llcircuit.h index 8824e6825a..874c0c0bee 100644 --- a/indra/llmessage/llcircuit.h +++ b/indra/llmessage/llcircuit.h @@ -3,30 +3,25 @@ * @brief Provides a method for tracking network circuit information * for the UDP message system * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -45,14 +40,11 @@ #include "llpacketack.h" #include "lluuid.h" #include "llthrottle.h" +#include "llstat.h" // // Constants // -const F32 PING_INTERVAL_MAX = 100.f; -const F32 PING_INTERVAL_ALARM = 50.f; - - const F32 LL_AVERAGED_PING_ALPHA = 0.2f; // relaxation constant on ping running average const F32 LL_AVERAGED_PING_MAX = 2000; // msec const F32 LL_AVERAGED_PING_MIN = 100; // msec // IW: increased to avoid retransmits when a process is slow @@ -84,7 +76,8 @@ class LLSD; class LLCircuitData { public: - LLCircuitData(const LLHost &host, TPACKETID in_id); + LLCircuitData(const LLHost &host, TPACKETID in_id, + const F32 circuit_heartbeat_interval, const F32 circuit_timeout); ~LLCircuitData(); S32 resendUnackedPackets(const F64 now); @@ -133,6 +126,10 @@ public: S32 getUnackedPacketCount() const { return mUnackedPacketCount; } S32 getUnackedPacketBytes() const { return mUnackedPacketBytes; } F64 getNextPingSendTime() const { return mNextPingSendTime; } + F32 getOutOfOrderRate(LLStatAccum::TimeScale scale = LLStatAccum::SCALE_MINUTE) + { return mOutOfOrderRate.meanValue(scale); } + U32 getLastPacketGap() const { return mLastPacketGap; } + LLHost getHost() const { return mHost; } LLThrottleGroup &getThrottleGroup() { return mThrottles; } @@ -276,6 +273,11 @@ protected: LLTimer mExistenceTimer; // initialized when circuit created, used to track bandwidth numbers S32 mCurrentResendCount; // Number of resent packets since last spam + LLStatRate mOutOfOrderRate; // Rate of out of order packets coming in. + U32 mLastPacketGap; // Gap in sequence number of last packet. + + const F32 mHeartbeatInterval; + const F32 mHeartbeatTimeout; }; @@ -285,7 +287,7 @@ class LLCircuit { public: // CREATORS - LLCircuit(); + LLCircuit(const F32 circuit_heartbeat_interval, const F32 circuit_timeout); ~LLCircuit(); // ACCESSORS @@ -338,5 +340,9 @@ protected: // optimize the many, many times we call findCircuit. This may be // set in otherwise const methods, so it is declared mutable. mutable LLCircuitData* mLastCircuit; + +private: + const F32 mHeartbeatInterval; + const F32 mHeartbeatTimeout; }; #endif diff --git a/indra/llmessage/llclassifiedflags.cpp b/indra/llmessage/llclassifiedflags.cpp index b34ebfe042..f6084d4a60 100644 --- a/indra/llmessage/llclassifiedflags.cpp +++ b/indra/llmessage/llclassifiedflags.cpp @@ -2,30 +2,25 @@ * @file llclassifiedflags.cpp * @brief * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -40,18 +35,35 @@ #include "linden_common.h" #include "llclassifiedflags.h" - -ClassifiedFlags pack_classified_flags(BOOL is_mature, BOOL auto_renew) + +ClassifiedFlags pack_classified_flags_request(BOOL auto_renew, BOOL inc_pg, BOOL inc_mature, BOOL inc_adult) +{ + U8 rv = 0; + if(inc_pg) rv |= CLASSIFIED_QUERY_INC_PG; + if(inc_mature) rv |= CLASSIFIED_QUERY_INC_MATURE; + if (inc_pg && !inc_mature) rv |= CLASSIFIED_FLAG_MATURE; + if(inc_adult) rv |= CLASSIFIED_QUERY_INC_ADULT; + if(auto_renew) rv |= CLASSIFIED_FLAG_AUTO_RENEW; + return rv; +} + +ClassifiedFlags pack_classified_flags(BOOL auto_renew, BOOL inc_pg, BOOL inc_mature, BOOL inc_adult) { U8 rv = 0; - if(is_mature) rv |= CLASSIFIED_FLAG_MATURE; + if(inc_pg) rv |= CLASSIFIED_QUERY_INC_PG; + if(inc_mature) + { + rv |= CLASSIFIED_QUERY_INC_MATURE; + rv |= CLASSIFIED_FLAG_MATURE; + } + if(inc_adult) rv |= CLASSIFIED_QUERY_INC_ADULT; if(auto_renew) rv |= CLASSIFIED_FLAG_AUTO_RENEW; return rv; } bool is_cf_mature(ClassifiedFlags flags) { - return ((flags & CLASSIFIED_FLAG_MATURE) != 0); + return ((flags & CLASSIFIED_FLAG_MATURE) != 0) || ((flags & CLASSIFIED_QUERY_INC_MATURE) != 0); } // Deprecated, but leaving commented out because someday we might diff --git a/indra/llmessage/llclassifiedflags.h b/indra/llmessage/llclassifiedflags.h index bcd03d939e..17fc867453 100644 --- a/indra/llmessage/llclassifiedflags.h +++ b/indra/llmessage/llclassifiedflags.h @@ -2,30 +2,25 @@ * @file llclassifiedflags.h * @brief Flags used in the classifieds. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -42,12 +37,23 @@ const U8 CLASSIFIED_FLAG_UPDATE_TIME= 1 << 4; const U8 CLASSIFIED_FLAG_AUTO_RENEW = 1 << 5; const U8 CLASSIFIED_QUERY_FILTER_MATURE = 1 << 1; -const U8 CLASSIFIED_QUERY_FILTER_ENABLED = 1 << 2; -const U8 CLASSIFIED_QUERY_FILTER_PRICE = 1 << 3; +//const U8 CLASSIFIED_QUERY_FILTER_ENABLED = 1 << 2; +//const U8 CLASSIFIED_QUERY_FILTER_PRICE = 1 << 3; + +// These are new with Adult-enabled viewers (1.23 and later) +const U8 CLASSIFIED_QUERY_INC_PG = 1 << 2; +const U8 CLASSIFIED_QUERY_INC_MATURE = 1 << 3; +const U8 CLASSIFIED_QUERY_INC_ADULT = 1 << 6; +const U8 CLASSIFIED_QUERY_INC_NEW_VIEWER = (CLASSIFIED_QUERY_INC_PG | CLASSIFIED_QUERY_INC_MATURE | CLASSIFIED_QUERY_INC_ADULT); const S32 MAX_CLASSIFIEDS = 100; -ClassifiedFlags pack_classified_flags(BOOL is_mature, BOOL auto_renew); +// This function is used in AO viewers to pack old query flags into the request +// so that they can talk to old dataservers properly. When the AO servers are deployed on agni +// we can revert back to ClassifiedFlags pack_classified_flags and get rider of this one. +ClassifiedFlags pack_classified_flags_request(BOOL auto_renew, BOOL is_pg, BOOL is_mature, BOOL is_adult); + +ClassifiedFlags pack_classified_flags(BOOL auto_renew, BOOL is_pg, BOOL is_mature, BOOL is_adult); bool is_cf_mature(ClassifiedFlags flags); //bool is_cf_enabled(ClassifiedFlags flags); bool is_cf_update_time(ClassifiedFlags flags); diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 8b9a45ff3f..a485fa0160 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -4,30 +4,25 @@ * @date 2006-10-15 * @brief Implementation of wrapper around libcurl. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -73,7 +68,7 @@ ////////////////////////////////////////////////////////////////////////////// -static const S32 EASY_HANDLE_POOL_SIZE = 5; +static const U32 EASY_HANDLE_POOL_SIZE = 5; static const S32 MULTI_PERFORM_CALL_REPEAT = 5; static const S32 CURL_REQUEST_TIMEOUT = 30; // seconds static const S32 MAX_ACTIVE_REQUEST_COUNT = 100; @@ -101,6 +96,12 @@ void LLCurl::setCAFile(const std::string& file) sCAFile = file; } +//static +std::string LLCurl::getVersionString() +{ + return std::string(curl_version()); +} + ////////////////////////////////////////////////////////////////////////////// LLCurl::Responder::Responder() @@ -113,50 +114,45 @@ LLCurl::Responder::~Responder() } // virtual +void LLCurl::Responder::errorWithContent( + U32 status, + const std::string& reason, + const LLSD&) +{ + error(status, reason); +} + +// virtual void LLCurl::Responder::error(U32 status, const std::string& reason) { - llinfos << status << ": " << reason << llendl; + llinfos << mURL << " [" << status << "]: " << reason << llendl; } // virtual void LLCurl::Responder::result(const LLSD& content) { - llwarns << "Virtual Function not implemented" << llendl; } -// virtual -void LLCurl::Responder::completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, - const LLIOPipe::buffer_ptr_t& buffer) +void LLCurl::Responder::setURL(const std::string& url) { - if (isGoodStatus(status)) - { - LLSD content; - LLBufferStream istr(channels, buffer.get()); - LLSDSerialize::fromXML(content, istr); -/* - const S32 parseError = -1; - if(LLSDSerialize::fromXML(content, istr) == parseError) - { - mStatus = 498; - mReason = "Client Parse Error"; - } -*/ - completed(status, reason, content); - } - else if (status == 400) - { - // Get reason from buffer - char tbuf[4096]; - S32 len = 4096; - buffer->readAfter(channels.in(), NULL, (U8*)tbuf, len); - tbuf[len] = 0; - completed(status, std::string(tbuf), LLSD()); - } - else + mURL = url; +} + +// virtual +void LLCurl::Responder::completedRaw( + U32 status, + const std::string& reason, + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) +{ + LLSD content; + LLBufferStream istr(channels, buffer.get()); + if (!LLSDSerialize::fromXML(content, istr)) { - completed(status, reason, LLSD()); + llinfos << "Failed to deserialize LLSD. " << mURL << " [" << status << "]: " << reason << llendl; } + + completed(status, reason, content); } // virtual @@ -168,7 +164,7 @@ void LLCurl::Responder::completed(U32 status, const std::string& reason, const L } else { - error(status, reason); + errorWithContent(status, reason, content); } } @@ -227,7 +223,7 @@ public: U32 report(CURLcode); void getTransferInfo(LLCurl::TransferInfo* info); - void prepRequest(const std::string& url, ResponderPtr, bool post = false); + void prepRequest(const std::string& url, const std::vector<std::string>& headers, ResponderPtr, bool post = false); const char* getErrorBuffer(); @@ -273,6 +269,10 @@ LLCurl::Easy* LLCurl::Easy::getEasy() delete easy; return NULL; } + + // set no DMS caching as default for all easy handles. This prevents them adopting a + // multi handles cache if they are added to one. + curl_easy_setopt(easy->mCurlEasyHandle, CURLOPT_DNS_CACHE_TIMEOUT, 0); ++gCurlEasyCount; return easy; } @@ -282,7 +282,7 @@ LLCurl::Easy::~Easy() curl_easy_cleanup(mCurlEasyHandle); --gCurlEasyCount; curl_slist_free_all(mHeaders); - for_each(mStrings.begin(), mStrings.end(), DeletePointer()); + for_each(mStrings.begin(), mStrings.end(), DeletePointerArray()); } void LLCurl::Easy::resetState() @@ -358,7 +358,7 @@ U32 LLCurl::Easy::report(CURLcode code) responseCode = 499; responseReason = strerror(code) + " : " + mErrorBuffer; } - + if (mResponder) { mResponder->completedRaw(responseCode, responseReason, mChannels, mOutput); @@ -435,7 +435,9 @@ size_t curlHeaderCallback(void* data, size_t size, size_t nmemb, void* user_data return n; } -void LLCurl::Easy::prepRequest(const std::string& url, ResponderPtr responder, bool post) +void LLCurl::Easy::prepRequest(const std::string& url, + const std::vector<std::string>& headers, + ResponderPtr responder, bool post) { resetState(); @@ -454,6 +456,13 @@ void LLCurl::Easy::prepRequest(const std::string& url, ResponderPtr responder, b setopt(CURLOPT_HEADERFUNCTION, (void*)&curlHeaderCallback); setopt(CURLOPT_HEADERDATA, (void*)this); + // Allow up to five redirects + if(responder && responder->followRedir()) + { + setopt(CURLOPT_FOLLOWLOCATION, 1); + setopt(CURLOPT_MAXREDIRS, MAX_REDIRECTS); + } + setErrorBuffer(); setCA(); @@ -468,8 +477,13 @@ void LLCurl::Easy::prepRequest(const std::string& url, ResponderPtr responder, b { slist_append("Connection: keep-alive"); slist_append("Keep-alive: 300"); + // Accept and other headers + for (std::vector<std::string>::const_iterator iter = headers.begin(); + iter != headers.end(); ++iter) + { + slist_append((*iter).c_str()); + } } - // *FIX: should have ACCEPT headers } //////////////////////////////////////////////////////////////////////////// @@ -675,18 +689,22 @@ std::string LLCurl::strerror(CURLcode errorcode) // For generating a simple request for data // using one multi and one easy per request -LLCurlRequest::LLCurlRequest() - : mActiveMulti(NULL) +LLCurlRequest::LLCurlRequest() : + mActiveMulti(NULL), + mActiveRequestCount(0) { + mThreadID = LLThread::currentID(); } LLCurlRequest::~LLCurlRequest() { + llassert_always(mThreadID == LLThread::currentID()); for_each(mMultiSet.begin(), mMultiSet.end(), DeletePointer()); } void LLCurlRequest::addMulti() { + llassert_always(mThreadID == LLThread::currentID()); LLCurl::Multi* multi = new LLCurl::Multi(); mMultiSet.insert(multi); mActiveMulti = multi; @@ -716,17 +734,20 @@ bool LLCurlRequest::addEasy(LLCurl::Easy* easy) void LLCurlRequest::get(const std::string& url, LLCurl::ResponderPtr responder) { - getByteRange(url, 0, -1, responder); + getByteRange(url, headers_t(), 0, -1, responder); } -bool LLCurlRequest::getByteRange(const std::string& url, S32 offset, S32 length, LLCurl::ResponderPtr responder) +bool LLCurlRequest::getByteRange(const std::string& url, + const headers_t& headers, + S32 offset, S32 length, + LLCurl::ResponderPtr responder) { LLCurl::Easy* easy = allocEasy(); if (!easy) { return false; } - easy->prepRequest(url, responder); + easy->prepRequest(url, headers, responder); easy->setopt(CURLOPT_HTTPGET, 1); if (length > 0) { @@ -738,14 +759,17 @@ bool LLCurlRequest::getByteRange(const std::string& url, S32 offset, S32 length, return res; } -bool LLCurlRequest::post(const std::string& url, const LLSD& data, LLCurl::ResponderPtr responder) +bool LLCurlRequest::post(const std::string& url, + const headers_t& headers, + const LLSD& data, + LLCurl::ResponderPtr responder) { LLCurl::Easy* easy = allocEasy(); if (!easy) { return false; } - easy->prepRequest(url, responder); + easy->prepRequest(url, headers, responder); LLSDSerialize::toXML(data, easy->getInput()); S32 bytes = easy->getInput().str().length(); @@ -754,7 +778,7 @@ bool LLCurlRequest::post(const std::string& url, const LLSD& data, LLCurl::Respo easy->setopt(CURLOPT_POSTFIELDS, (void*)NULL); easy->setopt(CURLOPT_POSTFIELDSIZE, bytes); - easy->slist_append("Content-Type: application/xml"); + easy->slist_append("Content-Type: application/llsd+xml"); easy->setHeaders(); lldebugs << "POSTING: " << bytes << " bytes." << llendl; @@ -765,6 +789,7 @@ bool LLCurlRequest::post(const std::string& url, const LLSD& data, LLCurl::Respo // Note: call once per frame S32 LLCurlRequest::process() { + llassert_always(mThreadID == LLThread::currentID()); S32 res = 0; for (curlmulti_set_t::iterator iter = mMultiSet.begin(); iter != mMultiSet.end(); ) @@ -784,6 +809,7 @@ S32 LLCurlRequest::process() S32 LLCurlRequest::getQueued() { + llassert_always(mThreadID == LLThread::currentID()); S32 queued = 0; for (curlmulti_set_t::iterator iter = mMultiSet.begin(); iter != mMultiSet.end(); ) @@ -870,6 +896,15 @@ void LLCurlEasyRequest::setReadCallback(curl_read_callback callback, void* userd } } +void LLCurlEasyRequest::setSSLCtxCallback(curl_ssl_ctx_callback callback, void* userdata) +{ + if (mEasy) + { + mEasy->setopt(CURLOPT_SSL_CTX_FUNCTION, (void*)callback); + mEasy->setopt(CURLOPT_SSL_CTX_DATA, userdata); + } +} + void LLCurlEasyRequest::slist_append(const char* str) { if (mEasy) @@ -882,6 +917,7 @@ void LLCurlEasyRequest::sendRequest(const std::string& url) { llassert_always(!mRequestSent); mRequestSent = true; + lldebugs << url << llendl; if (mEasy) { mEasy->setHeaders(); @@ -1003,7 +1039,7 @@ void LLCurl::initClass() S32 mutex_count = CRYPTO_num_locks(); for (S32 i=0; i<mutex_count; i++) { - sSSLMutex.push_back(new LLMutex(gAPRPoolp)); + sSSLMutex.push_back(new LLMutex(NULL)); } CRYPTO_set_id_callback(&LLCurl::ssl_thread_id); CRYPTO_set_locking_callback(&LLCurl::ssl_locking_callback); @@ -1019,3 +1055,4 @@ void LLCurl::cleanupClass() curl_global_cleanup(); } +const unsigned int LLCurl::MAX_REDIRECTS = 5; diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index 48c14d9460..64dadd6640 100644 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -4,30 +4,25 @@ * @date 2006-10-15 * @brief A wrapper around libcurl. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -84,17 +79,31 @@ public: return((200 <= status) && (status < 300)); } + virtual void errorWithContent( + U32 status, + const std::string& reason, + const LLSD& content); + //< called by completed() on bad status + virtual void error(U32 status, const std::string& reason); - // called with non-200 status codes + //< called by default error(status, reason, content) virtual void result(const LLSD& content); - - // Override point for clients that may want to use this class when the response is some other format besides LLSD - virtual void completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, - const LLIOPipe::buffer_ptr_t& buffer); + //< called by completed for good status codes. + + virtual void completedRaw( + U32 status, + const std::string& reason, + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer); + /**< Override point for clients that may want to use this + class when the response is some other format besides LLSD + */ - virtual void completed(U32 status, const std::string& reason, const LLSD& content); + virtual void completed( + U32 status, + const std::string& reason, + const LLSD& content); /**< The default implemetnation calls either: * result(), or @@ -105,8 +114,19 @@ public: // of the header can be parsed. In the ::completed call above only the body is contained in the LLSD. virtual void completedHeader(U32 status, const std::string& reason, const LLSD& content); + // Used internally to set the url for debugging later. + void setURL(const std::string& url); + + virtual bool followRedir() + { + return false; + } + public: /* but not really -- don't touch this */ U32 mReferenceCount; + + private: + std::string mURL; }; typedef boost::intrusive_ptr<Responder> ResponderPtr; @@ -120,6 +140,11 @@ public: * @ brief Set certificate authority path used to verify HTTPS certs. */ static void setCAPath(const std::string& path); + + /** + * @ brief Return human-readable string describing libcurl version. + */ + static std::string getVersionString(); /** * @ brief Get certificate authority file used to verify HTTPS certs. @@ -150,15 +175,13 @@ public: static std::vector<LLMutex*> sSSLMutex; // OpenSSL callbacks - static void LLCurl::ssl_locking_callback(int mode, int type, const char *file, int line); - static unsigned long LLCurl::ssl_thread_id(void); - - - -private: + static void ssl_locking_callback(int mode, int type, const char *file, int line); + static unsigned long ssl_thread_id(void); +private: static std::string sCAPath; static std::string sCAFile; + static const unsigned int MAX_REDIRECTS; }; namespace boost @@ -171,12 +194,14 @@ namespace boost class LLCurlRequest { public: + typedef std::vector<std::string> headers_t; + LLCurlRequest(); ~LLCurlRequest(); void get(const std::string& url, LLCurl::ResponderPtr responder); - bool getByteRange(const std::string& url, S32 offset, S32 length, LLCurl::ResponderPtr responder); - bool post(const std::string& url, const LLSD& data, LLCurl::ResponderPtr responder); + bool getByteRange(const std::string& url, const headers_t& headers, S32 offset, S32 length, LLCurl::ResponderPtr responder); + bool post(const std::string& url, const headers_t& headers, const LLSD& data, LLCurl::ResponderPtr responder); S32 process(); S32 getQueued(); @@ -190,6 +215,7 @@ private: curlmulti_set_t mMultiSet; LLCurl::Multi* mActiveMulti; S32 mActiveRequestCount; + U32 mThreadID; // debug }; class LLCurlEasyRequest @@ -203,6 +229,7 @@ public: void setHeaderCallback(curl_header_callback callback, void* userdata); void setWriteCallback(curl_write_callback callback, void* userdata); void setReadCallback(curl_read_callback callback, void* userdata); + void setSSLCtxCallback(curl_ssl_ctx_callback callback, void* userdata); void slist_append(const char* str); void sendRequest(const std::string& url); void requestComplete(); diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index 2ebd1b7176..3385d7c2e2 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -2,30 +2,25 @@ * @file lldatapacker.cpp * @brief Data packer implementation. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -54,6 +49,18 @@ LLDataPacker::LLDataPacker() : mPassFlags(0), mWriteEnabled(FALSE) { } +//virtual +void LLDataPacker::reset() +{ + llerrs << "Using unimplemented datapacker reset!" << llendl; +} + +//virtual +void LLDataPacker::dumpBufferToLog() +{ + llerrs << "dumpBufferToLog not implemented for this type!" << llendl; +} + BOOL LLDataPacker::packFixed(const F32 value, const char *name, const BOOL is_signed, const U32 int_bits, const U32 frac_bits) { @@ -170,16 +177,16 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name, // LLDataPackerBinaryBuffer implementation //--------------------------------------------------------------------------- -BOOL LLDataPackerBinaryBuffer::packString(const char *value, const char *name) +BOOL LLDataPackerBinaryBuffer::packString(const std::string& value, const char *name) { BOOL success = TRUE; - S32 length = (S32)strlen(value) + 1; /*Flawfinder: ignore*/ + S32 length = value.length()+1; success &= verifyLength(length, name); if (mWriteEnabled) { - htonmemcpy(mCurBufferp, value, MVT_VARIABLE, length); + htonmemcpy(mCurBufferp, value.c_str(), MVT_VARIABLE, length); } mCurBufferp += length; return success; @@ -577,18 +584,18 @@ void LLDataPackerBinaryBuffer::dumpBufferToLog() //--------------------------------------------------------------------------- // LLDataPackerAsciiBuffer implementation //--------------------------------------------------------------------------- -BOOL LLDataPackerAsciiBuffer::packString(const char *value, const char *name) +BOOL LLDataPackerAsciiBuffer::packString(const std::string& value, const char *name) { BOOL success = TRUE; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) { - numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", value); /* Flawfinder: ignore */ + numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", value.c_str()); /* Flawfinder: ignore */ } else { - numCopied = (S32)strlen(value) + 1; /*Flawfinder: ignore*/ + numCopied = value.length() + 1; /*Flawfinder: ignore*/ } // snprintf returns number of bytes that would have been written @@ -1242,9 +1249,9 @@ BOOL LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name) int numCopied = 0; if (mWriteEnabled) { - char tmp_str[64]; /* Flawfinder: ignore */ + std::string tmp_str; value.toString(tmp_str); - numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", tmp_str); /* Flawfinder: ignore */ + numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", tmp_str.c_str()); /* Flawfinder: ignore */ } else { @@ -1376,13 +1383,13 @@ std::string convertF32ToString(F32 val) //--------------------------------------------------------------------------- // LLDataPackerAsciiFile implementation //--------------------------------------------------------------------------- -BOOL LLDataPackerAsciiFile::packString(const char *value, const char *name) +BOOL LLDataPackerAsciiFile::packString(const std::string& value, const char *name) { BOOL success = TRUE; writeIndentedName(name); if (mFP) { - fprintf(mFP,"%s\n", value); + fprintf(mFP,"%s\n", value.c_str()); } else if (mOutputStream) { @@ -1829,11 +1836,11 @@ BOOL LLDataPackerAsciiFile::packUUID(const LLUUID &value, const char *name) { BOOL success = TRUE; writeIndentedName(name); - char tmp_str[64]; /*Flawfinder: ignore */ + std::string tmp_str; value.toString(tmp_str); if (mFP) { - fprintf(mFP,"%s\n", tmp_str); + fprintf(mFP,"%s\n", tmp_str.c_str()); } else if (mOutputStream) { @@ -1877,7 +1884,7 @@ void LLDataPackerAsciiFile::writeIndentedName(const char *name) } else if (mOutputStream) { - *mOutputStream << indent_buf.c_str() << name << "\t"; + *mOutputStream << indent_buf << name << "\t"; } } @@ -1895,7 +1902,12 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v if (mFP) { fpos_t last_pos; - fgetpos(mFP, &last_pos); + if (0 != fgetpos(mFP, &last_pos)) // 0==success for fgetpos + { + llwarns << "Data packer failed to fgetpos" << llendl; + return FALSE; + } + if (fgets(buffer, DP_BUFSIZE, mFP) == NULL) { buffer[0] = '\0'; diff --git a/indra/llmessage/lldatapacker.h b/indra/llmessage/lldatapacker.h index ff33d4ecc2..dd9c4eaa38 100644 --- a/indra/llmessage/lldatapacker.h +++ b/indra/llmessage/lldatapacker.h @@ -2,30 +2,25 @@ * @file lldatapacker.h * @brief Data packer declaration for tightly storing binary data. * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -44,12 +39,13 @@ class LLDataPacker public: virtual ~LLDataPacker() {} - virtual void reset() { llerrs << "Using unimplemented datapacker reset!" << llendl; }; - virtual void dumpBufferToLog() { llerrs << "dumpBufferToLog not implemented for this type!" << llendl; } + // Not required to override, but error to call? + virtual void reset(); + virtual void dumpBufferToLog(); virtual BOOL hasNext() const = 0; - virtual BOOL packString(const char *value, const char *name) = 0; + virtual BOOL packString(const std::string& value, const char *name) = 0; virtual BOOL unpackString(std::string& value, const char *name) = 0; virtual BOOL packBinaryData(const U8 *value, S32 size, const char *name) = 0; @@ -127,7 +123,7 @@ public: { } - /*virtual*/ BOOL packString(const char *value, const char *name); + /*virtual*/ BOOL packString(const std::string& value, const char *name); /*virtual*/ BOOL unpackString(std::string& value, const char *name); /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); @@ -229,7 +225,7 @@ public: mWriteEnabled = FALSE; } - /*virtual*/ BOOL packString(const char *value, const char *name); + /*virtual*/ BOOL packString(const std::string& value, const char *name); /*virtual*/ BOOL unpackString(std::string& value, const char *name); /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); @@ -330,7 +326,7 @@ inline BOOL LLDataPackerAsciiBuffer::verifyLength(const S32 data_size, const cha class LLDataPackerAsciiFile : public LLDataPacker { public: - LLDataPackerAsciiFile(FILE *fp, const S32 indent = 2) + LLDataPackerAsciiFile(LLFILE *fp, const S32 indent = 2) : LLDataPacker(), mIndent(indent), mFP(fp), @@ -358,7 +354,7 @@ public: { } - /*virtual*/ BOOL packString(const char *value, const char *name); + /*virtual*/ BOOL packString(const std::string& value, const char *name); /*virtual*/ BOOL unpackString(std::string& value, const char *name); /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); @@ -407,7 +403,7 @@ protected: protected: S32 mIndent; - FILE *mFP; + LLFILE *mFP; std::ostream* mOutputStream; std::istream* mInputStream; }; diff --git a/indra/llmessage/lldbstrings.h b/indra/llmessage/lldbstrings.h index f36f4c47fb..9bf1b3eda4 100644 --- a/indra/llmessage/lldbstrings.h +++ b/indra/llmessage/lldbstrings.h @@ -2,30 +2,25 @@ * @file lldbstrings.h * @brief Database String Lengths. * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/lldispatcher.cpp b/indra/llmessage/lldispatcher.cpp index d0e1e68b8a..b2dc414a68 100644 --- a/indra/llmessage/lldispatcher.cpp +++ b/indra/llmessage/lldispatcher.cpp @@ -2,30 +2,25 @@ * @file lldispatcher.cpp * @brief Implementation of the dispatcher object. * - * $LicenseInfo:firstyear=2004&license=viewergpl$ - * - * Copyright (c) 2004-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -111,8 +106,7 @@ bool LLDispatcher::unpackMessage( LLDispatcher::sparam_t& parameters) { char buf[MAX_STRING]; /*Flawfinder: ignore*/ - msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, MAX_STRING, buf); - method.assign(buf); + msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, method); msg->getUUIDFast(_PREHASH_MethodData, _PREHASH_Invoice, invoice); S32 size; S32 count = msg->getNumberOfBlocksFast(_PREHASH_ParamList); @@ -121,29 +115,32 @@ bool LLDispatcher::unpackMessage( // we treat the SParam as binary data (since it might be an // LLUUID in compressed form which may have embedded \0's,) size = msg->getSizeFast(_PREHASH_ParamList, i, _PREHASH_Parameter); - msg->getBinaryDataFast( - _PREHASH_ParamList, _PREHASH_Parameter, - buf, size, i, MAX_STRING-1); - - // If the last byte of the data is 0x0, this is either a normally - // packed string, or a binary packed UUID (which for these messages - // are packed with a 17th byte 0x0). Unpack into a std::string - // without the trailing \0, so "abc\0" becomes std::string("abc", 3) - // which matches const char* "abc". - if (size > 0 - && buf[size-1] == 0x0) + if (size >= 0) { - // special char*/size constructor because UUIDs may have embedded - // 0x0 bytes. - std::string binary_data(buf, size-1); - parameters.push_back(binary_data); - } - else - { - // This is either a NULL string, or a string that was packed - // incorrectly as binary data, without the usual trailing '\0'. - std::string string_data(buf, size); - parameters.push_back(string_data); + msg->getBinaryDataFast( + _PREHASH_ParamList, _PREHASH_Parameter, + buf, size, i, MAX_STRING-1); + + // If the last byte of the data is 0x0, this is either a normally + // packed string, or a binary packed UUID (which for these messages + // are packed with a 17th byte 0x0). Unpack into a std::string + // without the trailing \0, so "abc\0" becomes std::string("abc", 3) + // which matches const char* "abc". + if (size > 0 + && buf[size-1] == 0x0) + { + // special char*/size constructor because UUIDs may have embedded + // 0x0 bytes. + std::string binary_data(buf, size-1); + parameters.push_back(binary_data); + } + else + { + // This is either a NULL string, or a string that was packed + // incorrectly as binary data, without the usual trailing '\0'. + std::string string_data(buf, size); + parameters.push_back(string_data); + } } } return true; diff --git a/indra/llmessage/lldispatcher.h b/indra/llmessage/lldispatcher.h index 452be7c374..9d1751f588 100644 --- a/indra/llmessage/lldispatcher.h +++ b/indra/llmessage/lldispatcher.h @@ -2,30 +2,25 @@ * @file lldispatcher.h * @brief LLDispatcher class header file. * - * $LicenseInfo:firstyear=2004&license=viewergpl$ - * - * Copyright (c) 2004-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/lleventflags.h b/indra/llmessage/lleventflags.h index 9a5b889257..75d79071b1 100644 --- a/indra/llmessage/lleventflags.h +++ b/indra/llmessage/lleventflags.h @@ -2,30 +2,25 @@ * @file lleventflags.h * @brief Flags for events. * - * $LicenseInfo:firstyear=2004&license=viewergpl$ - * - * Copyright (c) 2004-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -36,5 +31,6 @@ const U32 EVENT_FLAG_NONE = 0x0000; // set for mature events const U32 EVENT_FLAG_MATURE = 0x0001; +const U32 EVENT_FLAG_ADULT = 0x0002; #endif diff --git a/indra/llmessage/llfiltersd2xmlrpc.cpp b/indra/llmessage/llfiltersd2xmlrpc.cpp index 88f7b1cb68..812ef7c151 100644 --- a/indra/llmessage/llfiltersd2xmlrpc.cpp +++ b/indra/llmessage/llfiltersd2xmlrpc.cpp @@ -3,30 +3,25 @@ * @author Phoenix * @date 2005-04-26 * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -81,7 +76,7 @@ #include <sstream> #include <iterator> #include <xmlrpc-epi/xmlrpc.h> -#include "apr-1/apr_base64.h" +#include "apr_base64.h" #include "llbuffer.h" #include "llbufferstream.h" @@ -695,6 +690,24 @@ LLIOPipe::EStatus LLFilterXMLRPCRequest2LLSD::process_impl( buffer->readAfter(channels.in(), NULL, (U8*)buf, bytes); //lldebugs << "xmlrpc request: " << buf << llendl; + + // Check the value in the buffer. XMLRPC_REQUEST_FromXML will report a error code 4 if + // values that are less than 0x20 are passed to it, except + // 0x09: Horizontal tab; 0x0a: New Line; 0x0d: Carriage + U8* cur_pBuf = (U8*)buf; + U8 cur_char; + for (S32 i=0; i<bytes; i++) + { + cur_char = *cur_pBuf; + if ( cur_char < 0x20 + && 0x09 != cur_char + && 0x0a != cur_char + && 0x0d != cur_char ) + { + *cur_pBuf = '?'; + } + ++cur_pBuf; + } PUMP_DEBUG; XMLRPC_REQUEST request = XMLRPC_REQUEST_FromXML( diff --git a/indra/llmessage/llfiltersd2xmlrpc.h b/indra/llmessage/llfiltersd2xmlrpc.h index c82a518b89..0c9a0dc95b 100644 --- a/indra/llmessage/llfiltersd2xmlrpc.h +++ b/indra/llmessage/llfiltersd2xmlrpc.h @@ -3,30 +3,25 @@ * @author Phoenix * @date 2005-04-26 * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llfollowcamparams.h b/indra/llmessage/llfollowcamparams.h index 0affcf9fe3..25208031db 100644 --- a/indra/llmessage/llfollowcamparams.h +++ b/indra/llmessage/llfollowcamparams.h @@ -2,30 +2,25 @@ * @file llfollowcamparams.h * @brief Follow camera parameters. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llhost.cpp b/indra/llmessage/llhost.cpp index 4d10f06051..61a84de8e3 100644 --- a/indra/llmessage/llhost.cpp +++ b/indra/llmessage/llhost.cpp @@ -2,30 +2,25 @@ * @file llhost.cpp * @brief Encapsulates an IP address and a port. * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -66,34 +61,15 @@ LLHost::LLHost(const std::string& ip_and_port) } } -void LLHost::getString(char* buffer, S32 length) const +std::string LLHost::getString() const { - if (((U32) length) < MAXADDRSTR + 1 + 5) - { - llerrs << "LLHost::getString - string too short" << llendl; - return; - } - - snprintf(buffer, length, "%s:%u", u32_to_ip_string(mIP), mPort); /* Flawfinder: ignore */ -} - -void LLHost::getIPString(char* buffer, S32 length) const -{ - if ( ((U32) length) < MAXADDRSTR) - { - llerrs << "LLHost::getIPString - string too short" << llendl; - return; - } - - snprintf(buffer, length, "%s", u32_to_ip_string(mIP)); /* Flawfinder: ignore */ + return llformat("%s:%u", u32_to_ip_string(mIP), mPort); } std::string LLHost::getIPandPort() const { - char buffer[MAXADDRSTR + 1 + 5]; /*Flawfinder: ignore*/ - getString(buffer, sizeof(buffer)); - return buffer; + return getString(); } @@ -103,35 +79,6 @@ std::string LLHost::getIPString() const } -void LLHost::getHostName(char *buf, S32 len) const -{ - hostent *he; - - if (INVALID_HOST_IP_ADDRESS == mIP) - { - llwarns << "LLHost::getHostName() : Invalid IP address" << llendl; - buf[0] = '\0'; - return; - } - he = gethostbyaddr((char *)&mIP, sizeof(mIP), AF_INET); - if (!he) - { -#if LL_WINDOWS - llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: " - << WSAGetLastError() << llendl; -#else - llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: " - << h_errno << llendl; -#endif - buf[0] = '\0'; - } - else - { - strncpy(buf, he->h_name, len); /*Flawfinder: ignore*/ - buf[len-1] = '\0'; - } -} - std::string LLHost::getHostName() const { hostent* he; @@ -158,28 +105,20 @@ std::string LLHost::getHostName() const } } -BOOL LLHost::setHostByName(const char *string) +BOOL LLHost::setHostByName(const std::string& hostname) { hostent *he; - char local_name[MAX_STRING]; /*Flawfinder: ignore*/ - - if (strlen(string)+1 > MAX_STRING) /*Flawfinder: ignore*/ - { - llerrs << "LLHost::setHostByName() : Address string is too long: " - << string << llendl; - } + std::string local_name(hostname); - strncpy(local_name, string,MAX_STRING); /*Flawfinder: ignore*/ - local_name[MAX_STRING-1] = '\0'; #if LL_WINDOWS // We may need an equivalent for Linux, but not sure - djs - _strupr(local_name); + LLStringUtil::toUpper(local_name); #endif - he = gethostbyname(local_name); + he = gethostbyname(local_name.c_str()); if(!he) { - U32 ip_address = inet_addr(string); + U32 ip_address = ip_string_to_u32(hostname.c_str()); he = gethostbyaddr((char *)&ip_address, sizeof(ip_address), AF_INET); } diff --git a/indra/llmessage/llhost.h b/indra/llmessage/llhost.h index a865ad616c..0cf52a4151 100644 --- a/indra/llmessage/llhost.h +++ b/indra/llmessage/llhost.h @@ -3,30 +3,25 @@ * @brief a LLHost uniquely defines a host (Simulator, Proxy or other) * across the network * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -61,10 +56,10 @@ public: mIP = ipv4_addr; } - LLHost( const char *ipv4_addr, U32 port ) + LLHost( const std::string& ipv4_addr, U32 port ) : mPort( port ) { - mIP = ip_string_to_u32(ipv4_addr); + mIP = ip_string_to_u32(ipv4_addr.c_str()); } explicit LLHost(const U64 ip_port) @@ -82,11 +77,11 @@ public: // MANIPULATORS void set( U32 ip, U32 port ) { mIP = ip; mPort = port; } - void set( const char* ipstr, U32 port ) { mIP = ip_string_to_u32(ipstr); mPort = port; } - void setAddress( const char* ipstr ) { mIP = ip_string_to_u32(ipstr); } + void set( const std::string& ipstr, U32 port ) { mIP = ip_string_to_u32(ipstr.c_str()); mPort = port; } + void setAddress( const std::string& ipstr ) { mIP = ip_string_to_u32(ipstr.c_str()); } void setAddress( U32 ip ) { mIP = ip; } void setPort( U32 port ) { mPort = port; } - BOOL setHostByName(const char *hname); + BOOL setHostByName(const std::string& hname); LLHost& operator=(const LLHost &rhs); void invalidate() { mIP = INVALID_HOST_IP_ADDRESS; mPort = INVALID_PORT;}; @@ -96,10 +91,8 @@ public: U32 getPort() const { return mPort; } BOOL isOk() const { return (mIP != INVALID_HOST_IP_ADDRESS) && (mPort != INVALID_PORT); } size_t hash() const { return (mIP << 16) | (mPort & 0xffff); } - void getString(char* buffer, S32 length) const; // writes IP:port into buffer - void getIPString(char* buffer, S32 length) const; // writes IP into buffer + std::string getString() const; std::string getIPString() const; - void getHostName(char *buf, S32 len) const; std::string getHostName() const; std::string getIPandPort() const; diff --git a/indra/llmessage/llhttpassetstorage.cpp b/indra/llmessage/llhttpassetstorage.cpp index 2179064807..9ea2ff4153 100644 --- a/indra/llmessage/llhttpassetstorage.cpp +++ b/indra/llmessage/llhttpassetstorage.cpp @@ -3,30 +3,25 @@ * @brief Subclass capable of loading asset data to/from an external * source. Currently, a web server accessed via curl * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -81,8 +76,8 @@ class LLHTTPAssetRequest : public LLAssetRequest { public: LLHTTPAssetRequest(LLHTTPAssetStorage *asp, const LLUUID &uuid, - LLAssetType::EType type, LLAssetStorage::ERequestType rt, - const char *url, CURLM *curl_multi); + LLAssetType::EType type, LLAssetStorage::ERequestType rt, + const std::string& url, CURLM *curl_multi); virtual ~LLHTTPAssetRequest(); void setupCurlHandle(); @@ -103,7 +98,7 @@ public: CURL *mCurlHandle; CURLM *mCurlMultiHandle; - char *mURLBuffer; + std::string mURLBuffer; struct curl_slist *mHTTPHeaders; LLVFile *mVFile; LLUUID mTmpUUID; @@ -122,11 +117,12 @@ LLHTTPAssetRequest::LLHTTPAssetRequest(LLHTTPAssetStorage *asp, const LLUUID &uuid, LLAssetType::EType type, LLAssetStorage::ERequestType rt, - const char *url, + const std::string& url, CURLM *curl_multi) : LLAssetRequest(uuid, type), - mZInitialized(false) + mZInitialized(false) { + memset(&mZStream, 0, sizeof(mZStream)); // we'll initialize this later, but for now zero the whole C-style struct to avoid debug/coverity noise mAssetStoragep = asp; mCurlHandle = NULL; mCurlMultiHandle = curl_multi; @@ -137,11 +133,7 @@ LLHTTPAssetRequest::LLHTTPAssetRequest(LLHTTPAssetStorage *asp, mZInputBuffer = NULL; mZInputExhausted = false; - mURLBuffer = new char[strlen(url) + 1]; /*Flawfinder: ignore*/ - if (mURLBuffer) - { - strcpy(mURLBuffer, url); /*Flawfinder: ignore*/ - } + mURLBuffer = url; } LLHTTPAssetRequest::~LLHTTPAssetRequest() @@ -156,7 +148,6 @@ LLHTTPAssetRequest::~LLHTTPAssetRequest() { curl_slist_free_all(mHTTPHeaders); } - delete[] mURLBuffer; delete mVFile; finishCompressedUpload(); } @@ -239,10 +230,11 @@ LLSD LLHTTPAssetRequest::getFullDetails() const void LLHTTPAssetRequest::setupCurlHandle() { + // *NOTE: Similar code exists in mapserver/llcurlutil.cpp JC mCurlHandle = curl_easy_init(); curl_easy_setopt(mCurlHandle, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(mCurlHandle, CURLOPT_NOPROGRESS, 1); - curl_easy_setopt(mCurlHandle, CURLOPT_URL, mURLBuffer); + curl_easy_setopt(mCurlHandle, CURLOPT_URL, mURLBuffer.c_str()); curl_easy_setopt(mCurlHandle, CURLOPT_PRIVATE, this); if (LLAssetStorage::RT_DOWNLOAD == mRequestType) { @@ -261,6 +253,10 @@ void LLHTTPAssetRequest::setupCurlHandle() // disable use of proxy, which can't handle chunked transfers } mHTTPHeaders = curl_slist_append(mHTTPHeaders, "Pragma:"); + + // bug in curl causes DNS to be cached for too long a time, 0 sets it to never cache DNS results internally (to curl) + curl_easy_setopt(mCurlHandle, CURLOPT_DNS_CACHE_TIMEOUT, 0); + // resist the temptation to explicitly add the Transfer-Encoding: chunked // header here - invokes a libCURL bug curl_easy_setopt(mCurlHandle, CURLOPT_HTTPHEADER, mHTTPHeaders); @@ -334,6 +330,8 @@ void LLHTTPAssetRequest::finishCompressedUpload() size_t LLHTTPAssetRequest::readCompressedData(void* data, size_t size) { + llassert(mZInitialized); + mZStream.next_out = (Bytef*)data; mZStream.avail_out = size; @@ -397,26 +395,28 @@ size_t LLHTTPAssetRequest::curlCompressedUploadCallback( LLHTTPAssetStorage::LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, - LLVFS *vfs, const LLHost &upstream_host, - const char *web_host, - const char *local_web_host, - const char *host_name) - : LLAssetStorage(msg, xfer, vfs, upstream_host) + LLVFS *vfs, LLVFS *static_vfs, + const LLHost &upstream_host, + const std::string& web_host, + const std::string& local_web_host, + const std::string& host_name) + : LLAssetStorage(msg, xfer, vfs, static_vfs, upstream_host) { _init(web_host, local_web_host, host_name); } LLHTTPAssetStorage::LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, - const char *web_host, - const char *local_web_host, - const char *host_name) - : LLAssetStorage(msg, xfer, vfs) + LLVFS *static_vfs, + const std::string& web_host, + const std::string& local_web_host, + const std::string& host_name) + : LLAssetStorage(msg, xfer, vfs, static_vfs) { _init(web_host, local_web_host, host_name); } -void LLHTTPAssetStorage::_init(const char *web_host, const char *local_web_host, const char* host_name) +void LLHTTPAssetStorage::_init(const std::string& web_host, const std::string& local_web_host, const std::string& host_name) { mBaseURL = web_host; mLocalBaseURL = local_web_host; @@ -468,7 +468,7 @@ void LLHTTPAssetStorage::storeAssetData( { message = "Added to upload queue"; } - reportMetric( uuid, type, NULL, requesting_agent_id, size, MR_OKAY, __FILE__, __LINE__, message ); + reportMetric( uuid, type, LLStringUtil::null, requesting_agent_id, size, MR_OKAY, __FILE__, __LINE__, message ); // this will get picked up and transmitted in checkForTimeouts if(store_local) @@ -490,7 +490,7 @@ void LLHTTPAssetStorage::storeAssetData( if (callback) { // LLAssetStorage metric: Zero size VFS - reportMetric( uuid, type, NULL, requesting_agent_id, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" ); + reportMetric( uuid, type, LLStringUtil::null, requesting_agent_id, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" ); callback(uuid, user_data, LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE, LL_EXSTAT_NONEXISTENT_FILE); } } @@ -498,7 +498,7 @@ void LLHTTPAssetStorage::storeAssetData( // virtual void LLHTTPAssetStorage::storeAssetData( - const char* filename, + const std::string& filename, const LLUUID& asset_id, LLAssetType::EType asset_type, LLStoreAssetCallback callback, @@ -595,7 +595,7 @@ LLSD LLHTTPAssetStorage::getPendingDetails(LLAssetStorage::ERequestType rt, LLSD& pending = sd["requests"][i]; // See if this pending request is running. const LLAssetRequest* req = findRequest(running, - LLAssetType::lookup(pending["type"].asString().c_str()), + LLAssetType::lookup(pending["type"].asString()), pending["asset_id"]); if (req) { @@ -623,7 +623,7 @@ LLSD LLHTTPAssetStorage::getPendingRequest(LLAssetStorage::ERequestType rt, const request_list_t* running = getRunningList(rt); if (running) { - LLSD sd = LLAssetStorage::getPendingRequest(running, asset_type, asset_id); + LLSD sd = LLAssetStorage::getPendingRequestImpl(running, asset_type, asset_id); if (sd) { sd["is_running"] = true; @@ -766,11 +766,11 @@ void LLHTTPAssetStorage::checkForTimeouts() // Setup this curl download request // We need to generate a new request here // since the one in the list could go away - char tmp_url[MAX_STRING]; /*Flawfinder: ignore*/ - char uuid_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ + std::string tmp_url; + std::string uuid_str; req->getUUID().toString(uuid_str); std::string base_url = getBaseURL(req->getUUID(), req->getType()); - snprintf(tmp_url, sizeof(tmp_url), "%s/%36s.%s", base_url.c_str() , uuid_str, LLAssetType::lookup(req->getType())); /* Flawfinder: ignore */ + tmp_url = llformat("%s/%36s.%s", base_url.c_str() , uuid_str.c_str(), LLAssetType::lookup(req->getType())); LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), req->getType(), RT_DOWNLOAD, tmp_url, mCurlMultiHandle); @@ -803,12 +803,11 @@ void LLHTTPAssetStorage::checkForTimeouts() bool do_compress = req->getType() == LLAssetType::AT_OBJECT; - char tmp_url[MAX_STRING];/*Flawfinder: ignore*/ - char uuid_str[UUID_STR_LENGTH];/*Flawfinder: ignore*/ + std::string tmp_url; + std::string uuid_str; req->getUUID().toString(uuid_str); - snprintf(tmp_url, sizeof(tmp_url), /* Flawfinder: ignore */ - do_compress ? "%s/%s.%s.gz" : "%s/%s.%s", - mBaseURL.c_str(), uuid_str, LLAssetType::lookup(req->getType())); + tmp_url = mBaseURL + "/" + uuid_str + "." + LLAssetType::lookup(req->getType()); + if (do_compress) tmp_url += ".gz"; LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), req->getType(), RT_UPLOAD, tmp_url, mCurlMultiHandle); @@ -874,12 +873,12 @@ void LLHTTPAssetStorage::checkForTimeouts() // setup this curl upload request LLVFile file(mVFS, req->getUUID(), req->getType()); - char tmp_url[MAX_STRING]; /*Flawfinder: ignore*/ - char uuid_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ + std::string tmp_url; + std::string uuid_str; req->getUUID().toString(uuid_str); // KLW - All temporary uploads are saved locally "http://localhost:12041/asset" - snprintf(tmp_url, sizeof(tmp_url), "%s/%36s.%s", mLocalBaseURL.c_str(), uuid_str, LLAssetType::lookup(req->getType())); /* Flawfinder: ignore */ + tmp_url = llformat("%s/%36s.%s", mLocalBaseURL.c_str(), uuid_str.c_str(), LLAssetType::lookup(req->getType())); LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), req->getType(), RT_LOCALUPLOAD, tmp_url, mCurlMultiHandle); @@ -1158,7 +1157,7 @@ size_t LLHTTPAssetStorage::nullOutputCallback(void *data, size_t size, size_t nm // blocking asset fetch which bypasses the VFS // this is a very limited function for use by the simstate loader and other one-offs -S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const LLString &url, const char *filename, progress_callback callback, void *userdata) +S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const std::string &url, const std::string& filename, progress_callback callback, void *userdata) { // *NOTE: There is no guarantee that the uuid and the asset_type match // - not that it matters. - Doug @@ -1172,7 +1171,7 @@ S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asse } // make sure we use the normal curl setup, even though we don't really need a request object - LLHTTPAssetRequest req(this, uuid, asset_type, RT_DOWNLOAD, url.c_str(), mCurlMultiHandle); + LLHTTPAssetRequest req(this, uuid, asset_type, RT_DOWNLOAD, url, mCurlMultiHandle); req.mFP = fp; req.setupCurlHandle(); diff --git a/indra/llmessage/llhttpassetstorage.h b/indra/llmessage/llhttpassetstorage.h index e6ec39e27e..f743ccf0ac 100644 --- a/indra/llmessage/llhttpassetstorage.h +++ b/indra/llmessage/llhttpassetstorage.h @@ -2,30 +2,25 @@ * @file llhttpassetstorage.h * @brief Class for loading asset data to/from an external source over http. * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -47,20 +42,23 @@ class LLHTTPAssetStorage : public LLAssetStorage { public: LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, - LLVFS *vfs, const LLHost &upstream_host, - const char *web_host, - const char *local_web_host, - const char *host_name); + LLVFS *vfs, LLVFS *static_vfs, + const LLHost &upstream_host, + const std::string& web_host, + const std::string& local_web_host, + const std::string& host_name); LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, - LLVFS *vfs, - const char *web_host, - const char *local_web_host, - const char *host_name); + LLVFS *vfs, LLVFS *static_vfs, + const std::string& web_host, + const std::string& local_web_host, + const std::string& host_name); virtual ~LLHTTPAssetStorage(); + using LLAssetStorage::storeAssetData; // Unhiding virtuals... + virtual void storeAssetData( const LLUUID& uuid, LLAssetType::EType atype, @@ -74,7 +72,7 @@ public: F64 timeout=LL_ASSET_STORAGE_TIMEOUT); virtual void storeAssetData( - const char* filename, + const std::string& filename, const LLUUID& asset_id, LLAssetType::EType atype, LLStoreAssetCallback callback, @@ -99,7 +97,7 @@ public: // Hack. One off curl download an URL to a file. Probably should be elsewhere. // Only used by lldynamicstate. The API is broken, and should be replaced with // a generic HTTP file fetch - Doug 9/25/06 - S32 getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const LLString &url, const char *filename, progress_callback callback, void *userdata); + S32 getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const std::string &url, const std::string& filename, progress_callback callback, void *userdata); LLAssetRequest* findNextRequest(request_list_t& pending, request_list_t& running); @@ -135,7 +133,7 @@ protected: void *user_data, BOOL duplicate, BOOL is_priority); private: - void _init(const char *web_host, const char *local_web_host, const char* host_name); + void _init(const std::string& web_host, const std::string& local_web_host, const std::string& host_name); // This will return the correct base URI for any http asset request std::string getBaseURL(const LLUUID& asset_id, LLAssetType::EType asset_type); diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index 3b892aec50..0e5206a520 100644 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -1,36 +1,31 @@ - /** +/** * @file llhttpclient.cpp * @brief Implementation of classes for making HTTP requests. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #include "linden_common.h" - +#include <openssl/x509_vfy.h> #include "llhttpclient.h" #include "llassetstorage.h" @@ -45,7 +40,10 @@ #include "message.h" #include <curl/curl.h> + const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f; +LLURLRequest::SSLCertVerifyCallback LLHTTPClient::mCertVerifyCallback = NULL; + //////////////////////////////////////////////////////////////////////////// // Responder class moved to LLCurl @@ -56,7 +54,7 @@ namespace { public: LLHTTPClientURLAdaptor(LLCurl::ResponderPtr responder) - : mResponder(responder), mStatus(499), + : LLURLRequestComplete(), mResponder(responder), mStatus(499), mReason("LLURLRequest complete w/no status") { } @@ -67,6 +65,8 @@ namespace virtual void httpStatus(U32 status, const std::string& reason) { + LLURLRequestComplete::httpStatus(status,reason); + mStatus = status; mReason = reason; } @@ -76,8 +76,10 @@ namespace { if (mResponder.get()) { - mResponder->completedRaw(mStatus, mReason, channels, buffer); + // Allow clients to parse headers before we attempt to parse + // the body and provide completed/result/error calls. mResponder->completedHeader(mStatus, mReason, mHeaderOutput); + mResponder->completedRaw(mStatus, mReason, channels, buffer); } } virtual void header(const std::string& header, const std::string& value) @@ -104,7 +106,7 @@ namespace LLSDInjector(const LLSD& sd) : mSD(sd) {} virtual ~LLSDInjector() {} - const char* contentType() { return "application/xml"; } + const char* contentType() { return "application/llsd+xml"; } virtual EStatus process_impl(const LLChannelDescriptors& channels, buffer_ptr_t& buffer, bool& eos, LLSD& context, LLPumpIO* pump) @@ -122,7 +124,7 @@ namespace { public: RawInjector(const U8* data, S32 size) : mData(data), mSize(size) {} - virtual ~RawInjector() {} + virtual ~RawInjector() {delete mData;} const char* contentType() { return "application/octet-stream"; } @@ -152,17 +154,21 @@ namespace { LLBufferStream ostream(channels, buffer.get()); - llifstream fstream(mFilename.c_str(), std::iostream::binary | std::iostream::out); - fstream.seekg(0, std::ios::end); - U32 fileSize = fstream.tellg(); - fstream.seekg(0, std::ios::beg); - char* fileBuffer; - fileBuffer = new char [fileSize]; - fstream.read(fileBuffer, fileSize); - ostream.write(fileBuffer, fileSize); - fstream.close(); - eos = true; - return STATUS_DONE; + llifstream fstream(mFilename, std::iostream::binary | std::iostream::out); + if(fstream.is_open()) + { + fstream.seekg(0, std::ios::end); + U32 fileSize = fstream.tellg(); + fstream.seekg(0, std::ios::beg); + std::vector<char> fileBuffer(fileSize); + fstream.read(&fileBuffer[0], fileSize); + ostream.write(&fileBuffer[0], fileSize); + fstream.close(); + eos = true; + return STATUS_DONE; + } + + return STATUS_ERROR; } const std::string mFilename; @@ -187,6 +193,7 @@ namespace fileBuffer = new U8 [fileSize]; vfile.read(fileBuffer, fileSize); ostream.write((char*)fileBuffer, fileSize); + delete [] fileBuffer; eos = true; return STATUS_DONE; } @@ -199,14 +206,19 @@ namespace LLPumpIO* theClientPump = NULL; } -static void request(const std::string& url, - LLURLRequest::ERequestAction method, - Injector* body_injector, - LLCurl::ResponderPtr responder, - const LLSD& headers = LLSD(), - const F32 timeout = HTTP_REQUEST_EXPIRY_SECS, - S32 offset = 0, - S32 bytes = 0) +void LLHTTPClient::setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback callback) +{ + LLHTTPClient::mCertVerifyCallback = callback; +} + +static void request( + const std::string& url, + LLURLRequest::ERequestAction method, + Injector* body_injector, + LLCurl::ResponderPtr responder, + const F32 timeout = HTTP_REQUEST_EXPIRY_SECS, + const LLSD& headers = LLSD() + ) { if (!LLHTTPClient::hasPump()) { @@ -215,12 +227,21 @@ static void request(const std::string& url, } LLPumpIO::chain_t chain; - LLURLRequest *req = new LLURLRequest(method, url); - req->checkRootCertificate(true); + LLURLRequest* req = new LLURLRequest(method, url); + req->setSSLVerifyCallback(LLHTTPClient::getCertVerifyCallback(), (void *)req); + + + lldebugs << LLURLRequest::actionAsVerb(method) << " " << url << " " + << headers << llendl; + + // Insert custom headers if the caller sent any + if (headers.isMap()) + { + if (headers.has("Cookie")) + { + req->allowCookies(); + } - // Insert custom headers is the caller sent any - if (headers.isMap()) - { LLSD::map_const_iterator iter = headers.beginMap(); LLSD::map_const_iterator end = headers.endMap(); @@ -232,15 +253,34 @@ static void request(const std::string& url, //the Pragma header it so gratuitously inserts //Before inserting the header, force libcurl //to not use the proxy (read: llurlrequest.cpp) - if ((iter->first == "Pragma") && (iter->second.asString() == "")) + static const std::string PRAGMA("Pragma"); + if ((iter->first == PRAGMA) && (iter->second.asString().empty())) { - req->useProxy(FALSE); + req->useProxy(false); } header << iter->first << ": " << iter->second.asString() ; - llinfos << "header = " << header.str() << llendl; + lldebugs << "header = " << header.str() << llendl; req->addHeader(header.str().c_str()); } } + + // Check to see if we have already set Accept or not. If no one + // set it, set it to application/llsd+xml since that's what we + // almost always want. + if( method != LLURLRequest::HTTP_PUT && method != LLURLRequest::HTTP_POST ) + { + static const std::string ACCEPT("Accept"); + if(!headers.has(ACCEPT)) + { + req->addHeader("Accept: application/llsd+xml"); + } + } + + if (responder) + { + responder->setURL(url); + } + req->setCallback(new LLHTTPClientURLAdaptor(responder)); if (method == LLURLRequest::HTTP_POST && gMessageSystem) @@ -248,48 +288,64 @@ static void request(const std::string& url, req->addHeader(llformat("X-SecondLife-UDP-Listen-Port: %d", gMessageSystem->mPort).c_str()); } - + if (method == LLURLRequest::HTTP_PUT || method == LLURLRequest::HTTP_POST) { - req->addHeader(llformat("Content-Type: %s", - body_injector->contentType()).c_str()); - + static const std::string CONTENT_TYPE("Content-Type"); + if(!headers.has(CONTENT_TYPE)) + { + // If the Content-Type header was passed in, it has + // already been added as a header through req->addHeader + // in the loop above. We defer to the caller's wisdom, but + // if they did not specify a Content-Type, then ask the + // injector. + req->addHeader( + llformat( + "Content-Type: %s", + body_injector->contentType()).c_str()); + } chain.push_back(LLIOPipe::ptr_t(body_injector)); } - if (method == LLURLRequest::HTTP_GET && (offset > 0 || bytes > 0)) - { - std::string range = llformat("Range: bytes=%d-%d", offset,offset+bytes-1); - req->addHeader(range.c_str()); - } - chain.push_back(LLIOPipe::ptr_t(req)); theClientPump->addChain(chain, timeout); } -void LLHTTPClient::getByteRange(const std::string& url, - S32 offset, S32 bytes, - ResponderPtr responder, - const LLSD& headers, - const F32 timeout) +void LLHTTPClient::getByteRange( + const std::string& url, + S32 offset, + S32 bytes, + ResponderPtr responder, + const LLSD& hdrs, + const F32 timeout) { - request(url, LLURLRequest::HTTP_GET, NULL, responder, LLSD(), timeout, offset, bytes); + LLSD headers = hdrs; + if(offset > 0 || bytes > 0) + { + std::string range = llformat("bytes=%d-%d", offset, offset+bytes-1); + headers["Range"] = range; + } + request(url,LLURLRequest::HTTP_GET, NULL, responder, timeout, headers); } -void LLHTTPClient::head(const std::string& url, ResponderPtr responder, const F32 timeout) +void LLHTTPClient::head( + const std::string& url, + ResponderPtr responder, + const LLSD& headers, + const F32 timeout) { - request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout); + request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers); } void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout) { - request(url, LLURLRequest::HTTP_GET, NULL, responder, headers, timeout); + request(url, LLURLRequest::HTTP_GET, NULL, responder, timeout, headers); } void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout) { - request(url, LLURLRequest::HTTP_HEAD, NULL, responder, headers, timeout); + request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers); } void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const F32 timeout) { @@ -339,90 +395,214 @@ private: std::string mBuffer; }; -// *TODO: Deprecate (only used by dataserver) -// This call is blocking! This is probably usually bad. :( -LLSD LLHTTPClient::blockingGet(const std::string& url) +// These calls are blocking! This is usually bad, unless you're a dataserver. Then it's awesome. + +/** + @brief does a blocking request on the url, returning the data or bad status. + + @param url URI to verb on. + @param method the verb to hit the URI with. + @param body the body of the call (if needed - for instance not used for GET and DELETE, but is for POST and PUT) + @param headers HTTP headers to use for the request. + @param timeout Curl timeout to use. Defaults to 5. Rationale: + Without this timeout, blockingGet() calls have been observed to take + up to 90 seconds to complete. Users of blockingGet() already must + check the HTTP return code for validity, so this will not introduce + new errors. A 5 second timeout will succeed > 95% of the time (and + probably > 99% of the time) based on my statistics. JC + + @returns an LLSD map: {status: integer, body: map} + */ +static LLSD blocking_request( + const std::string& url, + LLURLRequest::ERequestAction method, + const LLSD& body, + const LLSD& headers = LLSD(), + const F32 timeout = 5 +) { - llinfos << "blockingGet of " << url << llendl; - - // Returns an LLSD map: {status: integer, body: map} - char curl_error_buffer[CURL_ERROR_SIZE]; + lldebugs << "blockingRequest of " << url << llendl; + char curl_error_buffer[CURL_ERROR_SIZE] = "\0"; CURL* curlp = curl_easy_init(); - LLHTTPBuffer http_buffer; - - // Without this timeout, blockingGet() calls have been observed to take - // up to 90 seconds to complete. Users of blockingGet() already must - // check the HTTP return code for validity, so this will not introduce - // new errors. A 5 second timeout will succeed > 95% of the time (and - // probably > 99% of the time) based on my statistics. JC + std::string body_str; + + // other request method checks root cert first, we skip? + + // * Set curl handle options curl_easy_setopt(curlp, CURLOPT_NOSIGNAL, 1); // don't use SIGALRM for timeouts - curl_easy_setopt(curlp, CURLOPT_TIMEOUT, 5); // seconds - + curl_easy_setopt(curlp, CURLOPT_TIMEOUT, timeout); // seconds, see warning at top of function. curl_easy_setopt(curlp, CURLOPT_WRITEFUNCTION, LLHTTPBuffer::curl_write); curl_easy_setopt(curlp, CURLOPT_WRITEDATA, &http_buffer); curl_easy_setopt(curlp, CURLOPT_URL, url.c_str()); curl_easy_setopt(curlp, CURLOPT_ERRORBUFFER, curl_error_buffer); - curl_easy_setopt(curlp, CURLOPT_FAILONERROR, 1); + + // * Setup headers (don't forget to free them after the call!) + curl_slist* headers_list = NULL; + if (headers.isMap()) + { + LLSD::map_const_iterator iter = headers.beginMap(); + LLSD::map_const_iterator end = headers.endMap(); + for (; iter != end; ++iter) + { + std::ostringstream header; + header << iter->first << ": " << iter->second.asString() ; + lldebugs << "header = " << header.str() << llendl; + headers_list = curl_slist_append(headers_list, header.str().c_str()); + } + } + + // * Setup specific method / "verb" for the URI (currently only GET and POST supported + poppy) + if (method == LLURLRequest::HTTP_GET) + { + curl_easy_setopt(curlp, CURLOPT_HTTPGET, 1); + } + else if (method == LLURLRequest::HTTP_POST) + { + curl_easy_setopt(curlp, CURLOPT_POST, 1); + //serialize to ostr then copy to str - need to because ostr ptr is unstable :( + std::ostringstream ostr; + LLSDSerialize::toXML(body, ostr); + body_str = ostr.str(); + curl_easy_setopt(curlp, CURLOPT_POSTFIELDS, body_str.c_str()); + //copied from PHP libs, correct? + headers_list = curl_slist_append(headers_list, "Content-Type: application/llsd+xml"); + + // copied from llurlrequest.cpp + // it appears that apache2.2.3 or django in etch is busted. If + // we do not clear the expect header, we get a 500. May be + // limited to django/mod_wsgi. + headers_list = curl_slist_append(headers_list, "Expect:"); + } + + // * Do the action using curl, handle results + lldebugs << "HTTP body: " << body_str << llendl; + headers_list = curl_slist_append(headers_list, "Accept: application/llsd+xml"); + CURLcode curl_result = curl_easy_setopt(curlp, CURLOPT_HTTPHEADER, headers_list); + if ( curl_result != CURLE_OK ) + { + llinfos << "Curl is hosed - can't add headers" << llendl; + } LLSD response = LLSD::emptyMap(); - S32 curl_success = curl_easy_perform(curlp); - S32 http_status = 499; - curl_easy_getinfo(curlp,CURLINFO_RESPONSE_CODE, &http_status); - + curl_easy_getinfo(curlp, CURLINFO_RESPONSE_CODE, &http_status); response["status"] = http_status; - - if (curl_success != 0 - && http_status != 404) // We expect 404s, don't spam for them. + // if we get a non-404 and it's not a 200 OR maybe it is but you have error bits, + if ( http_status != 404 && (http_status != 200 || curl_success != 0) ) { + // We expect 404s, don't spam for them. + llwarns << "CURL REQ URL: " << url << llendl; + llwarns << "CURL REQ METHOD TYPE: " << method << llendl; + llwarns << "CURL REQ HEADERS: " << headers.asString() << llendl; + llwarns << "CURL REQ BODY: " << body_str << llendl; + llwarns << "CURL HTTP_STATUS: " << http_status << llendl; llwarns << "CURL ERROR: " << curl_error_buffer << llendl; - + llwarns << "CURL ERROR BODY: " << http_buffer.asString() << llendl; response["body"] = http_buffer.asString(); } else { response["body"] = http_buffer.asLLSD(); + lldebugs << "CURL response: " << http_buffer.asString() << llendl; } - curl_easy_cleanup(curlp); + if(headers_list) + { // free the header list + curl_slist_free_all(headers_list); + } + // * Cleanup + curl_easy_cleanup(curlp); return response; } -void LLHTTPClient::put(const std::string& url, const LLSD& body, ResponderPtr responder, const F32 timeout) +LLSD LLHTTPClient::blockingGet(const std::string& url) +{ + return blocking_request(url, LLURLRequest::HTTP_GET, LLSD()); +} + +LLSD LLHTTPClient::blockingPost(const std::string& url, const LLSD& body) +{ + return blocking_request(url, LLURLRequest::HTTP_POST, body); +} + +void LLHTTPClient::put( + const std::string& url, + const LLSD& body, + ResponderPtr responder, + const LLSD& headers, + const F32 timeout) { - request(url, LLURLRequest::HTTP_PUT, new LLSDInjector(body), responder, timeout); + request(url, LLURLRequest::HTTP_PUT, new LLSDInjector(body), responder, timeout, headers); } -void LLHTTPClient::post(const std::string& url, const LLSD& body, ResponderPtr responder, const F32 timeout) +void LLHTTPClient::post( + const std::string& url, + const LLSD& body, + ResponderPtr responder, + const LLSD& headers, + const F32 timeout) { - request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout); + request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout, headers); } -void LLHTTPClient::post(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout) +void LLHTTPClient::postRaw( + const std::string& url, + const U8* data, + S32 size, + ResponderPtr responder, + const LLSD& headers, + const F32 timeout) { - request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout); + request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout, headers); } -void LLHTTPClient::del(const std::string& url, ResponderPtr responder, const F32 timeout) +void LLHTTPClient::postFile( + const std::string& url, + const std::string& filename, + ResponderPtr responder, + const LLSD& headers, + const F32 timeout) { - request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout); + request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, timeout, headers); } -#if 1 -void LLHTTPClient::postFile(const std::string& url, const std::string& filename, ResponderPtr responder, const F32 timeout) +void LLHTTPClient::postFile( + const std::string& url, + const LLUUID& uuid, + LLAssetType::EType asset_type, + ResponderPtr responder, + const LLSD& headers, + const F32 timeout) { - request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, timeout); + request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout, headers); } -void LLHTTPClient::postFile(const std::string& url, const LLUUID& uuid, - LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout) +// static +void LLHTTPClient::del( + const std::string& url, + ResponderPtr responder, + const LLSD& headers, + const F32 timeout) { - request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout); + request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout, headers); } -#endif + +// static +void LLHTTPClient::move( + const std::string& url, + const std::string& destination, + ResponderPtr responder, + const LLSD& hdrs, + const F32 timeout) +{ + LLSD headers = hdrs; + headers["Destination"] = destination; + request(url, LLURLRequest::HTTP_MOVE, NULL, responder, timeout, headers); +} + void LLHTTPClient::setPump(LLPumpIO& pump) { diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h index b011761f5f..a7236ba169 100644 --- a/indra/llmessage/llhttpclient.h +++ b/indra/llmessage/llhttpclient.h @@ -2,30 +2,25 @@ * @file llhttpclient.h * @brief Declaration of classes for making HTTP client requests. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -39,7 +34,8 @@ #include <string> #include <boost/intrusive_ptr.hpp> - +#include <openssl/x509_vfy.h> +#include "llurlrequest.h" #include "llassettype.h" #include "llcurl.h" #include "lliopipe.h" @@ -60,34 +56,107 @@ public: typedef LLCurl::Responder Responder; typedef LLCurl::ResponderPtr ResponderPtr; - // non-blocking - static void head(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + + /** @name non-blocking API */ + //@{ + static void head( + const std::string& url, + ResponderPtr, + const LLSD& headers = LLSD(), + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void getByteRange(const std::string& url, S32 offset, S32 bytes, ResponderPtr, const LLSD& headers=LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void get(const std::string& url, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void get(const std::string& url, const LLSD& query, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); - static void put(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + static void put( + const std::string& url, + const LLSD& body, + ResponderPtr, + const LLSD& headers = LLSD(), + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); - ///< non-blocking - static void post(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); - static void post(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); - static void postFile(const std::string& url, const std::string& filename, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); - static void postFile(const std::string& url, const LLUUID& uuid, - LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); - - // Blocking HTTP get that returns an LLSD map of status and body. - static LLSD blockingGet(const std::string& url); - - static void del(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + static void post( + const std::string& url, + const LLSD& body, + ResponderPtr, + const LLSD& headers = LLSD(), + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + /** Takes ownership of data and deletes it when sent */ + static void postRaw( + const std::string& url, + const U8* data, + S32 size, + ResponderPtr responder, + const LLSD& headers = LLSD(), + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + static void postFile( + const std::string& url, + const std::string& filename, + ResponderPtr, + const LLSD& headers = LLSD(), + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + static void postFile( + const std::string& url, + const LLUUID& uuid, + LLAssetType::EType asset_type, + ResponderPtr responder, + const LLSD& headers = LLSD(), + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + + static void del( + const std::string& url, + ResponderPtr responder, + const LLSD& headers = LLSD(), + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); ///< sends a DELETE method, but we can't call it delete in c++ + /** + * @brief Send a MOVE webdav method + * + * @param url The complete serialized (and escaped) url to get. + * @param destination The complete serialized destination url. + * @param responder The responder that will handle the result. + * @param headers A map of key:value headers to pass to the request + * @param timeout The number of seconds to give the server to respond. + */ + static void move( + const std::string& url, + const std::string& destination, + ResponderPtr responder, + const LLSD& headers = LLSD(), + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + + //@} + + /** + * @brief Blocking HTTP get that returns an LLSD map of status and body. + * + * @param url the complete serialized (and escaped) url to get + * @return An LLSD of { 'status':status, 'body':payload } + */ + static LLSD blockingGet(const std::string& url); + + /** + * @brief Blocking HTTP POST that returns an LLSD map of status and body. + * + * @param url the complete serialized (and escaped) url to get + * @param body the LLSD post body + * @return An LLSD of { 'status':status (an int), 'body':payload (an LLSD) } + */ + static LLSD blockingPost(const std::string& url, const LLSD& body); + static void setPump(LLPumpIO& pump); ///< must be called before any of the above calls are made static bool hasPump(); - ///< for testing + + static void setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback callback); + static LLURLRequest::SSLCertVerifyCallback getCertVerifyCallback() { return mCertVerifyCallback; } + +protected: + static LLURLRequest::SSLCertVerifyCallback mCertVerifyCallback; }; #endif // LL_LLHTTPCLIENT_H diff --git a/indra/llmessage/llhttpclientadapter.cpp b/indra/llmessage/llhttpclientadapter.cpp new file mode 100644 index 0000000000..f5d7a9abb6 --- /dev/null +++ b/indra/llmessage/llhttpclientadapter.cpp @@ -0,0 +1,55 @@ +/** + * @file llhttpclientadapter.cpp + * @brief + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llhttpclientadapter.h" +#include "llhttpclient.h" + +LLHTTPClientAdapter::~LLHTTPClientAdapter() +{ +} + +void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder) +{ + LLSD empty_pragma_header; + // Pragma is required to stop curl adding "no-cache" + // Space is required to stop llurlrequest from turnning off proxying + empty_pragma_header["Pragma"] = " "; + LLHTTPClient::get(url, responder, empty_pragma_header); +} + +void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers) +{ + LLSD empty_pragma_header = headers; + // as above + empty_pragma_header["Pragma"] = " "; + LLHTTPClient::get(url, responder, empty_pragma_header); +} + +void LLHTTPClientAdapter::put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder) +{ + LLHTTPClient::put(url, body, responder); +} + diff --git a/indra/llmessage/llhttpclientadapter.h b/indra/llmessage/llhttpclientadapter.h new file mode 100644 index 0000000000..aae6426a59 --- /dev/null +++ b/indra/llmessage/llhttpclientadapter.h @@ -0,0 +1,43 @@ +/** + * @file llhttpclientadepter.h + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_HTTPCLIENTADAPTER_H +#define LL_HTTPCLIENTADAPTER_H + +#include "llhttpclientinterface.h" +#include "llsingleton.h" // LLSingleton<> + +class LLHTTPClientAdapter : public LLHTTPClientInterface, public LLSingleton<LLHTTPClientAdapter> +{ +public: + virtual ~LLHTTPClientAdapter(); + virtual void get(const std::string& url, LLCurl::ResponderPtr responder); + virtual void get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers); + virtual void put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder); +}; + +#endif + diff --git a/indra/llmessage/llhttpclientinterface.h b/indra/llmessage/llhttpclientinterface.h new file mode 100644 index 0000000000..12a3857a61 --- /dev/null +++ b/indra/llmessage/llhttpclientinterface.h @@ -0,0 +1,45 @@ +/** + * @file llhttpclientinterface.h + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLHTTPCLIENTINTERFACE_H +#define LL_LLHTTPCLIENTINTERFACE_H + +#include "linden_common.h" +#include "llcurl.h" + +#include <string> + +class LLHTTPClientInterface +{ +public: + virtual ~LLHTTPClientInterface() {} + virtual void get(const std::string& url, LLCurl::ResponderPtr responder) = 0; + virtual void get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers) = 0; + virtual void put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder) = 0; +}; + +#endif // LL_LLHTTPCLIENTINTERFACE_H + diff --git a/indra/llmessage/llhttpnode.cpp b/indra/llmessage/llhttpnode.cpp index 1289b63d79..5c2f73eccb 100644 --- a/indra/llmessage/llhttpnode.cpp +++ b/indra/llmessage/llhttpnode.cpp @@ -2,30 +2,25 @@ * @file llhttpnode.cpp * @brief Implementation of classes for generic HTTP/LSL/REST handling. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -35,8 +30,8 @@ #include <boost/tokenizer.hpp> #include "llstl.h" +#include "lliohttpserver.h" // for string constants -static const std::string CONTEXT_REQUEST("request"); static const std::string CONTEXT_WILDCARD("wildcard"); /** @@ -97,19 +92,19 @@ namespace { } // virtual -LLSD LLHTTPNode::get() const +LLSD LLHTTPNode::simpleGet() const { throw NotImplemented(); } // virtual -LLSD LLHTTPNode::put(const LLSD& input) const +LLSD LLHTTPNode::simplePut(const LLSD& input) const { throw NotImplemented(); } // virtual -LLSD LLHTTPNode::post(const LLSD& input) const +LLSD LLHTTPNode::simplePost(const LLSD& input) const { throw NotImplemented(); } @@ -120,7 +115,7 @@ void LLHTTPNode::get(LLHTTPNode::ResponsePtr response, const LLSD& context) cons { try { - response->result(get()); + response->result(simpleGet()); } catch (NotImplemented) { @@ -133,7 +128,7 @@ void LLHTTPNode::put(LLHTTPNode::ResponsePtr response, const LLSD& context, cons { try { - response->result(put(input)); + response->result(simplePut(input)); } catch (NotImplemented) { @@ -146,7 +141,7 @@ void LLHTTPNode::post(LLHTTPNode::ResponsePtr response, const LLSD& context, con { try { - response->result(post(input)); + response->result(simplePost(input)); } catch (NotImplemented) { @@ -159,7 +154,7 @@ void LLHTTPNode::del(LLHTTPNode::ResponsePtr response, const LLSD& context) cons { try { - response->result(del(context)); + response->result(simpleDel(context)); } catch (NotImplemented) { @@ -169,15 +164,30 @@ void LLHTTPNode::del(LLHTTPNode::ResponsePtr response, const LLSD& context) cons } // virtual -LLSD LLHTTPNode::del() const +LLSD LLHTTPNode::simpleDel(const LLSD&) const { throw NotImplemented(); } // virtual -LLSD LLHTTPNode::del(const LLSD&) const +void LLHTTPNode::options(ResponsePtr response, const LLSD& context) const { - return del(); + //llinfos << "options context: " << context << llendl; + + // default implementation constructs an url to the documentation. + std::string host( + context[CONTEXT_REQUEST][CONTEXT_HEADERS]["host"].asString()); + if(host.empty()) + { + response->status(400, "Bad Request -- need Host header"); + return; + } + std::ostringstream ostr; + ostr << "http://" << host << "/web/server/api"; + ostr << context[CONTEXT_REQUEST]["path"].asString(); + static const std::string DOC_HEADER("X-Documentation-URL"); + response->addHeader(DOC_HEADER, ostr.str()); + response->status(200, "OK"); } @@ -372,7 +382,7 @@ LLHTTPNode::Response::~Response() { } -void LLHTTPNode::Response::status(S32 code) +void LLHTTPNode::Response::statusUnknownError(S32 code) { status(code, "Unknown Error"); } @@ -392,6 +402,13 @@ void LLHTTPNode::Response::methodNotAllowed() status(405, "Method Not Allowed"); } +void LLHTTPNode::Response::addHeader( + const std::string& name, + const std::string& value) +{ + mHeaders[name] = value; +} + void LLHTTPNode::describe(Description& desc) const { desc.shortInfo("unknown service (missing describe() method)"); @@ -432,8 +449,8 @@ void LLHTTPRegistrar::buildAllServices(LLHTTPNode& root) FactoryMap::const_iterator end = map.end(); for (; i != end; ++i) { - llinfos << "LLHTTPRegistrar::buildAllServices adding node for path " - << i->first << llendl; + LL_DEBUGS("AppInit") << "LLHTTPRegistrar::buildAllServices adding node for path " + << i->first << LL_ENDL; root.addNode(i->first, i->second->build()); } @@ -453,6 +470,11 @@ void LLSimpleResponse::result(const LLSD& result) status(200, "OK"); } +void LLSimpleResponse::extendedResult(S32 code, const std::string& body, const LLSD& headers) +{ + status(code,body); +} + void LLSimpleResponse::status(S32 code, const std::string& message) { mCode = code; diff --git a/indra/llmessage/llhttpnode.h b/indra/llmessage/llhttpnode.h index 2f177bf0ef..148647ddde 100644 --- a/indra/llmessage/llhttpnode.h +++ b/indra/llmessage/llhttpnode.h @@ -2,42 +2,37 @@ * @file llhttpnode.h * @brief Declaration of classes for generic HTTP/LSL/REST handling. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #ifndef LL_LLHTTPNODE_H #define LL_LLHTTPNODE_H -#include "llmemory.h" +#include "llpointer.h" +#include "llrefcount.h" #include "llsd.h" class LLChainIOFactory; - /** * These classes represent the HTTP framework: The URL tree, and the LLSD * REST interface that such nodes implement. @@ -82,34 +77,86 @@ public: */ //@{ public: - virtual LLSD get() const; - virtual LLSD put(const LLSD& input) const; - virtual LLSD post(const LLSD& input) const; - virtual LLSD del() const; - virtual LLSD del(const LLSD& context) const; + virtual LLSD simpleGet() const; + virtual LLSD simplePut(const LLSD& input) const; + virtual LLSD simplePost(const LLSD& input) const; + virtual LLSD simpleDel(const LLSD& context) const; - class Response : public LLRefCount - { - protected: - virtual ~Response(); + /** + * @brief Abstract Base Class declaring Response interface. + */ + class Response : public LLRefCount + { + protected: + virtual ~Response(); - public: - virtual void result(const LLSD&) = 0; - virtual void status(S32 code, const std::string& message) = 0; + public: + /** + * @brief Return the LLSD content and a 200 OK. + */ + virtual void result(const LLSD&) = 0; - void status(S32 code); - void notFound(const std::string& message); - void notFound(); - void methodNotAllowed(); - }; + /** + * @brief return status code and message with headers. + */ + virtual void extendedResult(S32 code, const std::string& message, const LLSD& headers) = 0; - typedef LLPointer<Response> ResponsePtr; + /** + * @brief return status code and reason string on http header, + * but do not return a payload. + */ + virtual void status(S32 code, const std::string& message) = 0; + + /** + * @brief Return no body, just status code and 'UNKNOWN ERROR'. + */ + virtual void statusUnknownError(S32 code); + + virtual void notFound(const std::string& message); + virtual void notFound(); + virtual void methodNotAllowed(); + + /** + * @breif Add a name: value http header. + * + * No effort is made to ensure the response is a valid http + * header. + * The headers are stored as a map of header name : value. + * Though HTTP allows the same header name to be transmitted + * more than once, this implementation only stores a header + * name once. + * @param name The name of the header, eg, "Content-Encoding" + * @param value The value of the header, eg, "gzip" + */ + virtual void addHeader(const std::string& name, const std::string& value); + + protected: + /** + * @brief Headers to be sent back with the HTTP response. + * + * Protected class membership since derived classes are + * expected to use it and there is no use case yet for other + * uses. If such a use case arises, I suggest making a + * headers() public method, and moving this member data into + * private. + */ + LLSD mHeaders; + }; - virtual void get(ResponsePtr, const LLSD& context) const; - virtual void put(ResponsePtr, const LLSD& context, const LLSD& input) const; - virtual void post(ResponsePtr, const LLSD& context, const LLSD& input) const; - virtual void del(ResponsePtr, const LLSD& context) const; + typedef LLPointer<Response> ResponsePtr; + + virtual void get(ResponsePtr, const LLSD& context) const; + virtual void put( + ResponsePtr, + const LLSD& context, + const LLSD& input) const; + virtual void post( + ResponsePtr, + const LLSD& context, + const LLSD& input) const; + virtual void del(ResponsePtr, const LLSD& context) const; + virtual void options(ResponsePtr, const LLSD& context) const; //@} @@ -172,6 +219,14 @@ public: const LLHTTPNode* rootNode() const; const LLHTTPNode* findNode(const std::string& name) const; + + enum EHTTPNodeContentType + { + CONTENT_TYPE_LLSD, + CONTENT_TYPE_TEXT + }; + + virtual EHTTPNodeContentType getContentType() const { return CONTENT_TYPE_LLSD; } //@} /* @name Description system @@ -231,6 +286,8 @@ public: static LLPointer<LLSimpleResponse> create(); void result(const LLSD& result); + void extendedResult(S32 code, const std::string& body, const LLSD& headers); + void status(S32 code, const std::string& message); void print(std::ostream& out) const; @@ -242,7 +299,7 @@ protected: ~LLSimpleResponse(); private: - LLSimpleResponse() {;} // Must be accessed through LLPointer. + LLSimpleResponse() : mCode(0) {} // Must be accessed through LLPointer. }; std::ostream& operator<<(std::ostream& out, const LLSimpleResponse& resp); diff --git a/indra/llmessage/llhttpnodeadapter.h b/indra/llmessage/llhttpnodeadapter.h new file mode 100644 index 0000000000..22984c4478 --- /dev/null +++ b/indra/llmessage/llhttpnodeadapter.h @@ -0,0 +1,52 @@ +/** + * @file llhttpnodeadapter.h + * @brief Declaration of llhttpnode adapter classes + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_HTTP_NODE_ADAPTER_H +#define LL_HTTP_NODE_ADAPTER_H + +#include "llhttpnode.h" + +template<typename T> +class LLHTTPNodeAdapter : public LLHTTPNode +{ +public: + + virtual bool validate(const std::string& name, LLSD& context) const + { + T node; + return node.validate(name, context); + } + + virtual void post(LLHTTPNode::ResponsePtr response, + const LLSD& context, + const LLSD& input) const + { + T node; + return node.post(response, context, input); + } +}; + +#endif // LL_HTTP_NODE_ADAPTER_H diff --git a/indra/llmessage/llhttpsender.cpp b/indra/llmessage/llhttpsender.cpp index 096bc73e0b..c48cbc42a6 100644 --- a/indra/llmessage/llhttpsender.cpp +++ b/indra/llmessage/llhttpsender.cpp @@ -2,30 +2,25 @@ * @file llhttpsender.cpp * @brief Abstracts details of sending messages via HTTP. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -52,7 +47,7 @@ LLHTTPSender::~LLHTTPSender() } //virtual -void LLHTTPSender::send(const LLHost& host, const char* name, +void LLHTTPSender::send(const LLHost& host, const std::string& name, const LLSD& body, LLHTTPClient::ResponderPtr response) const { diff --git a/indra/llmessage/llhttpsender.h b/indra/llmessage/llhttpsender.h index 3a6cd681fa..88920db24d 100644 --- a/indra/llmessage/llhttpsender.h +++ b/indra/llmessage/llhttpsender.h @@ -2,30 +2,25 @@ * @file llhttpsender.h * @brief Abstracts details of sending messages via HTTP. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -45,7 +40,7 @@ class LLHTTPSender /** @brief Send message to host with body, call response when done */ virtual void send(const LLHost& host, - const char* message, const LLSD& body, + const std::string& message, const LLSD& body, LLHTTPClient::ResponderPtr response) const; /** @brief Set sender for host, takes ownership of sender. */ diff --git a/indra/llmessage/llinstantmessage.cpp b/indra/llmessage/llinstantmessage.cpp index 04af44fe26..d68e0c423e 100644 --- a/indra/llmessage/llinstantmessage.cpp +++ b/indra/llmessage/llinstantmessage.cpp @@ -4,30 +4,25 @@ * @date 2005-08-29 * @brief Constants and functions used in IM. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -39,8 +34,8 @@ #include "lluuid.h" #include "llsd.h" #include "llsdserialize.h" -#include "llsdutil.h" -#include "llmemory.h" +#include "llsdutil_math.h" +#include "llpointer.h" #include "message.h" #include "message.h" @@ -59,7 +54,8 @@ const S32 VOTE_UNANIMOUS = 2; const char EMPTY_BINARY_BUCKET[] = ""; const S32 EMPTY_BINARY_BUCKET_SIZE = 1; const U32 NO_TIMESTAMP = 0; -const char SYSTEM_FROM[] = "Second Life"; +const std::string SYSTEM_FROM("Second Life"); +const std::string INTERACTIVE_SYSTEM_FROM("F387446C-37C4-45f2-A438-D99CBDBB563B"); const S32 IM_TTL = 1; @@ -67,9 +63,11 @@ const S32 IM_TTL = 1; * LLIMInfo */ LLIMInfo::LLIMInfo() : + mFromGroup(FALSE), mParentEstateID(0), mOffline(0), mViewerThinksToIsOnline(false), + mIMType(IM_NOTHING_SPECIAL), mTimeStamp(0), mSource(IM_FROM_SIM), mTTL(IM_TTL) @@ -144,8 +142,8 @@ void LLIMInfo::packMessageBlock(LLMessageSystem* msg) const mFromGroup, LLUUID::null, mToID, - mName.c_str(), - mMessage.c_str(), + mName, + mMessage, mOffline, mIMType, mID, @@ -163,8 +161,8 @@ void pack_instant_message( BOOL from_group, const LLUUID& session_id, const LLUUID& to_id, - const char* name, - const char* message, + const std::string& name, + const std::string& message, U8 offline, EInstantMessage dialog, const LLUUID& id, @@ -202,8 +200,8 @@ void pack_instant_message_block( BOOL from_group, const LLUUID& session_id, const LLUUID& to_id, - const char* name, - const char* message, + const std::string& name, + const std::string& message, U8 offline, EInstantMessage dialog, const LLUUID& id, @@ -229,10 +227,10 @@ void pack_instant_message_block( msg->addU32Fast(_PREHASH_Timestamp, timestamp); msg->addStringFast(_PREHASH_FromAgentName, name); S32 bytes_left = MTUBYTES; - if(message) + if(!message.empty()) { char buffer[MTUBYTES]; - int num_written = snprintf(buffer, MTUBYTES, "%s", message); /* Flawfinder: ignore */ + int num_written = snprintf(buffer, MTUBYTES, "%s", message.c_str()); /* Flawfinder: ignore */ // snprintf returns number of bytes that would have been written // had the output not being truncated. In that case, it will // return either -1 or value >= passed in size value . So a check needs to be added @@ -281,13 +279,9 @@ void LLIMInfo::unpackMessageBlock(LLMessageSystem* msg) mIMType = (EInstantMessage) dialog; msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, mID); msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_Timestamp, mTimeStamp); - char name[DB_FULL_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, DB_FULL_NAME_BUF_SIZE, name); - mName.assign(name); + msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, mName); - char message[DB_IM_MSG_BUF_SIZE]; /*Flawfinder: ignore*/ - msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, DB_IM_MSG_BUF_SIZE, message); - mMessage.assign(message); + msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, mMessage); S32 binary_bucket_size = llmin( MTUBYTES, @@ -360,7 +354,7 @@ LLPointer<LLIMInfo> llsd_to_im_info(const LLSD& im_info_sd) param_message["message"].asString(), param_message["id"].asUUID(), (U32) param_message["parent_estate_id"].asInteger(), - im_info->mRegionID = param_message["region_id"].asUUID(), + param_message["region_id"].asUUID(), ll_vector3_from_sd(param_message["position"]), param_message["data"], (U8) param_message["offline"].asInteger(), diff --git a/indra/llmessage/llinstantmessage.h b/indra/llmessage/llinstantmessage.h index abb1651faf..e0dae376b4 100644 --- a/indra/llmessage/llinstantmessage.h +++ b/indra/llmessage/llinstantmessage.h @@ -2,30 +2,25 @@ * @file llinstantmessage.h * @brief Constants and declarations used by instant messages. * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -35,7 +30,8 @@ #include "llhost.h" #include "lluuid.h" #include "llsd.h" -#include "llmemory.h" +#include "llrefcount.h" +#include "llpointer.h" #include "v3math.h" class LLMessageSystem; @@ -73,6 +69,7 @@ enum EInstantMessage // Group vote // Name is name of person who called vote. // ID is vote ID used for internal tracking + // TODO: _DEPRECATED suffix as part of vote removal - DEV-24856 IM_GROUP_VOTE = 7, // Group message @@ -158,7 +155,7 @@ enum EInstantMessage IM_FRIENDSHIP_OFFERED = 38, IM_FRIENDSHIP_ACCEPTED = 39, - IM_FRIENDSHIP_DECLINED = 40, + IM_FRIENDSHIP_DECLINED_DEPRECATED = 40, IM_TYPING_START = 41, IM_TYPING_STOP = 42, @@ -177,7 +174,7 @@ enum EGodlikeRequest GOD_WANTS_NOTHING, // for requesting physics information about an object - GOD_WANTS_HAVOK_INFO, + GOD_WANTS_PHYSICS_INFO, // two unused requests that can be appropriated for debug // purposes (no viewer recompile necessary) @@ -222,7 +219,8 @@ extern const char EMPTY_BINARY_BUCKET[]; extern const S32 EMPTY_BINARY_BUCKET_SIZE; extern const U32 NO_TIMESTAMP; -extern const char SYSTEM_FROM[]; +extern const std::string SYSTEM_FROM; +extern const std::string INTERACTIVE_SYSTEM_FROM; // Number of retry attempts on sending the im. extern const S32 IM_TTL; @@ -289,8 +287,8 @@ void pack_instant_message( BOOL from_group, const LLUUID& session_id, const LLUUID& to_id, - const char* name, - const char* message, + const std::string& name, + const std::string& message, U8 offline = IM_ONLINE, EInstantMessage dialog = IM_NOTHING_SPECIAL, const LLUUID& id = LLUUID::null, @@ -307,8 +305,8 @@ void pack_instant_message_block( BOOL from_group, const LLUUID& session_id, const LLUUID& to_id, - const char* name, - const char* message, + const std::string& name, + const std::string& message, U8 offline = IM_ONLINE, EInstantMessage dialog = IM_NOTHING_SPECIAL, const LLUUID& id = LLUUID::null, diff --git a/indra/llmessage/llinvite.h b/indra/llmessage/llinvite.h index e9439de568..e5d573c1e3 100644 --- a/indra/llmessage/llinvite.h +++ b/indra/llmessage/llinvite.h @@ -2,30 +2,25 @@ * @file llinvite.h * @brief Constants used for inviting users to join groups. * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/lliobuffer.cpp b/indra/llmessage/lliobuffer.cpp index 061e8f0ff1..ed00e230ac 100644 --- a/indra/llmessage/lliobuffer.cpp +++ b/indra/llmessage/lliobuffer.cpp @@ -4,30 +4,25 @@ * @date 2005-05-04 * @brief Definition of buffer based implementations of IO Pipes. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -86,7 +81,7 @@ LLIOPipe::EStatus LLIOBuffer::seek(LLIOBuffer::EHead head, S64 delta) { case READ: if(((delta >= 0) && ((mReadHead + delta) <= mWriteHead)) - || (delta < 0) && ((mReadHead + delta) >= mBuffer)) + || ((delta < 0) && ((mReadHead + delta) >= mBuffer))) { mReadHead += delta; status = STATUS_OK; @@ -94,7 +89,7 @@ LLIOPipe::EStatus LLIOBuffer::seek(LLIOBuffer::EHead head, S64 delta) break; case WRITE: if(((delta >= 0) && ((mWriteHead + delta) < (mBuffer + mBufferSize))) - || (delta < 0) && ((mWriteHead + delta) > mReadHead)) + || ((delta < 0) && ((mWriteHead + delta) > mReadHead))) { mWriteHead += delta; status = STATUS_OK; diff --git a/indra/llmessage/lliobuffer.h b/indra/llmessage/lliobuffer.h index 14381ab652..3349848947 100644 --- a/indra/llmessage/lliobuffer.h +++ b/indra/llmessage/lliobuffer.h @@ -4,30 +4,25 @@ * @date 2005-05-04 * @brief Declaration of buffers for use in IO Pipes. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index 625dbb68b9..3b18a9177c 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -4,30 +4,25 @@ * @date 2005-10-05 * @brief Implementation of the http server classes * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -47,6 +42,7 @@ #include "llpumpio.h" #include "llsd.h" #include "llsdserialize_xml.h" +#include "llstat.h" #include "llstl.h" #include "lltimer.h" @@ -55,12 +51,15 @@ #include <boost/tokenizer.hpp> static const char HTTP_VERSION_STR[] = "HTTP/1.0"; -static const std::string CONTEXT_REQUEST("request"); -static const std::string CONTEXT_RESPONSE("response"); -static const std::string HTTP_VERB_GET("GET"); -static const std::string HTTP_VERB_PUT("PUT"); -static const std::string HTTP_VERB_POST("POST"); -static const std::string HTTP_VERB_DELETE("DELETE"); +const std::string CONTEXT_REQUEST("request"); +const std::string CONTEXT_RESPONSE("response"); +const std::string CONTEXT_VERB("verb"); +const std::string CONTEXT_HEADERS("headers"); +const std::string HTTP_VERB_GET("GET"); +const std::string HTTP_VERB_PUT("PUT"); +const std::string HTTP_VERB_POST("POST"); +const std::string HTTP_VERB_DELETE("DELETE"); +const std::string HTTP_VERB_OPTIONS("OPTIONS"); static LLIOHTTPServer::timing_callback_t sTimingCallback = NULL; static void* sTimingCallbackData = NULL; @@ -69,7 +68,12 @@ class LLHTTPPipe : public LLIOPipe { public: LLHTTPPipe(const LLHTTPNode& node) - : mNode(node), mResponse(NULL), mState(STATE_INVOKE), mChainLock(0), mStatusCode(0) + : mNode(node), + mResponse(NULL), + mState(STATE_INVOKE), + mChainLock(0), + mLockedPump(NULL), + mStatusCode(0) { } virtual ~LLHTTPPipe() { @@ -99,12 +103,14 @@ private: // from LLHTTPNode::Response virtual void result(const LLSD&); + virtual void extendedResult(S32 code, const std::string& body, const LLSD& headers); + virtual void status(S32 code, const std::string& message); void nullPipe(); private: - Response() {;} // Must be accessed through LLPointer. + Response() : mPipe(NULL) {} // Must be accessed through LLPointer. LLHTTPPipe* mPipe; }; friend class Response; @@ -117,7 +123,8 @@ private: STATE_DELAYED, STATE_LOCKED, STATE_GOOD_RESULT, - STATE_STATUS_RESULT + STATE_STATUS_RESULT, + STATE_EXTENDED_RESULT }; State mState; @@ -130,6 +137,7 @@ private: LLSD mGoodResult; S32 mStatusCode; std::string mStatusMessage; + LLSD mHeaders; }; LLIOPipe::EStatus LLHTTPPipe::process_impl( @@ -164,27 +172,53 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( static LLTimer timer; timer.reset(); - std::string verb = context[CONTEXT_REQUEST]["verb"]; + std::string verb = context[CONTEXT_REQUEST][CONTEXT_VERB]; if(verb == HTTP_VERB_GET) { + LLPerfBlock getblock("http_get"); mNode.get(LLHTTPNode::ResponsePtr(mResponse), context); } else if(verb == HTTP_VERB_PUT) { + LLPerfBlock putblock("http_put"); LLSD input; - LLSDSerialize::fromXML(input, istr); + if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_LLSD) + { + LLSDSerialize::fromXML(input, istr); + } + else if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_TEXT) + { + std::stringstream strstrm; + strstrm << istr.rdbuf(); + input = strstrm.str(); + } mNode.put(LLHTTPNode::ResponsePtr(mResponse), context, input); } else if(verb == HTTP_VERB_POST) { + LLPerfBlock postblock("http_post"); LLSD input; - LLSDSerialize::fromXML(input, istr); + if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_LLSD) + { + LLSDSerialize::fromXML(input, istr); + } + else if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_TEXT) + { + std::stringstream strstrm; + strstrm << istr.rdbuf(); + input = strstrm.str(); + } mNode.post(LLHTTPNode::ResponsePtr(mResponse), context, input); } else if(verb == HTTP_VERB_DELETE) { + LLPerfBlock delblock("http_delete"); mNode.del(LLHTTPNode::ResponsePtr(mResponse), context); } + else if(verb == HTTP_VERB_OPTIONS) + { + mNode.options(LLHTTPNode::ResponsePtr(mResponse), context); + } else { mResponse->methodNotAllowed(); @@ -203,7 +237,9 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( } // Log all HTTP transactions. - llinfos << verb << " " << context[CONTEXT_REQUEST]["path"].asString() + // TODO: Add a way to log these to their own file instead of indra.log + // It is just too spammy to be in indra.log. + lldebugs << verb << " " << context[CONTEXT_REQUEST]["path"].asString() << " " << mStatusCode << " " << mStatusMessage << " " << delta << "s" << llendl; @@ -229,7 +265,9 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( case STATE_GOOD_RESULT: { - context[CONTEXT_RESPONSE]["contentType"] = "application/xml"; + LLSD headers = mHeaders; + headers["Content-Type"] = "application/llsd+xml"; + context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = headers; LLBufferStream ostr(channels, buffer.get()); LLSDSerialize::toXML(mGoodResult, ostr); @@ -238,11 +276,22 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( case STATE_STATUS_RESULT: { - context[CONTEXT_RESPONSE]["contentType"] = "text/plain"; + LLSD headers = mHeaders; + headers["Content-Type"] = "text/plain"; + context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = headers; context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode; context[CONTEXT_RESPONSE]["statusMessage"] = mStatusMessage; LLBufferStream ostr(channels, buffer.get()); - ostr << mStatusMessage << std::ends; + ostr << mStatusMessage; + + return STATUS_DONE; + } + case STATE_EXTENDED_RESULT: + { + context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = mHeaders; + context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode; + LLBufferStream ostr(channels, buffer.get()); + ostr << mStatusMessage; return STATUS_DONE; } @@ -285,9 +334,25 @@ void LLHTTPPipe::Response::result(const LLSD& r) mPipe->mStatusMessage = "OK"; mPipe->mGoodResult = r; mPipe->mState = STATE_GOOD_RESULT; + mPipe->mHeaders = mHeaders; mPipe->unlockChain(); } +void LLHTTPPipe::Response::extendedResult(S32 code, const std::string& body, const LLSD& headers) +{ + if(! mPipe) + { + llwarns << "LLHTTPPipe::Response::status: NULL pipe" << llendl; + return; + } + + mPipe->mStatusCode = code; + mPipe->mStatusMessage = body; + mPipe->mHeaders = headers; + mPipe->mState = STATE_EXTENDED_RESULT; + mPipe->unlockChain(); +} + // virtual void LLHTTPPipe::Response::status(S32 code, const std::string& message) { @@ -300,6 +365,7 @@ void LLHTTPPipe::Response::status(S32 code, const std::string& message) mPipe->mStatusCode = code; mPipe->mStatusMessage = message; mPipe->mState = STATE_STATUS_RESULT; + mPipe->mHeaders = mHeaders; mPipe->unlockChain(); } @@ -336,7 +402,7 @@ void LLHTTPPipe::unlockChain() class LLHTTPResponseHeader : public LLIOPipe { public: - LLHTTPResponseHeader() {} + LLHTTPResponseHeader() : mCode(0) {} virtual ~LLHTTPResponseHeader() {} protected: @@ -387,17 +453,25 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl( } ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n"; - - std::string type = context[CONTEXT_RESPONSE]["contentType"].asString(); - if (!type.empty()) - { - ostr << "Content-Type: " << type << "\r\n"; - } + S32 content_length = buffer->countAfter(channels.in(), NULL); if(0 < content_length) { ostr << "Content-Length: " << content_length << "\r\n"; } + // *NOTE: This guard can go away once the LLSD static map + // iterator is available. Phoenix. 2008-05-09 + LLSD headers = context[CONTEXT_RESPONSE][CONTEXT_HEADERS]; + if(headers.isDefined()) + { + LLSD::map_iterator iter = headers.beginMap(); + LLSD::map_iterator end = headers.endMap(); + for(; iter != end; ++iter) + { + ostr << (*iter).first << ": " << (*iter).second.asString() + << "\r\n"; + } + } ostr << "\r\n"; LLChangeChannel change(channels.in(), channels.out()); @@ -446,7 +520,7 @@ protected: * seek orfor string assignment. * @returns Returns true if a line was found. */ - bool readLine( + bool readHeaderLine( const LLChannelDescriptors& channels, buffer_ptr_t buffer, U8* dest, @@ -517,7 +591,7 @@ LLHTTPResponder::~LLHTTPResponder() //lldebugs << "destroying LLHTTPResponder" << llendl; } -bool LLHTTPResponder::readLine( +bool LLHTTPResponder::readHeaderLine( const LLChannelDescriptors& channels, buffer_ptr_t buffer, U8* dest, @@ -595,7 +669,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( #endif PUMP_DEBUG; - if(readLine(channels, buffer, (U8*)buf, len)) + if(readHeaderLine(channels, buffer, (U8*)buf, len)) { bool read_next_line = false; bool parse_all = true; @@ -604,11 +678,12 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( read_next_line = true; LLMemoryStream header((U8*)buf, len); header >> mVerb; - + if((HTTP_VERB_GET == mVerb) || (HTTP_VERB_POST == mVerb) || (HTTP_VERB_PUT == mVerb) - || (HTTP_VERB_DELETE == mVerb)) + || (HTTP_VERB_DELETE == mVerb) + || (HTTP_VERB_OPTIONS == mVerb)) { header >> mAbsPathAndQuery; header >> mVersion; @@ -658,7 +733,13 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( if(read_next_line) { len = HEADER_BUFFER_SIZE; - readLine(channels, buffer, (U8*)buf, len); + if (!readHeaderLine(channels, buffer, (U8*)buf, len)) + { + // Failed to read the header line, probably too long. + // readHeaderLine already marked the channel/buffer as bad. + keep_parsing = false; + break; + } } if(0 == len) { @@ -683,7 +764,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( read_next_line = true; std::string name(buf, pos_colon - buf); std::string value(pos_colon + 2); - LLString::toLower(name); + LLStringUtil::toLower(name); if("content-length" == name) { lldebugs << "Content-Length: " << value << llendl; @@ -691,7 +772,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( } else { - LLString::trimTail(value); + LLStringUtil::trimTail(value); mHeaders[name] = value; } } @@ -719,12 +800,12 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( { // hey, hey, we should have everything now, so we pass it to // a content handler. - context[CONTEXT_REQUEST]["verb"] = mVerb; + context[CONTEXT_REQUEST][CONTEXT_VERB] = mVerb; const LLHTTPNode* node = mRootNode.traverse(mPath, context); if(node) { - lldebugs << "LLHTTPResponder::process_impl found node for " - << mAbsPathAndQuery << llendl; + //llinfos << "LLHTTPResponder::process_impl found node for " + // << mAbsPathAndQuery << llendl; // Copy everything after mLast read to the out. LLBufferArray::segment_iterator_t seg_iter; @@ -763,12 +844,13 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( = mBuildContext["remote-host"]; context[CONTEXT_REQUEST]["remote-port"] = mBuildContext["remote-port"]; - context[CONTEXT_REQUEST]["headers"] = mHeaders; + context[CONTEXT_REQUEST][CONTEXT_HEADERS] = mHeaders; const LLChainIOFactory* protocolHandler = node->getProtocolHandler(); if (protocolHandler) { + lldebugs << "HTTP context: " << context << llendl; protocolHandler->build(chain, context); } else diff --git a/indra/llmessage/lliohttpserver.h b/indra/llmessage/lliohttpserver.h index bf61dae06b..5c1b0531ff 100644 --- a/indra/llmessage/lliohttpserver.h +++ b/indra/llmessage/lliohttpserver.h @@ -3,42 +3,48 @@ * @brief Declaration of function for creating an HTTP wire server * @see LLIOServerSocket, LLPumpIO * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #ifndef LL_LLIOHTTPSERVER_H #define LL_LLIOHTTPSERVER_H -#include "llapr.h" #include "llchainio.h" #include "llhttpnode.h" class LLPumpIO; +// common strings use for populating the context. bascally 'request', +// 'wildcard', and 'headers'. +extern const std::string CONTEXT_REQUEST; +extern const std::string CONTEXT_RESPONSE; +extern const std::string CONTEXT_VERB; +extern const std::string CONTEXT_HEADERS; +extern const std::string HTTP_VERB_GET; +extern const std::string HTTP_VERB_PUT; +extern const std::string HTTP_VERB_POST; +extern const std::string HTTP_VERB_DELETE; +extern const std::string HTTP_VERB_OPTIONS; + class LLIOHTTPServer { public: diff --git a/indra/llmessage/lliopipe.cpp b/indra/llmessage/lliopipe.cpp index a0cf5183f1..6e4eec74a6 100644 --- a/indra/llmessage/lliopipe.cpp +++ b/indra/llmessage/lliopipe.cpp @@ -4,30 +4,25 @@ * @date 2004-11-19 * @brief Implementation of the LLIOPipe class * - * $LicenseInfo:firstyear=2004&license=viewergpl$ - * - * Copyright (c) 2004-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -55,6 +50,7 @@ static const std::string STATUS_ERROR_NAMES[LLIOPipe::STATUS_ERROR_COUNT] = std::string("STATUS_EXPIRED"), }; +#ifdef LL_DEBUG_PUMPS // Debugging schmutz for deadlock const char *gPumpFile = ""; S32 gPumpLine = 0; @@ -64,6 +60,7 @@ void pump_debug(const char *file, S32 line) gPumpFile = file; gPumpLine = line; } +#endif /* LL_DEBUG_PUMPS */ /** * LLIOPipe diff --git a/indra/llmessage/lliopipe.h b/indra/llmessage/lliopipe.h index e480f83b55..8e656b6da1 100644 --- a/indra/llmessage/lliopipe.h +++ b/indra/llmessage/lliopipe.h @@ -4,30 +4,25 @@ * @date 2004-11-18 * @brief Declaration of base IO class * - * $LicenseInfo:firstyear=2004&license=viewergpl$ - * - * Copyright (c) 2004-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -36,7 +31,7 @@ #include <boost/intrusive_ptr.hpp> #include <boost/shared_ptr.hpp> -#include "apr-1/apr_poll.h" +#include "apr_poll.h" #include "llsd.h" @@ -46,11 +41,14 @@ class LLBufferArray; class LLChannelDescriptors; // Debugging schmutz for deadlocks -#define LL_DEBUG_PUMPS +//#define LL_DEBUG_PUMPS #ifdef LL_DEBUG_PUMPS void pump_debug(const char *file, S32 line); #define PUMP_DEBUG pump_debug(__FILE__, __LINE__); #define END_PUMP_DEBUG pump_debug("none", 0); +#else /* LL_DEBUG_PUMPS */ +#define PUMP_DEBUG +#define END_PUMP_DEBUG #endif diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index b1f55a297c..ca84fa8bb8 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -4,30 +4,25 @@ * @date 2005-07-31 * @brief Sockets declarations for use with the io pipes * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -68,7 +63,7 @@ bool is_addr_in_use(apr_status_t status) // Define this to see the actual file descriptors being tossed around. //#define LL_DEBUG_SOCKET_FILE_DESCRIPTORS 1 #if LL_DEBUG_SOCKET_FILE_DESCRIPTORS -#include "apr-1/apr_portable.h" +#include "apr_portable.h" #endif #endif @@ -220,11 +215,11 @@ bool LLSocket::blockingConnect(const LLHost& host) { if(!mSocket) return false; apr_sockaddr_t* sa = NULL; - char ip_address[MAXADDRSTR]; /*Flawfinder: ignore*/ - host.getIPString(ip_address, MAXADDRSTR); + std::string ip_address; + ip_address = host.getIPString(); if(ll_apr_warn_status(apr_sockaddr_info_get( &sa, - ip_address, + ip_address.c_str(), APR_UNSPEC, host.getPort(), 0, @@ -355,8 +350,11 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl( } else if(APR_STATUS_IS_EAGAIN(status)) { +/*Commented out by Aura 9-9-8 for DEV-19961. // everything is fine, but we can terminate this process pump. + rv = STATUS_BREAK; +*/ } else { diff --git a/indra/llmessage/lliosocket.h b/indra/llmessage/lliosocket.h index 586f489b28..6806e5084a 100644 --- a/indra/llmessage/lliosocket.h +++ b/indra/llmessage/lliosocket.h @@ -4,30 +4,25 @@ * @date 2005-07-31 * @brief Declaration of files used for handling sockets and associated pipes * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -43,8 +38,8 @@ */ #include "lliopipe.h" -#include "apr-1/apr_pools.h" -#include "apr-1/apr_network_io.h" +#include "apr_pools.h" +#include "apr_network_io.h" #include "llchainio.h" class LLHost; diff --git a/indra/llmessage/llioutil.cpp b/indra/llmessage/llioutil.cpp index b00ec87324..2e6ee59ff2 100644 --- a/indra/llmessage/llioutil.cpp +++ b/indra/llmessage/llioutil.cpp @@ -4,30 +4,25 @@ * @date 2005-10-05 * @brief Utility functionality for the io pipes. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llioutil.h b/indra/llmessage/llioutil.h index e2f33a4afc..e8d245f530 100644 --- a/indra/llmessage/llioutil.h +++ b/indra/llmessage/llioutil.h @@ -4,30 +4,25 @@ * @date 2005-10-05 * @brief Helper classes for dealing with IOPipes * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llloginflags.h b/indra/llmessage/llloginflags.h index ab8228bdbf..45833fc914 100644 --- a/indra/llmessage/llloginflags.h +++ b/indra/llmessage/llloginflags.h @@ -2,30 +2,25 @@ * @file llloginflags.h * @brief Login flag constants. * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp index ac0ee66e41..08b31e9c7a 100644 --- a/indra/llmessage/llmail.cpp +++ b/indra/llmessage/llmail.cpp @@ -2,30 +2,25 @@ * @file llmail.cpp * @brief smtp helper functions. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -42,16 +37,16 @@ #include <string> #include <sstream> -#include <boost/regex.hpp> -#include "apr-1/apr_pools.h" -#include "apr-1/apr_network_io.h" +#include "apr_pools.h" +#include "apr_network_io.h" #include "llapr.h" #include "llbase32.h" // IM-to-email address #include "llblowfishcipher.h" #include "llerror.h" #include "llhost.h" +#include "llsd.h" #include "llstring.h" #include "lluuid.h" #include "net.h" @@ -66,8 +61,6 @@ static apr_pool_t* gMailPool; static apr_sockaddr_t* gSockAddr; static apr_socket_t* gMailSocket; -// According to RFC2822 -static const boost::regex valid_subject_chars("[\\x1-\\x9\\xb\\xc\\xe-\\x7f]*"); bool connect_smtp(); void disconnect_smtp(); @@ -114,16 +107,22 @@ void disconnect_smtp() // Returns TRUE on success. // message should NOT be SMTP escaped. // static -BOOL LLMail::send(const char* from_name, const char* from_address, - const char* to_name, const char* to_address, - const char* subject, const char* message) +BOOL LLMail::send( + const char* from_name, + const char* from_address, + const char* to_name, + const char* to_address, + const char* subject, + const char* message, + const LLSD& headers) { std::string header = buildSMTPTransaction( from_name, from_address, to_name, to_address, - subject); + subject, + headers); if(header.empty()) { return FALSE; @@ -173,13 +172,30 @@ void LLMail::enable(bool mail_enabled) gMailEnabled = mail_enabled; } +// Test a subject line for RFC2822 compliance. +static bool valid_subject_chars(const char *subject) +{ + for (; *subject != '\0'; subject++) + { + unsigned char c = *subject; + + if (c == '\xa' || c == '\xd' || c > '\x7f') + { + return false; + } + } + + return true; +} + // static std::string LLMail::buildSMTPTransaction( const char* from_name, const char* from_address, const char* to_name, const char* to_address, - const char* subject) + const char* subject, + const LLSD& headers) { if(!from_address || !to_address) { @@ -187,7 +203,7 @@ std::string LLMail::buildSMTPTransaction( << " from address." << llendl; return std::string(); } - if(! boost::regex_match(subject, valid_subject_chars)) + if(!valid_subject_chars(subject)) { llinfos << "send_mail build_smtp_transaction reject: bad subject header: " << "to=<" << to_address @@ -223,15 +239,27 @@ std::string LLMail::buildSMTPTransaction( << "DATA\r\n" << "From: " << from_fmt.str() << "\r\n" << "To: " << to_fmt.str() << "\r\n" - << "Subject: " << subject << "\r\n" - << "\r\n"; + << "Subject: " << subject << "\r\n"; + + if(headers.isMap()) + { + LLSD::map_const_iterator iter = headers.beginMap(); + LLSD::map_const_iterator end = headers.endMap(); + for(; iter != end; ++iter) + { + header << (*iter).first << ": " << ((*iter).second).asString() + << "\r\n"; + } + } + + header << "\r\n"; return header.str(); } // static bool LLMail::send( const std::string& header, - const std::string& message, + const std::string& raw_message, const char* from_address, const char* to_address) { @@ -242,8 +270,20 @@ bool LLMail::send( return false; } - // *FIX: this translation doesn't deal with a single period on a - // line by itself. + // remove any "." SMTP commands to prevent injection (DEV-35777) + // we don't need to worry about "\r\n.\r\n" because of the + // "\n" --> "\n\n" conversion going into rfc2822_msg below + std::string message = raw_message; + std::string bad_string = "\n.\n"; + std::string good_string = "\n..\n"; + while (1) + { + int index = message.find(bad_string); + if (index == std::string::npos) break; + message.replace(index, bad_string.size(), good_string); + } + + // convert all "\n" into "\r\n" std::ostringstream rfc2822_msg; for(U32 i = 0; i < message.size(); ++i) { @@ -311,7 +351,7 @@ bool LLMail::send( << "when sending messages larger than " << LL_MAX_KNOWN_GOOD_MAIL_SIZE << " bytes. The next log about success is potentially a lie." << llendl; } - llinfos << "send_mail success: " + lldebugs << "send_mail success: " << "to=<" << to_address << ">, from=<" << from_address << ">" << ", bytes=" << original_size @@ -352,7 +392,7 @@ std::string LLMail::encryptIMEmailAddress(const LLUUID& from_agent_id, std::string address = LLBase32::encode(encrypted, encrypted_size); // Make it more pretty for humans. - LLString::toLower(address); + LLStringUtil::toLower(address); delete [] encrypted; diff --git a/indra/llmessage/llmail.h b/indra/llmessage/llmail.h index 2a88592b89..3791714363 100644 --- a/indra/llmessage/llmail.h +++ b/indra/llmessage/llmail.h @@ -2,30 +2,25 @@ * @file llmail.h * @brief smtp helper functions. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -34,7 +29,7 @@ typedef struct apr_pool_t apr_pool_t; -class LLUUID; +#include "llsd.h" class LLMail { @@ -45,34 +40,51 @@ public: // Allow all email transmission to be disabled/enabled. static void enable(bool mail_enabled); - // returns TRUE if the call succeeds, FALSE otherwise. - // - // Results in: - // From: "from_name" <from_address> - // To: "to_name" <to_address> - // Subject: subject - // message - static BOOL send(const char* from_name, const char* from_address, - const char* to_name, const char* to_address, - const char* subject, const char* message); + /** + * @brief send an email + * @param from_name The name of the email sender + * @param from_address The email address for the sender + * @param to_name The name of the email recipient + * @param to_address The email recipient address + * @param subject The subject of the email + * @param headers optional X-Foo headers in an llsd map. + * @return Returns TRUE if the call succeeds, FALSE otherwise. + * + * Results in: + * From: "from_name" <from_address> + * To: "to_name" <to_address> + * Subject: subject + * + * message + */ + static BOOL send( + const char* from_name, + const char* from_address, + const char* to_name, + const char* to_address, + const char* subject, + const char* message, + const LLSD& headers = LLSD()); /** - * @brief build the complete smtp transaction & header for use in an - * mail. - * - * @param from_name The name of the email sender - * @param from_address The email address for the sender - * @param to_name The name of the email recipient - * @param to_name The email recipient address - * @param subject The subject of the email - * @return Returns the complete SMTP transaction mail header. - */ + * @brief build the complete smtp transaction & header for use in an + * mail. + * + * @param from_name The name of the email sender + * @param from_address The email address for the sender + * @param to_name The name of the email recipient + * @param to_address The email recipient address + * @param subject The subject of the email + * @param headers optional X-Foo headers in an llsd map. + * @return Returns the complete SMTP transaction mail header. + */ static std::string buildSMTPTransaction( const char* from_name, const char* from_address, const char* to_name, const char* to_address, - const char* subject); + const char* subject, + const LLSD& headers = LLSD()); /** * @brief send an email with header and body. diff --git a/indra/llmessage/llmessagebuilder.cpp b/indra/llmessage/llmessagebuilder.cpp index cd0b07ecfa..e2ed968a57 100644 --- a/indra/llmessage/llmessagebuilder.cpp +++ b/indra/llmessage/llmessagebuilder.cpp @@ -2,30 +2,25 @@ * @file llmessagebuilder.cpp * @brief LLMessageBuilder class implementation * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llmessagebuilder.h b/indra/llmessage/llmessagebuilder.h index c478c45b99..bf5be929f2 100644 --- a/indra/llmessage/llmessagebuilder.h +++ b/indra/llmessage/llmessagebuilder.h @@ -2,30 +2,25 @@ * @file llmessagebuilder.h * @brief Declaration of LLMessageBuilder class. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llmessageconfig.cpp b/indra/llmessage/llmessageconfig.cpp index 78e22dd06d..539efc65f8 100644 --- a/indra/llmessage/llmessageconfig.cpp +++ b/indra/llmessage/llmessageconfig.cpp @@ -2,30 +2,25 @@ * @file llmessageconfig.cpp * @brief Live file handling for messaging * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -52,20 +47,22 @@ static LLSD sMessages; class LLMessageConfigFile : public LLLiveFile { public: - LLMessageConfigFile() - : LLLiveFile(filename(), messageConfigRefreshRate) + LLMessageConfigFile() : + LLLiveFile(filename(), messageConfigRefreshRate), + mMaxQueuedEvents(0) { } - static std::string filename(); + static std::string filename(); - LLSD mMessages; + LLSD mMessages; std::string mServerDefault; static LLMessageConfigFile& instance(); // return the singleton configuration file - /* virtual */ void loadFile(); + /* virtual */ bool loadFile(); void loadServerDefaults(const LLSD& data); + void loadMaxQueuedEvents(const LLSD& data); void loadMessages(const LLSD& data); void loadCapBans(const LLSD& blacklist); void loadMessageBans(const LLSD& blacklist); @@ -73,6 +70,10 @@ public: public: LLSD mCapBans; + S32 mMaxQueuedEvents; + +private: + static const S32 DEFAULT_MAX_QUEUED_EVENTS = 100; }; std::string LLMessageConfigFile::filename() @@ -91,30 +92,32 @@ LLMessageConfigFile& LLMessageConfigFile::instance() } // virtual -void LLMessageConfigFile::loadFile() +bool LLMessageConfigFile::loadFile() { LLSD data; { - llifstream file(filename().c_str()); + llifstream file(filename()); if (file.is_open()) { - llinfos << "Loading message.xml file at " << filename() << llendl; + LL_DEBUGS("AppInit") << "Loading message.xml file at " << filename() << LL_ENDL; LLSDSerialize::fromXML(data, file); } if (data.isUndefined()) { - llinfos << "LLMessageConfigFile::loadFile: file missing," + LL_INFOS("AppInit") << "LLMessageConfigFile::loadFile: file missing," " ill-formed, or simply undefined; not changing the" - " file" << llendl; - return; + " file" << LL_ENDL; + return false; } } loadServerDefaults(data); + loadMaxQueuedEvents(data); loadMessages(data); loadCapBans(data); loadMessageBans(data); + return true; } void LLMessageConfigFile::loadServerDefaults(const LLSD& data) @@ -122,6 +125,18 @@ void LLMessageConfigFile::loadServerDefaults(const LLSD& data) mServerDefault = data["serverDefaults"][sServerName].asString(); } +void LLMessageConfigFile::loadMaxQueuedEvents(const LLSD& data) +{ + if (data.has("maxQueuedEvents")) + { + mMaxQueuedEvents = data["maxQueuedEvents"].asInteger(); + } + else + { + mMaxQueuedEvents = DEFAULT_MAX_QUEUED_EVENTS; + } +} + void LLMessageConfigFile::loadMessages(const LLSD& data) { mMessages = data["messages"]; @@ -141,15 +156,15 @@ void LLMessageConfigFile::loadCapBans(const LLSD& data) LLSD bans = data["capBans"]; if (!bans.isMap()) { - llinfos << "LLMessageConfigFile::loadCapBans: missing capBans section" - << llendl; + LL_INFOS("AppInit") << "LLMessageConfigFile::loadCapBans: missing capBans section" + << LL_ENDL; return; } mCapBans = bans; - llinfos << "LLMessageConfigFile::loadCapBans: " - << bans.size() << " ban tests" << llendl; + LL_DEBUGS("AppInit") << "LLMessageConfigFile::loadCapBans: " + << bans.size() << " ban tests" << LL_ENDL; } void LLMessageConfigFile::loadMessageBans(const LLSD& data) @@ -157,8 +172,8 @@ void LLMessageConfigFile::loadMessageBans(const LLSD& data) LLSD bans = data["messageBans"]; if (!bans.isMap()) { - llinfos << "LLMessageConfigFile::loadMessageBans: missing messageBans section" - << llendl; + LL_INFOS("AppInit") << "LLMessageConfigFile::loadMessageBans: missing messageBans section" + << LL_ENDL; return; } @@ -182,8 +197,8 @@ void LLMessageConfig::initClass(const std::string& server_name, sServerName = server_name; sConfigDir = config_dir; (void) LLMessageConfigFile::instance(); - llinfos << "LLMessageConfig::initClass config file " - << config_dir << "/" << messageConfigFileName << llendl; + LL_DEBUGS("AppInit") << "LLMessageConfig::initClass config file " + << config_dir << "/" << messageConfigFileName << LL_ENDL; } //static @@ -191,10 +206,10 @@ void LLMessageConfig::useConfig(const LLSD& config) { LLMessageConfigFile &the_file = LLMessageConfigFile::instance(); the_file.loadServerDefaults(config); + the_file.loadMaxQueuedEvents(config); the_file.loadMessages(config); the_file.loadCapBans(config); the_file.loadMessageBans(config); - } //static @@ -213,6 +228,13 @@ LLMessageConfig::Flavor LLMessageConfig::getServerDefaultFlavor() } //static +S32 LLMessageConfig::getMaxQueuedEvents() +{ + LLMessageConfigFile& file = LLMessageConfigFile::instance(); + return file.mMaxQueuedEvents; +} + +//static LLMessageConfig::Flavor LLMessageConfig::getMessageFlavor(const std::string& msg_name) { LLMessageConfigFile& file = LLMessageConfigFile::instance(); @@ -252,6 +274,14 @@ bool LLMessageConfig::isValidMessage(const std::string& msg_name) return file.mMessages.has(msg_name); } +//static +bool LLMessageConfig::onlySendLatest(const std::string& msg_name) +{ + LLMessageConfigFile& file = LLMessageConfigFile::instance(); + LLSD config = file.mMessages[msg_name]; + return config["only-send-latest"].asBoolean(); +} + 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 eb3113b121..1b39c386ca 100644 --- a/indra/llmessage/llmessageconfig.h +++ b/indra/llmessage/llmessageconfig.h @@ -2,30 +2,25 @@ * @file llmessageconfig.h * @brief Live file handling for messaging * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -48,11 +43,13 @@ public: static void useConfig(const LLSD& config); static Flavor getServerDefaultFlavor(); + static S32 getMaxQueuedEvents(); // For individual messages 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 onlySendLatest(const std::string& msg_name); static bool isCapBanned(const std::string& cap_name); static LLSD getConfigForMessage(const std::string& msg_name); }; diff --git a/indra/llmessage/llmessagereader.cpp b/indra/llmessage/llmessagereader.cpp index 7ec4f56d5c..1d1bee7f59 100644 --- a/indra/llmessage/llmessagereader.cpp +++ b/indra/llmessage/llmessagereader.cpp @@ -2,30 +2,25 @@ * @file llmessagereader.cpp * @brief LLMessageReader class implementation * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llmessagereader.h b/indra/llmessage/llmessagereader.h index 4687191494..3b77a6bfe4 100644 --- a/indra/llmessage/llmessagereader.h +++ b/indra/llmessage/llmessagereader.h @@ -2,30 +2,25 @@ * @file llmessagereader.h * @brief Declaration of LLMessageReader class. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -43,6 +38,12 @@ class LLVector3; class LLVector3d; class LLVector4; +// Error return values for getSize() functions +const S32 LL_BLOCK_NOT_IN_MESSAGE = -1; +const S32 LL_VARIABLE_NOT_IN_BLOCK = -2; +const S32 LL_MESSAGE_ERROR = -3; + + class LLMessageReader { public: @@ -69,6 +70,7 @@ class LLMessageReader virtual void getIPAddr(const char *block, const char *var, U32 &ip, S32 blocknum = 0) = 0; virtual void getIPPort(const char *block, const char *var, U16 &port, S32 blocknum = 0) = 0; virtual void getString(const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0) = 0; + virtual void getString(const char *block, const char *var, std::string& outstr, S32 blocknum = 0) = 0; virtual S32 getNumberOfBlocks(const char *blockname) = 0; virtual S32 getSize(const char *blockname, const char *varname) = 0; diff --git a/indra/llmessage/llmessagesenderinterface.h b/indra/llmessage/llmessagesenderinterface.h new file mode 100644 index 0000000000..ac0f9f7edb --- /dev/null +++ b/indra/llmessage/llmessagesenderinterface.h @@ -0,0 +1,44 @@ +/** + * @file llmessagesenderinterface.h + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLMESSAGESENDERINTERFACE_H +#define LL_LLMESSAGESENDERINTERFACE_H + +#include "linden_common.h" +#include "llstoredmessage.h" +class LLHost; +class LLSD; + +class LLMessageSenderInterface +{ +public: + virtual ~LLMessageSenderInterface() {} + virtual S32 sendMessage(const LLHost& host, LLStoredMessagePtr message) = 0; + +}; + +#endif // LL_LLMESSAGESENDERINTERFACE_H + diff --git a/indra/llmessage/llmessagetemplate.cpp b/indra/llmessage/llmessagetemplate.cpp index b6c5304f09..d64123ad62 100644 --- a/indra/llmessage/llmessagetemplate.cpp +++ b/indra/llmessage/llmessagetemplate.cpp @@ -2,30 +2,25 @@ * @file llmessagetemplate.cpp * @brief Implementation of message template classes. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -50,7 +45,7 @@ void LLMsgVarData::addData(const void *data, S32 size, EMsgVariableType type, S3 } if(size) { - delete mData; // Delete it if it already exists + delete[] mData; // Delete it if it already exists mData = new U8[size]; htonmemcpy(mData, data, mType, size); } @@ -175,3 +170,23 @@ std::ostream& operator<<(std::ostream& s, LLMessageTemplate &msg) return s; } + +void LLMessageTemplate::banUdp() +{ + static const char* deprecation[] = { + "NotDeprecated", + "Deprecated", + "UDPDeprecated", + "UDPBlackListed" + }; + if (mDeprecation != MD_DEPRECATED) + { + llinfos << "Setting " << mName << " to UDPBlackListed was " << deprecation[mDeprecation] << llendl; + mDeprecation = MD_UDPBLACKLISTED; + } + else + { + llinfos << mName << " is already more deprecated than UDPBlackListed" << llendl; + } +} + diff --git a/indra/llmessage/llmessagetemplate.h b/indra/llmessage/llmessagetemplate.h index 58214749ca..16d825d33b 100644 --- a/indra/llmessage/llmessagetemplate.h +++ b/indra/llmessage/llmessagetemplate.h @@ -2,30 +2,25 @@ * @file llmessagetemplate.h * @brief Declaration of the message template classes. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -34,6 +29,7 @@ #include "lldarray.h" #include "message.h" // TODO: babbage: Remove... +#include "llstat.h" #include "llstl.h" class LLMsgVarData @@ -80,7 +76,7 @@ protected: class LLMsgBlkData { public: - LLMsgBlkData(const char *name, S32 blocknum) : mOffset(-1), mBlockNumber(blocknum), mTotalSize(-1) + LLMsgBlkData(const char *name, S32 blocknum) : mBlockNumber(blocknum), mTotalSize(-1) { mName = (char *)name; } @@ -106,7 +102,6 @@ public: temp->addData(data, size, type, data_size); } - S32 mOffset; S32 mBlockNumber; typedef LLDynamicArrayIndexed<LLMsgVarData, const char *, 8> msg_var_data_map_t; msg_var_data_map_t mMemberVarData; @@ -134,7 +129,6 @@ public: void addDataFast(char *blockname, char *varname, const void *data, S32 size, EMsgVariableType type, S32 data_size = -1); public: - S32 mOffset; typedef std::map<char*, LLMsgBlkData*> msg_blk_data_map_t; msg_blk_data_map_t mMemberBlocks; char *mName; @@ -156,7 +150,7 @@ public: LLMessageVariable(const char *name, const EMsgVariableType type, const S32 size) : mType(type), mSize(size) { - mName = gMessageStringTable.getString(name); + mName = LLMessageStringTable::getInstance()->getString(name); } ~LLMessageVariable() {} @@ -187,7 +181,7 @@ class LLMessageBlock public: LLMessageBlock(const char *name, EMsgBlockType type, S32 number = 1) : mType(type), mNumber(number), mTotalSize(0) { - mName = gMessageStringTable.getString(name); + mName = LLMessageStringTable::getInstance()->getString(name); } ~LLMessageBlock() @@ -265,6 +259,7 @@ enum EMsgDeprecation { MD_NOTDEPRECATED, MD_UDPDEPRECATED, + MD_UDPBLACKLISTED, MD_DEPRECATED }; @@ -293,13 +288,13 @@ public: mHandlerFunc(NULL), mUserData(NULL) { - mName = gMessageStringTable.getString(name); + mName = LLMessageStringTable::getInstance()->getString(name); } ~LLMessageTemplate() { for_each(mMemberBlocks.begin(), mMemberBlocks.end(), DeletePointer()); -} + } void addBlock(LLMessageBlock *blockp) { @@ -369,12 +364,20 @@ public: { if (mHandlerFunc) { + LLPerfBlock msg_cb_time("msg_cb", mName); mHandlerFunc(msgsystem, mUserData); return TRUE; } return FALSE; } + bool isUdpBanned() const + { + return mDeprecation == MD_UDPBLACKLISTED; + } + + void banUdp(); + bool isBanned(bool trustedSource) const { return trustedSource ? mBanFromTrusted : mBanFromUntrusted; diff --git a/indra/llmessage/llmessagetemplateparser.cpp b/indra/llmessage/llmessagetemplateparser.cpp index e8843c7696..b0f19df47c 100644 --- a/indra/llmessage/llmessagetemplateparser.cpp +++ b/indra/llmessage/llmessagetemplateparser.cpp @@ -2,30 +2,25 @@ * @file llmessagetemplateparser.cpp * @brief LLMessageTemplateParser implementation * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -161,7 +156,7 @@ S32 get_checker_number(char checker) } // check token based on passed simplified regular expression -BOOL b_check_token(const char *token, char *regexp) +BOOL b_check_token(const char *token, const char *regexp) { S32 tptr, rptr = 0; S32 current_checker, next_checker = 0; @@ -402,6 +397,10 @@ LLTemplateParser::LLTemplateParser(LLTemplateTokenizer & tokens): { mMessages.push_back(templatep); } + else + { + delete templatep; + } } if(!tokens.wantEOF()) @@ -525,6 +524,10 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens) { templatep->setDeprecation(MD_UDPDEPRECATED); } + else if (tokens.want("UDPBlackListed")) + { + templatep->setDeprecation(MD_UDPBLACKLISTED); + } else if (tokens.want("NotDeprecated")) { // this is the default value, but it can't hurt to set it twice diff --git a/indra/llmessage/llmessagetemplateparser.h b/indra/llmessage/llmessagetemplateparser.h index 9a71184f06..372a2b292d 100644 --- a/indra/llmessage/llmessagetemplateparser.h +++ b/indra/llmessage/llmessagetemplateparser.h @@ -2,30 +2,25 @@ * @file llmessagetemplateparser.h * @brief Classes to parse message template. * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llmessagethrottle.cpp b/indra/llmessage/llmessagethrottle.cpp index 912980d738..579d6d7187 100644 --- a/indra/llmessage/llmessagethrottle.cpp +++ b/indra/llmessage/llmessagethrottle.cpp @@ -2,30 +2,25 @@ * @file llmessagethrottle.cpp * @brief LLMessageThrottle class used for throttling messages. * - * $LicenseInfo:firstyear=2004&license=viewergpl$ - * - * Copyright (c) 2004-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -110,7 +105,7 @@ void LLMessageThrottle::pruneEntries() } } -BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const char* mesg) +BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg) { message_list_t* message_list = &(mMessageList[MTC_VIEWER_ALERT]); @@ -119,7 +114,7 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const char* mesg) full_mesg << to << mesg; // Create an entry for this message. - size_t hash = llhash<const char*> (full_mesg.str().c_str()); + size_t hash = llhash(full_mesg.str().c_str()); LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime()); // Check if this message is already in the list. @@ -144,7 +139,7 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const char* mesg) } } -BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, const char* mesg) +BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, const std::string& mesg) { message_list_t* message_list = &(mMessageList[MTC_AGENT_ALERT]); @@ -153,7 +148,7 @@ BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, c full_mesg << agent << task << mesg; // Create an entry for this message. - size_t hash = llhash<const char*> (full_mesg.str().c_str()); + size_t hash = llhash(full_mesg.str().c_str()); LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime()); // Check if this message is already in the list. diff --git a/indra/llmessage/llmessagethrottle.h b/indra/llmessage/llmessagethrottle.h index a3267e7d9d..4ea84f712a 100644 --- a/indra/llmessage/llmessagethrottle.h +++ b/indra/llmessage/llmessagethrottle.h @@ -2,30 +2,25 @@ * @file llmessagethrottle.h * @brief LLMessageThrottle class used for throttling messages. * - * $LicenseInfo:firstyear=2004&license=viewergpl$ - * - * Copyright (c) 2004-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -64,8 +59,8 @@ public: LLMessageThrottle(); ~LLMessageThrottle(); - BOOL addViewerAlert (const LLUUID& to, const char* mesg); - BOOL addAgentAlert (const LLUUID& agent, const LLUUID& task, const char* mesg); + BOOL addViewerAlert (const LLUUID& to, const std::string& mesg); + BOOL addAgentAlert (const LLUUID& agent, const LLUUID& task, const std::string& mesg); void pruneEntries(); diff --git a/indra/llmessage/llmime.cpp b/indra/llmessage/llmime.cpp index 7d43f38e9a..943a734927 100644 --- a/indra/llmessage/llmime.cpp +++ b/indra/llmessage/llmime.cpp @@ -4,30 +4,25 @@ * @date 2006-12-20 * @brief Implementation of mime tools. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -439,9 +434,7 @@ bool LLMimeParser::Impl::parseHeaders( std::string value(colon); for(S32 ii = 0; ii < KNOWN_HEADER_COUNT; ++ii) { - if(0 == LLString::compareInsensitive( - name.c_str(), - KNOWN_HEADER[ii].c_str())) + if(0 == LLStringUtil::compareInsensitive(name, KNOWN_HEADER[ii])) { name = KNOWN_HEADER[ii]; break; @@ -525,7 +518,7 @@ void LLMimeParser::Impl::scanPastSeparator( { mContinue = false; } - if(0 == LLString::compareStrings(mBuffer, separator.c_str())) + if(0 == LLStringUtil::compareStrings(std::string(mBuffer), separator)) { found_separator = true; } diff --git a/indra/llmessage/llmime.h b/indra/llmessage/llmime.h index 0a7fa1d0d4..e6617fb503 100644 --- a/indra/llmessage/llmime.h +++ b/indra/llmessage/llmime.h @@ -4,30 +4,25 @@ * @date 2006-12-20 * @brief Declaration of mime tools. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llmsgvariabletype.h b/indra/llmessage/llmsgvariabletype.h index 5ce171ba2e..c4de822b46 100644 --- a/indra/llmessage/llmsgvariabletype.h +++ b/indra/llmessage/llmsgvariabletype.h @@ -2,30 +2,25 @@ * @file llmsgvariabletype.h * @brief Declaration of the EMsgVariableType enumeration. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llnamevalue.cpp b/indra/llmessage/llnamevalue.cpp index 932eeaa670..d799403029 100644 --- a/indra/llmessage/llnamevalue.cpp +++ b/indra/llmessage/llnamevalue.cpp @@ -2,30 +2,25 @@ * @file llnamevalue.cpp * @brief class for defining name value pairs. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -34,12 +29,11 @@ #include "linden_common.h" -#include <map> - #include "llnamevalue.h" + #include "u64.h" #include "llstring.h" -#include "llcamera.h" +#include "string_table.h" // Anonymous enumeration to provide constants in this file. // *NOTE: These values may be used in sscanf statements below as their @@ -51,17 +45,7 @@ enum U64_BUFFER_LEN = 64 }; -struct user_callback_t -{ - user_callback_t() {}; - user_callback_t(TNameValueCallback cb, void** data) : m_Callback(cb), m_Data(data) {} - TNameValueCallback m_Callback; - void ** m_Data; -}; -typedef std::map<char *, user_callback_t> user_callback_map_t; -user_callback_map_t gUserCallbackMap; - -LLStringTable gNVNameTable(16384); +LLStringTable gNVNameTable(256); char NameValueTypeStrings[NVT_EOF][NAME_VALUE_TYPE_STRING_LENGTH] = /*Flawfinder: Ignore*/ { @@ -80,8 +64,7 @@ char NameValueClassStrings[NVC_EOF][NAME_VALUE_CLASS_STRING_LENGTH] = /*Flawfind { "NULL", "R", // read only - "RW", // read write - "CB" // callback + "RW" // read write }; char NameValueSendtoStrings[NVS_EOF][NAME_VALUE_SENDTO_STRING_LENGTH] = /*Flawfinder: Ignore*/ @@ -94,13 +77,6 @@ char NameValueSendtoStrings[NVS_EOF][NAME_VALUE_SENDTO_STRING_LENGTH] = /*Flawfi }; /*Flawfinder: Ignore*/ -void add_use_callback(char *name, TNameValueCallback ucb, void **user_data) -{ - char *temp = gNVNameTable.addString(name); - gUserCallbackMap[temp] = user_callback_t(ucb,user_data); -} - - // // Class // @@ -125,12 +101,9 @@ void LLNameValue::baseInit() mSendto = NVS_NULL; mStringSendto = NameValueSendtoStrings[NVS_NULL]; - - mNameValueCB = NULL; - mUserData = NULL; } -void LLNameValue::init(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto, TNameValueCallback nvcb, void **user_data) +void LLNameValue::init(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto) { mNVNameTable = &gNVNameTable; @@ -176,7 +149,7 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con else if (!strcmp(mStringType, "U64")) { mType = NVT_U64; - mNameValueReference.u64 = new U64(str_to_U64(data)); + mNameValueReference.u64 = new U64(str_to_U64(ll_safe_string(data))); } else if (!strcmp(mStringType, "VEC3")) { @@ -254,40 +227,11 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con mClass = NVC_READ_WRITE; mStringClass = mNVNameTable->addString("RW"); } - else if (!strcmp(nvclass, "CB") || - !strcmp(nvclass, "CALLBACK")) // legacy - { - mClass = NVC_CALLBACK; - mStringClass = mNVNameTable->addString("CB"); - mNameValueCB = nvcb; - mUserData = user_data; - } else { // assume it's bad mClass = NVC_NULL; mStringClass = mNVNameTable->addString(nvclass); - mNameValueCB = NULL; - mUserData = NULL; - - // are we a user-defined call back? - for (user_callback_map_t::iterator iter = gUserCallbackMap.begin(); - iter != gUserCallbackMap.end(); iter++) - { - char* tname = iter->first; - if (tname == mStringClass) - { - mClass = NVC_CALLBACK; - mNameValueCB = (iter->second).m_Callback; - mUserData = (iter->second).m_Data; - } - } - - // Warn if we didn't find a callback - if (mClass == NVC_NULL) - { - llwarns << "Unknown user callback in name value init() for " << mName << llendl; - } } // Initialize the sendto variable @@ -326,24 +270,24 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con } -LLNameValue::LLNameValue(const char *name, const char *data, const char *type, const char *nvclass, TNameValueCallback nvcb, void **user_data) +LLNameValue::LLNameValue(const char *name, const char *data, const char *type, const char *nvclass) { baseInit(); // if not specified, send to simulator only - init(name, data, type, nvclass, "SIM", nvcb, user_data); + init(name, data, type, nvclass, "SIM"); } -LLNameValue::LLNameValue(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto, TNameValueCallback nvcb, void **user_data) +LLNameValue::LLNameValue(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto) { baseInit(); - init(name, data, type, nvclass, nvsendto, nvcb, user_data); + init(name, data, type, nvclass, nvsendto); } // Initialize without any initial data. -LLNameValue::LLNameValue(const char *name, const char *type, const char *nvclass, TNameValueCallback nvcb, void **user_data) +LLNameValue::LLNameValue(const char *name, const char *type, const char *nvclass) { baseInit(); mName = mNVNameTable->addString(name); @@ -401,11 +345,9 @@ LLNameValue::LLNameValue(const char *name, const char *type, const char *nvclass { mClass = NVC_READ_WRITE; } - else if (!strcmp(mStringClass, "CALLBACK")) + else { - mClass = NVC_READ_WRITE; - mNameValueCB = nvcb; - mUserData = user_data; + mClass = NVC_NULL; } // Initialize the sendto variable @@ -734,46 +676,6 @@ LLVector3 *LLNameValue::getVec3() } -F32 LLNameValue::magnitude() -{ - switch(mType) - { - case NVT_STRING: - return (F32)(strlen(mNameValueReference.string)); /* Flawfinder: ignore */ - break; - case NVT_F32: - return (fabsf(*mNameValueReference.f32)); - break; - case NVT_S32: - return (fabsf((F32)(*mNameValueReference.s32))); - break; - case NVT_VEC3: - return (mNameValueReference.vec3->magVec()); - break; - case NVT_U32: - return (F32)(*mNameValueReference.u32); - break; - default: - llerrs << "No magnitude operation for NV type " << mStringType << llendl; - break; - } - return 0.f; -} - - -void LLNameValue::callCallback() -{ - if (mNameValueCB) - { - (*mNameValueCB)(this, mUserData); - } - else - { - llinfos << mName << " has no callback!" << llendl; - } -} - - BOOL LLNameValue::sendToData() const { return (mSendto == NVS_DATA_SIM || mSendto == NVS_DATA_SIM_VIEWER); @@ -795,13 +697,6 @@ LLNameValue &LLNameValue::operator=(const LLNameValue &a) if (mClass == NVC_READ_ONLY) return *this; - BOOL b_changed = FALSE; - if ( (mClass == NVC_CALLBACK) - &&(*this != a)) - { - b_changed = TRUE; - } - switch(a.mType) { case NVT_STRING: @@ -835,11 +730,6 @@ LLNameValue &LLNameValue::operator=(const LLNameValue &a) break; } - if (b_changed) - { - callCallback(); - } - return *this; } @@ -847,19 +737,12 @@ void LLNameValue::setString(const char *a) { if (mClass == NVC_READ_ONLY) return; - BOOL b_changed = FALSE; switch(mType) { case NVT_STRING: if (a) { - if ( (mClass == NVC_CALLBACK) - &&(strcmp(this->mNameValueReference.string,a))) - { - b_changed = TRUE; - } - if (mNameValueReference.string) { delete [] mNameValueReference.string; @@ -870,11 +753,6 @@ void LLNameValue::setString(const char *a) { strcpy(mNameValueReference.string, a); /* Flawfinder: ignore */ } - - if (b_changed) - { - callCallback(); - } } else { @@ -889,11 +767,6 @@ void LLNameValue::setString(const char *a) break; } - if (b_changed) - { - callCallback(); - } - return; } @@ -902,19 +775,12 @@ void LLNameValue::setAsset(const char *a) { if (mClass == NVC_READ_ONLY) return; - BOOL b_changed = FALSE; switch(mType) { case NVT_ASSET: if (a) { - if ( (mClass == NVC_CALLBACK) - &&(strcmp(this->mNameValueReference.string,a))) - { - b_changed = TRUE; - } - if (mNameValueReference.string) { delete [] mNameValueReference.string; @@ -924,11 +790,6 @@ void LLNameValue::setAsset(const char *a) { strcpy(mNameValueReference.string, a); /* Flawfinder: ignore */ } - - if (b_changed) - { - callCallback(); - } } else { @@ -942,10 +803,6 @@ void LLNameValue::setAsset(const char *a) default: break; } - if (b_changed) - { - callCallback(); - } } @@ -953,29 +810,15 @@ void LLNameValue::setF32(const F32 a) { if (mClass == NVC_READ_ONLY) return; - BOOL b_changed = FALSE; switch(mType) { case NVT_F32: - if ( (mClass == NVC_CALLBACK) - &&(*this->mNameValueReference.f32 != a)) - { - b_changed = TRUE; - } *mNameValueReference.f32 = a; - if (b_changed) - { - callCallback(); - } break; default: break; } - if (b_changed) - { - callCallback(); - } return; } @@ -985,53 +828,21 @@ void LLNameValue::setS32(const S32 a) { if (mClass == NVC_READ_ONLY) return; - BOOL b_changed = FALSE; switch(mType) { case NVT_S32: - if ( (mClass == NVC_CALLBACK) - &&(*this->mNameValueReference.s32 != a)) - { - b_changed = TRUE; - } *mNameValueReference.s32 = a; - if (b_changed) - { - callCallback(); - } break; case NVT_U32: - if ( (mClass == NVC_CALLBACK) - && ((S32) (*this->mNameValueReference.u32) != a)) - { - b_changed = TRUE; - } *mNameValueReference.u32 = a; - if (b_changed) - { - callCallback(); - } break; case NVT_F32: - if ( (mClass == NVC_CALLBACK) - &&(*this->mNameValueReference.f32 != a)) - { - b_changed = TRUE; - } *mNameValueReference.f32 = (F32)a; - if (b_changed) - { - callCallback(); - } break; default: break; } - if (b_changed) - { - callCallback(); - } return; } @@ -1041,45 +852,17 @@ void LLNameValue::setU32(const U32 a) { if (mClass == NVC_READ_ONLY) return; - BOOL b_changed = FALSE; switch(mType) { case NVT_S32: - if ( (mClass == NVC_CALLBACK) - &&(*this->mNameValueReference.s32 != (S32) a)) - { - b_changed = TRUE; - } *mNameValueReference.s32 = a; - if (b_changed) - { - callCallback(); - } break; case NVT_U32: - if ( (mClass == NVC_CALLBACK) - &&(*this->mNameValueReference.u32 != a)) - { - b_changed = TRUE; - } *mNameValueReference.u32 = a; - if (b_changed) - { - callCallback(); - } break; case NVT_F32: - if ( (mClass == NVC_CALLBACK) - &&(*this->mNameValueReference.f32 != a)) - { - b_changed = TRUE; - } *mNameValueReference.f32 = (F32)a; - if (b_changed) - { - callCallback(); - } break; default: llerrs << "NameValue: Trying to set U32 into a " << mStringType << ", unknown conversion" << llendl; @@ -1093,21 +876,11 @@ void LLNameValue::setVec3(const LLVector3 &a) { if (mClass == NVC_READ_ONLY) return; - BOOL b_changed = FALSE; switch(mType) { case NVT_VEC3: - if ( (mClass == NVC_CALLBACK) - &&(*this->mNameValueReference.vec3 != a)) - { - b_changed = TRUE; - } *mNameValueReference.vec3 = a; - if (b_changed) - { - callCallback(); - } break; default: llerrs << "NameValue: Trying to set LLVector3 into a " << mStringType << ", unknown conversion" << llendl; @@ -1117,30 +890,7 @@ void LLNameValue::setVec3(const LLVector3 &a) } -BOOL LLNameValue::nonzero() -{ - switch(mType) - { - case NVT_STRING: - if (!mNameValueReference.string) - return 0; - return (mNameValueReference.string[0] != 0); - case NVT_F32: - return (*mNameValueReference.f32 != 0.f); - case NVT_S32: - return (*mNameValueReference.s32 != 0); - case NVT_U32: - return (*mNameValueReference.u32 != 0); - case NVT_VEC3: - return (mNameValueReference.vec3->magVecSquared() != 0.f); - default: - llerrs << "NameValue: Trying to call nonzero on a " << mStringType << ", unknown conversion" << llendl; - break; - } - return FALSE; -} - -std::string LLNameValue::printNameValue() +std::string LLNameValue::printNameValue() const { std::string buffer; buffer = llformat("%s %s %s %s ", mName, mStringType, mStringClass, mStringSendto); @@ -1149,7 +899,7 @@ std::string LLNameValue::printNameValue() return buffer; } -std::string LLNameValue::printData() +std::string LLNameValue::printData() const { std::string buffer; switch(mType) @@ -1207,6 +957,7 @@ std::ostream& operator<<(std::ostream& s, const LLNameValue &a) U64_to_str(*a.mNameValueReference.u64, u64_string, sizeof(u64_string)); s << u64_string; } + break; case NVT_VEC3: s << *(a.mNameValueReference.vec3); break; @@ -1217,951 +968,3 @@ std::ostream& operator<<(std::ostream& s, const LLNameValue &a) return s; } - -// nota bene: return values aren't static for now to prevent memory leaks - -LLNameValue &operator+(const LLNameValue &a, const LLNameValue &b) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - if (b.mType == NVT_STRING) - { - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - - S32 length1 = (S32)strlen(a.mNameValueReference.string); /* Flawfinder: Ignore */ - S32 length2 = (S32)strlen(b.mNameValueReference.string); /* Flawfinder: Ignore */ - delete [] retval.mNameValueReference.string; - retval.mNameValueReference.string = new char[length1 + length2 + 1]; - if(retval.mNameValueReference.string != NULL) - { - strcpy(retval.mNameValueReference.string, a.mNameValueReference.string); /* Flawfinder: Ignore */ - strcat(retval.mNameValueReference.string, b.mNameValueReference.string); /* Flawfinder: Ignore */ - } - } - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 + *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 + *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 + *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 + *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 + *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 + *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 + *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 + *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_U32; - retval.mStringType = NameValueTypeStrings[NVT_U32]; - delete retval.mNameValueReference.u32; - retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 + *b.mNameValueReference.u32); - } - break; - case NVT_VEC3: - if ( (a.mType == b.mType) - &&(a.mType == NVT_VEC3)) - { - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.vec3; - retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 + *b.mNameValueReference.vec3); - } - break; - default: - llerrs << "Unknown add of NV type " << a.mStringType << " to " << b.mStringType << llendl; - break; - } - return retval; -} - -LLNameValue &operator-(const LLNameValue &a, const LLNameValue &b) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 - *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 - *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 - *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 - *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 - *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 - *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 - *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 - *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_U32; - retval.mStringType = NameValueTypeStrings[NVT_U32]; - delete retval.mNameValueReference.u32; - retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 - *b.mNameValueReference.u32); - } - break; - case NVT_VEC3: - if ( (a.mType == b.mType) - &&(a.mType == NVT_VEC3)) - { - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.vec3; - retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 - *b.mNameValueReference.vec3); - } - break; - default: - llerrs << "Unknown subtract of NV type " << a.mStringType << " to " << b.mStringType << llendl; - break; - } - return retval; -} - -LLNameValue &operator*(const LLNameValue &a, const LLNameValue &b) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 * *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 * *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 * *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 * *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 * *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_U32; - retval.mStringType = NameValueTypeStrings[NVT_U32]; - delete retval.mNameValueReference.u32; - retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 * *b.mNameValueReference.u32); - } - break; - case NVT_VEC3: - if ( (a.mType == b.mType) - &&(a.mType == NVT_VEC3)) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32((*a.mNameValueReference.vec3) * (*b.mNameValueReference.vec3)); - } - break; - default: - llerrs << "Unknown multiply of NV type " << a.mStringType << " to " << b.mStringType << llendl; - break; - } - return retval; -} - -LLNameValue &operator/(const LLNameValue &a, const LLNameValue &b) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 / *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 / *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 / *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 / *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 / *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 / *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 / *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 / *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_U32; - retval.mStringType = NameValueTypeStrings[NVT_U32]; - delete retval.mNameValueReference.u32; - retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 / *b.mNameValueReference.u32); - } - break; - default: - llerrs << "Unknown divide of NV type " << a.mStringType << " to " << b.mStringType << llendl; - break; - } - return retval; -} - -LLNameValue &operator%(const LLNameValue &a, const LLNameValue &b) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - break; - case NVT_F32: - break; - case NVT_S32: - if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 % *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 % *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 % *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_U32; - retval.mStringType = NameValueTypeStrings[NVT_U32]; - delete retval.mNameValueReference.u32; - retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 % *b.mNameValueReference.u32); - } - break; - case NVT_VEC3: - if ( (a.mType == b.mType) - &&(a.mType == NVT_VEC3)) - { - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.vec3; - retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 % *b.mNameValueReference.vec3); - } - break; - default: - llerrs << "Unknown % of NV type " << a.mStringType << " to " << b.mStringType << llendl; - break; - } - return retval; -} - - -// Multiplying anything times a float gives you some floats -LLNameValue &operator*(const LLNameValue &a, F32 k) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - break; - case NVT_F32: - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * k); - break; - case NVT_S32: - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 * k); - break; - case NVT_U32: - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 * k); - break; - case NVT_VEC3: - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.vec3; - retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 * k); - break; - default: - llerrs << "Unknown multiply of NV type " << a.mStringType << " with F32" << llendl; - break; - } - return retval; -} - - -LLNameValue &operator*(F32 k, const LLNameValue &a) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - break; - case NVT_F32: - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * k); - break; - case NVT_S32: - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 * k); - break; - case NVT_U32: - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 * k); - break; - case NVT_VEC3: - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.vec3; - retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 * k); - break; - default: - llerrs << "Unknown multiply of NV type " << a.mStringType << " with F32" << llendl; - break; - } - return retval; -} - - -bool operator==(const LLNameValue &a, const LLNameValue &b) -{ - switch(a.mType) - { - case NVT_STRING: - if (b.mType == NVT_STRING) - { - if (!a.mNameValueReference.string) - return FALSE; - if (!b.mNameValueReference.string) - return FALSE; - return (!strcmp(a.mNameValueReference.string, b.mNameValueReference.string)); - } - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.f32 == *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.f32 == *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.f32 == *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.s32 == *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.s32 == *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.s32 == (S32) *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.u32 == *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return ((S32) *a.mNameValueReference.u32 == *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.u32 == *b.mNameValueReference.u32); - } - break; - case NVT_VEC3: - if ( (a.mType == b.mType) - &&(a.mType == NVT_VEC3)) - { - return (*a.mNameValueReference.vec3 == *b.mNameValueReference.vec3); - } - break; - default: - llerrs << "Unknown == NV type " << a.mStringType << " with " << b.mStringType << llendl; - break; - } - return FALSE; -} - -bool operator<=(const LLNameValue &a, const LLNameValue &b) -{ - switch(a.mType) - { - case NVT_STRING: - if (b.mType == NVT_STRING) - { - S32 retval = strcmp(a.mNameValueReference.string, b.mNameValueReference.string); - return (retval <= 0); - } - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.f32 <= *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.f32 <= *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.f32 <= *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.s32 <= *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.s32 <= *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.s32 <= (S32) *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.u32 <= *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return ((S32) *a.mNameValueReference.u32 <= *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.u32 <= *b.mNameValueReference.u32); - } - break; - default: - llerrs << "Unknown <= NV type " << a.mStringType << " with " << b.mStringType << llendl; - break; - } - return FALSE; -} - - -bool operator>=(const LLNameValue &a, const LLNameValue &b) -{ - switch(a.mType) - { - case NVT_STRING: - if ( (a.mType == b.mType) - &&(a.mType == NVT_STRING)) - { - S32 retval = strcmp(a.mNameValueReference.string, b.mNameValueReference.string); - return (retval >= 0); - } - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.f32 >= *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.f32 >= *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.f32 >= *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.s32 >= *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.s32 >= *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.s32 >= (S32) *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.u32 >= *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return ((S32) *a.mNameValueReference.u32 >= *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.u32 >= *b.mNameValueReference.u32); - } - break; - default: - llerrs << "Unknown >= NV type " << a.mStringType << " with " << b.mStringType << llendl; - break; - } - return FALSE; -} - - -bool operator<(const LLNameValue &a, const LLNameValue &b) -{ - switch(a.mType) - { - case NVT_STRING: - if ( (a.mType == b.mType) - &&(a.mType == NVT_STRING)) - { - S32 retval = strcmp(a.mNameValueReference.string, b.mNameValueReference.string); - return (retval < 0); - } - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.f32 < *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.f32 < *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.f32 < *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.s32 < *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.s32 < *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.s32 < (S32) *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.u32 < *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return ((S32) *a.mNameValueReference.u32 < *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.u32 < *b.mNameValueReference.u32); - } - break; - default: - llerrs << "Unknown < NV type " << a.mStringType << " with " << b.mStringType << llendl; - break; - } - return FALSE; -} - - -bool operator>(const LLNameValue &a, const LLNameValue &b) -{ - switch(a.mType) - { - case NVT_STRING: - if ( (a.mType == b.mType) - &&(a.mType == NVT_STRING)) - { - S32 retval = strcmp(a.mNameValueReference.string, b.mNameValueReference.string); - return (retval > 0); - } - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.f32 > *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.f32 > *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.f32 > *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.s32 > *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.s32 > *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.s32 > (S32) *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.u32 > *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return ((S32) *a.mNameValueReference.u32 > *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.u32 > *b.mNameValueReference.u32); - } - break; - default: - llerrs << "Unknown > NV type " << a.mStringType << " with " << b.mStringType << llendl; - break; - } - return FALSE; -} - -bool operator!=(const LLNameValue &a, const LLNameValue &b) -{ - switch(a.mType) - { - case NVT_STRING: - if ( (a.mType == b.mType) - &&(a.mType == NVT_STRING)) - { - return (strcmp(a.mNameValueReference.string, b.mNameValueReference.string)) ? true : false; - } - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.f32 != *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.f32 != *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.f32 != *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.s32 != *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.s32 != *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.s32 != (S32) *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.u32 != *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return ((S32) *a.mNameValueReference.u32 != *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.u32 != *b.mNameValueReference.u32); - } - break; - case NVT_VEC3: - if ( (a.mType == b.mType) - &&(a.mType == NVT_VEC3)) - { - return (*a.mNameValueReference.vec3 != *b.mNameValueReference.vec3); - } - break; - default: - llerrs << "Unknown != NV type " << a.mStringType << " with " << b.mStringType << llendl; - break; - } - return FALSE; -} - - -LLNameValue &operator-(const LLNameValue &a) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - break; - case NVT_F32: - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(-*a.mNameValueReference.f32); - break; - case NVT_S32: - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(-*a.mNameValueReference.s32); - break; - case NVT_U32: - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - // Can't do unary minus on U32, doesn't work. - retval.mNameValueReference.s32 = new S32(-S32(*a.mNameValueReference.u32)); - break; - case NVT_VEC3: - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.vec3; - retval.mNameValueReference.vec3 = new LLVector3(-*a.mNameValueReference.vec3); - break; - default: - llerrs << "Unknown - NV type " << a.mStringType << llendl; - break; - } - return retval; -} diff --git a/indra/llmessage/llnamevalue.h b/indra/llmessage/llnamevalue.h index 7a4c80f3f3..273de475f8 100644 --- a/indra/llmessage/llnamevalue.h +++ b/indra/llmessage/llnamevalue.h @@ -2,45 +2,52 @@ * @file llnamevalue.h * @brief class for defining name value pairs. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #ifndef LL_LLNAMEVALUE_H #define LL_LLNAMEVALUE_H +// As of January 2008, I believe we only use the following name-value +// pairs. This is hard to prove because they are initialized from +// strings. JC +// +// FirstName STRING +// LastName STRING +// AttachPt U32 +// AttachmentItemId STRING +// Title STRING +// AttachmentOffset VEC3 +// AttachmentOrientation VEC3 +// SitObject STRING +// SitPosition VEC3 + #include "string_table.h" #include "llmath.h" #include "v3math.h" #include "lldbstrings.h" class LLNameValue; -typedef void (*TNameValueCallback)(LLNameValue *changed, void **user_data); - -void add_use_callback(char *name, TNameValueCallback ucb, void **user_data); +class LLStringTable; typedef enum e_name_value_types { @@ -61,7 +68,6 @@ typedef enum e_name_value_class NVC_NULL, NVC_READ_ONLY, NVC_READ_WRITE, - NVC_CALLBACK, NVC_EOF } ENameValueClass; @@ -110,17 +116,13 @@ class LLNameValue { public: void baseInit(); - void init(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto, - TNameValueCallback nvcb = NULL, void **user_data = NULL); + void init(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto ); LLNameValue(); LLNameValue(const char *data); - LLNameValue(const char *name, const char *type, const char *nvclass, - TNameValueCallback nvcb = NULL, void **user_data = NULL); - LLNameValue(const char *name, const char *data, const char *type, const char *nvclass, - TNameValueCallback nvcb = NULL, void **user_data = NULL); - LLNameValue(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto, - TNameValueCallback nvcb = NULL, void **user_data = NULL); + LLNameValue(const char *name, const char *type, const char *nvclass ); + LLNameValue(const char *name, const char *data, const char *type, const char *nvclass ); + LLNameValue(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto ); ~LLNameValue(); @@ -130,7 +132,6 @@ public: S32 *getS32(); void getVec3(LLVector3 &vec); LLVector3 *getVec3(); - F32 magnitude(); U32 *getU32(); U64 *getU64(); @@ -142,8 +143,8 @@ public: BOOL sendToViewer() const; void callCallback(); - std::string printNameValue(); - std::string printData(); + std::string printNameValue() const; + std::string printData() const; ENameValueType getTypeEnum() const { return mType; } ENameValueClass getClassEnum() const { return mClass; } @@ -157,27 +158,8 @@ public: void setVec3(const LLVector3 &a); void setU32(const U32 a); - BOOL nonzero(); - friend std::ostream& operator<<(std::ostream& s, const LLNameValue &a); - friend LLNameValue &operator+(const LLNameValue &a, const LLNameValue &b); - friend LLNameValue &operator-(const LLNameValue &a, const LLNameValue &b); - friend LLNameValue &operator*(const LLNameValue &a, const LLNameValue &b); - friend LLNameValue &operator/(const LLNameValue &a, const LLNameValue &b); - friend LLNameValue &operator%(const LLNameValue &a, const LLNameValue &b); - friend LLNameValue &operator*(const LLNameValue &a, F32 k); - friend LLNameValue &operator*(F32 k, const LLNameValue &a); - - friend bool operator==(const LLNameValue &a, const LLNameValue &b); - friend bool operator<=(const LLNameValue &a, const LLNameValue &b); - friend bool operator>=(const LLNameValue &a, const LLNameValue &b); - friend bool operator<(const LLNameValue &a, const LLNameValue &b); - friend bool operator>(const LLNameValue &a, const LLNameValue &b); - friend bool operator!=(const LLNameValue &a, const LLNameValue &b); - - friend LLNameValue &operator-(const LLNameValue &a); - private: void printNameValue(std::ostream& s); @@ -193,8 +175,6 @@ public: UNameValueReference mNameValueReference; LLStringTable *mNVNameTable; - TNameValueCallback mNameValueCB; - void **mUserData; }; extern LLStringTable gNVNameTable; diff --git a/indra/llmessage/llnullcipher.cpp b/indra/llmessage/llnullcipher.cpp index 613e7649ff..b32e7e6fa6 100644 --- a/indra/llmessage/llnullcipher.cpp +++ b/indra/llmessage/llnullcipher.cpp @@ -2,30 +2,25 @@ * @file llnullcipher.cpp * @brief Implementation of a cipher which does not encrypt. * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llnullcipher.h b/indra/llmessage/llnullcipher.h index a6dec02a45..a9f9a1ce03 100644 --- a/indra/llmessage/llnullcipher.h +++ b/indra/llmessage/llnullcipher.h @@ -1,30 +1,25 @@ /** * @file llnullcipher.h * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llpacketack.cpp b/indra/llmessage/llpacketack.cpp index dbc7865800..f08d3404ea 100644 --- a/indra/llmessage/llpacketack.cpp +++ b/indra/llmessage/llpacketack.cpp @@ -4,30 +4,25 @@ * @date 2007-05-09 * @brief Implementation of the LLReliablePacket. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llpacketack.h b/indra/llmessage/llpacketack.h index a5b425c8da..2ef3c48e44 100644 --- a/indra/llmessage/llpacketack.h +++ b/indra/llmessage/llpacketack.h @@ -2,30 +2,25 @@ * @file llpacketack.h * @brief Reliable UDP helpers for the message system. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llpacketbuffer.cpp b/indra/llmessage/llpacketbuffer.cpp index cb71fcd773..e69631eb3b 100644 --- a/indra/llmessage/llpacketbuffer.cpp +++ b/indra/llmessage/llpacketbuffer.cpp @@ -2,30 +2,25 @@ * @file llpacketbuffer.cpp * @brief implementation of LLPacketBuffer class for a packet. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -41,11 +36,14 @@ LLPacketBuffer::LLPacketBuffer(const LLHost &host, const char *datap, const S32 size) : mHost(host) { + mSize = 0; + mData[0] = '!'; + if (size > NET_BUFFER_SIZE) { llerrs << "Sending packet > " << NET_BUFFER_SIZE << " of size " << size << llendl; } - else // we previously relied on llerrs being fatal to not get here... + else { if (datap != NULL) { @@ -65,7 +63,6 @@ LLPacketBuffer::LLPacketBuffer (S32 hSocket) LLPacketBuffer::~LLPacketBuffer () { - free(); } /////////////////////////////////////////////////////////// @@ -74,27 +71,6 @@ void LLPacketBuffer::init (S32 hSocket) { mSize = receive_packet(hSocket, mData); mHost = ::get_sender(); + mReceivingIF = ::get_receiving_interface(); } - -/////////////////////////////////////////////////////////// - -void LLPacketBuffer::free () -{ -} - - - - - - - - - - - - - - - - diff --git a/indra/llmessage/llpacketbuffer.h b/indra/llmessage/llpacketbuffer.h index 1e57517f29..14b6f9d5d2 100644 --- a/indra/llmessage/llpacketbuffer.h +++ b/indra/llmessage/llpacketbuffer.h @@ -3,30 +3,25 @@ * @brief definition of LLPacketBuffer class for implementing a * resend, drop, or delay in packet transmissions. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -43,16 +38,17 @@ public: LLPacketBuffer(S32 hSocket); // receive a packet ~LLPacketBuffer(); - S32 getSize() const { return mSize; } - const char *getData() const { return mData; } - LLHost getHost() const { return mHost; } + S32 getSize() const { return mSize; } + const char *getData() const { return mData; } + LLHost getHost() const { return mHost; } + LLHost getReceivingInterface() const { return mReceivingIF; } void init(S32 hSocket); - void free(); protected: char mData[NET_BUFFER_SIZE]; // packet data /* Flawfinder : ignore */ S32 mSize; // size of buffer in bytes LLHost mHost; // source/dest IP and port + LLHost mReceivingIF; // source/dest IP and port }; #endif diff --git a/indra/llmessage/llpacketring.cpp b/indra/llmessage/llpacketring.cpp index 48a02fede5..8999dec64a 100644 --- a/indra/llmessage/llpacketring.cpp +++ b/indra/llmessage/llpacketring.cpp @@ -2,30 +2,25 @@ * @file llpacketring.cpp * @brief implementation of LLPacketRing class for a packet. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -59,11 +54,11 @@ LLPacketRing::LLPacketRing () : /////////////////////////////////////////////////////////// LLPacketRing::~LLPacketRing () { - free(); + cleanup(); } /////////////////////////////////////////////////////////// -void LLPacketRing::free () +void LLPacketRing::cleanup () { LLPacketBuffer *packetp; @@ -140,6 +135,7 @@ S32 LLPacketRing::receiveFromRing (S32 socket, char *datap) } // need to set sender IP/port!! mLastSender = packetp->getHost(); + mLastReceivingIF = packetp->getReceivingInterface(); delete packetp; this->mInBufferLength -= packet_size; @@ -222,6 +218,7 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap) // no delay, pull straight from net packet_size = receive_packet(socket, datap); mLastSender = ::get_sender(); + mLastReceivingIF = ::get_receiving_interface(); if (packet_size) // did we actually get a packet? { diff --git a/indra/llmessage/llpacketring.h b/indra/llmessage/llpacketring.h index 0e1450ac1b..e6409d2048 100644 --- a/indra/llmessage/llpacketring.h +++ b/indra/llmessage/llpacketring.h @@ -3,30 +3,25 @@ * @brief definition of LLPacketRing class for implementing a resend, * drop, or delay in packet transmissions * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -47,7 +42,7 @@ public: LLPacketRing(); ~LLPacketRing(); - void free(); + void cleanup(); void dropPackets(U32); void setDropPercentage (F32 percent_to_drop); @@ -61,6 +56,7 @@ public: BOOL sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host); inline LLHost getLastSender(); + inline LLHost getLastReceivingInterface(); S32 getAndResetActualInBits() { S32 bits = mActualBitsIn; mActualBitsIn = 0; return bits;} S32 getAndResetActualOutBits() { S32 bits = mActualBitsOut; mActualBitsOut = 0; return bits;} @@ -85,6 +81,7 @@ protected: std::queue<LLPacketBuffer *> mSendQueue; LLHost mLastSender; + LLHost mLastReceivingIF; }; @@ -93,4 +90,9 @@ inline LLHost LLPacketRing::getLastSender() return mLastSender; } +inline LLHost LLPacketRing::getLastReceivingInterface() +{ + return mLastReceivingIF; +} + #endif diff --git a/indra/llmessage/llpartdata.cpp b/indra/llmessage/llpartdata.cpp index 0e1dc4a7bd..26cafa025f 100644 --- a/indra/llmessage/llpartdata.cpp +++ b/indra/llmessage/llpartdata.cpp @@ -2,30 +2,25 @@ * @file llpartdata.cpp * @brief Particle system data packing * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -38,6 +33,8 @@ #include "v4coloru.h" #include "llsdutil.h" +#include "llsdutil_math.h" + const S32 PS_PART_DATA_BLOCK_SIZE = 4 + 2 + 4 + 4 + 2 + 2; // 18 @@ -155,6 +152,8 @@ void LLPartData::setEndAlpha(const F32 alpha) LLPartSysData::LLPartSysData() { mCRC = 0; + mFlags = 0; + mPartData.mFlags = 0; mPartData.mStartColor = LLColor4(1.f, 1.f, 1.f, 1.f); mPartData.mEndColor = LLColor4(1.f, 1.f, 1.f, 1.f); @@ -172,6 +171,8 @@ LLPartSysData::LLPartSysData() mBurstSpeedMin = 1.f; // Minimum particle velocity mBurstSpeedMax = 1.f; // Maximum particle velocity mBurstRadius = 0.f; + + mNumParticles = 0; } diff --git a/indra/llmessage/llpartdata.h b/indra/llmessage/llpartdata.h index 4220f5d791..a4ef058b30 100644 --- a/indra/llmessage/llpartdata.h +++ b/indra/llmessage/llpartdata.h @@ -2,30 +2,25 @@ * @file llpartdata.h * @brief Particle system data packing * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -84,7 +79,8 @@ class LLPartData public: LLPartData() : mFlags(0), - mMaxAge(0) + mMaxAge(0.f), + mParameter(0.f) { } BOOL unpack(LLDataPacker &dp); @@ -108,11 +104,12 @@ public: LL_PART_BEAM_MASK = 0x200, // Particle is a "beam" connecting source and target // Not implemented yet! - //LL_PART_RANDOM_ACCEL_MASK = 0x100, // Patricles have random accelearation + //LL_PART_RANDOM_ACCEL_MASK = 0x100, // Particles have random acceleration //LL_PART_RANDOM_VEL_MASK = 0x200, // Particles have random velocity shifts" //LL_PART_TRAIL_MASK = 0x400, // Particles have historical "trails" // Viewer side use only! + LL_PART_HUD = 0x40000000, LL_PART_DEAD_MASK = 0x80000000, }; diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp index b87b66822c..a8d2a0a224 100644 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -4,30 +4,25 @@ * @date 2004-11-21 * @brief Implementation of the i/o pump and related functions. * - * $LicenseInfo:firstyear=2004&license=viewergpl$ - * - * Copyright (c) 2004-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -36,11 +31,12 @@ #include <map> #include <set> -#include "apr-1/apr_poll.h" +#include "apr_poll.h" #include "llapr.h" #include "llmemtype.h" #include "llstl.h" +#include "llstat.h" // These should not be enabled in production, but they can be // intensely useful during development for finding certain kinds of @@ -49,7 +45,7 @@ //#define LL_DEBUG_PIPE_TYPE_IN_PUMP 1 //#define LL_DEBUG_POLL_FILE_DESCRIPTORS 1 #if LL_DEBUG_POLL_FILE_DESCRIPTORS -#include "apr-1/apr_portable.h" +#include "apr_portable.h" #endif #endif @@ -176,8 +172,11 @@ LLPumpIO::LLPumpIO(apr_pool_t* pool) : mCurrentPool(NULL), mCurrentPoolReallocCount(0), mChainsMutex(NULL), - mCallbackMutex(NULL) + mCallbackMutex(NULL), + mCurrentChain(mRunningChains.end()) { + mCurrentChain = mRunningChains.end(); + LLMemType m1(LLMemType::MTYPE_IO_PUMP); initialize(pool); } @@ -261,7 +260,7 @@ bool LLPumpIO::addChain( bool LLPumpIO::setTimeoutSeconds(F32 timeout) { // If no chain is running, return failure. - if(current_chain_t() == mCurrentChain) + if(mRunningChains.end() == mCurrentChain) { return false; } @@ -269,6 +268,15 @@ bool LLPumpIO::setTimeoutSeconds(F32 timeout) return true; } +void LLPumpIO::adjustTimeoutSeconds(F32 delta) +{ + // Ensure a chain is running + if(mRunningChains.end() != mCurrentChain) + { + (*mCurrentChain).adjustTimeoutSeconds(delta); + } +} + static std::string events_2_string(apr_int16_t events) { std::ostringstream ostr; @@ -365,7 +373,7 @@ S32 LLPumpIO::setLock() // lock the runner at the same time. // If no chain is running, return failure. - if(current_chain_t() == mCurrentChain) + if(mRunningChains.end() == mCurrentChain) { return 0; } @@ -414,7 +422,7 @@ bool LLPumpIO::sleepChain(F64 seconds) bool LLPumpIO::copyCurrentLinkInfo(links_t& links) const { LLMemType m1(LLMemType::MTYPE_IO_PUMP); - if(current_chain_t() == mCurrentChain) + if(mRunningChains.end() == mCurrentChain) { return false; } @@ -430,11 +438,13 @@ void LLPumpIO::pump() pump(DEFAULT_POLL_TIMEOUT); } +static LLFastTimer::DeclareTimer FTM_PUMP_IO("Pump IO"); + //timeout is in microseconds void LLPumpIO::pump(const S32& poll_timeout) { LLMemType m1(LLMemType::MTYPE_IO_PUMP); - LLFastTimer t1(LLFastTimer::FTM_PUMP); + LLFastTimer t1(FTM_PUMP_IO); //llinfos << "LLPumpIO::pump()" << llendl; // Run any pending runners. @@ -514,7 +524,10 @@ void LLPumpIO::pump(const S32& poll_timeout) //llinfos << "polling" << llendl; S32 count = 0; S32 client_id = 0; - apr_pollset_poll(mPollset, poll_timeout, &count, &poll_fd); + { + LLPerfBlock polltime("pump_poll"); + apr_pollset_poll(mPollset, poll_timeout, &count, &poll_fd); + } PUMP_DEBUG; for(S32 ii = 0; ii < count; ++ii) { @@ -533,7 +546,7 @@ void LLPumpIO::pump(const S32& poll_timeout) //lldebugs << "Running chain count: " << mRunningChains.size() << llendl; running_chains_t::iterator run_chain = mRunningChains.begin(); bool process_this_chain = false; - for(; run_chain != mRunningChains.end(); ) + while( run_chain != mRunningChains.end() ) { PUMP_DEBUG; if((*run_chain).mInit @@ -584,6 +597,7 @@ void LLPumpIO::pump(const S32& poll_timeout) } PUMP_DEBUG; mCurrentChain = run_chain; + if((*run_chain).mDescriptors.empty()) { // if there are no conditionals, just process this chain. @@ -702,7 +716,7 @@ void LLPumpIO::pump(const S32& poll_timeout) PUMP_DEBUG; // null out the chain - mCurrentChain = current_chain_t(); + mCurrentChain = mRunningChains.end(); END_PUMP_DEBUG; } @@ -758,6 +772,8 @@ bool LLPumpIO::respond( return true; } +static LLFastTimer::DeclareTimer FTM_PUMP_CALLBACK_CHAIN("Chain"); + void LLPumpIO::callback() { LLMemType m1(LLMemType::MTYPE_IO_PUMP); @@ -779,6 +795,7 @@ void LLPumpIO::callback() callbacks_t::iterator end = mCallbacks.end(); for(; it != end; ++it) { + LLFastTimer t(FTM_PUMP_CALLBACK_CHAIN); // it's always the first and last time for respone chains (*it).mHead = (*it).mChainLinks.begin(); (*it).mInit = true; @@ -1160,3 +1177,14 @@ void LLPumpIO::LLChainInfo::setTimeoutSeconds(F32 timeout) mTimer.stop(); } } + +void LLPumpIO::LLChainInfo::adjustTimeoutSeconds(F32 delta) +{ + LLMemType m1(LLMemType::MTYPE_IO_PUMP); + if(mTimer.getStarted()) + { + F64 expiry = mTimer.expiresAt(); + expiry += delta; + mTimer.setExpiryAt(expiry); + } +} diff --git a/indra/llmessage/llpumpio.h b/indra/llmessage/llpumpio.h index 1609650f1f..9303c9d7fc 100644 --- a/indra/llmessage/llpumpio.h +++ b/indra/llmessage/llpumpio.h @@ -4,30 +4,25 @@ * @date 2004-11-19 * @brief Declaration of pump class which manages io chains. * - * $LicenseInfo:firstyear=2004&license=viewergpl$ - * - * Copyright (c) 2004-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -39,7 +34,7 @@ #include <sys/param.h> #endif -#include "apr-1/apr_pools.h" +#include "apr_pools.h" #include "llbuffer.h" #include "llframetimer.h" #include "lliopipe.h" @@ -166,6 +161,14 @@ public: bool setTimeoutSeconds(F32 timeout); /** + * @brief Adjust the timeout of the running chain. + * + * This method has no effect if there is no timeout on the chain. + * @param delta The number of seconds to add to/remove from the timeout. + */ + void adjustTimeoutSeconds(F32 delta); + + /** * @brief Set up file descriptors for for the running chain. * @see rebuildPollset() * @@ -349,6 +352,7 @@ protected: // methods LLChainInfo(); void setTimeoutSeconds(F32 timeout); + void adjustTimeoutSeconds(F32 delta); // basic member data bool mInit; diff --git a/indra/llmessage/llqueryflags.h b/indra/llmessage/llqueryflags.h index 9b3074edca..14a62de04f 100644 --- a/indra/llmessage/llqueryflags.h +++ b/indra/llmessage/llqueryflags.h @@ -2,30 +2,25 @@ * @file llqueryflags.h * @brief Flags for directory queries * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -38,7 +33,7 @@ const U32 DFQ_PEOPLE = 0x1 << 0; const U32 DFQ_ONLINE = 0x1 << 1; //const U32 DFQ_PLACES = 0x1 << 2; -const U32 DFQ_EVENTS = 0x1 << 3; +const U32 DFQ_EVENTS = 0x1 << 3; // This is not set by the 1.21 viewer, but I don't know about older versions. JC const U32 DFQ_GROUPS = 0x1 << 4; const U32 DFQ_DATE_EVENTS = 0x1 << 5; @@ -64,6 +59,13 @@ const U32 DFQ_LIMIT_BY_AREA = 0x1 << 21; const U32 DFQ_FILTER_MATURE = 0x1 << 22; const U32 DFQ_PG_PARCELS_ONLY = 0x1 << 23; +const U32 DFQ_INC_PG = 0x1 << 24; // Flags appear in 1.23 viewer or later +const U32 DFQ_INC_MATURE = 0x1 << 25; +const U32 DFQ_INC_ADULT = 0x1 << 26; +const U32 DFQ_INC_NEW_VIEWER = (DFQ_INC_PG | DFQ_INC_MATURE | DFQ_INC_ADULT); // Indicates 1.23 viewer or later + +const U32 DFQ_ADULT_SIMS_ONLY = 0x1 << 27; + // Sell Type flags const U32 ST_AUCTION = 0x1 << 1; const U32 ST_NEWBIE = 0x1 << 2; @@ -72,4 +74,29 @@ const U32 ST_ESTATE = 0x1 << 4; const U32 ST_ALL = 0xFFFFFFFF; +// status flags embedded in search replay messages of classifieds, events, groups, and places. +// Places +const U32 STATUS_SEARCH_PLACES_NONE = 0x0; +const U32 STATUS_SEARCH_PLACES_BANNEDWORD = 0x1 << 0; +const U32 STATUS_SEARCH_PLACES_SHORTSTRING = 0x1 << 1; +const U32 STATUS_SEARCH_PLACES_FOUNDNONE = 0x1 << 2; +const U32 STATUS_SEARCH_PLACES_SEARCHDISABLED = 0x1 << 3; +const U32 STATUS_SEARCH_PLACES_ESTATEEMPTY = 0x1 << 4; +// Events +const U32 STATUS_SEARCH_EVENTS_NONE = 0x0; +const U32 STATUS_SEARCH_EVENTS_BANNEDWORD = 0x1 << 0; +const U32 STATUS_SEARCH_EVENTS_SHORTSTRING = 0x1 << 1; +const U32 STATUS_SEARCH_EVENTS_FOUNDNONE = 0x1 << 2; +const U32 STATUS_SEARCH_EVENTS_SEARCHDISABLED = 0x1 << 3; +const U32 STATUS_SEARCH_EVENTS_NODATEOFFSET = 0x1 << 4; +const U32 STATUS_SEARCH_EVENTS_NOCATEGORY = 0x1 << 5; +const U32 STATUS_SEARCH_EVENTS_NOQUERY = 0x1 << 6; + +//Classifieds +const U32 STATUS_SEARCH_CLASSIFIEDS_NONE = 0x0; +const U32 STATUS_SEARCH_CLASSIFIEDS_BANNEDWORD = 0x1 << 0; +const U32 STATUS_SEARCH_CLASSIFIEDS_SHORTSTRING = 0x1 << 1; +const U32 STATUS_SEARCH_CLASSIFIEDS_FOUNDNONE = 0x1 << 2; +const U32 STATUS_SEARCH_CLASSIFIEDS_SEARCHDISABLED = 0x1 << 3; + #endif diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h index 5f3fad8b8c..b9b974ec4f 100644 --- a/indra/llmessage/llregionflags.h +++ b/indra/llmessage/llregionflags.h @@ -2,30 +2,25 @@ * @file llregionflags.h * @brief Flags that are sent in the statistics message region_flags field. * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -60,8 +55,10 @@ const U32 REGION_FLAGS_BLOCK_LAND_RESELL = (1 << 7); // All content wiped once per night const U32 REGION_FLAGS_SANDBOX = (1 << 8); const U32 REGION_FLAGS_NULL_LAYER = (1 << 9); -const U32 REGION_FLAGS_SKIP_AGENT_ACTION = (1 << 10); -const U32 REGION_FLAGS_SKIP_UPDATE_INTEREST_LIST= (1 << 11); +// const U32 REGION_FLAGS_SKIP_AGENT_ACTION = (1 << 10); +const U32 REGION_FLAGS_HARD_ALLOW_LAND_TRANSFER = (1 << 10); // Region allows land reselling +// const U32 REGION_FLAGS_SKIP_UPDATE_INTEREST_LIST= (1 << 11); +const U32 REGION_FLAGS_HARD_ALLOW_POST_CLASSIFIED = (1 << 11); // Region allows posting of classified ads const U32 REGION_FLAGS_SKIP_COLLISIONS = (1 << 12); // Pin all non agent rigid bodies const U32 REGION_FLAGS_SKIP_SCRIPTS = (1 << 13); const U32 REGION_FLAGS_SKIP_PHYSICS = (1 << 14); // Skip all physics @@ -89,13 +86,13 @@ const U32 REGION_FLAGS_DENY_ANONYMOUS = (1 << 23); const U32 REGION_FLAGS_ALLOW_PARCEL_CHANGES = (1 << 26); -const U32 REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER = (1 << 27); +// const U32 REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER = (1 << 27); // We no longer support ELAR const U32 REGION_FLAGS_ALLOW_VOICE = (1 << 28); const U32 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29); -const U32 REGION_FLAGS_DENY_AGEUNVERIFIED = (1 << 30); - +const U32 REGION_FLAGS_DENY_AGEUNVERIFIED = (1 << 30); +const U32 REGION_FLAGS_SKIP_MONO_SCRIPTS = (1 << 31); const U32 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK | REGION_FLAGS_ALLOW_SET_HOME | @@ -140,7 +137,7 @@ const U32 ESTATE_MAINLAND = 1; const U32 ESTATE_ORIENTATION = 2; const U32 ESTATE_INTERNAL = 3; const U32 ESTATE_SHOWCASE = 4; -const U32 ESTATE_KIDGRID = 5; +const U32 ESTATE_TEEN = 5; const U32 ESTATE_LAST_LINDEN = 5; // last linden owned/managed estate // for EstateOwnerRequest, setaccess message @@ -172,9 +169,10 @@ const U32 ESTATE_ACCESS_BANNED_AGENT_ADD = 1 << 6; const U32 ESTATE_ACCESS_BANNED_AGENT_REMOVE = 1 << 7; const U32 ESTATE_ACCESS_MANAGER_ADD = 1 << 8; const U32 ESTATE_ACCESS_MANAGER_REMOVE = 1 << 9; +const U32 ESTATE_ACCESS_NO_REPLY = 1 << 10; const S32 ESTATE_MAX_MANAGERS = 10; -const S32 ESTATE_MAX_ACCESS_IDS = 300; // max for access, banned +const S32 ESTATE_MAX_ACCESS_IDS = 500; // max for access, banned const S32 ESTATE_MAX_GROUP_IDS = (S32) ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET; // 'Sim Wide Delete' flags diff --git a/indra/llmessage/llregionhandle.h b/indra/llmessage/llregionhandle.h index d9fcd82936..c77794e4b8 100644 --- a/indra/llmessage/llregionhandle.h +++ b/indra/llmessage/llregionhandle.h @@ -2,30 +2,25 @@ * @file llregionhandle.h * @brief Routines for converting positions to/from region handles. * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -115,7 +110,7 @@ inline LLVector3d from_region_handle(const U64 ®ion_handle) // grid-based region handle encoding. pass in a grid position // (eg: 1000,1000) and this will return the region handle. -inline U64 grid_to_region_handle(U32 grid_x, U32 grid_y) +inline U64 grid_to_region_handle(const U32 grid_x, const U32 grid_y) { return to_region_handle(grid_x * REGION_WIDTH_UNITS, grid_y * REGION_WIDTH_UNITS); diff --git a/indra/llmessage/llregionpresenceverifier.cpp b/indra/llmessage/llregionpresenceverifier.cpp new file mode 100644 index 0000000000..932cbf375e --- /dev/null +++ b/indra/llmessage/llregionpresenceverifier.cpp @@ -0,0 +1,153 @@ +/** + * @file llregionpresenceverifier.cpp + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llregionpresenceverifier.h" +#include "llhttpclientinterface.h" +#include <sstream> +#include "net.h" +#include "message.h" + +namespace boost +{ + void intrusive_ptr_add_ref(LLRegionPresenceVerifier::Response* p) + { + ++p->mReferenceCount; + } + + void intrusive_ptr_release(LLRegionPresenceVerifier::Response* p) + { + if(p && 0 == --p->mReferenceCount) + { + delete p; + } + } +}; + +LLRegionPresenceVerifier::Response::~Response() +{ +} + +LLRegionPresenceVerifier::RegionResponder::RegionResponder(const std::string& + uri, + ResponsePtr data, + S32 retry_count) : + mUri(uri), + mSharedData(data), + mRetryCount(retry_count) +{ +} + +//virtual +LLRegionPresenceVerifier::RegionResponder::~RegionResponder() +{ +} + +void LLRegionPresenceVerifier::RegionResponder::result(const LLSD& content) +{ + std::string host = content["private_host"].asString(); + U32 port = content["private_port"].asInteger(); + LLHost destination(host, port); + LLUUID id = content["region_id"]; + + lldebugs << "Verifying " << destination.getString() << " is region " << id << llendl; + + std::stringstream uri; + uri << "http://" << destination.getString() << "/state/basic/"; + mSharedData->getHttpClient().get( + uri.str(), + new VerifiedDestinationResponder(mUri, mSharedData, content, mRetryCount)); +} + +void LLRegionPresenceVerifier::RegionResponder::error(U32 status, + const std::string& reason) +{ + // TODO: babbage: distinguish between region presence service and + // region verification errors? + mSharedData->onRegionVerificationFailed(); +} + +LLRegionPresenceVerifier::VerifiedDestinationResponder::VerifiedDestinationResponder(const std::string& uri, ResponsePtr data, const LLSD& content, + S32 retry_count): + mUri(uri), + mSharedData(data), + mContent(content), + mRetryCount(retry_count) +{ +} + +//virtual +LLRegionPresenceVerifier::VerifiedDestinationResponder::~VerifiedDestinationResponder() +{ +} + +void LLRegionPresenceVerifier::VerifiedDestinationResponder::result(const LLSD& content) +{ + LLUUID actual_region_id = content["region_id"]; + LLUUID expected_region_id = mContent["region_id"]; + + lldebugs << "Actual region: " << content << llendl; + lldebugs << "Expected region: " << mContent << llendl; + + if (mSharedData->checkValidity(content) && + (actual_region_id == expected_region_id)) + { + mSharedData->onRegionVerified(mContent); + } + else if (mRetryCount > 0) + { + retry(); + } + else + { + llwarns << "Simulator verification failed. Region: " << mUri << llendl; + mSharedData->onRegionVerificationFailed(); + } +} + +void LLRegionPresenceVerifier::VerifiedDestinationResponder::retry() +{ + LLSD headers; + headers["Cache-Control"] = "no-cache, max-age=0"; + llinfos << "Requesting region information, get uncached for region " + << mUri << llendl; + --mRetryCount; + mSharedData->getHttpClient().get(mUri, new RegionResponder(mUri, mSharedData, mRetryCount), headers); +} + +void LLRegionPresenceVerifier::VerifiedDestinationResponder::error(U32 status, const std::string& reason) +{ + if(mRetryCount > 0) + { + retry(); + } + else + { + llwarns << "Failed to contact simulator for verification. Region: " << mUri << llendl; + mSharedData->onRegionVerificationFailed(); + } +} diff --git a/indra/llmessage/llregionpresenceverifier.h b/indra/llmessage/llregionpresenceverifier.h new file mode 100644 index 0000000000..5e8251e519 --- /dev/null +++ b/indra/llmessage/llregionpresenceverifier.h @@ -0,0 +1,98 @@ +/** + * @file llregionpresenceverifier.cpp + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +/* Macro Definitions */ +#ifndef LL_LLREGIONPRESENCEVERIFIER_H +#define LL_LLREGIONPRESENCEVERIFIER_H + +#include "llhttpclient.h" +#include <string> +#include "llsd.h" +#include <boost/intrusive_ptr.hpp> + +class LLHTTPClientInterface; + +class LLRegionPresenceVerifier +{ +public: + class Response + { + public: + virtual ~Response() = 0; + + virtual bool checkValidity(const LLSD& content) const = 0; + virtual void onRegionVerified(const LLSD& region_details) = 0; + virtual void onRegionVerificationFailed() = 0; + + virtual LLHTTPClientInterface& getHttpClient() = 0; + + public: /* but not really -- don't touch this */ + U32 mReferenceCount; + }; + + typedef boost::intrusive_ptr<Response> ResponsePtr; + + class RegionResponder : public LLHTTPClient::Responder + { + public: + RegionResponder(const std::string& uri, ResponsePtr data, + S32 retry_count); + virtual ~RegionResponder(); + virtual void result(const LLSD& content); + virtual void error(U32 status, const std::string& reason); + + private: + ResponsePtr mSharedData; + std::string mUri; + S32 mRetryCount; + }; + + class VerifiedDestinationResponder : public LLHTTPClient::Responder + { + public: + VerifiedDestinationResponder(const std::string& uri, ResponsePtr data, + const LLSD& content, S32 retry_count); + virtual ~VerifiedDestinationResponder(); + virtual void result(const LLSD& content); + + virtual void error(U32 status, const std::string& reason); + + private: + void retry(); + ResponsePtr mSharedData; + LLSD mContent; + std::string mUri; + S32 mRetryCount; + }; +}; + +namespace boost +{ + void intrusive_ptr_add_ref(LLRegionPresenceVerifier::Response* p); + void intrusive_ptr_release(LLRegionPresenceVerifier::Response* p); +}; + +#endif //LL_LLREGIONPRESENCEVERIFIER_H diff --git a/indra/llmessage/llsdappservices.cpp b/indra/llmessage/llsdappservices.cpp index 88588df1f2..8bab91b0c0 100644 --- a/indra/llmessage/llsdappservices.cpp +++ b/indra/llmessage/llsdappservices.cpp @@ -3,30 +3,25 @@ * @author Phoenix * @date 2006-09-12 * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -55,7 +50,7 @@ public: desc.source(__FILE__, __LINE__); } - virtual LLSD get() const + virtual LLSD simpleGet() const { LLSD result; LLApp* app = LLApp::instance(); @@ -81,7 +76,7 @@ public: desc.source(__FILE__, __LINE__); } - virtual LLSD get() const + virtual LLSD simpleGet() const { return LLApp::instance()->getOptionData( LLApp::PRIORITY_RUNTIME_OVERRIDE); diff --git a/indra/llmessage/llsdappservices.h b/indra/llmessage/llsdappservices.h index 089687bdde..e76e20cea9 100644 --- a/indra/llmessage/llsdappservices.h +++ b/indra/llmessage/llsdappservices.h @@ -4,30 +4,25 @@ * @date 2006-09-12 * @brief Header file to declare the /app common web services. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llsdhttpserver.cpp b/indra/llmessage/llsdhttpserver.cpp index 41bc503a76..5c8fc7b2bb 100644 --- a/indra/llmessage/llsdhttpserver.cpp +++ b/indra/llmessage/llsdhttpserver.cpp @@ -2,30 +2,25 @@ * @file llsdhttpserver.cpp * @brief Standard LLSD services * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -61,7 +56,7 @@ public: desc.source(__FILE__, __LINE__); } - virtual LLSD get() const + virtual LLSD simpleGet() const { LLSD result = "hello"; return result; @@ -85,7 +80,7 @@ public: desc.source(__FILE__, __LINE__); } - virtual LLSD post(const LLSD& params) const + virtual LLSD simplePost(const LLSD& params) const { return params; } diff --git a/indra/llmessage/llsdhttpserver.h b/indra/llmessage/llsdhttpserver.h index e0e8853dbe..39f9204604 100644 --- a/indra/llmessage/llsdhttpserver.h +++ b/indra/llmessage/llsdhttpserver.h @@ -2,30 +2,25 @@ * @file llsdhttpserver.h * @brief Standard LLSD services * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llsdmessage.cpp b/indra/llmessage/llsdmessage.cpp new file mode 100644 index 0000000000..9148c9dd15 --- /dev/null +++ b/indra/llmessage/llsdmessage.cpp @@ -0,0 +1,170 @@ +/** + * @file llsdmessage.cpp + * @author Nat Goodspeed + * @date 2008-10-31 + * @brief Implementation for llsdmessage. + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#if LL_WINDOWS +#pragma warning (disable : 4675) // "resolved by ADL" -- just as I want! +#endif + +// Precompiled header +#include "linden_common.h" +// associated header +#include "llsdmessage.h" +// STL headers +// std headers +// external library headers +// other Linden headers +#include "llevents.h" +#include "llsdserialize.h" +#include "llhttpclient.h" +#include "llmessageconfig.h" +#include "llhost.h" +#include "message.h" +#include "llsdutil.h" + +// Declare a static LLSDMessage instance to ensure that we have a listener as +// soon as someone tries to post on our canonical LLEventPump name. +static LLSDMessage httpListener; + +LLSDMessage::LLSDMessage(): + // Instantiating our own local LLEventPump with a string name the + // constructor is NOT allowed to tweak is a way of ensuring Singleton + // semantics: attempting to instantiate a second LLSDMessage object would + // throw LLEventPump::DupPumpName. + mEventPump("LLHTTPClient") +{ + mEventPump.listen("self", boost::bind(&LLSDMessage::httpListener, this, _1)); +} + +bool LLSDMessage::httpListener(const LLSD& request) +{ + // Extract what we want from the request object. We do it all up front + // partly to document what we expect. + LLSD::String url(request["url"]); + LLSD payload(request["payload"]); + LLSD::String reply(request["reply"]); + LLSD::String error(request["error"]); + LLSD::Real timeout(request["timeout"]); + // If the LLSD doesn't even have a "url" key, we doubt it was intended for + // this listener. + if (url.empty()) + { + std::ostringstream out; + out << "request event without 'url' key to '" << mEventPump.getName() << "'"; + throw ArgError(out.str()); + } + // Establish default timeout. This test relies on LLSD::asReal() returning + // exactly 0.0 for an undef value. + if (! timeout) + { + timeout = HTTP_REQUEST_EXPIRY_SECS; + } + LLHTTPClient::post(url, payload, + new LLSDMessage::EventResponder(LLEventPumps::instance(), + request, + url, "POST", reply, error), + LLSD(), // headers + timeout); + return false; +} + +void LLSDMessage::EventResponder::result(const LLSD& data) +{ + // If our caller passed an empty replyPump name, they're not + // listening: this is a fire-and-forget message. Don't bother posting + // to the pump whose name is "". + if (! mReplyPump.empty()) + { + LLSD response(data); + mReqID.stamp(response); + mPumps.obtain(mReplyPump).post(response); + } + else // default success handling + { + LL_INFOS("LLSDMessage::EventResponder") + << "'" << mMessage << "' to '" << mTarget << "' succeeded" + << LL_ENDL; + } +} + +void LLSDMessage::EventResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) +{ + // If our caller passed an empty errorPump name, they're not + // listening: "default error handling is acceptable." Only post to an + // explicit pump name. + if (! mErrorPump.empty()) + { + LLSD info(mReqID.makeResponse()); + info["target"] = mTarget; + info["message"] = mMessage; + info["status"] = LLSD::Integer(status); + info["reason"] = reason; + info["content"] = content; + mPumps.obtain(mErrorPump).post(info); + } + else // default error handling + { + // convention seems to be to use llinfos, but that seems a bit casual? + LL_WARNS("LLSDMessage::EventResponder") + << "'" << mMessage << "' to '" << mTarget + << "' failed with code " << status << ": " << reason << '\n' + << ll_pretty_print_sd(content) + << LL_ENDL; + } +} + +LLSDMessage::ResponderAdapter::ResponderAdapter(LLHTTPClient::ResponderPtr responder, + const std::string& name): + mResponder(responder), + mReplyPump(name + ".reply", true), // tweak name for uniqueness + mErrorPump(name + ".error", true) +{ + mReplyPump.listen("self", boost::bind(&ResponderAdapter::listener, this, _1, true)); + mErrorPump.listen("self", boost::bind(&ResponderAdapter::listener, this, _1, false)); +} + +bool LLSDMessage::ResponderAdapter::listener(const LLSD& payload, bool success) +{ + if (success) + { + mResponder->result(payload); + } + else + { + mResponder->errorWithContent(payload["status"].asInteger(), payload["reason"], payload["content"]); + } + + /*---------------- MUST BE LAST STATEMENT BEFORE RETURN ----------------*/ + delete this; + // Destruction of mResponder will usually implicitly free its referent as well + /*------------------------- NOTHING AFTER THIS -------------------------*/ + return false; +} + +void LLSDMessage::link() +{ +} diff --git a/indra/llmessage/llsdmessage.h b/indra/llmessage/llsdmessage.h new file mode 100644 index 0000000000..0d34847ff2 --- /dev/null +++ b/indra/llmessage/llsdmessage.h @@ -0,0 +1,166 @@ +/** + * @file llsdmessage.h + * @author Nat Goodspeed + * @date 2008-10-30 + * @brief API intended to unify sending capability, UDP and TCP messages: + * https://wiki.lindenlab.com/wiki/Viewer:Messaging/Messaging_Notes + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLSDMESSAGE_H) +#define LL_LLSDMESSAGE_H + +#include "llerror.h" // LOG_CLASS() +#include "llevents.h" // LLEventPumps +#include "llhttpclient.h" +#include <string> +#include <stdexcept> + +class LLSD; + +/** + * Class managing the messaging API described in + * https://wiki.lindenlab.com/wiki/Viewer:Messaging/Messaging_Notes + */ +class LLSDMessage +{ + LOG_CLASS(LLSDMessage); + +public: + LLSDMessage(); + + /// Exception if you specify arguments badly + struct ArgError: public std::runtime_error + { + ArgError(const std::string& what): + std::runtime_error(std::string("ArgError: ") + what) {} + }; + + /** + * The response idiom used by LLSDMessage -- LLEventPump names on which to + * post reply or error -- is designed for the case in which your + * reply/error handlers are methods on the same class as the method + * sending the message. Any state available to the sending method that + * must be visible to the reply/error methods can conveniently be stored + * on that class itself, if it's not already. + * + * The LLHTTPClient::Responder idiom requires a separate instance of a + * separate class so that it can dispatch to the code of interest by + * calling canonical virtual methods. Interesting state must be copied + * into that new object. + * + * With some trepidation, because existing response code is packaged in + * LLHTTPClient::Responder subclasses, we provide this adapter class + * <i>for transitional purposes only.</i> Instantiate a new heap + * ResponderAdapter with your new LLHTTPClient::ResponderPtr. Pass + * ResponderAdapter::getReplyName() and/or getErrorName() in your + * LLSDMessage (or LLViewerRegion::getCapAPI()) request event. The + * ResponderAdapter will call the appropriate Responder method, then + * @c delete itself. + */ + class ResponderAdapter + { + public: + /** + * Bind the new LLHTTPClient::Responder subclass instance. + * + * Passing the constructor a name other than the default is only + * interesting if you suspect some usage will lead to an exception or + * log message. + */ + ResponderAdapter(LLHTTPClient::ResponderPtr responder, + const std::string& name="ResponderAdapter"); + + /// EventPump name on which LLSDMessage should post reply event + std::string getReplyName() const { return mReplyPump.getName(); } + /// EventPump name on which LLSDMessage should post error event + std::string getErrorName() const { return mErrorPump.getName(); } + + private: + // We have two different LLEventStreams, though we route them both to + // the same listener, so that we can bind an extra flag identifying + // which case (reply or error) reached that listener. + bool listener(const LLSD&, bool success); + + LLHTTPClient::ResponderPtr mResponder; + LLEventStream mReplyPump, mErrorPump; + }; + + /** + * Force our implementation file to be linked with caller. The .cpp file + * contains a static instance of this class, which must be linked into the + * executable to support the canonical listener. But since the primary + * interface to that static instance is via a named LLEventPump rather + * than by direct reference, the linker doesn't necessarily perceive the + * necessity to bring in the translation unit. Referencing this dummy + * method forces the issue. + */ + static void link(); + +private: + friend class LLCapabilityListener; + /// Responder used for internal purposes by LLSDMessage and + /// LLCapabilityListener. Others should use higher-level APIs. + class EventResponder: public LLHTTPClient::Responder + { + public: + /** + * LLHTTPClient::Responder that dispatches via named LLEventPump instances. + * We bind LLEventPumps, even though it's an LLSingleton, for testability. + * We bind the string names of the desired LLEventPump instances rather + * than actually obtain()ing them so we only obtain() the one we're going + * to use. If the caller doesn't bother to listen() on it, the other pump + * may never materialize at all. + * @a target and @a message are only to clarify error processing. + * For a capability message, @a target should be the region description, + * @a message should be the capability name. + * For a service with a visible URL, pass the URL as @a target and the HTTP verb + * (e.g. "POST") as @a message. + */ + EventResponder(LLEventPumps& pumps, + const LLSD& request, + const std::string& target, const std::string& message, + const std::string& replyPump, const std::string& errorPump): + mPumps(pumps), + mReqID(request), + mTarget(target), + mMessage(message), + mReplyPump(replyPump), + mErrorPump(errorPump) + {} + + virtual void result(const LLSD& data); + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content); + + private: + LLEventPumps& mPumps; + LLReqID mReqID; + const std::string mTarget, mMessage, mReplyPump, mErrorPump; + }; + +private: + bool httpListener(const LLSD&); + LLEventStream mEventPump; +}; + +#endif /* ! defined(LL_LLSDMESSAGE_H) */ diff --git a/indra/llmessage/llsdmessagebuilder.cpp b/indra/llmessage/llsdmessagebuilder.cpp index 43fe7d6aea..42c179782f 100755..100644 --- a/indra/llmessage/llsdmessagebuilder.cpp +++ b/indra/llmessage/llsdmessagebuilder.cpp @@ -2,30 +2,25 @@ * @file llsdmessagebuilder.cpp * @brief LLSDMessageBuilder class implementation. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -36,6 +31,7 @@ #include "llmessagetemplate.h" #include "llquaternion.h" #include "llsdutil.h" +#include "llsdutil_math.h" #include "llsdserialize.h" #include "u64.h" #include "v3dmath.h" @@ -267,10 +263,125 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) for(; dit != dend; ++dit) { - //const LLMsgVarData& mvci = *dit; - - // TODO: Copy mvci data in to block: - // (*mCurrentBlock)[varname] = v; + const LLMsgVarData& mvci = *dit; + const char* varname = mvci.getName(); + + switch(mvci.getType()) + { + case MVT_FIXED: + addBinaryData(varname, mvci.getData(), mvci.getSize()); + break; + + case MVT_VARIABLE: + { + const char end = ((const char*)mvci.getData())[mvci.getSize()-1]; // Ensure null terminated + if (mvci.getDataSize() == 1 && end == 0) + { + addString(varname, (const char*)mvci.getData()); + } + else + { + addBinaryData(varname, mvci.getData(), mvci.getSize()); + } + break; + } + + case MVT_U8: + addU8(varname, *(U8*)mvci.getData()); + break; + + case MVT_U16: + addU16(varname, *(U16*)mvci.getData()); + break; + + case MVT_U32: + addU32(varname, *(U32*)mvci.getData()); + break; + + case MVT_U64: + addU64(varname, *(U64*)mvci.getData()); + break; + + case MVT_S8: + addS8(varname, *(S8*)mvci.getData()); + break; + + case MVT_S16: + addS16(varname, *(S16*)mvci.getData()); + break; + + case MVT_S32: + addS32(varname, *(S32*)mvci.getData()); + break; + + // S64 not supported in LLSD so we just truncate it + case MVT_S64: + addS32(varname, *(S64*)mvci.getData()); + break; + + case MVT_F32: + addF32(varname, *(F32*)mvci.getData()); + break; + + case MVT_F64: + addF64(varname, *(F64*)mvci.getData()); + break; + + case MVT_LLVector3: + addVector3(varname, *(LLVector3*)mvci.getData()); + break; + + case MVT_LLVector3d: + addVector3d(varname, *(LLVector3d*)mvci.getData()); + break; + + case MVT_LLVector4: + addVector4(varname, *(LLVector4*)mvci.getData()); + break; + + case MVT_LLQuaternion: + { + LLVector3 v = *(LLVector3*)mvci.getData(); + LLQuaternion q; + q.unpackFromVector3(v); + addQuat(varname, q); + break; + } + + case MVT_LLUUID: + addUUID(varname, *(LLUUID*)mvci.getData()); + break; + + case MVT_BOOL: + addBOOL(varname, *(BOOL*)mvci.getData()); + break; + + case MVT_IP_ADDR: + addIPAddr(varname, *(U32*)mvci.getData()); + break; + + case MVT_IP_PORT: + addIPPort(varname, *(U16*)mvci.getData()); + break; + + case MVT_U16Vec3: + //treated as an array of 6 bytes + addBinaryData(varname, mvci.getData(), 6); + break; + + case MVT_U16Quat: + //treated as an array of 8 bytes + addBinaryData(varname, mvci.getData(), 8); + break; + + case MVT_S16Array: + addBinaryData(varname, mvci.getData(), mvci.getSize()); + break; + + default: + llwarns << "Unknown type in conversion of message to LLSD" << llendl; + break; + } } } } diff --git a/indra/llmessage/llsdmessagebuilder.h b/indra/llmessage/llsdmessagebuilder.h index 4cdae36128..9c7c1bfde3 100755..100644 --- a/indra/llmessage/llsdmessagebuilder.h +++ b/indra/llmessage/llsdmessagebuilder.h @@ -2,30 +2,25 @@ * @file llsdmessagebuilder.h * @brief Declaration of LLSDMessageBuilder class. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp index e69c3e34ff..304a692cdf 100755..100644 --- a/indra/llmessage/llsdmessagereader.cpp +++ b/indra/llmessage/llsdmessagereader.cpp @@ -2,30 +2,25 @@ * @file llsdmessagereader.cpp * @brief LLSDMessageReader class implementation. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -37,7 +32,16 @@ #include "llsdmessagebuilder.h" #include "llsdutil.h" -LLSDMessageReader::LLSDMessageReader() +#include "llsdutil_math.h" +#include "v3math.h" +#include "v4math.h" +#include "v3dmath.h" +#include "v2math.h" +#include "llquaternion.h" +#include "v4color.h" + +LLSDMessageReader::LLSDMessageReader() : + mMessageName(NULL) { } @@ -63,14 +67,20 @@ LLSD getLLSD(const LLSD& input, const char* block, const char* var, S32 blocknum } if(! input[block].isArray()) { - llerrs << "block " << block << " not found" << llendl; + // NOTE: babbage: need to return default for missing blocks to allow + // backwards/forwards compatibility - handlers must cope with default + // values. + llwarns << "block " << block << " not found" << llendl; return LLSD(); } LLSD result = input[block][blocknum][var]; if(result.isUndefined()) { - llerrs << "var " << var << " not found" << llendl; + // NOTE: babbage: need to return default for missing vars to allow + // backwards/forwards compatibility - handlers must cope with default + // values. + llwarns << "var " << var << " not found" << llendl; } return result; } @@ -93,6 +103,12 @@ void LLSDMessageReader::getBinaryData(const char *block, const char *var, data_size = max_size; } + // Calls to memcpy will fail if data_size is not positive. + // Phoenix 2009-02-27 + if(data_size <= 0) + { + return; + } memcpy(datap, &(data[0]), data_size); } @@ -235,6 +251,12 @@ void LLSDMessageReader::getString(const char *block, const char *var, buffer[data_size] = '\0'; } +//virtual +void LLSDMessageReader::getString(const char *block, const char *var, + std::string& outstr, S32 blocknum) +{ + outstr = getLLSD(mMessage, block, var, blocknum).asString(); +} //virtual S32 LLSDMessageReader::getNumberOfBlocks(const char *blockname) diff --git a/indra/llmessage/llsdmessagereader.h b/indra/llmessage/llsdmessagereader.h index 66ac1d14ad..3b3d7fbfbe 100755..100644 --- a/indra/llmessage/llsdmessagereader.h +++ b/indra/llmessage/llsdmessagereader.h @@ -2,30 +2,25 @@ * @file llsdmessagereader.h * @brief LLSDMessageReader class Declaration * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -87,6 +82,8 @@ public: S32 blocknum = 0); virtual void getString(const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0); + virtual void getString(const char *block, const char *var, std::string& outstr, + S32 blocknum = 0); virtual S32 getNumberOfBlocks(const char *blockname); virtual S32 getSize(const char *blockname, const char *varname); diff --git a/indra/llmessage/llsdrpcclient.cpp b/indra/llmessage/llsdrpcclient.cpp index c4738b7083..86fe5c7912 100644 --- a/indra/llmessage/llsdrpcclient.cpp +++ b/indra/llmessage/llsdrpcclient.cpp @@ -4,30 +4,25 @@ * @date 2005-11-05 * @brief Implementation of the llsd client classes. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llsdrpcclient.h b/indra/llmessage/llsdrpcclient.h index 4511d10fea..9fb49a5c33 100644 --- a/indra/llmessage/llsdrpcclient.h +++ b/indra/llmessage/llsdrpcclient.h @@ -4,30 +4,25 @@ * @date 2005-11-05 * @brief Implementation and helpers for structure data RPC clients. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llsdrpcserver.cpp b/indra/llmessage/llsdrpcserver.cpp index ab1b800db8..f87c418fb1 100644 --- a/indra/llmessage/llsdrpcserver.cpp +++ b/indra/llmessage/llsdrpcserver.cpp @@ -4,30 +4,25 @@ * @date 2005-10-11 * @brief Implementation of the LLSDRPCServer and related classes. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llsdrpcserver.h b/indra/llmessage/llsdrpcserver.h index 92992aa0e3..9e56e4ea46 100644 --- a/indra/llmessage/llsdrpcserver.h +++ b/indra/llmessage/llsdrpcserver.h @@ -4,30 +4,25 @@ * @date 2005-10-11 * @brief Declaration of the structured data remote procedure call server. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llservice.cpp b/indra/llmessage/llservice.cpp index daa21b16bd..dbec92c221 100644 --- a/indra/llmessage/llservice.cpp +++ b/indra/llmessage/llservice.cpp @@ -3,30 +3,25 @@ * @author Phoenix * @date 2005-04-20 * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llservice.h b/indra/llmessage/llservice.h index 254b2d587a..9c09aeb44c 100644 --- a/indra/llmessage/llservice.h +++ b/indra/llmessage/llservice.h @@ -4,30 +4,25 @@ * @date 2004-11-21 * @brief Declaration file for LLService and related classes. * - * $LicenseInfo:firstyear=2004&license=viewergpl$ - * - * Copyright (c) 2004-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp index d5c6014140..b9aef3d0ba 100644 --- a/indra/llmessage/llservicebuilder.cpp +++ b/indra/llmessage/llservicebuilder.cpp @@ -2,30 +2,25 @@ * @file llservicebuilder.cpp * @brief Implementation of the LLServiceBuilder class. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -39,11 +34,11 @@ void LLServiceBuilder::loadServiceDefinitionsFromFile( const std::string& service_filename) { - llifstream service_file(service_filename.c_str(), std::ios::binary); + llifstream service_file(service_filename, std::ios::binary); if(service_file.is_open()) { LLSD service_data; - LLSDSerialize::fromXML(service_data, service_file); + LLSDSerialize::fromXMLDocument(service_data, service_file); service_file.close(); // Load service LLSD service_map = service_data["services"]; @@ -85,20 +80,42 @@ void LLServiceBuilder::createServiceDefinition( } } -std::string LLServiceBuilder::buildServiceURI(const std::string& service_name) +static +bool starts_with(const std::string& text, const char* prefix) +{ + return text.substr(0, strlen(prefix)) == prefix; +} + +// TODO: Build a real services.xml for windows development. +// and remove the base_url logic below. +std::string LLServiceBuilder::buildServiceURI(const std::string& service_name) const { std::ostringstream service_url; // Find the service builder - if(mServiceMap.find(service_name) != mServiceMap.end()) + std::map<std::string, std::string>::const_iterator it = + mServiceMap.find(service_name); + if(it != mServiceMap.end()) { // construct the service builder url LLApp* app = LLApp::instance(); if(app) { - LLSD base_url = app->getOption("services-base-url"); + // We define a base-url for some development configurations + // In production neither of these are defined and all services have full urls + LLSD base_url; + + if (starts_with(service_name,"cap")) + { + base_url = app->getOption("cap-base-url"); + } + + if (base_url.asString().empty()) + { + base_url = app->getOption("services-base-url"); + } service_url << base_url.asString(); } - service_url << mServiceMap[service_name]; + service_url << it->second; } else { @@ -109,12 +126,15 @@ std::string LLServiceBuilder::buildServiceURI(const std::string& service_name) std::string LLServiceBuilder::buildServiceURI( const std::string& service_name, - const LLSD& option_map) + const LLSD& option_map) const +{ + return russ_format(buildServiceURI(service_name), option_map); +} + +std::string russ_format(const std::string& format_str, const LLSD& context) { - std::string service_url = buildServiceURI(service_name); - - // Find the Service Name - if(!service_url.empty() && option_map.isMap()) + std::string service_url(format_str); + if(!service_url.empty() && context.isMap()) { // throw in a ridiculously large limiter to make sure we don't // loop forever with bad input. @@ -134,9 +154,9 @@ std::string LLServiceBuilder::buildServiceURI( std::string::iterator end(service_url.end()); std::string::iterator deepest_node(service_url.end()); std::string::iterator deepest_node_end(service_url.end()); - //parse out the variables to replace by going through {}s one at a time, - // starting with the "deepest" in series {{}}, - // and otherwise replacing right-to-left + // parse out the variables to replace by going through {}s + // one at a time, starting with the "deepest" in series + // {{}}, and otherwise replacing right-to-left for(; iter != end; ++iter) { switch(*iter) @@ -171,7 +191,7 @@ std::string LLServiceBuilder::buildServiceURI( // params and straight string substitution, so it's a // known distance of 2 to skip the directive. std::string key(deepest_node + 2, deepest_node_end); - LLSD value = option_map[key]; + LLSD value = context[key]; switch(*(deepest_node + 1)) { case '$': @@ -184,7 +204,9 @@ std::string LLServiceBuilder::buildServiceURI( } else { - llwarns << "Unknown key: " << key << " in option map: " << LLSDOStreamer<LLSDNotationFormatter>(option_map) << llendl; + llwarns << "Unknown key: " << key << " in option map: " + << LLSDOStreamer<LLSDNotationFormatter>(context) + << llendl; keep_looping = false; } break; @@ -212,50 +234,3 @@ std::string LLServiceBuilder::buildServiceURI( } return service_url; } - - - -// Old, not as good implementation. Phoenix 2007-10-15 -#if 0 - // Do brace replacements - NOT CURRENTLY RECURSIVE - for(LLSD::map_const_iterator option_itr = option_map.beginMap(); - option_itr != option_map.endMap(); - ++option_itr) - { - std::string variable_name = "{$"; - variable_name.append((*option_itr).first); - variable_name.append("}"); - std::string::size_type find_pos = service_url.find(variable_name); - if(find_pos != std::string::npos) - { - service_url.replace( - find_pos, - variable_name.length(), - (*option_itr).second.asString()); - continue; - } - variable_name.assign("{%"); - variable_name.append((*option_itr).first); - variable_name.append("}"); - find_pos = service_url.find(variable_name); - if(find_pos != std::string::npos) - { - std::string query_str = LLURI::mapToQueryString( - (*option_itr).second); - service_url.replace( - find_pos, - variable_name.length(), - query_str); - } - } - } - - if (service_url.find('{') != std::string::npos) - { - llwarns << "Constructed a likely bogus service URL: " << service_url - << llendl; - } - - return service_url; -} -#endif diff --git a/indra/llmessage/llservicebuilder.h b/indra/llmessage/llservicebuilder.h index 2c00660893..968995edf2 100644 --- a/indra/llmessage/llservicebuilder.h +++ b/indra/llmessage/llservicebuilder.h @@ -2,30 +2,25 @@ * @file llservicebuilder.h * @brief Declaration of the LLServiceBuilder class. * -* $LicenseInfo:firstyear=2007&license=viewergpl$ -* -* Copyright (c) 2007, Linden Research, Inc. -* +* $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code -* 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 +* Copyright (C) 2010, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. * -* 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 +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. * -* 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. +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * -* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO -* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, -* COMPLETENESS OR PERFORMANCE. +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -38,11 +33,24 @@ class LLSD; +/** + * @brief Format format string according to rules for RUSS. + * + * This function appears alongside the service builder since the + * algorithm was originally implemented there. This can eventually be + * moved when someone wants to take the time. + * @see https://osiris.lindenlab.com/mediawiki/index.php/Recursive_URL_Substitution_Syntax + * @param format_str The input string to format. + * @param context A map used for string substitutions. + * @return Returns the formatted string. If no match is found for a + * substitution target, the braces remain intact. + */ +std::string russ_format(const std::string& format_str, const LLSD& context); + /** * @class LLServiceBuilder * @brief This class builds urls for us to use when making web service calls. */ - class LLServiceBuilder { LOG_CLASS(LLServiceBuilder); @@ -62,7 +70,7 @@ public: * * @param service_name The name of the service you want to call. */ - std::string buildServiceURI(const std::string& service_name); + std::string buildServiceURI(const std::string& service_name) const; /** * @brief Build a service url if the url with construction parameters. @@ -74,7 +82,7 @@ public: */ std::string buildServiceURI( const std::string& service_name, - const LLSD& option_map); + const LLSD& option_map) const; public: /** diff --git a/indra/llmessage/llstoredmessage.cpp b/indra/llmessage/llstoredmessage.cpp new file mode 100644 index 0000000000..9f2f2bcda7 --- /dev/null +++ b/indra/llmessage/llstoredmessage.cpp @@ -0,0 +1,32 @@ +/** + * @file llstoredmessage.cpp + * @brief + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llstoredmessage.h" + +LLStoredMessage::LLStoredMessage(const std::string& name, const LLSD& message) : mMessage(message), mName(name) +{ +} + diff --git a/indra/llmessage/llstoredmessage.h b/indra/llmessage/llstoredmessage.h new file mode 100644 index 0000000000..9c98e2c558 --- /dev/null +++ b/indra/llmessage/llstoredmessage.h @@ -0,0 +1,52 @@ +/** + * @file llstoredmessage.h + * @brief + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_STOREDMESSAGE_H +#define LL_STOREDMESSAGE_H + +#include "linden_common.h" +#include "llsd.h" +#include <boost/shared_ptr.hpp> +#include <string> + + +class LLMessageSystem; + +class LLStoredMessage +{ +public: + LLStoredMessage(const std::string& name, const LLSD& message); +private: + friend class LLMessageSystem; + + LLSD mMessage; + std::string mName; +}; + +typedef boost::shared_ptr<LLStoredMessage> LLStoredMessagePtr; + + +#endif // LL_STOREDMESSAGE_H diff --git a/indra/llmessage/lltaskname.h b/indra/llmessage/lltaskname.h index d5bcfbd6d6..5dbd9c6223 100644 --- a/indra/llmessage/lltaskname.h +++ b/indra/llmessage/lltaskname.h @@ -3,30 +3,25 @@ * @brief This contains the current list of valid tasks and is inluded * into both simulator and viewer * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llteleportflags.h b/indra/llmessage/llteleportflags.h index c08c905726..b3fcad036e 100644 --- a/indra/llmessage/llteleportflags.h +++ b/indra/llmessage/llteleportflags.h @@ -2,30 +2,25 @@ * @file llteleportflags.h * @brief Teleport flags * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/lltemplatemessagebuilder.cpp b/indra/llmessage/lltemplatemessagebuilder.cpp index 70c306c060..6611d704e6 100644 --- a/indra/llmessage/lltemplatemessagebuilder.cpp +++ b/indra/llmessage/lltemplatemessagebuilder.cpp @@ -2,30 +2,25 @@ * @file lltemplatemessagebuilder.cpp * @brief LLTemplateMessageBuilder class implementation. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -40,7 +35,7 @@ #include "v3math.h" #include "v4math.h" -LLTemplateMessageBuilder::LLTemplateMessageBuilder(message_template_name_map_t& name_template_map) : +LLTemplateMessageBuilder::LLTemplateMessageBuilder(const message_template_name_map_t& name_template_map) : mCurrentSMessageData(NULL), mCurrentSMessageTemplate(NULL), mCurrentSDataBlock(NULL), @@ -60,7 +55,6 @@ LLTemplateMessageBuilder::~LLTemplateMessageBuilder() mCurrentSMessageData = NULL; } - // virtual void LLTemplateMessageBuilder::newMessage(const char *name) { @@ -75,14 +69,14 @@ void LLTemplateMessageBuilder::newMessage(const char *name) char* namep = (char*)name; if (mMessageTemplates.count(namep) > 0) { - mCurrentSMessageTemplate = mMessageTemplates[namep]; + mCurrentSMessageTemplate = mMessageTemplates.find(name)->second; mCurrentSMessageData = new LLMsgData(namep); mCurrentSMessageName = namep; mCurrentSDataBlock = NULL; mCurrentSBlockName = NULL; // add at one of each block - const LLMessageTemplate* msg_template = mMessageTemplates[namep]; + const LLMessageTemplate* msg_template = mMessageTemplates.find(name)->second; if (msg_template->getDeprecation() != MD_NOTDEPRECATED) { @@ -326,7 +320,7 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM << "(" << size << "). Clamping size and truncating data." << llendl; size = 255; char *truncate = (char *)data; - truncate[255] = 0; + truncate[254] = 0; // array size is 255 but the last element index is 254 } // no correct size for MVT_VARIABLE, instead we need to tell how many bytes the size will be encoded as @@ -728,19 +722,23 @@ static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* templat // out gracefully from this function. XXXTBD llerrs << "buildBlock failed. " << "Attempted to pack " - << result + mvci.getSize() + << (result + mvci.getSize()) << " bytes into a buffer with size " - << buffer_size << "." << llendl + << buffer_size << "." << llendl; } } } } --block_count; - ++block_iter; + if (block_iter != message_data->mMemberBlocks.end()) { - mbci = block_iter->second; + ++block_iter; + if (block_iter != message_data->mMemberBlocks.end()) + { + mbci = block_iter->second; + } } } diff --git a/indra/llmessage/lltemplatemessagebuilder.h b/indra/llmessage/lltemplatemessagebuilder.h index af4657c075..4f614a4657 100644 --- a/indra/llmessage/lltemplatemessagebuilder.h +++ b/indra/llmessage/lltemplatemessagebuilder.h @@ -2,30 +2,25 @@ * @file lltemplatemessagebuilder.h * @brief Declaration of LLTemplateMessageBuilder class. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -48,7 +43,7 @@ public: typedef std::map<const char* , LLMessageTemplate*> message_template_name_map_t; - LLTemplateMessageBuilder(message_template_name_map_t&); + LLTemplateMessageBuilder(const message_template_name_map_t&); virtual ~LLTemplateMessageBuilder(); virtual void newMessage(const char* name); @@ -98,6 +93,7 @@ public: virtual void copyFromMessageData(const LLMsgData& data); virtual void copyFromLLSD(const LLSD&); + LLMsgData* getCurrentMessage() const { return mCurrentSMessageData; } private: void addData(const char* varname, const void* data, EMsgVariableType type, S32 size); @@ -113,7 +109,7 @@ private: BOOL mbSBuilt; BOOL mbSClear; S32 mCurrentSendTotal; - message_template_name_map_t& mMessageTemplates; + const message_template_name_map_t& mMessageTemplates; }; #endif // LL_LLTEMPLATEMESSAGEBUILDER_H diff --git a/indra/llmessage/lltemplatemessagedispatcher.cpp b/indra/llmessage/lltemplatemessagedispatcher.cpp new file mode 100644 index 0000000000..ee7a4e7e71 --- /dev/null +++ b/indra/llmessage/lltemplatemessagedispatcher.cpp @@ -0,0 +1,67 @@ +/** + * @file lltemplatemessagedispatcher.h + * @brief LLTemplateMessageDispatcher class + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#include "lltemplatemessagedispatcher.h" + +#include "llhttpnode.h" +#include "llhost.h" +#include "message.h" +#include "llsd.h" +#include "lltemplatemessagereader.h" + + +LLTemplateMessageDispatcher::LLTemplateMessageDispatcher(LLTemplateMessageReader &template_message_reader) : + mTemplateMessageReader(template_message_reader) +{ +} + +void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name, + const LLSD& message, + LLHTTPNode::ResponsePtr responsep) +{ + std::vector<U8> data = message["body"]["binary-template-data"].asBinary(); + U32 size = data.size(); + if(size == 0) + { + return; + } + + LLHost host; + host = gMessageSystem->getSender(); + + bool validate_message = mTemplateMessageReader.validateMessage(&(data[0]), data.size(), host, true); + + if (validate_message) + { + mTemplateMessageReader.readMessage(&(data[0]),host); + } + else + { + gMessageSystem->clearReceiveState(); + } +} + diff --git a/indra/llmessage/lltemplatemessagedispatcher.h b/indra/llmessage/lltemplatemessagedispatcher.h new file mode 100644 index 0000000000..fe77f92074 --- /dev/null +++ b/indra/llmessage/lltemplatemessagedispatcher.h @@ -0,0 +1,48 @@ +/** + * @file lltemplatemessagedispatcher.h + * @brief LLTemplateMessageDispatcher class + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LLTEMPLATEMESSAGEDISPATCHER_H +#define LLTEMPLATEMESSAGEDISPATCHER_H + +#include "linden_common.h" +#include "llsd.h" +#include "llhttpnode.h" +#include "lltemplatemessagereader.h" + + +class LLTemplateMessageDispatcher +{ +public: + LLTemplateMessageDispatcher(LLTemplateMessageReader& template_message_reader); + void dispatch(const std::string& msg_name, + const LLSD& message, + LLHTTPNode::ResponsePtr responsep); + +private: + LLTemplateMessageReader &mTemplateMessageReader; +}; + +#endif // LLTEMPLATEMESSAGEDISPATCHER_H diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index f9b703b52a..3bfcd58c69 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -2,30 +2,25 @@ * @file lltemplatemessagereader.cpp * @brief LLTemplateMessageReader class implementation. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -171,9 +166,6 @@ S32 LLTemplateMessageReader::getNumberOfBlocks(const char *blockname) if (iter == mCurrentRMessageData->mMemberBlocks.end()) { -// sprintf(errmsg, "Block %s not in message %s", bnamep, mCurrentRMessageData->mName); -// llerrs << errmsg << llendl; -// return -1; return 0; } @@ -184,15 +176,15 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname) { // is there a message ready to go? if (mReceiveSize == -1) - { + { // This is a serious error - crash llerrs << "No message waiting for decode 4!" << llendl; - return -1; + return LL_MESSAGE_ERROR; } if (!mCurrentRMessageData) - { + { // This is a serious error - crash llerrs << "Invalid mCurrentRMessageData in getData!" << llendl; - return -1; + return LL_MESSAGE_ERROR; } char *bnamep = (char *)blockname; @@ -200,10 +192,10 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname) LLMsgData::msg_blk_data_map_t::const_iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep); if (iter == mCurrentRMessageData->mMemberBlocks.end()) - { - llerrs << "Block " << bnamep << " not in message " + { // don't crash + llinfos << "Block " << bnamep << " not in message " << mCurrentRMessageData->mName << llendl; - return -1; + return LL_BLOCK_NOT_IN_MESSAGE; } char *vnamep = (char *)varname; @@ -212,17 +204,17 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname) LLMsgVarData& vardata = msg_data->mMemberVarData[vnamep]; if (!vardata.getName()) - { - llerrs << "Variable " << varname << " not in message " + { // don't crash + llinfos << "Variable " << varname << " not in message " << mCurrentRMessageData->mName << " block " << bnamep << llendl; - return -1; + return LL_VARIABLE_NOT_IN_BLOCK; } if (mCurrentRMessageTemplate->mMemberBlocks[bnamep]->mType != MBT_SINGLE) - { + { // This is a serious error - crash llerrs << "Block " << bnamep << " isn't type MBT_SINGLE," " use getSize with blocknum argument!" << llendl; - return -1; + return LL_MESSAGE_ERROR; } return vardata.getSize(); @@ -232,15 +224,15 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const { // is there a message ready to go? if (mReceiveSize == -1) - { + { // This is a serious error - crash llerrs << "No message waiting for decode 5!" << llendl; - return -1; + return LL_MESSAGE_ERROR; } if (!mCurrentRMessageData) - { + { // This is a serious error - crash llerrs << "Invalid mCurrentRMessageData in getData!" << llendl; - return -1; + return LL_MESSAGE_ERROR; } char *bnamep = (char *)blockname + blocknum; @@ -249,20 +241,20 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const LLMsgData::msg_blk_data_map_t::const_iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep); if (iter == mCurrentRMessageData->mMemberBlocks.end()) - { - llerrs << "Block " << bnamep << " not in message " + { // don't crash + llinfos << "Block " << bnamep << " not in message " << mCurrentRMessageData->mName << llendl; - return -1; + return LL_BLOCK_NOT_IN_MESSAGE; } LLMsgBlkData* msg_data = iter->second; LLMsgVarData& vardata = msg_data->mMemberVarData[vnamep]; if (!vardata.getName()) - { - llerrs << "Variable " << vnamep << " not in message " + { // don't crash + llinfos << "Variable " << vnamep << " not in message " << mCurrentRMessageData->mName << " block " << bnamep << llendl; - return -1; + return LL_VARIABLE_NOT_IN_BLOCK; } return vardata.getSize(); @@ -433,6 +425,14 @@ inline void LLTemplateMessageReader::getString(const char *block, const char *va s[buffer_size - 1] = '\0'; } +inline void LLTemplateMessageReader::getString(const char *block, const char *var, std::string& outstr, S32 blocknum ) +{ + char s[MTUBYTES + 1]= {0}; // every element is initialized with 0 + getData(block, var, s, 0, blocknum, MTUBYTES); + s[MTUBYTES] = '\0'; + outstr = s; +} + //virtual S32 LLTemplateMessageReader::getMessageSize() const { @@ -524,6 +524,8 @@ void LLTemplateMessageReader::logRanOffEndOfPacket( const LLHost& host, const S3 gMessageSystem->callExceptionFunc(MX_RAN_OFF_END_OF_PACKET); } +static LLFastTimer::DeclareTimer FTM_PROCESS_MESSAGES("Process Messages"); + // decode a given message BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender ) { @@ -568,7 +570,9 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender // repeat number is a single byte if (decode_pos >= mReceiveSize) { - logRanOffEndOfPacket(sender, decode_pos, 1); + // commented out - hetgrid says that missing variable blocks + // at end of message are legal + // logRanOffEndOfPacket(sender, decode_pos, 1); // default to 0 repeats repeat_number = 0; @@ -667,8 +671,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender // default to 0s. U32 size = mvci.getSize(); - std::vector<U8> data(size); - memset(&(data[0]), 0, size); + std::vector<U8> data(size, 0); cur_data_block->addData(mvci.getName(), &(data[0]), size, mvci.getType()); } @@ -701,7 +704,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender } { - LLFastTimer t(LLFastTimer::FTM_PROCESS_MESSAGES); + LLFastTimer t(FTM_PROCESS_MESSAGES); if( !mCurrentRMessageTemplate->callHandlerFunc(gMessageSystem) ) { llwarns << "Message from " << sender << " with no handler function received: " << mCurrentRMessageTemplate->mName << llendl; @@ -746,18 +749,38 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender BOOL LLTemplateMessageReader::validateMessage(const U8* buffer, S32 buffer_size, - const LLHost& sender) + const LLHost& sender, + bool trusted) { mReceiveSize = buffer_size; - BOOL result = decodeTemplate(buffer, buffer_size, &mCurrentRMessageTemplate ); - if(result) + BOOL valid = decodeTemplate(buffer, buffer_size, &mCurrentRMessageTemplate ); + if(valid) { mCurrentRMessageTemplate->mReceiveCount++; - //lldebugs << "MessageRecvd:" + //lldebugs << "MessageRecvd:" // << mCurrentRMessageTemplate->mName // << " from " << sender << llendl; } - return result; + + if (valid && isBanned(trusted)) + { + LL_WARNS("Messaging") << "LLMessageSystem::checkMessages " + << "received banned message " + << getMessageName() + << " from " + << ((trusted) ? "trusted " : "untrusted ") + << sender << llendl; + valid = FALSE; + } + + if(valid && isUdpBanned()) + { + llwarns << "Received UDP black listed message " + << getMessageName() + << " from " << sender << llendl; + valid = FALSE; + } + return valid; } BOOL LLTemplateMessageReader::readMessage(const U8* buffer, @@ -783,12 +806,16 @@ bool LLTemplateMessageReader::isTrusted() const return mCurrentRMessageTemplate->getTrust() == MT_TRUST; } -//virtual bool LLTemplateMessageReader::isBanned(bool trustedSource) const { return mCurrentRMessageTemplate->isBanned(trustedSource); } +bool LLTemplateMessageReader::isUdpBanned() const +{ + return mCurrentRMessageTemplate->isUdpBanned(); +} + //virtual void LLTemplateMessageReader::copyToBuilder(LLMessageBuilder& builder) const { diff --git a/indra/llmessage/lltemplatemessagereader.h b/indra/llmessage/lltemplatemessagereader.h index 42cd90ea94..fcf8f92fa6 100644 --- a/indra/llmessage/lltemplatemessagereader.h +++ b/indra/llmessage/lltemplatemessagereader.h @@ -2,30 +2,25 @@ * @file lltemplatemessagereader.h * @brief Declaration of LLTemplateMessageReader class. * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -88,6 +83,8 @@ public: S32 blocknum = 0); virtual void getString(const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0); + virtual void getString(const char *block, const char *var, std::string& outstr, + S32 blocknum = 0); virtual S32 getNumberOfBlocks(const char *blockname); virtual S32 getSize(const char *blockname, const char *varname); @@ -102,12 +99,13 @@ public: virtual void copyToBuilder(LLMessageBuilder&) const; BOOL validateMessage(const U8* buffer, S32 buffer_size, - const LLHost& sender); + const LLHost& sender, bool trusted = false); BOOL readMessage(const U8* buffer, const LLHost& sender); bool isTrusted() const; bool isBanned(bool trusted_source) const; - + bool isUdpBanned() const; + private: void getData(const char *blockname, const char *varname, void *datap, diff --git a/indra/llmessage/llthrottle.cpp b/indra/llmessage/llthrottle.cpp index c6a819b873..64ebd51fec 100644 --- a/indra/llmessage/llthrottle.cpp +++ b/indra/llmessage/llthrottle.cpp @@ -2,30 +2,25 @@ * @file llthrottle.cpp * @brief LLThrottle class used for network bandwidth control. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -264,6 +259,31 @@ BOOL LLThrottleGroup::setNominalBPS(F32* throttle_vec) return changed; } +// Return bits available in the channel +S32 LLThrottleGroup::getAvailable(S32 throttle_cat) +{ + S32 retval = 0; + + F32 category_bps = mCurrentBPS[throttle_cat]; + F32 lookahead_bits = category_bps * THROTTLE_LOOKAHEAD_TIME; + + // use a temporary bits_available + // since we don't want to change mBitsAvailable every time + F32 elapsed_time = (F32)(LLMessageSystem::getMessageTimeSeconds() - mLastSendTime[throttle_cat]); + F32 bits_available = mBitsAvailable[throttle_cat] + (category_bps * elapsed_time); + + if (bits_available >= lookahead_bits) + { + retval = (S32) gThrottleMaximumBPS[throttle_cat]; + } + else + { + retval = (S32) bits_available; + } + + return retval; +} + BOOL LLThrottleGroup::checkOverflow(S32 throttle_cat, F32 bits) { diff --git a/indra/llmessage/llthrottle.h b/indra/llmessage/llthrottle.h index a999510ac4..ed0aeb4602 100644 --- a/indra/llmessage/llthrottle.h +++ b/indra/llmessage/llthrottle.h @@ -2,30 +2,25 @@ * @file llthrottle.h * @brief LLThrottle class used for network bandwidth control * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -83,6 +78,8 @@ public: BOOL dynamicAdjust(); // Shift bandwidth from idle channels to busy channels, TRUE if adjustment occurred BOOL setNominalBPS(F32* throttle_vec); // TRUE if any value was different, resets adjustment system if was different + S32 getAvailable(S32 throttle_cat); // Return bits available in the channel + void packThrottle(LLDataPacker &dp) const; void unpackThrottle(LLDataPacker &dp); public: diff --git a/indra/llmessage/lltransfermanager.cpp b/indra/llmessage/lltransfermanager.cpp index ff4f8a2e66..754eb99cbd 100644 --- a/indra/llmessage/lltransfermanager.cpp +++ b/indra/llmessage/lltransfermanager.cpp @@ -3,30 +3,25 @@ * @brief Improved transfer mechanism for moving data through the * message system. * - * $LicenseInfo:firstyear=2004&license=viewergpl$ - * - * Copyright (c) 2004-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -854,6 +849,7 @@ void LLTransferSourceChannel::updateTransfers() break; case LLTS_ERROR: llwarns << "Error in transfer dataCallback!" << llendl; + // fall through case LLTS_DONE: // We need to clean up this transfer source. //llinfos << "LLTransferSourceChannel::updateTransfers() " << tsp->getID() << " done" << llendl; @@ -1194,6 +1190,7 @@ LLTransferTarget::LLTransferTarget( mType(type), mSourceType(source_type), mID(transfer_id), + mChannelp(NULL), mGotInfo(FALSE), mSize(0), mLastPacketID(-1) @@ -1336,7 +1333,9 @@ BOOL LLTransferSourceParamsInvItem::unpackParams(LLDataPacker &dp) } LLTransferSourceParamsEstate::LLTransferSourceParamsEstate() : - LLTransferSourceParams(LLTST_SIM_ESTATE), mEstateAssetType(ET_NONE) + LLTransferSourceParams(LLTST_SIM_ESTATE), + mEstateAssetType(ET_NONE), + mAssetType(LLAssetType::AT_NONE) { } diff --git a/indra/llmessage/lltransfermanager.h b/indra/llmessage/lltransfermanager.h index 1813dd0afb..252e05d1d1 100644 --- a/indra/llmessage/lltransfermanager.h +++ b/indra/llmessage/lltransfermanager.h @@ -3,30 +3,25 @@ * @brief Improved transfer mechanism for moving data through the * message system. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/lltransfersourceasset.cpp b/indra/llmessage/lltransfersourceasset.cpp index 941c77e960..7e57841580 100644 --- a/indra/llmessage/lltransfersourceasset.cpp +++ b/indra/llmessage/lltransfersourceasset.cpp @@ -2,30 +2,25 @@ * @file lltransfersourceasset.cpp * @brief Transfer system for sending an asset. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -59,7 +54,7 @@ void LLTransferSourceAsset::initTransfer() // to the simulator. This is subset of assets we allow to be // simply pulled straight from the asset system. LLUUID* tidp; - if(is_asset_fetch_by_id_allowed(mParams.getAssetType())) + if(LLAssetType::lookupIsAssetFetchByIDAllowed(mParams.getAssetType())) { tidp = new LLUUID(getID()); gAssetStorage->getAssetData( @@ -130,7 +125,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id, *data_handle = tmpp; if (!vf.read(tmpp, max_bytes)) /* Flawfinder: Ignore */ { - // Crap, read failure, need to deal with it. + // Read failure, need to deal with it. delete[] tmpp; *data_handle = NULL; returned_bytes = 0; @@ -225,7 +220,10 @@ void LLTransferSourceAsset::responderCallback(LLVFS *vfs, const LLUUID& uuid, LL -LLTransferSourceParamsAsset::LLTransferSourceParamsAsset() : LLTransferSourceParams(LLTST_ASSET) +LLTransferSourceParamsAsset::LLTransferSourceParamsAsset() + : LLTransferSourceParams(LLTST_ASSET), + + mAssetType(LLAssetType::AT_NONE) { } @@ -253,48 +251,3 @@ BOOL LLTransferSourceParamsAsset::unpackParams(LLDataPacker &dp) return TRUE; } - -/** - * Helper functions - */ -bool is_asset_fetch_by_id_allowed(LLAssetType::EType type) -{ - // *FIX: Make this list smaller. - bool rv = false; - switch(type) - { - case LLAssetType::AT_SOUND: - case LLAssetType::AT_LANDMARK: - case LLAssetType::AT_CLOTHING: - case LLAssetType::AT_BODYPART: - case LLAssetType::AT_ANIMATION: - case LLAssetType::AT_GESTURE: - rv = true; - break; - default: - break; - } - return rv; -} - -bool is_asset_id_knowable(LLAssetType::EType type) -{ - // *FIX: Make this list smaller. - bool rv = false; - switch(type) - { - case LLAssetType::AT_TEXTURE: - case LLAssetType::AT_SOUND: - case LLAssetType::AT_LANDMARK: - case LLAssetType::AT_CLOTHING: - case LLAssetType::AT_NOTECARD: - case LLAssetType::AT_BODYPART: - case LLAssetType::AT_ANIMATION: - case LLAssetType::AT_GESTURE: - rv = true; - break; - default: - break; - } - return rv; -} diff --git a/indra/llmessage/lltransfersourceasset.h b/indra/llmessage/lltransfersourceasset.h index 4a15d5e2d2..3abda83cf8 100644 --- a/indra/llmessage/lltransfersourceasset.h +++ b/indra/llmessage/lltransfersourceasset.h @@ -2,30 +2,25 @@ * @file lltransfersourceasset.h * @brief Transfer system for sending an asset. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -83,24 +78,4 @@ protected: S32 mCurPos; }; -/** - * @brief Quick check to see if the asset allows direct download. - * - * This might not be the right place for this function call, but it - * originally started life inside the LLTransferSourceAsset code. - * @param type The type of asset. - * @return Returns true if the asset can be fetched by id. - */ -bool is_asset_fetch_by_id_allowed(LLAssetType::EType type); - -/** - * @brief Quick check to see if all asset data can be known by the viewer. - * - * This might not be the right place for this function call, but it - * originally started life inside the LLTransferSourceAsset code. - * @param type The type of asset. - * @return Returns true if the asset id can be transmitted to the viewer. - */ -bool is_asset_id_knowable(LLAssetType::EType type); - #endif // LL_LLTRANSFERSOURCEASSET_H diff --git a/indra/llmessage/lltransfersourcefile.cpp b/indra/llmessage/lltransfersourcefile.cpp index abbef1cc63..43c9448fba 100644 --- a/indra/llmessage/lltransfersourcefile.cpp +++ b/indra/llmessage/lltransfersourcefile.cpp @@ -2,30 +2,25 @@ * @file lltransfersourcefile.cpp * @brief Transfer system for sending a file. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -67,7 +62,7 @@ void LLTransferSourceFile::initTransfer() return; } // Look for the file. - mFP = LLFile::fopen(mParams.getFilename().c_str(), "rb"); /* Flawfinder: ignore */ + mFP = LLFile::fopen(mParams.getFilename(), "rb"); /* Flawfinder: ignore */ if (!mFP) { sendTransferStatus(LLTS_ERROR); @@ -134,9 +129,9 @@ void LLTransferSourceFile::completionCallback(const LLTSCode status) } // Delete the file iff the filename begins with "TEMP" - if (mParams.getDeleteOnCompletion() && memcmp(mParams.getFilename().c_str(), "TEMP", 4) == 0) + if (mParams.getDeleteOnCompletion() && mParams.getFilename().substr(0, 4) == "TEMP") { - LLFile::remove(mParams.getFilename().c_str()); + LLFile::remove(mParams.getFilename()); } } @@ -153,14 +148,16 @@ BOOL LLTransferSourceFile::unpackParams(LLDataPacker &dp) } -LLTransferSourceParamsFile::LLTransferSourceParamsFile() : LLTransferSourceParams(LLTST_FILE) +LLTransferSourceParamsFile::LLTransferSourceParamsFile() : + LLTransferSourceParams(LLTST_FILE), + mDeleteOnCompletion(FALSE) { } void LLTransferSourceParamsFile::packParams(LLDataPacker &dp) const { - dp.packString(mFilename.c_str(), "Filename"); + dp.packString(mFilename, "Filename"); dp.packU8((U8)mDeleteOnCompletion, "Delete"); } diff --git a/indra/llmessage/lltransfersourcefile.h b/indra/llmessage/lltransfersourcefile.h index c3523b10d7..985042417e 100644 --- a/indra/llmessage/lltransfersourcefile.h +++ b/indra/llmessage/lltransfersourcefile.h @@ -2,30 +2,25 @@ * @file lltransfersourcefile.h * @brief Transfer system for sending a file. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -42,7 +37,7 @@ public: /*virtual*/ void packParams(LLDataPacker &dp) const; /*virtual*/ BOOL unpackParams(LLDataPacker &dp); - void setFilename(const LLString &filename) { mFilename = filename; } + void setFilename(const std::string &filename) { mFilename = filename; } std::string getFilename() const { return mFilename; } void setDeleteOnCompletion(BOOL enabled) { mDeleteOnCompletion = enabled; } @@ -74,7 +69,7 @@ protected: protected: LLTransferSourceParamsFile mParams; - FILE *mFP; + LLFILE *mFP; }; #endif // LL_LLTRANSFERSOURCEFILE_H diff --git a/indra/llmessage/lltransfertargetfile.cpp b/indra/llmessage/lltransfertargetfile.cpp index d05f80834a..560fc8b6e4 100644 --- a/indra/llmessage/lltransfertargetfile.cpp +++ b/indra/llmessage/lltransfertargetfile.cpp @@ -2,30 +2,25 @@ * @file lltransfertargetfile.cpp * @brief Transfer system for receiving a file. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -80,7 +75,7 @@ LLTSCode LLTransferTargetFile::dataCallback(const S32 packet_id, U8 *in_datap, c if (!mFP) { - mFP = LLFile::fopen(mParams.mFilename.c_str(), "wb"); /* Flawfinder: ignore */ + mFP = LLFile::fopen(mParams.mFilename, "wb"); /* Flawfinder: ignore */ if (!mFP) { @@ -122,7 +117,7 @@ void LLTransferTargetFile::completionCallback(const LLTSCode status) if (mFP) { // Only need to remove file if we successfully opened it. - LLFile::remove(mParams.mFilename.c_str()); + LLFile::remove(mParams.mFilename); } default: break; diff --git a/indra/llmessage/lltransfertargetfile.h b/indra/llmessage/lltransfertargetfile.h index 18b44e2611..6d03ff2d2e 100644 --- a/indra/llmessage/lltransfertargetfile.h +++ b/indra/llmessage/lltransfertargetfile.h @@ -2,30 +2,25 @@ * @file lltransfertargetfile.h * @brief Transfer system for receiving a file. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -39,13 +34,18 @@ typedef void (*LLTTFCompleteCallback)(const LLTSCode status, void *user_data); class LLTransferTargetParamsFile : public LLTransferTargetParams { public: - LLTransferTargetParamsFile() : LLTransferTargetParams(LLTTT_FILE) {} - void setFilename(const LLString& filename) { mFilename = filename; } + LLTransferTargetParamsFile() + : LLTransferTargetParams(LLTTT_FILE), + + mCompleteCallback(NULL), + mUserData(NULL) + {} + void setFilename(const std::string& filename) { mFilename = filename; } void setCallback(LLTTFCompleteCallback cb, void *user_data) { mCompleteCallback = cb; mUserData = user_data; } friend class LLTransferTargetFile; protected: - LLString mFilename; + std::string mFilename; LLTTFCompleteCallback mCompleteCallback; void * mUserData; }; @@ -69,7 +69,7 @@ protected: LLTransferTargetParamsFile mParams; - FILE *mFP; + LLFILE *mFP; }; #endif // LL_LLTRANSFERTARGETFILE_H diff --git a/indra/llmessage/lltransfertargetvfile.cpp b/indra/llmessage/lltransfertargetvfile.cpp index 4be0b65855..c78d9288b6 100644 --- a/indra/llmessage/lltransfertargetvfile.cpp +++ b/indra/llmessage/lltransfertargetvfile.cpp @@ -2,30 +2,25 @@ * @file lltransfertargetvfile.cpp * @brief Transfer system for receiving a vfile. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/lltransfertargetvfile.h b/indra/llmessage/lltransfertargetvfile.h index 041b7eac33..23a65e4bb2 100644 --- a/indra/llmessage/lltransfertargetvfile.h +++ b/indra/llmessage/lltransfertargetvfile.h @@ -2,30 +2,25 @@ * @file lltransfertargetvfile.h * @brief Transfer system for receiving a vfile. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -67,7 +62,6 @@ protected: LLTTVFCompleteCallback mCompleteCallback; void* mUserDatap; S32 mErrCode; - LLVFSThread::handle_t mHandle; }; diff --git a/indra/llmessage/lltrustedmessageservice.cpp b/indra/llmessage/lltrustedmessageservice.cpp new file mode 100644 index 0000000000..fea7fc72c4 --- /dev/null +++ b/indra/llmessage/lltrustedmessageservice.cpp @@ -0,0 +1,84 @@ +/** + * @file lltrustedmessageservice.cpp + * @brief LLTrustedMessageService implementation + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "lltrustedmessageservice.h" +#include "llhost.h" +#include "llmessageconfig.h" +#include "message.h" + + +bool LLTrustedMessageService::validate(const std::string& name, LLSD& context) +const +{ + return true; +} + +void LLTrustedMessageService::post(LLHTTPNode::ResponsePtr response, + const LLSD& context, + const LLSD& input) const +{ + std::string name = context["request"]["wildcard"]["message-name"]; + std::string senderIP = context["request"]["remote-host"]; + std::string senderPort = context["request"]["headers"] + ["x-secondlife-udp-listen-port"]; + + LLSD message_data; + std::string sender = senderIP + ":" + senderPort; + message_data["sender"] = sender; + message_data["body"] = input; + + // 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))) + { + LL_WARNS("Messaging") << "trusted message POST to /trusted-message/" + << name << " from unknown or untrusted sender " + << sender << llendl; + response->status(403, "Unknown or untrusted sender"); + } + else + { + gMessageSystem->receivedMessageFromTrustedSender(); + if (input.has("binary-template-data")) + { + llinfos << "Dispatching template: " << input << llendl; + // try and send this message using udp dispatch + LLMessageSystem::dispatchTemplate(name, message_data, response); + } + else + { + llinfos << "Dispatching without template: " << input << llendl; + LLMessageSystem::dispatch(name, message_data, response); + } + } +} diff --git a/indra/llmessage/lltrustedmessageservice.h b/indra/llmessage/lltrustedmessageservice.h new file mode 100644 index 0000000000..688937ac2c --- /dev/null +++ b/indra/llmessage/lltrustedmessageservice.h @@ -0,0 +1,46 @@ +/** + * @file lltrustedmessageservice.h + * @brief LLTrustedMessageService class + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LLTRUSTEDMESSAGESERVICE_H +#define LLTRUSTEDMESSAGESERVICE_H + +#include "linden_common.h" +#include "llhttpnode.h" + +class LLSD; + +class LLTrustedMessageService +{ +public: + + bool validate(const std::string& name, LLSD& context) const; + + void post(LLHTTPNode::ResponsePtr response, + const LLSD& context, + const LLSD& input) const; +}; + +#endif // LLTRUSTEDMESSAGESERVICE_H diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index db67fbeea7..cb9d1c3731 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -4,57 +4,55 @@ * @date 2005-04-28 * @brief Implementation of the URLRequest class and related classes. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #include "linden_common.h" #include "llurlrequest.h" -#include <curl/curl.h> #include <algorithm> - +#include <openssl/x509_vfy.h> +#include <openssl/ssl.h> #include "llcurl.h" #include "llioutil.h" #include "llmemtype.h" #include "llpumpio.h" #include "llsd.h" #include "llstring.h" -#include "apr-1/apr_env.h" - +#include "apr_env.h" +#include "llapr.h" static const U32 HTTP_STATUS_PIPE_ERROR = 499; /** * String constants */ const std::string CONTEXT_DEST_URI_SD_LABEL("dest_uri"); +const std::string CONTEXT_TRANSFERED_BYTES("transfered_bytes"); static size_t headerCallback(void* data, size_t size, size_t nmemb, void* user); + + /** * class LLURLRequestDetail */ @@ -69,7 +67,9 @@ public: LLChannelDescriptors mChannels; U8* mLastRead; U32 mBodyLimit; + S32 mByteAccumulator; bool mIsBodyLimitSet; + LLURLRequest::SSLCertVerifyCallback mSSLVerifyCallback; }; LLURLRequestDetail::LLURLRequestDetail() : @@ -77,8 +77,9 @@ LLURLRequestDetail::LLURLRequestDetail() : mResponseBuffer(NULL), mLastRead(NULL), mBodyLimit(0), - mIsBodyLimitSet(false) - + mByteAccumulator(0), + mIsBodyLimitSet(false), + mSSLVerifyCallback(NULL) { LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST); mCurlRequest = new LLCurlEasyRequest(); @@ -92,11 +93,61 @@ LLURLRequestDetail::~LLURLRequestDetail() mLastRead = NULL; } +void LLURLRequest::setSSLVerifyCallback(SSLCertVerifyCallback callback, void *param) +{ + mDetail->mSSLVerifyCallback = callback; + mDetail->mCurlRequest->setSSLCtxCallback(LLURLRequest::_sslCtxCallback, (void *)this); + mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, true); + mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, 2); +} + + +// _sslCtxFunction +// Callback function called when an SSL Context is created via CURL +// used to configure the context for custom cert validation + +CURLcode LLURLRequest::_sslCtxCallback(CURL * curl, void *sslctx, void *param) +{ + LLURLRequest *req = (LLURLRequest *)param; + if(req == NULL || req->mDetail->mSSLVerifyCallback == NULL) + { + SSL_CTX_set_cert_verify_callback((SSL_CTX *)sslctx, NULL, NULL); + return CURLE_OK; + } + SSL_CTX * ctx = (SSL_CTX *) sslctx; + // disable any default verification for server certs + SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL); + // set the verification callback. + SSL_CTX_set_cert_verify_callback(ctx, req->mDetail->mSSLVerifyCallback, (void *)req); + // the calls are void + return CURLE_OK; + +} /** * class LLURLRequest */ +// static +std::string LLURLRequest::actionAsVerb(LLURLRequest::ERequestAction action) +{ + static const std::string VERBS[] = + { + "(invalid)", + "HEAD", + "GET", + "PUT", + "POST", + "DELETE", + "MOVE" + }; + if(((S32)action <=0) || ((S32)action >= REQUEST_ACTION_COUNT)) + { + return VERBS[0]; + } + return VERBS[action]; +} + LLURLRequest::LLURLRequest(LLURLRequest::ERequestAction action) : mAction(action) { @@ -126,6 +177,11 @@ void LLURLRequest::setURL(const std::string& url) mDetail->mURL = url; } +std::string LLURLRequest::getURL() const +{ + return mDetail->mURL; +} + void LLURLRequest::addHeader(const char* header) { LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST); @@ -138,12 +194,6 @@ void LLURLRequest::setBodyLimit(U32 size) mDetail->mIsBodyLimitSet = true; } -void LLURLRequest::checkRootCertificate(bool check) -{ - mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, (check? TRUE : FALSE)); - mDetail->mCurlRequest->setoptString(CURLOPT_ENCODING, ""); -} - void LLURLRequest::setCallback(LLURLRequestComplete* callback) { LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST); @@ -165,18 +215,16 @@ void LLURLRequest::useProxy(bool use_proxy) if (use_proxy && (env_proxy == NULL)) { apr_status_t status; - apr_pool_t* pool; - apr_pool_create(&pool, NULL); - status = apr_env_get(&env_proxy, "ALL_PROXY", pool); + LLAPRPool pool; + status = apr_env_get(&env_proxy, "ALL_PROXY", pool.getAPRPool()); if (status != APR_SUCCESS) { - status = apr_env_get(&env_proxy, "http_proxy", pool); + status = apr_env_get(&env_proxy, "http_proxy", pool.getAPRPool()); } if (status != APR_SUCCESS) { use_proxy = FALSE; } - apr_pool_destroy(pool); } @@ -194,7 +242,12 @@ void LLURLRequest::useProxy(bool use_proxy) void LLURLRequest::useProxy(const std::string &proxy) { - curl_easy_setopt(mDetail->mCurlRequest, CURLOPT_PROXY, proxy.c_str()); + mDetail->mCurlRequest->setoptString(CURLOPT_PROXY, proxy); +} + +void LLURLRequest::allowCookies() +{ + mDetail->mCurlRequest->setoptString(CURLOPT_COOKIEFILE, ""); } // virtual @@ -228,7 +281,29 @@ LLIOPipe::EStatus LLURLRequest::process_impl( PUMP_DEBUG; LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST); //llinfos << "LLURLRequest::process_impl()" << llendl; - if(!buffer) return STATUS_ERROR; + if (!buffer) return STATUS_ERROR; + + // we're still waiting or prcessing, check how many + // bytes we have accumulated. + const S32 MIN_ACCUMULATION = 100000; + if(pump && (mDetail->mByteAccumulator > MIN_ACCUMULATION)) + { + // This is a pretty sloppy calculation, but this + // tries to make the gross assumption that if data + // is coming in at 56kb/s, then this transfer will + // probably succeed. So, if we're accumlated + // 100,000 bytes (MIN_ACCUMULATION) then let's + // give this client another 2s to complete. + const F32 TIMEOUT_ADJUSTMENT = 2.0f; + mDetail->mByteAccumulator = 0; + pump->adjustTimeoutSeconds(TIMEOUT_ADJUSTMENT); + lldebugs << "LLURLRequest adjustTimeoutSeconds for request: " << mDetail->mURL << llendl; + if (mState == STATE_INITIALIZED) + { + llinfos << "LLURLRequest adjustTimeoutSeconds called during upload" << llendl; + } + } + switch(mState) { case STATE_INITIALIZED: @@ -265,12 +340,16 @@ LLIOPipe::EStatus LLURLRequest::process_impl( { CURLcode result; bool newmsg = mDetail->mCurlRequest->getResult(&result); - if (!newmsg) + if(!newmsg) { + // keep processing break; } mState = STATE_HAVE_RESPONSE; + context[CONTEXT_REQUEST][CONTEXT_TRANSFERED_BYTES] = mRequestTransferedBytes; + context[CONTEXT_RESPONSE][CONTEXT_TRANSFERED_BYTES] = mResponseTransferedBytes; + lldebugs << this << "Setting context to " << context << llendl; switch(result) { case CURLE_OK: @@ -317,10 +396,16 @@ LLIOPipe::EStatus LLURLRequest::process_impl( // we already stuffed everything into channel in in the curl // callback, so we are done. eos = true; + context[CONTEXT_REQUEST][CONTEXT_TRANSFERED_BYTES] = mRequestTransferedBytes; + context[CONTEXT_RESPONSE][CONTEXT_TRANSFERED_BYTES] = mResponseTransferedBytes; + lldebugs << this << "Setting context to " << context << llendl; return STATUS_DONE; default: PUMP_DEBUG; + context[CONTEXT_REQUEST][CONTEXT_TRANSFERED_BYTES] = mRequestTransferedBytes; + context[CONTEXT_RESPONSE][CONTEXT_TRANSFERED_BYTES] = mResponseTransferedBytes; + lldebugs << this << "Setting context to " << context << llendl; return STATUS_ERROR; } } @@ -333,6 +418,8 @@ void LLURLRequest::initialize() mDetail->mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1); mDetail->mCurlRequest->setWriteCallback(&downCallback, (void*)this); mDetail->mCurlRequest->setReadCallback(&upCallback, (void*)this); + mRequestTransferedBytes = 0; + mResponseTransferedBytes = 0; } bool LLURLRequest::configure() @@ -386,6 +473,13 @@ bool LLURLRequest::configure() rv = true; break; + case HTTP_MOVE: + // Set the handle for an http post + mDetail->mCurlRequest->setoptString(CURLOPT_CUSTOMREQUEST, "MOVE"); + // *NOTE: should we check for the Destination header? + rv = true; + break; + default: llwarns << "Unhandled URLRequest action: " << mAction << llendl; break; @@ -428,6 +522,8 @@ size_t LLURLRequest::downCallback( req->mDetail->mChannels.out(), (U8*)data, bytes); + req->mResponseTransferedBytes += bytes; + req->mDetail->mByteAccumulator += bytes; return bytes; } @@ -450,63 +546,76 @@ size_t LLURLRequest::upCallback( req->mDetail->mLastRead, (U8*)data, bytes); + req->mRequestTransferedBytes += bytes; return bytes; } static size_t headerCallback(void* data, size_t size, size_t nmemb, void* user) { - const char* headerLine = (const char*)data; - size_t headerLen = size * nmemb; + const char* header_line = (const char*)data; + size_t header_len = size * nmemb; LLURLRequestComplete* complete = (LLURLRequestComplete*)user; + if (!complete || !header_line) + { + return header_len; + } + // *TODO: This should be a utility in llstring.h: isascii() - for (size_t i = 0; i < headerLen; ++i) + for (size_t i = 0; i < header_len; ++i) { - if (headerLine[i] < 0) + if (header_line[i] < 0) { - return headerLen; + return header_len; } } - size_t sep; - for (sep = 0; sep < headerLen && headerLine[sep] != ':'; ++sep) { } - - if (sep < headerLen && complete) - { - std::string key(headerLine, sep); - std::string value(headerLine + sep + 1, headerLen - sep - 1); - - key = utf8str_tolower(utf8str_trim(key)); - value = utf8str_trim(value); + std::string header(header_line, header_len); - complete->header(key, value); - } - else + // Per HTTP spec the first header line must be the status line. + if (header.substr(0,5) == "HTTP/") { - std::string s(headerLine, headerLen); - - std::string::iterator end = s.end(); - std::string::iterator pos1 = std::find(s.begin(), end, ' '); + std::string::iterator end = header.end(); + std::string::iterator pos1 = std::find(header.begin(), end, ' '); if (pos1 != end) ++pos1; std::string::iterator pos2 = std::find(pos1, end, ' '); if (pos2 != end) ++pos2; std::string::iterator pos3 = std::find(pos2, end, '\r'); - std::string version(s.begin(), pos1); + std::string version(header.begin(), pos1); std::string status(pos1, pos2); std::string reason(pos2, pos3); - int statusCode = atoi(status.c_str()); - if (statusCode > 0) + S32 status_code = atoi(status.c_str()); + if (status_code > 0) { - if (complete) - { - complete->httpStatus((U32)statusCode, reason); - } + complete->httpStatus((U32)status_code, reason); + return header_len; } } - return headerLen; + std::string::iterator sep = std::find(header.begin(),header.end(),':'); + + if (sep != header.end()) + { + std::string key(header.begin(), sep); + std::string value(sep + 1, header.end()); + + key = utf8str_tolower(utf8str_trim(key)); + value = utf8str_trim(value); + + complete->header(key, value); + } + else + { + LLStringUtil::trim(header); + if (!header.empty()) + { + llwarns << "Unable to parse header: " << header << llendl; + } + } + + return header_len; } /** @@ -536,7 +645,7 @@ LLIOPipe::EStatus LLContextURLExtractor::process_impl( // find the context url if(context.has(CONTEXT_DEST_URI_SD_LABEL)) { - mRequest->setURL(context[CONTEXT_DEST_URI_SD_LABEL]); + mRequest->setURL(context[CONTEXT_DEST_URI_SD_LABEL].asString()); return STATUS_DONE; } return STATUS_ERROR; @@ -564,11 +673,6 @@ void LLURLRequestComplete::header(const std::string& header, const std::string& } //virtual -void LLURLRequestComplete::httpStatus(U32 status, const std::string& reason) -{ -} - -//virtual void LLURLRequestComplete::complete(const LLChannelDescriptors& channels, const buffer_ptr_t& buffer) { diff --git a/indra/llmessage/llurlrequest.h b/indra/llmessage/llurlrequest.h index 288bf463f5..ec5c2c1941 100644 --- a/indra/llmessage/llurlrequest.h +++ b/indra/llmessage/llurlrequest.h @@ -4,30 +4,25 @@ * @date 2005-04-21 * @brief Declaration of url based requests on pipes. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -43,6 +38,14 @@ #include "lliopipe.h" #include "llchainio.h" #include "llerror.h" +#include <openssl/x509_vfy.h> +#include "llcurl.h" + + +extern const std::string CONTEXT_REQUEST; +extern const std::string CONTEXT_DEST_URI_SD_LABEL; +extern const std::string CONTEXT_RESPONSE; +extern const std::string CONTEXT_TRANSFERED_BYTES; class LLURLRequestDetail; @@ -65,6 +68,8 @@ class LLURLRequest : public LLIOPipe { LOG_CLASS(LLURLRequest); public: + + typedef int (* SSLCertVerifyCallback)(X509_STORE_CTX *ctx, void *param); /** * @brief This enumeration is for specifying the type of request. */ @@ -76,9 +81,15 @@ public: HTTP_PUT, HTTP_POST, HTTP_DELETE, + HTTP_MOVE, // Caller will need to set 'Destination' header REQUEST_ACTION_COUNT }; + /** + * @brief Turn the requst action into an http verb. + */ + static std::string actionAsVerb(ERequestAction action); + /** * @brief Constructor. * @@ -112,7 +123,7 @@ public: * */ void setURL(const std::string& url); - + std::string getURL() const; /** * @brief Add a header to the http post. * @@ -130,8 +141,9 @@ public: * Set whether request will check that remote server * certificates are signed by a known root CA when using HTTPS. */ - void checkRootCertificate(bool check); + void setSSLVerifyCallback(SSLCertVerifyCallback callback, void * param); + /** * @brief Return at most size bytes of body. * @@ -171,11 +183,17 @@ public: */ void useProxy(const std::string& proxy); + /** + * @brief Turn on cookie handling for this request with CURLOPT_COOKIEFILE. + */ + void allowCookies(); + public: /** * @brief Give this pipe a chance to handle a generated error */ virtual EStatus handleError(EStatus status, LLPumpIO* pump); + protected: /** @@ -201,7 +219,11 @@ protected: ERequestAction mAction; LLURLRequestDetail* mDetail; LLIOPipe::ptr_t mCompletionCallback; + S32 mRequestTransferedBytes; + S32 mResponseTransferedBytes; + static CURLcode _sslCtxCallback(CURL * curl, void *sslctx, void *param); + private: /** * @brief Initialize the object. Called during construction. @@ -285,11 +307,13 @@ class LLURLRequestComplete : public LLIOPipe { public: + // Called once for each header received, except status lines virtual void header(const std::string& header, const std::string& value); - ///< Called once for each header received, prior to httpStatus - virtual void httpStatus(U32 status, const std::string& reason); - ///< Always called on request completion, prior to complete + // May be called more than once, particularly for redirects and proxy madness. + // Ex. a 200 for a connection to https through a proxy, followed by the "real" status + // a 3xx for a redirect followed by a "real" status, or more redirects. + virtual void httpStatus(U32 status, const std::string& reason) { } virtual void complete( const LLChannelDescriptors& channels, @@ -347,62 +371,6 @@ protected: }; -/** - * @class LLURLRequestClientFactory - * @brief Template class to build url request based client chains - * - * This class eases construction of a basic sd rpc client. Here is an - * example of it's use: - * <code> - * class LLUsefulService : public LLService { ... }<br> - * LLService::registerCreator(<br> - * "useful",<br> - * LLService::creator_t(new LLURLRequestClientFactory<LLUsefulService>))<br> - * </code> - * - * This class should work, but I never got around to using/testing it. - * - */ -#if 0 -template<class Client> -class LLURLRequestClientFactory : public LLChainIOFactory -{ -public: - LLURLRequestClientFactory(LLURLRequest::ERequestAction action) {} - LLURLRequestClientFactory( - LLURLRequest::ERequestAction action, - const std::string& fixed_url) : - mAction(action), - mURL(fixed_url) - { - } - virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const - { - lldebugs << "LLURLRequestClientFactory::build" << llendl; - LLIOPipe::ptr_t service(new Client); - chain.push_back(service); - LLURLRequest* http(new LLURLRequest(mAction)); - LLIOPipe::ptr_t http_pipe(http); - // *FIX: how do we know the content type? - //http->addHeader("Content-Type: text/llsd"); - if(mURL.empty()) - { - chain.push_back(LLIOPipe::ptr_t(new LLContextURLExtractor(http))); - } - else - { - http->setURL(mURL); - } - chain.push_back(http_pipe); - chain.push_back(service); - return true; - } - -protected: - LLURLRequest::ERequestAction mAction; - std::string mURL; -}; -#endif /** * External constants diff --git a/indra/llmessage/lluseroperation.cpp b/indra/llmessage/lluseroperation.cpp index 9ba70cc902..a4a68d0c81 100644 --- a/indra/llmessage/lluseroperation.cpp +++ b/indra/llmessage/lluseroperation.cpp @@ -2,30 +2,25 @@ * @file lluseroperation.cpp * @brief LLUserOperation class definition. * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/lluseroperation.h b/indra/llmessage/lluseroperation.h index 5006809e1c..7db5f0b27f 100644 --- a/indra/llmessage/lluseroperation.h +++ b/indra/llmessage/lluseroperation.h @@ -3,30 +3,25 @@ * @brief LLUserOperation class header file - used for message based * transaction. For example, L$ transactions. * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llvehicleparams.h b/indra/llmessage/llvehicleparams.h index bfc2a4a0eb..f34df7744e 100644 --- a/indra/llmessage/llvehicleparams.h +++ b/indra/llmessage/llvehicleparams.h @@ -3,30 +3,25 @@ * @brief For parameter names that must be shared between the * scripting language and the LLVehicleAction class on the simulator. * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llxfer.cpp b/indra/llmessage/llxfer.cpp index fefb6f9c63..f8c55d52ad 100644 --- a/indra/llmessage/llxfer.cpp +++ b/indra/llmessage/llxfer.cpp @@ -2,30 +2,25 @@ * @file llxfer.cpp * @brief implementation of LLXfer class for a single xfer. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -55,7 +50,7 @@ LLXfer::LLXfer (S32 chunk_size) LLXfer::~LLXfer () { - free(); + cleanup(); } /////////////////////////////////////////////////////////// @@ -73,6 +68,7 @@ void LLXfer::init (S32 chunk_size) mCallback = NULL; mCallbackDataHandle = NULL; + mCallbackResult = 0; mBufferContainsEOF = FALSE; mBuffer = NULL; @@ -90,7 +86,7 @@ void LLXfer::init (S32 chunk_size) /////////////////////////////////////////////////////////// -void LLXfer::free () +void LLXfer::cleanup () { if (mBuffer) { @@ -103,7 +99,7 @@ void LLXfer::free () S32 LLXfer::startSend (U64 xfer_id, const LLHost &remote_host) { - llwarns << "undifferentiated LLXfer::startSend for " << getName() << llendl; + llwarns << "undifferentiated LLXfer::startSend for " << getFileName() << llendl; return (-1); } @@ -119,7 +115,7 @@ void LLXfer::setXferSize (S32 xfer_size) S32 LLXfer::startDownload() { - llwarns << "undifferentiated LLXfer::startDownload for " << getName() + llwarns << "undifferentiated LLXfer::startDownload for " << getFileName() << llendl; return (-1); } @@ -293,13 +289,13 @@ S32 LLXfer::processEOF() if (LL_ERR_NOERR == mCallbackResult) { - llinfos << "xfer from " << mRemoteHost << " complete: " << getName() + llinfos << "xfer from " << mRemoteHost << " complete: " << getFileName() << llendl; } else { llinfos << "xfer from " << mRemoteHost << " failed, code " - << mCallbackResult << ": " << getName() << llendl; + << mCallbackResult << ": " << getFileName() << llendl; } if (mCallback) @@ -327,7 +323,7 @@ void LLXfer::abort (S32 result_code) { mCallbackResult = result_code; - llinfos << "Aborting xfer from " << mRemoteHost << " named " << getName() + llinfos << "Aborting xfer from " << mRemoteHost << " named " << getFileName() << " - error: " << result_code << llendl; gMessageSystem->newMessageFast(_PREHASH_AbortXfer); @@ -343,11 +339,9 @@ void LLXfer::abort (S32 result_code) /////////////////////////////////////////////////////////// -const char * LLXfer::getName() +std::string LLXfer::getFileName() { - static char tmp_str[256]; /* Flawfinder: ignore */ - - return (U64_to_str(mID, tmp_str, sizeof(tmp_str))); + return U64_to_str(mID); } /////////////////////////////////////////////////////////// @@ -367,7 +361,7 @@ S32 LLXfer::getMaxBufferSize () std::ostream& operator<< (std::ostream& os, LLXfer &hh) { - os << hh.getName() ; + os << hh.getFileName() ; return os; } diff --git a/indra/llmessage/llxfer.h b/indra/llmessage/llxfer.h index 017a521b81..989e8b2cab 100644 --- a/indra/llmessage/llxfer.h +++ b/indra/llmessage/llxfer.h @@ -2,30 +2,25 @@ * @file llxfer.h * @brief definition of LLXfer class for a single xfer * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -88,7 +83,7 @@ class LLXfer virtual ~LLXfer(); void init(S32 chunk_size); - virtual void free(); + virtual void cleanup(); virtual S32 startSend (U64 xfer_id, const LLHost &remote_host); virtual void sendPacket(S32 packet_num); @@ -106,7 +101,7 @@ class LLXfer virtual void setXferSize (S32 data_size); virtual S32 getMaxBufferSize(); - virtual const char *getName(); + virtual std::string getFileName(); virtual U32 getXferTypeTag(); diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp index caa418e564..9e02af2c3e 100644 --- a/indra/llmessage/llxfer_file.cpp +++ b/indra/llmessage/llxfer_file.cpp @@ -2,30 +2,25 @@ * @file llxfer_file.cpp * @brief implementation of LLXfer_File class for a single xfer (file) * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -47,17 +42,17 @@ const U32 LL_MAX_XFER_FILE_BUFFER = 65536; // local function to copy a file -S32 copy_file(const char* from, const char* to); +S32 copy_file(const std::string& from, const std::string& to); /////////////////////////////////////////////////////////// LLXfer_File::LLXfer_File (S32 chunk_size) : LLXfer(chunk_size) { - init(LLString::null, FALSE, chunk_size); + init(LLStringUtil::null, FALSE, chunk_size); } -LLXfer_File::LLXfer_File (const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size) +LLXfer_File::LLXfer_File (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size) : LLXfer(chunk_size) { init(local_filename, delete_local_on_completion, chunk_size); @@ -67,35 +62,35 @@ LLXfer_File::LLXfer_File (const LLString& local_filename, BOOL delete_local_on_c LLXfer_File::~LLXfer_File () { - free(); + cleanup(); } /////////////////////////////////////////////////////////// -void LLXfer_File::init (const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size) +void LLXfer_File::init (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size) { mFp = NULL; - mLocalFilename[0] = 0; - mRemoteFilename[0] = 0; + mLocalFilename.clear(); + mRemoteFilename.clear(); mRemotePath = LL_PATH_NONE; - mTempFilename[0] = 0; + mTempFilename.clear(); mDeleteLocalOnCompletion = FALSE; mDeleteRemoteOnCompletion = FALSE; if (!local_filename.empty()) { - strncpy(mLocalFilename, local_filename.c_str(), LL_MAX_PATH-1); - mLocalFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy. + mLocalFilename = local_filename.substr(0,LL_MAX_PATH-1); // You can only automatically delete .tmp file as a safeguard against nasty messages. - mDeleteLocalOnCompletion = (delete_local_on_completion && (strstr(mLocalFilename,".tmp") == &mLocalFilename[strlen(mLocalFilename)-4])); /* Flawfinder : ignore */ + std::string exten = mLocalFilename.substr(mLocalFilename.length()-4, 4); + mDeleteLocalOnCompletion = (delete_local_on_completion && exten == ".tmp"); } } /////////////////////////////////////////////////////////// -void LLXfer_File::free () +void LLXfer_File::cleanup () { if (mFp) { @@ -115,14 +110,14 @@ void LLXfer_File::free () lldebugs << "Keeping local file: " << mLocalFilename << llendl; } - LLXfer::free(); + LLXfer::cleanup(); } /////////////////////////////////////////////////////////// S32 LLXfer_File::initializeRequest(U64 xfer_id, - const LLString& local_filename, - const LLString& remote_filename, + const std::string& local_filename, + const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -132,15 +127,13 @@ S32 LLXfer_File::initializeRequest(U64 xfer_id, S32 retval = 0; // presume success mID = xfer_id; - strncpy(mLocalFilename, local_filename.c_str(), LL_MAX_PATH-1); - mLocalFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy. - strncpy(mRemoteFilename,remote_filename.c_str(), LL_MAX_PATH-1); - mRemoteFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy. + mLocalFilename = local_filename; + mRemoteFilename = remote_filename; mRemotePath = remote_path; mRemoteHost = remote_host; mDeleteRemoteOnCompletion = delete_remote_on_completion; - snprintf(mTempFilename, sizeof(mTempFilename), "%s",gDirUtilp->getTempFilename().c_str()); /* Flawfinder: ignore */ + mTempFilename = gDirUtilp->getTempFilename(); mCallback = callback; mCallbackDataHandle = user_data; @@ -343,7 +336,7 @@ S32 LLXfer_File::processEOF() if(copy_file(mTempFilename, mLocalFilename) == 0) { llinfos << "Rename across mounts; copying+unlinking the file instead." << llendl; - unlink(mTempFilename); + unlink(mTempFilename.c_str()); } else { @@ -353,7 +346,7 @@ S32 LLXfer_File::processEOF() } else { - //FILE* fp = LLFile::fopen(mTempFilename, "r"); + //LLFILE* fp = LLFile::fopen(mTempFilename, "r"); //llwarns << "File " << mTempFilename << " does " // << (!fp ? "not" : "" ) << " exit." << llendl; //if(fp) fclose(fp); @@ -384,14 +377,14 @@ S32 LLXfer_File::processEOF() /////////////////////////////////////////////////////////// -BOOL LLXfer_File::matchesLocalFilename(const LLString& filename) +BOOL LLXfer_File::matchesLocalFilename(const std::string& filename) { return (filename == mLocalFilename); } /////////////////////////////////////////////////////////// -BOOL LLXfer_File::matchesRemoteFilename(const LLString& filename, ELLPath remote_path) +BOOL LLXfer_File::matchesRemoteFilename(const std::string& filename, ELLPath remote_path) { return ((filename == mRemoteFilename) && (remote_path == mRemotePath)); } @@ -399,9 +392,9 @@ BOOL LLXfer_File::matchesRemoteFilename(const LLString& filename, ELLPath remote /////////////////////////////////////////////////////////// -const char * LLXfer_File::getName() +std::string LLXfer_File::getFileName() { - return (mLocalFilename); + return mLocalFilename; } /////////////////////////////////////////////////////////// @@ -421,11 +414,11 @@ U32 LLXfer_File::getXferTypeTag() // function. It does not really spam enough information, but is useful // for this cpp file, because this should never be called in a // production environment. -S32 copy_file(const char* from, const char* to) +S32 copy_file(const std::string& from, const std::string& to) { S32 rv = 0; - FILE* in = LLFile::fopen(from, "rb"); /*Flawfinder: ignore*/ - FILE* out = LLFile::fopen(to, "wb"); /*Flawfinder: ignore*/ + LLFILE* in = LLFile::fopen(from, "rb"); /*Flawfinder: ignore*/ + LLFILE* out = LLFile::fopen(to, "wb"); /*Flawfinder: ignore*/ if(in && out) { S32 read = 0; diff --git a/indra/llmessage/llxfer_file.h b/indra/llmessage/llxfer_file.h index b87417d290..a37dda6732 100644 --- a/indra/llmessage/llxfer_file.h +++ b/indra/llmessage/llxfer_file.h @@ -2,30 +2,25 @@ * @file llxfer_file.h * @brief definition of LLXfer_File class for a single xfer_file. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -38,26 +33,26 @@ class LLXfer_File : public LLXfer { protected: - FILE *mFp; - char mLocalFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ - char mRemoteFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ + LLFILE *mFp; + std::string mLocalFilename; + std::string mRemoteFilename; ELLPath mRemotePath; - char mTempFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ + std::string mTempFilename; BOOL mDeleteLocalOnCompletion; BOOL mDeleteRemoteOnCompletion; public: LLXfer_File (S32 chunk_size); - LLXfer_File (const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size); + LLXfer_File (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size); virtual ~LLXfer_File(); - virtual void init(const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size); - virtual void free(); + virtual void init(const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size); + virtual void cleanup(); virtual S32 initializeRequest(U64 xfer_id, - const LLString& local_filename, - const LLString& remote_filename, + const std::string& local_filename, + const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -72,14 +67,14 @@ class LLXfer_File : public LLXfer virtual S32 suck(S32 start_position); virtual S32 flush(); - virtual BOOL matchesLocalFilename(const LLString& filename); - virtual BOOL matchesRemoteFilename(const LLString& filename, ELLPath remote_path); + virtual BOOL matchesLocalFilename(const std::string& filename); + virtual BOOL matchesRemoteFilename(const std::string& filename, ELLPath remote_path); virtual S32 getMaxBufferSize(); virtual U32 getXferTypeTag(); - virtual const char *getName(); + virtual std::string getFileName(); }; #endif diff --git a/indra/llmessage/llxfer_mem.cpp b/indra/llmessage/llxfer_mem.cpp index 4c3b1bbebb..4c7e83c33d 100644 --- a/indra/llmessage/llxfer_mem.cpp +++ b/indra/llmessage/llxfer_mem.cpp @@ -2,30 +2,25 @@ * @file llxfer_mem.cpp * @brief implementation of LLXfer_Mem class for a single xfer * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -48,23 +43,23 @@ LLXfer_Mem::LLXfer_Mem () LLXfer_Mem::~LLXfer_Mem () { - free(); + cleanup(); } /////////////////////////////////////////////////////////// void LLXfer_Mem::init () { - mRemoteFilename[0] = '\0'; + mRemoteFilename.clear(); mRemotePath = LL_PATH_NONE; mDeleteRemoteOnCompletion = FALSE; } /////////////////////////////////////////////////////////// -void LLXfer_Mem::free () +void LLXfer_Mem::cleanup () { - LLXfer::free(); + LLXfer::cleanup(); } /////////////////////////////////////////////////////////// @@ -120,7 +115,7 @@ S32 LLXfer_Mem::startSend (U64 xfer_id, const LLHost &remote_host) mID = xfer_id; mPacketNum = -1; -// cout << "Sending file: " << getName() << endl; +// cout << "Sending file: " << getFileName() << endl; mStatus = e_LL_XFER_PENDING; @@ -135,7 +130,7 @@ S32 LLXfer_Mem::processEOF() mStatus = e_LL_XFER_COMPLETE; - llinfos << "xfer complete: " << getName() << llendl; + llinfos << "xfer complete: " << getFileName() << llendl; if (mCallback) { @@ -165,8 +160,7 @@ S32 LLXfer_Mem::initializeRequest(U64 xfer_id, mCallbackDataHandle = user_data; mCallbackResult = LL_ERR_NOERR; - strncpy(mRemoteFilename, remote_filename.c_str(), LL_MAX_PATH-1); - mRemoteFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy. + mRemoteFilename = remote_filename; mRemotePath = remote_path; mDeleteRemoteOnCompletion = delete_remote_on_completion; diff --git a/indra/llmessage/llxfer_mem.h b/indra/llmessage/llxfer_mem.h index 858b8d1323..b5adf837df 100644 --- a/indra/llmessage/llxfer_mem.h +++ b/indra/llmessage/llxfer_mem.h @@ -2,30 +2,25 @@ * @file llxfer_mem.h * @brief definition of LLXfer_Mem class for a single xfer * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -42,7 +37,7 @@ class LLXfer_Mem : public LLXfer private: protected: void (*mCallback)(void *, S32, void **, S32, LLExtStat); - char mRemoteFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ + std::string mRemoteFilename; ELLPath mRemotePath; BOOL mDeleteRemoteOnCompletion; @@ -55,7 +50,7 @@ class LLXfer_Mem : public LLXfer virtual ~LLXfer_Mem(); virtual void init(); - virtual void free(); + virtual void cleanup(); virtual S32 startSend (U64 xfer_id, const LLHost &remote_host); virtual U64 registerXfer(U64 xfer_id, const void *datap, const S32 length); diff --git a/indra/llmessage/llxfer_vfile.cpp b/indra/llmessage/llxfer_vfile.cpp index b870e5369d..751a69518c 100644 --- a/indra/llmessage/llxfer_vfile.cpp +++ b/indra/llmessage/llxfer_vfile.cpp @@ -2,30 +2,25 @@ * @file llxfer_vfile.cpp * @brief implementation of LLXfer_VFile class for a single xfer (vfile). * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -60,7 +55,7 @@ LLXfer_VFile::LLXfer_VFile (LLVFS *vfs, const LLUUID &local_id, LLAssetType::ETy LLXfer_VFile::~LLXfer_VFile () { - free(); + cleanup(); } /////////////////////////////////////////////////////////// @@ -74,15 +69,15 @@ void LLXfer_VFile::init (LLVFS *vfs, const LLUUID &local_id, LLAssetType::EType mVFile = NULL; - char id_string[UUID_STR_LENGTH]; /* Flawfinder : ignore */ + std::string id_string; mLocalID.toString(id_string); - snprintf(mName, sizeof(mName), "VFile %s:%s", id_string, LLAssetType::lookup(mType)); /* Flawfinder : ignore */ + mName = llformat("VFile %s:%s", id_string.c_str(), LLAssetType::lookup(mType)); } /////////////////////////////////////////////////////////// -void LLXfer_VFile::free () +void LLXfer_VFile::cleanup () { LLVFile file(mVFS, mTempID, mType, LLVFile::WRITE); file.remove(); @@ -90,7 +85,7 @@ void LLXfer_VFile::free () delete mVFile; mVFile = NULL; - LLXfer::free(); + LLXfer::cleanup(); } /////////////////////////////////////////////////////////// @@ -118,10 +113,10 @@ S32 LLXfer_VFile::initializeRequest(U64 xfer_id, mCallbackDataHandle = user_data; mCallbackResult = LL_ERR_NOERR; - char id_string[UUID_STR_LENGTH]; /* Flawfinder : ignore */ + std::string id_string; mLocalID.toString(id_string); - snprintf(mName, sizeof(mName), "VFile %s:%s", id_string, LLAssetType::lookup(mType)); /* Flawfinder : ignore */ + mName = llformat("VFile %s:%s", id_string.c_str(), LLAssetType::lookup(mType)); llinfos << "Requesting " << mName << llendl; @@ -328,7 +323,7 @@ BOOL LLXfer_VFile::matchesRemoteFile(const LLUUID &id, LLAssetType::EType type) ////////////////////////////////////////////////////////// -const char * LLXfer_VFile::getName() +std::string LLXfer_VFile::getFileName() { return mName; } diff --git a/indra/llmessage/llxfer_vfile.h b/indra/llmessage/llxfer_vfile.h index 5d57b08e3c..048bf49dcc 100644 --- a/indra/llmessage/llxfer_vfile.h +++ b/indra/llmessage/llxfer_vfile.h @@ -2,30 +2,25 @@ * @file llxfer_vfile.h * @brief definition of LLXfer_VFile class for a single xfer_vfile. * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -50,7 +45,7 @@ class LLXfer_VFile : public LLXfer LLVFS *mVFS; - char mName[MAX_STRING]; /* Flawfinder : ignore */ + std::string mName; public: LLXfer_VFile (); @@ -58,7 +53,7 @@ class LLXfer_VFile : public LLXfer virtual ~LLXfer_VFile(); virtual void init(LLVFS *vfs, const LLUUID &local_id, LLAssetType::EType type); - virtual void free(); + virtual void cleanup(); virtual S32 initializeRequest(U64 xfer_id, LLVFS *vfs, @@ -85,7 +80,7 @@ class LLXfer_VFile : public LLXfer virtual U32 getXferTypeTag(); - virtual const char *getName(); + virtual std::string getFileName(); }; #endif diff --git a/indra/llmessage/llxfermanager.cpp b/indra/llmessage/llxfermanager.cpp index a612e181cd..b9cddc8e45 100644 --- a/indra/llmessage/llxfermanager.cpp +++ b/indra/llmessage/llxfermanager.cpp @@ -2,30 +2,25 @@ * @file llxfermanager.cpp * @brief implementation of LLXferManager class for a collection of xfers * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -64,7 +59,7 @@ LLXferManager::LLXferManager (LLVFS *vfs) LLXferManager::~LLXferManager () { - free(); + cleanup(); } /////////////////////////////////////////////////////////// @@ -86,7 +81,7 @@ void LLXferManager::init (LLVFS *vfs) /////////////////////////////////////////////////////////// -void LLXferManager::free () +void LLXferManager::cleanup () { LLXfer *xferp; LLXfer *delp; @@ -143,8 +138,8 @@ void LLXferManager::setAckThrottleBPS(const F32 bps) // Set F32 actual_rate = llmax(min_bps*1.1f, bps); - llinfos << "LLXferManager ack throttle min rate: " << min_bps << llendl; - llinfos << "LLXferManager ack throttle actual rate: " << actual_rate << llendl; + LL_DEBUGS("AppInit") << "LLXferManager ack throttle min rate: " << min_bps << LL_ENDL; + LL_DEBUGS("AppInit") << "LLXferManager ack throttle actual rate: " << actual_rate << LL_ENDL; mAckThrottle.setRate(actual_rate); } @@ -406,8 +401,8 @@ U64 LLXferManager::registerXfer(const void *datap, const S32 length) /////////////////////////////////////////////////////////// -void LLXferManager::requestFile(const char* local_filename, - const char* remote_filename, +void LLXferManager::requestFile(const std::string& local_filename, + const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -444,7 +439,7 @@ void LLXferManager::requestFile(const char* local_filename, // Note: according to AaronB, this is here to deal with locks on files that were // in transit during a crash, if(delete_remote_on_completion && - (strstr(remote_filename,".tmp") == &remote_filename[strlen(remote_filename)-4])) /* Flawfinder : ignore */ + (remote_filename.substr(remote_filename.length()-4) == ".tmp")) { LLFile::remove(local_filename); } @@ -464,7 +459,7 @@ void LLXferManager::requestFile(const char* local_filename, } } -void LLXferManager::requestFile(const char* remote_filename, +void LLXferManager::requestFile(const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -540,7 +535,7 @@ void LLXferManager::requestVFile(const LLUUID& local_id, /* void LLXferManager::requestXfer( - const char *local_filename, + const std::string& local_filename, BOOL delete_remote_on_completion, U64 xfer_id, const LLHost &remote_host, @@ -634,11 +629,11 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user // confirm it if it was a resend of the last one, since the confirmation might have gotten dropped if (decodePacketNum(packetnum) == (xferp->mPacketNum - 1)) { - llinfos << "Reconfirming xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " packet " << packetnum << llendl; sendConfirmPacket(mesgsys, id, decodePacketNum(packetnum), mesgsys->getSender()); + llinfos << "Reconfirming xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet " << packetnum << llendl; sendConfirmPacket(mesgsys, id, decodePacketNum(packetnum), mesgsys->getSender()); } else { - llinfos << "Ignoring xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " recv'd packet " << packetnum << "; expecting " << xferp->mPacketNum << llendl; + llinfos << "Ignoring xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " recv'd packet " << packetnum << "; expecting " << xferp->mPacketNum << llendl; } return; } @@ -713,11 +708,89 @@ void LLXferManager::sendConfirmPacket (LLMessageSystem *mesgsys, U64 id, S32 pac /////////////////////////////////////////////////////////// +static bool find_and_remove(std::multiset<std::string>& files, + const std::string& filename) +{ + std::multiset<std::string>::iterator ptr; + if ( (ptr = files.find(filename)) != files.end()) + { + //erase(filename) erases *all* entries with that key + files.erase(ptr); + return true; + } + return false; +} + +void LLXferManager::expectFileForRequest(const std::string& filename) +{ + mExpectedRequests.insert(filename); +} + +bool LLXferManager::validateFileForRequest(const std::string& filename) +{ + return find_and_remove(mExpectedRequests, filename); +} + +void LLXferManager::expectFileForTransfer(const std::string& filename) +{ + mExpectedTransfers.insert(filename); +} + +bool LLXferManager::validateFileForTransfer(const std::string& filename) +{ + return find_and_remove(mExpectedTransfers, filename); +} + +static bool remove_prefix(std::string& filename, const std::string& prefix) +{ + if (std::equal(prefix.begin(), prefix.end(), filename.begin())) + { + filename = filename.substr(prefix.length()); + return true; + } + return false; +} + +static bool verify_cache_filename(const std::string& filename) +{ + //NOTE: This routine is only used to check file names that our own + // code places in the cache directory. As such, it can be limited + // to this very restrictive file name pattern. It does not need to + // handle other characters. The only known uses of this are (with examples): + // sim to sim object pass: fc0b72d8-9456-63d9-a802-a557ef847313.tmp + // sim to viewer mute list: mute_b78eacd0-1244-448e-93ca-28ede242f647.tmp + // sim to viewer task inventory: inventory_d8ab59d2-baf0-0e79-c4c2-a3f99b9fcf45.tmp + + //IMPORTANT: Do not broaden the filenames accepted by this routine + // without careful analysis. Anything allowed by this function can + // be downloaded by the viewer. + + size_t len = filename.size(); + //const boost::regex expr("[0-9a-zA-Z_-]<1,46>\.tmp"); + if (len < 5 || len > 50) + { + return false; + } + for(size_t i=0; i<(len-4); ++i) + { + char c = filename[i]; + bool ok = isalnum(c) || '_'==c || '-'==c; + if (!ok) + { + return false; + } + } + return filename[len-4] == '.' + && filename[len-3] == 't' + && filename[len-2] == 'm' + && filename[len-1] == 'p'; +} + void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user_data*/) { U64 id; - char local_filename[MAX_STRING]; /* Flawfinder : ignore */ + std::string local_filename; ELLPath local_path = LL_PATH_NONE; S32 result = LL_ERR_NOERR; LLUUID uuid; @@ -732,18 +805,13 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user llinfos << "xfer request id: " << U64_to_str(id, U64_BUF, sizeof(U64_BUF)) << " to " << mesgsys->getSender() << llendl; - mesgsys->getStringFast(_PREHASH_XferID, _PREHASH_Filename, MAX_STRING, local_filename); + mesgsys->getStringFast(_PREHASH_XferID, _PREHASH_Filename, local_filename); - U8 local_path_u8; - mesgsys->getU8("XferID", "FilePath", local_path_u8); - if( local_path_u8 < (U8)LL_PATH_COUNT ) { + U8 local_path_u8; + mesgsys->getU8("XferID", "FilePath", local_path_u8); local_path = (ELLPath)local_path_u8; } - else - { - llwarns << "Invalid file path in LLXferManager::processFileRequest() " << (U32)local_path_u8 << llendl; - } mesgsys->getUUIDFast(_PREHASH_XferID, _PREHASH_VFileID, uuid); mesgsys->getS16Fast(_PREHASH_XferID, _PREHASH_VFileType, type_s16); @@ -780,8 +848,45 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user llerrs << "Xfer allcoation error" << llendl; } } - else if (strlen(local_filename)) /* Flawfinder : ignore */ + else if (!local_filename.empty()) { + // See DEV-21775 for detailed security issues + + if (local_path == LL_PATH_NONE) + { + // this handles legacy simulators that are passing objects + // by giving a filename that explicitly names the cache directory + static const std::string legacy_cache_prefix = "data/"; + if (remove_prefix(local_filename, legacy_cache_prefix)) + { + local_path = LL_PATH_CACHE; + } + } + + switch (local_path) + { + case LL_PATH_NONE: + if(!validateFileForTransfer(local_filename)) + { + llwarns << "SECURITY: Unapproved filename '" << local_filename << llendl; + return; + } + break; + + case LL_PATH_CACHE: + if(!verify_cache_filename(local_filename)) + { + llwarns << "SECURITY: Illegal cache filename '" << local_filename << llendl; + return; + } + break; + + default: + llwarns << "SECURITY: Restricted file dir enum: " << (U32)local_path << llendl; + return; + } + + std::string expanded_filename = gDirUtilp->getExpandedFilename( local_path, local_filename ); llinfos << "starting file transfer: " << expanded_filename << " to " << mesgsys->getSender() << llendl; @@ -861,6 +966,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user } } + /////////////////////////////////////////////////////////// void LLXferManager::processConfirmation (LLMessageSystem *mesgsys, void ** /*user_data*/) @@ -923,7 +1029,7 @@ void LLXferManager::retransmitUnackedPackets () { if (xferp->mRetries > LL_PACKET_RETRY_LIMIT) { - llinfos << "dropping xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " packet retransmit limit exceeded, xfer dropped" << llendl; + llinfos << "dropping xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet retransmit limit exceeded, xfer dropped" << llendl; xferp->abort(LL_ERR_TCP_TIMEOUT); delp = xferp; xferp = xferp->mNext; @@ -931,7 +1037,7 @@ void LLXferManager::retransmitUnackedPackets () } else { - llinfos << "resending xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " packet unconfirmed after: "<< et << " sec, packet " << xferp->mPacketNum << llendl; + llinfos << "resending xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet unconfirmed after: "<< et << " sec, packet " << xferp->mPacketNum << llendl; xferp->resendLastPacket(); xferp = xferp->mNext; } @@ -946,7 +1052,7 @@ void LLXferManager::retransmitUnackedPackets () } else if (xferp->mStatus == e_LL_XFER_ABORTED) { - llwarns << "Removing aborted xfer " << xferp->mRemoteHost << ":" << xferp->getName() << llendl; + llwarns << "Removing aborted xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << llendl; delp = xferp; xferp = xferp->mNext; removeXfer(delp,&mSendList); diff --git a/indra/llmessage/llxfermanager.h b/indra/llmessage/llxfermanager.h index c4af8fe937..b84bccb5b7 100644 --- a/indra/llmessage/llxfermanager.h +++ b/indra/llmessage/llxfermanager.h @@ -3,30 +3,25 @@ * @brief definition of LLXferManager class for a keeping track of * multiple xfers * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -108,13 +103,15 @@ class LLXferManager // implementation methods virtual void startPendingDownloads(); virtual void addToList(LLXfer* xferp, LLXfer*& head, BOOL is_priority); + std::multiset<std::string> mExpectedTransfers; // files that are authorized to transfer out + std::multiset<std::string> mExpectedRequests; // files that are authorized to be downloaded on top of public: LLXferManager(LLVFS *vfs); virtual ~LLXferManager(); virtual void init(LLVFS *vfs); - virtual void free(); + virtual void cleanup(); void setUseAckThrottling(const BOOL use); void setAckThrottleBPS(const F32 bps); @@ -143,8 +140,8 @@ class LLXferManager // file requesting routines // .. to file - virtual void requestFile(const char* local_filename, - const char* remote_filename, + virtual void requestFile(const std::string& local_filename, + const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -153,7 +150,7 @@ class LLXferManager BOOL use_big_packets = FALSE); // .. to memory - virtual void requestFile(const char* remote_filename, + virtual void requestFile(const std::string& remote_filename, ELLPath remote_path, const LLHost &remote_host, BOOL delete_remote_on_completion, @@ -168,6 +165,20 @@ class LLXferManager const LLHost& remote_host, void (*callback)(void**,S32,LLExtStat), void** user_data, BOOL is_priority = FALSE); + /** + When arbitrary files are requested to be transfered (by giving a dir of LL_PATH_NONE) + they must be "expected", but having something pre-authorize them. This pair of functions + maintains a pre-authorized list. The first function adds something to the list, the second + checks if is authorized, removing it if so. In this way, a file is only authorized for + a single use. + */ + virtual void expectFileForTransfer(const std::string& filename); + virtual bool validateFileForTransfer(const std::string& filename); + /** + Same idea, but for the viewer about to call InitiateDownload to track what it requested. + */ + virtual void expectFileForRequest(const std::string& filename); + virtual bool validateFileForRequest(const std::string& filename); /* // xfer request (may be memory or file) diff --git a/indra/llmessage/llxorcipher.cpp b/indra/llmessage/llxorcipher.cpp index c659d3f7ec..9053e1b2f1 100644 --- a/indra/llmessage/llxorcipher.cpp +++ b/indra/llmessage/llxorcipher.cpp @@ -2,30 +2,25 @@ * @file llxorcipher.cpp * @brief Implementation of LLXORCipher * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/llxorcipher.h b/indra/llmessage/llxorcipher.h index 4c7a846b12..c5b0700f0d 100644 --- a/indra/llmessage/llxorcipher.h +++ b/indra/llmessage/llxorcipher.h @@ -1,30 +1,25 @@ /** * @file llxorcipher.h * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/machine.cpp b/indra/llmessage/machine.cpp new file mode 100644 index 0000000000..8d2f512037 --- /dev/null +++ b/indra/llmessage/machine.cpp @@ -0,0 +1,56 @@ +/** + * @file machine.cpp + * @brief LLMachine class header file + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "linden_common.h" + +#include "machine.h" + +#include "llerror.h" + +void LLMachine::setMachinePort(S32 port) +{ + if (port < 0) + { + llinfos << "Can't assign a negative number to LLMachine::mPort" << llendl; + mHost.setPort(0); + } + else + { + mHost.setPort(port); + } +} + +void LLMachine::setControlPort( S32 port ) +{ + if (port < 0) + { + llinfos << "Can't assign a negative number to LLMachine::mControlPort" << llendl; + mControlPort = 0; + } + else + { + mControlPort = port; + } +} diff --git a/indra/llmessage/machine.h b/indra/llmessage/machine.h index b2102504d4..07aadd47d2 100644 --- a/indra/llmessage/machine.h +++ b/indra/llmessage/machine.h @@ -2,37 +2,31 @@ * @file machine.h * @brief LLMachine class header file * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #ifndef LL_MACHINE_H #define LL_MACHINE_H -#include "llerror.h" #include "net.h" #include "llhost.h" @@ -78,31 +72,8 @@ public: void setMachineIP(U32 ip) { mHost.setAddress(ip); } void setMachineHost(const LLHost &host) { mHost = host; } - void setMachinePort(S32 port) - { - if (port < 0) - { - llinfos << "Can't assign a negative number to LLMachine::mPort" << llendl; - mHost.setPort(0); - } - else - { - mHost.setPort(port); - } - } - - void setControlPort( S32 port ) - { - if (port < 0) - { - llinfos << "Can't assign a negative number to LLMachine::mControlPort" << llendl; - mControlPort = 0; - } - else - { - mControlPort = port; - } - } + void setMachinePort(S32 port); + void setControlPort( S32 port ); // member variables diff --git a/indra/llmessage/mean_collision_data.h b/indra/llmessage/mean_collision_data.h index 1643c30594..29de091603 100644 --- a/indra/llmessage/mean_collision_data.h +++ b/indra/llmessage/mean_collision_data.h @@ -3,30 +3,25 @@ * @brief data type to log interactions between stuff and agents that * might be community standards violations * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -55,15 +50,13 @@ class LLMeanCollisionData public: LLMeanCollisionData(const LLUUID &victim, const LLUUID &perp, time_t time, EMeanCollisionType type, F32 mag) : mVictim(victim), mPerp(perp), mTime(time), mType(type), mMag(mag) - { mFirstName[0] = 0; mLastName[0] = 0; } + { + } LLMeanCollisionData(LLMeanCollisionData *mcd) - : mVictim(mcd->mVictim), mPerp(mcd->mPerp), mTime(mcd->mTime), mType(mcd->mType), mMag(mcd->mMag) - { - strncpy(mFirstName, mcd->mFirstName, sizeof(mFirstName) -1); /* Flawfinder: Ignore */ - mFirstName[sizeof(mFirstName) -1] = '\0'; - strncpy(mLastName, mcd->mLastName, sizeof(mLastName) -1); /* Flawfinder: Ignore */ - mLastName[sizeof(mLastName) -1] = '\0'; + : mVictim(mcd->mVictim), mPerp(mcd->mPerp), mTime(mcd->mTime), mType(mcd->mType), mMag(mcd->mMag), + mFullName(mcd->mFullName) + { } friend std::ostream& operator<<(std::ostream& s, const LLMeanCollisionData &a) @@ -96,8 +89,7 @@ public: time_t mTime; EMeanCollisionType mType; F32 mMag; - char mFirstName[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: Ignore */ - char mLastName[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: Ignore */ + std::string mFullName; }; diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index aca7a60bf1..2f0d815be5 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -2,30 +2,25 @@ * @file message.cpp * @brief LLMessageSystem class implementation * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -46,9 +41,9 @@ #include <sstream> #include "llapr.h" -#include "apr-1/apr_portable.h" -#include "apr-1/apr_network_io.h" -#include "apr-1/apr_poll.h" +#include "apr_portable.h" +#include "apr_network_io.h" +#include "apr_poll.h" // linden library headers #include "indra_constants.h" @@ -58,13 +53,16 @@ #include "llerrorlegacy.h" #include "llfasttimer.h" #include "llhttpclient.h" +#include "llhttpnodeadapter.h" #include "llhttpsender.h" #include "llmd5.h" #include "llmessagebuilder.h" #include "llmessageconfig.h" +#include "lltemplatemessagedispatcher.h" #include "llpumpio.h" #include "lltemplatemessagebuilder.h" #include "lltemplatemessagereader.h" +#include "lltrustedmessageservice.h" #include "llmessagetemplate.h" #include "llmessagetemplateparser.h" #include "llsd.h" @@ -82,6 +80,7 @@ #include "v3math.h" #include "v4math.h" #include "lltransfertargetvfile.h" +#include "llmemtype.h" // Constants //const char* MESSAGE_LOG_FILENAME = "message.log"; @@ -120,7 +119,7 @@ namespace // don't spam when agent communication disconnected already if (status != 410) { - llwarns << "error status " << status + LL_WARNS("Messaging") << "error status " << status << " for message " << mMessageName << " reason " << reason << llendl; } @@ -141,52 +140,6 @@ namespace }; } - -class LLTrustedMessageService : public LLHTTPNode -{ - virtual bool validate(const std::string& name, LLSD& context) const - { return true; } - - virtual void post(LLHTTPNode::ResponsePtr response, - const LLSD& context, - const LLSD& input) const; -}; - -//virtual -void LLTrustedMessageService::post(LLHTTPNode::ResponsePtr response, - const LLSD& context, - const LLSD& input) const -{ - std::string name = context["request"]["wildcard"]["message-name"]; - std::string senderIP = context["request"]["remote-host"]; - std::string senderPort = context["request"]["headers"] - ["x-secondlife-udp-listen-port"]; - - LLSD message_data; - std::string sender = senderIP + ":" + senderPort; - message_data["sender"] = sender; - message_data["body"] = input; - - // 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 { virtual bool validate(const std::string& name, LLSD& context) const @@ -201,7 +154,7 @@ 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()); + char* namePtr = LLMessageStringTable::getInstance()->getString(name.c_str()); lldebugs << "Setting mLastSender " << input["sender"].asString() << llendl; gMessageSystem->mLastSender = LLHost(input["sender"].asString()); @@ -222,9 +175,6 @@ void LLMessageHandlerBridge::post(LLHTTPNode::ResponsePtr response, LLHTTPRegistration<LLMessageHandlerBridge> gHTTPRegistrationMessageWildcard("/message/<message-name>"); -LLHTTPRegistration<LLTrustedMessageService> - gHTTPRegistrationTrustedMessageWildcard("/trusted-message/<message-name>"); - //virtual LLUseCircuitCodeResponder::~LLUseCircuitCodeResponder() { @@ -286,13 +236,19 @@ void LLMessageSystem::init() } // Read file and build message templates -LLMessageSystem::LLMessageSystem(const char *filename, U32 port, +LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, S32 version_major, S32 version_minor, - S32 version_patch) + S32 version_patch, + bool failure_is_fatal, + const F32 circuit_heartbeat_interval, const F32 circuit_timeout) : + mCircuitInfo(circuit_heartbeat_interval, circuit_timeout), + mLastMessageFromTrustedMessageService(false) { init(); + mSendSize = 0; + mSystemVersionMajor = version_major; mSystemVersionMinor = version_minor; mSystemVersionPatch = version_patch; @@ -302,11 +258,14 @@ LLMessageSystem::LLMessageSystem(const char *filename, U32 port, // default to not accepting packets from not alive circuits mbProtected = TRUE; + // default to blocking trusted connections on a public interface if one is specified + mBlockUntrustedInterface = true; + mSendPacketFailureCount = 0; mCircuitPrintFreq = 60.f; // seconds - loadTemplateFile(filename); + loadTemplateFile(filename, failure_is_fatal); mTemplateMessageBuilder = new LLTemplateMessageBuilder(mMessageTemplates); mLLSDMessageBuilder = new LLSDMessageBuilder(); @@ -326,14 +285,14 @@ LLMessageSystem::LLMessageSystem(const char *filename, U32 port, mbError = TRUE; mErrorCode = error; } - //llinfos << << "*** port: " << mPort << llendl; +// LL_DEBUGS("Messaging") << << "*** port: " << mPort << llendl; // // Create the data structure that we can poll on // if (!gAPRPoolp) { - llerrs << "No APR pool before message system initialization!" << llendl; + LL_ERRS("Messaging") << "No APR pool before message system initialization!" << llendl; ll_init_apr(); } apr_socket_t *aprSocketp = NULL; @@ -360,16 +319,18 @@ LLMessageSystem::LLMessageSystem(const char *filename, U32 port, mMaxMessageTime = 1.f; mTrueReceiveSize = 0; + + mReceiveTime = 0.f; } // Read file and build message templates -void LLMessageSystem::loadTemplateFile(const char* filename) +void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure_is_fatal) { - if(!filename) + if(filename.empty()) { - llerrs << "No template filename specified" << llendl; + LL_ERRS("Messaging") << "No template filename specified" << llendl; mbError = TRUE; return; } @@ -377,7 +338,11 @@ void LLMessageSystem::loadTemplateFile(const char* filename) std::string template_body; if(!_read_file_into_string(template_body, filename)) { - llwarns << "Failed to open template: " << filename << llendl; + if (failure_is_fatal) { + LL_ERRS("Messaging") << "Failed to open template: " << filename << llendl; + } else { + LL_WARNS("Messaging") << "Failed to open template: " << filename << llendl; + } mbError = TRUE; return; } @@ -432,7 +397,9 @@ void LLMessageSystem::clearReceiveState() mCurrentRecvPacketID = 0; mIncomingCompressedSize = 0; mLastSender.invalidate(); + mLastReceivingIF.invalidate(); mMessageReader->clearMessage(); + mLastMessageFromTrustedMessageService = false; } @@ -465,11 +432,22 @@ bool LLMessageSystem::isTrustedSender(const LLHost& host) const return cdp->getTrusted(); } +void LLMessageSystem::receivedMessageFromTrustedSender() +{ + mLastMessageFromTrustedMessageService = true; +} + +bool LLMessageSystem::isTrustedSender() const +{ + return mLastMessageFromTrustedMessageService || + isTrustedSender(getSender()); +} + 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()); + const char* namePrehash = LLMessageStringTable::getInstance()->getString(name.c_str()); if(NULL == namePrehash) {return templates.end();} return templates.find(namePrehash); } @@ -581,6 +559,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) receive_size = mTrueReceiveSize; mLastSender = mPacketRing.getLastSender(); + mLastReceivingIF = mPacketRing.getLastReceivingInterface(); if (receive_size < (S32) LL_MINIMUM_VALID_PACKET_SIZE) { @@ -588,7 +567,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) // Ones that are non-zero but below the minimum packet size are worrisome. if (receive_size > 0) { - llwarns << "Invalid (too short) packet discarded " << receive_size << llendl; + LL_WARNS("Messaging") << "Invalid (too short) packet discarded " << receive_size << llendl; callExceptionFunc(MX_PACKET_TOO_SHORT); } // no data in packet receive buffer @@ -612,7 +591,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) { // mal-formed packet. ignore it and continue with // the next one - llwarns << "Malformed packet received. Packet size " + LL_WARNS("Messaging") << "Malformed packet received. Packet size " << receive_size << " with invalid no. of acks " << acks << llendl; valid_packet = FALSE; @@ -642,7 +621,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) memcpy(&mem_id, &mTrueReceiveBuffer[true_rcv_size], /* Flawfinder: ignore*/ sizeof(TPACKETID)); packet_id = ntohl(mem_id); - //llinfos << "got ack: " << packet_id << llendl; + //LL_INFOS("Messaging") << "got ack: " << packet_id << llendl; cdp->ackReliablePacket(packet_id); } if (!cdp->getUnackedPacketCount()) @@ -671,7 +650,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) // TESTING CODE //if(mCircuitInfo.mCurrentCircuit->mHost != host) //{ - // llwarns << "DISCARDED PACKET HOST MISMATCH! HOST: " + // LL_WARNS("Messaging") << "DISCARDED PACKET HOST MISMATCH! HOST: " // << host << " CIRCUIT: " // << mCircuitInfo.mCurrentCircuit->mHost // << llendl; @@ -681,19 +660,19 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) cdp->collectRAck(mCurrentRecvPacketID); } - //llinfos << "Discarding duplicate resend from " << host << llendl; + LL_DEBUGS("Messaging") << "Discarding duplicate resend from " << host << llendl; if(mVerboseLog) { std::ostringstream str; str << "MSG: <- " << host; - char buffer[MAX_STRING]; /* Flawfinder: ignore*/ - snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", receive_size, (mIncomingCompressedSize ? mIncomingCompressedSize : receive_size), mCurrentRecvPacketID); /* Flawfinder: ignore */ - str << buffer << "(unknown)" + std::string tbuf; + tbuf = llformat( "\t%6d\t%6d\t%6d ", receive_size, (mIncomingCompressedSize ? mIncomingCompressedSize : receive_size), mCurrentRecvPacketID); + str << tbuf << "(unknown)" << (recv_reliable ? " reliable" : "") << " resent " << ((acks > 0) ? "acks" : "") << " DISCARD DUPLICATE"; - llinfos << str.str() << llendl; + LL_INFOS("Messaging") << str.str() << llendl; } mPacketsIn++; valid_packet = FALSE; @@ -704,11 +683,16 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) // UseCircuitCode can be a valid, off-circuit packet. // But we don't want to acknowledge UseCircuitCode until the circuit is // available, which is why the acknowledgement test is done above. JC - + bool trusted = cdp && cdp->getTrusted(); valid_packet = mTemplateMessageReader->validateMessage( buffer, receive_size, - host); + host, + trusted); + if (!valid_packet) + { + clearReceiveState(); + } // UseCircuitCode is allowed in even from an invalid circuit, so that // we can toss circuits around. @@ -736,24 +720,9 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) valid_packet = FALSE; } - if ( - valid_packet && - mTemplateMessageReader->isBanned(cdp && cdp->getTrusted())) - { - llwarns << "LLMessageSystem::checkMessages " - << "received banned message " - << mTemplateMessageReader->getMessageName() - << " from " - << ((cdp && cdp->getTrusted()) ? "trusted " : "untrusted ") - << host << llendl; - clearReceiveState(); - valid_packet = FALSE; - } - if( valid_packet ) { logValidMsg(cdp, host, recv_reliable, recv_resent, (BOOL)(acks>0) ); - valid_packet = mTemplateMessageReader->readMessage(buffer, host); } @@ -763,95 +732,6 @@ 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 ) - { - static char* object_update = gMessageStringTable.getString("ObjectUpdate"); - if(object_update == mTemplateMessageReader->getMessageName() ) - { - llinfos << "ObjectUpdate:" << llendl; - U32 i; - llinfos << " Zero Encoded: " << zero_unexpanded_size << llendl; - for( i = 0; i<zero_unexpanded_size; i++ ) - { - llinfos << " " << i << ": " << (U32) zero_unexpanded_buffer[i] << llendl; - } - llinfos << "" << llendl; - - llinfos << " Zero Unencoded: " << receive_size << llendl; - for( i = 0; i<receive_size; i++ ) - { - llinfos << " " << i << ": " << (U32) buffer[i] << llendl; - } - llinfos << "" << llendl; - - llinfos << " Blocks and variables: " << llendl; - S32 byte_count = 0; - for (LLMessageTemplate::message_block_map_t::iterator - iter = mCurrentRMessageTemplate->mMemberBlocks.begin(), - end = mCurrentRMessageTemplate->mMemberBlocks.end(); - iter != end; iter++) - { - LLMessageBlock* block = iter->second; - const char* block_name = block->mName; - for (LLMsgBlkData::msg_var_data_map_t::iterator - iter = block->mMemberVariables.begin(), - end = block->mMemberVariables.end(); - iter != end; iter++) - { - const char* var_name = iter->first; - - if( getNumberOfBlocksFast( block_name ) < 1 ) - { - llinfos << var_name << " has no blocks" << llendl; - } - for( S32 blocknum = 0; blocknum < getNumberOfBlocksFast( block_name ); blocknum++ ) - { - char *bnamep = (char *)block_name + blocknum; // this works because it's just a hash. The bnamep is never derefference - char *vnamep = (char *)var_name; - - LLMsgBlkData *msg_block_data = mCurrentRMessageData->mMemberBlocks[bnamep]; - - char errmsg[1024]; - if (!msg_block_data) - { - sprintf(errmsg, "Block %s #%d not in message %s", block_name, blocknum, mCurrentRMessageData->mName); - llerrs << errmsg << llendl; - } - - LLMsgVarData vardata = msg_block_data->mMemberVarData[vnamep]; - - if (!vardata.getName()) - { - sprintf(errmsg, "Variable %s not in message %s block %s", vnamep, mCurrentRMessageData->mName, bnamep); - llerrs << errmsg << llendl; - } - - const S32 vardata_size = vardata.getSize(); - if( vardata_size ) - { - for( i = 0; i < vardata_size; i++ ) - { - byte_count++; - llinfos << block_name << " " << var_name << " [" << blocknum << "][" << i << "]= " << (U32)(((U8*)vardata.getData())[i]) << llendl; - } - } - else - { - llinfos << block_name << " " << var_name << " [" << blocknum << "] 0 bytes" << llendl; - } - } - } - } - llinfos << "Byte count =" << byte_count << llendl; - } - } - */ - mPacketsIn++; mBytesIn += mTrueReceiveSize; @@ -871,7 +751,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) { if (mbProtected && (!cdp)) { - llwarns << "Invalid Packet from invalid circuit " << host << llendl; + LL_WARNS("Messaging") << "Invalid Packet from invalid circuit " << host << llendl; mOffCircuitPackets++; } else @@ -879,9 +759,6 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) mInvalidOnCircuitPackets++; } } - - // Code for dumping the complete contents of a message - // delete [] zero_unexpanded_buffer; } } while (!valid_packet && receive_size > 0); @@ -916,6 +793,7 @@ S32 LLMessageSystem::getReceiveBytes() const void LLMessageSystem::processAcks() { + LLMemType mt_pa(LLMemType::MTYPE_MESSAGE_PROCESS_ACKS); F64 mt_sec = getMessageTimeSeconds(); { gTransferManager.updateTransfers(); @@ -944,7 +822,7 @@ void LLMessageSystem::processAcks() if (!mDenyTrustedCircuitSet.empty()) { - llinfos << "Sending queued DenyTrustedCircuit messages." << llendl; + LL_INFOS("Messaging") << "Sending queued DenyTrustedCircuit messages." << llendl; for (host_set_t::iterator hostit = mDenyTrustedCircuitSet.begin(); hostit != mDenyTrustedCircuitSet.end(); ++hostit) { reallySendDenyTrustedCircuit(*hostit); @@ -984,7 +862,7 @@ void LLMessageSystem::processAcks() } } -void LLMessageSystem::copyMessageRtoS() +void LLMessageSystem::copyMessageReceivedToSend() { // NOTE: babbage: switch builder to match reader to avoid // converting message format @@ -1001,6 +879,94 @@ void LLMessageSystem::copyMessageRtoS() mMessageReader->copyToBuilder(*mMessageBuilder); } +LLSD LLMessageSystem::getReceivedMessageLLSD() const +{ + LLSDMessageBuilder builder; + mMessageReader->copyToBuilder(builder); + return builder.getMessage(); +} + +LLSD LLMessageSystem::getBuiltMessageLLSD() const +{ + LLSD result; + if (mLLSDMessageBuilder == mMessageBuilder) + { + result = mLLSDMessageBuilder->getMessage(); + } + else + { + // TODO: implement as below? + llerrs << "Message not built as LLSD." << llendl; + } + return result; +} + +LLSD LLMessageSystem::wrapReceivedTemplateData() const +{ + if(mMessageReader == mTemplateMessageReader) + { + LLTemplateMessageBuilder builder(mMessageTemplates); + builder.newMessage(mMessageReader->getMessageName()); + mMessageReader->copyToBuilder(builder); + U8 buffer[MAX_BUFFER_SIZE]; + const U8 offset_to_data = 0; + U32 size = builder.buildMessage(buffer, MAX_BUFFER_SIZE, + offset_to_data); + std::vector<U8> binary_data(buffer, buffer+size); + LLSD wrapped_data = LLSD::emptyMap(); + wrapped_data["binary-template-data"] = binary_data; + return wrapped_data; + } + else + { + return getReceivedMessageLLSD(); + } +} + +LLSD LLMessageSystem::wrapBuiltTemplateData() const +{ + LLSD result; + if (mLLSDMessageBuilder == mMessageBuilder) + { + result = getBuiltMessageLLSD(); + } + else + { + U8 buffer[MAX_BUFFER_SIZE]; + const U8 offset_to_data = 0; + U32 size = mTemplateMessageBuilder->buildMessage( + buffer, MAX_BUFFER_SIZE, + offset_to_data); + std::vector<U8> binary_data(buffer, buffer+size); + LLSD wrapped_data = LLSD::emptyMap(); + wrapped_data["binary-template-data"] = binary_data; + result = wrapped_data; + } + return result; +} + +LLStoredMessagePtr LLMessageSystem::getReceivedMessage() const +{ + const std::string& name = mMessageReader->getMessageName(); + LLSD message = wrapReceivedTemplateData(); + + return LLStoredMessagePtr(new LLStoredMessage(name, message)); +} + +LLStoredMessagePtr LLMessageSystem::getBuiltMessage() const +{ + const std::string& name = mMessageBuilder->getMessageName(); + LLSD message = wrapBuiltTemplateData(); + + return LLStoredMessagePtr(new LLStoredMessage(name, message)); +} + +S32 LLMessageSystem::sendMessage(const LLHost &host, LLStoredMessagePtr message) +{ + return sendMessage(host, message->mName.c_str(), message->mMessage); +} + + void LLMessageSystem::clearMessage() { mSendReliable = FALSE; @@ -1013,12 +979,17 @@ void LLMessageSystem::nextBlockFast(const char *blockname) mMessageBuilder->nextBlock(blockname); } +void LLMessageSystem::nextBlock(const char *blockname) +{ + nextBlockFast(LLMessageStringTable::getInstance()->getString(blockname)); +} + BOOL LLMessageSystem::isSendFull(const char* blockname) { char* stringTableName = NULL; if(NULL != blockname) { - stringTableName = gMessageStringTable.getString(blockname); + stringTableName = LLMessageStringTable::getInstance()->getString(blockname); } return isSendFullFast(stringTableName); } @@ -1092,19 +1063,19 @@ S32 LLMessageSystem::sendReliable( const LLHost &host, void LLMessageSystem::forwardMessage(const LLHost &host) { - copyMessageRtoS(); + copyMessageReceivedToSend(); sendMessage(host); } void LLMessageSystem::forwardReliable(const LLHost &host) { - copyMessageRtoS(); + copyMessageReceivedToSend(); sendReliable(host); } void LLMessageSystem::forwardReliable(const U32 circuit_code) { - copyMessageRtoS(); + copyMessageReceivedToSend(); sendReliable(findHost(circuit_code)); } @@ -1115,7 +1086,7 @@ S32 LLMessageSystem::forwardReliable( const LLHost &host, void (*callback)(void **,S32), void ** callback_data) { - copyMessageRtoS(); + copyMessageReceivedToSend(); return sendReliable(host, retries, ping_based_timeout, timeout, callback, callback_data); } @@ -1176,13 +1147,13 @@ LLHTTPClient::ResponderPtr LLMessageSystem::createResponder(const std::string& n { // These messages aren't really unreliable, they just weren't // explicitly sent as reliable, so they don't have a callback -// llwarns << "LLMessageSystem::sendMessage: Sending unreliable " +// LL_WARNS("Messaging") << "LLMessageSystem::sendMessage: Sending unreliable " // << mMessageBuilder->getMessageName() << " message via HTTP" // << llendl; return new LLFnPtrResponder( NULL, NULL, - mMessageBuilder->getMessageName()); + name); } } @@ -1213,10 +1184,10 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) // yup! don't send packets to an unknown circuit if(mVerboseLog) { - llinfos << "MSG: -> " << host << "\tUNKNOWN CIRCUIT:\t" + LL_INFOS_ONCE("Messaging") << "MSG: -> " << host << "\tUNKNOWN CIRCUIT:\t" << mMessageBuilder->getMessageName() << llendl; } - llwarns << "sendMessage - Trying to send " + LL_WARNS_ONCE("Messaging") << "sendMessage - Trying to send " << mMessageBuilder->getMessageName() << " on unknown circuit " << host << llendl; return 0; @@ -1236,10 +1207,10 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) // nope. don't send to dead circuits if(mVerboseLog) { - llinfos << "MSG: -> " << host << "\tDEAD CIRCUIT\t\t" + LL_INFOS("Messaging") << "MSG: -> " << host << "\tDEAD CIRCUIT\t\t" << mMessageBuilder->getMessageName() << llendl; } - llwarns << "sendMessage - Trying to send message " + LL_WARNS("Messaging") << "sendMessage - Trying to send message " << mMessageBuilder->getMessageName() << " to dead circuit " << host << llendl; return 0; @@ -1283,7 +1254,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) if((mMessageBuilder->getMessageName() != _PREHASH_ChildAgentUpdate) && (mMessageBuilder->getMessageName() != _PREHASH_SendXferPacket)) { - llwarns << "sendMessage - Trying to send " + LL_WARNS("Messaging") << "sendMessage - Trying to send " << ((buffer_length > 4000) ? "EXTRA " : "") << "BIG message " << mMessageBuilder->getMessageName() << " - " << buffer_length << llendl; @@ -1348,7 +1319,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) // append_acout_count is incorrect or that // MAX_BUFFER_SIZE has fallen below MTU which is bad // and probably programmer error. - llerrs << "Buffer packing failed due to size.." << llendl; + LL_ERRS("Messaging") << "Buffer packing failed due to size.." << llendl; } } @@ -1378,8 +1349,8 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) { std::ostringstream str; str << "MSG: -> " << host; - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mSendSize, buffer_length, cdp->getPacketOutID()); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat( "\t%6d\t%6d\t%6d ", mSendSize, buffer_length, cdp->getPacketOutID()); str << buffer << mMessageBuilder->getMessageName() << (mSendReliable ? " reliable " : ""); @@ -1389,13 +1360,9 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) std::ostream_iterator<TPACKETID> append(str, " "); std::copy(acks.begin(), acks.end(), append); } - llinfos << str.str() << llendl; + LL_INFOS("Messaging") << str.str() << llendl; } - /*lldebugst(LLERR_MESSAGE) << "MessageSent at: " << (S32)totalTime() - << "," << mMessageBuilder->getMessageName() - << " to " << host - << llendl;*/ mPacketsOut++; mBytesOut += buffer_length; @@ -1411,13 +1378,13 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re { std::ostringstream str; str << "MSG: <- " << host; - 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 */ + std::string buffer; + buffer = llformat( "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize: mMessageReader->getMessageSize()), mCurrentRecvPacketID); str << buffer << nullToEmpty(mMessageReader->getMessageName()) << (recv_reliable ? " reliable" : "") << " REJECTED"; - llinfos << str.str() << llendl; + LL_INFOS("Messaging") << str.str() << llendl; } // nope! // cout << "Rejecting unexpected message " << mCurrentMessageTemplate->mName << " from " << hex << ip << " , " << dec << port << endl; @@ -1425,7 +1392,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re // Keep track of rejected messages as well if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM) { - llwarns << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl; + LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl; } else { @@ -1444,14 +1411,7 @@ S32 LLMessageSystem::sendMessage( { 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; + LL_WARNS("Messaging") << "trying to send message to invalid host" << llendl; return 0; } @@ -1466,7 +1426,7 @@ void LLMessageSystem::logTrustedMsgFromUntrustedCircuit( const LLHost& host ) // if it's received on a trusted circuit. JC if (strcmp(mMessageReader->getMessageName(), "RequestTrustedCircuit")) { - llwarns << "Received trusted message on untrusted circuit. " + LL_WARNS("Messaging") << "Received trusted message on untrusted circuit. " << "Will reply with deny. " << "Message: " << nullToEmpty(mMessageReader->getMessageName()) << " Host: " << host << llendl; @@ -1474,7 +1434,7 @@ void LLMessageSystem::logTrustedMsgFromUntrustedCircuit( const LLHost& host ) if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM) { - llwarns << "got more than " << MAX_MESSAGE_COUNT_NUM + LL_WARNS("Messaging") << "got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl; } @@ -1494,7 +1454,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r { if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM) { - llwarns << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl; + LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl; } else { @@ -1516,14 +1476,14 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r { std::ostringstream str; str << "MSG: <- " << host; - 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 */ + std::string buffer; + buffer = llformat( "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize : mMessageReader->getMessageSize()), mCurrentRecvPacketID); str << buffer << nullToEmpty(mMessageReader->getMessageName()) << (recv_reliable ? " reliable" : "") << (recv_resent ? " resent" : "") << (recv_acks ? " acks" : ""); - llinfos << str.str() << llendl; + LL_INFOS("Messaging") << str.str() << llendl; } } @@ -1533,48 +1493,48 @@ void LLMessageSystem::sanityCheck() // if (!mCurrentRMessageData) // { -// llerrs << "mCurrentRMessageData is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentRMessageData is NULL" << llendl; // } // if (!mCurrentRMessageTemplate) // { -// llerrs << "mCurrentRMessageTemplate is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentRMessageTemplate is NULL" << llendl; // } // if (!mCurrentRTemplateBlock) // { -// llerrs << "mCurrentRTemplateBlock is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentRTemplateBlock is NULL" << llendl; // } // if (!mCurrentRDataBlock) // { -// llerrs << "mCurrentRDataBlock is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentRDataBlock is NULL" << llendl; // } // if (!mCurrentSMessageData) // { -// llerrs << "mCurrentSMessageData is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentSMessageData is NULL" << llendl; // } // if (!mCurrentSMessageTemplate) // { -// llerrs << "mCurrentSMessageTemplate is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentSMessageTemplate is NULL" << llendl; // } // if (!mCurrentSTemplateBlock) // { -// llerrs << "mCurrentSTemplateBlock is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentSTemplateBlock is NULL" << llendl; // } // if (!mCurrentSDataBlock) // { -// llerrs << "mCurrentSDataBlock is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentSDataBlock is NULL" << llendl; // } } void LLMessageSystem::showCircuitInfo() { - llinfos << mCircuitInfo << llendl; + LL_INFOS("Messaging") << mCircuitInfo << llendl; } @@ -1624,7 +1584,7 @@ void LLMessageSystem::enableCircuit(const LLHost &host, BOOL trusted) void LLMessageSystem::disableCircuit(const LLHost &host) { - llinfos << "LLMessageSystem::disableCircuit for " << host << llendl; + LL_INFOS("Messaging") << "LLMessageSystem::disableCircuit for " << host << llendl; U32 code = gMessageSystem->findCircuitCode( host ); // Don't need to do this, as we're removing the circuit info anyway - djs 01/28/03 @@ -1637,7 +1597,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host) code_session_map_t::iterator it = mCircuitCodes.find(code); if(it != mCircuitCodes.end()) { - llinfos << "Circuit " << code << " removed from list" << llendl; + LL_INFOS("Messaging") << "Circuit " << code << " removed from list" << llendl; //mCircuitCodes.removeData(code); mCircuitCodes.erase(it); } @@ -1653,7 +1613,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host) U32 old_port = (U32)(ip_port & (U64)0xFFFFFFFF); U32 old_ip = (U32)(ip_port >> 32); - llinfos << "Host " << LLHost(old_ip, old_port) << " circuit " << code << " removed from lookup table" << llendl; + LL_INFOS("Messaging") << "Host " << LLHost(old_ip, old_port) << " circuit " << code << " removed from lookup table" << llendl; gMessageSystem->mIPPortToCircuitCode.erase(ip_port); } mCircuitInfo.removeCircuitData(host); @@ -1663,7 +1623,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host) // 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; + LL_WARNS("Messaging") << "Couldn't find circuit code for " << host << llendl; } } @@ -1694,7 +1654,7 @@ BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit) if (!host.isOk()) { - //llinfos << "checkCircuitBlocked: Unknown circuit " << circuit << llendl; + LL_DEBUGS("Messaging") << "checkCircuitBlocked: Unknown circuit " << circuit << llendl; return TRUE; } @@ -1705,7 +1665,7 @@ BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit) } else { - llinfos << "checkCircuitBlocked(circuit): Unknown host - " << host << llendl; + LL_INFOS("Messaging") << "checkCircuitBlocked(circuit): Unknown host - " << host << llendl; return FALSE; } } @@ -1716,7 +1676,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit) if (!host.isOk()) { - //llinfos << "checkCircuitAlive: Unknown circuit " << circuit << llendl; + LL_DEBUGS("Messaging") << "checkCircuitAlive: Unknown circuit " << circuit << llendl; return FALSE; } @@ -1727,7 +1687,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit) } else { - llinfos << "checkCircuitAlive(circuit): Unknown host - " << host << llendl; + LL_INFOS("Messaging") << "checkCircuitAlive(circuit): Unknown host - " << host << llendl; return FALSE; } } @@ -1741,7 +1701,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const LLHost &host) } else { - //llinfos << "checkCircuitAlive(host): Unknown host - " << host << llendl; + LL_DEBUGS("Messaging") << "checkCircuitAlive(host): Unknown host - " << host << llendl; return FALSE; } } @@ -1891,7 +1851,7 @@ void LLMessageSystem::processAssignCircuitCode(LLMessageSystem* msg, void**) msg->getUUIDFast(_PREHASH_CircuitCode, _PREHASH_SessionID, session_id); if(session_id != msg->getMySessionID()) { - llwarns << "AssignCircuitCode, bad session id. Expecting " + LL_WARNS("Messaging") << "AssignCircuitCode, bad session id. Expecting " << msg->getMySessionID() << " but got " << session_id << llendl; return; @@ -1900,11 +1860,11 @@ void LLMessageSystem::processAssignCircuitCode(LLMessageSystem* msg, void**) msg->getU32Fast(_PREHASH_CircuitCode, _PREHASH_Code, code); if (!code) { - llerrs << "Assigning circuit code of zero!" << llendl; + LL_ERRS("Messaging") << "Assigning circuit code of zero!" << llendl; } msg->mOurCircuitCode = code; - llinfos << "Circuit code " << code << " assigned." << llendl; + LL_INFOS("Messaging") << "Circuit code " << code << " assigned." << llendl; } */ @@ -1928,20 +1888,20 @@ bool LLMessageSystem::addCircuitCode(U32 code, const LLUUID& session_id) { if(!code) { - llwarns << "addCircuitCode: zero circuit code" << llendl; + LL_WARNS("Messaging") << "addCircuitCode: zero circuit code" << llendl; return false; } code_session_map_t::iterator it = mCircuitCodes.find(code); if(it == mCircuitCodes.end()) { - llinfos << "New circuit code " << code << " added" << llendl; + LL_INFOS("Messaging") << "New circuit code " << code << " added" << llendl; //msg->mCircuitCodes[circuit_code] = circuit_code; mCircuitCodes.insert(code_session_map_t::value_type(code, session_id)); } else { - llinfos << "Duplicate circuit code " << code << " added" << llendl; + LL_INFOS("Messaging") << "Duplicate circuit code " << code << " added" << llendl; } return true; } @@ -1973,7 +1933,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, if(it == msg->mCircuitCodes.end()) { // Whoah, abort! We don't know anything about this circuit code. - llwarns << "UseCircuitCode for " << circuit_code_in + LL_WARNS("Messaging") << "UseCircuitCode for " << circuit_code_in << " received without AddCircuitCode message - aborting" << llendl; return; @@ -1985,7 +1945,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, msg->getUUIDFast(_PREHASH_CircuitCode, _PREHASH_SessionID, session_id); if(session_id != (*it).second) { - llwarns << "UseCircuitCode unmatched session id. Got " + LL_WARNS("Messaging") << "UseCircuitCode unmatched session id. Got " << session_id << " but expected " << (*it).second << llendl; return; @@ -2000,7 +1960,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, if ((ip_port_old == ip_port_in) && (circuit_code_old == circuit_code_in)) { // Current information is the same as incoming info, ignore - llinfos << "Got duplicate UseCircuitCode for circuit " << circuit_code_in << " to " << msg->getSender() << llendl; + LL_INFOS("Messaging") << "Got duplicate UseCircuitCode for circuit " << circuit_code_in << " to " << msg->getSender() << llendl; return; } @@ -2010,25 +1970,25 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, msg->mIPPortToCircuitCode.erase(ip_port_old); U32 old_port = (U32)(ip_port_old & (U64)0xFFFFFFFF); U32 old_ip = (U32)(ip_port_old >> 32); - llinfos << "Removing derelict lookup entry for circuit " << circuit_code_old << " to " << LLHost(old_ip, old_port) << llendl; + LL_INFOS("Messaging") << "Removing derelict lookup entry for circuit " << circuit_code_old << " to " << LLHost(old_ip, old_port) << llendl; } if (circuit_code_old) { LLHost cur_host(ip, port); - llwarns << "Disabling existing circuit for " << cur_host << llendl; + LL_WARNS("Messaging") << "Disabling existing circuit for " << cur_host << llendl; msg->disableCircuit(cur_host); if (circuit_code_old == circuit_code_in) { - llwarns << "Asymmetrical circuit to ip/port lookup!" << llendl; - llwarns << "Multiple circuit codes for " << cur_host << " probably!" << llendl; - llwarns << "Permanently disabling circuit" << llendl; + LL_WARNS("Messaging") << "Asymmetrical circuit to ip/port lookup!" << llendl; + LL_WARNS("Messaging") << "Multiple circuit codes for " << cur_host << " probably!" << llendl; + LL_WARNS("Messaging") << "Permanently disabling circuit" << llendl; return; } else { - llwarns << "Circuit code changed for " << msg->getSender() + LL_WARNS("Messaging") << "Circuit code changed for " << msg->getSender() << " from " << circuit_code_old << " to " << circuit_code_in << llendl; } @@ -2070,7 +2030,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, msg->mIPPortToCircuitCode[ip_port_in] = circuit_code_in; msg->mCircuitCodeToIPPort[circuit_code_in] = ip_port_in; - llinfos << "Circuit code " << circuit_code_in << " from " + LL_INFOS("Messaging") << "Circuit code " << circuit_code_in << " from " << msg->getSender() << " for agent " << id << " in session " << session_id << llendl; @@ -2083,29 +2043,27 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, } else { - llwarns << "Got zero circuit code in use_circuit_code" << llendl; + LL_WARNS("Messaging") << "Got zero circuit code in use_circuit_code" << llendl; } } // 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); + msg->getString("Data", "Token", error_token); + LLUUID error_id; msg->getUUID("Data", "ID", error_id); std::string error_system; - msg->getString("Data", "System", MTUBYTES, buffer); - error_system.assign(buffer); + msg->getString("Data", "System", error_system); + std::string error_message; - msg->getString("Data", "Message", MTUBYTES, buffer); - error_message.assign(buffer); + msg->getString("Data", "Message", error_message); - llwarns << "Message error from " << msg->getSender() << " - " + LL_WARNS("Messaging") << "Message error from " << msg->getSender() << " - " << error_code << " " << error_token << " " << error_id << " \"" << error_system << "\" \"" << error_message << "\"" << llendl; } @@ -2139,11 +2097,11 @@ void LLMessageSystem::dispatch( LLHTTPNode::ResponsePtr responsep) { if ((gMessageSystem->mMessageTemplates.find - (gMessageStringTable.getString(msg_name.c_str())) == + (LLMessageStringTable::getInstance()->getString(msg_name.c_str())) == gMessageSystem->mMessageTemplates.end()) && !LLMessageConfig::isValidMessage(msg_name)) { - llwarns << "Ignoring unknown message " << msg_name << llendl; + LL_WARNS("Messaging") << "Ignoring unknown message " << msg_name << llendl; responsep->notFound("Invalid message name"); return; } @@ -2153,17 +2111,26 @@ void LLMessageSystem::dispatch( const LLHTTPNode* handler = messageRootNode().traverse(path, context); if (!handler) { - llwarns << "LLMessageService::dispatch > no handler for " + LL_WARNS("Messaging") << "LLMessageService::dispatch > no handler for " << path << llendl; return; } // enable this for output of message names - //llinfos << "< \"" << msg_name << "\"" << llendl; + //LL_INFOS("Messaging") << "< \"" << msg_name << "\"" << llendl; //lldebugs << "data: " << LLSDNotationStreamer(message) << llendl; handler->post(responsep, context, message); } +//static +void LLMessageSystem::dispatchTemplate(const std::string& msg_name, + const LLSD& message, + LLHTTPNode::ResponsePtr responsep) +{ + LLTemplateMessageDispatcher dispatcher(*(gMessageSystem->mTemplateMessageReader)); + dispatcher.dispatch(msg_name, message, responsep); +} + static void check_for_unrecognized_messages( const char* type, const LLSD& map, @@ -2173,13 +2140,13 @@ static void check_for_unrecognized_messages( end = map.endMap(); iter != end; ++iter) { - const char* name = gMessageStringTable.getString(iter->first.c_str()); + const char* name = LLMessageStringTable::getInstance()->getString(iter->first.c_str()); if (templates.find(name) == templates.end()) { - llinfos << " " << type + LL_INFOS("AppInit") << " " << type << " ban list contains unrecognized message " - << name << llendl; + << name << LL_ENDL; } } } @@ -2187,7 +2154,7 @@ static void check_for_unrecognized_messages( void LLMessageSystem::setMessageBans( const LLSD& trusted, const LLSD& untrusted) { - llinfos << "LLMessageSystem::setMessageBans:" << llendl; + LL_DEBUGS("AppInit") << "LLMessageSystem::setMessageBans:" << LL_ENDL; bool any_set = false; for (message_template_name_map_t::iterator iter = mMessageTemplates.begin(), @@ -2207,17 +2174,17 @@ void LLMessageSystem::setMessageBans( if (ban_from_trusted || ban_from_untrusted) { - llinfos << " " << name << " banned from " + LL_INFOS("AppInit") << " " << name << " banned from " << (ban_from_trusted ? "TRUSTED " : " ") << (ban_from_untrusted ? "UNTRUSTED " : " ") - << llendl; + << LL_ENDL; any_set = true; } } if (!any_set) { - llinfos << " no messages banned" << llendl; + LL_DEBUGS("AppInit") << " no messages banned" << LL_ENDL; } check_for_unrecognized_messages("trusted", trusted, mMessageTemplates); @@ -2267,7 +2234,7 @@ S32 LLMessageSystem::sendError( } else { - llwarns << "Data and message were too large -- data removed." + LL_WARNS("Messaging") << "Data and message were too large -- data removed." << llendl; addBinaryData("Data", NULL, 0); } @@ -2288,7 +2255,7 @@ void process_packet_ack(LLMessageSystem *msgsystem, void** /*user_data*/) for (S32 i = 0; i < ack_count; i++) { msgsystem->getU32Fast(_PREHASH_Packets, _PREHASH_ID, packet_id, i); -// llinfos << "ack recvd' from " << host << " for packet " << (TPACKETID)packet_id << llendl; +// LL_DEBUGS("Messaging") << "ack recvd' from " << host << " for packet " << (TPACKETID)packet_id << llendl; cdp->ackReliablePacket(packet_id); } if (!cdp->getUnackedPacketCount()) @@ -2309,12 +2276,12 @@ void process_log_messages(LLMessageSystem* msg, void**) if (log_message) { - llinfos << "Starting logging via message" << llendl; + LL_INFOS("Messaging") << "Starting logging via message" << llendl; msg->startLogging(); } else { - llinfos << "Stopping logging via message" << llendl; + LL_INFOS("Messaging") << "Stopping logging via message" << llendl; msg->stopLogging(); } }*/ @@ -2333,7 +2300,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **) LLCircuitData *cdp = msg->mCircuitInfo.findCircuit(msg->getSender()); if (!cdp) { - llwarns << "Attempt to create trusted circuit without circuit data: " + LL_WARNS("Messaging") << "Attempt to create trusted circuit without circuit data: " << msg->getSender() << llendl; return; } @@ -2346,6 +2313,23 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **) return; } + U32 untrusted_interface = msg->getUntrustedInterface().getAddress(); + U32 last_interface = msg->getReceivingInterface().getAddress(); + if ( ( untrusted_interface != INVALID_HOST_IP_ADDRESS ) && ( untrusted_interface == last_interface ) ) + { + if( msg->getBlockUntrustedInterface() ) + { + LL_WARNS("Messaging") << "Ignoring CreateTrustedCircuit on public interface from host: " + << msg->getSender() << llendl; + return; + } + else + { + LL_WARNS("Messaging") << "Processing CreateTrustedCircuit on public interface from host: " + << msg->getSender() << llendl; + } + } + char their_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */ S32 size = msg->getSizeFast(_PREHASH_DataBlock, _PREHASH_Digest); if(size != MD5HEX_STR_BYTES) @@ -2358,7 +2342,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **) if(msg->isMatchingDigestForWindowAndUUIDs(their_digest, TRUST_TIME_WINDOW, local_id, remote_id)) { cdp->setTrusted(TRUE); - llinfos << "Trusted digest from " << msg->getSender() << llendl; + LL_INFOS("Messaging") << "Trusted digest from " << msg->getSender() << llendl; return; } else if (cdp->getTrusted()) @@ -2367,13 +2351,13 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **) // This means that this could just be the result of a stale deny sent from a while back, and // the message system is being slow. Don't bother sending the deny, as it may continually // ping-pong back and forth on a very hosed circuit. - llwarns << "Ignoring bad digest from known trusted circuit: " << their_digest + LL_WARNS("Messaging") << "Ignoring bad digest from known trusted circuit: " << their_digest << " host: " << msg->getSender() << llendl; return; } else { - llwarns << "Bad digest from known circuit: " << their_digest + LL_WARNS("Messaging") << "Bad digest from known circuit: " << their_digest << " host: " << msg->getSender() << llendl; msg->sendDenyTrustedCircuit(msg->getSender()); return; @@ -2402,6 +2386,24 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **) // Don't respond to requests that use the same end point ID return; } + + U32 untrusted_interface = msg->getUntrustedInterface().getAddress(); + U32 last_interface = msg->getReceivingInterface().getAddress(); + if ( ( untrusted_interface != INVALID_HOST_IP_ADDRESS ) && ( untrusted_interface == last_interface ) ) + { + if( msg->getBlockUntrustedInterface() ) + { + LL_WARNS("Messaging") << "Ignoring DenyTrustedCircuit on public interface from host: " + << msg->getSender() << llendl; + return; + } + else + { + LL_WARNS("Messaging") << "Processing DenyTrustedCircuit on public interface from host: " + << msg->getSender() << llendl; + } + } + // Assume that we require trust to proceed, so resend. // This catches the case where a circuit that was trusted @@ -2410,7 +2412,7 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **) // spin. // *TODO: probably should keep a count of number of resends // per circuit, and stop resending after a while. - llinfos << "Got DenyTrustedCircuit. Sending CreateTrustedCircuit to " + LL_INFOS("Messaging") << "Got DenyTrustedCircuit. Sending CreateTrustedCircuit to " << msg->getSender() << llendl; msg->sendCreateTrustedCircuit(msg->getSender(), local_id, remote_id); } @@ -2419,7 +2421,8 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **) void dump_prehash_files() { U32 i; - FILE* fp = LLFile::fopen("../../indra/llmessage/message_prehash.h", "w"); /* Flawfinder: ignore */ + std::string filename("../../indra/llmessage/message_prehash.h"); + LLFILE* fp = LLFile::fopen(filename, "w"); /* Flawfinder: ignore */ if (fp) { fprintf( @@ -2428,7 +2431,7 @@ void dump_prehash_files() " * @file message_prehash.h\n" " * @brief header file of externs of prehashed variables plus defines.\n" " *\n" - " * $LicenseInfo:firstyear=2003&license=viewergpl$" + " * $LicenseInfo:firstyear=2003&license=viewerlgpl$" " * $/LicenseInfo$" " */\n\n" "#ifndef LL_MESSAGE_PREHASH_H\n#define LL_MESSAGE_PREHASH_H\n\n"); @@ -2441,17 +2444,16 @@ void dump_prehash_files() fprintf(fp, "\n\nextern F32 gPrehashVersionNumber;\n\n"); for (i = 0; i < MESSAGE_NUMBER_OF_HASH_BUCKETS; i++) { - if (!gMessageStringTable.mEmpty[i] && gMessageStringTable.mString[i][0] != '.') + if (!LLMessageStringTable::getInstance()->mEmpty[i] && LLMessageStringTable::getInstance()->mString[i][0] != '.') { - fprintf(fp, "extern char * _PREHASH_%s;\n", gMessageStringTable.mString[i]); + fprintf(fp, "extern char * _PREHASH_%s;\n", LLMessageStringTable::getInstance()->mString[i]); } } - fprintf(fp, "\n\nvoid init_prehash_data();\n\n"); - fprintf(fp, "\n\n"); fprintf(fp, "\n\n#endif\n"); fclose(fp); } - fp = LLFile::fopen("../../indra/llmessage/message_prehash.cpp", "w"); /* Flawfinder: ignore */ + filename = std::string("../../indra/llmessage/message_prehash.cpp"); + fp = LLFile::fopen(filename, "w"); /* Flawfinder: ignore */ if (fp) { fprintf( @@ -2460,7 +2462,7 @@ void dump_prehash_files() " * @file message_prehash.cpp\n" " * @brief file of prehashed variables\n" " *\n" - " * $LicenseInfo:firstyear=2003&license=viewergpl$" + " * $LicenseInfo:firstyear=2003&license=viewerlgpl$" " * $/LicenseInfo$" " */\n\n" "/**\n" @@ -2472,46 +2474,42 @@ void dump_prehash_files() fprintf(fp, "\n\nF32 gPrehashVersionNumber = %.3ff;\n\n", gMessageSystem->mMessageFileVersionNumber); for (i = 0; i < MESSAGE_NUMBER_OF_HASH_BUCKETS; i++) { - if (!gMessageStringTable.mEmpty[i] && gMessageStringTable.mString[i][0] != '.') + if (!LLMessageStringTable::getInstance()->mEmpty[i] && LLMessageStringTable::getInstance()->mString[i][0] != '.') { - fprintf(fp, "char * _PREHASH_%s;\n", gMessageStringTable.mString[i]); + fprintf(fp, "char * _PREHASH_%s = LLMessageStringTable::getInstance()->getString(\"%s\");\n", LLMessageStringTable::getInstance()->mString[i], LLMessageStringTable::getInstance()->mString[i]); } } - fprintf(fp, "\nvoid init_prehash_data()\n"); - fprintf(fp, "{\n"); - for (i = 0; i < MESSAGE_NUMBER_OF_HASH_BUCKETS; i++) - { - if (!gMessageStringTable.mEmpty[i] && gMessageStringTable.mString[i][0] != '.') - { - fprintf(fp, "\t_PREHASH_%s = gMessageStringTable.getString(\"%s\");\n", gMessageStringTable.mString[i], gMessageStringTable.mString[i]); - } - } - fprintf(fp, "}\n"); fclose(fp); } } -BOOL start_messaging_system( +bool start_messaging_system( const std::string& template_name, U32 port, S32 version_major, S32 version_minor, S32 version_patch, - BOOL b_dump_prehash_file, + bool b_dump_prehash_file, const std::string& secret, - const LLUseCircuitCodeResponder* responder) + const LLUseCircuitCodeResponder* responder, + bool failure_is_fatal, + const F32 circuit_heartbeat_interval, + const F32 circuit_timeout) { gMessageSystem = new LLMessageSystem( - template_name.c_str(), + template_name, port, version_major, version_minor, - version_patch); + version_patch, + failure_is_fatal, + circuit_heartbeat_interval, + circuit_timeout); g_shared_secret.assign(secret); if (!gMessageSystem) { - llerrs << "Messaging system initialization failed." << llendl; + LL_ERRS("AppInit") << "Messaging system initialization failed." << LL_ENDL; return FALSE; } @@ -2528,15 +2526,14 @@ BOOL start_messaging_system( } else { - init_prehash_data(); if (gMessageSystem->mMessageFileVersionNumber != gPrehashVersionNumber) { - llinfos << "Message template version does not match prehash version number" << llendl; - llinfos << "Run simulator with -prehash command line option to rebuild prehash data" << llendl; + LL_INFOS("AppInit") << "Message template version does not match prehash version number" << LL_ENDL; + LL_INFOS("AppInit") << "Run simulator with -prehash command line option to rebuild prehash data" << llendl; } else { - llinfos << "Message template version matches prehash version number" << llendl; + LL_DEBUGS("AppInit") << "Message template version matches prehash version number" << llendl; } } @@ -2582,7 +2579,7 @@ void LLMessageSystem::startLogging() str << "\t<-\tincoming message" <<std::endl; str << "\t->\toutgoing message" << std::endl; str << " <> host size zero id name"; - llinfos << str.str() << llendl; + LL_INFOS("Messaging") << str.str() << llendl; } void LLMessageSystem::stopLogging() @@ -2590,85 +2587,85 @@ void LLMessageSystem::stopLogging() if(mVerboseLog) { mVerboseLog = FALSE; - llinfos << "END MESSAGE LOG" << llendl; + LL_INFOS("Messaging") << "END MESSAGE LOG" << llendl; } } void LLMessageSystem::summarizeLogs(std::ostream& str) { - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - char tmp_str[MAX_STRING]; /* Flawfinder: ignore */ + std::string buffer; + std::string tmp_str; F32 run_time = mMessageSystemTimer.getElapsedTimeF32(); str << "START MESSAGE LOG SUMMARY" << std::endl; - snprintf(buffer, MAX_STRING, "Run time: %12.3f seconds", run_time); /* Flawfinder: ignore */ + buffer = llformat( "Run time: %12.3f seconds", run_time); // Incoming str << buffer << std::endl << "Incoming:" << std::endl; - U64_to_str(mTotalBytesIn, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total bytes received: %20s (%5.2f kbits per second)", tmp_str, ((F32)mTotalBytesIn * 0.008f) / run_time); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mTotalBytesIn); + buffer = llformat( "Total bytes received: %20s (%5.2f kbits per second)", tmp_str.c_str(), ((F32)mTotalBytesIn * 0.008f) / run_time); str << buffer << std::endl; - U64_to_str(mPacketsIn, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total packets received: %20s (%5.2f packets per second)", tmp_str, ((F32) mPacketsIn / run_time)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mPacketsIn); + buffer = llformat( "Total packets received: %20s (%5.2f packets per second)", tmp_str.c_str(), ((F32) mPacketsIn / run_time)); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Average packet size: %20.0f bytes", (F32)mTotalBytesIn / (F32)mPacketsIn); /* Flawfinder: ignore */ + buffer = llformat( "Average packet size: %20.0f bytes", (F32)mTotalBytesIn / (F32)mPacketsIn); str << buffer << std::endl; - U64_to_str(mReliablePacketsIn, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total reliable packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mReliablePacketsIn)/((F32) mPacketsIn + 1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mReliablePacketsIn); + buffer = llformat( "Total reliable packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mReliablePacketsIn)/((F32) mPacketsIn + 1)); str << buffer << std::endl; - U64_to_str(mCompressedPacketsIn, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total compressed packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mCompressedPacketsIn)/((F32) mPacketsIn + 1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mCompressedPacketsIn); + buffer = llformat( "Total compressed packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mCompressedPacketsIn)/((F32) mPacketsIn + 1)); str << buffer << std::endl; S64 savings = mUncompressedBytesIn - mCompressedBytesIn; - U64_to_str(savings, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total compression savings: %20s bytes", tmp_str); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings); + buffer = llformat( "Total compression savings: %20s bytes", tmp_str.c_str()); str << buffer << std::endl; - U64_to_str(savings/(mCompressedPacketsIn +1), tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str, ((F32) mUncompressedBytesIn)/((F32) mCompressedBytesIn+1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings/(mCompressedPacketsIn +1)); + buffer = llformat( "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mUncompressedBytesIn)/((F32) mCompressedBytesIn+1)); str << buffer << std::endl; - U64_to_str(savings/(mPacketsIn+1), tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str, ((F32) mTotalBytesIn + (F32) savings)/((F32) mTotalBytesIn + 1.f)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings/(mPacketsIn+1)); + buffer = llformat( "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mTotalBytesIn + (F32) savings)/((F32) mTotalBytesIn + 1.f)); // Outgoing str << buffer << std::endl << std::endl << "Outgoing:" << std::endl; - U64_to_str(mTotalBytesOut, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total bytes sent: %20s (%5.2f kbits per second)", tmp_str, ((F32)mTotalBytesOut * 0.008f) / run_time ); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mTotalBytesOut); + buffer = llformat( "Total bytes sent: %20s (%5.2f kbits per second)", tmp_str.c_str(), ((F32)mTotalBytesOut * 0.008f) / run_time ); str << buffer << std::endl; - U64_to_str(mPacketsOut, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total packets sent: %20s (%5.2f packets per second)", tmp_str, ((F32)mPacketsOut / run_time)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mPacketsOut); + buffer = llformat( "Total packets sent: %20s (%5.2f packets per second)", tmp_str.c_str(), ((F32)mPacketsOut / run_time)); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Average packet size: %20.0f bytes", (F32)mTotalBytesOut / (F32)mPacketsOut); /* Flawfinder: ignore */ + buffer = llformat( "Average packet size: %20.0f bytes", (F32)mTotalBytesOut / (F32)mPacketsOut); str << buffer << std::endl; - U64_to_str(mReliablePacketsOut, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total reliable packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mReliablePacketsOut)/((F32) mPacketsOut + 1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mReliablePacketsOut); + buffer = llformat( "Total reliable packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mReliablePacketsOut)/((F32) mPacketsOut + 1)); str << buffer << std::endl; - U64_to_str(mCompressedPacketsOut, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total compressed packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mCompressedPacketsOut)/((F32) mPacketsOut + 1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mCompressedPacketsOut); + buffer = llformat( "Total compressed packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mCompressedPacketsOut)/((F32) mPacketsOut + 1)); str << buffer << std::endl; savings = mUncompressedBytesOut - mCompressedBytesOut; - U64_to_str(savings, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total compression savings: %20s bytes", tmp_str); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings); + buffer = llformat( "Total compression savings: %20s bytes", tmp_str.c_str()); str << buffer << std::endl; - U64_to_str(savings/(mCompressedPacketsOut +1), tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str, ((F32) mUncompressedBytesOut)/((F32) mCompressedBytesOut+1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings/(mCompressedPacketsOut +1)); + buffer = llformat( "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mUncompressedBytesOut)/((F32) mCompressedBytesOut+1)); str << buffer << std::endl; - U64_to_str(savings/(mPacketsOut+1), tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str, ((F32) mTotalBytesOut + (F32) savings)/((F32) mTotalBytesOut + 1.f)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings/(mPacketsOut+1)); + buffer = llformat( "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mTotalBytesOut + (F32) savings)/((F32) mTotalBytesOut + 1.f)); str << buffer << std::endl << std::endl; - snprintf(buffer, MAX_STRING, "SendPacket failures: %20d", mSendPacketFailureCount); /* Flawfinder: ignore */ + buffer = llformat( "SendPacket failures: %20d", mSendPacketFailureCount); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Dropped packets: %20d", mDroppedPackets); /* Flawfinder: ignore */ + buffer = llformat( "Dropped packets: %20d", mDroppedPackets); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Resent packets: %20d", mResentPackets); /* Flawfinder: ignore */ + buffer = llformat( "Resent packets: %20d", mResentPackets); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Failed reliable resends: %20d", mFailedResendPackets); /* Flawfinder: ignore */ + buffer = llformat( "Failed reliable resends: %20d", mFailedResendPackets); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Off-circuit rejected packets: %17d", mOffCircuitPackets); /* Flawfinder: ignore */ + buffer = llformat( "Off-circuit rejected packets: %17d", mOffCircuitPackets); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "On-circuit invalid packets: %17d", mInvalidOnCircuitPackets); /* Flawfinder: ignore */ + buffer = llformat( "On-circuit invalid packets: %17d", mInvalidOnCircuitPackets); str << buffer << std::endl << std::endl; str << "Decoding: " << std::endl; - snprintf(buffer, MAX_STRING, "%35s%10s%10s%10s%10s", "Message", "Count", "Time", "Max", "Avg"); /* Flawfinder: ignore */ + buffer = llformat( "%35s%10s%10s%10s%10s", "Message", "Count", "Time", "Max", "Avg"); str << buffer << std:: endl; F32 avg; for (message_template_name_map_t::const_iterator iter = mMessageTemplates.begin(), @@ -2679,14 +2676,14 @@ void LLMessageSystem::summarizeLogs(std::ostream& str) if(mt->mTotalDecoded > 0) { avg = mt->mTotalDecodeTime / (F32)mt->mTotalDecoded; - snprintf(buffer, MAX_STRING, "%35s%10u%10f%10f%10f", mt->mName, mt->mTotalDecoded, mt->mTotalDecodeTime, mt->mMaxDecodeTimePerMsg, avg); /* Flawfinder: ignore */ + buffer = llformat( "%35s%10u%10f%10f%10f", mt->mName, mt->mTotalDecoded, mt->mTotalDecodeTime, mt->mMaxDecodeTimePerMsg, avg); str << buffer << std::endl; } } str << "END MESSAGE LOG SUMMARY" << std::endl; } -void end_messaging_system() +void end_messaging_system(bool print_summary) { gTransferManager.cleanup(); LLTransferTargetVFile::updateQueue(true); // shutdown LLTransferTargetVFile @@ -2694,9 +2691,12 @@ void end_messaging_system() { gMessageSystem->stopLogging(); - std::ostringstream str; - gMessageSystem->summarizeLogs(str); - llinfos << str.str().c_str() << llendl; + if (print_summary) + { + std::ostringstream str; + gMessageSystem->summarizeLogs(str); + LL_INFOS("Messaging") << str.str().c_str() << llendl; + } delete gMessageSystem; gMessageSystem = NULL; @@ -2748,7 +2748,7 @@ void LLMessageSystem::dumpReceiveCounts() if(mNumMessageCounts > 0) { - llinfos << "Dump: " << mNumMessageCounts << " messages processed in " << mReceiveTime << " seconds" << llendl; + LL_DEBUGS("Messaging") << "Dump: " << mNumMessageCounts << " messages processed in " << mReceiveTime << " seconds" << llendl; for (message_template_name_map_t::const_iterator iter = mMessageTemplates.begin(), end = mMessageTemplates.end(); iter != end; iter++) @@ -2756,7 +2756,7 @@ void LLMessageSystem::dumpReceiveCounts() const LLMessageTemplate* mt = iter->second; if (mt->mReceiveCount > 0) { - llinfos << "Num: " << std::setw(3) << mt->mReceiveCount << " Bytes: " << std::setw(6) << mt->mReceiveBytes + LL_INFOS("Messaging") << "Num: " << std::setw(3) << mt->mReceiveCount << " Bytes: " << std::setw(6) << mt->mReceiveBytes << " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << llround(100 * mt->mDecodeTimeThisFrame / mReceiveTime) << "%" << llendl; } } @@ -2873,7 +2873,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size) { if ((*data_size ) < LL_MINIMUM_VALID_PACKET_SIZE) { - llwarns << "zeroCodeExpand() called with data_size of " << *data_size + LL_WARNS("Messaging") << "zeroCodeExpand() called with data_size of " << *data_size << llendl; } @@ -2913,7 +2913,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size) { if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-1])) { - llwarns << "attempt to write past reasonable encoded buffer size 1" << llendl; + LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 1" << llendl; callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE); outptr = mEncodedRecvBuffer; break; @@ -2925,7 +2925,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size) *outptr++ = *inptr++; if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-256])) { - llwarns << "attempt to write past reasonable encoded buffer size 2" << llendl; + LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 2" << llendl; callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE); outptr = mEncodedRecvBuffer; count = -1; @@ -2944,7 +2944,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size) { if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-(*inptr)])) { - llwarns << "attempt to write past reasonable encoded buffer size 3" << llendl; + LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 3" << llendl; callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE); outptr = mEncodedRecvBuffer; } @@ -2967,7 +2967,7 @@ void LLMessageSystem::addTemplate(LLMessageTemplate *templatep) { if (mMessageTemplates.count(templatep->mName) > 0) { - llerrs << templatep->mName << " already used as a template name!" + LL_ERRS("Messaging") << templatep->mName << " already used as a template name!" << llendl; } mMessageTemplates[templatep->mName] = templatep; @@ -2984,19 +2984,19 @@ void LLMessageSystem::setHandlerFuncFast(const char *name, void (*handler_func)( } else { - llerrs << name << " is not a known message name!" << llendl; + LL_ERRS("Messaging") << name << " is not a known message name!" << llendl; } } bool LLMessageSystem::callHandler(const char *name, bool trustedSource, LLMessageSystem* msg) { - name = gMessageStringTable.getString(name); + name = LLMessageStringTable::getInstance()->getString(name); message_template_name_map_t::const_iterator iter; iter = mMessageTemplates.find(name); if(iter == mMessageTemplates.end()) { - llwarns << "LLMessageSystem::callHandler: unknown message " + LL_WARNS("Messaging") << "LLMessageSystem::callHandler: unknown message " << name << llendl; return false; } @@ -3004,7 +3004,7 @@ bool LLMessageSystem::callHandler(const char *name, const LLMessageTemplate* msg_template = iter->second; if (msg_template->isBanned(trustedSource)) { - llwarns << "LLMessageSystem::callHandler: banned message " + LL_WARNS("Messaging") << "LLMessageSystem::callHandler: banned message " << name << " from " << (trustedSource ? "trusted " : "untrusted ") @@ -3144,7 +3144,7 @@ bool LLMessageSystem::generateDigestForWindowAndUUIDs(char* digest, const S32 wi std::string shared_secret = get_shared_secret(); if(shared_secret.empty()) { - llerrs << "Trying to generate complex digest on a machine without a shared secret!" << llendl; + LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << llendl; } U32 now = time(NULL); @@ -3163,7 +3163,7 @@ bool LLMessageSystem::isMatchingDigestForWindowAndUUIDs(const char* digest, cons std::string shared_secret = get_shared_secret(); if(shared_secret.empty()) { - llerrs << "Trying to compare complex digests on a machine without a shared secret!" << llendl; + LL_ERRS("Messaging") << "Trying to compare complex digests on a machine without a shared secret!" << llendl; } char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */ @@ -3210,7 +3210,7 @@ bool LLMessageSystem::generateDigestForWindow(char* digest, const S32 window) co std::string shared_secret = get_shared_secret(); if(shared_secret.empty()) { - llerrs << "Trying to generate simple digest on a machine without a shared secret!" << llendl; + LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << llendl; } U32 now = time(NULL); @@ -3229,7 +3229,7 @@ bool LLMessageSystem::isMatchingDigestForWindow(const char* digest, S32 const wi std::string shared_secret = get_shared_secret(); if(shared_secret.empty()) { - llerrs << "Trying to compare simple digests on a machine without a shared secret!" << llendl; + LL_ERRS("Messaging") << "Trying to compare simple digests on a machine without a shared secret!" << llendl; } char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */ @@ -3263,12 +3263,12 @@ void LLMessageSystem::sendCreateTrustedCircuit(const LLHost &host, const LLUUID char digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */ if (id1.isNull()) { - llwarns << "Can't send CreateTrustedCircuit to " << host << " because we don't have the local end point ID" << llendl; + LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the local end point ID" << llendl; return; } if (id2.isNull()) { - llwarns << "Can't send CreateTrustedCircuit to " << host << " because we don't have the remote end point ID" << llendl; + LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the remote end point ID" << llendl; return; } generateDigestForWindowAndUUIDs(digest, TRUST_TIME_WINDOW, id1, id2); @@ -3276,7 +3276,7 @@ void LLMessageSystem::sendCreateTrustedCircuit(const LLHost &host, const LLUUID nextBlockFast(_PREHASH_DataBlock); addUUIDFast(_PREHASH_EndPointID, id1); addBinaryDataFast(_PREHASH_Digest, digest, MD5HEX_STR_BYTES); - llinfos << "xmitting digest: " << digest << " Host: " << host << llendl; + LL_INFOS("Messaging") << "xmitting digest: " << digest << " Host: " << host << llendl; sendMessage(host); } @@ -3290,10 +3290,10 @@ void LLMessageSystem::reallySendDenyTrustedCircuit(const LLHost &host) LLCircuitData *cdp = mCircuitInfo.findCircuit(host); if (!cdp) { - llwarns << "Not sending DenyTrustedCircuit to host without a circuit." << llendl; + LL_WARNS("Messaging") << "Not sending DenyTrustedCircuit to host without a circuit." << llendl; return; } - llinfos << "Sending DenyTrustedCircuit to " << host << llendl; + LL_INFOS("Messaging") << "Sending DenyTrustedCircuit to " << host << llendl; newMessageFast(_PREHASH_DenyTrustedCircuit); nextBlockFast(_PREHASH_DataBlock); addUUIDFast(_PREHASH_EndPointID, cdp->getLocalEndPointID()); @@ -3314,7 +3314,7 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_ std::string shared_secret = get_shared_secret(); if(shared_secret.empty()) { - llerrs << "Trying to establish bidirectional trust on a machine without a shared secret!" << llendl; + LL_ERRS("Messaging") << "Trying to establish bidirectional trust on a machine without a shared secret!" << llendl; } LLTimer timeout; @@ -3366,8 +3366,8 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_ void LLMessageSystem::dumpPacketToLog() { - llwarns << "Packet Dump from:" << mPacketRing.getLastSender() << llendl; - llwarns << "Packet Size:" << mTrueReceiveSize << llendl; + LL_WARNS("Messaging") << "Packet Dump from:" << mPacketRing.getLastSender() << llendl; + LL_WARNS("Messaging") << "Packet Size:" << mTrueReceiveSize << llendl; char line_buffer[256]; /* Flawfinder: ignore */ S32 i; S32 cur_line_pos = 0; @@ -3382,13 +3382,13 @@ void LLMessageSystem::dumpPacketToLog() if (cur_line_pos >= 16) { cur_line_pos = 0; - llwarns << "PD:" << cur_line << "PD:" << line_buffer << llendl; + LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << llendl; cur_line++; } } if (cur_line_pos) { - llwarns << "PD:" << cur_line << "PD:" << line_buffer << llendl; + LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << llendl; } } @@ -3474,7 +3474,7 @@ void LLMessageSystem::newMessageFast(const char *name) void LLMessageSystem::newMessage(const char *name) { - newMessageFast(gMessageStringTable.getString(name)); + newMessageFast(LLMessageStringTable::getInstance()->getString(name)); } void LLMessageSystem::addBinaryDataFast(const char *varname, const void *data, S32 size) @@ -3484,7 +3484,7 @@ void LLMessageSystem::addBinaryDataFast(const char *varname, const void *data, S void LLMessageSystem::addBinaryData(const char *varname, const void *data, S32 size) { - mMessageBuilder->addBinaryData(gMessageStringTable.getString(varname),data, size); + mMessageBuilder->addBinaryData(LLMessageStringTable::getInstance()->getString(varname),data, size); } void LLMessageSystem::addS8Fast(const char *varname, S8 v) @@ -3494,7 +3494,7 @@ void LLMessageSystem::addS8Fast(const char *varname, S8 v) void LLMessageSystem::addS8(const char *varname, S8 v) { - mMessageBuilder->addS8(gMessageStringTable.getString(varname), v); + mMessageBuilder->addS8(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addU8Fast(const char *varname, U8 v) @@ -3504,7 +3504,7 @@ void LLMessageSystem::addU8Fast(const char *varname, U8 v) void LLMessageSystem::addU8(const char *varname, U8 v) { - mMessageBuilder->addU8(gMessageStringTable.getString(varname), v); + mMessageBuilder->addU8(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addS16Fast(const char *varname, S16 v) @@ -3514,7 +3514,7 @@ void LLMessageSystem::addS16Fast(const char *varname, S16 v) void LLMessageSystem::addS16(const char *varname, S16 v) { - mMessageBuilder->addS16(gMessageStringTable.getString(varname), v); + mMessageBuilder->addS16(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addU16Fast(const char *varname, U16 v) @@ -3524,7 +3524,7 @@ void LLMessageSystem::addU16Fast(const char *varname, U16 v) void LLMessageSystem::addU16(const char *varname, U16 v) { - mMessageBuilder->addU16(gMessageStringTable.getString(varname), v); + mMessageBuilder->addU16(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addF32Fast(const char *varname, F32 v) @@ -3534,7 +3534,7 @@ void LLMessageSystem::addF32Fast(const char *varname, F32 v) void LLMessageSystem::addF32(const char *varname, F32 v) { - mMessageBuilder->addF32(gMessageStringTable.getString(varname), v); + mMessageBuilder->addF32(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addS32Fast(const char *varname, S32 v) @@ -3544,7 +3544,7 @@ void LLMessageSystem::addS32Fast(const char *varname, S32 v) void LLMessageSystem::addS32(const char *varname, S32 v) { - mMessageBuilder->addS32(gMessageStringTable.getString(varname), v); + mMessageBuilder->addS32(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addU32Fast(const char *varname, U32 v) @@ -3554,7 +3554,7 @@ void LLMessageSystem::addU32Fast(const char *varname, U32 v) void LLMessageSystem::addU32(const char *varname, U32 v) { - mMessageBuilder->addU32(gMessageStringTable.getString(varname), v); + mMessageBuilder->addU32(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addU64Fast(const char *varname, U64 v) @@ -3564,7 +3564,7 @@ void LLMessageSystem::addU64Fast(const char *varname, U64 v) void LLMessageSystem::addU64(const char *varname, U64 v) { - mMessageBuilder->addU64(gMessageStringTable.getString(varname), v); + mMessageBuilder->addU64(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addF64Fast(const char *varname, F64 v) @@ -3574,7 +3574,7 @@ void LLMessageSystem::addF64Fast(const char *varname, F64 v) void LLMessageSystem::addF64(const char *varname, F64 v) { - mMessageBuilder->addF64(gMessageStringTable.getString(varname), v); + mMessageBuilder->addF64(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addIPAddrFast(const char *varname, U32 v) @@ -3584,7 +3584,7 @@ void LLMessageSystem::addIPAddrFast(const char *varname, U32 v) void LLMessageSystem::addIPAddr(const char *varname, U32 v) { - mMessageBuilder->addIPAddr(gMessageStringTable.getString(varname), v); + mMessageBuilder->addIPAddr(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addIPPortFast(const char *varname, U16 v) @@ -3594,7 +3594,7 @@ void LLMessageSystem::addIPPortFast(const char *varname, U16 v) void LLMessageSystem::addIPPort(const char *varname, U16 v) { - mMessageBuilder->addIPPort(gMessageStringTable.getString(varname), v); + mMessageBuilder->addIPPort(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addBOOLFast(const char* varname, BOOL v) @@ -3604,7 +3604,7 @@ void LLMessageSystem::addBOOLFast(const char* varname, BOOL v) void LLMessageSystem::addBOOL(const char* varname, BOOL v) { - mMessageBuilder->addBOOL(gMessageStringTable.getString(varname), v); + mMessageBuilder->addBOOL(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addStringFast(const char* varname, const char* v) @@ -3614,7 +3614,7 @@ void LLMessageSystem::addStringFast(const char* varname, const char* v) void LLMessageSystem::addString(const char* varname, const char* v) { - mMessageBuilder->addString(gMessageStringTable.getString(varname), v); + mMessageBuilder->addString(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addStringFast(const char* varname, const std::string& v) @@ -3624,7 +3624,7 @@ void LLMessageSystem::addStringFast(const char* varname, const std::string& v) void LLMessageSystem::addString(const char* varname, const std::string& v) { - mMessageBuilder->addString(gMessageStringTable.getString(varname), v); + mMessageBuilder->addString(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addVector3Fast(const char *varname, const LLVector3& v) @@ -3634,7 +3634,7 @@ void LLMessageSystem::addVector3Fast(const char *varname, const LLVector3& v) void LLMessageSystem::addVector3(const char *varname, const LLVector3& v) { - mMessageBuilder->addVector3(gMessageStringTable.getString(varname), v); + mMessageBuilder->addVector3(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addVector4Fast(const char *varname, const LLVector4& v) @@ -3644,7 +3644,7 @@ void LLMessageSystem::addVector4Fast(const char *varname, const LLVector4& v) void LLMessageSystem::addVector4(const char *varname, const LLVector4& v) { - mMessageBuilder->addVector4(gMessageStringTable.getString(varname), v); + mMessageBuilder->addVector4(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addVector3dFast(const char *varname, const LLVector3d& v) @@ -3654,7 +3654,7 @@ void LLMessageSystem::addVector3dFast(const char *varname, const LLVector3d& v) void LLMessageSystem::addVector3d(const char *varname, const LLVector3d& v) { - mMessageBuilder->addVector3d(gMessageStringTable.getString(varname), v); + mMessageBuilder->addVector3d(LLMessageStringTable::getInstance()->getString(varname), v); } void LLMessageSystem::addQuatFast(const char *varname, const LLQuaternion& v) @@ -3664,7 +3664,7 @@ void LLMessageSystem::addQuatFast(const char *varname, const LLQuaternion& v) void LLMessageSystem::addQuat(const char *varname, const LLQuaternion& v) { - mMessageBuilder->addQuat(gMessageStringTable.getString(varname), v); + mMessageBuilder->addQuat(LLMessageStringTable::getInstance()->getString(varname), v); } @@ -3675,7 +3675,7 @@ void LLMessageSystem::addUUIDFast(const char *varname, const LLUUID& v) void LLMessageSystem::addUUID(const char *varname, const LLUUID& v) { - mMessageBuilder->addUUID(gMessageStringTable.getString(varname), v); + mMessageBuilder->addUUID(LLMessageStringTable::getInstance()->getString(varname), v); } S32 LLMessageSystem::getCurrentSendTotal() const @@ -3692,8 +3692,8 @@ void LLMessageSystem::getS8Fast(const char *block, const char *var, S8 &u, void LLMessageSystem::getS8(const char *block, const char *var, S8 &u, S32 blocknum) { - getS8Fast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), u, blocknum); + getS8Fast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), u, blocknum); } void LLMessageSystem::getU8Fast(const char *block, const char *var, U8 &u, @@ -3705,8 +3705,8 @@ void LLMessageSystem::getU8Fast(const char *block, const char *var, U8 &u, void LLMessageSystem::getU8(const char *block, const char *var, U8 &u, S32 blocknum) { - getU8Fast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), u, blocknum); + getU8Fast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), u, blocknum); } void LLMessageSystem::getBOOLFast(const char *block, const char *var, BOOL &b, @@ -3718,8 +3718,8 @@ void LLMessageSystem::getBOOLFast(const char *block, const char *var, BOOL &b, void LLMessageSystem::getBOOL(const char *block, const char *var, BOOL &b, S32 blocknum) { - getBOOLFast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), b, blocknum); + getBOOLFast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), b, blocknum); } void LLMessageSystem::getS16Fast(const char *block, const char *var, S16 &d, @@ -3731,8 +3731,8 @@ void LLMessageSystem::getS16Fast(const char *block, const char *var, S16 &d, void LLMessageSystem::getS16(const char *block, const char *var, S16 &d, S32 blocknum) { - getS16Fast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), d, blocknum); + getS16Fast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), d, blocknum); } void LLMessageSystem::getU16Fast(const char *block, const char *var, U16 &d, @@ -3744,8 +3744,8 @@ void LLMessageSystem::getU16Fast(const char *block, const char *var, U16 &d, void LLMessageSystem::getU16(const char *block, const char *var, U16 &d, S32 blocknum) { - getU16Fast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), d, blocknum); + getU16Fast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), d, blocknum); } void LLMessageSystem::getS32Fast(const char *block, const char *var, S32 &d, @@ -3757,8 +3757,8 @@ void LLMessageSystem::getS32Fast(const char *block, const char *var, S32 &d, void LLMessageSystem::getS32(const char *block, const char *var, S32 &d, S32 blocknum) { - getS32Fast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), d, blocknum); + getS32Fast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), d, blocknum); } void LLMessageSystem::getU32Fast(const char *block, const char *var, U32 &d, @@ -3770,8 +3770,8 @@ void LLMessageSystem::getU32Fast(const char *block, const char *var, U32 &d, void LLMessageSystem::getU32(const char *block, const char *var, U32 &d, S32 blocknum) { - getU32Fast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), d, blocknum); + getU32Fast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), d, blocknum); } void LLMessageSystem::getU64Fast(const char *block, const char *var, U64 &d, @@ -3784,8 +3784,8 @@ void LLMessageSystem::getU64(const char *block, const char *var, U64 &d, S32 blocknum) { - getU64Fast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), d, blocknum); + getU64Fast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), d, blocknum); } void LLMessageSystem::getBinaryDataFast(const char *blockname, @@ -3802,8 +3802,8 @@ void LLMessageSystem::getBinaryData(const char *blockname, void *datap, S32 size, S32 blocknum, S32 max_size) { - getBinaryDataFast(gMessageStringTable.getString(blockname), - gMessageStringTable.getString(varname), + getBinaryDataFast(LLMessageStringTable::getInstance()->getString(blockname), + LLMessageStringTable::getInstance()->getString(varname), datap, size, blocknum, max_size); } @@ -3816,8 +3816,8 @@ void LLMessageSystem::getF32Fast(const char *block, const char *var, F32 &d, void LLMessageSystem::getF32(const char *block, const char *var, F32 &d, S32 blocknum) { - getF32Fast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), d, blocknum); + getF32Fast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), d, blocknum); } void LLMessageSystem::getF64Fast(const char *block, const char *var, F64 &d, @@ -3829,8 +3829,8 @@ void LLMessageSystem::getF64Fast(const char *block, const char *var, F64 &d, void LLMessageSystem::getF64(const char *block, const char *var, F64 &d, S32 blocknum) { - getF64Fast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), d, blocknum); + getF64Fast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), d, blocknum); } @@ -3843,8 +3843,8 @@ void LLMessageSystem::getVector3Fast(const char *block, const char *var, void LLMessageSystem::getVector3(const char *block, const char *var, LLVector3 &v, S32 blocknum ) { - getVector3Fast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), v, blocknum); + getVector3Fast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), v, blocknum); } void LLMessageSystem::getVector4Fast(const char *block, const char *var, @@ -3856,8 +3856,8 @@ void LLMessageSystem::getVector4Fast(const char *block, const char *var, void LLMessageSystem::getVector4(const char *block, const char *var, LLVector4 &v, S32 blocknum ) { - getVector4Fast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), v, blocknum); + getVector4Fast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), v, blocknum); } void LLMessageSystem::getVector3dFast(const char *block, const char *var, @@ -3869,8 +3869,8 @@ void LLMessageSystem::getVector3dFast(const char *block, const char *var, void LLMessageSystem::getVector3d(const char *block, const char *var, LLVector3d &v, S32 blocknum ) { - getVector3dFast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), v, blocknum); + getVector3dFast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), v, blocknum); } void LLMessageSystem::getQuatFast(const char *block, const char *var, @@ -3882,8 +3882,8 @@ void LLMessageSystem::getQuatFast(const char *block, const char *var, void LLMessageSystem::getQuat(const char *block, const char *var, LLQuaternion &q, S32 blocknum) { - getQuatFast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), q, blocknum); + getQuatFast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), q, blocknum); } void LLMessageSystem::getUUIDFast(const char *block, const char *var, @@ -3895,8 +3895,8 @@ void LLMessageSystem::getUUIDFast(const char *block, const char *var, void LLMessageSystem::getUUID(const char *block, const char *var, LLUUID &u, S32 blocknum ) { - getUUIDFast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), u, blocknum); + getUUIDFast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), u, blocknum); } void LLMessageSystem::getIPAddrFast(const char *block, const char *var, @@ -3908,8 +3908,8 @@ void LLMessageSystem::getIPAddrFast(const char *block, const char *var, void LLMessageSystem::getIPAddr(const char *block, const char *var, U32 &u, S32 blocknum) { - getIPAddrFast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), u, blocknum); + getIPAddrFast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), u, blocknum); } void LLMessageSystem::getIPPortFast(const char *block, const char *var, @@ -3921,8 +3921,8 @@ void LLMessageSystem::getIPPortFast(const char *block, const char *var, void LLMessageSystem::getIPPort(const char *block, const char *var, U16 &u, S32 blocknum) { - getIPPortFast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), u, + getIPPortFast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), u, blocknum); } @@ -3932,7 +3932,7 @@ void LLMessageSystem::getStringFast(const char *block, const char *var, { if(buffer_size <= 0) { - llwarns << "buffer_size <= 0" << llendl; + LL_WARNS("Messaging") << "buffer_size <= 0" << llendl; } mMessageReader->getString(block, var, buffer_size, s, blocknum); } @@ -3940,44 +3940,63 @@ void LLMessageSystem::getStringFast(const char *block, const char *var, void LLMessageSystem::getString(const char *block, const char *var, S32 buffer_size, char *s, S32 blocknum ) { - getStringFast(gMessageStringTable.getString(block), - gMessageStringTable.getString(var), buffer_size, s, + getStringFast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), buffer_size, s, blocknum); } -S32 LLMessageSystem::getNumberOfBlocksFast(const char *blockname) +void LLMessageSystem::getStringFast(const char *block, const char *var, + std::string& outstr, S32 blocknum) +{ + mMessageReader->getString(block, var, outstr, blocknum); +} + +void LLMessageSystem::getString(const char *block, const char *var, + std::string& outstr, S32 blocknum ) +{ + getStringFast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), outstr, + blocknum); +} + +BOOL LLMessageSystem::has(const char *blockname) const +{ + return getNumberOfBlocks(blockname) > 0; +} + +S32 LLMessageSystem::getNumberOfBlocksFast(const char *blockname) const { return mMessageReader->getNumberOfBlocks(blockname); } -S32 LLMessageSystem::getNumberOfBlocks(const char *blockname) +S32 LLMessageSystem::getNumberOfBlocks(const char *blockname) const { - return getNumberOfBlocksFast(gMessageStringTable.getString(blockname)); + return getNumberOfBlocksFast(LLMessageStringTable::getInstance()->getString(blockname)); } -S32 LLMessageSystem::getSizeFast(const char *blockname, const char *varname) +S32 LLMessageSystem::getSizeFast(const char *blockname, const char *varname) const { return mMessageReader->getSize(blockname, varname); } -S32 LLMessageSystem::getSize(const char *blockname, const char *varname) +S32 LLMessageSystem::getSize(const char *blockname, const char *varname) const { - return getSizeFast(gMessageStringTable.getString(blockname), - gMessageStringTable.getString(varname)); + return getSizeFast(LLMessageStringTable::getInstance()->getString(blockname), + LLMessageStringTable::getInstance()->getString(varname)); } // size in bytes of variable length data S32 LLMessageSystem::getSizeFast(const char *blockname, S32 blocknum, - const char *varname) + const char *varname) const { return mMessageReader->getSize(blockname, blocknum, varname); } S32 LLMessageSystem::getSize(const char *blockname, S32 blocknum, - const char *varname) + const char *varname) const { - return getSizeFast(gMessageStringTable.getString(blockname), blocknum, - gMessageStringTable.getString(varname)); + return getSizeFast(LLMessageStringTable::getInstance()->getString(blockname), blocknum, + LLMessageStringTable::getInstance()->getString(varname)); } S32 LLMessageSystem::getReceiveSize() const @@ -4001,6 +4020,7 @@ void LLMessageSystem::setTimeDecodesSpamThreshold( F32 seconds ) // TODO: babbage: move gServicePump in to LLMessageSystem? bool LLMessageSystem::checkAllMessages(S64 frame_count, LLPumpIO* http_pump) { + LLMemType mt_cam(LLMemType::MTYPE_MESSAGE_CHECK_ALL); if(checkMessages(frame_count)) { return true; @@ -4010,3 +4030,26 @@ bool LLMessageSystem::checkAllMessages(S64 frame_count, LLPumpIO* http_pump) http_pump->callback(); return (mPacketsIn - packetsIn) > 0; } + +void LLMessageSystem::banUdpMessage(const std::string& name) +{ + message_template_name_map_t::iterator itt = mMessageTemplates.find( + LLMessageStringTable::getInstance()->getString(name.c_str()) + ); + if(itt != mMessageTemplates.end()) + { + itt->second->banUdp(); + } + else + { + llwarns << "Attempted to ban an unknown message: " << name << "." << llendl; + } +} +const LLHost& LLMessageSystem::getSender() const +{ + return mLastSender; +} + +LLHTTPRegistration<LLHTTPNodeAdapter<LLTrustedMessageService> > + gHTTPRegistrationTrustedMessageWildcard("/trusted-message/<message-name>"); + diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 61d34b7fc1..1589ea29c1 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -2,30 +2,25 @@ * @file message.h * @brief LLMessageSystem class header file * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -58,17 +53,20 @@ #include "llhttpclient.h" #include "llhttpnode.h" #include "llpacketack.h" +#include "llsingleton.h" #include "message_prehash.h" #include "llstl.h" #include "llmsgvariabletype.h" -#include "llmsgvariabletype.h" +#include "llmessagesenderinterface.h" + +#include "llstoredmessage.h" const U32 MESSAGE_MAX_STRINGS_LENGTH = 64; const U32 MESSAGE_NUMBER_OF_HASH_BUCKETS = 8192; const S32 MESSAGE_MAX_PER_FRAME = 400; -class LLMessageStringTable +class LLMessageStringTable : public LLSingleton<LLMessageStringTable> { public: LLMessageStringTable(); @@ -81,7 +79,6 @@ public: char mString[MESSAGE_NUMBER_OF_HASH_BUCKETS][MESSAGE_MAX_STRINGS_LENGTH]; /* Flawfinder: ignore */ }; -extern LLMessageStringTable gMessageStringTable; // Individual Messages are described with the following format // Note that to ease parsing, keywords are used @@ -206,12 +203,15 @@ public: virtual void complete(const LLHost& host, const LLUUID& agent) const = 0; }; -class LLMessageSystem +class LLMessageSystem : public LLMessageSenderInterface { private: U8 mSendBuffer[MAX_BUFFER_SIZE]; S32 mSendSize; + bool mBlockUntrustedInterface; + LLHost mUntrustedInterface; + public: LLPacketRing mPacketRing; LLReliablePacketParams mReliablePacketParams; @@ -284,8 +284,10 @@ public: public: // Read file and build message templates - LLMessageSystem(const char *filename, U32 port, S32 version_major, - S32 version_minor, S32 version_patch); + LLMessageSystem(const std::string& filename, U32 port, S32 version_major, + S32 version_minor, S32 version_patch, + bool failure_is_fatal, + const F32 circuit_heartbeat_interval, const F32 circuit_timeout); ~LLMessageSystem(); @@ -295,14 +297,14 @@ public: // Read file and build message templates filename must point to a // valid string which specifies the path of a valid linden // template. - void loadTemplateFile(const char* filename); + void loadTemplateFile(const std::string& filename, bool failure_is_fatal); // methods for building, sending, receiving, and handling messages void setHandlerFuncFast(const char *name, void (*handler_func)(LLMessageSystem *msgsystem, void **user_data), void **user_data = NULL); void setHandlerFunc(const char *name, void (*handler_func)(LLMessageSystem *msgsystem, void **user_data), void **user_data = NULL) { - setHandlerFuncFast(gMessageStringTable.getString(name), handler_func, user_data); + setHandlerFuncFast(LLMessageStringTable::getInstance()->getString(name), handler_func, user_data); } // Set a callback function for a message system exception. @@ -339,7 +341,7 @@ public: BOOL isMessageFast(const char *msg); BOOL isMessage(const char *msg) { - return isMessageFast(gMessageStringTable.getString(msg)); + return isMessageFast(LLMessageStringTable::getInstance()->getString(msg)); } void dumpPacketToLog(); @@ -350,6 +352,8 @@ public: U32 getSenderIP() const; // getSender() is preferred U32 getSenderPort() const; // getSender() is preferred + const LLHost& getReceivingInterface() const; + // This method returns the uuid associated with the sender. The // UUID will be null if it is not yet known or is a server // circuit. @@ -366,14 +370,34 @@ public: void newMessageFast(const char *name); void newMessage(const char *name); - void copyMessageRtoS(); - void clearMessage(); + +public: + LLStoredMessagePtr getReceivedMessage() const; + LLStoredMessagePtr getBuiltMessage() const; + S32 sendMessage(const LLHost &host, LLStoredMessagePtr message); + +private: + LLSD getReceivedMessageLLSD() const; + LLSD getBuiltMessageLLSD() const; + + // NOTE: babbage: Only use to support legacy misuse of the + // LLMessageSystem API where values are dangerously written + // as one type and read as another. LLSD does not support + // dangerous conversions and so converting the message to an + // LLSD would result in the reads failing. All code which + // misuses the message system in this way should be made safe + // but while the unsafe code is run in old processes, this + // method should be used to forward unsafe messages. + LLSD wrapReceivedTemplateData() const; + LLSD wrapBuiltTemplateData() const; + +public: + + void copyMessageReceivedToSend(); + void clearMessage(); void nextBlockFast(const char *blockname); - void nextBlock(const char *blockname) - { - nextBlockFast(gMessageStringTable.getString(blockname)); - } + void nextBlock(const char *blockname); public: void addBinaryDataFast(const char *varname, const void *data, S32 size); @@ -454,14 +478,14 @@ public: void (*callback)(void **,S32), void ** callback_data); // flush sends a message only if data's been pushed on it. - S32 flushSemiReliable( const LLHost &host, + S32 flushSemiReliable( const LLHost &host, void (*callback)(void **,S32), void ** callback_data); - S32 flushReliable( const LLHost &host ); + S32 flushReliable( const LLHost &host ); - void forwardMessage(const LLHost &host); - void forwardReliable(const LLHost &host); - void forwardReliable(const U32 circuit_code); + void forwardMessage(const LLHost &host); + void forwardReliable(const LLHost &host); + void forwardReliable(const U32 circuit_code); S32 forwardReliable( const LLHost &host, S32 retries, @@ -473,11 +497,28 @@ public: LLHTTPClient::ResponderPtr createResponder(const std::string& name); S32 sendMessage(const LLHost &host); S32 sendMessage(const U32 circuit); +private: S32 sendMessage(const LLHost &host, const char* name, const LLSD& message); - +public: // BOOL decodeData(const U8 *buffer, const LLHost &host); + /** + gets binary data from the current message. + + @param blockname the name of the block in the message (from the message template) + + @param varname + + @param datap + + @param size expected size - set to zero to get any amount of data up to max_size. + Make sure max_size is set in that case! + + @param blocknum + + @param max_size the max number of bytes to read + */ void getBinaryDataFast(const char *blockname, const char *varname, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX); void getBinaryData(const char *blockname, const char *varname, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX); void getBOOLFast( const char *block, const char *var, BOOL &data, S32 blocknum = 0); @@ -516,6 +557,8 @@ public: void getIPPort( const char *block, const char *var, U16 &port, S32 blocknum = 0); void getStringFast( const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0); void getString( const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0); + void getStringFast( const char *block, const char *var, std::string& outstr, S32 blocknum = 0); + void getString( const char *block, const char *var, std::string& outstr, S32 blocknum = 0); // Utility functions to generate a replay-resistant digest check @@ -552,14 +595,28 @@ public: void sendDenyTrustedCircuit(const LLHost &host); /** Return false if host is unknown or untrusted */ + // Note:DaveH/Babbage some trusted messages can be received without a circuit bool isTrustedSender(const LLHost& host) const; + /** Return true if current message is from trusted source */ + bool isTrustedSender() 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; + // Mark an interface ineligible for trust + void setUntrustedInterface( const LLHost host ) { mUntrustedInterface = host; } + LLHost getUntrustedInterface() const { return mUntrustedInterface; } + void setBlockUntrustedInterface( bool block ) { mBlockUntrustedInterface = block; } // Throw a switch to allow, sending warnings only + bool getBlockUntrustedInterface() const { return mBlockUntrustedInterface; } + + // Change this message to be UDP black listed. + void banUdpMessage(const std::string& name); + + private: // A list of the circuits that need to be sent DenyTrustedCircuit messages. typedef std::set<LLHost> host_set_t; @@ -576,6 +633,7 @@ public: void establishBidirectionalTrust(const LLHost &host, S64 frame_count = 0); // returns whether the given host is on a trusted circuit + // Note:DaveH/Babbage some trusted messages can be received without a circuit BOOL getCircuitTrust(const LLHost &host); void setCircuitAllowTimeout(const LLHost &host, BOOL allow); @@ -589,13 +647,14 @@ public: LLHost findHost(const U32 circuit_code); void sanityCheck(); - S32 getNumberOfBlocksFast(const char *blockname); - S32 getNumberOfBlocks(const char *blockname); - S32 getSizeFast(const char *blockname, const char *varname); - S32 getSize(const char *blockname, const char *varname); + BOOL has(const char *blockname) const; + S32 getNumberOfBlocksFast(const char *blockname) const; + S32 getNumberOfBlocks(const char *blockname) const; + S32 getSizeFast(const char *blockname, const char *varname) const; + S32 getSize(const char *blockname, const char *varname) const; S32 getSizeFast(const char *blockname, S32 blocknum, - const char *varname); // size in bytes of data - S32 getSize(const char *blockname, S32 blocknum, const char *varname); + const char *varname) const; // size in bytes of data + S32 getSize(const char *blockname, S32 blocknum, const char *varname) const; void resetReceiveCounts(); // resets receive counts for all message types to 0 void dumpReceiveCounts(); // dumps receive count for each message type to llinfos @@ -644,6 +703,12 @@ public: const LLSD& message, LLHTTPNode::ResponsePtr responsep); + // this is added to support specific legacy messages and is + // ***not intended for general use*** Si, Gabriel, 2009 + static void dispatchTemplate(const std::string& msg_name, + const LLSD& message, + LLHTTPNode::ResponsePtr responsep); + void setMessageBans(const LLSD& trusted, const LLSD& untrusted); /** @@ -671,9 +736,18 @@ public: // Check UDP messages and pump http_pump to receive HTTP messages. bool checkAllMessages(S64 frame_count, LLPumpIO* http_pump); + + // Moved to allow access from LLTemplateMessageDispatcher + void clearReceiveState(); + + // This will cause all trust queries to return true until the next message + // is read: use with caution! + void receivedMessageFromTrustedSender(); private: + bool mLastMessageFromTrustedMessageService; + // The mCircuitCodes is a map from circuit codes to session // ids. This allows us to verify sessions on connect. typedef std::map<U32, LLUUID> code_session_map_t; @@ -684,7 +758,6 @@ private: LLUUID mSessionID; void addTemplate(LLMessageTemplate *templatep); - void clearReceiveState(); BOOL decodeTemplate( const U8* buffer, S32 buffer_size, LLMessageTemplate** msg_template ); void logMsgFromInvalidCircuit( const LLHost& sender, BOOL recv_reliable ); @@ -739,6 +812,7 @@ private: void init(); // ctor shared initialisation. LLHost mLastSender; + LLHost mLastReceivingIF; S32 mIncomingCompressedSize; // original size of compressed msg (0 if uncomp.) TPACKETID mCurrentRecvPacketID; // packet ID of current receive packet (for reporting) @@ -765,18 +839,21 @@ extern LLMessageSystem *gMessageSystem; // Must specific overall system version, which is used to determine // if a patch is available in the message template checksum verification. -// Return TRUE if able to initialize system. -BOOL start_messaging_system( +// Return true if able to initialize system. +bool start_messaging_system( const std::string& template_name, U32 port, S32 version_major, S32 version_minor, S32 version_patch, - BOOL b_dump_prehash_file, + bool b_dump_prehash_file, const std::string& secret, - const LLUseCircuitCodeResponder* responder = NULL); + const LLUseCircuitCodeResponder* responder, + bool failure_is_fatal, + const F32 circuit_heartbeat_interval, + const F32 circuit_timeout); -void end_messaging_system(); +void end_messaging_system(bool print_summary = true); void null_message_callback(LLMessageSystem *msg, void **data); @@ -953,8 +1030,7 @@ inline void *ntohmemcpy(void *s, const void *ct, EMsgVariableType type, size_t n return(htonmemcpy(s,ct,type, n)); } - -inline const LLHost& LLMessageSystem::getSender() const {return mLastSender;} +inline const LLHost& LLMessageSystem::getReceivingInterface() const {return mLastReceivingIF;} inline U32 LLMessageSystem::getSenderIP() const { @@ -966,6 +1042,7 @@ inline U32 LLMessageSystem::getSenderPort() const return mLastSender.getPort(); } + //----------------------------------------------------------------------------- // Transmission aliases //----------------------------------------------------------------------------- diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index 5190c93731..eb1e366149 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -2,30 +2,25 @@ * @file message_prehash.cpp * @brief file of prehashed variables * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -39,2673 +34,1344 @@ F32 gPrehashVersionNumber = 2.000f; -char * _PREHASH_X; -char * _PREHASH_Y; -char * _PREHASH_Z; -char * _PREHASH_AddFlags; -char * _PREHASH_FailureInfo; -char * _PREHASH_MapData; -char * _PREHASH_AddItem; -char * _PREHASH_MeanCollision; -char * _PREHASH_RezScript; -char * _PREHASH_AvatarSitResponse; -char * _PREHASH_InventoryAssetResponse; -char * _PREHASH_KillObject; -char * _PREHASH_ProposalID; -char * _PREHASH_SerialNum; -char * _PREHASH_Duration; -char * _PREHASH_ScriptQuestion; -char * _PREHASH_AddCircuitCode; -char * _PREHASH_UseCircuitCode; -char * _PREHASH_ViewerCircuitCode; -char * _PREHASH_ScriptAnswerYes; -char * _PREHASH_PartnerID; -char * _PREHASH_DirLandQuery; -char * _PREHASH_TeleportStart; -char * _PREHASH_AboutText; -char * _PREHASH_VisualParam; -char * _PREHASH_GroupPrims; -char * _PREHASH_SelectedPrims; -char * _PREHASH_ID; -char * _PREHASH_UUIDNameRequest; -char * _PREHASH_UUIDGroupNameRequest; -char * _PREHASH_GroupAccountTransactionsRequest; -char * _PREHASH_MapNameRequest; -char * _PREHASH_UpdateSimulator; -char * _PREHASH_BillableFactor; -char * _PREHASH_ObjectBonusFactor; -char * _PREHASH_EnableSimulator; -char * _PREHASH_DisableSimulator; -char * _PREHASH_ConfirmEnableSimulator; -char * _PREHASH_LayerType; -char * _PREHASH_OwnerRole; -char * _PREHASH_ParcelOverlay; -char * _PREHASH_GroupOwned; -char * _PREHASH_IP; -char * _PREHASH_ChatFromViewer; -char * _PREHASH_AvgAgentsInView; -char * _PREHASH_AgentsInView; -char * _PREHASH_GroupTitle; -char * _PREHASH_MapLayerReply; -char * _PREHASH_CompoundMsgID; -char * _PREHASH_CameraConstraint; -char * _PREHASH_DownloadTotals; -char * _PREHASH_GenCounter; -char * _PREHASH_FrozenData; -char * _PREHASH_ChildAgentDying; -char * _PREHASH_To; -char * _PREHASH_CopyInventoryFromNotecard; -char * _PREHASH_RezObjectFromNotecard; -char * _PREHASH_ParcelDirFeeCurrent; -char * _PREHASH_SeedCapability; -char * _PREHASH_ObjectDuplicate; -char * _PREHASH_InventoryData; -char * _PREHASH_ReplyData; -char * _PREHASH_ResetList; -char * _PREHASH_MediaID; -char * _PREHASH_RelatedRights; -char * _PREHASH_RedirectGridX; -char * _PREHASH_RedirectGridY; -char * _PREHASH_TransferID; -char * _PREHASH_TexturesChanged; -char * _PREHASH_UserLookAt; -char * _PREHASH_TestBlock1; -char * _PREHASH_SensedData; -char * _PREHASH_UpdateBlock; -char * _PREHASH_ClassifiedGodDelete; -char * _PREHASH_ObjectGrabUpdate; -char * _PREHASH_LocationPos; -char * _PREHASH_TaxDate; -char * _PREHASH_StartDateTime; -char * _PREHASH_ObjectUpdateCached; -char * _PREHASH_Packets; -char * _PREHASH_FailureType; -char * _PREHASH_UpdateGroupInfo; -char * _PREHASH_ObjectPermissions; -char * _PREHASH_RevokePermissions; -char * _PREHASH_UpdateFlags; -char * _PREHASH_ObjectExportSelected; -char * _PREHASH_RezSelected; -char * _PREHASH_AutoPilot; -char * _PREHASH_UpdateMuteListEntry; -char * _PREHASH_RemoveMuteListEntry; -char * _PREHASH_SetSimStatusInDatabase; -char * _PREHASH_SetSimPresenceInDatabase; -char * _PREHASH_CameraProperty; -char * _PREHASH_BrushSize; -char * _PREHASH_SimulatorSetMap; -char * _PREHASH_RegionPresenceRequestByRegionID; -char * _PREHASH_ParcelObjectOwnersReply; -char * _PREHASH_GroupMembersReply; -char * _PREHASH_GroupRoleMembersReply; -char * _PREHASH_RequestRegionInfo; -char * _PREHASH_AABBMax; -char * _PREHASH_RequestPayPrice; -char * _PREHASH_SimulatorPresentAtLocation; -char * _PREHASH_AgentRequestSit; -char * _PREHASH_AABBMin; -char * _PREHASH_ClassifiedFlags; -char * _PREHASH_ControlFlags; -char * _PREHASH_TeleportRequest; -char * _PREHASH_ScriptTeleportRequest; -char * _PREHASH_EstateCovenantRequest; -char * _PREHASH_DateUTC; -char * _PREHASH_TaskIDs; -char * _PREHASH_RequestResult; -char * _PREHASH_CanAcceptAgents; -char * _PREHASH_ObjectSaleInfo; -char * _PREHASH_KillChildAgents; -char * _PREHASH_Balance; -char * _PREHASH_DerezContainer; -char * _PREHASH_ObjectData; -char * _PREHASH_CameraAtAxis; -char * _PREHASH_InfoBlock; -char * _PREHASH_OwnershipCost; -char * _PREHASH_AvatarNotesUpdate; -char * _PREHASH_PID; -char * _PREHASH_DirPopularReply; -char * _PREHASH_TerrainHeightRange00; -char * _PREHASH_SimData; -char * _PREHASH_TerrainHeightRange01; -char * _PREHASH_TerrainHeightRange10; -char * _PREHASH_TerrainHeightRange11; -char * _PREHASH_UpdateInventoryItem; -char * _PREHASH_UpdateCreateInventoryItem; -char * _PREHASH_MoveInventoryItem; -char * _PREHASH_CopyInventoryItem; -char * _PREHASH_RemoveInventoryItem; -char * _PREHASH_CreateInventoryItem; -char * _PREHASH_PathTwistBegin; -char * _PREHASH_CRC; -char * _PREHASH_AttachmentPoint; -char * _PREHASH_TelehubBlock; -char * _PREHASH_FOVBlock; -char * _PREHASH_StartLocationData; -char * _PREHASH_PositionData; -char * _PREHASH_TimeSinceLast; -char * _PREHASH_MapImage; -char * _PREHASH_Objects; -char * _PREHASH_URL; -char * _PREHASH_CreationDate; -char * _PREHASH_JointPivot; -char * _PREHASH_FPS; -char * _PREHASH_HasTelehub; -char * _PREHASH_PathEnd; -char * _PREHASH_ScriptDataReply; -char * _PREHASH_MapBlockReply; -char * _PREHASH_PropertiesData; -char * _PREHASH_ViewerEffect; -char * _PREHASH_FreezeUser; -char * _PREHASH_OwnerPrims; -char * _PREHASH_ObjectGrab; -char * _PREHASH_ToAgentID; -char * _PREHASH_SimulatorMapUpdate; -char * _PREHASH_TransferPacket; -char * _PREHASH_ObjectName; -char * _PREHASH_GroupPowers; -char * _PREHASH_OriginalName; -char * _PREHASH_CompletePingCheck; -char * _PREHASH_OnlineStatus; -char * _PREHASH_ObjectDrop; -char * _PREHASH_UseBigPackets; -char * _PREHASH_GroupNoticesListReply; -char * _PREHASH_ParcelAccessListReply; -char * _PREHASH_RpcChannelReply; -char * _PREHASH_RegionPresenceResponse; -char * _PREHASH_CharterMember; -char * _PREHASH_EdgeData; -char * _PREHASH_NameData; -char * _PREHASH_RegionPushOverride; -char * _PREHASH_SimName; -char * _PREHASH_UserReport; -char * _PREHASH_DownloadPriority; -char * _PREHASH_ToAgentId; -char * _PREHASH_DirPopularQuery; -char * _PREHASH_Mag; -char * _PREHASH_ParcelPropertiesRequestByID; -char * _PREHASH_ObjectLink; -char * _PREHASH_RpcScriptReplyInbound; -char * _PREHASH_RezData; -char * _PREHASH_RemoveInventoryObjects; -char * _PREHASH_GroupProposalBallot; -char * _PREHASH_RPCServerIP; -char * _PREHASH_Far; -char * _PREHASH_GodSessionID; -char * _PREHASH_FLAboutText; -char * _PREHASH_RegionHandshakeReply; -char * _PREHASH_GroupActiveProposalItemReply; -char * _PREHASH_MapItemReply; -char * _PREHASH_Seconds; -char * _PREHASH_UpdateUserInfo; -char * _PREHASH_AggregatePermTexturesOwner; -char * _PREHASH_Set; -char * _PREHASH_NewName; -char * _PREHASH_Key; -char * _PREHASH_AgentID; -char * _PREHASH_EventNotificationRemoveRequest; -char * _PREHASH_NewFolderID; -char * _PREHASH_Arc; -char * _PREHASH_RegionX; -char * _PREHASH_RegionY; -char * _PREHASH_RequestData; -char * _PREHASH_Msg; -char * _PREHASH_Top; -char * _PREHASH_MiscStats; -char * _PREHASH_ImageID; -char * _PREHASH_DataPacket; -char * _PREHASH_You; -char * _PREHASH_ScriptControlChange; -char * _PREHASH_LoadURL; -char * _PREHASH_SetCPURatio; -char * _PREHASH_NameValueData; -char * _PREHASH_AtomicPassObject; -char * _PREHASH_ErrorMessage; -char * _PREHASH_ViewerFrozenMessage; -char * _PREHASH_HealthMessage; -char * _PREHASH_LogTextMessage; -char * _PREHASH_TimeDilation; -char * _PREHASH_RemoveContribution; -char * _PREHASH_Contribution; -char * _PREHASH_SetGroupContribution; -char * _PREHASH_Offline; -char * _PREHASH_AgentIsNowWearing; -char * _PREHASH_Members; -char * _PREHASH_FailedResends; -char * _PREHASH_SecPerDay; -char * _PREHASH_CameraCenter; -char * _PREHASH_CameraLeftAxis; -char * _PREHASH_ExBlock; -char * _PREHASH_Channel; -char * _PREHASH_NetTest; -char * _PREHASH_DiscardLevel; -char * _PREHASH_LayerID; -char * _PREHASH_GrabOffset; -char * _PREHASH_SimPort; -char * _PREHASH_PricePerMeter; -char * _PREHASH_RegionFlags; -char * _PREHASH_VoteResult; -char * _PREHASH_ParcelDirFeeEstimate; -char * _PREHASH_ModifyBlock; -char * _PREHASH_InventoryBlock; -char * _PREHASH_ReplyBlock; -char * _PREHASH_ValidUntil; -char * _PREHASH_VelocityInterpolateOn; -char * _PREHASH_ClassifiedDelete; -char * _PREHASH_RegionDenyAnonymous; -char * _PREHASH_FLImageID; -char * _PREHASH_AllowPublish; -char * _PREHASH_SitName; -char * _PREHASH_RegionsVisited; -char * _PREHASH_DirClassifiedReply; -char * _PREHASH_AvatarClassifiedReply; -char * _PREHASH_MediaURL; -char * _PREHASH_CompleteAgentMovement; -char * _PREHASH_ClassifiedID; -char * _PREHASH_LocalID; -char * _PREHASH_SpaceIP; -char * _PREHASH_RemoveItem; -char * _PREHASH_LogFailedMoneyTransaction; -char * _PREHASH_ViewerStartAuction; -char * _PREHASH_StartAuction; -char * _PREHASH_DuplicateFlags; -char * _PREHASH_RegionInfo2; -char * _PREHASH_TextColor; -char * _PREHASH_SlaveID; -char * _PREHASH_Charter; -char * _PREHASH_AlertData; -char * _PREHASH_TargetBlock; -char * _PREHASH_CheckParcelAuctions; -char * _PREHASH_ParcelAuctions; -char * _PREHASH_OwnerIsGroup; -char * _PREHASH_NameValuePair; -char * _PREHASH_RemoveNameValuePair; -char * _PREHASH_BulkUpdateInventory; -char * _PREHASH_UpdateTaskInventory; -char * _PREHASH_RemoveTaskInventory; -char * _PREHASH_MoveTaskInventory; -char * _PREHASH_RequestTaskInventory; -char * _PREHASH_ReplyTaskInventory; -char * _PREHASH_AggregatePermInventory; -char * _PREHASH_GroupAccountTransactionsReply; -char * _PREHASH_SimulatorInfo; -char * _PREHASH_WearableData; -char * _PREHASH_Enabled; -char * _PREHASH_Savings; -char * _PREHASH_SimulatorLoad; -char * _PREHASH_InternalRegionIP; -char * _PREHASH_ExternalRegionIP; -char * _PREHASH_TotalPairs; -char * _PREHASH_CreateGroupRequest; -char * _PREHASH_JoinGroupRequest; -char * _PREHASH_LeaveGroupRequest; -char * _PREHASH_InviteGroupRequest; -char * _PREHASH_LiveHelpGroupRequest; -char * _PREHASH_PriceParcelClaimFactor; -char * _PREHASH_BillableArea; -char * _PREHASH_ObjectID; -char * _PREHASH_ObjectFlagUpdate; -char * _PREHASH_GroupRoleUpdate; -char * _PREHASH_RequestInventoryAsset; -char * _PREHASH_ChangedGrid; -char * _PREHASH_AgentDropGroup; -char * _PREHASH_Details; -char * _PREHASH_LocationX; -char * _PREHASH_SaleType; -char * _PREHASH_LocationY; -char * _PREHASH_LocationZ; -char * _PREHASH_EconomyData; -char * _PREHASH_HeadRotation; -char * _PREHASH_DeleteOnCompletion; -char * _PREHASH_PublicPort; -char * _PREHASH_DirClassifiedQuery; -char * _PREHASH_CallbackID; -char * _PREHASH_RequestParcelTransfer; -char * _PREHASH_RoleCount; -char * _PREHASH_ObjectCapacity; -char * _PREHASH_RequestID; -char * _PREHASH_RequestXfer; -char * _PREHASH_ObjectTaxCurrent; -char * _PREHASH_LightTaxCurrent; -char * _PREHASH_LandTaxCurrent; -char * _PREHASH_GroupTaxCurrent; -char * _PREHASH_FetchInventoryDescendents; -char * _PREHASH_InventoryDescendents; -char * _PREHASH_Descendents; -char * _PREHASH_PurgeInventoryDescendents; -char * _PREHASH_ShowDir; -char * _PREHASH_IsOwner; -char * _PREHASH_Timestamp; -char * _PREHASH_GlobalPos; -char * _PREHASH_GrabOffsetInitial; -char * _PREHASH_IsTrial; -char * _PREHASH_ObjectDuplicateOnRay; -char * _PREHASH_GroupMembershipCount; -char * _PREHASH_MethodData; -char * _PREHASH_ActivateGestures; -char * _PREHASH_DeactivateGestures; -char * _PREHASH_ProposalData; -char * _PREHASH_PosGlobal; -char * _PREHASH_SearchID; -char * _PREHASH_RezMultipleAttachmentsFromInv; -char * _PREHASH_SearchName; -char * _PREHASH_VersionString; -char * _PREHASH_CreateGroupReply; -char * _PREHASH_LeaveGroupReply; -char * _PREHASH_ActualArea; -char * _PREHASH_Message; -char * _PREHASH_ClickAction; -char * _PREHASH_AssetUploadComplete; -char * _PREHASH_RequestType; -char * _PREHASH_UUID; -char * _PREHASH_BaseMask; -char * _PREHASH_NetBlock; -char * _PREHASH_GlobalX; -char * _PREHASH_GlobalY; -char * _PREHASH_CopyRotates; -char * _PREHASH_KickUserAck; -char * _PREHASH_TopPick; -char * _PREHASH_SessionID; -char * _PREHASH_GlobalZ; -char * _PREHASH_DeclineFriendship; -char * _PREHASH_FormFriendship; -char * _PREHASH_TerminateFriendship; -char * _PREHASH_TaskData; -char * _PREHASH_SimWideMaxPrims; -char * _PREHASH_TotalPrims; -char * _PREHASH_ProfileBegin; -char * _PREHASH_Request; -char * _PREHASH_GroupAccountDetailsRequest; -char * _PREHASH_GroupActiveProposalsRequest; -char * _PREHASH_StringValue; -char * _PREHASH_Version; -char * _PREHASH_OtherCount; -char * _PREHASH_MemberCount; -char * _PREHASH_ChatData; -char * _PREHASH_IsGroupOwned; -char * _PREHASH_EnergyEfficiency; -char * _PREHASH_PickInfoUpdate; -char * _PREHASH_PickDelete; -char * _PREHASH_ScriptReset; -char * _PREHASH_Requester; -char * _PREHASH_ForSale; -char * _PREHASH_NearestLandingRegionReply; -char * _PREHASH_ParcelID; -char * _PREHASH_Godlike; -char * _PREHASH_TotalDebits; -char * _PREHASH_Direction; -char * _PREHASH_HealthData; -char * _PREHASH_LeftAxis; -char * _PREHASH_LocationBlock; -char * _PREHASH_ObjectImage; -char * _PREHASH_TerrainStartHeight00; -char * _PREHASH_TerrainStartHeight01; -char * _PREHASH_TerrainStartHeight10; -char * _PREHASH_TerrainStartHeight11; -char * _PREHASH_WaterHeight; -char * _PREHASH_FetchInventoryReply; -char * _PREHASH_GroupAccountSummaryReply; -char * _PREHASH_AttachedSound; -char * _PREHASH_ParamInUse; -char * _PREHASH_GodKickUser; -char * _PREHASH_PickName; -char * _PREHASH_TaskName; -char * _PREHASH_ObjectCount; -char * _PREHASH_RegionPresenceRequestByHandle; -char * _PREHASH_RezSingleAttachmentFromInv; -char * _PREHASH_ChildAgentUpdate; -char * _PREHASH_IsOwnerGroup; -char * _PREHASH_AgentHeightWidth; -char * _PREHASH_VerticalAngle; -char * _PREHASH_WearableType; -char * _PREHASH_AggregatePermNextOwner; -char * _PREHASH_ShowInList; -char * _PREHASH_UpdateParcel; -char * _PREHASH_SetAlwaysRun; -char * _PREHASH_NVPair; -char * _PREHASH_SearchType; -char * _PREHASH_ObjectSpinStart; -char * _PREHASH_UseEstateSun; -char * _PREHASH_RegionID; -char * _PREHASH_AbuseRegionID; -char * _PREHASH_Creator; -char * _PREHASH_ProposalText; -char * _PREHASH_DirEventsReply; -char * _PREHASH_EventInfoReply; -char * _PREHASH_UserInfoReply; -char * _PREHASH_PathRadiusOffset; -char * _PREHASH_TextureData; -char * _PREHASH_ChatPass; -char * _PREHASH_TargetID; -char * _PREHASH_DefaultPayPrice; -char * _PREHASH_UserLocation; -char * _PREHASH_MaxPrims; -char * _PREHASH_LandmarkID; -char * _PREHASH_InitiateDownload; -char * _PREHASH_Name; -char * _PREHASH_OtherCleanTime; -char * _PREHASH_ParcelSetOtherCleanTime; -char * _PREHASH_TeleportPriceExponent; -char * _PREHASH_Gain; -char * _PREHASH_PacketAck; -char * _PREHASH_PathSkew; -char * _PREHASH_SimulatorShutdownRequest; -char * _PREHASH_NearestLandingRegionRequest; -char * _PREHASH_OtherID; -char * _PREHASH_MemberID; -char * _PREHASH_MapLayerRequest; -char * _PREHASH_ObjectScale; -char * _PREHASH_TargetIP; -char * _PREHASH_Redo; -char * _PREHASH_MoneyBalance; -char * _PREHASH_TrackAgent; -char * _PREHASH_MaxX; -char * _PREHASH_Data; -char * _PREHASH_MaxY; -char * _PREHASH_TextureAnim; -char * _PREHASH_ReturnIDs; -char * _PREHASH_Date; -char * _PREHASH_AgentWearablesUpdate; -char * _PREHASH_AgentDataUpdate; -char * _PREHASH_GroupDataUpdate; -char * _PREHASH_Hash; -char * _PREHASH_AgentGroupDataUpdate; -char * _PREHASH_Left; -char * _PREHASH_Mask; -char * _PREHASH_ForceMouselook; -char * _PREHASH_Success; -char * _PREHASH_ObjectGroup; -char * _PREHASH_SunHour; -char * _PREHASH_MinX; -char * _PREHASH_ScriptSensorReply; -char * _PREHASH_MinY; -char * _PREHASH_Command; -char * _PREHASH_Desc; -char * _PREHASH_AttachmentNeedsSave; -char * _PREHASH_HistoryItemData; -char * _PREHASH_AgentCachedTexture; -char * _PREHASH_Subject; -char * _PREHASH_East; -char * _PREHASH_QueryReplies; -char * _PREHASH_ObjectCategory; -char * _PREHASH_Time; -char * _PREHASH_CreateLandmarkForEvent; -char * _PREHASH_ParentID; -char * _PREHASH_Ping; -char * _PREHASH_Perp; -char * _PREHASH_Code; -char * _PREHASH_InvType; -char * _PREHASH_AgentFOV; -char * _PREHASH_Audible; -char * _PREHASH_AuctionData; -char * _PREHASH_IDBlock; -char * _PREHASH_West; -char * _PREHASH_Undo; -char * _PREHASH_TotalNumItems; -char * _PREHASH_Info; -char * _PREHASH_Area; -char * _PREHASH_SimCrashed; -char * _PREHASH_Text; -char * _PREHASH_PriceGroupCreate; -char * _PREHASH_ObjectShape; -char * _PREHASH_GroupRoleDataReply; -char * _PREHASH_MuteCRC; -char * _PREHASH_Size; -char * _PREHASH_FromAddress; -char * _PREHASH_Body; -char * _PREHASH_FileData; -char * _PREHASH_List; -char * _PREHASH_KickUser; -char * _PREHASH_OtherPrims; -char * _PREHASH_RunTime; -char * _PREHASH_GrantUserRights; -char * _PREHASH_RpcScriptRequestInboundForward; -char * _PREHASH_More; -char * _PREHASH_Majority; -char * _PREHASH_MetersTraveled; -char * _PREHASH_Stat; -char * _PREHASH_SoundID; -char * _PREHASH_Item; -char * _PREHASH_User; -char * _PREHASH_Prey; -char * _PREHASH_RayStart; -char * _PREHASH_UsecSinceStart; -char * _PREHASH_ParcelData; -char * _PREHASH_CameraUpAxis; -char * _PREHASH_ScriptDialog; -char * _PREHASH_MasterParcelData; -char * _PREHASH_Invalid; -char * _PREHASH_ProfileCurve; -char * _PREHASH_ParcelAccessListUpdate; -char * _PREHASH_MuteListUpdate; -char * _PREHASH_SendPacket; -char * _PREHASH_SendXferPacket; -char * _PREHASH_RegionDenyIdentified; -char * _PREHASH_NotecardItemID; -char * _PREHASH_LastName; -char * _PREHASH_From; -char * _PREHASH_RoleChange; -char * _PREHASH_Port; -char * _PREHASH_MemberTitle; -char * _PREHASH_LogParcelChanges; -char * _PREHASH_AgentCachedTextureResponse; -char * _PREHASH_DeRezObject; -char * _PREHASH_IsTemporary; -char * _PREHASH_InsigniaID; -char * _PREHASH_CheckFlags; -char * _PREHASH_EventID; -char * _PREHASH_Selected; -char * _PREHASH_FromAgentId; -char * _PREHASH_Type; -char * _PREHASH_ChatType; -char * _PREHASH_ReportData; -char * _PREHASH_RequestBlock; -char * _PREHASH_GrantData; -char * _PREHASH_DetachAttachmentIntoInv; -char * _PREHASH_ParcelDisableObjects; -char * _PREHASH_Sections; -char * _PREHASH_GodLevel; -char * _PREHASH_PayPriceReply; -char * _PREHASH_QueryID; -char * _PREHASH_CameraEyeOffset; -char * _PREHASH_AgentPosition; -char * _PREHASH_GrabPosition; -char * _PREHASH_OnlineNotification; -char * _PREHASH_OfflineNotification; -char * _PREHASH_SendPostcard; -char * _PREHASH_RequestFlags; -char * _PREHASH_GroupAccountSummaryRequest; -char * _PREHASH_GroupVoteHistoryRequest; -char * _PREHASH_ParamValue; -char * _PREHASH_MaxAgents; -char * _PREHASH_CreateNewOutfitAttachments; -char * _PREHASH_RegionHandle; -char * _PREHASH_TeleportProgress; -char * _PREHASH_AgentQuitCopy; -char * _PREHASH_AvatarInterestsUpdate; -char * _PREHASH_GroupNoticeID; -char * _PREHASH_ParcelName; -char * _PREHASH_PriceObjectRent; -char * _PREHASH_OfferCallingCard; -char * _PREHASH_AcceptCallingCard; -char * _PREHASH_DeclineCallingCard; -char * _PREHASH_AgentAccess; -char * _PREHASH_DataHomeLocationReply; -char * _PREHASH_EventLocationReply; -char * _PREHASH_TerseDateID; -char * _PREHASH_ObjectOwner; -char * _PREHASH_AssetID; -char * _PREHASH_AlertMessage; -char * _PREHASH_AgentAlertMessage; -char * _PREHASH_EstateOwnerMessage; -char * _PREHASH_ParcelMediaCommandMessage; -char * _PREHASH_Auction; -char * _PREHASH_Category; -char * _PREHASH_FilePath; -char * _PREHASH_ItemFlags; -char * _PREHASH_Invoice; -char * _PREHASH_IntervalDays; -char * _PREHASH_PathScaleX; -char * _PREHASH_FromTaskID; -char * _PREHASH_PathScaleY; -char * _PREHASH_TimeInfo; -char * _PREHASH_PublicCount; -char * _PREHASH_ParcelJoin; -char * _PREHASH_GroupRolesCount; -char * _PREHASH_SimulatorBlock; -char * _PREHASH_GroupID; -char * _PREHASH_AgentVel; -char * _PREHASH_RequestImage; -char * _PREHASH_NetStats; -char * _PREHASH_AgentPos; -char * _PREHASH_AgentSit; -char * _PREHASH_Material; -char * _PREHASH_ObjectDeGrab; -char * _PREHASH_VelocityInterpolateOff; -char * _PREHASH_AuthorizedBuyerID; -char * _PREHASH_AvatarPropertiesReply; -char * _PREHASH_GroupProfileReply; -char * _PREHASH_SimOwner; -char * _PREHASH_SalePrice; -char * _PREHASH_Animation; -char * _PREHASH_OwnerID; -char * _PREHASH_NearestLandingRegionUpdated; -char * _PREHASH_PassToAgent; -char * _PREHASH_PreyAgent; -char * _PREHASH_SimStats; -char * _PREHASH_LogoutReply; -char * _PREHASH_FeatureDisabled; -char * _PREHASH_PhysicalAvatarEventList; -char * _PREHASH_ObjectLocalID; -char * _PREHASH_Dropped; -char * _PREHASH_WebProfilesDisabled; -char * _PREHASH_Destination; -char * _PREHASH_MasterID; -char * _PREHASH_TransferData; -char * _PREHASH_WantToMask; -char * _PREHASH_ParcelSelectObjects; -char * _PREHASH_ExtraParams; -char * _PREHASH_CreatorID; -char * _PREHASH_Summary; -char * _PREHASH_BuyObjectInventory; -char * _PREHASH_FetchInventory; -char * _PREHASH_InventoryID; -char * _PREHASH_PacketNumber; -char * _PREHASH_SetFollowCamProperties; -char * _PREHASH_ClearFollowCamProperties; -char * _PREHASH_SequenceID; -char * _PREHASH_DataServerLogout; -char * _PREHASH_NameValue; -char * _PREHASH_PathShearX; -char * _PREHASH_PathShearY; -char * _PREHASH_Velocity; -char * _PREHASH_SecPerYear; -char * _PREHASH_FirstName; -char * _PREHASH_AttachedSoundGainChange; -char * _PREHASH_LocationID; -char * _PREHASH_Running; -char * _PREHASH_AgentThrottle; -char * _PREHASH_NeighborList; -char * _PREHASH_PathTaperX; -char * _PREHASH_PathTaperY; -char * _PREHASH_AgentRelated; -char * _PREHASH_GranterBlock; -char * _PREHASH_UseCachedMuteList; -char * _PREHASH_FailStats; -char * _PREHASH_Tempfile; -char * _PREHASH_BuyerID; -char * _PREHASH_DirPeopleReply; -char * _PREHASH_TransferInfo; -char * _PREHASH_AvatarPickerRequestBackend; -char * _PREHASH_AvatarPropertiesRequestBackend; -char * _PREHASH_UpdateData; -char * _PREHASH_SimFPS; -char * _PREHASH_ReporterID; -char * _PREHASH_ButtonLabel; -char * _PREHASH_GranterID; -char * _PREHASH_WantToText; -char * _PREHASH_ReportType; -char * _PREHASH_SimulatorReady; -char * _PREHASH_DataBlock; -char * _PREHASH_AnimationSourceList; -char * _PREHASH_SubscribeLoad; -char * _PREHASH_UnsubscribeLoad; -char * _PREHASH_Packet; -char * _PREHASH_UndoLand; -char * _PREHASH_SimAccess; -char * _PREHASH_AbuserID; -char * _PREHASH_MembershipFee; -char * _PREHASH_InviteGroupResponse; -char * _PREHASH_CreateInventoryFolder; -char * _PREHASH_UpdateInventoryFolder; -char * _PREHASH_MoveInventoryFolder; -char * _PREHASH_RemoveInventoryFolder; -char * _PREHASH_MoneyData; -char * _PREHASH_ObjectDeselect; -char * _PREHASH_NewAssetID; -char * _PREHASH_ObjectAdd; -char * _PREHASH_RayEndIsIntersection; -char * _PREHASH_CompleteAuction; -char * _PREHASH_CircuitCode; -char * _PREHASH_AgentMovementComplete; -char * _PREHASH_ViewerIP; -char * _PREHASH_Header; -char * _PREHASH_GestureFlags; -char * _PREHASH_XferID; -char * _PREHASH_StatValue; -char * _PREHASH_TaskID; -char * _PREHASH_PickID; -char * _PREHASH_RayEnd; -char * _PREHASH_Throttles; -char * _PREHASH_RebakeAvatarTextures; -char * _PREHASH_UpAxis; -char * _PREHASH_AgentTextures; -char * _PREHASH_NotecardData; -char * _PREHASH_Radius; -char * _PREHASH_OffCircuit; -char * _PREHASH_Access; -char * _PREHASH_TitleRoleID; -char * _PREHASH_SquareMetersCredit; -char * _PREHASH_Filename; -char * _PREHASH_ClassifiedInfoRequest; -char * _PREHASH_ParcelInfoRequest; -char * _PREHASH_ParcelObjectOwnersRequest; -char * _PREHASH_TeleportLandmarkRequest; -char * _PREHASH_EventInfoRequest; -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_ButtonIndex; -char * _PREHASH_GetScriptRunning; -char * _PREHASH_SetScriptRunning; -char * _PREHASH_Health; -char * _PREHASH_CircuitInfo; -char * _PREHASH_ObjectBuy; -char * _PREHASH_ProfileEnd; -char * _PREHASH_Effect; -char * _PREHASH_TestMessage; -char * _PREHASH_ScriptMailRegistration; -char * _PREHASH_AgentSetAppearance; -char * _PREHASH_AvatarAppearance; -char * _PREHASH_RegionData; -char * _PREHASH_RequestingRegionData; -char * _PREHASH_LandingRegionData; -char * _PREHASH_SitTransform; -char * _PREHASH_TerrainBase0; -char * _PREHASH_SkillsMask; -char * _PREHASH_AtAxis; -char * _PREHASH_TerrainBase1; -char * _PREHASH_Reason; -char * _PREHASH_TerrainBase2; -char * _PREHASH_TerrainBase3; -char * _PREHASH_Params; -char * _PREHASH_PingID; -char * _PREHASH_Change; -char * _PREHASH_Height; -char * _PREHASH_Region; -char * _PREHASH_TelehubInfo; -char * _PREHASH_StateSave; -char * _PREHASH_RoleData; -char * _PREHASH_AgentAnimation; -char * _PREHASH_AvatarAnimation; -char * _PREHASH_LogDwellTime; -char * _PREHASH_ParcelGodMarkAsContent; -char * _PREHASH_UsePhysics; -char * _PREHASH_RegionDenyTransacted; -char * _PREHASH_JointType; -char * _PREHASH_ObjectTaxEstimate; -char * _PREHASH_LightTaxEstimate; -char * _PREHASH_LandTaxEstimate; -char * _PREHASH_TeleportLandingStatusChanged; -char * _PREHASH_GroupTaxEstimate; -char * _PREHASH_AvgViewerFPS; -char * _PREHASH_Buttons; -char * _PREHASH_Sender; -char * _PREHASH_Dialog; -char * _PREHASH_TargetData; -char * _PREHASH_DestID; -char * _PREHASH_PricePublicObjectDelete; -char * _PREHASH_ObjectDelete; -char * _PREHASH_Delete; -char * _PREHASH_EventGodDelete; -char * _PREHASH_LastTaxDate; -char * _PREHASH_MapImageID; -char * _PREHASH_EndDateTime; -char * _PREHASH_TerrainDetail0; -char * _PREHASH_TerrainDetail1; -char * _PREHASH_TerrainDetail2; -char * _PREHASH_TerrainDetail3; -char * _PREHASH_Offset; -char * _PREHASH_ObjectDelink; -char * _PREHASH_TargetObject; -char * _PREHASH_IsEstateManager; -char * _PREHASH_CancelAuction; -char * _PREHASH_ObjectDetach; -char * _PREHASH_Compressed; -char * _PREHASH_PathBegin; -char * _PREHASH_BypassRaycast; -char * _PREHASH_WinnerID; -char * _PREHASH_ChannelType; -char * _PREHASH_NonExemptMembers; -char * _PREHASH_Agents; -char * _PREHASH_MemberData; -char * _PREHASH_ToGroupID; -char * _PREHASH_ImageNotInDatabase; -char * _PREHASH_StartDate; -char * _PREHASH_AnimID; -char * _PREHASH_Serial; -char * _PREHASH_AbuseRegionName; -char * _PREHASH_ModifyLand; -char * _PREHASH_Digest; -char * _PREHASH_Victim; -char * _PREHASH_Script; -char * _PREHASH_PickInfoReply; -char * _PREHASH_MoneyBalanceReply; -char * _PREHASH_RoutedMoneyBalanceReply; -char * _PREHASH_RoleID; -char * _PREHASH_RegionInfo; -char * _PREHASH_GodUpdateRegionInfo; -char * _PREHASH_StartAnim; -char * _PREHASH_Action; -char * _PREHASH_Location; -char * _PREHASH_Rights; -char * _PREHASH_SearchDir; -char * _PREHASH_TransferRequest; -char * _PREHASH_ScriptSensorRequest; -char * _PREHASH_MoneyTransferRequest; -char * _PREHASH_EjectGroupMemberRequest; -char * _PREHASH_SkillsText; -char * _PREHASH_Resent; -char * _PREHASH_Center; -char * _PREHASH_SharedData; -char * _PREHASH_PSBlock; -char * _PREHASH_UUIDNameBlock; -char * _PREHASH_GroupTitleUpdate; -char * _PREHASH_Method; -char * _PREHASH_TouchName; -char * _PREHASH_UpdateType; -char * _PREHASH_KickedFromEstateID; -char * _PREHASH_CandidateID; -char * _PREHASH_ParamData; -char * _PREHASH_GodlikeMessage; -char * _PREHASH_SystemMessage; -char * _PREHASH_BodyRotation; -char * _PREHASH_SearchRegions; -char * _PREHASH_AnimationData; -char * _PREHASH_StatID; -char * _PREHASH_ItemID; -char * _PREHASH_ScriptDialogReply; -char * _PREHASH_RegionIDAndHandleReply; -char * _PREHASH_CameraAtOffset; -char * _PREHASH_VoteID; -char * _PREHASH_ParcelGodForceOwner; -char * _PREHASH_Filter; -char * _PREHASH_InviteData; -char * _PREHASH_PCode; -char * _PREHASH_SearchPos; -char * _PREHASH_PreyID; -char * _PREHASH_TerrainLowerLimit; -char * _PREHASH_EventFlags; -char * _PREHASH_TallyVotes; -char * _PREHASH_Result; -char * _PREHASH_LookAt; -char * _PREHASH_SearchOrder; -char * _PREHASH_PayButton; -char * _PREHASH_SelfCount; -char * _PREHASH_PacketCount; -char * _PREHASH_ParcelBuyPass; -char * _PREHASH_OldItemID; -char * _PREHASH_RegionPort; -char * _PREHASH_PriceEnergyUnit; -char * _PREHASH_Bitmap; -char * _PREHASH_CacheMissType; -char * _PREHASH_VFileID; -char * _PREHASH_GroupInsigniaID; -char * _PREHASH_Online; -char * _PREHASH_KickFlags; -char * _PREHASH_CovenantID; -char * _PREHASH_SysCPU; -char * _PREHASH_EMail; -char * _PREHASH_AggregatePermTextures; -char * _PREHASH_ChatChannel; -char * _PREHASH_ReturnID; -char * _PREHASH_ObjectAttach; -char * _PREHASH_TargetPort; -char * _PREHASH_ObjectSpinStop; -char * _PREHASH_FullID; -char * _PREHASH_ActivateGroup; -char * _PREHASH_SysGPU; -char * _PREHASH_AvatarInterestsReply; -char * _PREHASH_StartLure; -char * _PREHASH_SysRAM; -char * _PREHASH_ObjectPosition; -char * _PREHASH_SitPosition; -char * _PREHASH_StartTime; -char * _PREHASH_BornOn; -char * _PREHASH_CameraCollidePlane; -char * _PREHASH_EconomyDataRequest; -char * _PREHASH_TeleportLureRequest; -char * _PREHASH_FolderID; -char * _PREHASH_RegionHandleRequest; -char * _PREHASH_ScriptDataRequest; -char * _PREHASH_GroupRoleDataRequest; -char * _PREHASH_GroupTitlesRequest; -char * _PREHASH_AgentWearablesRequest; -char * _PREHASH_MapBlockRequest; -char * _PREHASH_LureID; -char * _PREHASH_CopyCenters; -char * _PREHASH_ParamList; -char * _PREHASH_InventorySerial; -char * _PREHASH_EdgeDataPacket; -char * _PREHASH_AvatarPickerReply; -char * _PREHASH_ParcelDwellReply; -char * _PREHASH_IsForSale; -char * _PREHASH_MuteID; -char * _PREHASH_MeanCollisionAlert; -char * _PREHASH_CanAcceptTasks; -char * _PREHASH_ItemData; -char * _PREHASH_AnimationList; -char * _PREHASH_Reputation; -char * _PREHASH_IntValue; -char * _PREHASH_TargetType; -char * _PREHASH_Amount; -char * _PREHASH_HasAttachment; -char * _PREHASH_UpdateAttachment; -char * _PREHASH_RemoveAttachment; -char * _PREHASH_HeightWidthBlock; -char * _PREHASH_RequestObjectPropertiesFamily; -char * _PREHASH_ObjectPropertiesFamily; -char * _PREHASH_UserData; -char * _PREHASH_IsReadable; -char * _PREHASH_PathCurve; -char * _PREHASH_Status; -char * _PREHASH_FromGroup; -char * _PREHASH_AlreadyVoted; -char * _PREHASH_PlacesReply; -char * _PREHASH_DirPlacesReply; -char * _PREHASH_ParcelBuy; -char * _PREHASH_DirFindQueryBackend; -char * _PREHASH_DirPlacesQueryBackend; -char * _PREHASH_DirClassifiedQueryBackend; -char * _PREHASH_DirLandQueryBackend; -char * _PREHASH_DirPopularQueryBackend; -char * _PREHASH_HistoryData; -char * _PREHASH_SnapshotID; -char * _PREHASH_Aspect; -char * _PREHASH_ParamSize; -char * _PREHASH_VoteCast; -char * _PREHASH_CastsShadows; -char * _PREHASH_EveryoneMask; -char * _PREHASH_ObjectSpinUpdate; -char * _PREHASH_MaturePublish; -char * _PREHASH_UseExistingAsset; -char * _PREHASH_Powers; -char * _PREHASH_ParcelLocalID; -char * _PREHASH_TeleportCancel; -char * _PREHASH_UnixTime; -char * _PREHASH_QueryFlags; -char * _PREHASH_AlwaysRun; -char * _PREHASH_Bottom; -char * _PREHASH_ButtonData; -char * _PREHASH_SoundData; -char * _PREHASH_ViewerStats; -char * _PREHASH_RegionHandshake; -char * _PREHASH_ObjectDescription; -char * _PREHASH_Description; -char * _PREHASH_ParamType; -char * _PREHASH_UUIDNameReply; -char * _PREHASH_UUIDGroupNameReply; -char * _PREHASH_SaveAssetIntoInventory; -char * _PREHASH_UserInfo; -char * _PREHASH_AnimSequenceID; -char * _PREHASH_NVPairs; -char * _PREHASH_GroupNoticesListRequest; -char * _PREHASH_ParcelAccessListRequest; -char * _PREHASH_MuteListRequest; -char * _PREHASH_RpcChannelRequest; -char * _PREHASH_LandStatRequest; -char * _PREHASH_PlacesQuery; -char * _PREHASH_DirPlacesQuery; -char * _PREHASH_SortOrder; -char * _PREHASH_Hunter; -char * _PREHASH_SunAngVelocity; -char * _PREHASH_BinaryBucket; -char * _PREHASH_ImagePacket; -char * _PREHASH_StartGroupProposal; -char * _PREHASH_EnergyLevel; -char * _PREHASH_PriceForListing; -char * _PREHASH_Scale; -char * _PREHASH_EstateCovenantReply; -char * _PREHASH_ParentEstateID; -char * _PREHASH_Extra2; -char * _PREHASH_Throttle; -char * _PREHASH_SimIP; -char * _PREHASH_GodID; -char * _PREHASH_TeleportMinPrice; -char * _PREHASH_VoteItem; -char * _PREHASH_ObjectRotation; -char * _PREHASH_SitRotation; -char * _PREHASH_SnapSelection; -char * _PREHASH_SoundTrigger; -char * _PREHASH_TerrainRaiseLimit; -char * _PREHASH_Quorum; -char * _PREHASH_AgentBlock; -char * _PREHASH_CommandBlock; -char * _PREHASH_PricePublicObjectDecay; -char * _PREHASH_SpawnPointPos; -char * _PREHASH_VolumeDetail; -char * _PREHASH_FromAgentName; -char * _PREHASH_Range; -char * _PREHASH_DirectoryVisibility; -char * _PREHASH_PublicIP; -char * _PREHASH_TeleportFailed; -char * _PREHASH_PreloadSound; -char * _PREHASH_ScreenshotID; -char * _PREHASH_CovenantTimestamp; -char * _PREHASH_OldestUnacked; -char * _PREHASH_SimulatorIP; -char * _PREHASH_Value; -char * _PREHASH_JointAxisOrAnchor; -char * _PREHASH_Test0; -char * _PREHASH_Test1; -char * _PREHASH_Test2; -char * _PREHASH_SunPhase; -char * _PREHASH_ParcelDivide; -char * _PREHASH_PriceObjectClaim; -char * _PREHASH_Field; -char * _PREHASH_Ratio; -char * _PREHASH_JoinGroupReply; -char * _PREHASH_LiveHelpGroupReply; -char * _PREHASH_Score; -char * _PREHASH_Image; -char * _PREHASH_ObjectClickAction; -char * _PREHASH_Parameter; -char * _PREHASH_Flags; -char * _PREHASH_Plane; -char * _PREHASH_Width; -char * _PREHASH_Right; -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_Modal; -char * _PREHASH_ChildAgentUnknown; -char * _PREHASH_LandingType; -char * _PREHASH_ScriptRunningReply; -char * _PREHASH_Reply; -char * _PREHASH_GroupAccountDetailsReply; -char * _PREHASH_TelehubRot; -char * _PREHASH_AcceptFriendship; -char * _PREHASH_ItemType; -char * _PREHASH_DwellInfo; -char * _PREHASH_AgentResume; -char * _PREHASH_MailFilter; -char * _PREHASH_Disconnect; -char * _PREHASH_SimPosition; -char * _PREHASH_SimWideTotalPrims; -char * _PREHASH_Index; -char * _PREHASH_SimFilename; -char * _PREHASH_LastOwnerID; -char * _PREHASH_GroupNoticeRequest; -char * _PREHASH_EmailMessageRequest; -char * _PREHASH_MapItemRequest; -char * _PREHASH_AgentCount; -char * _PREHASH_MessageBlock; -char * _PREHASH_FuseBlock; -char * _PREHASH_AgentGroupData; -char * _PREHASH_ClassifiedInfoUpdate; -char * _PREHASH_RegionPos; -char * _PREHASH_ParcelMediaUpdate; -char * _PREHASH_NoticeID; -char * _PREHASH_GridX; -char * _PREHASH_GridY; -char * _PREHASH_Title; -char * _PREHASH_AuctionID; -char * _PREHASH_VoteType; -char * _PREHASH_CategoryID; -char * _PREHASH_Token; -char * _PREHASH_AggregatePerms; -char * _PREHASH_ObjectSelect; -char * _PREHASH_ForceObjectSelect; -char * _PREHASH_Price; -char * _PREHASH_SunDirection; -char * _PREHASH_FromName; -char * _PREHASH_ChangeInventoryItemFlags; -char * _PREHASH_Force; -char * _PREHASH_TransactionBlock; -char * _PREHASH_PowersMask; -char * _PREHASH_Stamp; -char * _PREHASH_TotalCredits; -char * _PREHASH_State; -char * _PREHASH_TextureIndex; -char * _PREHASH_InviteeID; -char * _PREHASH_ParcelReclaim; -char * _PREHASH_Money; -char * _PREHASH_PathTwist; -char * _PREHASH_AuthBuyerID; -char * _PREHASH_Color; -char * _PREHASH_SourceType; -char * _PREHASH_World; -char * _PREHASH_QueryData; -char * _PREHASH_Users; -char * _PREHASH_SysOS; -char * _PREHASH_Notes; -char * _PREHASH_AvatarID; -char * _PREHASH_FounderID; -char * _PREHASH_EndPointID; -char * _PREHASH_LocationLookAt; -char * _PREHASH_Sound; -char * _PREHASH_Cover; -char * _PREHASH_TotalObjectCount; -char * _PREHASH_TextureEntry; -char * _PREHASH_SquareMetersCommitted; -char * _PREHASH_ChannelID; -char * _PREHASH_Dwell; -char * _PREHASH_North; -char * _PREHASH_AgentUpdate; -char * _PREHASH_PickGodDelete; -char * _PREHASH_HostName; -char * _PREHASH_PriceParcelClaim; -char * _PREHASH_ParcelClaim; -char * _PREHASH_AgentPowers; -char * _PREHASH_ProfileHollow; -char * _PREHASH_GroupRoleChanges; -char * _PREHASH_Count; -char * _PREHASH_South; -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; -char * _PREHASH_FolderData; -char * _PREHASH_AssetBlock; -char * _PREHASH_AcceptNotices; -char * _PREHASH_SetGroupAcceptNotices; -char * _PREHASH_CloseCircuit; -char * _PREHASH_TeleportFinish; -char * _PREHASH_PathRevolutions; -char * _PREHASH_ClassifiedInfoReply; -char * _PREHASH_ParcelInfoReply; -char * _PREHASH_AutosaveData; -char * _PREHASH_SetStartLocation; -char * _PREHASH_PassHours; -char * _PREHASH_AttachmentPt; -char * _PREHASH_ParcelFlags; -char * _PREHASH_NumVotes; -char * _PREHASH_AvatarPickerRequest; -char * _PREHASH_TeleportLocationRequest; -char * _PREHASH_DataHomeLocationRequest; -char * _PREHASH_EventNotificationAddRequest; -char * _PREHASH_ParcelDwellRequest; -char * _PREHASH_EventLocationRequest; -char * _PREHASH_SetStartLocationRequest; -char * _PREHASH_QueryStart; -char * _PREHASH_EjectData; -char * _PREHASH_AvatarTextureUpdate; -char * _PREHASH_RPCServerPort; -char * _PREHASH_Bytes; -char * _PREHASH_Extra; -char * _PREHASH_ForceScriptControlRelease; -char * _PREHASH_ParcelRelease; -char * _PREHASH_VFileType; -char * _PREHASH_EjectGroupMemberReply; -char * _PREHASH_ImageData; -char * _PREHASH_SimulatorViewerTimeMessage; -char * _PREHASH_Rotation; -char * _PREHASH_Selection; -char * _PREHASH_TransactionData; -char * _PREHASH_OperationData; -char * _PREHASH_ExpirationDate; -char * _PREHASH_ParcelDeedToGroup; -char * _PREHASH_AvatarPicksReply; -char * _PREHASH_GroupTitlesReply; -char * _PREHASH_AgentInfo; -char * _PREHASH_MoneyTransferBackend; -char * _PREHASH_NextOwnerMask; -char * _PREHASH_MuteData; -char * _PREHASH_PassPrice; -char * _PREHASH_SourceID; -char * _PREHASH_ChangeUserRights; -char * _PREHASH_TeleportFlags; -char * _PREHASH_SlaveParcelData; -char * _PREHASH_AssetData; -char * _PREHASH_MultipleObjectUpdate; -char * _PREHASH_ObjectUpdate; -char * _PREHASH_ImprovedTerseObjectUpdate; -char * _PREHASH_ConfirmXferPacket; -char * _PREHASH_StartPingCheck; -char * _PREHASH_SimWideDeletes; -char * _PREHASH_LandStatReply; -char * _PREHASH_IsPhantom; -char * _PREHASH_AgentList; -char * _PREHASH_SimApproved; -char * _PREHASH_RezObject; -char * _PREHASH_TaskLocalID; -char * _PREHASH_ClaimDate; -char * _PREHASH_MergeParcel; -char * _PREHASH_Priority; -char * _PREHASH_QueryText; -char * _PREHASH_GroupNoticeAdd; -char * _PREHASH_ReturnType; -char * _PREHASH_FetchFolders; -char * _PREHASH_SimulatorPublicHostBlock; -char * _PREHASH_HeaderData; -char * _PREHASH_RequestMultipleObjects; -char * _PREHASH_RetrieveInstantMessages; -char * _PREHASH_OpenCircuit; -char * _PREHASH_CrossedRegion; -char * _PREHASH_DirGroupsReply; -char * _PREHASH_AvatarGroupsReply; -char * _PREHASH_EmailMessageReply; -char * _PREHASH_GroupVoteHistoryItemReply; -char * _PREHASH_ViewerPosition; -char * _PREHASH_Position; -char * _PREHASH_ParentEstate; -char * _PREHASH_EstateName; -char * _PREHASH_MuteName; -char * _PREHASH_ParcelRename; -char * _PREHASH_ViewerFilename; -char * _PREHASH_UserReportInternal; -char * _PREHASH_AvatarPropertiesRequest; -char * _PREHASH_ParcelPropertiesRequest; -char * _PREHASH_GroupProfileRequest; -char * _PREHASH_AgentDataUpdateRequest; -char * _PREHASH_PriceObjectScaleFactor; -char * _PREHASH_OpenEnrollment; -char * _PREHASH_GroupData; -char * _PREHASH_RequestGodlikePowers; -char * _PREHASH_GrantGodlikePowers; -char * _PREHASH_TransactionID; -char * _PREHASH_DestinationID; -char * _PREHASH_Controls; -char * _PREHASH_FirstDetachAll; -char * _PREHASH_EstateID; -char * _PREHASH_ImprovedInstantMessage; -char * _PREHASH_CheckParcelSales; -char * _PREHASH_ParcelSales; -char * _PREHASH_CurrentInterval; -char * _PREHASH_PriceRentLight; -char * _PREHASH_MediaAutoScale; -char * _PREHASH_NeighborBlock; -char * _PREHASH_LayerData; -char * _PREHASH_NVPairData; -char * _PREHASH_TeleportLocal; -char * _PREHASH_EjecteeID; -char * _PREHASH_VoteInitiator; -char * _PREHASH_TypeData; -char * _PREHASH_OwnerIDs; -char * _PREHASH_SystemKickUser; -char * _PREHASH_TransactionTime; -char * _PREHASH_TimeToLive; -char * _PREHASH_OldAgentID; -char * _PREHASH_MusicURL; -char * _PREHASH_ParcelPrimBonus; -char * _PREHASH_EjectUser; -char * _PREHASH_CoarseLocationUpdate; -char * _PREHASH_ChildAgentPositionUpdate; -char * _PREHASH_StoreLocal; -char * _PREHASH_GroupName; -char * _PREHASH_PriceParcelRent; -char * _PREHASH_SimStatus; -char * _PREHASH_TransactionSuccess; -char * _PREHASH_LureType; -char * _PREHASH_GroupMask; -char * _PREHASH_SitObject; -char * _PREHASH_Override; -char * _PREHASH_LocomotionState; -char * _PREHASH_PriceUpload; -char * _PREHASH_RemoveParcel; -char * _PREHASH_ConfirmAuctionStart; -char * _PREHASH_RpcScriptRequestInbound; -char * _PREHASH_ActiveGroupID; -char * _PREHASH_ParcelReturnObjects; -char * _PREHASH_TotalObjects; -char * _PREHASH_ObjectExtraParams; -char * _PREHASH_Questions; -char * _PREHASH_TransferAbort; -char * _PREHASH_TransferInventory; -char * _PREHASH_RayTargetID; -char * _PREHASH_ClaimPrice; -char * _PREHASH_ObjectProperties; -char * _PREHASH_ParcelProperties; -char * _PREHASH_EstateOwnerID; -char * _PREHASH_LogoutRequest; -char * _PREHASH_AssetUploadRequest; -char * _PREHASH_TransactionType; -char * _PREHASH_AvatarPropertiesUpdate; -char * _PREHASH_ParcelPropertiesUpdate; -char * _PREHASH_FetchItems; -char * _PREHASH_AbortXfer; -char * _PREHASH_DeRezAck; -char * _PREHASH_TakeControls; -char * _PREHASH_DirLandReply; -char * _PREHASH_MuteType; -char * _PREHASH_IMViaEMail; -char * _PREHASH_RentPrice; -char * _PREHASH_GenericMessage; -char * _PREHASH_ChildAgentAlive; -char * _PREHASH_AssetType; -char * _PREHASH_SpawnPointBlock; -char * _PREHASH_AttachmentBlock; -char * _PREHASH_ObjectMaterial; -char * _PREHASH_OwnerName; -char * _PREHASH_AvatarNotesReply; -char * _PREHASH_CacheID; -char * _PREHASH_OwnerMask; -char * _PREHASH_TransferInventoryAck; -char * _PREHASH_RegionDenyAgeUnverified; -char * _PREHASH_AgeVerificationBlock; - - -void init_prehash_data() -{ - _PREHASH_X = gMessageStringTable.getString("X"); - _PREHASH_Y = gMessageStringTable.getString("Y"); - _PREHASH_Z = gMessageStringTable.getString("Z"); - _PREHASH_AddFlags = gMessageStringTable.getString("AddFlags"); - _PREHASH_FailureInfo = gMessageStringTable.getString("FailureInfo"); - _PREHASH_MapData = gMessageStringTable.getString("MapData"); - _PREHASH_AddItem = gMessageStringTable.getString("AddItem"); - _PREHASH_MeanCollision = gMessageStringTable.getString("MeanCollision"); - _PREHASH_RezScript = gMessageStringTable.getString("RezScript"); - _PREHASH_AvatarSitResponse = gMessageStringTable.getString("AvatarSitResponse"); - _PREHASH_InventoryAssetResponse = gMessageStringTable.getString("InventoryAssetResponse"); - _PREHASH_KillObject = gMessageStringTable.getString("KillObject"); - _PREHASH_ProposalID = gMessageStringTable.getString("ProposalID"); - _PREHASH_SerialNum = gMessageStringTable.getString("SerialNum"); - _PREHASH_Duration = gMessageStringTable.getString("Duration"); - _PREHASH_ScriptQuestion = gMessageStringTable.getString("ScriptQuestion"); - _PREHASH_AddCircuitCode = gMessageStringTable.getString("AddCircuitCode"); - _PREHASH_UseCircuitCode = gMessageStringTable.getString("UseCircuitCode"); - _PREHASH_ViewerCircuitCode = gMessageStringTable.getString("ViewerCircuitCode"); - _PREHASH_ScriptAnswerYes = gMessageStringTable.getString("ScriptAnswerYes"); - _PREHASH_PartnerID = gMessageStringTable.getString("PartnerID"); - _PREHASH_DirLandQuery = gMessageStringTable.getString("DirLandQuery"); - _PREHASH_TeleportStart = gMessageStringTable.getString("TeleportStart"); - _PREHASH_AboutText = gMessageStringTable.getString("AboutText"); - _PREHASH_VisualParam = gMessageStringTable.getString("VisualParam"); - _PREHASH_GroupPrims = gMessageStringTable.getString("GroupPrims"); - _PREHASH_SelectedPrims = gMessageStringTable.getString("SelectedPrims"); - _PREHASH_ID = gMessageStringTable.getString("ID"); - _PREHASH_UUIDNameRequest = gMessageStringTable.getString("UUIDNameRequest"); - _PREHASH_UUIDGroupNameRequest = gMessageStringTable.getString("UUIDGroupNameRequest"); - _PREHASH_GroupAccountTransactionsRequest = gMessageStringTable.getString("GroupAccountTransactionsRequest"); - _PREHASH_MapNameRequest = gMessageStringTable.getString("MapNameRequest"); - _PREHASH_UpdateSimulator = gMessageStringTable.getString("UpdateSimulator"); - _PREHASH_BillableFactor = gMessageStringTable.getString("BillableFactor"); - _PREHASH_ObjectBonusFactor = gMessageStringTable.getString("ObjectBonusFactor"); - _PREHASH_EnableSimulator = gMessageStringTable.getString("EnableSimulator"); - _PREHASH_DisableSimulator = gMessageStringTable.getString("DisableSimulator"); - _PREHASH_ConfirmEnableSimulator = gMessageStringTable.getString("ConfirmEnableSimulator"); - _PREHASH_LayerType = gMessageStringTable.getString("LayerType"); - _PREHASH_OwnerRole = gMessageStringTable.getString("OwnerRole"); - _PREHASH_ParcelOverlay = gMessageStringTable.getString("ParcelOverlay"); - _PREHASH_GroupOwned = gMessageStringTable.getString("GroupOwned"); - _PREHASH_IP = gMessageStringTable.getString("IP"); - _PREHASH_ChatFromViewer = gMessageStringTable.getString("ChatFromViewer"); - _PREHASH_AvgAgentsInView = gMessageStringTable.getString("AvgAgentsInView"); - _PREHASH_AgentsInView = gMessageStringTable.getString("AgentsInView"); - _PREHASH_GroupTitle = gMessageStringTable.getString("GroupTitle"); - _PREHASH_MapLayerReply = gMessageStringTable.getString("MapLayerReply"); - _PREHASH_CompoundMsgID = gMessageStringTable.getString("CompoundMsgID"); - _PREHASH_CameraConstraint = gMessageStringTable.getString("CameraConstraint"); - _PREHASH_DownloadTotals = gMessageStringTable.getString("DownloadTotals"); - _PREHASH_GenCounter = gMessageStringTable.getString("GenCounter"); - _PREHASH_FrozenData = gMessageStringTable.getString("FrozenData"); - _PREHASH_ChildAgentDying = gMessageStringTable.getString("ChildAgentDying"); - _PREHASH_To = gMessageStringTable.getString("To"); - _PREHASH_CopyInventoryFromNotecard = gMessageStringTable.getString("CopyInventoryFromNotecard"); - _PREHASH_RezObjectFromNotecard = gMessageStringTable.getString("RezObjectFromNotecard"); - _PREHASH_ParcelDirFeeCurrent = gMessageStringTable.getString("ParcelDirFeeCurrent"); - _PREHASH_SeedCapability = gMessageStringTable.getString("SeedCapability"); - _PREHASH_ObjectDuplicate = gMessageStringTable.getString("ObjectDuplicate"); - _PREHASH_InventoryData = gMessageStringTable.getString("InventoryData"); - _PREHASH_ReplyData = gMessageStringTable.getString("ReplyData"); - _PREHASH_ResetList = gMessageStringTable.getString("ResetList"); - _PREHASH_MediaID = gMessageStringTable.getString("MediaID"); - _PREHASH_RelatedRights = gMessageStringTable.getString("RelatedRights"); - _PREHASH_RedirectGridX = gMessageStringTable.getString("RedirectGridX"); - _PREHASH_RedirectGridY = gMessageStringTable.getString("RedirectGridY"); - _PREHASH_TransferID = gMessageStringTable.getString("TransferID"); - _PREHASH_TexturesChanged = gMessageStringTable.getString("TexturesChanged"); - _PREHASH_UserLookAt = gMessageStringTable.getString("UserLookAt"); - _PREHASH_TestBlock1 = gMessageStringTable.getString("TestBlock1"); - _PREHASH_SensedData = gMessageStringTable.getString("SensedData"); - _PREHASH_UpdateBlock = gMessageStringTable.getString("UpdateBlock"); - _PREHASH_ClassifiedGodDelete = gMessageStringTable.getString("ClassifiedGodDelete"); - _PREHASH_ObjectGrabUpdate = gMessageStringTable.getString("ObjectGrabUpdate"); - _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"); - _PREHASH_FailureType = gMessageStringTable.getString("FailureType"); - _PREHASH_UpdateGroupInfo = gMessageStringTable.getString("UpdateGroupInfo"); - _PREHASH_ObjectPermissions = gMessageStringTable.getString("ObjectPermissions"); - _PREHASH_RevokePermissions = gMessageStringTable.getString("RevokePermissions"); - _PREHASH_UpdateFlags = gMessageStringTable.getString("UpdateFlags"); - _PREHASH_ObjectExportSelected = gMessageStringTable.getString("ObjectExportSelected"); - _PREHASH_RezSelected = gMessageStringTable.getString("RezSelected"); - _PREHASH_AutoPilot = gMessageStringTable.getString("AutoPilot"); - _PREHASH_UpdateMuteListEntry = gMessageStringTable.getString("UpdateMuteListEntry"); - _PREHASH_RemoveMuteListEntry = gMessageStringTable.getString("RemoveMuteListEntry"); - _PREHASH_SetSimStatusInDatabase = gMessageStringTable.getString("SetSimStatusInDatabase"); - _PREHASH_SetSimPresenceInDatabase = gMessageStringTable.getString("SetSimPresenceInDatabase"); - _PREHASH_CameraProperty = gMessageStringTable.getString("CameraProperty"); - _PREHASH_BrushSize = gMessageStringTable.getString("BrushSize"); - _PREHASH_SimulatorSetMap = gMessageStringTable.getString("SimulatorSetMap"); - _PREHASH_RegionPresenceRequestByRegionID = gMessageStringTable.getString("RegionPresenceRequestByRegionID"); - _PREHASH_ParcelObjectOwnersReply = gMessageStringTable.getString("ParcelObjectOwnersReply"); - _PREHASH_GroupMembersReply = gMessageStringTable.getString("GroupMembersReply"); - _PREHASH_GroupRoleMembersReply = gMessageStringTable.getString("GroupRoleMembersReply"); - _PREHASH_RequestRegionInfo = gMessageStringTable.getString("RequestRegionInfo"); - _PREHASH_AABBMax = gMessageStringTable.getString("AABBMax"); - _PREHASH_RequestPayPrice = gMessageStringTable.getString("RequestPayPrice"); - _PREHASH_SimulatorPresentAtLocation = gMessageStringTable.getString("SimulatorPresentAtLocation"); - _PREHASH_AgentRequestSit = gMessageStringTable.getString("AgentRequestSit"); - _PREHASH_AABBMin = gMessageStringTable.getString("AABBMin"); - _PREHASH_ClassifiedFlags = gMessageStringTable.getString("ClassifiedFlags"); - _PREHASH_ControlFlags = gMessageStringTable.getString("ControlFlags"); - _PREHASH_TeleportRequest = gMessageStringTable.getString("TeleportRequest"); - _PREHASH_ScriptTeleportRequest = gMessageStringTable.getString("ScriptTeleportRequest"); - _PREHASH_EstateCovenantRequest = gMessageStringTable.getString("EstateCovenantRequest"); - _PREHASH_DateUTC = gMessageStringTable.getString("DateUTC"); - _PREHASH_TaskIDs = gMessageStringTable.getString("TaskIDs"); - _PREHASH_RequestResult = gMessageStringTable.getString("RequestResult"); - _PREHASH_CanAcceptAgents = gMessageStringTable.getString("CanAcceptAgents"); - _PREHASH_ObjectSaleInfo = gMessageStringTable.getString("ObjectSaleInfo"); - _PREHASH_KillChildAgents = gMessageStringTable.getString("KillChildAgents"); - _PREHASH_Balance = gMessageStringTable.getString("Balance"); - _PREHASH_DerezContainer = gMessageStringTable.getString("DerezContainer"); - _PREHASH_ObjectData = gMessageStringTable.getString("ObjectData"); - _PREHASH_CameraAtAxis = gMessageStringTable.getString("CameraAtAxis"); - _PREHASH_InfoBlock = gMessageStringTable.getString("InfoBlock"); - _PREHASH_OwnershipCost = gMessageStringTable.getString("OwnershipCost"); - _PREHASH_AvatarNotesUpdate = gMessageStringTable.getString("AvatarNotesUpdate"); - _PREHASH_PID = gMessageStringTable.getString("PID"); - _PREHASH_DirPopularReply = gMessageStringTable.getString("DirPopularReply"); - _PREHASH_TerrainHeightRange00 = gMessageStringTable.getString("TerrainHeightRange00"); - _PREHASH_SimData = gMessageStringTable.getString("SimData"); - _PREHASH_TerrainHeightRange01 = gMessageStringTable.getString("TerrainHeightRange01"); - _PREHASH_TerrainHeightRange10 = gMessageStringTable.getString("TerrainHeightRange10"); - _PREHASH_TerrainHeightRange11 = gMessageStringTable.getString("TerrainHeightRange11"); - _PREHASH_UpdateInventoryItem = gMessageStringTable.getString("UpdateInventoryItem"); - _PREHASH_UpdateCreateInventoryItem = gMessageStringTable.getString("UpdateCreateInventoryItem"); - _PREHASH_MoveInventoryItem = gMessageStringTable.getString("MoveInventoryItem"); - _PREHASH_CopyInventoryItem = gMessageStringTable.getString("CopyInventoryItem"); - _PREHASH_RemoveInventoryItem = gMessageStringTable.getString("RemoveInventoryItem"); - _PREHASH_CreateInventoryItem = gMessageStringTable.getString("CreateInventoryItem"); - _PREHASH_PathTwistBegin = gMessageStringTable.getString("PathTwistBegin"); - _PREHASH_CRC = gMessageStringTable.getString("CRC"); - _PREHASH_AttachmentPoint = gMessageStringTable.getString("AttachmentPoint"); - _PREHASH_TelehubBlock = gMessageStringTable.getString("TelehubBlock"); - _PREHASH_FOVBlock = gMessageStringTable.getString("FOVBlock"); - _PREHASH_StartLocationData = gMessageStringTable.getString("StartLocationData"); - _PREHASH_PositionData = gMessageStringTable.getString("PositionData"); - _PREHASH_TimeSinceLast = gMessageStringTable.getString("TimeSinceLast"); - _PREHASH_MapImage = gMessageStringTable.getString("MapImage"); - _PREHASH_Objects = gMessageStringTable.getString("Objects"); - _PREHASH_URL = gMessageStringTable.getString("URL"); - _PREHASH_CreationDate = gMessageStringTable.getString("CreationDate"); - _PREHASH_JointPivot = gMessageStringTable.getString("JointPivot"); - _PREHASH_FPS = gMessageStringTable.getString("FPS"); - _PREHASH_HasTelehub = gMessageStringTable.getString("HasTelehub"); - _PREHASH_PathEnd = gMessageStringTable.getString("PathEnd"); - _PREHASH_ScriptDataReply = gMessageStringTable.getString("ScriptDataReply"); - _PREHASH_MapBlockReply = gMessageStringTable.getString("MapBlockReply"); - _PREHASH_PropertiesData = gMessageStringTable.getString("PropertiesData"); - _PREHASH_ViewerEffect = gMessageStringTable.getString("ViewerEffect"); - _PREHASH_FreezeUser = gMessageStringTable.getString("FreezeUser"); - _PREHASH_OwnerPrims = gMessageStringTable.getString("OwnerPrims"); - _PREHASH_ObjectGrab = gMessageStringTable.getString("ObjectGrab"); - _PREHASH_ToAgentID = gMessageStringTable.getString("ToAgentID"); - _PREHASH_SimulatorMapUpdate = gMessageStringTable.getString("SimulatorMapUpdate"); - _PREHASH_TransferPacket = gMessageStringTable.getString("TransferPacket"); - _PREHASH_ObjectName = gMessageStringTable.getString("ObjectName"); - _PREHASH_GroupPowers = gMessageStringTable.getString("GroupPowers"); - _PREHASH_OriginalName = gMessageStringTable.getString("OriginalName"); - _PREHASH_CompletePingCheck = gMessageStringTable.getString("CompletePingCheck"); - _PREHASH_OnlineStatus = gMessageStringTable.getString("OnlineStatus"); - _PREHASH_ObjectDrop = gMessageStringTable.getString("ObjectDrop"); - _PREHASH_UseBigPackets = gMessageStringTable.getString("UseBigPackets"); - _PREHASH_GroupNoticesListReply = gMessageStringTable.getString("GroupNoticesListReply"); - _PREHASH_ParcelAccessListReply = gMessageStringTable.getString("ParcelAccessListReply"); - _PREHASH_RpcChannelReply = gMessageStringTable.getString("RpcChannelReply"); - _PREHASH_RegionPresenceResponse = gMessageStringTable.getString("RegionPresenceResponse"); - _PREHASH_CharterMember = gMessageStringTable.getString("CharterMember"); - _PREHASH_EdgeData = gMessageStringTable.getString("EdgeData"); - _PREHASH_NameData = gMessageStringTable.getString("NameData"); - _PREHASH_RegionPushOverride = gMessageStringTable.getString("RegionPushOverride"); - _PREHASH_SimName = gMessageStringTable.getString("SimName"); - _PREHASH_UserReport = gMessageStringTable.getString("UserReport"); - _PREHASH_DownloadPriority = gMessageStringTable.getString("DownloadPriority"); - _PREHASH_ToAgentId = gMessageStringTable.getString("ToAgentId"); - _PREHASH_DirPopularQuery = gMessageStringTable.getString("DirPopularQuery"); - _PREHASH_Mag = gMessageStringTable.getString("Mag"); - _PREHASH_ParcelPropertiesRequestByID = gMessageStringTable.getString("ParcelPropertiesRequestByID"); - _PREHASH_ObjectLink = gMessageStringTable.getString("ObjectLink"); - _PREHASH_RpcScriptReplyInbound = gMessageStringTable.getString("RpcScriptReplyInbound"); - _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_FLAboutText = gMessageStringTable.getString("FLAboutText"); - _PREHASH_RegionHandshakeReply = gMessageStringTable.getString("RegionHandshakeReply"); - _PREHASH_GroupActiveProposalItemReply = gMessageStringTable.getString("GroupActiveProposalItemReply"); - _PREHASH_MapItemReply = gMessageStringTable.getString("MapItemReply"); - _PREHASH_Seconds = gMessageStringTable.getString("Seconds"); - _PREHASH_UpdateUserInfo = gMessageStringTable.getString("UpdateUserInfo"); - _PREHASH_AggregatePermTexturesOwner = gMessageStringTable.getString("AggregatePermTexturesOwner"); - _PREHASH_Set = gMessageStringTable.getString("Set"); - _PREHASH_NewName = gMessageStringTable.getString("NewName"); - _PREHASH_Key = gMessageStringTable.getString("Key"); - _PREHASH_AgentID = gMessageStringTable.getString("AgentID"); - _PREHASH_EventNotificationRemoveRequest = gMessageStringTable.getString("EventNotificationRemoveRequest"); - _PREHASH_NewFolderID = gMessageStringTable.getString("NewFolderID"); - _PREHASH_Arc = gMessageStringTable.getString("Arc"); - _PREHASH_RegionX = gMessageStringTable.getString("RegionX"); - _PREHASH_RegionY = gMessageStringTable.getString("RegionY"); - _PREHASH_RequestData = gMessageStringTable.getString("RequestData"); - _PREHASH_Msg = gMessageStringTable.getString("Msg"); - _PREHASH_Top = gMessageStringTable.getString("Top"); - _PREHASH_MiscStats = gMessageStringTable.getString("MiscStats"); - _PREHASH_ImageID = gMessageStringTable.getString("ImageID"); - _PREHASH_DataPacket = gMessageStringTable.getString("DataPacket"); - _PREHASH_You = gMessageStringTable.getString("You"); - _PREHASH_ScriptControlChange = gMessageStringTable.getString("ScriptControlChange"); - _PREHASH_LoadURL = gMessageStringTable.getString("LoadURL"); - _PREHASH_SetCPURatio = gMessageStringTable.getString("SetCPURatio"); - _PREHASH_NameValueData = gMessageStringTable.getString("NameValueData"); - _PREHASH_AtomicPassObject = gMessageStringTable.getString("AtomicPassObject"); - _PREHASH_ErrorMessage = gMessageStringTable.getString("ErrorMessage"); - _PREHASH_ViewerFrozenMessage = gMessageStringTable.getString("ViewerFrozenMessage"); - _PREHASH_HealthMessage = gMessageStringTable.getString("HealthMessage"); - _PREHASH_LogTextMessage = gMessageStringTable.getString("LogTextMessage"); - _PREHASH_TimeDilation = gMessageStringTable.getString("TimeDilation"); - _PREHASH_RemoveContribution = gMessageStringTable.getString("RemoveContribution"); - _PREHASH_Contribution = gMessageStringTable.getString("Contribution"); - _PREHASH_SetGroupContribution = gMessageStringTable.getString("SetGroupContribution"); - _PREHASH_Offline = gMessageStringTable.getString("Offline"); - _PREHASH_AgentIsNowWearing = gMessageStringTable.getString("AgentIsNowWearing"); - _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"); - _PREHASH_Channel = gMessageStringTable.getString("Channel"); - _PREHASH_NetTest = gMessageStringTable.getString("NetTest"); - _PREHASH_DiscardLevel = gMessageStringTable.getString("DiscardLevel"); - _PREHASH_LayerID = gMessageStringTable.getString("LayerID"); - _PREHASH_GrabOffset = gMessageStringTable.getString("GrabOffset"); - _PREHASH_SimPort = gMessageStringTable.getString("SimPort"); - _PREHASH_PricePerMeter = gMessageStringTable.getString("PricePerMeter"); - _PREHASH_RegionFlags = gMessageStringTable.getString("RegionFlags"); - _PREHASH_VoteResult = gMessageStringTable.getString("VoteResult"); - _PREHASH_ParcelDirFeeEstimate = gMessageStringTable.getString("ParcelDirFeeEstimate"); - _PREHASH_ModifyBlock = gMessageStringTable.getString("ModifyBlock"); - _PREHASH_InventoryBlock = gMessageStringTable.getString("InventoryBlock"); - _PREHASH_ReplyBlock = gMessageStringTable.getString("ReplyBlock"); - _PREHASH_ValidUntil = gMessageStringTable.getString("ValidUntil"); - _PREHASH_VelocityInterpolateOn = gMessageStringTable.getString("VelocityInterpolateOn"); - _PREHASH_ClassifiedDelete = gMessageStringTable.getString("ClassifiedDelete"); - _PREHASH_RegionDenyAnonymous = gMessageStringTable.getString("RegionDenyAnonymous"); - _PREHASH_FLImageID = gMessageStringTable.getString("FLImageID"); - _PREHASH_AllowPublish = gMessageStringTable.getString("AllowPublish"); - _PREHASH_SitName = gMessageStringTable.getString("SitName"); - _PREHASH_RegionsVisited = gMessageStringTable.getString("RegionsVisited"); - _PREHASH_DirClassifiedReply = gMessageStringTable.getString("DirClassifiedReply"); - _PREHASH_AvatarClassifiedReply = gMessageStringTable.getString("AvatarClassifiedReply"); - _PREHASH_MediaURL = gMessageStringTable.getString("MediaURL"); - _PREHASH_CompleteAgentMovement = gMessageStringTable.getString("CompleteAgentMovement"); - _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_DuplicateFlags = gMessageStringTable.getString("DuplicateFlags"); - _PREHASH_RegionInfo2 = gMessageStringTable.getString("RegionInfo2"); - _PREHASH_TextColor = gMessageStringTable.getString("TextColor"); - _PREHASH_SlaveID = gMessageStringTable.getString("SlaveID"); - _PREHASH_Charter = gMessageStringTable.getString("Charter"); - _PREHASH_AlertData = gMessageStringTable.getString("AlertData"); - _PREHASH_TargetBlock = gMessageStringTable.getString("TargetBlock"); - _PREHASH_CheckParcelAuctions = gMessageStringTable.getString("CheckParcelAuctions"); - _PREHASH_ParcelAuctions = gMessageStringTable.getString("ParcelAuctions"); - _PREHASH_OwnerIsGroup = gMessageStringTable.getString("OwnerIsGroup"); - _PREHASH_NameValuePair = gMessageStringTable.getString("NameValuePair"); - _PREHASH_RemoveNameValuePair = gMessageStringTable.getString("RemoveNameValuePair"); - _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_AggregatePermInventory = gMessageStringTable.getString("AggregatePermInventory"); - _PREHASH_GroupAccountTransactionsReply = gMessageStringTable.getString("GroupAccountTransactionsReply"); - _PREHASH_SimulatorInfo = gMessageStringTable.getString("SimulatorInfo"); - _PREHASH_WearableData = gMessageStringTable.getString("WearableData"); - _PREHASH_Enabled = gMessageStringTable.getString("Enabled"); - _PREHASH_Savings = gMessageStringTable.getString("Savings"); - _PREHASH_SimulatorLoad = gMessageStringTable.getString("SimulatorLoad"); - _PREHASH_InternalRegionIP = gMessageStringTable.getString("InternalRegionIP"); - _PREHASH_ExternalRegionIP = gMessageStringTable.getString("ExternalRegionIP"); - _PREHASH_TotalPairs = gMessageStringTable.getString("TotalPairs"); - _PREHASH_CreateGroupRequest = gMessageStringTable.getString("CreateGroupRequest"); - _PREHASH_JoinGroupRequest = gMessageStringTable.getString("JoinGroupRequest"); - _PREHASH_LeaveGroupRequest = gMessageStringTable.getString("LeaveGroupRequest"); - _PREHASH_InviteGroupRequest = gMessageStringTable.getString("InviteGroupRequest"); - _PREHASH_LiveHelpGroupRequest = gMessageStringTable.getString("LiveHelpGroupRequest"); - _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_ChangedGrid = gMessageStringTable.getString("ChangedGrid"); - _PREHASH_AgentDropGroup = gMessageStringTable.getString("AgentDropGroup"); - _PREHASH_Details = gMessageStringTable.getString("Details"); - _PREHASH_LocationX = gMessageStringTable.getString("LocationX"); - _PREHASH_SaleType = gMessageStringTable.getString("SaleType"); - _PREHASH_LocationY = gMessageStringTable.getString("LocationY"); - _PREHASH_LocationZ = gMessageStringTable.getString("LocationZ"); - _PREHASH_EconomyData = gMessageStringTable.getString("EconomyData"); - _PREHASH_HeadRotation = gMessageStringTable.getString("HeadRotation"); - _PREHASH_DeleteOnCompletion = gMessageStringTable.getString("DeleteOnCompletion"); - _PREHASH_PublicPort = gMessageStringTable.getString("PublicPort"); - _PREHASH_DirClassifiedQuery = gMessageStringTable.getString("DirClassifiedQuery"); - _PREHASH_CallbackID = gMessageStringTable.getString("CallbackID"); - _PREHASH_RequestParcelTransfer = gMessageStringTable.getString("RequestParcelTransfer"); - _PREHASH_RoleCount = gMessageStringTable.getString("RoleCount"); - _PREHASH_ObjectCapacity = gMessageStringTable.getString("ObjectCapacity"); - _PREHASH_RequestID = gMessageStringTable.getString("RequestID"); - _PREHASH_RequestXfer = gMessageStringTable.getString("RequestXfer"); - _PREHASH_ObjectTaxCurrent = gMessageStringTable.getString("ObjectTaxCurrent"); - _PREHASH_LightTaxCurrent = gMessageStringTable.getString("LightTaxCurrent"); - _PREHASH_LandTaxCurrent = gMessageStringTable.getString("LandTaxCurrent"); - _PREHASH_GroupTaxCurrent = gMessageStringTable.getString("GroupTaxCurrent"); - _PREHASH_FetchInventoryDescendents = gMessageStringTable.getString("FetchInventoryDescendents"); - _PREHASH_InventoryDescendents = gMessageStringTable.getString("InventoryDescendents"); - _PREHASH_Descendents = gMessageStringTable.getString("Descendents"); - _PREHASH_PurgeInventoryDescendents = gMessageStringTable.getString("PurgeInventoryDescendents"); - _PREHASH_ShowDir = gMessageStringTable.getString("ShowDir"); - _PREHASH_IsOwner = gMessageStringTable.getString("IsOwner"); - _PREHASH_Timestamp = gMessageStringTable.getString("Timestamp"); - _PREHASH_GlobalPos = gMessageStringTable.getString("GlobalPos"); - _PREHASH_GrabOffsetInitial = gMessageStringTable.getString("GrabOffsetInitial"); - _PREHASH_IsTrial = gMessageStringTable.getString("IsTrial"); - _PREHASH_ObjectDuplicateOnRay = gMessageStringTable.getString("ObjectDuplicateOnRay"); - _PREHASH_GroupMembershipCount = gMessageStringTable.getString("GroupMembershipCount"); - _PREHASH_MethodData = gMessageStringTable.getString("MethodData"); - _PREHASH_ActivateGestures = gMessageStringTable.getString("ActivateGestures"); - _PREHASH_DeactivateGestures = gMessageStringTable.getString("DeactivateGestures"); - _PREHASH_ProposalData = gMessageStringTable.getString("ProposalData"); - _PREHASH_PosGlobal = gMessageStringTable.getString("PosGlobal"); - _PREHASH_SearchID = gMessageStringTable.getString("SearchID"); - _PREHASH_RezMultipleAttachmentsFromInv = gMessageStringTable.getString("RezMultipleAttachmentsFromInv"); - _PREHASH_SearchName = gMessageStringTable.getString("SearchName"); - _PREHASH_VersionString = gMessageStringTable.getString("VersionString"); - _PREHASH_CreateGroupReply = gMessageStringTable.getString("CreateGroupReply"); - _PREHASH_LeaveGroupReply = gMessageStringTable.getString("LeaveGroupReply"); - _PREHASH_ActualArea = gMessageStringTable.getString("ActualArea"); - _PREHASH_Message = gMessageStringTable.getString("Message"); - _PREHASH_ClickAction = gMessageStringTable.getString("ClickAction"); - _PREHASH_AssetUploadComplete = gMessageStringTable.getString("AssetUploadComplete"); - _PREHASH_RequestType = gMessageStringTable.getString("RequestType"); - _PREHASH_UUID = gMessageStringTable.getString("UUID"); - _PREHASH_BaseMask = gMessageStringTable.getString("BaseMask"); - _PREHASH_NetBlock = gMessageStringTable.getString("NetBlock"); - _PREHASH_GlobalX = gMessageStringTable.getString("GlobalX"); - _PREHASH_GlobalY = gMessageStringTable.getString("GlobalY"); - _PREHASH_CopyRotates = gMessageStringTable.getString("CopyRotates"); - _PREHASH_KickUserAck = gMessageStringTable.getString("KickUserAck"); - _PREHASH_TopPick = gMessageStringTable.getString("TopPick"); - _PREHASH_SessionID = gMessageStringTable.getString("SessionID"); - _PREHASH_GlobalZ = gMessageStringTable.getString("GlobalZ"); - _PREHASH_DeclineFriendship = gMessageStringTable.getString("DeclineFriendship"); - _PREHASH_FormFriendship = gMessageStringTable.getString("FormFriendship"); - _PREHASH_TerminateFriendship = gMessageStringTable.getString("TerminateFriendship"); - _PREHASH_TaskData = gMessageStringTable.getString("TaskData"); - _PREHASH_SimWideMaxPrims = gMessageStringTable.getString("SimWideMaxPrims"); - _PREHASH_TotalPrims = gMessageStringTable.getString("TotalPrims"); - _PREHASH_ProfileBegin = gMessageStringTable.getString("ProfileBegin"); - _PREHASH_Request = gMessageStringTable.getString("Request"); - _PREHASH_GroupAccountDetailsRequest = gMessageStringTable.getString("GroupAccountDetailsRequest"); - _PREHASH_GroupActiveProposalsRequest = gMessageStringTable.getString("GroupActiveProposalsRequest"); - _PREHASH_StringValue = gMessageStringTable.getString("StringValue"); - _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_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_ParcelID = gMessageStringTable.getString("ParcelID"); - _PREHASH_Godlike = gMessageStringTable.getString("Godlike"); - _PREHASH_TotalDebits = gMessageStringTable.getString("TotalDebits"); - _PREHASH_Direction = gMessageStringTable.getString("Direction"); - _PREHASH_HealthData = gMessageStringTable.getString("HealthData"); - _PREHASH_LeftAxis = gMessageStringTable.getString("LeftAxis"); - _PREHASH_LocationBlock = gMessageStringTable.getString("LocationBlock"); - _PREHASH_ObjectImage = gMessageStringTable.getString("ObjectImage"); - _PREHASH_TerrainStartHeight00 = gMessageStringTable.getString("TerrainStartHeight00"); - _PREHASH_TerrainStartHeight01 = gMessageStringTable.getString("TerrainStartHeight01"); - _PREHASH_TerrainStartHeight10 = gMessageStringTable.getString("TerrainStartHeight10"); - _PREHASH_TerrainStartHeight11 = gMessageStringTable.getString("TerrainStartHeight11"); - _PREHASH_WaterHeight = gMessageStringTable.getString("WaterHeight"); - _PREHASH_FetchInventoryReply = gMessageStringTable.getString("FetchInventoryReply"); - _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_ObjectCount = gMessageStringTable.getString("ObjectCount"); - _PREHASH_RegionPresenceRequestByHandle = gMessageStringTable.getString("RegionPresenceRequestByHandle"); - _PREHASH_RezSingleAttachmentFromInv = gMessageStringTable.getString("RezSingleAttachmentFromInv"); - _PREHASH_ChildAgentUpdate = gMessageStringTable.getString("ChildAgentUpdate"); - _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_UpdateParcel = gMessageStringTable.getString("UpdateParcel"); - _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_RegionID = gMessageStringTable.getString("RegionID"); - _PREHASH_AbuseRegionID = gMessageStringTable.getString("AbuseRegionID"); - _PREHASH_Creator = gMessageStringTable.getString("Creator"); - _PREHASH_ProposalText = gMessageStringTable.getString("ProposalText"); - _PREHASH_DirEventsReply = gMessageStringTable.getString("DirEventsReply"); - _PREHASH_EventInfoReply = gMessageStringTable.getString("EventInfoReply"); - _PREHASH_UserInfoReply = gMessageStringTable.getString("UserInfoReply"); - _PREHASH_PathRadiusOffset = gMessageStringTable.getString("PathRadiusOffset"); - _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_LandmarkID = gMessageStringTable.getString("LandmarkID"); - _PREHASH_InitiateDownload = gMessageStringTable.getString("InitiateDownload"); - _PREHASH_Name = gMessageStringTable.getString("Name"); - _PREHASH_OtherCleanTime = gMessageStringTable.getString("OtherCleanTime"); - _PREHASH_ParcelSetOtherCleanTime = gMessageStringTable.getString("ParcelSetOtherCleanTime"); - _PREHASH_TeleportPriceExponent = gMessageStringTable.getString("TeleportPriceExponent"); - _PREHASH_Gain = gMessageStringTable.getString("Gain"); - _PREHASH_PacketAck = gMessageStringTable.getString("PacketAck"); - _PREHASH_PathSkew = gMessageStringTable.getString("PathSkew"); - _PREHASH_SimulatorShutdownRequest = gMessageStringTable.getString("SimulatorShutdownRequest"); - _PREHASH_NearestLandingRegionRequest = gMessageStringTable.getString("NearestLandingRegionRequest"); - _PREHASH_OtherID = gMessageStringTable.getString("OtherID"); - _PREHASH_MemberID = gMessageStringTable.getString("MemberID"); - _PREHASH_MapLayerRequest = gMessageStringTable.getString("MapLayerRequest"); - _PREHASH_ObjectScale = gMessageStringTable.getString("ObjectScale"); - _PREHASH_TargetIP = gMessageStringTable.getString("TargetIP"); - _PREHASH_Redo = gMessageStringTable.getString("Redo"); - _PREHASH_MoneyBalance = gMessageStringTable.getString("MoneyBalance"); - _PREHASH_TrackAgent = gMessageStringTable.getString("TrackAgent"); - _PREHASH_MaxX = gMessageStringTable.getString("MaxX"); - _PREHASH_Data = gMessageStringTable.getString("Data"); - _PREHASH_MaxY = gMessageStringTable.getString("MaxY"); - _PREHASH_TextureAnim = gMessageStringTable.getString("TextureAnim"); - _PREHASH_ReturnIDs = gMessageStringTable.getString("ReturnIDs"); - _PREHASH_Date = gMessageStringTable.getString("Date"); - _PREHASH_AgentWearablesUpdate = gMessageStringTable.getString("AgentWearablesUpdate"); - _PREHASH_AgentDataUpdate = gMessageStringTable.getString("AgentDataUpdate"); - _PREHASH_GroupDataUpdate = gMessageStringTable.getString("GroupDataUpdate"); - _PREHASH_Hash = gMessageStringTable.getString("Hash"); - _PREHASH_AgentGroupDataUpdate = gMessageStringTable.getString("AgentGroupDataUpdate"); - _PREHASH_Left = gMessageStringTable.getString("Left"); - _PREHASH_Mask = gMessageStringTable.getString("Mask"); - _PREHASH_ForceMouselook = gMessageStringTable.getString("ForceMouselook"); - _PREHASH_Success = gMessageStringTable.getString("Success"); - _PREHASH_ObjectGroup = gMessageStringTable.getString("ObjectGroup"); - _PREHASH_SunHour = gMessageStringTable.getString("SunHour"); - _PREHASH_MinX = gMessageStringTable.getString("MinX"); - _PREHASH_ScriptSensorReply = gMessageStringTable.getString("ScriptSensorReply"); - _PREHASH_MinY = gMessageStringTable.getString("MinY"); - _PREHASH_Command = gMessageStringTable.getString("Command"); - _PREHASH_Desc = gMessageStringTable.getString("Desc"); - _PREHASH_AttachmentNeedsSave = gMessageStringTable.getString("AttachmentNeedsSave"); - _PREHASH_HistoryItemData = gMessageStringTable.getString("HistoryItemData"); - _PREHASH_AgentCachedTexture = gMessageStringTable.getString("AgentCachedTexture"); - _PREHASH_Subject = gMessageStringTable.getString("Subject"); - _PREHASH_East = gMessageStringTable.getString("East"); - _PREHASH_QueryReplies = gMessageStringTable.getString("QueryReplies"); - _PREHASH_ObjectCategory = gMessageStringTable.getString("ObjectCategory"); - _PREHASH_Time = gMessageStringTable.getString("Time"); - _PREHASH_CreateLandmarkForEvent = gMessageStringTable.getString("CreateLandmarkForEvent"); - _PREHASH_ParentID = gMessageStringTable.getString("ParentID"); - _PREHASH_Ping = gMessageStringTable.getString("Ping"); - _PREHASH_Perp = gMessageStringTable.getString("Perp"); - _PREHASH_Code = gMessageStringTable.getString("Code"); - _PREHASH_InvType = gMessageStringTable.getString("InvType"); - _PREHASH_AgentFOV = gMessageStringTable.getString("AgentFOV"); - _PREHASH_Audible = gMessageStringTable.getString("Audible"); - _PREHASH_AuctionData = gMessageStringTable.getString("AuctionData"); - _PREHASH_IDBlock = gMessageStringTable.getString("IDBlock"); - _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_SimCrashed = gMessageStringTable.getString("SimCrashed"); - _PREHASH_Text = gMessageStringTable.getString("Text"); - _PREHASH_PriceGroupCreate = gMessageStringTable.getString("PriceGroupCreate"); - _PREHASH_ObjectShape = gMessageStringTable.getString("ObjectShape"); - _PREHASH_GroupRoleDataReply = gMessageStringTable.getString("GroupRoleDataReply"); - _PREHASH_MuteCRC = gMessageStringTable.getString("MuteCRC"); - _PREHASH_Size = gMessageStringTable.getString("Size"); - _PREHASH_FromAddress = gMessageStringTable.getString("FromAddress"); - _PREHASH_Body = gMessageStringTable.getString("Body"); - _PREHASH_FileData = gMessageStringTable.getString("FileData"); - _PREHASH_List = gMessageStringTable.getString("List"); - _PREHASH_KickUser = gMessageStringTable.getString("KickUser"); - _PREHASH_OtherPrims = gMessageStringTable.getString("OtherPrims"); - _PREHASH_RunTime = gMessageStringTable.getString("RunTime"); - _PREHASH_GrantUserRights = gMessageStringTable.getString("GrantUserRights"); - _PREHASH_RpcScriptRequestInboundForward = gMessageStringTable.getString("RpcScriptRequestInboundForward"); - _PREHASH_More = gMessageStringTable.getString("More"); - _PREHASH_Majority = gMessageStringTable.getString("Majority"); - _PREHASH_MetersTraveled = gMessageStringTable.getString("MetersTraveled"); - _PREHASH_Stat = gMessageStringTable.getString("Stat"); - _PREHASH_SoundID = gMessageStringTable.getString("SoundID"); - _PREHASH_Item = gMessageStringTable.getString("Item"); - _PREHASH_User = gMessageStringTable.getString("User"); - _PREHASH_Prey = gMessageStringTable.getString("Prey"); - _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_ProfileCurve = gMessageStringTable.getString("ProfileCurve"); - _PREHASH_ParcelAccessListUpdate = gMessageStringTable.getString("ParcelAccessListUpdate"); - _PREHASH_MuteListUpdate = gMessageStringTable.getString("MuteListUpdate"); - _PREHASH_SendPacket = gMessageStringTable.getString("SendPacket"); - _PREHASH_SendXferPacket = gMessageStringTable.getString("SendXferPacket"); - _PREHASH_RegionDenyIdentified = gMessageStringTable.getString("RegionDenyIdentified"); - _PREHASH_NotecardItemID = gMessageStringTable.getString("NotecardItemID"); - _PREHASH_LastName = gMessageStringTable.getString("LastName"); - _PREHASH_From = gMessageStringTable.getString("From"); - _PREHASH_RoleChange = gMessageStringTable.getString("RoleChange"); - _PREHASH_Port = gMessageStringTable.getString("Port"); - _PREHASH_MemberTitle = gMessageStringTable.getString("MemberTitle"); - _PREHASH_LogParcelChanges = gMessageStringTable.getString("LogParcelChanges"); - _PREHASH_AgentCachedTextureResponse = gMessageStringTable.getString("AgentCachedTextureResponse"); - _PREHASH_DeRezObject = gMessageStringTable.getString("DeRezObject"); - _PREHASH_IsTemporary = gMessageStringTable.getString("IsTemporary"); - _PREHASH_InsigniaID = gMessageStringTable.getString("InsigniaID"); - _PREHASH_CheckFlags = gMessageStringTable.getString("CheckFlags"); - _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_RequestBlock = gMessageStringTable.getString("RequestBlock"); - _PREHASH_GrantData = gMessageStringTable.getString("GrantData"); - _PREHASH_DetachAttachmentIntoInv = gMessageStringTable.getString("DetachAttachmentIntoInv"); - _PREHASH_ParcelDisableObjects = gMessageStringTable.getString("ParcelDisableObjects"); - _PREHASH_Sections = gMessageStringTable.getString("Sections"); - _PREHASH_GodLevel = gMessageStringTable.getString("GodLevel"); - _PREHASH_PayPriceReply = gMessageStringTable.getString("PayPriceReply"); - _PREHASH_QueryID = gMessageStringTable.getString("QueryID"); - _PREHASH_CameraEyeOffset = gMessageStringTable.getString("CameraEyeOffset"); - _PREHASH_AgentPosition = gMessageStringTable.getString("AgentPosition"); - _PREHASH_GrabPosition = gMessageStringTable.getString("GrabPosition"); - _PREHASH_OnlineNotification = gMessageStringTable.getString("OnlineNotification"); - _PREHASH_OfflineNotification = gMessageStringTable.getString("OfflineNotification"); - _PREHASH_SendPostcard = gMessageStringTable.getString("SendPostcard"); - _PREHASH_RequestFlags = gMessageStringTable.getString("RequestFlags"); - _PREHASH_GroupAccountSummaryRequest = gMessageStringTable.getString("GroupAccountSummaryRequest"); - _PREHASH_GroupVoteHistoryRequest = gMessageStringTable.getString("GroupVoteHistoryRequest"); - _PREHASH_ParamValue = gMessageStringTable.getString("ParamValue"); - _PREHASH_MaxAgents = gMessageStringTable.getString("MaxAgents"); - _PREHASH_CreateNewOutfitAttachments = gMessageStringTable.getString("CreateNewOutfitAttachments"); - _PREHASH_RegionHandle = gMessageStringTable.getString("RegionHandle"); - _PREHASH_TeleportProgress = gMessageStringTable.getString("TeleportProgress"); - _PREHASH_AgentQuitCopy = gMessageStringTable.getString("AgentQuitCopy"); - _PREHASH_AvatarInterestsUpdate = gMessageStringTable.getString("AvatarInterestsUpdate"); - _PREHASH_GroupNoticeID = gMessageStringTable.getString("GroupNoticeID"); - _PREHASH_ParcelName = gMessageStringTable.getString("ParcelName"); - _PREHASH_PriceObjectRent = gMessageStringTable.getString("PriceObjectRent"); - _PREHASH_OfferCallingCard = gMessageStringTable.getString("OfferCallingCard"); - _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"); - _PREHASH_ObjectOwner = gMessageStringTable.getString("ObjectOwner"); - _PREHASH_AssetID = gMessageStringTable.getString("AssetID"); - _PREHASH_AlertMessage = gMessageStringTable.getString("AlertMessage"); - _PREHASH_AgentAlertMessage = gMessageStringTable.getString("AgentAlertMessage"); - _PREHASH_EstateOwnerMessage = gMessageStringTable.getString("EstateOwnerMessage"); - _PREHASH_ParcelMediaCommandMessage = gMessageStringTable.getString("ParcelMediaCommandMessage"); - _PREHASH_Auction = gMessageStringTable.getString("Auction"); - _PREHASH_Category = gMessageStringTable.getString("Category"); - _PREHASH_FilePath = gMessageStringTable.getString("FilePath"); - _PREHASH_ItemFlags = gMessageStringTable.getString("ItemFlags"); - _PREHASH_Invoice = gMessageStringTable.getString("Invoice"); - _PREHASH_IntervalDays = gMessageStringTable.getString("IntervalDays"); - _PREHASH_PathScaleX = gMessageStringTable.getString("PathScaleX"); - _PREHASH_FromTaskID = gMessageStringTable.getString("FromTaskID"); - _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"); - _PREHASH_SimulatorBlock = gMessageStringTable.getString("SimulatorBlock"); - _PREHASH_GroupID = gMessageStringTable.getString("GroupID"); - _PREHASH_AgentVel = gMessageStringTable.getString("AgentVel"); - _PREHASH_RequestImage = gMessageStringTable.getString("RequestImage"); - _PREHASH_NetStats = gMessageStringTable.getString("NetStats"); - _PREHASH_AgentPos = gMessageStringTable.getString("AgentPos"); - _PREHASH_AgentSit = gMessageStringTable.getString("AgentSit"); - _PREHASH_Material = gMessageStringTable.getString("Material"); - _PREHASH_ObjectDeGrab = gMessageStringTable.getString("ObjectDeGrab"); - _PREHASH_VelocityInterpolateOff = gMessageStringTable.getString("VelocityInterpolateOff"); - _PREHASH_AuthorizedBuyerID = gMessageStringTable.getString("AuthorizedBuyerID"); - _PREHASH_AvatarPropertiesReply = gMessageStringTable.getString("AvatarPropertiesReply"); - _PREHASH_GroupProfileReply = gMessageStringTable.getString("GroupProfileReply"); - _PREHASH_SimOwner = gMessageStringTable.getString("SimOwner"); - _PREHASH_SalePrice = gMessageStringTable.getString("SalePrice"); - _PREHASH_Animation = gMessageStringTable.getString("Animation"); - _PREHASH_OwnerID = gMessageStringTable.getString("OwnerID"); - _PREHASH_NearestLandingRegionUpdated = gMessageStringTable.getString("NearestLandingRegionUpdated"); - _PREHASH_PassToAgent = gMessageStringTable.getString("PassToAgent"); - _PREHASH_PreyAgent = gMessageStringTable.getString("PreyAgent"); - _PREHASH_SimStats = gMessageStringTable.getString("SimStats"); - _PREHASH_LogoutReply = gMessageStringTable.getString("LogoutReply"); - _PREHASH_FeatureDisabled = gMessageStringTable.getString("FeatureDisabled"); - _PREHASH_PhysicalAvatarEventList = gMessageStringTable.getString("PhysicalAvatarEventList"); - _PREHASH_ObjectLocalID = gMessageStringTable.getString("ObjectLocalID"); - _PREHASH_Dropped = gMessageStringTable.getString("Dropped"); - _PREHASH_WebProfilesDisabled = gMessageStringTable.getString("WebProfilesDisabled"); - _PREHASH_Destination = gMessageStringTable.getString("Destination"); - _PREHASH_MasterID = gMessageStringTable.getString("MasterID"); - _PREHASH_TransferData = gMessageStringTable.getString("TransferData"); - _PREHASH_WantToMask = gMessageStringTable.getString("WantToMask"); - _PREHASH_ParcelSelectObjects = gMessageStringTable.getString("ParcelSelectObjects"); - _PREHASH_ExtraParams = gMessageStringTable.getString("ExtraParams"); - _PREHASH_CreatorID = gMessageStringTable.getString("CreatorID"); - _PREHASH_Summary = gMessageStringTable.getString("Summary"); - _PREHASH_BuyObjectInventory = gMessageStringTable.getString("BuyObjectInventory"); - _PREHASH_FetchInventory = gMessageStringTable.getString("FetchInventory"); - _PREHASH_InventoryID = gMessageStringTable.getString("InventoryID"); - _PREHASH_PacketNumber = gMessageStringTable.getString("PacketNumber"); - _PREHASH_SetFollowCamProperties = gMessageStringTable.getString("SetFollowCamProperties"); - _PREHASH_ClearFollowCamProperties = gMessageStringTable.getString("ClearFollowCamProperties"); - _PREHASH_SequenceID = gMessageStringTable.getString("SequenceID"); - _PREHASH_DataServerLogout = gMessageStringTable.getString("DataServerLogout"); - _PREHASH_NameValue = gMessageStringTable.getString("NameValue"); - _PREHASH_PathShearX = gMessageStringTable.getString("PathShearX"); - _PREHASH_PathShearY = gMessageStringTable.getString("PathShearY"); - _PREHASH_Velocity = gMessageStringTable.getString("Velocity"); - _PREHASH_SecPerYear = gMessageStringTable.getString("SecPerYear"); - _PREHASH_FirstName = gMessageStringTable.getString("FirstName"); - _PREHASH_AttachedSoundGainChange = gMessageStringTable.getString("AttachedSoundGainChange"); - _PREHASH_LocationID = gMessageStringTable.getString("LocationID"); - _PREHASH_Running = gMessageStringTable.getString("Running"); - _PREHASH_AgentThrottle = gMessageStringTable.getString("AgentThrottle"); - _PREHASH_NeighborList = gMessageStringTable.getString("NeighborList"); - _PREHASH_PathTaperX = gMessageStringTable.getString("PathTaperX"); - _PREHASH_PathTaperY = gMessageStringTable.getString("PathTaperY"); - _PREHASH_AgentRelated = gMessageStringTable.getString("AgentRelated"); - _PREHASH_GranterBlock = gMessageStringTable.getString("GranterBlock"); - _PREHASH_UseCachedMuteList = gMessageStringTable.getString("UseCachedMuteList"); - _PREHASH_FailStats = gMessageStringTable.getString("FailStats"); - _PREHASH_Tempfile = gMessageStringTable.getString("Tempfile"); - _PREHASH_BuyerID = gMessageStringTable.getString("BuyerID"); - _PREHASH_DirPeopleReply = gMessageStringTable.getString("DirPeopleReply"); - _PREHASH_TransferInfo = gMessageStringTable.getString("TransferInfo"); - _PREHASH_AvatarPickerRequestBackend = gMessageStringTable.getString("AvatarPickerRequestBackend"); - _PREHASH_AvatarPropertiesRequestBackend = gMessageStringTable.getString("AvatarPropertiesRequestBackend"); - _PREHASH_UpdateData = gMessageStringTable.getString("UpdateData"); - _PREHASH_SimFPS = gMessageStringTable.getString("SimFPS"); - _PREHASH_ReporterID = gMessageStringTable.getString("ReporterID"); - _PREHASH_ButtonLabel = gMessageStringTable.getString("ButtonLabel"); - _PREHASH_GranterID = gMessageStringTable.getString("GranterID"); - _PREHASH_WantToText = gMessageStringTable.getString("WantToText"); - _PREHASH_ReportType = gMessageStringTable.getString("ReportType"); - _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"); - _PREHASH_Packet = gMessageStringTable.getString("Packet"); - _PREHASH_UndoLand = gMessageStringTable.getString("UndoLand"); - _PREHASH_SimAccess = gMessageStringTable.getString("SimAccess"); - _PREHASH_AbuserID = gMessageStringTable.getString("AbuserID"); - _PREHASH_MembershipFee = gMessageStringTable.getString("MembershipFee"); - _PREHASH_InviteGroupResponse = gMessageStringTable.getString("InviteGroupResponse"); - _PREHASH_CreateInventoryFolder = gMessageStringTable.getString("CreateInventoryFolder"); - _PREHASH_UpdateInventoryFolder = gMessageStringTable.getString("UpdateInventoryFolder"); - _PREHASH_MoveInventoryFolder = gMessageStringTable.getString("MoveInventoryFolder"); - _PREHASH_RemoveInventoryFolder = gMessageStringTable.getString("RemoveInventoryFolder"); - _PREHASH_MoneyData = gMessageStringTable.getString("MoneyData"); - _PREHASH_ObjectDeselect = gMessageStringTable.getString("ObjectDeselect"); - _PREHASH_NewAssetID = gMessageStringTable.getString("NewAssetID"); - _PREHASH_ObjectAdd = gMessageStringTable.getString("ObjectAdd"); - _PREHASH_RayEndIsIntersection = gMessageStringTable.getString("RayEndIsIntersection"); - _PREHASH_CompleteAuction = gMessageStringTable.getString("CompleteAuction"); - _PREHASH_CircuitCode = gMessageStringTable.getString("CircuitCode"); - _PREHASH_AgentMovementComplete = gMessageStringTable.getString("AgentMovementComplete"); - _PREHASH_ViewerIP = gMessageStringTable.getString("ViewerIP"); - _PREHASH_Header = gMessageStringTable.getString("Header"); - _PREHASH_GestureFlags = gMessageStringTable.getString("GestureFlags"); - _PREHASH_XferID = gMessageStringTable.getString("XferID"); - _PREHASH_StatValue = gMessageStringTable.getString("StatValue"); - _PREHASH_TaskID = gMessageStringTable.getString("TaskID"); - _PREHASH_PickID = gMessageStringTable.getString("PickID"); - _PREHASH_RayEnd = gMessageStringTable.getString("RayEnd"); - _PREHASH_Throttles = gMessageStringTable.getString("Throttles"); - _PREHASH_RebakeAvatarTextures = gMessageStringTable.getString("RebakeAvatarTextures"); - _PREHASH_UpAxis = gMessageStringTable.getString("UpAxis"); - _PREHASH_AgentTextures = gMessageStringTable.getString("AgentTextures"); - _PREHASH_NotecardData = gMessageStringTable.getString("NotecardData"); - _PREHASH_Radius = gMessageStringTable.getString("Radius"); - _PREHASH_OffCircuit = gMessageStringTable.getString("OffCircuit"); - _PREHASH_Access = gMessageStringTable.getString("Access"); - _PREHASH_TitleRoleID = gMessageStringTable.getString("TitleRoleID"); - _PREHASH_SquareMetersCredit = gMessageStringTable.getString("SquareMetersCredit"); - _PREHASH_Filename = gMessageStringTable.getString("Filename"); - _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_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_ButtonIndex = gMessageStringTable.getString("ButtonIndex"); - _PREHASH_GetScriptRunning = gMessageStringTable.getString("GetScriptRunning"); - _PREHASH_SetScriptRunning = gMessageStringTable.getString("SetScriptRunning"); - _PREHASH_Health = gMessageStringTable.getString("Health"); - _PREHASH_CircuitInfo = gMessageStringTable.getString("CircuitInfo"); - _PREHASH_ObjectBuy = gMessageStringTable.getString("ObjectBuy"); - _PREHASH_ProfileEnd = gMessageStringTable.getString("ProfileEnd"); - _PREHASH_Effect = gMessageStringTable.getString("Effect"); - _PREHASH_TestMessage = gMessageStringTable.getString("TestMessage"); - _PREHASH_ScriptMailRegistration = gMessageStringTable.getString("ScriptMailRegistration"); - _PREHASH_AgentSetAppearance = gMessageStringTable.getString("AgentSetAppearance"); - _PREHASH_AvatarAppearance = gMessageStringTable.getString("AvatarAppearance"); - _PREHASH_RegionData = gMessageStringTable.getString("RegionData"); - _PREHASH_RequestingRegionData = gMessageStringTable.getString("RequestingRegionData"); - _PREHASH_LandingRegionData = gMessageStringTable.getString("LandingRegionData"); - _PREHASH_SitTransform = gMessageStringTable.getString("SitTransform"); - _PREHASH_TerrainBase0 = gMessageStringTable.getString("TerrainBase0"); - _PREHASH_SkillsMask = gMessageStringTable.getString("SkillsMask"); - _PREHASH_AtAxis = gMessageStringTable.getString("AtAxis"); - _PREHASH_TerrainBase1 = gMessageStringTable.getString("TerrainBase1"); - _PREHASH_Reason = gMessageStringTable.getString("Reason"); - _PREHASH_TerrainBase2 = gMessageStringTable.getString("TerrainBase2"); - _PREHASH_TerrainBase3 = gMessageStringTable.getString("TerrainBase3"); - _PREHASH_Params = gMessageStringTable.getString("Params"); - _PREHASH_PingID = gMessageStringTable.getString("PingID"); - _PREHASH_Change = gMessageStringTable.getString("Change"); - _PREHASH_Height = gMessageStringTable.getString("Height"); - _PREHASH_Region = gMessageStringTable.getString("Region"); - _PREHASH_TelehubInfo = gMessageStringTable.getString("TelehubInfo"); - _PREHASH_StateSave = gMessageStringTable.getString("StateSave"); - _PREHASH_RoleData = gMessageStringTable.getString("RoleData"); - _PREHASH_AgentAnimation = gMessageStringTable.getString("AgentAnimation"); - _PREHASH_AvatarAnimation = gMessageStringTable.getString("AvatarAnimation"); - _PREHASH_LogDwellTime = gMessageStringTable.getString("LogDwellTime"); - _PREHASH_ParcelGodMarkAsContent = gMessageStringTable.getString("ParcelGodMarkAsContent"); - _PREHASH_UsePhysics = gMessageStringTable.getString("UsePhysics"); - _PREHASH_RegionDenyTransacted = gMessageStringTable.getString("RegionDenyTransacted"); - _PREHASH_JointType = gMessageStringTable.getString("JointType"); - _PREHASH_ObjectTaxEstimate = gMessageStringTable.getString("ObjectTaxEstimate"); - _PREHASH_LightTaxEstimate = gMessageStringTable.getString("LightTaxEstimate"); - _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"); - _PREHASH_Sender = gMessageStringTable.getString("Sender"); - _PREHASH_Dialog = gMessageStringTable.getString("Dialog"); - _PREHASH_TargetData = gMessageStringTable.getString("TargetData"); - _PREHASH_DestID = gMessageStringTable.getString("DestID"); - _PREHASH_PricePublicObjectDelete = gMessageStringTable.getString("PricePublicObjectDelete"); - _PREHASH_ObjectDelete = gMessageStringTable.getString("ObjectDelete"); - _PREHASH_Delete = gMessageStringTable.getString("Delete"); - _PREHASH_EventGodDelete = gMessageStringTable.getString("EventGodDelete"); - _PREHASH_LastTaxDate = gMessageStringTable.getString("LastTaxDate"); - _PREHASH_MapImageID = gMessageStringTable.getString("MapImageID"); - _PREHASH_EndDateTime = gMessageStringTable.getString("EndDateTime"); - _PREHASH_TerrainDetail0 = gMessageStringTable.getString("TerrainDetail0"); - _PREHASH_TerrainDetail1 = gMessageStringTable.getString("TerrainDetail1"); - _PREHASH_TerrainDetail2 = gMessageStringTable.getString("TerrainDetail2"); - _PREHASH_TerrainDetail3 = gMessageStringTable.getString("TerrainDetail3"); - _PREHASH_Offset = gMessageStringTable.getString("Offset"); - _PREHASH_ObjectDelink = gMessageStringTable.getString("ObjectDelink"); - _PREHASH_TargetObject = gMessageStringTable.getString("TargetObject"); - _PREHASH_IsEstateManager = gMessageStringTable.getString("IsEstateManager"); - _PREHASH_CancelAuction = gMessageStringTable.getString("CancelAuction"); - _PREHASH_ObjectDetach = gMessageStringTable.getString("ObjectDetach"); - _PREHASH_Compressed = gMessageStringTable.getString("Compressed"); - _PREHASH_PathBegin = gMessageStringTable.getString("PathBegin"); - _PREHASH_BypassRaycast = gMessageStringTable.getString("BypassRaycast"); - _PREHASH_WinnerID = gMessageStringTable.getString("WinnerID"); - _PREHASH_ChannelType = gMessageStringTable.getString("ChannelType"); - _PREHASH_NonExemptMembers = gMessageStringTable.getString("NonExemptMembers"); - _PREHASH_Agents = gMessageStringTable.getString("Agents"); - _PREHASH_MemberData = gMessageStringTable.getString("MemberData"); - _PREHASH_ToGroupID = gMessageStringTable.getString("ToGroupID"); - _PREHASH_ImageNotInDatabase = gMessageStringTable.getString("ImageNotInDatabase"); - _PREHASH_StartDate = gMessageStringTable.getString("StartDate"); - _PREHASH_AnimID = gMessageStringTable.getString("AnimID"); - _PREHASH_Serial = gMessageStringTable.getString("Serial"); - _PREHASH_AbuseRegionName = gMessageStringTable.getString("AbuseRegionName"); - _PREHASH_ModifyLand = gMessageStringTable.getString("ModifyLand"); - _PREHASH_Digest = gMessageStringTable.getString("Digest"); - _PREHASH_Victim = gMessageStringTable.getString("Victim"); - _PREHASH_Script = gMessageStringTable.getString("Script"); - _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_GodUpdateRegionInfo = gMessageStringTable.getString("GodUpdateRegionInfo"); - _PREHASH_StartAnim = gMessageStringTable.getString("StartAnim"); - _PREHASH_Action = gMessageStringTable.getString("Action"); - _PREHASH_Location = gMessageStringTable.getString("Location"); - _PREHASH_Rights = gMessageStringTable.getString("Rights"); - _PREHASH_SearchDir = gMessageStringTable.getString("SearchDir"); - _PREHASH_TransferRequest = gMessageStringTable.getString("TransferRequest"); - _PREHASH_ScriptSensorRequest = gMessageStringTable.getString("ScriptSensorRequest"); - _PREHASH_MoneyTransferRequest = gMessageStringTable.getString("MoneyTransferRequest"); - _PREHASH_EjectGroupMemberRequest = gMessageStringTable.getString("EjectGroupMemberRequest"); - _PREHASH_SkillsText = gMessageStringTable.getString("SkillsText"); - _PREHASH_Resent = gMessageStringTable.getString("Resent"); - _PREHASH_Center = gMessageStringTable.getString("Center"); - _PREHASH_SharedData = gMessageStringTable.getString("SharedData"); - _PREHASH_PSBlock = gMessageStringTable.getString("PSBlock"); - _PREHASH_UUIDNameBlock = gMessageStringTable.getString("UUIDNameBlock"); - _PREHASH_GroupTitleUpdate = gMessageStringTable.getString("GroupTitleUpdate"); - _PREHASH_Method = gMessageStringTable.getString("Method"); - _PREHASH_TouchName = gMessageStringTable.getString("TouchName"); - _PREHASH_UpdateType = gMessageStringTable.getString("UpdateType"); - _PREHASH_KickedFromEstateID = gMessageStringTable.getString("KickedFromEstateID"); - _PREHASH_CandidateID = gMessageStringTable.getString("CandidateID"); - _PREHASH_ParamData = gMessageStringTable.getString("ParamData"); - _PREHASH_GodlikeMessage = gMessageStringTable.getString("GodlikeMessage"); - _PREHASH_SystemMessage = gMessageStringTable.getString("SystemMessage"); - _PREHASH_BodyRotation = gMessageStringTable.getString("BodyRotation"); - _PREHASH_SearchRegions = gMessageStringTable.getString("SearchRegions"); - _PREHASH_AnimationData = gMessageStringTable.getString("AnimationData"); - _PREHASH_StatID = gMessageStringTable.getString("StatID"); - _PREHASH_ItemID = gMessageStringTable.getString("ItemID"); - _PREHASH_ScriptDialogReply = gMessageStringTable.getString("ScriptDialogReply"); - _PREHASH_RegionIDAndHandleReply = gMessageStringTable.getString("RegionIDAndHandleReply"); - _PREHASH_CameraAtOffset = gMessageStringTable.getString("CameraAtOffset"); - _PREHASH_VoteID = gMessageStringTable.getString("VoteID"); - _PREHASH_ParcelGodForceOwner = gMessageStringTable.getString("ParcelGodForceOwner"); - _PREHASH_Filter = gMessageStringTable.getString("Filter"); - _PREHASH_InviteData = gMessageStringTable.getString("InviteData"); - _PREHASH_PCode = gMessageStringTable.getString("PCode"); - _PREHASH_SearchPos = gMessageStringTable.getString("SearchPos"); - _PREHASH_PreyID = gMessageStringTable.getString("PreyID"); - _PREHASH_TerrainLowerLimit = gMessageStringTable.getString("TerrainLowerLimit"); - _PREHASH_EventFlags = gMessageStringTable.getString("EventFlags"); - _PREHASH_TallyVotes = gMessageStringTable.getString("TallyVotes"); - _PREHASH_Result = gMessageStringTable.getString("Result"); - _PREHASH_LookAt = gMessageStringTable.getString("LookAt"); - _PREHASH_SearchOrder = gMessageStringTable.getString("SearchOrder"); - _PREHASH_PayButton = gMessageStringTable.getString("PayButton"); - _PREHASH_SelfCount = gMessageStringTable.getString("SelfCount"); - _PREHASH_PacketCount = gMessageStringTable.getString("PacketCount"); - _PREHASH_ParcelBuyPass = gMessageStringTable.getString("ParcelBuyPass"); - _PREHASH_OldItemID = gMessageStringTable.getString("OldItemID"); - _PREHASH_RegionPort = gMessageStringTable.getString("RegionPort"); - _PREHASH_PriceEnergyUnit = gMessageStringTable.getString("PriceEnergyUnit"); - _PREHASH_Bitmap = gMessageStringTable.getString("Bitmap"); - _PREHASH_CacheMissType = gMessageStringTable.getString("CacheMissType"); - _PREHASH_VFileID = gMessageStringTable.getString("VFileID"); - _PREHASH_GroupInsigniaID = gMessageStringTable.getString("GroupInsigniaID"); - _PREHASH_Online = gMessageStringTable.getString("Online"); - _PREHASH_KickFlags = gMessageStringTable.getString("KickFlags"); - _PREHASH_CovenantID = gMessageStringTable.getString("CovenantID"); - _PREHASH_SysCPU = gMessageStringTable.getString("SysCPU"); - _PREHASH_EMail = gMessageStringTable.getString("EMail"); - _PREHASH_AggregatePermTextures = gMessageStringTable.getString("AggregatePermTextures"); - _PREHASH_ChatChannel = gMessageStringTable.getString("ChatChannel"); - _PREHASH_ReturnID = gMessageStringTable.getString("ReturnID"); - _PREHASH_ObjectAttach = gMessageStringTable.getString("ObjectAttach"); - _PREHASH_TargetPort = gMessageStringTable.getString("TargetPort"); - _PREHASH_ObjectSpinStop = gMessageStringTable.getString("ObjectSpinStop"); - _PREHASH_FullID = gMessageStringTable.getString("FullID"); - _PREHASH_ActivateGroup = gMessageStringTable.getString("ActivateGroup"); - _PREHASH_SysGPU = gMessageStringTable.getString("SysGPU"); - _PREHASH_AvatarInterestsReply = gMessageStringTable.getString("AvatarInterestsReply"); - _PREHASH_StartLure = gMessageStringTable.getString("StartLure"); - _PREHASH_SysRAM = gMessageStringTable.getString("SysRAM"); - _PREHASH_ObjectPosition = gMessageStringTable.getString("ObjectPosition"); - _PREHASH_SitPosition = gMessageStringTable.getString("SitPosition"); - _PREHASH_StartTime = gMessageStringTable.getString("StartTime"); - _PREHASH_BornOn = gMessageStringTable.getString("BornOn"); - _PREHASH_CameraCollidePlane = gMessageStringTable.getString("CameraCollidePlane"); - _PREHASH_EconomyDataRequest = gMessageStringTable.getString("EconomyDataRequest"); - _PREHASH_TeleportLureRequest = gMessageStringTable.getString("TeleportLureRequest"); - _PREHASH_FolderID = gMessageStringTable.getString("FolderID"); - _PREHASH_RegionHandleRequest = gMessageStringTable.getString("RegionHandleRequest"); - _PREHASH_ScriptDataRequest = gMessageStringTable.getString("ScriptDataRequest"); - _PREHASH_GroupRoleDataRequest = gMessageStringTable.getString("GroupRoleDataRequest"); - _PREHASH_GroupTitlesRequest = gMessageStringTable.getString("GroupTitlesRequest"); - _PREHASH_AgentWearablesRequest = gMessageStringTable.getString("AgentWearablesRequest"); - _PREHASH_MapBlockRequest = gMessageStringTable.getString("MapBlockRequest"); - _PREHASH_LureID = gMessageStringTable.getString("LureID"); - _PREHASH_CopyCenters = gMessageStringTable.getString("CopyCenters"); - _PREHASH_ParamList = gMessageStringTable.getString("ParamList"); - _PREHASH_InventorySerial = gMessageStringTable.getString("InventorySerial"); - _PREHASH_EdgeDataPacket = gMessageStringTable.getString("EdgeDataPacket"); - _PREHASH_AvatarPickerReply = gMessageStringTable.getString("AvatarPickerReply"); - _PREHASH_ParcelDwellReply = gMessageStringTable.getString("ParcelDwellReply"); - _PREHASH_IsForSale = gMessageStringTable.getString("IsForSale"); - _PREHASH_MuteID = gMessageStringTable.getString("MuteID"); - _PREHASH_MeanCollisionAlert = gMessageStringTable.getString("MeanCollisionAlert"); - _PREHASH_CanAcceptTasks = gMessageStringTable.getString("CanAcceptTasks"); - _PREHASH_ItemData = gMessageStringTable.getString("ItemData"); - _PREHASH_AnimationList = gMessageStringTable.getString("AnimationList"); - _PREHASH_Reputation = gMessageStringTable.getString("Reputation"); - _PREHASH_IntValue = gMessageStringTable.getString("IntValue"); - _PREHASH_TargetType = gMessageStringTable.getString("TargetType"); - _PREHASH_Amount = gMessageStringTable.getString("Amount"); - _PREHASH_HasAttachment = gMessageStringTable.getString("HasAttachment"); - _PREHASH_UpdateAttachment = gMessageStringTable.getString("UpdateAttachment"); - _PREHASH_RemoveAttachment = gMessageStringTable.getString("RemoveAttachment"); - _PREHASH_HeightWidthBlock = gMessageStringTable.getString("HeightWidthBlock"); - _PREHASH_RequestObjectPropertiesFamily = gMessageStringTable.getString("RequestObjectPropertiesFamily"); - _PREHASH_ObjectPropertiesFamily = gMessageStringTable.getString("ObjectPropertiesFamily"); - _PREHASH_UserData = gMessageStringTable.getString("UserData"); - _PREHASH_IsReadable = gMessageStringTable.getString("IsReadable"); - _PREHASH_PathCurve = gMessageStringTable.getString("PathCurve"); - _PREHASH_Status = gMessageStringTable.getString("Status"); - _PREHASH_FromGroup = gMessageStringTable.getString("FromGroup"); - _PREHASH_AlreadyVoted = gMessageStringTable.getString("AlreadyVoted"); - _PREHASH_PlacesReply = gMessageStringTable.getString("PlacesReply"); - _PREHASH_DirPlacesReply = gMessageStringTable.getString("DirPlacesReply"); - _PREHASH_ParcelBuy = gMessageStringTable.getString("ParcelBuy"); - _PREHASH_DirFindQueryBackend = gMessageStringTable.getString("DirFindQueryBackend"); - _PREHASH_DirPlacesQueryBackend = gMessageStringTable.getString("DirPlacesQueryBackend"); - _PREHASH_DirClassifiedQueryBackend = gMessageStringTable.getString("DirClassifiedQueryBackend"); - _PREHASH_DirLandQueryBackend = gMessageStringTable.getString("DirLandQueryBackend"); - _PREHASH_DirPopularQueryBackend = gMessageStringTable.getString("DirPopularQueryBackend"); - _PREHASH_HistoryData = gMessageStringTable.getString("HistoryData"); - _PREHASH_SnapshotID = gMessageStringTable.getString("SnapshotID"); - _PREHASH_Aspect = gMessageStringTable.getString("Aspect"); - _PREHASH_ParamSize = gMessageStringTable.getString("ParamSize"); - _PREHASH_VoteCast = gMessageStringTable.getString("VoteCast"); - _PREHASH_CastsShadows = gMessageStringTable.getString("CastsShadows"); - _PREHASH_EveryoneMask = gMessageStringTable.getString("EveryoneMask"); - _PREHASH_ObjectSpinUpdate = gMessageStringTable.getString("ObjectSpinUpdate"); - _PREHASH_MaturePublish = gMessageStringTable.getString("MaturePublish"); - _PREHASH_UseExistingAsset = gMessageStringTable.getString("UseExistingAsset"); - _PREHASH_Powers = gMessageStringTable.getString("Powers"); - _PREHASH_ParcelLocalID = gMessageStringTable.getString("ParcelLocalID"); - _PREHASH_TeleportCancel = gMessageStringTable.getString("TeleportCancel"); - _PREHASH_UnixTime = gMessageStringTable.getString("UnixTime"); - _PREHASH_QueryFlags = gMessageStringTable.getString("QueryFlags"); - _PREHASH_AlwaysRun = gMessageStringTable.getString("AlwaysRun"); - _PREHASH_Bottom = gMessageStringTable.getString("Bottom"); - _PREHASH_ButtonData = gMessageStringTable.getString("ButtonData"); - _PREHASH_SoundData = gMessageStringTable.getString("SoundData"); - _PREHASH_ViewerStats = gMessageStringTable.getString("ViewerStats"); - _PREHASH_RegionHandshake = gMessageStringTable.getString("RegionHandshake"); - _PREHASH_ObjectDescription = gMessageStringTable.getString("ObjectDescription"); - _PREHASH_Description = gMessageStringTable.getString("Description"); - _PREHASH_ParamType = gMessageStringTable.getString("ParamType"); - _PREHASH_UUIDNameReply = gMessageStringTable.getString("UUIDNameReply"); - _PREHASH_UUIDGroupNameReply = gMessageStringTable.getString("UUIDGroupNameReply"); - _PREHASH_SaveAssetIntoInventory = gMessageStringTable.getString("SaveAssetIntoInventory"); - _PREHASH_UserInfo = gMessageStringTable.getString("UserInfo"); - _PREHASH_AnimSequenceID = gMessageStringTable.getString("AnimSequenceID"); - _PREHASH_NVPairs = gMessageStringTable.getString("NVPairs"); - _PREHASH_GroupNoticesListRequest = gMessageStringTable.getString("GroupNoticesListRequest"); - _PREHASH_ParcelAccessListRequest = gMessageStringTable.getString("ParcelAccessListRequest"); - _PREHASH_MuteListRequest = gMessageStringTable.getString("MuteListRequest"); - _PREHASH_RpcChannelRequest = gMessageStringTable.getString("RpcChannelRequest"); - _PREHASH_LandStatRequest = gMessageStringTable.getString("LandStatRequest"); - _PREHASH_PlacesQuery = gMessageStringTable.getString("PlacesQuery"); - _PREHASH_DirPlacesQuery = gMessageStringTable.getString("DirPlacesQuery"); - _PREHASH_SortOrder = gMessageStringTable.getString("SortOrder"); - _PREHASH_Hunter = gMessageStringTable.getString("Hunter"); - _PREHASH_SunAngVelocity = gMessageStringTable.getString("SunAngVelocity"); - _PREHASH_BinaryBucket = gMessageStringTable.getString("BinaryBucket"); - _PREHASH_ImagePacket = gMessageStringTable.getString("ImagePacket"); - _PREHASH_StartGroupProposal = gMessageStringTable.getString("StartGroupProposal"); - _PREHASH_EnergyLevel = gMessageStringTable.getString("EnergyLevel"); - _PREHASH_PriceForListing = gMessageStringTable.getString("PriceForListing"); - _PREHASH_Scale = gMessageStringTable.getString("Scale"); - _PREHASH_EstateCovenantReply = gMessageStringTable.getString("EstateCovenantReply"); - _PREHASH_ParentEstateID = gMessageStringTable.getString("ParentEstateID"); - _PREHASH_Extra2 = gMessageStringTable.getString("Extra2"); - _PREHASH_Throttle = gMessageStringTable.getString("Throttle"); - _PREHASH_SimIP = gMessageStringTable.getString("SimIP"); - _PREHASH_GodID = gMessageStringTable.getString("GodID"); - _PREHASH_TeleportMinPrice = gMessageStringTable.getString("TeleportMinPrice"); - _PREHASH_VoteItem = gMessageStringTable.getString("VoteItem"); - _PREHASH_ObjectRotation = gMessageStringTable.getString("ObjectRotation"); - _PREHASH_SitRotation = gMessageStringTable.getString("SitRotation"); - _PREHASH_SnapSelection = gMessageStringTable.getString("SnapSelection"); - _PREHASH_SoundTrigger = gMessageStringTable.getString("SoundTrigger"); - _PREHASH_TerrainRaiseLimit = gMessageStringTable.getString("TerrainRaiseLimit"); - _PREHASH_Quorum = gMessageStringTable.getString("Quorum"); - _PREHASH_AgentBlock = gMessageStringTable.getString("AgentBlock"); - _PREHASH_CommandBlock = gMessageStringTable.getString("CommandBlock"); - _PREHASH_PricePublicObjectDecay = gMessageStringTable.getString("PricePublicObjectDecay"); - _PREHASH_SpawnPointPos = gMessageStringTable.getString("SpawnPointPos"); - _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_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_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_ParcelDivide = gMessageStringTable.getString("ParcelDivide"); - _PREHASH_PriceObjectClaim = gMessageStringTable.getString("PriceObjectClaim"); - _PREHASH_Field = gMessageStringTable.getString("Field"); - _PREHASH_Ratio = gMessageStringTable.getString("Ratio"); - _PREHASH_JoinGroupReply = gMessageStringTable.getString("JoinGroupReply"); - _PREHASH_LiveHelpGroupReply = gMessageStringTable.getString("LiveHelpGroupReply"); - _PREHASH_Score = gMessageStringTable.getString("Score"); - _PREHASH_Image = gMessageStringTable.getString("Image"); - _PREHASH_ObjectClickAction = gMessageStringTable.getString("ObjectClickAction"); - _PREHASH_Parameter = gMessageStringTable.getString("Parameter"); - _PREHASH_Flags = gMessageStringTable.getString("Flags"); - _PREHASH_Plane = gMessageStringTable.getString("Plane"); - _PREHASH_Width = gMessageStringTable.getString("Width"); - _PREHASH_Right = gMessageStringTable.getString("Right"); - _PREHASH_DirFindQuery = gMessageStringTable.getString("DirFindQuery"); - _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_Modal = gMessageStringTable.getString("Modal"); - _PREHASH_ChildAgentUnknown = gMessageStringTable.getString("ChildAgentUnknown"); - _PREHASH_LandingType = gMessageStringTable.getString("LandingType"); - _PREHASH_ScriptRunningReply = gMessageStringTable.getString("ScriptRunningReply"); - _PREHASH_Reply = gMessageStringTable.getString("Reply"); - _PREHASH_GroupAccountDetailsReply = gMessageStringTable.getString("GroupAccountDetailsReply"); - _PREHASH_TelehubRot = gMessageStringTable.getString("TelehubRot"); - _PREHASH_AcceptFriendship = gMessageStringTable.getString("AcceptFriendship"); - _PREHASH_ItemType = gMessageStringTable.getString("ItemType"); - _PREHASH_DwellInfo = gMessageStringTable.getString("DwellInfo"); - _PREHASH_AgentResume = gMessageStringTable.getString("AgentResume"); - _PREHASH_MailFilter = gMessageStringTable.getString("MailFilter"); - _PREHASH_Disconnect = gMessageStringTable.getString("Disconnect"); - _PREHASH_SimPosition = gMessageStringTable.getString("SimPosition"); - _PREHASH_SimWideTotalPrims = gMessageStringTable.getString("SimWideTotalPrims"); - _PREHASH_Index = gMessageStringTable.getString("Index"); - _PREHASH_SimFilename = gMessageStringTable.getString("SimFilename"); - _PREHASH_LastOwnerID = gMessageStringTable.getString("LastOwnerID"); - _PREHASH_GroupNoticeRequest = gMessageStringTable.getString("GroupNoticeRequest"); - _PREHASH_EmailMessageRequest = gMessageStringTable.getString("EmailMessageRequest"); - _PREHASH_MapItemRequest = gMessageStringTable.getString("MapItemRequest"); - _PREHASH_AgentCount = gMessageStringTable.getString("AgentCount"); - _PREHASH_MessageBlock = gMessageStringTable.getString("MessageBlock"); - _PREHASH_FuseBlock = gMessageStringTable.getString("FuseBlock"); - _PREHASH_AgentGroupData = gMessageStringTable.getString("AgentGroupData"); - _PREHASH_ClassifiedInfoUpdate = gMessageStringTable.getString("ClassifiedInfoUpdate"); - _PREHASH_RegionPos = gMessageStringTable.getString("RegionPos"); - _PREHASH_ParcelMediaUpdate = gMessageStringTable.getString("ParcelMediaUpdate"); - _PREHASH_NoticeID = gMessageStringTable.getString("NoticeID"); - _PREHASH_GridX = gMessageStringTable.getString("GridX"); - _PREHASH_GridY = gMessageStringTable.getString("GridY"); - _PREHASH_Title = gMessageStringTable.getString("Title"); - _PREHASH_AuctionID = gMessageStringTable.getString("AuctionID"); - _PREHASH_VoteType = gMessageStringTable.getString("VoteType"); - _PREHASH_CategoryID = gMessageStringTable.getString("CategoryID"); - _PREHASH_Token = gMessageStringTable.getString("Token"); - _PREHASH_AggregatePerms = gMessageStringTable.getString("AggregatePerms"); - _PREHASH_ObjectSelect = gMessageStringTable.getString("ObjectSelect"); - _PREHASH_ForceObjectSelect = gMessageStringTable.getString("ForceObjectSelect"); - _PREHASH_Price = gMessageStringTable.getString("Price"); - _PREHASH_SunDirection = gMessageStringTable.getString("SunDirection"); - _PREHASH_FromName = gMessageStringTable.getString("FromName"); - _PREHASH_ChangeInventoryItemFlags = gMessageStringTable.getString("ChangeInventoryItemFlags"); - _PREHASH_Force = gMessageStringTable.getString("Force"); - _PREHASH_TransactionBlock = gMessageStringTable.getString("TransactionBlock"); - _PREHASH_PowersMask = gMessageStringTable.getString("PowersMask"); - _PREHASH_Stamp = gMessageStringTable.getString("Stamp"); - _PREHASH_TotalCredits = gMessageStringTable.getString("TotalCredits"); - _PREHASH_State = gMessageStringTable.getString("State"); - _PREHASH_TextureIndex = gMessageStringTable.getString("TextureIndex"); - _PREHASH_InviteeID = gMessageStringTable.getString("InviteeID"); - _PREHASH_ParcelReclaim = gMessageStringTable.getString("ParcelReclaim"); - _PREHASH_Money = gMessageStringTable.getString("Money"); - _PREHASH_PathTwist = gMessageStringTable.getString("PathTwist"); - _PREHASH_AuthBuyerID = gMessageStringTable.getString("AuthBuyerID"); - _PREHASH_Color = gMessageStringTable.getString("Color"); - _PREHASH_SourceType = gMessageStringTable.getString("SourceType"); - _PREHASH_World = gMessageStringTable.getString("World"); - _PREHASH_QueryData = gMessageStringTable.getString("QueryData"); - _PREHASH_Users = gMessageStringTable.getString("Users"); - _PREHASH_SysOS = gMessageStringTable.getString("SysOS"); - _PREHASH_Notes = gMessageStringTable.getString("Notes"); - _PREHASH_AvatarID = gMessageStringTable.getString("AvatarID"); - _PREHASH_FounderID = gMessageStringTable.getString("FounderID"); - _PREHASH_EndPointID = gMessageStringTable.getString("EndPointID"); - _PREHASH_LocationLookAt = gMessageStringTable.getString("LocationLookAt"); - _PREHASH_Sound = gMessageStringTable.getString("Sound"); - _PREHASH_Cover = gMessageStringTable.getString("Cover"); - _PREHASH_TotalObjectCount = gMessageStringTable.getString("TotalObjectCount"); - _PREHASH_TextureEntry = gMessageStringTable.getString("TextureEntry"); - _PREHASH_SquareMetersCommitted = gMessageStringTable.getString("SquareMetersCommitted"); - _PREHASH_ChannelID = gMessageStringTable.getString("ChannelID"); - _PREHASH_Dwell = gMessageStringTable.getString("Dwell"); - _PREHASH_North = gMessageStringTable.getString("North"); - _PREHASH_AgentUpdate = gMessageStringTable.getString("AgentUpdate"); - _PREHASH_PickGodDelete = gMessageStringTable.getString("PickGodDelete"); - _PREHASH_HostName = gMessageStringTable.getString("HostName"); - _PREHASH_PriceParcelClaim = gMessageStringTable.getString("PriceParcelClaim"); - _PREHASH_ParcelClaim = gMessageStringTable.getString("ParcelClaim"); - _PREHASH_AgentPowers = gMessageStringTable.getString("AgentPowers"); - _PREHASH_ProfileHollow = gMessageStringTable.getString("ProfileHollow"); - _PREHASH_GroupRoleChanges = gMessageStringTable.getString("GroupRoleChanges"); - _PREHASH_Count = gMessageStringTable.getString("Count"); - _PREHASH_South = gMessageStringTable.getString("South"); - _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"); - _PREHASH_FolderData = gMessageStringTable.getString("FolderData"); - _PREHASH_AssetBlock = gMessageStringTable.getString("AssetBlock"); - _PREHASH_AcceptNotices = gMessageStringTable.getString("AcceptNotices"); - _PREHASH_SetGroupAcceptNotices = gMessageStringTable.getString("SetGroupAcceptNotices"); - _PREHASH_CloseCircuit = gMessageStringTable.getString("CloseCircuit"); - _PREHASH_TeleportFinish = gMessageStringTable.getString("TeleportFinish"); - _PREHASH_PathRevolutions = gMessageStringTable.getString("PathRevolutions"); - _PREHASH_ClassifiedInfoReply = gMessageStringTable.getString("ClassifiedInfoReply"); - _PREHASH_ParcelInfoReply = gMessageStringTable.getString("ParcelInfoReply"); - _PREHASH_AutosaveData = gMessageStringTable.getString("AutosaveData"); - _PREHASH_SetStartLocation = gMessageStringTable.getString("SetStartLocation"); - _PREHASH_PassHours = gMessageStringTable.getString("PassHours"); - _PREHASH_AttachmentPt = gMessageStringTable.getString("AttachmentPt"); - _PREHASH_ParcelFlags = gMessageStringTable.getString("ParcelFlags"); - _PREHASH_NumVotes = gMessageStringTable.getString("NumVotes"); - _PREHASH_AvatarPickerRequest = gMessageStringTable.getString("AvatarPickerRequest"); - _PREHASH_TeleportLocationRequest = gMessageStringTable.getString("TeleportLocationRequest"); - _PREHASH_DataHomeLocationRequest = gMessageStringTable.getString("DataHomeLocationRequest"); - _PREHASH_EventNotificationAddRequest = gMessageStringTable.getString("EventNotificationAddRequest"); - _PREHASH_ParcelDwellRequest = gMessageStringTable.getString("ParcelDwellRequest"); - _PREHASH_EventLocationRequest = gMessageStringTable.getString("EventLocationRequest"); - _PREHASH_SetStartLocationRequest = gMessageStringTable.getString("SetStartLocationRequest"); - _PREHASH_QueryStart = gMessageStringTable.getString("QueryStart"); - _PREHASH_EjectData = gMessageStringTable.getString("EjectData"); - _PREHASH_AvatarTextureUpdate = gMessageStringTable.getString("AvatarTextureUpdate"); - _PREHASH_RPCServerPort = gMessageStringTable.getString("RPCServerPort"); - _PREHASH_Bytes = gMessageStringTable.getString("Bytes"); - _PREHASH_Extra = gMessageStringTable.getString("Extra"); - _PREHASH_ForceScriptControlRelease = gMessageStringTable.getString("ForceScriptControlRelease"); - _PREHASH_ParcelRelease = gMessageStringTable.getString("ParcelRelease"); - _PREHASH_VFileType = gMessageStringTable.getString("VFileType"); - _PREHASH_EjectGroupMemberReply = gMessageStringTable.getString("EjectGroupMemberReply"); - _PREHASH_ImageData = gMessageStringTable.getString("ImageData"); - _PREHASH_SimulatorViewerTimeMessage = gMessageStringTable.getString("SimulatorViewerTimeMessage"); - _PREHASH_Rotation = gMessageStringTable.getString("Rotation"); - _PREHASH_Selection = gMessageStringTable.getString("Selection"); - _PREHASH_TransactionData = gMessageStringTable.getString("TransactionData"); - _PREHASH_OperationData = gMessageStringTable.getString("OperationData"); - _PREHASH_ExpirationDate = gMessageStringTable.getString("ExpirationDate"); - _PREHASH_ParcelDeedToGroup = gMessageStringTable.getString("ParcelDeedToGroup"); - _PREHASH_AvatarPicksReply = gMessageStringTable.getString("AvatarPicksReply"); - _PREHASH_GroupTitlesReply = gMessageStringTable.getString("GroupTitlesReply"); - _PREHASH_AgentInfo = gMessageStringTable.getString("AgentInfo"); - _PREHASH_MoneyTransferBackend = gMessageStringTable.getString("MoneyTransferBackend"); - _PREHASH_NextOwnerMask = gMessageStringTable.getString("NextOwnerMask"); - _PREHASH_MuteData = gMessageStringTable.getString("MuteData"); - _PREHASH_PassPrice = gMessageStringTable.getString("PassPrice"); - _PREHASH_SourceID = gMessageStringTable.getString("SourceID"); - _PREHASH_ChangeUserRights = gMessageStringTable.getString("ChangeUserRights"); - _PREHASH_TeleportFlags = gMessageStringTable.getString("TeleportFlags"); - _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"); - _PREHASH_ConfirmXferPacket = gMessageStringTable.getString("ConfirmXferPacket"); - _PREHASH_StartPingCheck = gMessageStringTable.getString("StartPingCheck"); - _PREHASH_SimWideDeletes = gMessageStringTable.getString("SimWideDeletes"); - _PREHASH_LandStatReply = gMessageStringTable.getString("LandStatReply"); - _PREHASH_IsPhantom = gMessageStringTable.getString("IsPhantom"); - _PREHASH_AgentList = gMessageStringTable.getString("AgentList"); - _PREHASH_SimApproved = gMessageStringTable.getString("SimApproved"); - _PREHASH_RezObject = gMessageStringTable.getString("RezObject"); - _PREHASH_TaskLocalID = gMessageStringTable.getString("TaskLocalID"); - _PREHASH_ClaimDate = gMessageStringTable.getString("ClaimDate"); - _PREHASH_MergeParcel = gMessageStringTable.getString("MergeParcel"); - _PREHASH_Priority = gMessageStringTable.getString("Priority"); - _PREHASH_QueryText = gMessageStringTable.getString("QueryText"); - _PREHASH_GroupNoticeAdd = gMessageStringTable.getString("GroupNoticeAdd"); - _PREHASH_ReturnType = gMessageStringTable.getString("ReturnType"); - _PREHASH_FetchFolders = gMessageStringTable.getString("FetchFolders"); - _PREHASH_SimulatorPublicHostBlock = gMessageStringTable.getString("SimulatorPublicHostBlock"); - _PREHASH_HeaderData = gMessageStringTable.getString("HeaderData"); - _PREHASH_RequestMultipleObjects = gMessageStringTable.getString("RequestMultipleObjects"); - _PREHASH_RetrieveInstantMessages = gMessageStringTable.getString("RetrieveInstantMessages"); - _PREHASH_OpenCircuit = gMessageStringTable.getString("OpenCircuit"); - _PREHASH_CrossedRegion = gMessageStringTable.getString("CrossedRegion"); - _PREHASH_DirGroupsReply = gMessageStringTable.getString("DirGroupsReply"); - _PREHASH_AvatarGroupsReply = gMessageStringTable.getString("AvatarGroupsReply"); - _PREHASH_EmailMessageReply = gMessageStringTable.getString("EmailMessageReply"); - _PREHASH_GroupVoteHistoryItemReply = gMessageStringTable.getString("GroupVoteHistoryItemReply"); - _PREHASH_ViewerPosition = gMessageStringTable.getString("ViewerPosition"); - _PREHASH_Position = gMessageStringTable.getString("Position"); - _PREHASH_ParentEstate = gMessageStringTable.getString("ParentEstate"); - _PREHASH_EstateName = gMessageStringTable.getString("EstateName"); - _PREHASH_MuteName = gMessageStringTable.getString("MuteName"); - _PREHASH_ParcelRename = gMessageStringTable.getString("ParcelRename"); - _PREHASH_ViewerFilename = gMessageStringTable.getString("ViewerFilename"); - _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_OpenEnrollment = gMessageStringTable.getString("OpenEnrollment"); - _PREHASH_GroupData = gMessageStringTable.getString("GroupData"); - _PREHASH_RequestGodlikePowers = gMessageStringTable.getString("RequestGodlikePowers"); - _PREHASH_GrantGodlikePowers = gMessageStringTable.getString("GrantGodlikePowers"); - _PREHASH_TransactionID = gMessageStringTable.getString("TransactionID"); - _PREHASH_DestinationID = gMessageStringTable.getString("DestinationID"); - _PREHASH_Controls = gMessageStringTable.getString("Controls"); - _PREHASH_FirstDetachAll = gMessageStringTable.getString("FirstDetachAll"); - _PREHASH_EstateID = gMessageStringTable.getString("EstateID"); - _PREHASH_ImprovedInstantMessage = gMessageStringTable.getString("ImprovedInstantMessage"); - _PREHASH_CheckParcelSales = gMessageStringTable.getString("CheckParcelSales"); - _PREHASH_ParcelSales = gMessageStringTable.getString("ParcelSales"); - _PREHASH_CurrentInterval = gMessageStringTable.getString("CurrentInterval"); - _PREHASH_PriceRentLight = gMessageStringTable.getString("PriceRentLight"); - _PREHASH_MediaAutoScale = gMessageStringTable.getString("MediaAutoScale"); - _PREHASH_NeighborBlock = gMessageStringTable.getString("NeighborBlock"); - _PREHASH_LayerData = gMessageStringTable.getString("LayerData"); - _PREHASH_NVPairData = gMessageStringTable.getString("NVPairData"); - _PREHASH_TeleportLocal = gMessageStringTable.getString("TeleportLocal"); - _PREHASH_EjecteeID = gMessageStringTable.getString("EjecteeID"); - _PREHASH_VoteInitiator = gMessageStringTable.getString("VoteInitiator"); - _PREHASH_TypeData = gMessageStringTable.getString("TypeData"); - _PREHASH_OwnerIDs = gMessageStringTable.getString("OwnerIDs"); - _PREHASH_SystemKickUser = gMessageStringTable.getString("SystemKickUser"); - _PREHASH_TransactionTime = gMessageStringTable.getString("TransactionTime"); - _PREHASH_TimeToLive = gMessageStringTable.getString("TimeToLive"); - _PREHASH_OldAgentID = gMessageStringTable.getString("OldAgentID"); - _PREHASH_MusicURL = gMessageStringTable.getString("MusicURL"); - _PREHASH_ParcelPrimBonus = gMessageStringTable.getString("ParcelPrimBonus"); - _PREHASH_EjectUser = gMessageStringTable.getString("EjectUser"); - _PREHASH_CoarseLocationUpdate = gMessageStringTable.getString("CoarseLocationUpdate"); - _PREHASH_ChildAgentPositionUpdate = gMessageStringTable.getString("ChildAgentPositionUpdate"); - _PREHASH_StoreLocal = gMessageStringTable.getString("StoreLocal"); - _PREHASH_GroupName = gMessageStringTable.getString("GroupName"); - _PREHASH_PriceParcelRent = gMessageStringTable.getString("PriceParcelRent"); - _PREHASH_SimStatus = gMessageStringTable.getString("SimStatus"); - _PREHASH_TransactionSuccess = gMessageStringTable.getString("TransactionSuccess"); - _PREHASH_LureType = gMessageStringTable.getString("LureType"); - _PREHASH_GroupMask = gMessageStringTable.getString("GroupMask"); - _PREHASH_SitObject = gMessageStringTable.getString("SitObject"); - _PREHASH_Override = gMessageStringTable.getString("Override"); - _PREHASH_LocomotionState = gMessageStringTable.getString("LocomotionState"); - _PREHASH_PriceUpload = gMessageStringTable.getString("PriceUpload"); - _PREHASH_RemoveParcel = gMessageStringTable.getString("RemoveParcel"); - _PREHASH_ConfirmAuctionStart = gMessageStringTable.getString("ConfirmAuctionStart"); - _PREHASH_RpcScriptRequestInbound = gMessageStringTable.getString("RpcScriptRequestInbound"); - _PREHASH_ActiveGroupID = gMessageStringTable.getString("ActiveGroupID"); - _PREHASH_ParcelReturnObjects = gMessageStringTable.getString("ParcelReturnObjects"); - _PREHASH_TotalObjects = gMessageStringTable.getString("TotalObjects"); - _PREHASH_ObjectExtraParams = gMessageStringTable.getString("ObjectExtraParams"); - _PREHASH_Questions = gMessageStringTable.getString("Questions"); - _PREHASH_TransferAbort = gMessageStringTable.getString("TransferAbort"); - _PREHASH_TransferInventory = gMessageStringTable.getString("TransferInventory"); - _PREHASH_RayTargetID = gMessageStringTable.getString("RayTargetID"); - _PREHASH_ClaimPrice = gMessageStringTable.getString("ClaimPrice"); - _PREHASH_ObjectProperties = gMessageStringTable.getString("ObjectProperties"); - _PREHASH_ParcelProperties = gMessageStringTable.getString("ParcelProperties"); - _PREHASH_EstateOwnerID = gMessageStringTable.getString("EstateOwnerID"); - _PREHASH_LogoutRequest = gMessageStringTable.getString("LogoutRequest"); - _PREHASH_AssetUploadRequest = gMessageStringTable.getString("AssetUploadRequest"); - _PREHASH_TransactionType = gMessageStringTable.getString("TransactionType"); - _PREHASH_AvatarPropertiesUpdate = gMessageStringTable.getString("AvatarPropertiesUpdate"); - _PREHASH_ParcelPropertiesUpdate = gMessageStringTable.getString("ParcelPropertiesUpdate"); - _PREHASH_FetchItems = gMessageStringTable.getString("FetchItems"); - _PREHASH_AbortXfer = gMessageStringTable.getString("AbortXfer"); - _PREHASH_DeRezAck = gMessageStringTable.getString("DeRezAck"); - _PREHASH_TakeControls = gMessageStringTable.getString("TakeControls"); - _PREHASH_DirLandReply = gMessageStringTable.getString("DirLandReply"); - _PREHASH_MuteType = gMessageStringTable.getString("MuteType"); - _PREHASH_IMViaEMail = gMessageStringTable.getString("IMViaEMail"); - _PREHASH_RentPrice = gMessageStringTable.getString("RentPrice"); - _PREHASH_GenericMessage = gMessageStringTable.getString("GenericMessage"); - _PREHASH_ChildAgentAlive = gMessageStringTable.getString("ChildAgentAlive"); - _PREHASH_AssetType = gMessageStringTable.getString("AssetType"); - _PREHASH_SpawnPointBlock = gMessageStringTable.getString("SpawnPointBlock"); - _PREHASH_AttachmentBlock = gMessageStringTable.getString("AttachmentBlock"); - _PREHASH_ObjectMaterial = gMessageStringTable.getString("ObjectMaterial"); - _PREHASH_OwnerName = gMessageStringTable.getString("OwnerName"); - _PREHASH_AvatarNotesReply = gMessageStringTable.getString("AvatarNotesReply"); - _PREHASH_CacheID = gMessageStringTable.getString("CacheID"); - _PREHASH_OwnerMask = gMessageStringTable.getString("OwnerMask"); - _PREHASH_TransferInventoryAck = gMessageStringTable.getString("TransferInventoryAck"); - _PREHASH_RegionDenyAgeUnverified = gMessageStringTable.getString("RegionDenyAgeUnverified"); - _PREHASH_AgeVerificationBlock = gMessageStringTable.getString("AgeVerificationBlock"); -} - +char* _PREHASH_X = LLMessageStringTable::getInstance()->getString("X"); +char* _PREHASH_Y = LLMessageStringTable::getInstance()->getString("Y"); +char* _PREHASH_Z = LLMessageStringTable::getInstance()->getString("Z"); +char* _PREHASH_AddFlags = LLMessageStringTable::getInstance()->getString("AddFlags"); +char* _PREHASH_FailureInfo = LLMessageStringTable::getInstance()->getString("FailureInfo"); +char* _PREHASH_MapData = LLMessageStringTable::getInstance()->getString("MapData"); +char* _PREHASH_AddItem = LLMessageStringTable::getInstance()->getString("AddItem"); +char* _PREHASH_MeanCollision = LLMessageStringTable::getInstance()->getString("MeanCollision"); +char* _PREHASH_RezScript = LLMessageStringTable::getInstance()->getString("RezScript"); +char* _PREHASH_AvatarSitResponse = LLMessageStringTable::getInstance()->getString("AvatarSitResponse"); +char* _PREHASH_InventoryAssetResponse = LLMessageStringTable::getInstance()->getString("InventoryAssetResponse"); +char* _PREHASH_KillObject = LLMessageStringTable::getInstance()->getString("KillObject"); +char* _PREHASH_ProposalID = LLMessageStringTable::getInstance()->getString("ProposalID"); +char* _PREHASH_SerialNum = LLMessageStringTable::getInstance()->getString("SerialNum"); +char* _PREHASH_Duration = LLMessageStringTable::getInstance()->getString("Duration"); +char* _PREHASH_ScriptQuestion = LLMessageStringTable::getInstance()->getString("ScriptQuestion"); +char* _PREHASH_AddCircuitCode = LLMessageStringTable::getInstance()->getString("AddCircuitCode"); +char* _PREHASH_UseCircuitCode = LLMessageStringTable::getInstance()->getString("UseCircuitCode"); +char* _PREHASH_ViewerCircuitCode = LLMessageStringTable::getInstance()->getString("ViewerCircuitCode"); +char* _PREHASH_ScriptAnswerYes = LLMessageStringTable::getInstance()->getString("ScriptAnswerYes"); +char* _PREHASH_PartnerID = LLMessageStringTable::getInstance()->getString("PartnerID"); +char* _PREHASH_DirLandQuery = LLMessageStringTable::getInstance()->getString("DirLandQuery"); +char* _PREHASH_TeleportStart = LLMessageStringTable::getInstance()->getString("TeleportStart"); +char* _PREHASH_AboutText = LLMessageStringTable::getInstance()->getString("AboutText"); +char* _PREHASH_VisualParam = LLMessageStringTable::getInstance()->getString("VisualParam"); +char* _PREHASH_GroupPrims = LLMessageStringTable::getInstance()->getString("GroupPrims"); +char* _PREHASH_SelectedPrims = LLMessageStringTable::getInstance()->getString("SelectedPrims"); +char* _PREHASH_ID = LLMessageStringTable::getInstance()->getString("ID"); +char* _PREHASH_UUIDNameRequest = LLMessageStringTable::getInstance()->getString("UUIDNameRequest"); +char* _PREHASH_UUIDGroupNameRequest = LLMessageStringTable::getInstance()->getString("UUIDGroupNameRequest"); +char* _PREHASH_GroupAccountTransactionsRequest = LLMessageStringTable::getInstance()->getString("GroupAccountTransactionsRequest"); +char* _PREHASH_MapNameRequest = LLMessageStringTable::getInstance()->getString("MapNameRequest"); +char* _PREHASH_UpdateSimulator = LLMessageStringTable::getInstance()->getString("UpdateSimulator"); +char* _PREHASH_BillableFactor = LLMessageStringTable::getInstance()->getString("BillableFactor"); +char* _PREHASH_ObjectBonusFactor = LLMessageStringTable::getInstance()->getString("ObjectBonusFactor"); +char* _PREHASH_EnableSimulator = LLMessageStringTable::getInstance()->getString("EnableSimulator"); +char* _PREHASH_DisableSimulator = LLMessageStringTable::getInstance()->getString("DisableSimulator"); +char* _PREHASH_ConfirmEnableSimulator = LLMessageStringTable::getInstance()->getString("ConfirmEnableSimulator"); +char* _PREHASH_LayerType = LLMessageStringTable::getInstance()->getString("LayerType"); +char* _PREHASH_OwnerRole = LLMessageStringTable::getInstance()->getString("OwnerRole"); +char* _PREHASH_ParcelOverlay = LLMessageStringTable::getInstance()->getString("ParcelOverlay"); +char* _PREHASH_GroupOwned = LLMessageStringTable::getInstance()->getString("GroupOwned"); +char* _PREHASH_IP = LLMessageStringTable::getInstance()->getString("IP"); +char* _PREHASH_ChatFromViewer = LLMessageStringTable::getInstance()->getString("ChatFromViewer"); +char* _PREHASH_AvgAgentsInView = LLMessageStringTable::getInstance()->getString("AvgAgentsInView"); +char* _PREHASH_AgentsInView = LLMessageStringTable::getInstance()->getString("AgentsInView"); +char* _PREHASH_GroupTitle = LLMessageStringTable::getInstance()->getString("GroupTitle"); +char* _PREHASH_MapLayerReply = LLMessageStringTable::getInstance()->getString("MapLayerReply"); +char* _PREHASH_CompoundMsgID = LLMessageStringTable::getInstance()->getString("CompoundMsgID"); +char* _PREHASH_CameraConstraint = LLMessageStringTable::getInstance()->getString("CameraConstraint"); +char* _PREHASH_DownloadTotals = LLMessageStringTable::getInstance()->getString("DownloadTotals"); +char* _PREHASH_GenCounter = LLMessageStringTable::getInstance()->getString("GenCounter"); +char* _PREHASH_FrozenData = LLMessageStringTable::getInstance()->getString("FrozenData"); +char* _PREHASH_ChildAgentDying = LLMessageStringTable::getInstance()->getString("ChildAgentDying"); +char* _PREHASH_To = LLMessageStringTable::getInstance()->getString("To"); +char* _PREHASH_CopyInventoryFromNotecard = LLMessageStringTable::getInstance()->getString("CopyInventoryFromNotecard"); +char* _PREHASH_RezObjectFromNotecard = LLMessageStringTable::getInstance()->getString("RezObjectFromNotecard"); +char* _PREHASH_ParcelDirFeeCurrent = LLMessageStringTable::getInstance()->getString("ParcelDirFeeCurrent"); +char* _PREHASH_SeedCapability = LLMessageStringTable::getInstance()->getString("SeedCapability"); +char* _PREHASH_ObjectDuplicate = LLMessageStringTable::getInstance()->getString("ObjectDuplicate"); +char* _PREHASH_InventoryData = LLMessageStringTable::getInstance()->getString("InventoryData"); +char* _PREHASH_ReplyData = LLMessageStringTable::getInstance()->getString("ReplyData"); +char* _PREHASH_ResetList = LLMessageStringTable::getInstance()->getString("ResetList"); +char* _PREHASH_MediaID = LLMessageStringTable::getInstance()->getString("MediaID"); +char* _PREHASH_RelatedRights = LLMessageStringTable::getInstance()->getString("RelatedRights"); +char* _PREHASH_RedirectGridX = LLMessageStringTable::getInstance()->getString("RedirectGridX"); +char* _PREHASH_RedirectGridY = LLMessageStringTable::getInstance()->getString("RedirectGridY"); +char* _PREHASH_TransferID = LLMessageStringTable::getInstance()->getString("TransferID"); +char* _PREHASH_TexturesChanged = LLMessageStringTable::getInstance()->getString("TexturesChanged"); +char* _PREHASH_UserLookAt = LLMessageStringTable::getInstance()->getString("UserLookAt"); +char* _PREHASH_TestBlock1 = LLMessageStringTable::getInstance()->getString("TestBlock1"); +char* _PREHASH_SensedData = LLMessageStringTable::getInstance()->getString("SensedData"); +char* _PREHASH_UpdateBlock = LLMessageStringTable::getInstance()->getString("UpdateBlock"); +char* _PREHASH_ClassifiedGodDelete = LLMessageStringTable::getInstance()->getString("ClassifiedGodDelete"); +char* _PREHASH_ObjectGrabUpdate = LLMessageStringTable::getInstance()->getString("ObjectGrabUpdate"); +char* _PREHASH_LocationPos = LLMessageStringTable::getInstance()->getString("LocationPos"); +char* _PREHASH_TaxDate = LLMessageStringTable::getInstance()->getString("TaxDate"); +char* _PREHASH_StartDateTime = LLMessageStringTable::getInstance()->getString("StartDateTime"); +char* _PREHASH_ObjectUpdateCached = LLMessageStringTable::getInstance()->getString("ObjectUpdateCached"); +char* _PREHASH_Packets = LLMessageStringTable::getInstance()->getString("Packets"); +char* _PREHASH_FailureType = LLMessageStringTable::getInstance()->getString("FailureType"); +char* _PREHASH_UpdateGroupInfo = LLMessageStringTable::getInstance()->getString("UpdateGroupInfo"); +char* _PREHASH_ObjectPermissions = LLMessageStringTable::getInstance()->getString("ObjectPermissions"); +char* _PREHASH_RevokePermissions = LLMessageStringTable::getInstance()->getString("RevokePermissions"); +char* _PREHASH_UpdateFlags = LLMessageStringTable::getInstance()->getString("UpdateFlags"); +char* _PREHASH_ObjectExportSelected = LLMessageStringTable::getInstance()->getString("ObjectExportSelected"); +char* _PREHASH_RezSelected = LLMessageStringTable::getInstance()->getString("RezSelected"); +char* _PREHASH_AutoPilot = LLMessageStringTable::getInstance()->getString("AutoPilot"); +char* _PREHASH_UpdateMuteListEntry = LLMessageStringTable::getInstance()->getString("UpdateMuteListEntry"); +char* _PREHASH_RemoveMuteListEntry = LLMessageStringTable::getInstance()->getString("RemoveMuteListEntry"); +char* _PREHASH_SetSimStatusInDatabase = LLMessageStringTable::getInstance()->getString("SetSimStatusInDatabase"); +char* _PREHASH_SetSimPresenceInDatabase = LLMessageStringTable::getInstance()->getString("SetSimPresenceInDatabase"); +char* _PREHASH_CameraProperty = LLMessageStringTable::getInstance()->getString("CameraProperty"); +char* _PREHASH_BrushSize = LLMessageStringTable::getInstance()->getString("BrushSize"); +char* _PREHASH_SimulatorSetMap = LLMessageStringTable::getInstance()->getString("SimulatorSetMap"); +char* _PREHASH_RegionPresenceRequestByRegionID = LLMessageStringTable::getInstance()->getString("RegionPresenceRequestByRegionID"); +char* _PREHASH_ParcelObjectOwnersReply = LLMessageStringTable::getInstance()->getString("ParcelObjectOwnersReply"); +char* _PREHASH_GroupMembersReply = LLMessageStringTable::getInstance()->getString("GroupMembersReply"); +char* _PREHASH_GroupRoleMembersReply = LLMessageStringTable::getInstance()->getString("GroupRoleMembersReply"); +char* _PREHASH_RequestRegionInfo = LLMessageStringTable::getInstance()->getString("RequestRegionInfo"); +char* _PREHASH_AABBMax = LLMessageStringTable::getInstance()->getString("AABBMax"); +char* _PREHASH_RequestPayPrice = LLMessageStringTable::getInstance()->getString("RequestPayPrice"); +char* _PREHASH_SimulatorPresentAtLocation = LLMessageStringTable::getInstance()->getString("SimulatorPresentAtLocation"); +char* _PREHASH_AgentRequestSit = LLMessageStringTable::getInstance()->getString("AgentRequestSit"); +char* _PREHASH_AABBMin = LLMessageStringTable::getInstance()->getString("AABBMin"); +char* _PREHASH_ClassifiedFlags = LLMessageStringTable::getInstance()->getString("ClassifiedFlags"); +char* _PREHASH_ControlFlags = LLMessageStringTable::getInstance()->getString("ControlFlags"); +char* _PREHASH_TeleportRequest = LLMessageStringTable::getInstance()->getString("TeleportRequest"); +char* _PREHASH_ScriptTeleportRequest = LLMessageStringTable::getInstance()->getString("ScriptTeleportRequest"); +char* _PREHASH_EstateCovenantRequest = LLMessageStringTable::getInstance()->getString("EstateCovenantRequest"); +char* _PREHASH_DateUTC = LLMessageStringTable::getInstance()->getString("DateUTC"); +char* _PREHASH_TaskIDs = LLMessageStringTable::getInstance()->getString("TaskIDs"); +char* _PREHASH_RequestResult = LLMessageStringTable::getInstance()->getString("RequestResult"); +char* _PREHASH_CanAcceptAgents = LLMessageStringTable::getInstance()->getString("CanAcceptAgents"); +char* _PREHASH_ObjectSaleInfo = LLMessageStringTable::getInstance()->getString("ObjectSaleInfo"); +char* _PREHASH_KillChildAgents = LLMessageStringTable::getInstance()->getString("KillChildAgents"); +char* _PREHASH_Balance = LLMessageStringTable::getInstance()->getString("Balance"); +char* _PREHASH_DerezContainer = LLMessageStringTable::getInstance()->getString("DerezContainer"); +char* _PREHASH_ObjectData = LLMessageStringTable::getInstance()->getString("ObjectData"); +char* _PREHASH_CameraAtAxis = LLMessageStringTable::getInstance()->getString("CameraAtAxis"); +char* _PREHASH_InfoBlock = LLMessageStringTable::getInstance()->getString("InfoBlock"); +char* _PREHASH_OwnershipCost = LLMessageStringTable::getInstance()->getString("OwnershipCost"); +char* _PREHASH_AvatarNotesUpdate = LLMessageStringTable::getInstance()->getString("AvatarNotesUpdate"); +char* _PREHASH_PID = LLMessageStringTable::getInstance()->getString("PID"); +char* _PREHASH_DirPopularReply = LLMessageStringTable::getInstance()->getString("DirPopularReply"); +char* _PREHASH_TerrainHeightRange00 = LLMessageStringTable::getInstance()->getString("TerrainHeightRange00"); +char* _PREHASH_SimData = LLMessageStringTable::getInstance()->getString("SimData"); +char* _PREHASH_TerrainHeightRange01 = LLMessageStringTable::getInstance()->getString("TerrainHeightRange01"); +char* _PREHASH_TerrainHeightRange10 = LLMessageStringTable::getInstance()->getString("TerrainHeightRange10"); +char* _PREHASH_TerrainHeightRange11 = LLMessageStringTable::getInstance()->getString("TerrainHeightRange11"); +char* _PREHASH_UpdateInventoryItem = LLMessageStringTable::getInstance()->getString("UpdateInventoryItem"); +char* _PREHASH_UpdateCreateInventoryItem = LLMessageStringTable::getInstance()->getString("UpdateCreateInventoryItem"); +char* _PREHASH_MoveInventoryItem = LLMessageStringTable::getInstance()->getString("MoveInventoryItem"); +char* _PREHASH_CopyInventoryItem = LLMessageStringTable::getInstance()->getString("CopyInventoryItem"); +char* _PREHASH_LinkInventoryItem = LLMessageStringTable::getInstance()->getString("LinkInventoryItem"); +char* _PREHASH_RemoveInventoryItem = LLMessageStringTable::getInstance()->getString("RemoveInventoryItem"); +char* _PREHASH_CreateInventoryItem = LLMessageStringTable::getInstance()->getString("CreateInventoryItem"); +char* _PREHASH_PathTwistBegin = LLMessageStringTable::getInstance()->getString("PathTwistBegin"); +char* _PREHASH_CRC = LLMessageStringTable::getInstance()->getString("CRC"); +char* _PREHASH_AttachmentPoint = LLMessageStringTable::getInstance()->getString("AttachmentPoint"); +char* _PREHASH_TelehubBlock = LLMessageStringTable::getInstance()->getString("TelehubBlock"); +char* _PREHASH_FOVBlock = LLMessageStringTable::getInstance()->getString("FOVBlock"); +char* _PREHASH_StartLocationData = LLMessageStringTable::getInstance()->getString("StartLocationData"); +char* _PREHASH_PositionData = LLMessageStringTable::getInstance()->getString("PositionData"); +char* _PREHASH_TimeSinceLast = LLMessageStringTable::getInstance()->getString("TimeSinceLast"); +char* _PREHASH_MapImage = LLMessageStringTable::getInstance()->getString("MapImage"); +char* _PREHASH_Objects = LLMessageStringTable::getInstance()->getString("Objects"); +char* _PREHASH_URL = LLMessageStringTable::getInstance()->getString("URL"); +char* _PREHASH_CreationDate = LLMessageStringTable::getInstance()->getString("CreationDate"); +char* _PREHASH_JointPivot = LLMessageStringTable::getInstance()->getString("JointPivot"); +char* _PREHASH_FPS = LLMessageStringTable::getInstance()->getString("FPS"); +char* _PREHASH_HasTelehub = LLMessageStringTable::getInstance()->getString("HasTelehub"); +char* _PREHASH_PathEnd = LLMessageStringTable::getInstance()->getString("PathEnd"); +char* _PREHASH_ScriptDataReply = LLMessageStringTable::getInstance()->getString("ScriptDataReply"); +char* _PREHASH_MapBlockReply = LLMessageStringTable::getInstance()->getString("MapBlockReply"); +char* _PREHASH_PropertiesData = LLMessageStringTable::getInstance()->getString("PropertiesData"); +char* _PREHASH_ViewerEffect = LLMessageStringTable::getInstance()->getString("ViewerEffect"); +char* _PREHASH_FreezeUser = LLMessageStringTable::getInstance()->getString("FreezeUser"); +char* _PREHASH_OwnerPrims = LLMessageStringTable::getInstance()->getString("OwnerPrims"); +char* _PREHASH_ObjectGrab = LLMessageStringTable::getInstance()->getString("ObjectGrab"); +char* _PREHASH_ToAgentID = LLMessageStringTable::getInstance()->getString("ToAgentID"); +char* _PREHASH_SimulatorMapUpdate = LLMessageStringTable::getInstance()->getString("SimulatorMapUpdate"); +char* _PREHASH_TransferPacket = LLMessageStringTable::getInstance()->getString("TransferPacket"); +char* _PREHASH_ObjectName = LLMessageStringTable::getInstance()->getString("ObjectName"); +char* _PREHASH_GroupPowers = LLMessageStringTable::getInstance()->getString("GroupPowers"); +char* _PREHASH_OriginalName = LLMessageStringTable::getInstance()->getString("OriginalName"); +char* _PREHASH_CompletePingCheck = LLMessageStringTable::getInstance()->getString("CompletePingCheck"); +char* _PREHASH_OnlineStatus = LLMessageStringTable::getInstance()->getString("OnlineStatus"); +char* _PREHASH_ObjectDrop = LLMessageStringTable::getInstance()->getString("ObjectDrop"); +char* _PREHASH_UseBigPackets = LLMessageStringTable::getInstance()->getString("UseBigPackets"); +char* _PREHASH_GroupNoticesListReply = LLMessageStringTable::getInstance()->getString("GroupNoticesListReply"); +char* _PREHASH_ParcelAccessListReply = LLMessageStringTable::getInstance()->getString("ParcelAccessListReply"); +char* _PREHASH_RpcChannelReply = LLMessageStringTable::getInstance()->getString("RpcChannelReply"); +char* _PREHASH_RegionPresenceResponse = LLMessageStringTable::getInstance()->getString("RegionPresenceResponse"); +char* _PREHASH_CharterMember = LLMessageStringTable::getInstance()->getString("CharterMember"); +char* _PREHASH_EdgeData = LLMessageStringTable::getInstance()->getString("EdgeData"); +char* _PREHASH_NameData = LLMessageStringTable::getInstance()->getString("NameData"); +char* _PREHASH_RegionPushOverride = LLMessageStringTable::getInstance()->getString("RegionPushOverride"); +char* _PREHASH_SimName = LLMessageStringTable::getInstance()->getString("SimName"); +char* _PREHASH_UserReport = LLMessageStringTable::getInstance()->getString("UserReport"); +char* _PREHASH_DownloadPriority = LLMessageStringTable::getInstance()->getString("DownloadPriority"); +char* _PREHASH_ToAgentId = LLMessageStringTable::getInstance()->getString("ToAgentId"); +char* _PREHASH_DirPopularQuery = LLMessageStringTable::getInstance()->getString("DirPopularQuery"); +char* _PREHASH_Mag = LLMessageStringTable::getInstance()->getString("Mag"); +char* _PREHASH_ParcelPropertiesRequestByID = LLMessageStringTable::getInstance()->getString("ParcelPropertiesRequestByID"); +char* _PREHASH_ObjectLink = LLMessageStringTable::getInstance()->getString("ObjectLink"); +char* _PREHASH_RpcScriptReplyInbound = LLMessageStringTable::getInstance()->getString("RpcScriptReplyInbound"); +char* _PREHASH_RezData = LLMessageStringTable::getInstance()->getString("RezData"); +char* _PREHASH_RemoveInventoryObjects = LLMessageStringTable::getInstance()->getString("RemoveInventoryObjects"); +char* _PREHASH_GroupProposalBallot = LLMessageStringTable::getInstance()->getString("GroupProposalBallot"); +char* _PREHASH_RPCServerIP = LLMessageStringTable::getInstance()->getString("RPCServerIP"); +char* _PREHASH_Far = LLMessageStringTable::getInstance()->getString("Far"); +char* _PREHASH_GodSessionID = LLMessageStringTable::getInstance()->getString("GodSessionID"); +char* _PREHASH_FLAboutText = LLMessageStringTable::getInstance()->getString("FLAboutText"); +char* _PREHASH_RegionHandshakeReply = LLMessageStringTable::getInstance()->getString("RegionHandshakeReply"); +char* _PREHASH_GroupActiveProposalItemReply = LLMessageStringTable::getInstance()->getString("GroupActiveProposalItemReply"); +char* _PREHASH_MapItemReply = LLMessageStringTable::getInstance()->getString("MapItemReply"); +char* _PREHASH_Seconds = LLMessageStringTable::getInstance()->getString("Seconds"); +char* _PREHASH_UpdateUserInfo = LLMessageStringTable::getInstance()->getString("UpdateUserInfo"); +char* _PREHASH_AggregatePermTexturesOwner = LLMessageStringTable::getInstance()->getString("AggregatePermTexturesOwner"); +char* _PREHASH_Set = LLMessageStringTable::getInstance()->getString("Set"); +char* _PREHASH_NewName = LLMessageStringTable::getInstance()->getString("NewName"); +char* _PREHASH_Key = LLMessageStringTable::getInstance()->getString("Key"); +char* _PREHASH_AgentID = LLMessageStringTable::getInstance()->getString("AgentID"); +char* _PREHASH_EventNotificationRemoveRequest = LLMessageStringTable::getInstance()->getString("EventNotificationRemoveRequest"); +char* _PREHASH_NewFolderID = LLMessageStringTable::getInstance()->getString("NewFolderID"); +char* _PREHASH_Arc = LLMessageStringTable::getInstance()->getString("Arc"); +char* _PREHASH_RegionX = LLMessageStringTable::getInstance()->getString("RegionX"); +char* _PREHASH_RegionY = LLMessageStringTable::getInstance()->getString("RegionY"); +char* _PREHASH_RequestData = LLMessageStringTable::getInstance()->getString("RequestData"); +char* _PREHASH_Msg = LLMessageStringTable::getInstance()->getString("Msg"); +char* _PREHASH_Top = LLMessageStringTable::getInstance()->getString("Top"); +char* _PREHASH_MiscStats = LLMessageStringTable::getInstance()->getString("MiscStats"); +char* _PREHASH_ImageID = LLMessageStringTable::getInstance()->getString("ImageID"); +char* _PREHASH_DataPacket = LLMessageStringTable::getInstance()->getString("DataPacket"); +char* _PREHASH_You = LLMessageStringTable::getInstance()->getString("You"); +char* _PREHASH_ScriptControlChange = LLMessageStringTable::getInstance()->getString("ScriptControlChange"); +char* _PREHASH_LoadURL = LLMessageStringTable::getInstance()->getString("LoadURL"); +char* _PREHASH_SetCPURatio = LLMessageStringTable::getInstance()->getString("SetCPURatio"); +char* _PREHASH_NameValueData = LLMessageStringTable::getInstance()->getString("NameValueData"); +char* _PREHASH_AtomicPassObject = LLMessageStringTable::getInstance()->getString("AtomicPassObject"); +char* _PREHASH_ErrorMessage = LLMessageStringTable::getInstance()->getString("ErrorMessage"); +char* _PREHASH_ViewerFrozenMessage = LLMessageStringTable::getInstance()->getString("ViewerFrozenMessage"); +char* _PREHASH_HealthMessage = LLMessageStringTable::getInstance()->getString("HealthMessage"); +char* _PREHASH_LogTextMessage = LLMessageStringTable::getInstance()->getString("LogTextMessage"); +char* _PREHASH_TimeDilation = LLMessageStringTable::getInstance()->getString("TimeDilation"); +char* _PREHASH_RemoveContribution = LLMessageStringTable::getInstance()->getString("RemoveContribution"); +char* _PREHASH_Contribution = LLMessageStringTable::getInstance()->getString("Contribution"); +char* _PREHASH_SetGroupContribution = LLMessageStringTable::getInstance()->getString("SetGroupContribution"); +char* _PREHASH_Offline = LLMessageStringTable::getInstance()->getString("Offline"); +char* _PREHASH_AgentIsNowWearing = LLMessageStringTable::getInstance()->getString("AgentIsNowWearing"); +char* _PREHASH_Members = LLMessageStringTable::getInstance()->getString("Members"); +char* _PREHASH_FailedResends = LLMessageStringTable::getInstance()->getString("FailedResends"); +char* _PREHASH_SecPerDay = LLMessageStringTable::getInstance()->getString("SecPerDay"); +char* _PREHASH_CameraCenter = LLMessageStringTable::getInstance()->getString("CameraCenter"); +char* _PREHASH_CameraLeftAxis = LLMessageStringTable::getInstance()->getString("CameraLeftAxis"); +char* _PREHASH_ExBlock = LLMessageStringTable::getInstance()->getString("ExBlock"); +char* _PREHASH_Channel = LLMessageStringTable::getInstance()->getString("Channel"); +char* _PREHASH_NetTest = LLMessageStringTable::getInstance()->getString("NetTest"); +char* _PREHASH_DiscardLevel = LLMessageStringTable::getInstance()->getString("DiscardLevel"); +char* _PREHASH_LayerID = LLMessageStringTable::getInstance()->getString("LayerID"); +char* _PREHASH_GrabOffset = LLMessageStringTable::getInstance()->getString("GrabOffset"); +char* _PREHASH_SimPort = LLMessageStringTable::getInstance()->getString("SimPort"); +char* _PREHASH_PricePerMeter = LLMessageStringTable::getInstance()->getString("PricePerMeter"); +char* _PREHASH_RegionFlags = LLMessageStringTable::getInstance()->getString("RegionFlags"); +char* _PREHASH_VoteResult = LLMessageStringTable::getInstance()->getString("VoteResult"); +char* _PREHASH_ParcelDirFeeEstimate = LLMessageStringTable::getInstance()->getString("ParcelDirFeeEstimate"); +char* _PREHASH_ModifyBlock = LLMessageStringTable::getInstance()->getString("ModifyBlock"); +char* _PREHASH_InventoryBlock = LLMessageStringTable::getInstance()->getString("InventoryBlock"); +char* _PREHASH_ReplyBlock = LLMessageStringTable::getInstance()->getString("ReplyBlock"); +char* _PREHASH_ValidUntil = LLMessageStringTable::getInstance()->getString("ValidUntil"); +char* _PREHASH_VelocityInterpolateOn = LLMessageStringTable::getInstance()->getString("VelocityInterpolateOn"); +char* _PREHASH_ClassifiedDelete = LLMessageStringTable::getInstance()->getString("ClassifiedDelete"); +char* _PREHASH_RegionDenyAnonymous = LLMessageStringTable::getInstance()->getString("RegionDenyAnonymous"); +char* _PREHASH_FLImageID = LLMessageStringTable::getInstance()->getString("FLImageID"); +char* _PREHASH_AllowPublish = LLMessageStringTable::getInstance()->getString("AllowPublish"); +char* _PREHASH_SitName = LLMessageStringTable::getInstance()->getString("SitName"); +char* _PREHASH_RegionsVisited = LLMessageStringTable::getInstance()->getString("RegionsVisited"); +char* _PREHASH_DirClassifiedReply = LLMessageStringTable::getInstance()->getString("DirClassifiedReply"); +char* _PREHASH_AvatarClassifiedReply = LLMessageStringTable::getInstance()->getString("AvatarClassifiedReply"); +char* _PREHASH_MediaURL = LLMessageStringTable::getInstance()->getString("MediaURL"); +char* _PREHASH_CompleteAgentMovement = LLMessageStringTable::getInstance()->getString("CompleteAgentMovement"); +char* _PREHASH_ClassifiedID = LLMessageStringTable::getInstance()->getString("ClassifiedID"); +char* _PREHASH_LocalID = LLMessageStringTable::getInstance()->getString("LocalID"); +char* _PREHASH_SpaceIP = LLMessageStringTable::getInstance()->getString("SpaceIP"); +char* _PREHASH_RemoveItem = LLMessageStringTable::getInstance()->getString("RemoveItem"); +char* _PREHASH_LogFailedMoneyTransaction = LLMessageStringTable::getInstance()->getString("LogFailedMoneyTransaction"); +char* _PREHASH_ViewerStartAuction = LLMessageStringTable::getInstance()->getString("ViewerStartAuction"); +char* _PREHASH_StartAuction = LLMessageStringTable::getInstance()->getString("StartAuction"); +char* _PREHASH_DuplicateFlags = LLMessageStringTable::getInstance()->getString("DuplicateFlags"); +char* _PREHASH_RegionInfo2 = LLMessageStringTable::getInstance()->getString("RegionInfo2"); +char* _PREHASH_TextColor = LLMessageStringTable::getInstance()->getString("TextColor"); +char* _PREHASH_SlaveID = LLMessageStringTable::getInstance()->getString("SlaveID"); +char* _PREHASH_Charter = LLMessageStringTable::getInstance()->getString("Charter"); +char* _PREHASH_AlertData = LLMessageStringTable::getInstance()->getString("AlertData"); +char* _PREHASH_AlertInfo = LLMessageStringTable::getInstance()->getString("AlertInfo"); +char* _PREHASH_TargetBlock = LLMessageStringTable::getInstance()->getString("TargetBlock"); +char* _PREHASH_CheckParcelAuctions = LLMessageStringTable::getInstance()->getString("CheckParcelAuctions"); +char* _PREHASH_ParcelAuctions = LLMessageStringTable::getInstance()->getString("ParcelAuctions"); +char* _PREHASH_OwnerIsGroup = LLMessageStringTable::getInstance()->getString("OwnerIsGroup"); +char* _PREHASH_NameValuePair = LLMessageStringTable::getInstance()->getString("NameValuePair"); +char* _PREHASH_RemoveNameValuePair = LLMessageStringTable::getInstance()->getString("RemoveNameValuePair"); +char* _PREHASH_BulkUpdateInventory = LLMessageStringTable::getInstance()->getString("BulkUpdateInventory"); +char* _PREHASH_UpdateTaskInventory = LLMessageStringTable::getInstance()->getString("UpdateTaskInventory"); +char* _PREHASH_RemoveTaskInventory = LLMessageStringTable::getInstance()->getString("RemoveTaskInventory"); +char* _PREHASH_MoveTaskInventory = LLMessageStringTable::getInstance()->getString("MoveTaskInventory"); +char* _PREHASH_RequestTaskInventory = LLMessageStringTable::getInstance()->getString("RequestTaskInventory"); +char* _PREHASH_ReplyTaskInventory = LLMessageStringTable::getInstance()->getString("ReplyTaskInventory"); +char* _PREHASH_AggregatePermInventory = LLMessageStringTable::getInstance()->getString("AggregatePermInventory"); +char* _PREHASH_GroupAccountTransactionsReply = LLMessageStringTable::getInstance()->getString("GroupAccountTransactionsReply"); +char* _PREHASH_SimulatorInfo = LLMessageStringTable::getInstance()->getString("SimulatorInfo"); +char* _PREHASH_WearableData = LLMessageStringTable::getInstance()->getString("WearableData"); +char* _PREHASH_Enabled = LLMessageStringTable::getInstance()->getString("Enabled"); +char* _PREHASH_Savings = LLMessageStringTable::getInstance()->getString("Savings"); +char* _PREHASH_SimulatorLoad = LLMessageStringTable::getInstance()->getString("SimulatorLoad"); +char* _PREHASH_InternalRegionIP = LLMessageStringTable::getInstance()->getString("InternalRegionIP"); +char* _PREHASH_ExternalRegionIP = LLMessageStringTable::getInstance()->getString("ExternalRegionIP"); +char* _PREHASH_TotalPairs = LLMessageStringTable::getInstance()->getString("TotalPairs"); +char* _PREHASH_CreateGroupRequest = LLMessageStringTable::getInstance()->getString("CreateGroupRequest"); +char* _PREHASH_JoinGroupRequest = LLMessageStringTable::getInstance()->getString("JoinGroupRequest"); +char* _PREHASH_LeaveGroupRequest = LLMessageStringTable::getInstance()->getString("LeaveGroupRequest"); +char* _PREHASH_InviteGroupRequest = LLMessageStringTable::getInstance()->getString("InviteGroupRequest"); +char* _PREHASH_LiveHelpGroupRequest = LLMessageStringTable::getInstance()->getString("LiveHelpGroupRequest"); +char* _PREHASH_PriceParcelClaimFactor = LLMessageStringTable::getInstance()->getString("PriceParcelClaimFactor"); +char* _PREHASH_BillableArea = LLMessageStringTable::getInstance()->getString("BillableArea"); +char* _PREHASH_ObjectID = LLMessageStringTable::getInstance()->getString("ObjectID"); +char* _PREHASH_ObjectFlagUpdate = LLMessageStringTable::getInstance()->getString("ObjectFlagUpdate"); +char* _PREHASH_GroupRoleUpdate = LLMessageStringTable::getInstance()->getString("GroupRoleUpdate"); +char* _PREHASH_RequestInventoryAsset = LLMessageStringTable::getInstance()->getString("RequestInventoryAsset"); +char* _PREHASH_ChangedGrid = LLMessageStringTable::getInstance()->getString("ChangedGrid"); +char* _PREHASH_AgentDropGroup = LLMessageStringTable::getInstance()->getString("AgentDropGroup"); +char* _PREHASH_Details = LLMessageStringTable::getInstance()->getString("Details"); +char* _PREHASH_LocationX = LLMessageStringTable::getInstance()->getString("LocationX"); +char* _PREHASH_SaleType = LLMessageStringTable::getInstance()->getString("SaleType"); +char* _PREHASH_LocationY = LLMessageStringTable::getInstance()->getString("LocationY"); +char* _PREHASH_LocationZ = LLMessageStringTable::getInstance()->getString("LocationZ"); +char* _PREHASH_EconomyData = LLMessageStringTable::getInstance()->getString("EconomyData"); +char* _PREHASH_HeadRotation = LLMessageStringTable::getInstance()->getString("HeadRotation"); +char* _PREHASH_DeleteOnCompletion = LLMessageStringTable::getInstance()->getString("DeleteOnCompletion"); +char* _PREHASH_PublicPort = LLMessageStringTable::getInstance()->getString("PublicPort"); +char* _PREHASH_DirClassifiedQuery = LLMessageStringTable::getInstance()->getString("DirClassifiedQuery"); +char* _PREHASH_CallbackID = LLMessageStringTable::getInstance()->getString("CallbackID"); +char* _PREHASH_RequestParcelTransfer = LLMessageStringTable::getInstance()->getString("RequestParcelTransfer"); +char* _PREHASH_RoleCount = LLMessageStringTable::getInstance()->getString("RoleCount"); +char* _PREHASH_ObjectCapacity = LLMessageStringTable::getInstance()->getString("ObjectCapacity"); +char* _PREHASH_RequestID = LLMessageStringTable::getInstance()->getString("RequestID"); +char* _PREHASH_RequestXfer = LLMessageStringTable::getInstance()->getString("RequestXfer"); +char* _PREHASH_ObjectTaxCurrent = LLMessageStringTable::getInstance()->getString("ObjectTaxCurrent"); +char* _PREHASH_LightTaxCurrent = LLMessageStringTable::getInstance()->getString("LightTaxCurrent"); +char* _PREHASH_LandTaxCurrent = LLMessageStringTable::getInstance()->getString("LandTaxCurrent"); +char* _PREHASH_GroupTaxCurrent = LLMessageStringTable::getInstance()->getString("GroupTaxCurrent"); +char* _PREHASH_FetchInventoryDescendents = LLMessageStringTable::getInstance()->getString("FetchInventoryDescendents"); +char* _PREHASH_InventoryDescendents = LLMessageStringTable::getInstance()->getString("InventoryDescendents"); +char* _PREHASH_Descendents = LLMessageStringTable::getInstance()->getString("Descendents"); +char* _PREHASH_PurgeInventoryDescendents = LLMessageStringTable::getInstance()->getString("PurgeInventoryDescendents"); +char* _PREHASH_ShowDir = LLMessageStringTable::getInstance()->getString("ShowDir"); +char* _PREHASH_IsOwner = LLMessageStringTable::getInstance()->getString("IsOwner"); +char* _PREHASH_Timestamp = LLMessageStringTable::getInstance()->getString("Timestamp"); +char* _PREHASH_GlobalPos = LLMessageStringTable::getInstance()->getString("GlobalPos"); +char* _PREHASH_GrabOffsetInitial = LLMessageStringTable::getInstance()->getString("GrabOffsetInitial"); +char* _PREHASH_IsTrial = LLMessageStringTable::getInstance()->getString("IsTrial"); +char* _PREHASH_ObjectDuplicateOnRay = LLMessageStringTable::getInstance()->getString("ObjectDuplicateOnRay"); +char* _PREHASH_GroupMembershipCount = LLMessageStringTable::getInstance()->getString("GroupMembershipCount"); +char* _PREHASH_MethodData = LLMessageStringTable::getInstance()->getString("MethodData"); +char* _PREHASH_ActivateGestures = LLMessageStringTable::getInstance()->getString("ActivateGestures"); +char* _PREHASH_DeactivateGestures = LLMessageStringTable::getInstance()->getString("DeactivateGestures"); +char* _PREHASH_ProposalData = LLMessageStringTable::getInstance()->getString("ProposalData"); +char* _PREHASH_PosGlobal = LLMessageStringTable::getInstance()->getString("PosGlobal"); +char* _PREHASH_SearchID = LLMessageStringTable::getInstance()->getString("SearchID"); +char* _PREHASH_RezMultipleAttachmentsFromInv = LLMessageStringTable::getInstance()->getString("RezMultipleAttachmentsFromInv"); +char* _PREHASH_SearchName = LLMessageStringTable::getInstance()->getString("SearchName"); +char* _PREHASH_VersionString = LLMessageStringTable::getInstance()->getString("VersionString"); +char* _PREHASH_CreateGroupReply = LLMessageStringTable::getInstance()->getString("CreateGroupReply"); +char* _PREHASH_LeaveGroupReply = LLMessageStringTable::getInstance()->getString("LeaveGroupReply"); +char* _PREHASH_ActualArea = LLMessageStringTable::getInstance()->getString("ActualArea"); +char* _PREHASH_Message = LLMessageStringTable::getInstance()->getString("Message"); +char* _PREHASH_ClickAction = LLMessageStringTable::getInstance()->getString("ClickAction"); +char* _PREHASH_AssetUploadComplete = LLMessageStringTable::getInstance()->getString("AssetUploadComplete"); +char* _PREHASH_RequestType = LLMessageStringTable::getInstance()->getString("RequestType"); +char* _PREHASH_UUID = LLMessageStringTable::getInstance()->getString("UUID"); +char* _PREHASH_BaseMask = LLMessageStringTable::getInstance()->getString("BaseMask"); +char* _PREHASH_NetBlock = LLMessageStringTable::getInstance()->getString("NetBlock"); +char* _PREHASH_GlobalX = LLMessageStringTable::getInstance()->getString("GlobalX"); +char* _PREHASH_GlobalY = LLMessageStringTable::getInstance()->getString("GlobalY"); +char* _PREHASH_CopyRotates = LLMessageStringTable::getInstance()->getString("CopyRotates"); +char* _PREHASH_KickUserAck = LLMessageStringTable::getInstance()->getString("KickUserAck"); +char* _PREHASH_TopPick = LLMessageStringTable::getInstance()->getString("TopPick"); //legacy var need to be deleted -angela +char* _PREHASH_SessionID = LLMessageStringTable::getInstance()->getString("SessionID"); +char* _PREHASH_GlobalZ = LLMessageStringTable::getInstance()->getString("GlobalZ"); +char* _PREHASH_DeclineFriendship = LLMessageStringTable::getInstance()->getString("DeclineFriendship"); +char* _PREHASH_FormFriendship = LLMessageStringTable::getInstance()->getString("FormFriendship"); +char* _PREHASH_TerminateFriendship = LLMessageStringTable::getInstance()->getString("TerminateFriendship"); +char* _PREHASH_TaskData = LLMessageStringTable::getInstance()->getString("TaskData"); +char* _PREHASH_SimWideMaxPrims = LLMessageStringTable::getInstance()->getString("SimWideMaxPrims"); +char* _PREHASH_TotalPrims = LLMessageStringTable::getInstance()->getString("TotalPrims"); +char* _PREHASH_ProfileBegin = LLMessageStringTable::getInstance()->getString("ProfileBegin"); +char* _PREHASH_Request = LLMessageStringTable::getInstance()->getString("Request"); +char* _PREHASH_GroupAccountDetailsRequest = LLMessageStringTable::getInstance()->getString("GroupAccountDetailsRequest"); +char* _PREHASH_GroupActiveProposalsRequest = LLMessageStringTable::getInstance()->getString("GroupActiveProposalsRequest"); +char* _PREHASH_StringValue = LLMessageStringTable::getInstance()->getString("StringValue"); +char* _PREHASH_Version = LLMessageStringTable::getInstance()->getString("Version"); +char* _PREHASH_OtherCount = LLMessageStringTable::getInstance()->getString("OtherCount"); +char* _PREHASH_MemberCount = LLMessageStringTable::getInstance()->getString("MemberCount"); +char* _PREHASH_ChatData = LLMessageStringTable::getInstance()->getString("ChatData"); +char* _PREHASH_IsGroupOwned = LLMessageStringTable::getInstance()->getString("IsGroupOwned"); +char* _PREHASH_EnergyEfficiency = LLMessageStringTable::getInstance()->getString("EnergyEfficiency"); +char* _PREHASH_PickInfoUpdate = LLMessageStringTable::getInstance()->getString("PickInfoUpdate"); +char* _PREHASH_PickDelete = LLMessageStringTable::getInstance()->getString("PickDelete"); +char* _PREHASH_ScriptReset = LLMessageStringTable::getInstance()->getString("ScriptReset"); +char* _PREHASH_Requester = LLMessageStringTable::getInstance()->getString("Requester"); +char* _PREHASH_ForSale = LLMessageStringTable::getInstance()->getString("ForSale"); +char* _PREHASH_NearestLandingRegionReply = LLMessageStringTable::getInstance()->getString("NearestLandingRegionReply"); +char* _PREHASH_ParcelID = LLMessageStringTable::getInstance()->getString("ParcelID"); +char* _PREHASH_Godlike = LLMessageStringTable::getInstance()->getString("Godlike"); +char* _PREHASH_TotalDebits = LLMessageStringTable::getInstance()->getString("TotalDebits"); +char* _PREHASH_Direction = LLMessageStringTable::getInstance()->getString("Direction"); +char* _PREHASH_HealthData = LLMessageStringTable::getInstance()->getString("HealthData"); +char* _PREHASH_LeftAxis = LLMessageStringTable::getInstance()->getString("LeftAxis"); +char* _PREHASH_LocationBlock = LLMessageStringTable::getInstance()->getString("LocationBlock"); +char* _PREHASH_ObjectImage = LLMessageStringTable::getInstance()->getString("ObjectImage"); +char* _PREHASH_TerrainStartHeight00 = LLMessageStringTable::getInstance()->getString("TerrainStartHeight00"); +char* _PREHASH_TerrainStartHeight01 = LLMessageStringTable::getInstance()->getString("TerrainStartHeight01"); +char* _PREHASH_TerrainStartHeight10 = LLMessageStringTable::getInstance()->getString("TerrainStartHeight10"); +char* _PREHASH_TerrainStartHeight11 = LLMessageStringTable::getInstance()->getString("TerrainStartHeight11"); +char* _PREHASH_WaterHeight = LLMessageStringTable::getInstance()->getString("WaterHeight"); +char* _PREHASH_FetchInventoryReply = LLMessageStringTable::getInstance()->getString("FetchInventoryReply"); +char* _PREHASH_GroupAccountSummaryReply = LLMessageStringTable::getInstance()->getString("GroupAccountSummaryReply"); +char* _PREHASH_AttachedSound = LLMessageStringTable::getInstance()->getString("AttachedSound"); +char* _PREHASH_ParamInUse = LLMessageStringTable::getInstance()->getString("ParamInUse"); +char* _PREHASH_GodKickUser = LLMessageStringTable::getInstance()->getString("GodKickUser"); +char* _PREHASH_PickName = LLMessageStringTable::getInstance()->getString("PickName"); +char* _PREHASH_TaskName = LLMessageStringTable::getInstance()->getString("TaskName"); +char* _PREHASH_ObjectCount = LLMessageStringTable::getInstance()->getString("ObjectCount"); +char* _PREHASH_RegionPresenceRequestByHandle = LLMessageStringTable::getInstance()->getString("RegionPresenceRequestByHandle"); +char* _PREHASH_RezSingleAttachmentFromInv = LLMessageStringTable::getInstance()->getString("RezSingleAttachmentFromInv"); +char* _PREHASH_ChildAgentUpdate = LLMessageStringTable::getInstance()->getString("ChildAgentUpdate"); +char* _PREHASH_IsOwnerGroup = LLMessageStringTable::getInstance()->getString("IsOwnerGroup"); +char* _PREHASH_AgentHeightWidth = LLMessageStringTable::getInstance()->getString("AgentHeightWidth"); +char* _PREHASH_VerticalAngle = LLMessageStringTable::getInstance()->getString("VerticalAngle"); +char* _PREHASH_WearableType = LLMessageStringTable::getInstance()->getString("WearableType"); +char* _PREHASH_AggregatePermNextOwner = LLMessageStringTable::getInstance()->getString("AggregatePermNextOwner"); +char* _PREHASH_ShowInList = LLMessageStringTable::getInstance()->getString("ShowInList"); +char* _PREHASH_UpdateParcel = LLMessageStringTable::getInstance()->getString("UpdateParcel"); +char* _PREHASH_SetAlwaysRun = LLMessageStringTable::getInstance()->getString("SetAlwaysRun"); +char* _PREHASH_NVPair = LLMessageStringTable::getInstance()->getString("NVPair"); +char* _PREHASH_SearchType = LLMessageStringTable::getInstance()->getString("SearchType"); +char* _PREHASH_ObjectSpinStart = LLMessageStringTable::getInstance()->getString("ObjectSpinStart"); +char* _PREHASH_UseEstateSun = LLMessageStringTable::getInstance()->getString("UseEstateSun"); +char* _PREHASH_RegionID = LLMessageStringTable::getInstance()->getString("RegionID"); +char* _PREHASH_AbuseRegionID = LLMessageStringTable::getInstance()->getString("AbuseRegionID"); +char* _PREHASH_Creator = LLMessageStringTable::getInstance()->getString("Creator"); +char* _PREHASH_ProposalText = LLMessageStringTable::getInstance()->getString("ProposalText"); +char* _PREHASH_DirEventsReply = LLMessageStringTable::getInstance()->getString("DirEventsReply"); +char* _PREHASH_EventInfoReply = LLMessageStringTable::getInstance()->getString("EventInfoReply"); +char* _PREHASH_UserInfoReply = LLMessageStringTable::getInstance()->getString("UserInfoReply"); +char* _PREHASH_PathRadiusOffset = LLMessageStringTable::getInstance()->getString("PathRadiusOffset"); +char* _PREHASH_TextureData = LLMessageStringTable::getInstance()->getString("TextureData"); +char* _PREHASH_ChatPass = LLMessageStringTable::getInstance()->getString("ChatPass"); +char* _PREHASH_TargetID = LLMessageStringTable::getInstance()->getString("TargetID"); +char* _PREHASH_DefaultPayPrice = LLMessageStringTable::getInstance()->getString("DefaultPayPrice"); +char* _PREHASH_UserLocation = LLMessageStringTable::getInstance()->getString("UserLocation"); +char* _PREHASH_MaxPrims = LLMessageStringTable::getInstance()->getString("MaxPrims"); +char* _PREHASH_LandmarkID = LLMessageStringTable::getInstance()->getString("LandmarkID"); +char* _PREHASH_InitiateDownload = LLMessageStringTable::getInstance()->getString("InitiateDownload"); +char* _PREHASH_Name = LLMessageStringTable::getInstance()->getString("Name"); +char* _PREHASH_OtherCleanTime = LLMessageStringTable::getInstance()->getString("OtherCleanTime"); +char* _PREHASH_ParcelSetOtherCleanTime = LLMessageStringTable::getInstance()->getString("ParcelSetOtherCleanTime"); +char* _PREHASH_TeleportPriceExponent = LLMessageStringTable::getInstance()->getString("TeleportPriceExponent"); +char* _PREHASH_Gain = LLMessageStringTable::getInstance()->getString("Gain"); +char* _PREHASH_PacketAck = LLMessageStringTable::getInstance()->getString("PacketAck"); +char* _PREHASH_PathSkew = LLMessageStringTable::getInstance()->getString("PathSkew"); +char* _PREHASH_SimulatorShutdownRequest = LLMessageStringTable::getInstance()->getString("SimulatorShutdownRequest"); +char* _PREHASH_NearestLandingRegionRequest = LLMessageStringTable::getInstance()->getString("NearestLandingRegionRequest"); +char* _PREHASH_OtherID = LLMessageStringTable::getInstance()->getString("OtherID"); +char* _PREHASH_MemberID = LLMessageStringTable::getInstance()->getString("MemberID"); +char* _PREHASH_MapLayerRequest = LLMessageStringTable::getInstance()->getString("MapLayerRequest"); +char* _PREHASH_ObjectScale = LLMessageStringTable::getInstance()->getString("ObjectScale"); +char* _PREHASH_TargetIP = LLMessageStringTable::getInstance()->getString("TargetIP"); +char* _PREHASH_Redo = LLMessageStringTable::getInstance()->getString("Redo"); +char* _PREHASH_MoneyBalance = LLMessageStringTable::getInstance()->getString("MoneyBalance"); +char* _PREHASH_TrackAgent = LLMessageStringTable::getInstance()->getString("TrackAgent"); +char* _PREHASH_MaxX = LLMessageStringTable::getInstance()->getString("MaxX"); +char* _PREHASH_Data = LLMessageStringTable::getInstance()->getString("Data"); +char* _PREHASH_MaxY = LLMessageStringTable::getInstance()->getString("MaxY"); +char* _PREHASH_TextureAnim = LLMessageStringTable::getInstance()->getString("TextureAnim"); +char* _PREHASH_ReturnIDs = LLMessageStringTable::getInstance()->getString("ReturnIDs"); +char* _PREHASH_Date = LLMessageStringTable::getInstance()->getString("Date"); +char* _PREHASH_AgentWearablesUpdate = LLMessageStringTable::getInstance()->getString("AgentWearablesUpdate"); +char* _PREHASH_AgentDataUpdate = LLMessageStringTable::getInstance()->getString("AgentDataUpdate"); +char* _PREHASH_GroupDataUpdate = LLMessageStringTable::getInstance()->getString("GroupDataUpdate"); +char* _PREHASH_Hash = LLMessageStringTable::getInstance()->getString("Hash"); +char* _PREHASH_AgentGroupDataUpdate = LLMessageStringTable::getInstance()->getString("AgentGroupDataUpdate"); +char* _PREHASH_Left = LLMessageStringTable::getInstance()->getString("Left"); +char* _PREHASH_Mask = LLMessageStringTable::getInstance()->getString("Mask"); +char* _PREHASH_ForceMouselook = LLMessageStringTable::getInstance()->getString("ForceMouselook"); +char* _PREHASH_Success = LLMessageStringTable::getInstance()->getString("Success"); +char* _PREHASH_ObjectGroup = LLMessageStringTable::getInstance()->getString("ObjectGroup"); +char* _PREHASH_SunHour = LLMessageStringTable::getInstance()->getString("SunHour"); +char* _PREHASH_MinX = LLMessageStringTable::getInstance()->getString("MinX"); +char* _PREHASH_ScriptSensorReply = LLMessageStringTable::getInstance()->getString("ScriptSensorReply"); +char* _PREHASH_MinY = LLMessageStringTable::getInstance()->getString("MinY"); +char* _PREHASH_Command = LLMessageStringTable::getInstance()->getString("Command"); +char* _PREHASH_Desc = LLMessageStringTable::getInstance()->getString("Desc"); +char* _PREHASH_AttachmentNeedsSave = LLMessageStringTable::getInstance()->getString("AttachmentNeedsSave"); +char* _PREHASH_HistoryItemData = LLMessageStringTable::getInstance()->getString("HistoryItemData"); +char* _PREHASH_AgentCachedTexture = LLMessageStringTable::getInstance()->getString("AgentCachedTexture"); +char* _PREHASH_Subject = LLMessageStringTable::getInstance()->getString("Subject"); +char* _PREHASH_East = LLMessageStringTable::getInstance()->getString("East"); +char* _PREHASH_QueryReplies = LLMessageStringTable::getInstance()->getString("QueryReplies"); +char* _PREHASH_ObjectCategory = LLMessageStringTable::getInstance()->getString("ObjectCategory"); +char* _PREHASH_Time = LLMessageStringTable::getInstance()->getString("Time"); +char* _PREHASH_CreateLandmarkForEvent = LLMessageStringTable::getInstance()->getString("CreateLandmarkForEvent"); +char* _PREHASH_ParentID = LLMessageStringTable::getInstance()->getString("ParentID"); +char* _PREHASH_Ping = LLMessageStringTable::getInstance()->getString("Ping"); +char* _PREHASH_Perp = LLMessageStringTable::getInstance()->getString("Perp"); +char* _PREHASH_Code = LLMessageStringTable::getInstance()->getString("Code"); +char* _PREHASH_InvType = LLMessageStringTable::getInstance()->getString("InvType"); +char* _PREHASH_AgentFOV = LLMessageStringTable::getInstance()->getString("AgentFOV"); +char* _PREHASH_Audible = LLMessageStringTable::getInstance()->getString("Audible"); +char* _PREHASH_AuctionData = LLMessageStringTable::getInstance()->getString("AuctionData"); +char* _PREHASH_IDBlock = LLMessageStringTable::getInstance()->getString("IDBlock"); +char* _PREHASH_West = LLMessageStringTable::getInstance()->getString("West"); +char* _PREHASH_Undo = LLMessageStringTable::getInstance()->getString("Undo"); +char* _PREHASH_TotalNumItems = LLMessageStringTable::getInstance()->getString("TotalNumItems"); +char* _PREHASH_Info = LLMessageStringTable::getInstance()->getString("Info"); +char* _PREHASH_Area = LLMessageStringTable::getInstance()->getString("Area"); +char* _PREHASH_SimCrashed = LLMessageStringTable::getInstance()->getString("SimCrashed"); +char* _PREHASH_Text = LLMessageStringTable::getInstance()->getString("Text"); +char* _PREHASH_PriceGroupCreate = LLMessageStringTable::getInstance()->getString("PriceGroupCreate"); +char* _PREHASH_ObjectShape = LLMessageStringTable::getInstance()->getString("ObjectShape"); +char* _PREHASH_GroupRoleDataReply = LLMessageStringTable::getInstance()->getString("GroupRoleDataReply"); +char* _PREHASH_MuteCRC = LLMessageStringTable::getInstance()->getString("MuteCRC"); +char* _PREHASH_Size = LLMessageStringTable::getInstance()->getString("Size"); +char* _PREHASH_FromAddress = LLMessageStringTable::getInstance()->getString("FromAddress"); +char* _PREHASH_Body = LLMessageStringTable::getInstance()->getString("Body"); +char* _PREHASH_FileData = LLMessageStringTable::getInstance()->getString("FileData"); +char* _PREHASH_List = LLMessageStringTable::getInstance()->getString("List"); +char* _PREHASH_KickUser = LLMessageStringTable::getInstance()->getString("KickUser"); +char* _PREHASH_OtherPrims = LLMessageStringTable::getInstance()->getString("OtherPrims"); +char* _PREHASH_RunTime = LLMessageStringTable::getInstance()->getString("RunTime"); +char* _PREHASH_GrantUserRights = LLMessageStringTable::getInstance()->getString("GrantUserRights"); +char* _PREHASH_RpcScriptRequestInboundForward = LLMessageStringTable::getInstance()->getString("RpcScriptRequestInboundForward"); +char* _PREHASH_More = LLMessageStringTable::getInstance()->getString("More"); +char* _PREHASH_Majority = LLMessageStringTable::getInstance()->getString("Majority"); +char* _PREHASH_MetersTraveled = LLMessageStringTable::getInstance()->getString("MetersTraveled"); +char* _PREHASH_Stat = LLMessageStringTable::getInstance()->getString("Stat"); +char* _PREHASH_SoundID = LLMessageStringTable::getInstance()->getString("SoundID"); +char* _PREHASH_Item = LLMessageStringTable::getInstance()->getString("Item"); +char* _PREHASH_User = LLMessageStringTable::getInstance()->getString("User"); +char* _PREHASH_Prey = LLMessageStringTable::getInstance()->getString("Prey"); +char* _PREHASH_RayStart = LLMessageStringTable::getInstance()->getString("RayStart"); +char* _PREHASH_UsecSinceStart = LLMessageStringTable::getInstance()->getString("UsecSinceStart"); +char* _PREHASH_ParcelData = LLMessageStringTable::getInstance()->getString("ParcelData"); +char* _PREHASH_CameraUpAxis = LLMessageStringTable::getInstance()->getString("CameraUpAxis"); +char* _PREHASH_ScriptDialog = LLMessageStringTable::getInstance()->getString("ScriptDialog"); +char* _PREHASH_MasterParcelData = LLMessageStringTable::getInstance()->getString("MasterParcelData"); +char* _PREHASH_Invalid = LLMessageStringTable::getInstance()->getString("Invalid"); +char* _PREHASH_ProfileCurve = LLMessageStringTable::getInstance()->getString("ProfileCurve"); +char* _PREHASH_ParcelAccessListUpdate = LLMessageStringTable::getInstance()->getString("ParcelAccessListUpdate"); +char* _PREHASH_MuteListUpdate = LLMessageStringTable::getInstance()->getString("MuteListUpdate"); +char* _PREHASH_SendPacket = LLMessageStringTable::getInstance()->getString("SendPacket"); +char* _PREHASH_SendXferPacket = LLMessageStringTable::getInstance()->getString("SendXferPacket"); +char* _PREHASH_RegionDenyIdentified = LLMessageStringTable::getInstance()->getString("RegionDenyIdentified"); +char* _PREHASH_NotecardItemID = LLMessageStringTable::getInstance()->getString("NotecardItemID"); +char* _PREHASH_LastName = LLMessageStringTable::getInstance()->getString("LastName"); +char* _PREHASH_From = LLMessageStringTable::getInstance()->getString("From"); +char* _PREHASH_RoleChange = LLMessageStringTable::getInstance()->getString("RoleChange"); +char* _PREHASH_Port = LLMessageStringTable::getInstance()->getString("Port"); +char* _PREHASH_MemberTitle = LLMessageStringTable::getInstance()->getString("MemberTitle"); +char* _PREHASH_LogParcelChanges = LLMessageStringTable::getInstance()->getString("LogParcelChanges"); +char* _PREHASH_AgentCachedTextureResponse = LLMessageStringTable::getInstance()->getString("AgentCachedTextureResponse"); +char* _PREHASH_DeRezObject = LLMessageStringTable::getInstance()->getString("DeRezObject"); +char* _PREHASH_IsTemporary = LLMessageStringTable::getInstance()->getString("IsTemporary"); +char* _PREHASH_InsigniaID = LLMessageStringTable::getInstance()->getString("InsigniaID"); +char* _PREHASH_CheckFlags = LLMessageStringTable::getInstance()->getString("CheckFlags"); +char* _PREHASH_EventID = LLMessageStringTable::getInstance()->getString("EventID"); +char* _PREHASH_Selected = LLMessageStringTable::getInstance()->getString("Selected"); +char* _PREHASH_FromAgentId = LLMessageStringTable::getInstance()->getString("FromAgentId"); +char* _PREHASH_Type = LLMessageStringTable::getInstance()->getString("Type"); +char* _PREHASH_ChatType = LLMessageStringTable::getInstance()->getString("ChatType"); +char* _PREHASH_ReportData = LLMessageStringTable::getInstance()->getString("ReportData"); +char* _PREHASH_RequestBlock = LLMessageStringTable::getInstance()->getString("RequestBlock"); +char* _PREHASH_GrantData = LLMessageStringTable::getInstance()->getString("GrantData"); +char* _PREHASH_DetachAttachmentIntoInv = LLMessageStringTable::getInstance()->getString("DetachAttachmentIntoInv"); +char* _PREHASH_ParcelDisableObjects = LLMessageStringTable::getInstance()->getString("ParcelDisableObjects"); +char* _PREHASH_Sections = LLMessageStringTable::getInstance()->getString("Sections"); +char* _PREHASH_GodLevel = LLMessageStringTable::getInstance()->getString("GodLevel"); +char* _PREHASH_PayPriceReply = LLMessageStringTable::getInstance()->getString("PayPriceReply"); +char* _PREHASH_QueryID = LLMessageStringTable::getInstance()->getString("QueryID"); +char* _PREHASH_CameraEyeOffset = LLMessageStringTable::getInstance()->getString("CameraEyeOffset"); +char* _PREHASH_AgentPosition = LLMessageStringTable::getInstance()->getString("AgentPosition"); +char* _PREHASH_GrabPosition = LLMessageStringTable::getInstance()->getString("GrabPosition"); +char* _PREHASH_OnlineNotification = LLMessageStringTable::getInstance()->getString("OnlineNotification"); +char* _PREHASH_OfflineNotification = LLMessageStringTable::getInstance()->getString("OfflineNotification"); +char* _PREHASH_SendPostcard = LLMessageStringTable::getInstance()->getString("SendPostcard"); +char* _PREHASH_RequestFlags = LLMessageStringTable::getInstance()->getString("RequestFlags"); +char* _PREHASH_GroupAccountSummaryRequest = LLMessageStringTable::getInstance()->getString("GroupAccountSummaryRequest"); +char* _PREHASH_GroupVoteHistoryRequest = LLMessageStringTable::getInstance()->getString("GroupVoteHistoryRequest"); +char* _PREHASH_ParamValue = LLMessageStringTable::getInstance()->getString("ParamValue"); +char* _PREHASH_MaxAgents = LLMessageStringTable::getInstance()->getString("MaxAgents"); +char* _PREHASH_CreateNewOutfitAttachments = LLMessageStringTable::getInstance()->getString("CreateNewOutfitAttachments"); +char* _PREHASH_RegionHandle = LLMessageStringTable::getInstance()->getString("RegionHandle"); +char* _PREHASH_TeleportProgress = LLMessageStringTable::getInstance()->getString("TeleportProgress"); +char* _PREHASH_AgentQuitCopy = LLMessageStringTable::getInstance()->getString("AgentQuitCopy"); +char* _PREHASH_AvatarInterestsUpdate = LLMessageStringTable::getInstance()->getString("AvatarInterestsUpdate"); +char* _PREHASH_GroupNoticeID = LLMessageStringTable::getInstance()->getString("GroupNoticeID"); +char* _PREHASH_ParcelName = LLMessageStringTable::getInstance()->getString("ParcelName"); +char* _PREHASH_PriceObjectRent = LLMessageStringTable::getInstance()->getString("PriceObjectRent"); +char* _PREHASH_OfferCallingCard = LLMessageStringTable::getInstance()->getString("OfferCallingCard"); +char* _PREHASH_AcceptCallingCard = LLMessageStringTable::getInstance()->getString("AcceptCallingCard"); +char* _PREHASH_DeclineCallingCard = LLMessageStringTable::getInstance()->getString("DeclineCallingCard"); +char* _PREHASH_AgentAccess = LLMessageStringTable::getInstance()->getString("AgentAccess"); +char* _PREHASH_AgentLegacyAccess = LLMessageStringTable::getInstance()->getString("AgentLegacyAccess"); +char* _PREHASH_AgentMaxAccess = LLMessageStringTable::getInstance()->getString("AgentMaxAccess"); +char* _PREHASH_DataHomeLocationReply = LLMessageStringTable::getInstance()->getString("DataHomeLocationReply"); +char* _PREHASH_EventLocationReply = LLMessageStringTable::getInstance()->getString("EventLocationReply"); +char* _PREHASH_TerseDateID = LLMessageStringTable::getInstance()->getString("TerseDateID"); +char* _PREHASH_ObjectOwner = LLMessageStringTable::getInstance()->getString("ObjectOwner"); +char* _PREHASH_AssetID = LLMessageStringTable::getInstance()->getString("AssetID"); +char* _PREHASH_AlertMessage = LLMessageStringTable::getInstance()->getString("AlertMessage"); +char* _PREHASH_AgentAlertMessage = LLMessageStringTable::getInstance()->getString("AgentAlertMessage"); +char* _PREHASH_EstateOwnerMessage = LLMessageStringTable::getInstance()->getString("EstateOwnerMessage"); +char* _PREHASH_ParcelMediaCommandMessage = LLMessageStringTable::getInstance()->getString("ParcelMediaCommandMessage"); +char* _PREHASH_Auction = LLMessageStringTable::getInstance()->getString("Auction"); +char* _PREHASH_Category = LLMessageStringTable::getInstance()->getString("Category"); +char* _PREHASH_FilePath = LLMessageStringTable::getInstance()->getString("FilePath"); +char* _PREHASH_ItemFlags = LLMessageStringTable::getInstance()->getString("ItemFlags"); +char* _PREHASH_Invoice = LLMessageStringTable::getInstance()->getString("Invoice"); +char* _PREHASH_IntervalDays = LLMessageStringTable::getInstance()->getString("IntervalDays"); +char* _PREHASH_PathScaleX = LLMessageStringTable::getInstance()->getString("PathScaleX"); +char* _PREHASH_FromTaskID = LLMessageStringTable::getInstance()->getString("FromTaskID"); +char* _PREHASH_PathScaleY = LLMessageStringTable::getInstance()->getString("PathScaleY"); +char* _PREHASH_TimeInfo = LLMessageStringTable::getInstance()->getString("TimeInfo"); +char* _PREHASH_PublicCount = LLMessageStringTable::getInstance()->getString("PublicCount"); +char* _PREHASH_ParcelJoin = LLMessageStringTable::getInstance()->getString("ParcelJoin"); +char* _PREHASH_GroupRolesCount = LLMessageStringTable::getInstance()->getString("GroupRolesCount"); +char* _PREHASH_SimulatorBlock = LLMessageStringTable::getInstance()->getString("SimulatorBlock"); +char* _PREHASH_GroupID = LLMessageStringTable::getInstance()->getString("GroupID"); +char* _PREHASH_AgentVel = LLMessageStringTable::getInstance()->getString("AgentVel"); +char* _PREHASH_RequestImage = LLMessageStringTable::getInstance()->getString("RequestImage"); +char* _PREHASH_NetStats = LLMessageStringTable::getInstance()->getString("NetStats"); +char* _PREHASH_AgentPos = LLMessageStringTable::getInstance()->getString("AgentPos"); +char* _PREHASH_AgentSit = LLMessageStringTable::getInstance()->getString("AgentSit"); +char* _PREHASH_Material = LLMessageStringTable::getInstance()->getString("Material"); +char* _PREHASH_ObjectDeGrab = LLMessageStringTable::getInstance()->getString("ObjectDeGrab"); +char* _PREHASH_VelocityInterpolateOff = LLMessageStringTable::getInstance()->getString("VelocityInterpolateOff"); +char* _PREHASH_AuthorizedBuyerID = LLMessageStringTable::getInstance()->getString("AuthorizedBuyerID"); +char* _PREHASH_AvatarPropertiesReply = LLMessageStringTable::getInstance()->getString("AvatarPropertiesReply"); +char* _PREHASH_GroupProfileReply = LLMessageStringTable::getInstance()->getString("GroupProfileReply"); +char* _PREHASH_SimOwner = LLMessageStringTable::getInstance()->getString("SimOwner"); +char* _PREHASH_SalePrice = LLMessageStringTable::getInstance()->getString("SalePrice"); +char* _PREHASH_Animation = LLMessageStringTable::getInstance()->getString("Animation"); +char* _PREHASH_OwnerID = LLMessageStringTable::getInstance()->getString("OwnerID"); +char* _PREHASH_NearestLandingRegionUpdated = LLMessageStringTable::getInstance()->getString("NearestLandingRegionUpdated"); +char* _PREHASH_PassToAgent = LLMessageStringTable::getInstance()->getString("PassToAgent"); +char* _PREHASH_PreyAgent = LLMessageStringTable::getInstance()->getString("PreyAgent"); +char* _PREHASH_SimStats = LLMessageStringTable::getInstance()->getString("SimStats"); +char* _PREHASH_LogoutReply = LLMessageStringTable::getInstance()->getString("LogoutReply"); +char* _PREHASH_FeatureDisabled = LLMessageStringTable::getInstance()->getString("FeatureDisabled"); +char* _PREHASH_PhysicalAvatarEventList = LLMessageStringTable::getInstance()->getString("PhysicalAvatarEventList"); +char* _PREHASH_ObjectLocalID = LLMessageStringTable::getInstance()->getString("ObjectLocalID"); +char* _PREHASH_Dropped = LLMessageStringTable::getInstance()->getString("Dropped"); +char* _PREHASH_WebProfilesDisabled = LLMessageStringTable::getInstance()->getString("WebProfilesDisabled"); +char* _PREHASH_Destination = LLMessageStringTable::getInstance()->getString("Destination"); +char* _PREHASH_MasterID = LLMessageStringTable::getInstance()->getString("MasterID"); +char* _PREHASH_TransferData = LLMessageStringTable::getInstance()->getString("TransferData"); +char* _PREHASH_WantToMask = LLMessageStringTable::getInstance()->getString("WantToMask"); +char* _PREHASH_ParcelSelectObjects = LLMessageStringTable::getInstance()->getString("ParcelSelectObjects"); +char* _PREHASH_ExtraParams = LLMessageStringTable::getInstance()->getString("ExtraParams"); +char* _PREHASH_CreatorID = LLMessageStringTable::getInstance()->getString("CreatorID"); +char* _PREHASH_Summary = LLMessageStringTable::getInstance()->getString("Summary"); +char* _PREHASH_BuyObjectInventory = LLMessageStringTable::getInstance()->getString("BuyObjectInventory"); +char* _PREHASH_FetchInventory = LLMessageStringTable::getInstance()->getString("FetchInventory"); +char* _PREHASH_InventoryID = LLMessageStringTable::getInstance()->getString("InventoryID"); +char* _PREHASH_PacketNumber = LLMessageStringTable::getInstance()->getString("PacketNumber"); +char* _PREHASH_SetFollowCamProperties = LLMessageStringTable::getInstance()->getString("SetFollowCamProperties"); +char* _PREHASH_ClearFollowCamProperties = LLMessageStringTable::getInstance()->getString("ClearFollowCamProperties"); +char* _PREHASH_SequenceID = LLMessageStringTable::getInstance()->getString("SequenceID"); +char* _PREHASH_DataServerLogout = LLMessageStringTable::getInstance()->getString("DataServerLogout"); +char* _PREHASH_NameValue = LLMessageStringTable::getInstance()->getString("NameValue"); +char* _PREHASH_PathShearX = LLMessageStringTable::getInstance()->getString("PathShearX"); +char* _PREHASH_PathShearY = LLMessageStringTable::getInstance()->getString("PathShearY"); +char* _PREHASH_Velocity = LLMessageStringTable::getInstance()->getString("Velocity"); +char* _PREHASH_SecPerYear = LLMessageStringTable::getInstance()->getString("SecPerYear"); +char* _PREHASH_FirstName = LLMessageStringTable::getInstance()->getString("FirstName"); +char* _PREHASH_AttachedSoundGainChange = LLMessageStringTable::getInstance()->getString("AttachedSoundGainChange"); +char* _PREHASH_LocationID = LLMessageStringTable::getInstance()->getString("LocationID"); +char* _PREHASH_Running = LLMessageStringTable::getInstance()->getString("Running"); +char* _PREHASH_AgentThrottle = LLMessageStringTable::getInstance()->getString("AgentThrottle"); +char* _PREHASH_NeighborList = LLMessageStringTable::getInstance()->getString("NeighborList"); +char* _PREHASH_PathTaperX = LLMessageStringTable::getInstance()->getString("PathTaperX"); +char* _PREHASH_PathTaperY = LLMessageStringTable::getInstance()->getString("PathTaperY"); +char* _PREHASH_AgentRelated = LLMessageStringTable::getInstance()->getString("AgentRelated"); +char* _PREHASH_GranterBlock = LLMessageStringTable::getInstance()->getString("GranterBlock"); +char* _PREHASH_UseCachedMuteList = LLMessageStringTable::getInstance()->getString("UseCachedMuteList"); +char* _PREHASH_FailStats = LLMessageStringTable::getInstance()->getString("FailStats"); +char* _PREHASH_Tempfile = LLMessageStringTable::getInstance()->getString("Tempfile"); +char* _PREHASH_BuyerID = LLMessageStringTable::getInstance()->getString("BuyerID"); +char* _PREHASH_DirPeopleReply = LLMessageStringTable::getInstance()->getString("DirPeopleReply"); +char* _PREHASH_TransferInfo = LLMessageStringTable::getInstance()->getString("TransferInfo"); +char* _PREHASH_AvatarPickerRequestBackend = LLMessageStringTable::getInstance()->getString("AvatarPickerRequestBackend"); +char* _PREHASH_AvatarPropertiesRequestBackend = LLMessageStringTable::getInstance()->getString("AvatarPropertiesRequestBackend"); +char* _PREHASH_UpdateData = LLMessageStringTable::getInstance()->getString("UpdateData"); +char* _PREHASH_SimFPS = LLMessageStringTable::getInstance()->getString("SimFPS"); +char* _PREHASH_ReporterID = LLMessageStringTable::getInstance()->getString("ReporterID"); +char* _PREHASH_ButtonLabel = LLMessageStringTable::getInstance()->getString("ButtonLabel"); +char* _PREHASH_GranterID = LLMessageStringTable::getInstance()->getString("GranterID"); +char* _PREHASH_WantToText = LLMessageStringTable::getInstance()->getString("WantToText"); +char* _PREHASH_ReportType = LLMessageStringTable::getInstance()->getString("ReportType"); +char* _PREHASH_SimulatorReady = LLMessageStringTable::getInstance()->getString("SimulatorReady"); +char* _PREHASH_DataBlock = LLMessageStringTable::getInstance()->getString("DataBlock"); +char* _PREHASH_AnimationSourceList = LLMessageStringTable::getInstance()->getString("AnimationSourceList"); +char* _PREHASH_SubscribeLoad = LLMessageStringTable::getInstance()->getString("SubscribeLoad"); +char* _PREHASH_UnsubscribeLoad = LLMessageStringTable::getInstance()->getString("UnsubscribeLoad"); +char* _PREHASH_Packet = LLMessageStringTable::getInstance()->getString("Packet"); +char* _PREHASH_UndoLand = LLMessageStringTable::getInstance()->getString("UndoLand"); +char* _PREHASH_SimAccess = LLMessageStringTable::getInstance()->getString("SimAccess"); +char* _PREHASH_AbuserID = LLMessageStringTable::getInstance()->getString("AbuserID"); +char* _PREHASH_MembershipFee = LLMessageStringTable::getInstance()->getString("MembershipFee"); +char* _PREHASH_InviteGroupResponse = LLMessageStringTable::getInstance()->getString("InviteGroupResponse"); +char* _PREHASH_CreateInventoryFolder = LLMessageStringTable::getInstance()->getString("CreateInventoryFolder"); +char* _PREHASH_UpdateInventoryFolder = LLMessageStringTable::getInstance()->getString("UpdateInventoryFolder"); +char* _PREHASH_MoveInventoryFolder = LLMessageStringTable::getInstance()->getString("MoveInventoryFolder"); +char* _PREHASH_RemoveInventoryFolder = LLMessageStringTable::getInstance()->getString("RemoveInventoryFolder"); +char* _PREHASH_MoneyData = LLMessageStringTable::getInstance()->getString("MoneyData"); +char* _PREHASH_ObjectDeselect = LLMessageStringTable::getInstance()->getString("ObjectDeselect"); +char* _PREHASH_NewAssetID = LLMessageStringTable::getInstance()->getString("NewAssetID"); +char* _PREHASH_ObjectAdd = LLMessageStringTable::getInstance()->getString("ObjectAdd"); +char* _PREHASH_RayEndIsIntersection = LLMessageStringTable::getInstance()->getString("RayEndIsIntersection"); +char* _PREHASH_CompleteAuction = LLMessageStringTable::getInstance()->getString("CompleteAuction"); +char* _PREHASH_CircuitCode = LLMessageStringTable::getInstance()->getString("CircuitCode"); +char* _PREHASH_AgentMovementComplete = LLMessageStringTable::getInstance()->getString("AgentMovementComplete"); +char* _PREHASH_ViewerIP = LLMessageStringTable::getInstance()->getString("ViewerIP"); +char* _PREHASH_Header = LLMessageStringTable::getInstance()->getString("Header"); +char* _PREHASH_GestureFlags = LLMessageStringTable::getInstance()->getString("GestureFlags"); +char* _PREHASH_XferID = LLMessageStringTable::getInstance()->getString("XferID"); +char* _PREHASH_StatValue = LLMessageStringTable::getInstance()->getString("StatValue"); +char* _PREHASH_TaskID = LLMessageStringTable::getInstance()->getString("TaskID"); +char* _PREHASH_PickID = LLMessageStringTable::getInstance()->getString("PickID"); +char* _PREHASH_RayEnd = LLMessageStringTable::getInstance()->getString("RayEnd"); +char* _PREHASH_Throttles = LLMessageStringTable::getInstance()->getString("Throttles"); +char* _PREHASH_RebakeAvatarTextures = LLMessageStringTable::getInstance()->getString("RebakeAvatarTextures"); +char* _PREHASH_UpAxis = LLMessageStringTable::getInstance()->getString("UpAxis"); +char* _PREHASH_AgentTextures = LLMessageStringTable::getInstance()->getString("AgentTextures"); +char* _PREHASH_NotecardData = LLMessageStringTable::getInstance()->getString("NotecardData"); +char* _PREHASH_Radius = LLMessageStringTable::getInstance()->getString("Radius"); +char* _PREHASH_OffCircuit = LLMessageStringTable::getInstance()->getString("OffCircuit"); +char* _PREHASH_Access = LLMessageStringTable::getInstance()->getString("Access"); +char* _PREHASH_TitleRoleID = LLMessageStringTable::getInstance()->getString("TitleRoleID"); +char* _PREHASH_SquareMetersCredit = LLMessageStringTable::getInstance()->getString("SquareMetersCredit"); +char* _PREHASH_Filename = LLMessageStringTable::getInstance()->getString("Filename"); +char* _PREHASH_ClassifiedInfoRequest = LLMessageStringTable::getInstance()->getString("ClassifiedInfoRequest"); +char* _PREHASH_ParcelInfoRequest = LLMessageStringTable::getInstance()->getString("ParcelInfoRequest"); +char* _PREHASH_ParcelObjectOwnersRequest = LLMessageStringTable::getInstance()->getString("ParcelObjectOwnersRequest"); +char* _PREHASH_TeleportLandmarkRequest = LLMessageStringTable::getInstance()->getString("TeleportLandmarkRequest"); +char* _PREHASH_EventInfoRequest = LLMessageStringTable::getInstance()->getString("EventInfoRequest"); +char* _PREHASH_MoneyBalanceRequest = LLMessageStringTable::getInstance()->getString("MoneyBalanceRequest"); +char* _PREHASH_GroupMembersRequest = LLMessageStringTable::getInstance()->getString("GroupMembersRequest"); +char* _PREHASH_GroupRoleMembersRequest = LLMessageStringTable::getInstance()->getString("GroupRoleMembersRequest"); +char* _PREHASH_ChatFromSimulator = LLMessageStringTable::getInstance()->getString("ChatFromSimulator"); +char* _PREHASH_OldFolderID = LLMessageStringTable::getInstance()->getString("OldFolderID"); +char* _PREHASH_UserInfoRequest = LLMessageStringTable::getInstance()->getString("UserInfoRequest"); +char* _PREHASH_TextureID = LLMessageStringTable::getInstance()->getString("TextureID"); +char* _PREHASH_ProfileURL = LLMessageStringTable::getInstance()->getString("ProfileURL"); +char* _PREHASH_Handle = LLMessageStringTable::getInstance()->getString("Handle"); +char* _PREHASH_ButtonIndex = LLMessageStringTable::getInstance()->getString("ButtonIndex"); +char* _PREHASH_GetScriptRunning = LLMessageStringTable::getInstance()->getString("GetScriptRunning"); +char* _PREHASH_SetScriptRunning = LLMessageStringTable::getInstance()->getString("SetScriptRunning"); +char* _PREHASH_Health = LLMessageStringTable::getInstance()->getString("Health"); +char* _PREHASH_CircuitInfo = LLMessageStringTable::getInstance()->getString("CircuitInfo"); +char* _PREHASH_ObjectBuy = LLMessageStringTable::getInstance()->getString("ObjectBuy"); +char* _PREHASH_ProfileEnd = LLMessageStringTable::getInstance()->getString("ProfileEnd"); +char* _PREHASH_Effect = LLMessageStringTable::getInstance()->getString("Effect"); +char* _PREHASH_TestMessage = LLMessageStringTable::getInstance()->getString("TestMessage"); +char* _PREHASH_ScriptMailRegistration = LLMessageStringTable::getInstance()->getString("ScriptMailRegistration"); +char* _PREHASH_AgentSetAppearance = LLMessageStringTable::getInstance()->getString("AgentSetAppearance"); +char* _PREHASH_AvatarAppearance = LLMessageStringTable::getInstance()->getString("AvatarAppearance"); +char* _PREHASH_RegionData = LLMessageStringTable::getInstance()->getString("RegionData"); +char* _PREHASH_RequestingRegionData = LLMessageStringTable::getInstance()->getString("RequestingRegionData"); +char* _PREHASH_LandingRegionData = LLMessageStringTable::getInstance()->getString("LandingRegionData"); +char* _PREHASH_SitTransform = LLMessageStringTable::getInstance()->getString("SitTransform"); +char* _PREHASH_TerrainBase0 = LLMessageStringTable::getInstance()->getString("TerrainBase0"); +char* _PREHASH_SkillsMask = LLMessageStringTable::getInstance()->getString("SkillsMask"); +char* _PREHASH_AtAxis = LLMessageStringTable::getInstance()->getString("AtAxis"); +char* _PREHASH_TerrainBase1 = LLMessageStringTable::getInstance()->getString("TerrainBase1"); +char* _PREHASH_Reason = LLMessageStringTable::getInstance()->getString("Reason"); +char* _PREHASH_TerrainBase2 = LLMessageStringTable::getInstance()->getString("TerrainBase2"); +char* _PREHASH_TerrainBase3 = LLMessageStringTable::getInstance()->getString("TerrainBase3"); +char* _PREHASH_Params = LLMessageStringTable::getInstance()->getString("Params"); +char* _PREHASH_PingID = LLMessageStringTable::getInstance()->getString("PingID"); +char* _PREHASH_Change = LLMessageStringTable::getInstance()->getString("Change"); +char* _PREHASH_Height = LLMessageStringTable::getInstance()->getString("Height"); +char* _PREHASH_Region = LLMessageStringTable::getInstance()->getString("Region"); +char* _PREHASH_TelehubInfo = LLMessageStringTable::getInstance()->getString("TelehubInfo"); +char* _PREHASH_StateSave = LLMessageStringTable::getInstance()->getString("StateSave"); +char* _PREHASH_RoleData = LLMessageStringTable::getInstance()->getString("RoleData"); +char* _PREHASH_AgentAnimation = LLMessageStringTable::getInstance()->getString("AgentAnimation"); +char* _PREHASH_AvatarAnimation = LLMessageStringTable::getInstance()->getString("AvatarAnimation"); +char* _PREHASH_LogDwellTime = LLMessageStringTable::getInstance()->getString("LogDwellTime"); +char* _PREHASH_ParcelGodMarkAsContent = LLMessageStringTable::getInstance()->getString("ParcelGodMarkAsContent"); +char* _PREHASH_UsePhysics = LLMessageStringTable::getInstance()->getString("UsePhysics"); +char* _PREHASH_RegionDenyTransacted = LLMessageStringTable::getInstance()->getString("RegionDenyTransacted"); +char* _PREHASH_JointType = LLMessageStringTable::getInstance()->getString("JointType"); +char* _PREHASH_ObjectTaxEstimate = LLMessageStringTable::getInstance()->getString("ObjectTaxEstimate"); +char* _PREHASH_LightTaxEstimate = LLMessageStringTable::getInstance()->getString("LightTaxEstimate"); +char* _PREHASH_LandTaxEstimate = LLMessageStringTable::getInstance()->getString("LandTaxEstimate"); +char* _PREHASH_TeleportLandingStatusChanged = LLMessageStringTable::getInstance()->getString("TeleportLandingStatusChanged"); +char* _PREHASH_GroupTaxEstimate = LLMessageStringTable::getInstance()->getString("GroupTaxEstimate"); +char* _PREHASH_AvgViewerFPS = LLMessageStringTable::getInstance()->getString("AvgViewerFPS"); +char* _PREHASH_Buttons = LLMessageStringTable::getInstance()->getString("Buttons"); +char* _PREHASH_Sender = LLMessageStringTable::getInstance()->getString("Sender"); +char* _PREHASH_Dialog = LLMessageStringTable::getInstance()->getString("Dialog"); +char* _PREHASH_TargetData = LLMessageStringTable::getInstance()->getString("TargetData"); +char* _PREHASH_DestID = LLMessageStringTable::getInstance()->getString("DestID"); +char* _PREHASH_PricePublicObjectDelete = LLMessageStringTable::getInstance()->getString("PricePublicObjectDelete"); +char* _PREHASH_ObjectDelete = LLMessageStringTable::getInstance()->getString("ObjectDelete"); +char* _PREHASH_Delete = LLMessageStringTable::getInstance()->getString("Delete"); +char* _PREHASH_EventGodDelete = LLMessageStringTable::getInstance()->getString("EventGodDelete"); +char* _PREHASH_LastTaxDate = LLMessageStringTable::getInstance()->getString("LastTaxDate"); +char* _PREHASH_MapImageID = LLMessageStringTable::getInstance()->getString("MapImageID"); +char* _PREHASH_EndDateTime = LLMessageStringTable::getInstance()->getString("EndDateTime"); +char* _PREHASH_TerrainDetail0 = LLMessageStringTable::getInstance()->getString("TerrainDetail0"); +char* _PREHASH_TerrainDetail1 = LLMessageStringTable::getInstance()->getString("TerrainDetail1"); +char* _PREHASH_TerrainDetail2 = LLMessageStringTable::getInstance()->getString("TerrainDetail2"); +char* _PREHASH_TerrainDetail3 = LLMessageStringTable::getInstance()->getString("TerrainDetail3"); +char* _PREHASH_Offset = LLMessageStringTable::getInstance()->getString("Offset"); +char* _PREHASH_ObjectDelink = LLMessageStringTable::getInstance()->getString("ObjectDelink"); +char* _PREHASH_TargetObject = LLMessageStringTable::getInstance()->getString("TargetObject"); +char* _PREHASH_IsEstateManager = LLMessageStringTable::getInstance()->getString("IsEstateManager"); +char* _PREHASH_CancelAuction = LLMessageStringTable::getInstance()->getString("CancelAuction"); +char* _PREHASH_ObjectDetach = LLMessageStringTable::getInstance()->getString("ObjectDetach"); +char* _PREHASH_Compressed = LLMessageStringTable::getInstance()->getString("Compressed"); +char* _PREHASH_PathBegin = LLMessageStringTable::getInstance()->getString("PathBegin"); +char* _PREHASH_BypassRaycast = LLMessageStringTable::getInstance()->getString("BypassRaycast"); +char* _PREHASH_WinnerID = LLMessageStringTable::getInstance()->getString("WinnerID"); +char* _PREHASH_ChannelType = LLMessageStringTable::getInstance()->getString("ChannelType"); +char* _PREHASH_NonExemptMembers = LLMessageStringTable::getInstance()->getString("NonExemptMembers"); +char* _PREHASH_Agents = LLMessageStringTable::getInstance()->getString("Agents"); +char* _PREHASH_MemberData = LLMessageStringTable::getInstance()->getString("MemberData"); +char* _PREHASH_ToGroupID = LLMessageStringTable::getInstance()->getString("ToGroupID"); +char* _PREHASH_ImageNotInDatabase = LLMessageStringTable::getInstance()->getString("ImageNotInDatabase"); +char* _PREHASH_StartDate = LLMessageStringTable::getInstance()->getString("StartDate"); +char* _PREHASH_AnimID = LLMessageStringTable::getInstance()->getString("AnimID"); +char* _PREHASH_Serial = LLMessageStringTable::getInstance()->getString("Serial"); +char* _PREHASH_AbuseRegionName = LLMessageStringTable::getInstance()->getString("AbuseRegionName"); +char* _PREHASH_ModifyLand = LLMessageStringTable::getInstance()->getString("ModifyLand"); +char* _PREHASH_Digest = LLMessageStringTable::getInstance()->getString("Digest"); +char* _PREHASH_Victim = LLMessageStringTable::getInstance()->getString("Victim"); +char* _PREHASH_Script = LLMessageStringTable::getInstance()->getString("Script"); +char* _PREHASH_PickInfoReply = LLMessageStringTable::getInstance()->getString("PickInfoReply"); +char* _PREHASH_MoneyBalanceReply = LLMessageStringTable::getInstance()->getString("MoneyBalanceReply"); +char* _PREHASH_RoutedMoneyBalanceReply = LLMessageStringTable::getInstance()->getString("RoutedMoneyBalanceReply"); +char* _PREHASH_RoleID = LLMessageStringTable::getInstance()->getString("RoleID"); +char* _PREHASH_RegionInfo = LLMessageStringTable::getInstance()->getString("RegionInfo"); +char* _PREHASH_GodUpdateRegionInfo = LLMessageStringTable::getInstance()->getString("GodUpdateRegionInfo"); +char* _PREHASH_StartAnim = LLMessageStringTable::getInstance()->getString("StartAnim"); +char* _PREHASH_Action = LLMessageStringTable::getInstance()->getString("Action"); +char* _PREHASH_Location = LLMessageStringTable::getInstance()->getString("Location"); +char* _PREHASH_Rights = LLMessageStringTable::getInstance()->getString("Rights"); +char* _PREHASH_SearchDir = LLMessageStringTable::getInstance()->getString("SearchDir"); +char* _PREHASH_TransferRequest = LLMessageStringTable::getInstance()->getString("TransferRequest"); +char* _PREHASH_ScriptSensorRequest = LLMessageStringTable::getInstance()->getString("ScriptSensorRequest"); +char* _PREHASH_MoneyTransferRequest = LLMessageStringTable::getInstance()->getString("MoneyTransferRequest"); +char* _PREHASH_EjectGroupMemberRequest = LLMessageStringTable::getInstance()->getString("EjectGroupMemberRequest"); +char* _PREHASH_SkillsText = LLMessageStringTable::getInstance()->getString("SkillsText"); +char* _PREHASH_Resent = LLMessageStringTable::getInstance()->getString("Resent"); +char* _PREHASH_Center = LLMessageStringTable::getInstance()->getString("Center"); +char* _PREHASH_SharedData = LLMessageStringTable::getInstance()->getString("SharedData"); +char* _PREHASH_PSBlock = LLMessageStringTable::getInstance()->getString("PSBlock"); +char* _PREHASH_UUIDNameBlock = LLMessageStringTable::getInstance()->getString("UUIDNameBlock"); +char* _PREHASH_GroupTitleUpdate = LLMessageStringTable::getInstance()->getString("GroupTitleUpdate"); +char* _PREHASH_Method = LLMessageStringTable::getInstance()->getString("Method"); +char* _PREHASH_TouchName = LLMessageStringTable::getInstance()->getString("TouchName"); +char* _PREHASH_UpdateType = LLMessageStringTable::getInstance()->getString("UpdateType"); +char* _PREHASH_KickedFromEstateID = LLMessageStringTable::getInstance()->getString("KickedFromEstateID"); +char* _PREHASH_CandidateID = LLMessageStringTable::getInstance()->getString("CandidateID"); +char* _PREHASH_ParamData = LLMessageStringTable::getInstance()->getString("ParamData"); +char* _PREHASH_GodlikeMessage = LLMessageStringTable::getInstance()->getString("GodlikeMessage"); +char* _PREHASH_SystemMessage = LLMessageStringTable::getInstance()->getString("SystemMessage"); +char* _PREHASH_BodyRotation = LLMessageStringTable::getInstance()->getString("BodyRotation"); +char* _PREHASH_SearchRegions = LLMessageStringTable::getInstance()->getString("SearchRegions"); +char* _PREHASH_AnimationData = LLMessageStringTable::getInstance()->getString("AnimationData"); +char* _PREHASH_StatID = LLMessageStringTable::getInstance()->getString("StatID"); +char* _PREHASH_ItemID = LLMessageStringTable::getInstance()->getString("ItemID"); +char* _PREHASH_ScriptDialogReply = LLMessageStringTable::getInstance()->getString("ScriptDialogReply"); +char* _PREHASH_RegionIDAndHandleReply = LLMessageStringTable::getInstance()->getString("RegionIDAndHandleReply"); +char* _PREHASH_CameraAtOffset = LLMessageStringTable::getInstance()->getString("CameraAtOffset"); +char* _PREHASH_VoteID = LLMessageStringTable::getInstance()->getString("VoteID"); +char* _PREHASH_ParcelGodForceOwner = LLMessageStringTable::getInstance()->getString("ParcelGodForceOwner"); +char* _PREHASH_Filter = LLMessageStringTable::getInstance()->getString("Filter"); +char* _PREHASH_InviteData = LLMessageStringTable::getInstance()->getString("InviteData"); +char* _PREHASH_PCode = LLMessageStringTable::getInstance()->getString("PCode"); +char* _PREHASH_SearchPos = LLMessageStringTable::getInstance()->getString("SearchPos"); +char* _PREHASH_PreyID = LLMessageStringTable::getInstance()->getString("PreyID"); +char* _PREHASH_TerrainLowerLimit = LLMessageStringTable::getInstance()->getString("TerrainLowerLimit"); +char* _PREHASH_EventFlags = LLMessageStringTable::getInstance()->getString("EventFlags"); +char* _PREHASH_TallyVotes = LLMessageStringTable::getInstance()->getString("TallyVotes"); +char* _PREHASH_Result = LLMessageStringTable::getInstance()->getString("Result"); +char* _PREHASH_LookAt = LLMessageStringTable::getInstance()->getString("LookAt"); +char* _PREHASH_SearchOrder = LLMessageStringTable::getInstance()->getString("SearchOrder"); +char* _PREHASH_PayButton = LLMessageStringTable::getInstance()->getString("PayButton"); +char* _PREHASH_SelfCount = LLMessageStringTable::getInstance()->getString("SelfCount"); +char* _PREHASH_PacketCount = LLMessageStringTable::getInstance()->getString("PacketCount"); +char* _PREHASH_ParcelBuyPass = LLMessageStringTable::getInstance()->getString("ParcelBuyPass"); +char* _PREHASH_OldItemID = LLMessageStringTable::getInstance()->getString("OldItemID"); +char* _PREHASH_RegionPort = LLMessageStringTable::getInstance()->getString("RegionPort"); +char* _PREHASH_PriceEnergyUnit = LLMessageStringTable::getInstance()->getString("PriceEnergyUnit"); +char* _PREHASH_Bitmap = LLMessageStringTable::getInstance()->getString("Bitmap"); +char* _PREHASH_CacheMissType = LLMessageStringTable::getInstance()->getString("CacheMissType"); +char* _PREHASH_VFileID = LLMessageStringTable::getInstance()->getString("VFileID"); +char* _PREHASH_GroupInsigniaID = LLMessageStringTable::getInstance()->getString("GroupInsigniaID"); +char* _PREHASH_Online = LLMessageStringTable::getInstance()->getString("Online"); +char* _PREHASH_KickFlags = LLMessageStringTable::getInstance()->getString("KickFlags"); +char* _PREHASH_CovenantID = LLMessageStringTable::getInstance()->getString("CovenantID"); +char* _PREHASH_SysCPU = LLMessageStringTable::getInstance()->getString("SysCPU"); +char* _PREHASH_EMail = LLMessageStringTable::getInstance()->getString("EMail"); +char* _PREHASH_AggregatePermTextures = LLMessageStringTable::getInstance()->getString("AggregatePermTextures"); +char* _PREHASH_ChatChannel = LLMessageStringTable::getInstance()->getString("ChatChannel"); +char* _PREHASH_ReturnID = LLMessageStringTable::getInstance()->getString("ReturnID"); +char* _PREHASH_ObjectAttach = LLMessageStringTable::getInstance()->getString("ObjectAttach"); +char* _PREHASH_TargetPort = LLMessageStringTable::getInstance()->getString("TargetPort"); +char* _PREHASH_ObjectSpinStop = LLMessageStringTable::getInstance()->getString("ObjectSpinStop"); +char* _PREHASH_FullID = LLMessageStringTable::getInstance()->getString("FullID"); +char* _PREHASH_ActivateGroup = LLMessageStringTable::getInstance()->getString("ActivateGroup"); +char* _PREHASH_SysGPU = LLMessageStringTable::getInstance()->getString("SysGPU"); +char* _PREHASH_AvatarInterestsReply = LLMessageStringTable::getInstance()->getString("AvatarInterestsReply"); +char* _PREHASH_StartLure = LLMessageStringTable::getInstance()->getString("StartLure"); +char* _PREHASH_SysRAM = LLMessageStringTable::getInstance()->getString("SysRAM"); +char* _PREHASH_ObjectPosition = LLMessageStringTable::getInstance()->getString("ObjectPosition"); +char* _PREHASH_SitPosition = LLMessageStringTable::getInstance()->getString("SitPosition"); +char* _PREHASH_StartTime = LLMessageStringTable::getInstance()->getString("StartTime"); +char* _PREHASH_BornOn = LLMessageStringTable::getInstance()->getString("BornOn"); +char* _PREHASH_CameraCollidePlane = LLMessageStringTable::getInstance()->getString("CameraCollidePlane"); +char* _PREHASH_EconomyDataRequest = LLMessageStringTable::getInstance()->getString("EconomyDataRequest"); +char* _PREHASH_TeleportLureRequest = LLMessageStringTable::getInstance()->getString("TeleportLureRequest"); +char* _PREHASH_FolderID = LLMessageStringTable::getInstance()->getString("FolderID"); +char* _PREHASH_RegionHandleRequest = LLMessageStringTable::getInstance()->getString("RegionHandleRequest"); +char* _PREHASH_ScriptDataRequest = LLMessageStringTable::getInstance()->getString("ScriptDataRequest"); +char* _PREHASH_GroupRoleDataRequest = LLMessageStringTable::getInstance()->getString("GroupRoleDataRequest"); +char* _PREHASH_GroupTitlesRequest = LLMessageStringTable::getInstance()->getString("GroupTitlesRequest"); +char* _PREHASH_AgentWearablesRequest = LLMessageStringTable::getInstance()->getString("AgentWearablesRequest"); +char* _PREHASH_MapBlockRequest = LLMessageStringTable::getInstance()->getString("MapBlockRequest"); +char* _PREHASH_LureID = LLMessageStringTable::getInstance()->getString("LureID"); +char* _PREHASH_CopyCenters = LLMessageStringTable::getInstance()->getString("CopyCenters"); +char* _PREHASH_ParamList = LLMessageStringTable::getInstance()->getString("ParamList"); +char* _PREHASH_InventorySerial = LLMessageStringTable::getInstance()->getString("InventorySerial"); +char* _PREHASH_EdgeDataPacket = LLMessageStringTable::getInstance()->getString("EdgeDataPacket"); +char* _PREHASH_AvatarPickerReply = LLMessageStringTable::getInstance()->getString("AvatarPickerReply"); +char* _PREHASH_ParcelDwellReply = LLMessageStringTable::getInstance()->getString("ParcelDwellReply"); +char* _PREHASH_IsForSale = LLMessageStringTable::getInstance()->getString("IsForSale"); +char* _PREHASH_MuteID = LLMessageStringTable::getInstance()->getString("MuteID"); +char* _PREHASH_MeanCollisionAlert = LLMessageStringTable::getInstance()->getString("MeanCollisionAlert"); +char* _PREHASH_CanAcceptTasks = LLMessageStringTable::getInstance()->getString("CanAcceptTasks"); +char* _PREHASH_ItemData = LLMessageStringTable::getInstance()->getString("ItemData"); +char* _PREHASH_AnimationList = LLMessageStringTable::getInstance()->getString("AnimationList"); +char* _PREHASH_Reputation = LLMessageStringTable::getInstance()->getString("Reputation"); +char* _PREHASH_IntValue = LLMessageStringTable::getInstance()->getString("IntValue"); +char* _PREHASH_TargetType = LLMessageStringTable::getInstance()->getString("TargetType"); +char* _PREHASH_Amount = LLMessageStringTable::getInstance()->getString("Amount"); +char* _PREHASH_HasAttachment = LLMessageStringTable::getInstance()->getString("HasAttachment"); +char* _PREHASH_UpdateAttachment = LLMessageStringTable::getInstance()->getString("UpdateAttachment"); +char* _PREHASH_RemoveAttachment = LLMessageStringTable::getInstance()->getString("RemoveAttachment"); +char* _PREHASH_HeightWidthBlock = LLMessageStringTable::getInstance()->getString("HeightWidthBlock"); +char* _PREHASH_RequestObjectPropertiesFamily = LLMessageStringTable::getInstance()->getString("RequestObjectPropertiesFamily"); +char* _PREHASH_ObjectPropertiesFamily = LLMessageStringTable::getInstance()->getString("ObjectPropertiesFamily"); +char* _PREHASH_UserData = LLMessageStringTable::getInstance()->getString("UserData"); +char* _PREHASH_IsReadable = LLMessageStringTable::getInstance()->getString("IsReadable"); +char* _PREHASH_PathCurve = LLMessageStringTable::getInstance()->getString("PathCurve"); +char* _PREHASH_Status = LLMessageStringTable::getInstance()->getString("Status"); +char* _PREHASH_FromGroup = LLMessageStringTable::getInstance()->getString("FromGroup"); +char* _PREHASH_AlreadyVoted = LLMessageStringTable::getInstance()->getString("AlreadyVoted"); +char* _PREHASH_PlacesReply = LLMessageStringTable::getInstance()->getString("PlacesReply"); +char* _PREHASH_DirPlacesReply = LLMessageStringTable::getInstance()->getString("DirPlacesReply"); +char* _PREHASH_ParcelBuy = LLMessageStringTable::getInstance()->getString("ParcelBuy"); +char* _PREHASH_DirFindQueryBackend = LLMessageStringTable::getInstance()->getString("DirFindQueryBackend"); +char* _PREHASH_DirPlacesQueryBackend = LLMessageStringTable::getInstance()->getString("DirPlacesQueryBackend"); +char* _PREHASH_DirClassifiedQueryBackend = LLMessageStringTable::getInstance()->getString("DirClassifiedQueryBackend"); +char* _PREHASH_DirLandQueryBackend = LLMessageStringTable::getInstance()->getString("DirLandQueryBackend"); +char* _PREHASH_DirPopularQueryBackend = LLMessageStringTable::getInstance()->getString("DirPopularQueryBackend"); +char* _PREHASH_HistoryData = LLMessageStringTable::getInstance()->getString("HistoryData"); +char* _PREHASH_SnapshotID = LLMessageStringTable::getInstance()->getString("SnapshotID"); +char* _PREHASH_Aspect = LLMessageStringTable::getInstance()->getString("Aspect"); +char* _PREHASH_ParamSize = LLMessageStringTable::getInstance()->getString("ParamSize"); +char* _PREHASH_VoteCast = LLMessageStringTable::getInstance()->getString("VoteCast"); +char* _PREHASH_CastsShadows = LLMessageStringTable::getInstance()->getString("CastsShadows"); +char* _PREHASH_EveryoneMask = LLMessageStringTable::getInstance()->getString("EveryoneMask"); +char* _PREHASH_ObjectSpinUpdate = LLMessageStringTable::getInstance()->getString("ObjectSpinUpdate"); +char* _PREHASH_MaturePublish = LLMessageStringTable::getInstance()->getString("MaturePublish"); +char* _PREHASH_UseExistingAsset = LLMessageStringTable::getInstance()->getString("UseExistingAsset"); +char* _PREHASH_Powers = LLMessageStringTable::getInstance()->getString("Powers"); +char* _PREHASH_ParcelLocalID = LLMessageStringTable::getInstance()->getString("ParcelLocalID"); +char* _PREHASH_TeleportCancel = LLMessageStringTable::getInstance()->getString("TeleportCancel"); +char* _PREHASH_UnixTime = LLMessageStringTable::getInstance()->getString("UnixTime"); +char* _PREHASH_QueryFlags = LLMessageStringTable::getInstance()->getString("QueryFlags"); +char* _PREHASH_AlwaysRun = LLMessageStringTable::getInstance()->getString("AlwaysRun"); +char* _PREHASH_Bottom = LLMessageStringTable::getInstance()->getString("Bottom"); +char* _PREHASH_ButtonData = LLMessageStringTable::getInstance()->getString("ButtonData"); +char* _PREHASH_SoundData = LLMessageStringTable::getInstance()->getString("SoundData"); +char* _PREHASH_ViewerStats = LLMessageStringTable::getInstance()->getString("ViewerStats"); +char* _PREHASH_RegionHandshake = LLMessageStringTable::getInstance()->getString("RegionHandshake"); +char* _PREHASH_ObjectDescription = LLMessageStringTable::getInstance()->getString("ObjectDescription"); +char* _PREHASH_Description = LLMessageStringTable::getInstance()->getString("Description"); +char* _PREHASH_ParamType = LLMessageStringTable::getInstance()->getString("ParamType"); +char* _PREHASH_UUIDNameReply = LLMessageStringTable::getInstance()->getString("UUIDNameReply"); +char* _PREHASH_UUIDGroupNameReply = LLMessageStringTable::getInstance()->getString("UUIDGroupNameReply"); +char* _PREHASH_SaveAssetIntoInventory = LLMessageStringTable::getInstance()->getString("SaveAssetIntoInventory"); +char* _PREHASH_UserInfo = LLMessageStringTable::getInstance()->getString("UserInfo"); +char* _PREHASH_AnimSequenceID = LLMessageStringTable::getInstance()->getString("AnimSequenceID"); +char* _PREHASH_NVPairs = LLMessageStringTable::getInstance()->getString("NVPairs"); +char* _PREHASH_GroupNoticesListRequest = LLMessageStringTable::getInstance()->getString("GroupNoticesListRequest"); +char* _PREHASH_ParcelAccessListRequest = LLMessageStringTable::getInstance()->getString("ParcelAccessListRequest"); +char* _PREHASH_MuteListRequest = LLMessageStringTable::getInstance()->getString("MuteListRequest"); +char* _PREHASH_RpcChannelRequest = LLMessageStringTable::getInstance()->getString("RpcChannelRequest"); +char* _PREHASH_LandStatRequest = LLMessageStringTable::getInstance()->getString("LandStatRequest"); +char* _PREHASH_PlacesQuery = LLMessageStringTable::getInstance()->getString("PlacesQuery"); +char* _PREHASH_DirPlacesQuery = LLMessageStringTable::getInstance()->getString("DirPlacesQuery"); +char* _PREHASH_SortOrder = LLMessageStringTable::getInstance()->getString("SortOrder"); +char* _PREHASH_Hunter = LLMessageStringTable::getInstance()->getString("Hunter"); +char* _PREHASH_SunAngVelocity = LLMessageStringTable::getInstance()->getString("SunAngVelocity"); +char* _PREHASH_BinaryBucket = LLMessageStringTable::getInstance()->getString("BinaryBucket"); +char* _PREHASH_ImagePacket = LLMessageStringTable::getInstance()->getString("ImagePacket"); +char* _PREHASH_StartGroupProposal = LLMessageStringTable::getInstance()->getString("StartGroupProposal"); +char* _PREHASH_EnergyLevel = LLMessageStringTable::getInstance()->getString("EnergyLevel"); +char* _PREHASH_PriceForListing = LLMessageStringTable::getInstance()->getString("PriceForListing"); +char* _PREHASH_Scale = LLMessageStringTable::getInstance()->getString("Scale"); +char* _PREHASH_EstateCovenantReply = LLMessageStringTable::getInstance()->getString("EstateCovenantReply"); +char* _PREHASH_ParentEstateID = LLMessageStringTable::getInstance()->getString("ParentEstateID"); +char* _PREHASH_Extra2 = LLMessageStringTable::getInstance()->getString("Extra2"); +char* _PREHASH_Throttle = LLMessageStringTable::getInstance()->getString("Throttle"); +char* _PREHASH_SimIP = LLMessageStringTable::getInstance()->getString("SimIP"); +char* _PREHASH_GodID = LLMessageStringTable::getInstance()->getString("GodID"); +char* _PREHASH_TeleportMinPrice = LLMessageStringTable::getInstance()->getString("TeleportMinPrice"); +char* _PREHASH_VoteItem = LLMessageStringTable::getInstance()->getString("VoteItem"); +char* _PREHASH_ObjectRotation = LLMessageStringTable::getInstance()->getString("ObjectRotation"); +char* _PREHASH_SitRotation = LLMessageStringTable::getInstance()->getString("SitRotation"); +char* _PREHASH_SnapSelection = LLMessageStringTable::getInstance()->getString("SnapSelection"); +char* _PREHASH_SoundTrigger = LLMessageStringTable::getInstance()->getString("SoundTrigger"); +char* _PREHASH_TerrainRaiseLimit = LLMessageStringTable::getInstance()->getString("TerrainRaiseLimit"); +char* _PREHASH_Quorum = LLMessageStringTable::getInstance()->getString("Quorum"); +char* _PREHASH_AgentBlock = LLMessageStringTable::getInstance()->getString("AgentBlock"); +char* _PREHASH_CommandBlock = LLMessageStringTable::getInstance()->getString("CommandBlock"); +char* _PREHASH_PricePublicObjectDecay = LLMessageStringTable::getInstance()->getString("PricePublicObjectDecay"); +char* _PREHASH_SpawnPointPos = LLMessageStringTable::getInstance()->getString("SpawnPointPos"); +char* _PREHASH_VolumeDetail = LLMessageStringTable::getInstance()->getString("VolumeDetail"); +char* _PREHASH_FromAgentName = LLMessageStringTable::getInstance()->getString("FromAgentName"); +char* _PREHASH_Range = LLMessageStringTable::getInstance()->getString("Range"); +char* _PREHASH_DirectoryVisibility = LLMessageStringTable::getInstance()->getString("DirectoryVisibility"); +char* _PREHASH_PublicIP = LLMessageStringTable::getInstance()->getString("PublicIP"); +char* _PREHASH_TeleportFailed = LLMessageStringTable::getInstance()->getString("TeleportFailed"); +char* _PREHASH_PreloadSound = LLMessageStringTable::getInstance()->getString("PreloadSound"); +char* _PREHASH_ScreenshotID = LLMessageStringTable::getInstance()->getString("ScreenshotID"); +char* _PREHASH_CovenantTimestamp = LLMessageStringTable::getInstance()->getString("CovenantTimestamp"); +char* _PREHASH_OldestUnacked = LLMessageStringTable::getInstance()->getString("OldestUnacked"); +char* _PREHASH_SimulatorIP = LLMessageStringTable::getInstance()->getString("SimulatorIP"); +char* _PREHASH_Value = LLMessageStringTable::getInstance()->getString("Value"); +char* _PREHASH_JointAxisOrAnchor = LLMessageStringTable::getInstance()->getString("JointAxisOrAnchor"); +char* _PREHASH_Test0 = LLMessageStringTable::getInstance()->getString("Test0"); +char* _PREHASH_Test1 = LLMessageStringTable::getInstance()->getString("Test1"); +char* _PREHASH_Test2 = LLMessageStringTable::getInstance()->getString("Test2"); +char* _PREHASH_SunPhase = LLMessageStringTable::getInstance()->getString("SunPhase"); +char* _PREHASH_ParcelDivide = LLMessageStringTable::getInstance()->getString("ParcelDivide"); +char* _PREHASH_PriceObjectClaim = LLMessageStringTable::getInstance()->getString("PriceObjectClaim"); +char* _PREHASH_Field = LLMessageStringTable::getInstance()->getString("Field"); +char* _PREHASH_Ratio = LLMessageStringTable::getInstance()->getString("Ratio"); +char* _PREHASH_JoinGroupReply = LLMessageStringTable::getInstance()->getString("JoinGroupReply"); +char* _PREHASH_LiveHelpGroupReply = LLMessageStringTable::getInstance()->getString("LiveHelpGroupReply"); +char* _PREHASH_Score = LLMessageStringTable::getInstance()->getString("Score"); +char* _PREHASH_Image = LLMessageStringTable::getInstance()->getString("Image"); +char* _PREHASH_ObjectClickAction = LLMessageStringTable::getInstance()->getString("ObjectClickAction"); +char* _PREHASH_Parameter = LLMessageStringTable::getInstance()->getString("Parameter"); +char* _PREHASH_Flags = LLMessageStringTable::getInstance()->getString("Flags"); +char* _PREHASH_Plane = LLMessageStringTable::getInstance()->getString("Plane"); +char* _PREHASH_Width = LLMessageStringTable::getInstance()->getString("Width"); +char* _PREHASH_Right = LLMessageStringTable::getInstance()->getString("Right"); +char* _PREHASH_DirFindQuery = LLMessageStringTable::getInstance()->getString("DirFindQuery"); +char* _PREHASH_Textures = LLMessageStringTable::getInstance()->getString("Textures"); +char* _PREHASH_EventData = LLMessageStringTable::getInstance()->getString("EventData"); +char* _PREHASH_Final = LLMessageStringTable::getInstance()->getString("Final"); +char* _PREHASH_System = LLMessageStringTable::getInstance()->getString("System"); +char* _PREHASH_TelehubPos = LLMessageStringTable::getInstance()->getString("TelehubPos"); +char* _PREHASH_ReportAutosaveCrash = LLMessageStringTable::getInstance()->getString("ReportAutosaveCrash"); +char* _PREHASH_CreateTrustedCircuit = LLMessageStringTable::getInstance()->getString("CreateTrustedCircuit"); +char* _PREHASH_DenyTrustedCircuit = LLMessageStringTable::getInstance()->getString("DenyTrustedCircuit"); +char* _PREHASH_RequestTrustedCircuit = LLMessageStringTable::getInstance()->getString("RequestTrustedCircuit"); +char* _PREHASH_Codec = LLMessageStringTable::getInstance()->getString("Codec"); +char* _PREHASH_Modal = LLMessageStringTable::getInstance()->getString("Modal"); +char* _PREHASH_ChildAgentUnknown = LLMessageStringTable::getInstance()->getString("ChildAgentUnknown"); +char* _PREHASH_LandingType = LLMessageStringTable::getInstance()->getString("LandingType"); +char* _PREHASH_ScriptRunningReply = LLMessageStringTable::getInstance()->getString("ScriptRunningReply"); +char* _PREHASH_Reply = LLMessageStringTable::getInstance()->getString("Reply"); +char* _PREHASH_GroupAccountDetailsReply = LLMessageStringTable::getInstance()->getString("GroupAccountDetailsReply"); +char* _PREHASH_TelehubRot = LLMessageStringTable::getInstance()->getString("TelehubRot"); +char* _PREHASH_AcceptFriendship = LLMessageStringTable::getInstance()->getString("AcceptFriendship"); +char* _PREHASH_ItemType = LLMessageStringTable::getInstance()->getString("ItemType"); +char* _PREHASH_DwellInfo = LLMessageStringTable::getInstance()->getString("DwellInfo"); +char* _PREHASH_AgentResume = LLMessageStringTable::getInstance()->getString("AgentResume"); +char* _PREHASH_MailFilter = LLMessageStringTable::getInstance()->getString("MailFilter"); +char* _PREHASH_Disconnect = LLMessageStringTable::getInstance()->getString("Disconnect"); +char* _PREHASH_SimPosition = LLMessageStringTable::getInstance()->getString("SimPosition"); +char* _PREHASH_SimWideTotalPrims = LLMessageStringTable::getInstance()->getString("SimWideTotalPrims"); +char* _PREHASH_Index = LLMessageStringTable::getInstance()->getString("Index"); +char* _PREHASH_SimFilename = LLMessageStringTable::getInstance()->getString("SimFilename"); +char* _PREHASH_LastOwnerID = LLMessageStringTable::getInstance()->getString("LastOwnerID"); +char* _PREHASH_GroupNoticeRequest = LLMessageStringTable::getInstance()->getString("GroupNoticeRequest"); +char* _PREHASH_EmailMessageRequest = LLMessageStringTable::getInstance()->getString("EmailMessageRequest"); +char* _PREHASH_MapItemRequest = LLMessageStringTable::getInstance()->getString("MapItemRequest"); +char* _PREHASH_AgentCount = LLMessageStringTable::getInstance()->getString("AgentCount"); +char* _PREHASH_MessageBlock = LLMessageStringTable::getInstance()->getString("MessageBlock"); +char* _PREHASH_FuseBlock = LLMessageStringTable::getInstance()->getString("FuseBlock"); +char* _PREHASH_AgentGroupData = LLMessageStringTable::getInstance()->getString("AgentGroupData"); +char* _PREHASH_ClassifiedInfoUpdate = LLMessageStringTable::getInstance()->getString("ClassifiedInfoUpdate"); +char* _PREHASH_RegionPos = LLMessageStringTable::getInstance()->getString("RegionPos"); +char* _PREHASH_ParcelMediaUpdate = LLMessageStringTable::getInstance()->getString("ParcelMediaUpdate"); +char* _PREHASH_NoticeID = LLMessageStringTable::getInstance()->getString("NoticeID"); +char* _PREHASH_GridX = LLMessageStringTable::getInstance()->getString("GridX"); +char* _PREHASH_GridY = LLMessageStringTable::getInstance()->getString("GridY"); +char* _PREHASH_Title = LLMessageStringTable::getInstance()->getString("Title"); +char* _PREHASH_AuctionID = LLMessageStringTable::getInstance()->getString("AuctionID"); +char* _PREHASH_VoteType = LLMessageStringTable::getInstance()->getString("VoteType"); +char* _PREHASH_CategoryID = LLMessageStringTable::getInstance()->getString("CategoryID"); +char* _PREHASH_Token = LLMessageStringTable::getInstance()->getString("Token"); +char* _PREHASH_AggregatePerms = LLMessageStringTable::getInstance()->getString("AggregatePerms"); +char* _PREHASH_ObjectSelect = LLMessageStringTable::getInstance()->getString("ObjectSelect"); +char* _PREHASH_ForceObjectSelect = LLMessageStringTable::getInstance()->getString("ForceObjectSelect"); +char* _PREHASH_Price = LLMessageStringTable::getInstance()->getString("Price"); +char* _PREHASH_SunDirection = LLMessageStringTable::getInstance()->getString("SunDirection"); +char* _PREHASH_FromName = LLMessageStringTable::getInstance()->getString("FromName"); +char* _PREHASH_ChangeInventoryItemFlags = LLMessageStringTable::getInstance()->getString("ChangLLInventoryItemFlags"); +char* _PREHASH_Force = LLMessageStringTable::getInstance()->getString("Force"); +char* _PREHASH_TransactionBlock = LLMessageStringTable::getInstance()->getString("TransactionBlock"); +char* _PREHASH_PowersMask = LLMessageStringTable::getInstance()->getString("PowersMask"); +char* _PREHASH_Stamp = LLMessageStringTable::getInstance()->getString("Stamp"); +char* _PREHASH_TotalCredits = LLMessageStringTable::getInstance()->getString("TotalCredits"); +char* _PREHASH_State = LLMessageStringTable::getInstance()->getString("State"); +char* _PREHASH_TextureIndex = LLMessageStringTable::getInstance()->getString("TextureIndex"); +char* _PREHASH_InviteeID = LLMessageStringTable::getInstance()->getString("InviteeID"); +char* _PREHASH_ParcelReclaim = LLMessageStringTable::getInstance()->getString("ParcelReclaim"); +char* _PREHASH_Money = LLMessageStringTable::getInstance()->getString("Money"); +char* _PREHASH_PathTwist = LLMessageStringTable::getInstance()->getString("PathTwist"); +char* _PREHASH_AuthBuyerID = LLMessageStringTable::getInstance()->getString("AuthBuyerID"); +char* _PREHASH_Color = LLMessageStringTable::getInstance()->getString("Color"); +char* _PREHASH_SourceType = LLMessageStringTable::getInstance()->getString("SourceType"); +char* _PREHASH_World = LLMessageStringTable::getInstance()->getString("World"); +char* _PREHASH_QueryData = LLMessageStringTable::getInstance()->getString("QueryData"); +char* _PREHASH_Users = LLMessageStringTable::getInstance()->getString("Users"); +char* _PREHASH_SysOS = LLMessageStringTable::getInstance()->getString("SysOS"); +char* _PREHASH_Notes = LLMessageStringTable::getInstance()->getString("Notes"); +char* _PREHASH_AvatarID = LLMessageStringTable::getInstance()->getString("AvatarID"); +char* _PREHASH_FounderID = LLMessageStringTable::getInstance()->getString("FounderID"); +char* _PREHASH_EndPointID = LLMessageStringTable::getInstance()->getString("EndPointID"); +char* _PREHASH_LocationLookAt = LLMessageStringTable::getInstance()->getString("LocationLookAt"); +char* _PREHASH_Sound = LLMessageStringTable::getInstance()->getString("Sound"); +char* _PREHASH_Cover = LLMessageStringTable::getInstance()->getString("Cover"); +char* _PREHASH_TotalObjectCount = LLMessageStringTable::getInstance()->getString("TotalObjectCount"); +char* _PREHASH_TextureEntry = LLMessageStringTable::getInstance()->getString("TextureEntry"); +char* _PREHASH_SquareMetersCommitted = LLMessageStringTable::getInstance()->getString("SquareMetersCommitted"); +char* _PREHASH_ChannelID = LLMessageStringTable::getInstance()->getString("ChannelID"); +char* _PREHASH_Dwell = LLMessageStringTable::getInstance()->getString("Dwell"); +char* _PREHASH_North = LLMessageStringTable::getInstance()->getString("North"); +char* _PREHASH_AgentUpdate = LLMessageStringTable::getInstance()->getString("AgentUpdate"); +char* _PREHASH_PickGodDelete = LLMessageStringTable::getInstance()->getString("PickGodDelete"); +char* _PREHASH_HostName = LLMessageStringTable::getInstance()->getString("HostName"); +char* _PREHASH_PriceParcelClaim = LLMessageStringTable::getInstance()->getString("PriceParcelClaim"); +char* _PREHASH_ParcelClaim = LLMessageStringTable::getInstance()->getString("ParcelClaim"); +char* _PREHASH_AgentPowers = LLMessageStringTable::getInstance()->getString("AgentPowers"); +char* _PREHASH_ProfileHollow = LLMessageStringTable::getInstance()->getString("ProfileHollow"); +char* _PREHASH_GroupRoleChanges = LLMessageStringTable::getInstance()->getString("GroupRoleChanges"); +char* _PREHASH_Count = LLMessageStringTable::getInstance()->getString("Count"); +char* _PREHASH_South = LLMessageStringTable::getInstance()->getString("South"); +char* _PREHASH_ObjectUpdateCompressed = LLMessageStringTable::getInstance()->getString("ObjectUpdateCompressed"); +char* _PREHASH_MuteFlags = LLMessageStringTable::getInstance()->getString("MuteFlags"); +char* _PREHASH_Group = LLMessageStringTable::getInstance()->getString("Group"); +char* _PREHASH_AgentPause = LLMessageStringTable::getInstance()->getString("AgentPause"); +char* _PREHASH_LanguagesText = LLMessageStringTable::getInstance()->getString("LanguagesText"); +char* _PREHASH_Error = LLMessageStringTable::getInstance()->getString("Error"); +char* _PREHASH_InternalScriptMail = LLMessageStringTable::getInstance()->getString("InternalScriptMail"); +char* _PREHASH_FindAgent = LLMessageStringTable::getInstance()->getString("FindAgent"); +char* _PREHASH_AgentData = LLMessageStringTable::getInstance()->getString("AgentData"); +char* _PREHASH_FolderData = LLMessageStringTable::getInstance()->getString("FolderData"); +char* _PREHASH_AssetBlock = LLMessageStringTable::getInstance()->getString("AssetBlock"); +char* _PREHASH_AcceptNotices = LLMessageStringTable::getInstance()->getString("AcceptNotices"); +char* _PREHASH_SetGroupAcceptNotices = LLMessageStringTable::getInstance()->getString("SetGroupAcceptNotices"); +char* _PREHASH_CloseCircuit = LLMessageStringTable::getInstance()->getString("CloseCircuit"); +char* _PREHASH_TeleportFinish = LLMessageStringTable::getInstance()->getString("TeleportFinish"); +char* _PREHASH_PathRevolutions = LLMessageStringTable::getInstance()->getString("PathRevolutions"); +char* _PREHASH_ClassifiedInfoReply = LLMessageStringTable::getInstance()->getString("ClassifiedInfoReply"); +char* _PREHASH_ParcelInfoReply = LLMessageStringTable::getInstance()->getString("ParcelInfoReply"); +char* _PREHASH_AutosaveData = LLMessageStringTable::getInstance()->getString("AutosaveData"); +char* _PREHASH_SetStartLocation = LLMessageStringTable::getInstance()->getString("SetStartLocation"); +char* _PREHASH_PassHours = LLMessageStringTable::getInstance()->getString("PassHours"); +char* _PREHASH_AttachmentPt = LLMessageStringTable::getInstance()->getString("AttachmentPt"); +char* _PREHASH_ParcelFlags = LLMessageStringTable::getInstance()->getString("ParcelFlags"); +char* _PREHASH_NumVotes = LLMessageStringTable::getInstance()->getString("NumVotes"); +char* _PREHASH_AvatarPickerRequest = LLMessageStringTable::getInstance()->getString("AvatarPickerRequest"); +char* _PREHASH_TeleportLocationRequest = LLMessageStringTable::getInstance()->getString("TeleportLocationRequest"); +char* _PREHASH_DataHomeLocationRequest = LLMessageStringTable::getInstance()->getString("DataHomeLocationRequest"); +char* _PREHASH_EventNotificationAddRequest = LLMessageStringTable::getInstance()->getString("EventNotificationAddRequest"); +char* _PREHASH_ParcelDwellRequest = LLMessageStringTable::getInstance()->getString("ParcelDwellRequest"); +char* _PREHASH_EventLocationRequest = LLMessageStringTable::getInstance()->getString("EventLocationRequest"); +char* _PREHASH_SetStartLocationRequest = LLMessageStringTable::getInstance()->getString("SetStartLocationRequest"); +char* _PREHASH_QueryStart = LLMessageStringTable::getInstance()->getString("QueryStart"); +char* _PREHASH_EjectData = LLMessageStringTable::getInstance()->getString("EjectData"); +char* _PREHASH_AvatarTextureUpdate = LLMessageStringTable::getInstance()->getString("AvatarTextureUpdate"); +char* _PREHASH_RPCServerPort = LLMessageStringTable::getInstance()->getString("RPCServerPort"); +char* _PREHASH_Bytes = LLMessageStringTable::getInstance()->getString("Bytes"); +char* _PREHASH_Extra = LLMessageStringTable::getInstance()->getString("Extra"); +char* _PREHASH_ForceScriptControlRelease = LLMessageStringTable::getInstance()->getString("ForceScriptControlRelease"); +char* _PREHASH_ParcelRelease = LLMessageStringTable::getInstance()->getString("ParcelRelease"); +char* _PREHASH_VFileType = LLMessageStringTable::getInstance()->getString("VFileType"); +char* _PREHASH_EjectGroupMemberReply = LLMessageStringTable::getInstance()->getString("EjectGroupMemberReply"); +char* _PREHASH_ImageData = LLMessageStringTable::getInstance()->getString("ImageData"); +char* _PREHASH_SimulatorViewerTimeMessage = LLMessageStringTable::getInstance()->getString("SimulatorViewerTimeMessage"); +char* _PREHASH_Rotation = LLMessageStringTable::getInstance()->getString("Rotation"); +char* _PREHASH_Selection = LLMessageStringTable::getInstance()->getString("Selection"); +char* _PREHASH_TransactionData = LLMessageStringTable::getInstance()->getString("TransactionData"); +char* _PREHASH_OperationData = LLMessageStringTable::getInstance()->getString("OperationData"); +char* _PREHASH_ExpirationDate = LLMessageStringTable::getInstance()->getString("ExpirationDate"); +char* _PREHASH_ParcelDeedToGroup = LLMessageStringTable::getInstance()->getString("ParcelDeedToGroup"); +char* _PREHASH_AvatarPicksReply = LLMessageStringTable::getInstance()->getString("AvatarPicksReply"); +char* _PREHASH_GroupTitlesReply = LLMessageStringTable::getInstance()->getString("GroupTitlesReply"); +char* _PREHASH_AgentInfo = LLMessageStringTable::getInstance()->getString("AgentInfo"); +char* _PREHASH_MoneyTransferBackend = LLMessageStringTable::getInstance()->getString("MoneyTransferBackend"); +char* _PREHASH_NextOwnerMask = LLMessageStringTable::getInstance()->getString("NextOwnerMask"); +char* _PREHASH_MuteData = LLMessageStringTable::getInstance()->getString("MuteData"); +char* _PREHASH_PassPrice = LLMessageStringTable::getInstance()->getString("PassPrice"); +char* _PREHASH_SourceID = LLMessageStringTable::getInstance()->getString("SourceID"); +char* _PREHASH_ChangeUserRights = LLMessageStringTable::getInstance()->getString("ChangeUserRights"); +char* _PREHASH_TeleportFlags = LLMessageStringTable::getInstance()->getString("TeleportFlags"); +char* _PREHASH_SlaveParcelData = LLMessageStringTable::getInstance()->getString("SlaveParcelData"); +char* _PREHASH_AssetData = LLMessageStringTable::getInstance()->getString("AssetData"); +char* _PREHASH_MultipleObjectUpdate = LLMessageStringTable::getInstance()->getString("MultipleObjectUpdate"); +char* _PREHASH_ObjectUpdate = LLMessageStringTable::getInstance()->getString("ObjectUpdate"); +char* _PREHASH_ImprovedTerseObjectUpdate = LLMessageStringTable::getInstance()->getString("ImprovedTerseObjectUpdate"); +char* _PREHASH_ConfirmXferPacket = LLMessageStringTable::getInstance()->getString("ConfirmXferPacket"); +char* _PREHASH_StartPingCheck = LLMessageStringTable::getInstance()->getString("StartPingCheck"); +char* _PREHASH_SimWideDeletes = LLMessageStringTable::getInstance()->getString("SimWideDeletes"); +char* _PREHASH_LandStatReply = LLMessageStringTable::getInstance()->getString("LandStatReply"); +char* _PREHASH_IsPhantom = LLMessageStringTable::getInstance()->getString("IsPhantom"); +char* _PREHASH_AgentList = LLMessageStringTable::getInstance()->getString("AgentList"); +char* _PREHASH_SimApproved = LLMessageStringTable::getInstance()->getString("SimApproved"); +char* _PREHASH_RezObject = LLMessageStringTable::getInstance()->getString("RezObject"); +char* _PREHASH_TaskLocalID = LLMessageStringTable::getInstance()->getString("TaskLocalID"); +char* _PREHASH_ClaimDate = LLMessageStringTable::getInstance()->getString("ClaimDate"); +char* _PREHASH_MergeParcel = LLMessageStringTable::getInstance()->getString("MergeParcel"); +char* _PREHASH_Priority = LLMessageStringTable::getInstance()->getString("Priority"); +char* _PREHASH_QueryText = LLMessageStringTable::getInstance()->getString("QueryText"); +char* _PREHASH_GroupNoticeAdd = LLMessageStringTable::getInstance()->getString("GroupNoticeAdd"); +char* _PREHASH_ReturnType = LLMessageStringTable::getInstance()->getString("ReturnType"); +char* _PREHASH_FetchFolders = LLMessageStringTable::getInstance()->getString("FetchFolders"); +char* _PREHASH_SimulatorPublicHostBlock = LLMessageStringTable::getInstance()->getString("SimulatorPublicHostBlock"); +char* _PREHASH_HeaderData = LLMessageStringTable::getInstance()->getString("HeaderData"); +char* _PREHASH_RequestMultipleObjects = LLMessageStringTable::getInstance()->getString("RequestMultipleObjects"); +char* _PREHASH_RetrieveInstantMessages = LLMessageStringTable::getInstance()->getString("RetrieveInstantMessages"); +char* _PREHASH_OpenCircuit = LLMessageStringTable::getInstance()->getString("OpenCircuit"); +char* _PREHASH_CrossedRegion = LLMessageStringTable::getInstance()->getString("CrossedRegion"); +char* _PREHASH_DirGroupsReply = LLMessageStringTable::getInstance()->getString("DirGroupsReply"); +char* _PREHASH_AvatarGroupsReply = LLMessageStringTable::getInstance()->getString("AvatarGroupsReply"); +char* _PREHASH_EmailMessageReply = LLMessageStringTable::getInstance()->getString("EmailMessageReply"); +char* _PREHASH_GroupVoteHistoryItemReply = LLMessageStringTable::getInstance()->getString("GroupVoteHistoryItemReply"); +char* _PREHASH_ViewerPosition = LLMessageStringTable::getInstance()->getString("ViewerPosition"); +char* _PREHASH_Position = LLMessageStringTable::getInstance()->getString("Position"); +char* _PREHASH_ParentEstate = LLMessageStringTable::getInstance()->getString("ParentEstate"); +char* _PREHASH_EstateName = LLMessageStringTable::getInstance()->getString("EstateName"); +char* _PREHASH_MuteName = LLMessageStringTable::getInstance()->getString("MuteName"); +char* _PREHASH_ParcelRename = LLMessageStringTable::getInstance()->getString("ParcelRename"); +char* _PREHASH_ViewerFilename = LLMessageStringTable::getInstance()->getString("ViewerFilename"); +char* _PREHASH_UserReportInternal = LLMessageStringTable::getInstance()->getString("UserReportInternal"); +char* _PREHASH_AvatarPropertiesRequest = LLMessageStringTable::getInstance()->getString("AvatarPropertiesRequest"); +char* _PREHASH_ParcelPropertiesRequest = LLMessageStringTable::getInstance()->getString("ParcelPropertiesRequest"); +char* _PREHASH_GroupProfileRequest = LLMessageStringTable::getInstance()->getString("GroupProfileRequest"); +char* _PREHASH_AgentDataUpdateRequest = LLMessageStringTable::getInstance()->getString("AgentDataUpdateRequest"); +char* _PREHASH_PriceObjectScaleFactor = LLMessageStringTable::getInstance()->getString("PriceObjectScaleFactor"); +char* _PREHASH_OpenEnrollment = LLMessageStringTable::getInstance()->getString("OpenEnrollment"); +char* _PREHASH_GroupData = LLMessageStringTable::getInstance()->getString("GroupData"); +char* _PREHASH_RequestGodlikePowers = LLMessageStringTable::getInstance()->getString("RequestGodlikePowers"); +char* _PREHASH_GrantGodlikePowers = LLMessageStringTable::getInstance()->getString("GrantGodlikePowers"); +char* _PREHASH_TransactionID = LLMessageStringTable::getInstance()->getString("TransactionID"); +char* _PREHASH_DestinationID = LLMessageStringTable::getInstance()->getString("DestinationID"); +char* _PREHASH_Controls = LLMessageStringTable::getInstance()->getString("Controls"); +char* _PREHASH_FirstDetachAll = LLMessageStringTable::getInstance()->getString("FirstDetachAll"); +char* _PREHASH_EstateID = LLMessageStringTable::getInstance()->getString("EstateID"); +char* _PREHASH_ImprovedInstantMessage = LLMessageStringTable::getInstance()->getString("ImprovedInstantMessage"); +char* _PREHASH_CheckParcelSales = LLMessageStringTable::getInstance()->getString("CheckParcelSales"); +char* _PREHASH_ParcelSales = LLMessageStringTable::getInstance()->getString("ParcelSales"); +char* _PREHASH_CurrentInterval = LLMessageStringTable::getInstance()->getString("CurrentInterval"); +char* _PREHASH_PriceRentLight = LLMessageStringTable::getInstance()->getString("PriceRentLight"); +char* _PREHASH_MediaAutoScale = LLMessageStringTable::getInstance()->getString("MediaAutoScale"); +char* _PREHASH_NeighborBlock = LLMessageStringTable::getInstance()->getString("NeighborBlock"); +char* _PREHASH_LayerData = LLMessageStringTable::getInstance()->getString("LayerData"); +char* _PREHASH_NVPairData = LLMessageStringTable::getInstance()->getString("NVPairData"); +char* _PREHASH_TeleportLocal = LLMessageStringTable::getInstance()->getString("TeleportLocal"); +char* _PREHASH_EjecteeID = LLMessageStringTable::getInstance()->getString("EjecteeID"); +char* _PREHASH_VoteInitiator = LLMessageStringTable::getInstance()->getString("VoteInitiator"); +char* _PREHASH_TypeData = LLMessageStringTable::getInstance()->getString("TypeData"); +char* _PREHASH_OwnerIDs = LLMessageStringTable::getInstance()->getString("OwnerIDs"); +char* _PREHASH_SystemKickUser = LLMessageStringTable::getInstance()->getString("SystemKickUser"); +char* _PREHASH_TransactionTime = LLMessageStringTable::getInstance()->getString("TransactionTime"); +char* _PREHASH_TimeToLive = LLMessageStringTable::getInstance()->getString("TimeToLive"); +char* _PREHASH_OldAgentID = LLMessageStringTable::getInstance()->getString("OldAgentID"); +char* _PREHASH_MusicURL = LLMessageStringTable::getInstance()->getString("MusicURL"); +char* _PREHASH_ParcelPrimBonus = LLMessageStringTable::getInstance()->getString("ParcelPrimBonus"); +char* _PREHASH_EjectUser = LLMessageStringTable::getInstance()->getString("EjectUser"); +char* _PREHASH_CoarseLocationUpdate = LLMessageStringTable::getInstance()->getString("CoarseLocationUpdate"); +char* _PREHASH_ChildAgentPositionUpdate = LLMessageStringTable::getInstance()->getString("ChildAgentPositionUpdate"); +char* _PREHASH_StoreLocal = LLMessageStringTable::getInstance()->getString("StoreLocal"); +char* _PREHASH_GroupName = LLMessageStringTable::getInstance()->getString("GroupName"); +char* _PREHASH_PriceParcelRent = LLMessageStringTable::getInstance()->getString("PriceParcelRent"); +char* _PREHASH_SimStatus = LLMessageStringTable::getInstance()->getString("SimStatus"); +char* _PREHASH_TransactionSuccess = LLMessageStringTable::getInstance()->getString("TransactionSuccess"); +char* _PREHASH_LureType = LLMessageStringTable::getInstance()->getString("LureType"); +char* _PREHASH_GroupMask = LLMessageStringTable::getInstance()->getString("GroupMask"); +char* _PREHASH_SitObject = LLMessageStringTable::getInstance()->getString("SitObject"); +char* _PREHASH_Override = LLMessageStringTable::getInstance()->getString("Override"); +char* _PREHASH_LocomotionState = LLMessageStringTable::getInstance()->getString("LocomotionState"); +char* _PREHASH_PriceUpload = LLMessageStringTable::getInstance()->getString("PriceUpload"); +char* _PREHASH_RemoveParcel = LLMessageStringTable::getInstance()->getString("RemoveParcel"); +char* _PREHASH_ConfirmAuctionStart = LLMessageStringTable::getInstance()->getString("ConfirmAuctionStart"); +char* _PREHASH_RpcScriptRequestInbound = LLMessageStringTable::getInstance()->getString("RpcScriptRequestInbound"); +char* _PREHASH_ActiveGroupID = LLMessageStringTable::getInstance()->getString("ActiveGroupID"); +char* _PREHASH_ParcelReturnObjects = LLMessageStringTable::getInstance()->getString("ParcelReturnObjects"); +char* _PREHASH_TotalObjects = LLMessageStringTable::getInstance()->getString("TotalObjects"); +char* _PREHASH_ObjectExtraParams = LLMessageStringTable::getInstance()->getString("ObjectExtraParams"); +char* _PREHASH_Questions = LLMessageStringTable::getInstance()->getString("Questions"); +char* _PREHASH_TransferAbort = LLMessageStringTable::getInstance()->getString("TransferAbort"); +char* _PREHASH_TransferInventory = LLMessageStringTable::getInstance()->getString("TransferInventory"); +char* _PREHASH_RayTargetID = LLMessageStringTable::getInstance()->getString("RayTargetID"); +char* _PREHASH_ClaimPrice = LLMessageStringTable::getInstance()->getString("ClaimPrice"); +char* _PREHASH_ObjectProperties = LLMessageStringTable::getInstance()->getString("ObjectProperties"); +char* _PREHASH_ParcelProperties = LLMessageStringTable::getInstance()->getString("ParcelProperties"); +char* _PREHASH_EstateOwnerID = LLMessageStringTable::getInstance()->getString("EstateOwnerID"); +char* _PREHASH_LogoutRequest = LLMessageStringTable::getInstance()->getString("LogoutRequest"); +char* _PREHASH_AssetUploadRequest = LLMessageStringTable::getInstance()->getString("AssetUploadRequest"); +char* _PREHASH_TransactionType = LLMessageStringTable::getInstance()->getString("TransactionType"); +char* _PREHASH_AvatarPropertiesUpdate = LLMessageStringTable::getInstance()->getString("AvatarPropertiesUpdate"); +char* _PREHASH_ParcelPropertiesUpdate = LLMessageStringTable::getInstance()->getString("ParcelPropertiesUpdate"); +char* _PREHASH_FetchItems = LLMessageStringTable::getInstance()->getString("FetchItems"); +char* _PREHASH_AbortXfer = LLMessageStringTable::getInstance()->getString("AbortXfer"); +char* _PREHASH_DeRezAck = LLMessageStringTable::getInstance()->getString("DeRezAck"); +char* _PREHASH_TakeControls = LLMessageStringTable::getInstance()->getString("TakeControls"); +char* _PREHASH_DirLandReply = LLMessageStringTable::getInstance()->getString("DirLandReply"); +char* _PREHASH_MuteType = LLMessageStringTable::getInstance()->getString("MuteType"); +char* _PREHASH_IMViaEMail = LLMessageStringTable::getInstance()->getString("IMViaEMail"); +char* _PREHASH_RentPrice = LLMessageStringTable::getInstance()->getString("RentPrice"); +char* _PREHASH_GenericMessage = LLMessageStringTable::getInstance()->getString("GenericMessage"); +char* _PREHASH_ChildAgentAlive = LLMessageStringTable::getInstance()->getString("ChildAgentAlive"); +char* _PREHASH_AssetType = LLMessageStringTable::getInstance()->getString("AssetType"); +char* _PREHASH_SpawnPointBlock = LLMessageStringTable::getInstance()->getString("SpawnPointBlock"); +char* _PREHASH_AttachmentBlock = LLMessageStringTable::getInstance()->getString("AttachmentBlock"); +char* _PREHASH_ObjectMaterial = LLMessageStringTable::getInstance()->getString("ObjectMaterial"); +char* _PREHASH_OwnerName = LLMessageStringTable::getInstance()->getString("OwnerName"); +char* _PREHASH_AvatarNotesReply = LLMessageStringTable::getInstance()->getString("AvatarNotesReply"); +char* _PREHASH_CacheID = LLMessageStringTable::getInstance()->getString("CacheID"); +char* _PREHASH_OwnerMask = LLMessageStringTable::getInstance()->getString("OwnerMask"); +char* _PREHASH_TransferInventoryAck = LLMessageStringTable::getInstance()->getString("TransferInventoryAck"); +char* _PREHASH_RegionDenyAgeUnverified = LLMessageStringTable::getInstance()->getString("RegionDenyAgeUnverified"); +char* _PREHASH_AgeVerificationBlock = LLMessageStringTable::getInstance()->getString("AgeVerificationBlock"); +char* _PREHASH_UCoord = LLMessageStringTable::getInstance()->getString("UCoord"); +char* _PREHASH_VCoord = LLMessageStringTable::getInstance()->getString("VCoord"); +char* _PREHASH_FaceIndex = LLMessageStringTable::getInstance()->getString("FaceIndex"); +char* _PREHASH_StatusData = LLMessageStringTable::getInstance()->getString("StatusData"); +char* _PREHASH_ProductSKU = LLMessageStringTable::getInstance()->getString("ProductSKU"); diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index 4210665a84..08c74d22da 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -2,30 +2,25 @@ * @file message_prehash.h * @brief header file of externs of prehashed variables plus defines. * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -173,6 +168,7 @@ extern char * _PREHASH_UpdateInventoryItem; extern char * _PREHASH_UpdateCreateInventoryItem; extern char * _PREHASH_MoveInventoryItem; extern char * _PREHASH_CopyInventoryItem; +extern char * _PREHASH_LinkInventoryItem; extern char * _PREHASH_RemoveInventoryItem; extern char * _PREHASH_CreateInventoryItem; extern char * _PREHASH_PathTwistBegin; @@ -313,6 +309,7 @@ extern char * _PREHASH_TextColor; extern char * _PREHASH_SlaveID; extern char * _PREHASH_Charter; extern char * _PREHASH_AlertData; +extern char * _PREHASH_AlertInfo; extern char * _PREHASH_TargetBlock; extern char * _PREHASH_CheckParcelAuctions; extern char * _PREHASH_ParcelAuctions; @@ -629,6 +626,8 @@ extern char * _PREHASH_OfferCallingCard; extern char * _PREHASH_AcceptCallingCard; extern char * _PREHASH_DeclineCallingCard; extern char * _PREHASH_AgentAccess; +extern char * _PREHASH_AgentLegacyAccess; +extern char * _PREHASH_AgentMaxAccess; extern char * _PREHASH_DataHomeLocationReply; extern char * _PREHASH_EventLocationReply; extern char * _PREHASH_TerseDateID; @@ -1371,12 +1370,9 @@ extern char * _PREHASH_OwnerMask; extern char * _PREHASH_TransferInventoryAck; extern char * _PREHASH_RegionDenyAgeUnverified; extern char * _PREHASH_AgeVerificationBlock; - - -void init_prehash_data(); - - - - - +extern char * _PREHASH_UCoord; +extern char * _PREHASH_VCoord; +extern char * _PREHASH_FaceIndex; +extern char * _PREHASH_StatusData; +extern char * _PREHASH_ProductSKU; #endif diff --git a/indra/llmessage/message_string_table.cpp b/indra/llmessage/message_string_table.cpp index bc442395d3..dd063fcb83 100644 --- a/indra/llmessage/message_string_table.cpp +++ b/indra/llmessage/message_string_table.cpp @@ -2,30 +2,25 @@ * @file message_string_table.cpp * @brief static string table for message template * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -46,8 +41,6 @@ inline U32 message_hash_my_string(const char *str) } -LLMessageStringTable gMessageStringTable; - LLMessageStringTable::LLMessageStringTable() : mUsed(0) diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp index 50b34148d4..97611c3b51 100644 --- a/indra/llmessage/net.cpp +++ b/indra/llmessage/net.cpp @@ -2,30 +2,25 @@ * @file net.cpp * @brief Cross-platform routines for sending and receiving packets. * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -50,7 +45,6 @@ #endif // linden library includes -#include "network.h" #include "llerror.h" #include "llhost.h" #include "lltimer.h" @@ -80,8 +74,10 @@ typedef int socklen_t; #endif +static U32 gsnReceivingIFAddr = INVALID_HOST_IP_ADDRESS; // Address to which datagram was sent const char* LOOPBACK_ADDRESS_STRING = "127.0.0.1"; +const char* BROADCAST_ADDRESS_STRING = "255.255.255.255"; #if LL_DARWIN // Mac OS X returns an error when trying to set these to 400000. Smaller values succeed. @@ -109,6 +105,16 @@ U32 get_sender_port() return ntohs(stSrcAddr.sin_port); } +LLHost get_receiving_interface() +{ + return LLHost(gsnReceivingIFAddr, INVALID_PORT); +} + +U32 get_receiving_interface_ip(void) +{ + return gsnReceivingIFAddr; +} + const char* u32_to_ip_string(U32 ip) { static char buffer[MAXADDRSTR]; /* Flawfinder: ignore */ @@ -159,7 +165,21 @@ char *u32_to_ip_string(U32 ip, char *ip_string) // Wrapper for inet_addr() U32 ip_string_to_u32(const char* ip_string) { - return inet_addr(ip_string); + // *NOTE: Windows doesn't support inet_aton(), so we are using + // inet_addr(). Unfortunately, INADDR_NONE == INADDR_BROADCAST, so + // we have to check whether the input is a broadcast address before + // deciding that @ip_string is invalid. + // + // Also, our definition of INVALID_HOST_IP_ADDRESS doesn't allow us to + // use wildcard addresses. -Ambroff + U32 ip = inet_addr(ip_string); + if (ip == INADDR_NONE + && strncmp(ip_string, BROADCAST_ADDRESS_STRING, MAXADDRSTR) != 0) + { + llwarns << "ip_string_to_u32() failed, Error: Invalid IP string '" << ip_string << "'" << llendl; + return INVALID_HOST_IP_ADDRESS; + } + return ip; } @@ -185,7 +205,7 @@ S32 start_net(S32& socket_out, int& nPort) { S32 err = WSAGetLastError(); WSACleanup(); - llwarns << "Windows Sockets initialization failed, err " << err << llendl; + LL_WARNS("AppInit") << "Windows Sockets initialization failed, err " << err << LL_ENDL; return 1; } @@ -195,7 +215,7 @@ S32 start_net(S32& socket_out, int& nPort) { S32 err = WSAGetLastError(); WSACleanup(); - llwarns << "socket() failed, err " << err << llendl; + LL_WARNS("AppInit") << "socket() failed, err " << err << LL_ENDL; return 2; } @@ -205,7 +225,7 @@ S32 start_net(S32& socket_out, int& nPort) stLclAddr.sin_port = htons(nPort); S32 attempt_port = nPort; - llinfos << "attempting to connect on port " << attempt_port << llendl; + LL_DEBUGS("AppInit") << "attempting to connect on port " << attempt_port << LL_ENDL; nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr)); if (nRet == SOCKET_ERROR) @@ -219,7 +239,7 @@ S32 start_net(S32& socket_out, int& nPort) attempt_port++) { stLclAddr.sin_port = htons(attempt_port); - llinfos << "trying port " << attempt_port << llendl; + LL_DEBUGS("AppInit") << "trying port " << attempt_port << LL_ENDL; nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr)); if (!(nRet == SOCKET_ERROR && @@ -231,7 +251,7 @@ S32 start_net(S32& socket_out, int& nPort) if (nRet == SOCKET_ERROR) { - llwarns << "startNet() : Couldn't find available network port." << llendl; + LL_WARNS("AppInit") << "startNet() : Couldn't find available network port." << LL_ENDL; // Fail gracefully here in release return 3; } @@ -239,7 +259,7 @@ S32 start_net(S32& socket_out, int& nPort) else // Some other socket error { - llwarns << llformat("bind() port: %d failed, Err: %d\n", nPort, WSAGetLastError()) << llendl; + LL_WARNS("AppInit") << llformat("bind() port: %d failed, Err: %d\n", nPort, WSAGetLastError()) << LL_ENDL; // Fail gracefully in release. return 4; } @@ -250,7 +270,7 @@ S32 start_net(S32& socket_out, int& nPort) getsockname(hSocket, (SOCKADDR*) &socket_address, &socket_address_size); attempt_port = ntohs(socket_address.sin_port); - llinfos << "connected on port " << attempt_port << llendl; + LL_INFOS("AppInit") << "connected on port " << attempt_port << LL_ENDL; nPort = attempt_port; // Set socket to be non-blocking @@ -266,25 +286,24 @@ S32 start_net(S32& socket_out, int& nPort) nRet = setsockopt(hSocket, SOL_SOCKET, SO_RCVBUF, (char *)&rec_size, buff_size); if (nRet) { - llinfos << "Can't set receive buffer size!" << llendl; + LL_INFOS("AppInit") << "Can't set receive buffer size!" << LL_ENDL; } nRet = setsockopt(hSocket, SOL_SOCKET, SO_SNDBUF, (char *)&snd_size, buff_size); if (nRet) { - llinfos << "Can't set send buffer size!" << llendl; + LL_INFOS("AppInit") << "Can't set send buffer size!" << LL_ENDL; } getsockopt(hSocket, SOL_SOCKET, SO_RCVBUF, (char *)&rec_size, &buff_size); getsockopt(hSocket, SOL_SOCKET, SO_SNDBUF, (char *)&snd_size, &buff_size); - llinfos << "startNet - receive buffer size : " << rec_size << llendl; - llinfos << "startNet - send buffer size : " << snd_size << llendl; + LL_DEBUGS("AppInit") << "startNet - receive buffer size : " << rec_size << LL_ENDL; + LL_DEBUGS("AppInit") << "startNet - send buffer size : " << snd_size << LL_ENDL; // Setup a destination address - char achMCAddr[MAXADDRSTR] = " "; /* Flawfinder: ignore */ stDstAddr.sin_family = AF_INET; - stDstAddr.sin_addr.s_addr = inet_addr(achMCAddr); + stDstAddr.sin_addr.s_addr = INVALID_HOST_IP_ADDRESS; stDstAddr.sin_port = htons(nPort); socket_out = hSocket; @@ -383,11 +402,30 @@ S32 start_net(S32& socket_out, int& nPort) return 1; } - // Don't bind() if we want the operating system to assign our ports for - // us. if (NET_USE_OS_ASSIGNED_PORT == nPort) { - // Do nothing; the operating system will do it for us. + // Although bind is not required it will tell us which port we were + // assigned to. + stLclAddr.sin_family = AF_INET; + stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY); + stLclAddr.sin_port = htons(0); + llinfos << "attempting to connect on OS assigned port" << llendl; + nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr)); + if (nRet < 0) + { + llwarns << "Failed to bind on an OS assigned port error: " + << nRet << llendl; + } + else + { + sockaddr_in socket_info; + socklen_t len = sizeof(sockaddr_in); + int err = getsockname(hSocket, (sockaddr*)&socket_info, &len); + llinfos << "Get socket returned: " << err << " length " << len << llendl; + nPort = ntohs(socket_info.sin_port); + llinfos << "Assigned port: " << nPort << llendl; + + } } else { @@ -454,10 +492,25 @@ S32 start_net(S32& socket_out, int& nPort) llinfos << "startNet - receive buffer size : " << rec_size << llendl; llinfos << "startNet - send buffer size : " << snd_size << llendl; +#if LL_LINUX + // Turn on recipient address tracking + { + int use_pktinfo = 1; + if( setsockopt( hSocket, SOL_IP, IP_PKTINFO, &use_pktinfo, sizeof(use_pktinfo) ) == -1 ) + { + llwarns << "No IP_PKTINFO available" << llendl; + } + else + { + llinfos << "IP_PKKTINFO enabled" << llendl; + } + } +#endif + // Setup a destination address char achMCAddr[MAXADDRSTR] = "127.0.0.1"; /* Flawfinder: ignore */ stDstAddr.sin_family = AF_INET; - stDstAddr.sin_addr.s_addr = inet_addr(achMCAddr); + stDstAddr.sin_addr.s_addr = ip_string_to_u32(achMCAddr); stDstAddr.sin_port = htons(nPort); socket_out = hSocket; @@ -472,6 +525,52 @@ void end_net(S32& socket_out) } } +#if LL_LINUX +static int recvfrom_destip( int socket, void *buf, int len, struct sockaddr *from, socklen_t *fromlen, U32 *dstip ) +{ + int size; + struct iovec iov[1]; + char cmsg[CMSG_SPACE(sizeof(struct in_pktinfo))]; + struct cmsghdr *cmsgptr; + struct msghdr msg = {0}; + + iov[0].iov_base = buf; + iov[0].iov_len = len; + + memset( &msg, 0, sizeof msg ); + msg.msg_name = from; + msg.msg_namelen = *fromlen; + msg.msg_iov = iov; + msg.msg_iovlen = 1; + msg.msg_control = &cmsg; + msg.msg_controllen = sizeof(cmsg); + + size = recvmsg( socket, &msg, 0 ); + + if( size == -1 ) + { + return -1; + } + + for( cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL; cmsgptr = CMSG_NXTHDR( &msg, cmsgptr ) ) + { + if( cmsgptr->cmsg_level == SOL_IP && cmsgptr->cmsg_type == IP_PKTINFO ) + { + in_pktinfo *pktinfo = (in_pktinfo *)CMSG_DATA(cmsgptr); + if( pktinfo ) + { + // Two choices. routed and specified. ipi_addr is routed, ipi_spec_dst is + // routed. We should stay with specified until we go to multiple + // interfaces + *dstip = pktinfo->ipi_spec_dst.s_addr; + } + } + } + + return size; +} +#endif + int receive_packet(int hSocket, char * receiveBuffer) { // Receives data asynchronously from the socket set by initNet(). @@ -481,7 +580,14 @@ int receive_packet(int hSocket, char * receiveBuffer) int nRet; socklen_t addr_size = sizeof(struct sockaddr_in); - nRet = recvfrom(hSocket, receiveBuffer, NET_BUFFER_SIZE, 0, (struct sockaddr*)&stSrcAddr, &addr_size); + gsnReceivingIFAddr = INVALID_HOST_IP_ADDRESS; + +#if LL_LINUX + nRet = recvfrom_destip(hSocket, receiveBuffer, NET_BUFFER_SIZE, (struct sockaddr*)&stSrcAddr, &addr_size, &gsnReceivingIFAddr); +#else + int recv_flags = 0; + nRet = recvfrom(hSocket, receiveBuffer, NET_BUFFER_SIZE, recv_flags, (struct sockaddr*)&stSrcAddr, &addr_size); +#endif if (nRet == -1) { @@ -489,6 +595,9 @@ int receive_packet(int hSocket, char * receiveBuffer) return 0; } + // Uncomment for testing if/when implementing for Mac or Windows: + // llinfos << "Received datagram to in addr " << u32_to_ip_string(get_receiving_interface_ip()) << llendl; + return nRet; } diff --git a/indra/llmessage/net.h b/indra/llmessage/net.h index b6fa48d862..9f4f5c5821 100644 --- a/indra/llmessage/net.h +++ b/indra/llmessage/net.h @@ -2,30 +2,25 @@ * @file net.h * @brief Cross platform UDP network code. * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -54,12 +49,15 @@ BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, i LLHost get_sender(); U32 get_sender_port(); U32 get_sender_ip(void); +LLHost get_receiving_interface(); +U32 get_receiving_interface_ip(void); const char* u32_to_ip_string(U32 ip); // Returns pointer to internal string buffer, "(bad IP addr)" on failure, cannot nest calls char* u32_to_ip_string(U32 ip, char *ip_string); // NULL on failure, ip_string on success, you must allocate at least MAXADDRSTR chars U32 ip_string_to_u32(const char* ip_string); // Wrapper for inet_addr() extern const char* LOOPBACK_ADDRESS_STRING; +extern const char* BROADCAST_ADDRESS_STRING; // useful MTU consts diff --git a/indra/llmessage/partsyspacket.cpp b/indra/llmessage/partsyspacket.cpp index d27c0690a5..ad21614258 100644 --- a/indra/llmessage/partsyspacket.cpp +++ b/indra/llmessage/partsyspacket.cpp @@ -3,30 +3,25 @@ * @brief Object for packing particle system initialization parameters * before sending them over the network. * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -143,6 +138,8 @@ LLPartSysCompressedPacket::LLPartSysCompressedPacket() mData[i] = '\0'; } + mNumBytes = 0; + gSetInitDataDefaults(&mDefaults); } diff --git a/indra/llmessage/partsyspacket.h b/indra/llmessage/partsyspacket.h index c7d001c2bf..d9abecea3f 100644 --- a/indra/llmessage/partsyspacket.h +++ b/indra/llmessage/partsyspacket.h @@ -3,30 +3,25 @@ * @brief Object for packing particle system initialization parameters * before sending them over the network * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/patch_code.cpp b/indra/llmessage/patch_code.cpp index cea8635f67..e5d7f19448 100644 --- a/indra/llmessage/patch_code.cpp +++ b/indra/llmessage/patch_code.cpp @@ -2,30 +2,25 @@ * @file patch_code.cpp * @brief Encode patch DCT data into bitcode. * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/patch_code.h b/indra/llmessage/patch_code.h index f8ee39c55a..4c87c9808a 100644 --- a/indra/llmessage/patch_code.h +++ b/indra/llmessage/patch_code.h @@ -2,30 +2,25 @@ * @file patch_code.h * @brief Function declarations for encoding and decoding patches. * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/patch_dct.cpp b/indra/llmessage/patch_dct.cpp index 69f6a2d618..b5518b61ea 100644 --- a/indra/llmessage/patch_dct.cpp +++ b/indra/llmessage/patch_dct.cpp @@ -2,30 +2,25 @@ * @file patch_dct.cpp * @brief DCT patch. * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/patch_dct.h b/indra/llmessage/patch_dct.h index b6e7ba4ef4..101231ec84 100644 --- a/indra/llmessage/patch_dct.h +++ b/indra/llmessage/patch_dct.h @@ -2,30 +2,25 @@ * @file patch_dct.h * @brief Function declarations for DCT and IDCT routines * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/patch_idct.cpp b/indra/llmessage/patch_idct.cpp index 61c10bd871..9ce35df284 100644 --- a/indra/llmessage/patch_idct.cpp +++ b/indra/llmessage/patch_idct.cpp @@ -2,30 +2,25 @@ * @file patch_idct.cpp * @brief IDCT patch. * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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 + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llmessage/sound_ids.cpp b/indra/llmessage/sound_ids.cpp new file mode 100644 index 0000000000..2b8a0807c6 --- /dev/null +++ b/indra/llmessage/sound_ids.cpp @@ -0,0 +1,308 @@ +/** + * @file sound_ids.cpp + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "linden_common.h" + +#include "sound_ids.h" + +#include "lluuid.h" + +const LLUUID SND_NULL = LLUUID::null; +const LLUUID SND_RIDE ("00000000-0000-0000-0000-000000000100"); +const LLUUID SND_SHOT ("00000000-0000-0000-0000-000000000101"); +const LLUUID SND_MORTAR ("00000000-0000-0000-0000-000000000102"); +const LLUUID SND_HIT ("00000000-0000-0000-0000-000000000103"); +const LLUUID SND_EXPLOSION ("00000000-0000-0000-0000-000000000104"); +const LLUUID SND_BOING ("00000000-0000-0000-0000-000000000105"); +const LLUUID SND_OBJECT_CREATE ("9f1bc096-3592-411e-9b0b-c447a9ff054c"); + +// +// Different bird sounds for different states +// + +const LLUUID SND_CHIRP ("00000000-0000-0000-0000-000000000106"); // Flying random chirp +const LLUUID SND_CHIRP2 ("828a9526-175b-455d-8af0-0e3c0fb602b2"); // Spooked by user +const LLUUID SND_CHIRP3 ("f99772d6-1ce6-4a39-a28b-06d26c94c9e3"); // Spooked by object +const LLUUID SND_CHIRP4 ("54472ca4-7fc9-42cb-b7d5-99ad5b12bd50"); // Chasing other bird +const LLUUID SND_CHIRP5 ("2929964f-fac5-40d7-9179-2864a8fa9ace"); // Hopping random chirp +const LLUUID SND_CHIRPDEAD ("9abff1d3-863a-4e04-bd83-3834fd7fcff4"); // Hit by grenade - dead! + + +const LLUUID SND_MUNCH ("00000000-0000-0000-0000-000000000107"); +const LLUUID SND_PUNCH ("00000000-0000-0000-0000-000000000108"); +const LLUUID SND_SPLASH ("00000000-0000-0000-0000-000000000109"); +const LLUUID SND_CLICK ("00000000-0000-0000-0000-000000000110"); +const LLUUID SND_WHISTLE ("ab858f9a-1f44-4d39-9b33-351543d03ccb"); +const LLUUID SND_TYPING ("5e191c7b-8996-9ced-a177-b2ac32bfea06"); + +const LLUUID SND_ARROW_SHOT ("00000000-0000-0000-0000-000000000111"); +const LLUUID SND_ARROW_THUD ("00000000-0000-0000-0000-000000000112"); +const LLUUID SND_LASER_SHOT ("00000000-0000-0000-0000-000000000113"); +const LLUUID SND_JET_THRUST ("67f5e4f0-0534-4d97-bc01-f297648d20e0"); + +const LLUUID SND_SILENCE ("00000000-0000-0000-0000-000000000114"); +const LLUUID SND_BUBBLES ("00000000-0000-0000-0000-000000000115"); +const LLUUID SND_WELCOME ("00000000-0000-0000-0000-000000000116"); +const LLUUID SND_SQUISH ("00000000-0000-0000-0000-000000000117"); +const LLUUID SND_SUBPOD ("00000000-0000-0000-0000-000000000118"); +const LLUUID SND_FOOTSTEPS ("00000000-0000-0000-0000-000000000119"); +const LLUUID SND_STEP_LEFT ("00000000-0000-0000-0000-000000000124"); +const LLUUID SND_STEP_RIGHT ("00000000-0000-0000-0000-000000000125"); + +const LLUUID SND_BALL_COLLISION ("00000000-0000-0000-0000-000000000120"); + +const LLUUID SND_OOOH_SCARE_ME ("00000000-0000-0000-0000-000000000121"); +const LLUUID SND_PAYBACK_TIME ("00000000-0000-0000-0000-000000000122"); +const LLUUID SND_READY_FOR_BATTLE ("00000000-0000-0000-0000-000000000123"); + +const LLUUID SND_FLESH_FLESH ("dce5fdd4-afe4-4ea1-822f-dd52cac46b08"); +const LLUUID SND_FLESH_PLASTIC ("51011582-fbca-4580-ae9e-1a5593f094ec"); +const LLUUID SND_FLESH_RUBBER ("68d62208-e257-4d0c-bbe2-20c9ea9760bb"); +const LLUUID SND_GLASS_FLESH ("75872e8c-bc39-451b-9b0b-042d7ba36cba"); +const LLUUID SND_GLASS_GLASS ("6a45ba0b-5775-4ea8-8513-26008a17f873"); +const LLUUID SND_GLASS_PLASTIC ("992a6d1b-8c77-40e0-9495-4098ce539694"); +const LLUUID SND_GLASS_RUBBER ("2de4da5a-faf8-46be-bac6-c4d74f1e5767"); +const LLUUID SND_GLASS_WOOD ("6e3fb0f7-6d9c-42ca-b86b-1122ff562d7d"); +const LLUUID SND_METAL_FLESH ("14209133-4961-4acc-9649-53fc38ee1667"); +const LLUUID SND_METAL_GLASS ("bc4a4348-cfcc-4e5e-908e-8a52a8915fe6"); +const LLUUID SND_METAL_METAL ("9e5c1297-6eed-40c0-825a-d9bcd86e3193"); +const LLUUID SND_METAL_PLASTIC ("e534761c-1894-4b61-b20c-658a6fb68157"); +const LLUUID SND_METAL_RUBBER ("8761f73f-6cf9-4186-8aaa-0948ed002db1"); +const LLUUID SND_METAL_WOOD ("874a26fd-142f-4173-8c5b-890cd846c74d"); +const LLUUID SND_PLASTIC_PLASTIC ("0e24a717-b97e-4b77-9c94-b59a5a88b2da"); +const LLUUID SND_RUBBER_PLASTIC ("75cf3ade-9a5b-4c4d-bb35-f9799bda7fb2"); +const LLUUID SND_RUBBER_RUBBER ("153c8bf7-fb89-4d89-b263-47e58b1b4774"); +const LLUUID SND_STONE_FLESH ("55c3e0ce-275a-46fa-82ff-e0465f5e8703"); +const LLUUID SND_STONE_GLASS ("24babf58-7156-4841-9a3f-761bdbb8e237"); +const LLUUID SND_STONE_METAL ("aca261d8-e145-4610-9e20-9eff990f2c12"); +const LLUUID SND_STONE_PLASTIC ("0642fba6-5dcf-4d62-8e7b-94dbb529d117"); +const LLUUID SND_STONE_RUBBER ("25a863e8-dc42-4e8a-a357-e76422ace9b5"); +const LLUUID SND_STONE_STONE ("9538f37c-456e-4047-81be-6435045608d4"); +const LLUUID SND_STONE_WOOD ("8c0f84c3-9afd-4396-b5f5-9bca2c911c20"); +const LLUUID SND_WOOD_FLESH ("be582e5d-b123-41a2-a150-454c39e961c8"); +const LLUUID SND_WOOD_PLASTIC ("c70141d4-ba06-41ea-bcbc-35ea81cb8335"); +const LLUUID SND_WOOD_RUBBER ("7d1826f4-24c4-4aac-8c2e-eff45df37783"); +const LLUUID SND_WOOD_WOOD ("063c97d3-033a-4e9b-98d8-05c8074922cb"); + + +const LLUUID SND_SLIDE_FLESH_FLESH ("614eec22-f73d-4fdc-8691-a37dc5c58333"); +const LLUUID SND_SLIDE_FLESH_PLASTIC (SND_NULL); +const LLUUID SND_SLIDE_FLESH_RUBBER (SND_NULL); +const LLUUID SND_SLIDE_FLESH_FABRIC ("3678b9b9-2a0c-42b5-9c83-80b64ad6e898"); +const LLUUID SND_SLIDE_FLESH_GRAVEL ("02eaa42a-ce1a-4b6b-9c38-cd7ad0e8f4a6"); +const LLUUID SND_SLIDE_FLESH_GRAVEL_02 ("e7d3b501-79f8-4419-b842-ab6843e0f840"); +const LLUUID SND_SLIDE_FLESH_GRAVEL_03 ("4c3e8b52-6244-4e44-85a6-f4ab994418ed"); +const LLUUID SND_SLIDE_GLASS_GRAVEL ("ca491e77-5c47-4ea1-8021-b3ebbf636cab"); +const LLUUID SND_SLIDE_GLASS_GRAVEL_02 ("30794d49-91ce-48e3-a527-c06f67bd6cbe"); +const LLUUID SND_SLIDE_GLASS_GRAVEL_03 ("04c78e54-fd8d-46b6-8ab9-7678b5d6e5cb"); +const LLUUID SND_SLIDE_GLASS_FLESH (SND_NULL); +const LLUUID SND_SLIDE_GLASS_GLASS (SND_NULL); +const LLUUID SND_SLIDE_GLASS_PLASTIC (SND_NULL); +const LLUUID SND_SLIDE_GLASS_RUBBER (SND_NULL); +const LLUUID SND_SLIDE_GLASS_WOOD (SND_NULL); +const LLUUID SND_SLIDE_METAL_FABRIC ("18b66e81-2958-42d4-a373-7a5054919adc"); +const LLUUID SND_SLIDE_METAL_FLESH ("dde65837-633c-4841-af2f-62ec471bf61e"); +const LLUUID SND_SLIDE_METAL_FLESH_02 ("f3cc2cbe-1a1a-4db7-a8d2-e9c8f8fa1f4f"); +const LLUUID SND_SLIDE_METAL_GLASS ("4188be39-7b1f-4495-bf2b-83ddd82eea05"); +const LLUUID SND_SLIDE_METAL_GLASS_02 ("336faa2b-9d96-4e14-93ad-b63b60074379"); +const LLUUID SND_SLIDE_METAL_GLASS_03 ("34d912aa-cf73-4462-b7d0-dcba2c66caba"); +const LLUUID SND_SLIDE_METAL_GLASS_04 ("97ffc063-e872-4469-8e95-1450ac6bad2b"); +const LLUUID SND_SLIDE_METAL_GRAVEL ("2bbff37d-009a-4cfc-9a0d-817652c08fbe"); +const LLUUID SND_SLIDE_METAL_GRAVEL_02 ("a906a228-783b-49e7-9f0a-e20a41d0e39f"); +const LLUUID SND_SLIDE_METAL_METAL ("09461277-c691-45de-b2c5-89dfd3712f79"); +const LLUUID SND_SLIDE_METAL_METAL_02 ("e00a5d97-8fdc-46c1-bd53-7e312727466c"); +const LLUUID SND_SLIDE_METAL_METAL_03 ("8ebfa780-c440-4b52-ab65-5edf3bc15bf1"); +const LLUUID SND_SLIDE_METAL_METAL_04 ("d6d03cb2-5b16-4e31-b7d4-2a81d2a0909b"); +const LLUUID SND_SLIDE_METAL_METAL_05 ("3a46f447-916e-47de-a1e5-95d1af46bd0f"); +const LLUUID SND_SLIDE_METAL_METAL_06 ("cd423231-e70d-4fd2-ad26-f1c6cf5f0610"); +const LLUUID SND_SLIDE_METAL_PLASTIC (SND_NULL); +const LLUUID SND_SLIDE_METAL_RUBBER ("12d97bc0-3c15-4744-b6bd-77d1316eb4f0"); +const LLUUID SND_SLIDE_METAL_WOOD ("4afb6926-a73f-4cb7-85d5-0f9a40107434"); +const LLUUID SND_SLIDE_METAL_WOOD_02 ("349970bf-187d-4bcb-b2cf-e7bb6581590f"); +const LLUUID SND_SLIDE_METAL_WOOD_03 ("64bf6e87-73d4-4cb4-84f7-55cecfd97cd3"); +const LLUUID SND_SLIDE_METAL_WOOD_04 ("0dc670a9-dbe8-41bc-b8ee-4d96d99219d5"); +const LLUUID SND_SLIDE_METAL_WOOD_05 ("6e3cc57b-c9aa-4829-86a1-8e82aeaccb47"); +const LLUUID SND_SLIDE_METAL_WOOD_06 ("c1237f4c-8c88-4da1-bfbc-2af26a8d9e5a"); +const LLUUID SND_SLIDE_METAL_WOOD_07 ("0e1ec243-063b-4dcb-a903-52b8dffed3d2"); +const LLUUID SND_SLIDE_METAL_WOOD_08 ("66736d0f-533d-4007-a8ee-0f27c2034126"); +const LLUUID SND_SLIDE_PLASTIC_GRAVEL ("35092c21-5c48-4b4d-a818-3cf240af2348"); +const LLUUID SND_SLIDE_PLASTIC_GRAVEL_02("c37f5776-0020-47e8-89a0-c74cc6f5742d"); +const LLUUID SND_SLIDE_PLASTIC_GRAVEL_03("d2fc8db6-2e66-464a-8ccb-f99b61ee4987"); +const LLUUID SND_SLIDE_PLASTIC_GRAVEL_04("93cbdb10-6e82-4c0b-a547-7b3b79ac25f6"); +const LLUUID SND_SLIDE_PLASTIC_GRAVEL_05("2f6d0542-fcd1-4264-a17b-f57bf5ebf402"); +const LLUUID SND_SLIDE_PLASTIC_GRAVEL_06("5b8887d4-3be2-45a0-b25d-85af3b1e6392"); +const LLUUID SND_SLIDE_PLASTIC_PLASTIC (SND_NULL); +const LLUUID SND_SLIDE_PLASTIC_PLASTIC_02 (SND_NULL); +const LLUUID SND_SLIDE_PLASTIC_PLASTIC_03 (SND_NULL); +const LLUUID SND_SLIDE_PLASTIC_FABRIC ("7294d9ad-3e41-4373-992c-a9f21d5d66ad"); +const LLUUID SND_SLIDE_PLASTIC_FABRIC_02("58608ce1-f524-472f-b447-bbe6ce4a46e0"); +const LLUUID SND_SLIDE_PLASTIC_FABRIC_03("06ae285e-0b34-4ea6-84ab-9c6c31b414fc"); +const LLUUID SND_SLIDE_PLASTIC_FABRIC_04("211613db-0461-49bd-9554-5c14ad8b31f6"); +const LLUUID SND_SLIDE_RUBBER_PLASTIC ("a98ffa5a-e48e-4f9d-9242-b9a3210ad84a"); +const LLUUID SND_SLIDE_RUBBER_PLASTIC_02 ("d4136c40-eeaa-49c6-a982-8e5a16f5d93a"); +const LLUUID SND_SLIDE_RUBBER_PLASTIC_03 ("29ec0fb2-0b23-47b2-835b-c83cc7cf9fb0"); +const LLUUID SND_SLIDE_RUBBER_RUBBER (SND_NULL); +const LLUUID SND_SLIDE_STONE_FLESH (SND_NULL); +const LLUUID SND_SLIDE_STONE_GLASS (SND_NULL); +const LLUUID SND_SLIDE_STONE_METAL (SND_NULL); +const LLUUID SND_SLIDE_STONE_PLASTIC ("afd0bcc3-d41a-4572-9e7f-08a29eeb0b8a"); +const LLUUID SND_SLIDE_STONE_PLASTIC_02 ("881b720a-96cf-4128-bb98-5d87e03e93c7"); +const LLUUID SND_SLIDE_STONE_PLASTIC_03 ("293dac42-658a-4c5a-a7a2-6d4c5e5658b0"); +const LLUUID SND_SLIDE_STONE_RUBBER ("0724b946-6a3f-4eeb-bb50-0a3b33120974"); +const LLUUID SND_SLIDE_STONE_RUBBER_02 ("ada93d00-76e2-4bf1-9ad9-493727630717"); +const LLUUID SND_SLIDE_STONE_STONE ("ade766dc-2e75-4699-9b41-7c8e53d2b3f2"); +const LLUUID SND_SLIDE_STONE_STONE_02 ("66698375-6594-47b0-8046-c3973de1291d"); +const LLUUID SND_SLIDE_STONE_WOOD ("174ef324-ed50-4f65-9479-b4da580aeb3c"); +const LLUUID SND_SLIDE_STONE_WOOD_02 ("33d517fd-ff11-4d01-a7b5-0e3abf818dcf"); +const LLUUID SND_SLIDE_STONE_WOOD_03 ("1bac4b63-e6fd-4659-9761-991284cf4582"); +const LLUUID SND_SLIDE_STONE_WOOD_04 ("a7d28564-6821-4c01-a378-cde98fba7ba9"); +const LLUUID SND_SLIDE_WOOD_FABRIC ("22c58e74-22cd-4960-9ab7-5bf08ab824e5"); +const LLUUID SND_SLIDE_WOOD_FABRIC_02 ("0b0ed22e-4a0f-4617-a4cf-20d0f2b78ccc"); +const LLUUID SND_SLIDE_WOOD_FABRIC_03 ("42b80abb-9823-4b74-a210-326ccf23636a"); +const LLUUID SND_SLIDE_WOOD_FABRIC_04 ("8538298a-1e6b-4b69-a9ee-5e01e4a02b35"); +const LLUUID SND_SLIDE_WOOD_FLESH ("84b026f3-a11c-4366-aa7c-07edcd89b2bb"); +const LLUUID SND_SLIDE_WOOD_FLESH_02 ("2644191f-4848-47ba-8ba7-bddc0bfcb3da"); +const LLUUID SND_SLIDE_WOOD_FLESH_03 ("edb978e4-9be9-456f-b2fc-e8502bfe25be"); +const LLUUID SND_SLIDE_WOOD_FLESH_04 ("bf2b972e-f42a-46d7-b53e-5fca38f5bc61"); +const LLUUID SND_SLIDE_WOOD_GRAVEL ("d063bb4d-0eff-4403-a6cc-c6c6c073e624"); +const LLUUID SND_SLIDE_WOOD_GRAVEL_02 ("511eb679-6d93-47fa-9141-c3ef9261c919"); +const LLUUID SND_SLIDE_WOOD_GRAVEL_03 ("4ed1fd43-4707-4e5c-b7b7-21ec4e72c1ac"); +const LLUUID SND_SLIDE_WOOD_GRAVEL_04 ("99ea89b3-aa76-4b87-99c8-670365c6d8c3"); +const LLUUID SND_SLIDE_WOOD_PLASTIC ("505ca3c4-94a0-4e28-8fc1-ea72a428396b"); +const LLUUID SND_SLIDE_WOOD_PLASTIC_02 ("fc404011-df71-4ed0-8f22-b72bdd18f63c"); +const LLUUID SND_SLIDE_WOOD_PLASTIC_03 ("67dbe225-26df-4efa-8c8b-f1ef669fec45"); +const LLUUID SND_SLIDE_WOOD_RUBBER (SND_NULL); +const LLUUID SND_SLIDE_WOOD_WOOD ("3079d569-b3e8-4df4-9e09-f0d4611213ef"); +const LLUUID SND_SLIDE_WOOD_WOOD_02 ("276b093d-dbcb-4279-a89e-a54b0b416af6"); +const LLUUID SND_SLIDE_WOOD_WOOD_03 ("c3f3ca5e-2768-4081-847f-247139310fdb"); +const LLUUID SND_SLIDE_WOOD_WOOD_04 ("f08d44b8-ff87-4a98-9561-c72f1f2fec81"); +const LLUUID SND_SLIDE_WOOD_WOOD_05 ("2d8a58cf-f139-4238-8503-27d334d05c85"); +const LLUUID SND_SLIDE_WOOD_WOOD_06 ("e157ebbd-b12d-4225-aa7c-d47b026a7687"); +const LLUUID SND_SLIDE_WOOD_WOOD_07 ("35e17956-e7b4-478c-b274-e37db8a166b2"); +const LLUUID SND_SLIDE_WOOD_WOOD_08 ("e606fc65-0643-4964-9979-ff964fa6a62c"); + + +const LLUUID SND_ROLL_FLESH_FLESH (SND_NULL); +const LLUUID SND_ROLL_FLESH_PLASTIC ("89a0be4c-848d-4a6e-8886-298f56c2cff4"); +const LLUUID SND_ROLL_FLESH_PLASTIC_02 ("beb06343-1aa1-4af2-b320-5d2ec31c53b1"); +const LLUUID SND_ROLL_FLESH_RUBBER (SND_NULL); +const LLUUID SND_ROLL_GLASS_GRAVEL ("ba795c74-7e09-4572-b495-e09886a46b86"); +const LLUUID SND_ROLL_GLASS_GRAVEL_02 ("4c93c3b7-14cb-4d9b-a7df-628ad935f1f2"); +const LLUUID SND_ROLL_GLASS_FLESH (SND_NULL); +const LLUUID SND_ROLL_GLASS_GLASS (SND_NULL); +const LLUUID SND_ROLL_GLASS_PLASTIC (SND_NULL); +const LLUUID SND_ROLL_GLASS_RUBBER (SND_NULL); +const LLUUID SND_ROLL_GLASS_WOOD ("d40b1f48-a061-4f6e-b18f-4326a3dd5c29"); +const LLUUID SND_ROLL_GLASS_WOOD_02 ("78cd407a-bb36-4163-ba09-20f2e6d9d44b"); +const LLUUID SND_ROLL_GRAVEL_GRAVEL ("c7354cc3-6df5-4738-8dbb-b28a6ac46a05"); +const LLUUID SND_ROLL_GRAVEL_GRAVEL_02 ("01d194c4-72a6-47df-81a5-8db430faff87"); +const LLUUID SND_ROLL_METAL_FABRIC ("ce6e6564-20fd-48e4-81e2-cd3f81c00a3e"); +const LLUUID SND_ROLL_METAL_FABRIC_02 ("fc4d0065-32f6-4bb0-9f3f-f4737eb27163"); +const LLUUID SND_ROLL_METAL_FLESH (SND_NULL); +const LLUUID SND_ROLL_METAL_GLASS ("63d530bb-a41f-402b-aa1f-be6b11959809"); +const LLUUID SND_ROLL_METAL_GLASS_02 ("f62642c2-6db5-4faa-8b77-939067d837c3"); +const LLUUID SND_ROLL_METAL_GLASS_03 ("db5b5a15-2817-4cd7-9f0b-9ad49b5e52c8"); +const LLUUID SND_ROLL_METAL_GRAVEL ("447164e3-9646-4c1a-a16d-606892891466"); +const LLUUID SND_ROLL_METAL_METAL ("c3c22cf3-5d1f-4cc3-b4b5-708b9f65979c"); +const LLUUID SND_ROLL_METAL_METAL_02 ("d8386277-a1ea-460e-b6fd-bb285c323bf1"); +const LLUUID SND_ROLL_METAL_METAL_03 ("69ee1f02-f9cd-4c8b-aedd-39a2d6705680"); +const LLUUID SND_ROLL_METAL_METAL_04 ("5cc6b5fd-26ce-47ad-b21d-3a7c190dd375"); +const LLUUID SND_ROLL_METAL_PLASTIC ("c6a9bbf6-df15-4713-9f84-7237fce4051e"); +const LLUUID SND_ROLL_METAL_PLASTIC_01 ("0fedb59b-2dbb-4cec-b6cc-8559ec027749"); +const LLUUID SND_ROLL_METAL_RUBBER (SND_NULL); +const LLUUID SND_ROLL_METAL_WOOD ("1d76af57-01b1-4c73-9a1d-69523bfa50ea"); +const LLUUID SND_ROLL_METAL_WOOD_02 ("78aa4e71-8e7c-4b90-a561-3ebdc639f99b"); +const LLUUID SND_ROLL_METAL_WOOD_03 ("777d95bf-962f-48fa-93bf-8c1806557d72"); +const LLUUID SND_ROLL_METAL_WOOD_04 ("1833da76-45e2-4a8b-97da-d17413e056c9"); +const LLUUID SND_ROLL_METAL_WOOD_05 ("b13e1232-3d8d-42e9-92ec-b30f9f823962"); +const LLUUID SND_ROLL_PLASTIC_FABRIC ("616a1f03-209f-4c55-b264-83a000b6ef0a"); +const LLUUID SND_ROLL_PLASTIC_PLASTIC ("873f3d82-00b2-4082-9c69-7aef3461dba1"); +const LLUUID SND_ROLL_PLASTIC_PLASTIC_02 ("cc39879f-ebc8-4405-a4fc-8342f5bed31e"); +const LLUUID SND_ROLL_RUBBER_PLASTIC (SND_NULL); +const LLUUID SND_ROLL_RUBBER_RUBBER (SND_NULL); +const LLUUID SND_ROLL_STONE_FLESH (SND_NULL); +const LLUUID SND_ROLL_STONE_GLASS (SND_NULL); +const LLUUID SND_ROLL_STONE_METAL (SND_NULL); +const LLUUID SND_ROLL_STONE_PLASTIC ("155f65a8-cae7-476e-a58b-fd362be7fd0e"); +const LLUUID SND_ROLL_STONE_RUBBER (SND_NULL); +const LLUUID SND_ROLL_STONE_STONE ("67d56e3f-6ed5-4658-9418-14f020c38b11"); +const LLUUID SND_ROLL_STONE_STONE_02 ("43d99d10-d75b-4246-accf-4ceb2c909aa7"); +const LLUUID SND_ROLL_STONE_STONE_03 ("f04e83ff-eed7-4e99-8f45-eb97e4e1d3b7"); +const LLUUID SND_ROLL_STONE_STONE_04 ("10fcc5ad-fa89-48d6-b774-986b580c1efc"); +const LLUUID SND_ROLL_STONE_STONE_05 ("3d86f5a3-1a91-49d9-b99f-8521a7422497"); +const LLUUID SND_ROLL_STONE_WOOD ("53e46fb7-6c21-4fe1-bffe-0567475d48fa"); +const LLUUID SND_ROLL_STONE_WOOD_02 ("5eba8c9a-a014-4299-87f1-315c45ec795b"); +const LLUUID SND_ROLL_STONE_WOOD_03 ("ea6c05fc-6e9c-4526-8a20-bc47810bb549"); +const LLUUID SND_ROLL_STONE_WOOD_04 ("64618cbf-3f42-4728-8094-e77807545efb"); +const LLUUID SND_ROLL_WOOD_FLESH ("26ee185d-6fc3-49f8-89ba-51cab04cfc42"); +const LLUUID SND_ROLL_WOOD_FLESH_02 ("334faa25-1e80-4c99-b29f-4c9c2a3d079d"); +const LLUUID SND_ROLL_WOOD_FLESH_03 ("2f876626-4dce-4f71-a91e-a25302edfab7"); +const LLUUID SND_ROLL_WOOD_FLESH_04 ("d6877aac-07fc-4931-bcde-585f223802ad"); +const LLUUID SND_ROLL_WOOD_GRAVEL ("2a23ebb5-a4a2-4f1f-8d75-7384239354aa"); +const LLUUID SND_ROLL_WOOD_GRAVEL_02 ("208bf26d-f097-450c-95c4-9d26317c613c"); +const LLUUID SND_ROLL_WOOD_GRAVEL_03 ("a26ecaf4-92c6-4e32-9864-56b7c70cab8e"); +const LLUUID SND_ROLL_WOOD_PLASTIC ("71c1000a-9f16-4cc3-8ede-ec4aa3bf5723"); +const LLUUID SND_ROLL_WOOD_PLASTIC_02 ("7bc20ba6-1e6d-4eea-83ad-c5cc3ae0e409"); +const LLUUID SND_ROLL_WOOD_RUBBER (SND_NULL); +const LLUUID SND_ROLL_WOOD_WOOD ("2cc8eec4-bb4a-4ba8-b783-71526ec708e8"); +const LLUUID SND_ROLL_WOOD_WOOD_02 ("0a1f8070-a11a-4b4c-b260-5ffb6acb0a5d"); +const LLUUID SND_ROLL_WOOD_WOOD_03 ("160bef64-da9c-4be8-b07b-a5060b501700"); +const LLUUID SND_ROLL_WOOD_WOOD_04 ("1c62ea16-cc60-48ed-829a-68b8f4cf0c1c"); +const LLUUID SND_ROLL_WOOD_WOOD_05 ("be9cc8fe-b920-4bf5-8924-453088cbc03f"); +const LLUUID SND_ROLL_WOOD_WOOD_06 ("a76cfe60-56b0-43b1-8f31-93e56947d78b"); +const LLUUID SND_ROLL_WOOD_WOOD_07 ("0c6aa481-b5bc-4573-ae83-8e16ff27e750"); +const LLUUID SND_ROLL_WOOD_WOOD_08 ("214ab2c7-871a-451b-b0db-4c5677199011"); +const LLUUID SND_ROLL_WOOD_WOOD_09 ("0086e4db-3ac6-4545-b414-6f359bedd9a5"); + +const LLUUID SND_SLIDE_STONE_STONE_01 ("2a7dcbd1-d3e6-4767-8432-8322648e7b9d"); + +const LLUUID SND_STONE_DIRT_01 ("97727335-392c-4338-ac4b-23a7883279c2"); +const LLUUID SND_STONE_DIRT_02 ("cbe75eb2-3375-41d8-9e3f-2ae46b4164ed"); +const LLUUID SND_STONE_DIRT_03 ("31e236ee-001b-4c8e-ad6c-c2074cb64357"); +const LLUUID SND_STONE_DIRT_04 ("c8091652-e04b-4a11-84ba-15dba06e7a1b"); + +const LLUUID SND_STONE_STONE_02 ("ba4ef5ac-7435-4240-b826-c24ba8fa5a78"); +const LLUUID SND_STONE_STONE_04 ("ea296329-0f09-4993-af1b-e6784bab1dc9"); + + + +// extra guids +#if 0 +const LLUUID SND_ ("a839b8ac-b0af-4ba9-9fde-188754744e02"); +const LLUUID SND_ ("20165fa8-836f-4993-85dc-1529172dcd14"); +const LLUUID SND_ ("fba8e17b-a4b3-4693-9fce-c14800f8a349"); +const LLUUID SND_ ("2d48db8b-7260-4b02-ad2a-b2c6bee60e94"); +const LLUUID SND_ ("956d344b-1808-4d8b-88b1-cbc82b7a96a1"); +const LLUUID SND_ ("b8303cc6-f0b4-4c6f-a199-81f87aba342e"); +const LLUUID SND_ ("fbf7cd0c-bc8f-4cba-9c19-11f4dd03a06b"); +const LLUUID SND_ ("85047f7d-933a-4ce5-a7b5-34670243e1ab"); +const LLUUID SND_ ("0f81acf7-6a2e-4490-957f-c7b0eda00559"); +const LLUUID SND_ ("5631a6a1-79b4-4de8-bccf-1880b6882da1"); +const LLUUID SND_ ("43c87a6b-ffb2-437b-89a0-9deba890a4fc"); +const LLUUID SND_ ("58878d1d-3156-4d01-ac3c-0c4fb99f4d53"); +const LLUUID SND_ ("9a83f321-44bf-40f6-b006-46c085515345"); +const LLUUID SND_ ("ff144533-33ab-40f2-bac8-39c34699ecc4"); +const LLUUID SND_ ("09018e87-d52c-4cd5-9805-015f413319e7"); +const LLUUID SND_ ("17d4c057-7edd-401e-9589-d5b9fe981bf2"); +#endif diff --git a/indra/llmessage/sound_ids.h b/indra/llmessage/sound_ids.h index a8efdaee44..6a2e343ad3 100644 --- a/indra/llmessage/sound_ids.h +++ b/indra/llmessage/sound_ids.h @@ -2,315 +2,288 @@ * @file sound_ids.h * @brief Temporary holder for sound IDs. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * 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 + * Copyright (C) 2010, Linden Research, Inc. * - * 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 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #ifndef LL_SOUND_IDS_H #define LL_SOUND_IDS_H -#include "lluuid.h" - -const LLUUID SND_NULL = LLUUID::null; -const LLUUID SND_RIDE ("00000000-0000-0000-0000-000000000100"); -const LLUUID SND_SHOT ("00000000-0000-0000-0000-000000000101"); -const LLUUID SND_MORTAR ("00000000-0000-0000-0000-000000000102"); -const LLUUID SND_HIT ("00000000-0000-0000-0000-000000000103"); -const LLUUID SND_EXPLOSION ("00000000-0000-0000-0000-000000000104"); -const LLUUID SND_BOING ("00000000-0000-0000-0000-000000000105"); -const LLUUID SND_OBJECT_CREATE ("9f1bc096-3592-411e-9b0b-c447a9ff054c"); - -// -// Different bird sounds for different states -// - -const LLUUID SND_CHIRP ("00000000-0000-0000-0000-000000000106"); // Flying random chirp -const LLUUID SND_CHIRP2 ("828a9526-175b-455d-8af0-0e3c0fb602b2"); // Spooked by user -const LLUUID SND_CHIRP3 ("f99772d6-1ce6-4a39-a28b-06d26c94c9e3"); // Spooked by object -const LLUUID SND_CHIRP4 ("54472ca4-7fc9-42cb-b7d5-99ad5b12bd50"); // Chasing other bird -const LLUUID SND_CHIRP5 ("2929964f-fac5-40d7-9179-2864a8fa9ace"); // Hopping random chirp -const LLUUID SND_CHIRPDEAD ("9abff1d3-863a-4e04-bd83-3834fd7fcff4"); // Hit by grenade - dead! +// *NOTE: Do not put the actual IDs in this file - otherwise the symbols +// and values will be copied into every .o/.obj file and increase link time. +class LLUUID; -const LLUUID SND_MUNCH ("00000000-0000-0000-0000-000000000107"); -const LLUUID SND_PUNCH ("00000000-0000-0000-0000-000000000108"); -const LLUUID SND_SPLASH ("00000000-0000-0000-0000-000000000109"); -const LLUUID SND_CLICK ("00000000-0000-0000-0000-000000000110"); -const LLUUID SND_WHISTLE ("ab858f9a-1f44-4d39-9b33-351543d03ccb"); -const LLUUID SND_TYPING ("5e191c7b-8996-9ced-a177-b2ac32bfea06"); +extern const LLUUID SND_NULL; +extern const LLUUID SND_RIDE; +extern const LLUUID SND_SHOT; +extern const LLUUID SND_MORTAR; +extern const LLUUID SND_HIT; +extern const LLUUID SND_EXPLOSION; +extern const LLUUID SND_BOING; +extern const LLUUID SND_OBJECT_CREATE; -const LLUUID SND_ARROW_SHOT ("00000000-0000-0000-0000-000000000111"); -const LLUUID SND_ARROW_THUD ("00000000-0000-0000-0000-000000000112"); -const LLUUID SND_LASER_SHOT ("00000000-0000-0000-0000-000000000113"); -const LLUUID SND_JET_THRUST ("67f5e4f0-0534-4d97-bc01-f297648d20e0"); +// Different bird sounds for different states +extern const LLUUID SND_CHIRP; // Flying random chirp +extern const LLUUID SND_CHIRP2; // Spooked by user +extern const LLUUID SND_CHIRP3; // Spooked by object +extern const LLUUID SND_CHIRP4; // Chasing other bird +extern const LLUUID SND_CHIRP5; // Hopping random chirp +extern const LLUUID SND_CHIRPDEAD; // Hit by grenade - dead! -const LLUUID SND_SILENCE ("00000000-0000-0000-0000-000000000114"); -const LLUUID SND_BUBBLES ("00000000-0000-0000-0000-000000000115"); -const LLUUID SND_WELCOME ("00000000-0000-0000-0000-000000000116"); -const LLUUID SND_SQUISH ("00000000-0000-0000-0000-000000000117"); -const LLUUID SND_SUBPOD ("00000000-0000-0000-0000-000000000118"); -const LLUUID SND_FOOTSTEPS ("00000000-0000-0000-0000-000000000119"); -const LLUUID SND_STEP_LEFT ("00000000-0000-0000-0000-000000000124"); -const LLUUID SND_STEP_RIGHT ("00000000-0000-0000-0000-000000000125"); -const LLUUID SND_BALL_COLLISION ("00000000-0000-0000-0000-000000000120"); +extern const LLUUID SND_MUNCH; +extern const LLUUID SND_PUNCH; +extern const LLUUID SND_SPLASH; +extern const LLUUID SND_CLICK; +extern const LLUUID SND_WHISTLE; +extern const LLUUID SND_TYPING; -const LLUUID SND_OOOH_SCARE_ME ("00000000-0000-0000-0000-000000000121"); -const LLUUID SND_PAYBACK_TIME ("00000000-0000-0000-0000-000000000122"); -const LLUUID SND_READY_FOR_BATTLE ("00000000-0000-0000-0000-000000000123"); +extern const LLUUID SND_ARROW_SHOT; +extern const LLUUID SND_ARROW_THUD; +extern const LLUUID SND_LASER_SHOT; +extern const LLUUID SND_JET_THRUST; -const LLUUID SND_FLESH_FLESH ("dce5fdd4-afe4-4ea1-822f-dd52cac46b08"); -const LLUUID SND_FLESH_PLASTIC ("51011582-fbca-4580-ae9e-1a5593f094ec"); -const LLUUID SND_FLESH_RUBBER ("68d62208-e257-4d0c-bbe2-20c9ea9760bb"); -const LLUUID SND_GLASS_FLESH ("75872e8c-bc39-451b-9b0b-042d7ba36cba"); -const LLUUID SND_GLASS_GLASS ("6a45ba0b-5775-4ea8-8513-26008a17f873"); -const LLUUID SND_GLASS_PLASTIC ("992a6d1b-8c77-40e0-9495-4098ce539694"); -const LLUUID SND_GLASS_RUBBER ("2de4da5a-faf8-46be-bac6-c4d74f1e5767"); -const LLUUID SND_GLASS_WOOD ("6e3fb0f7-6d9c-42ca-b86b-1122ff562d7d"); -const LLUUID SND_METAL_FLESH ("14209133-4961-4acc-9649-53fc38ee1667"); -const LLUUID SND_METAL_GLASS ("bc4a4348-cfcc-4e5e-908e-8a52a8915fe6"); -const LLUUID SND_METAL_METAL ("9e5c1297-6eed-40c0-825a-d9bcd86e3193"); -const LLUUID SND_METAL_PLASTIC ("e534761c-1894-4b61-b20c-658a6fb68157"); -const LLUUID SND_METAL_RUBBER ("8761f73f-6cf9-4186-8aaa-0948ed002db1"); -const LLUUID SND_METAL_WOOD ("874a26fd-142f-4173-8c5b-890cd846c74d"); -const LLUUID SND_PLASTIC_PLASTIC ("0e24a717-b97e-4b77-9c94-b59a5a88b2da"); -const LLUUID SND_RUBBER_PLASTIC ("75cf3ade-9a5b-4c4d-bb35-f9799bda7fb2"); -const LLUUID SND_RUBBER_RUBBER ("153c8bf7-fb89-4d89-b263-47e58b1b4774"); -const LLUUID SND_STONE_FLESH ("55c3e0ce-275a-46fa-82ff-e0465f5e8703"); -const LLUUID SND_STONE_GLASS ("24babf58-7156-4841-9a3f-761bdbb8e237"); -const LLUUID SND_STONE_METAL ("aca261d8-e145-4610-9e20-9eff990f2c12"); -const LLUUID SND_STONE_PLASTIC ("0642fba6-5dcf-4d62-8e7b-94dbb529d117"); -const LLUUID SND_STONE_RUBBER ("25a863e8-dc42-4e8a-a357-e76422ace9b5"); -const LLUUID SND_STONE_STONE ("9538f37c-456e-4047-81be-6435045608d4"); -const LLUUID SND_STONE_WOOD ("8c0f84c3-9afd-4396-b5f5-9bca2c911c20"); -const LLUUID SND_WOOD_FLESH ("be582e5d-b123-41a2-a150-454c39e961c8"); -const LLUUID SND_WOOD_PLASTIC ("c70141d4-ba06-41ea-bcbc-35ea81cb8335"); -const LLUUID SND_WOOD_RUBBER ("7d1826f4-24c4-4aac-8c2e-eff45df37783"); -const LLUUID SND_WOOD_WOOD ("063c97d3-033a-4e9b-98d8-05c8074922cb"); +extern const LLUUID SND_SILENCE; +extern const LLUUID SND_BUBBLES; +extern const LLUUID SND_WELCOME; +extern const LLUUID SND_SQUISH; +extern const LLUUID SND_SUBPOD; +extern const LLUUID SND_FOOTSTEPS; +extern const LLUUID SND_STEP_LEFT; +extern const LLUUID SND_STEP_RIGHT; +extern const LLUUID SND_BALL_COLLISION; -const LLUUID SND_SLIDE_FLESH_FLESH ("614eec22-f73d-4fdc-8691-a37dc5c58333"); -const LLUUID SND_SLIDE_FLESH_PLASTIC (SND_NULL); -const LLUUID SND_SLIDE_FLESH_RUBBER (SND_NULL); -const LLUUID SND_SLIDE_FLESH_FABRIC ("3678b9b9-2a0c-42b5-9c83-80b64ad6e898"); -const LLUUID SND_SLIDE_FLESH_GRAVEL ("02eaa42a-ce1a-4b6b-9c38-cd7ad0e8f4a6"); -const LLUUID SND_SLIDE_FLESH_GRAVEL_02 ("e7d3b501-79f8-4419-b842-ab6843e0f840"); -const LLUUID SND_SLIDE_FLESH_GRAVEL_03 ("4c3e8b52-6244-4e44-85a6-f4ab994418ed"); -const LLUUID SND_SLIDE_GLASS_GRAVEL ("ca491e77-5c47-4ea1-8021-b3ebbf636cab"); -const LLUUID SND_SLIDE_GLASS_GRAVEL_02 ("30794d49-91ce-48e3-a527-c06f67bd6cbe"); -const LLUUID SND_SLIDE_GLASS_GRAVEL_03 ("04c78e54-fd8d-46b6-8ab9-7678b5d6e5cb"); -const LLUUID SND_SLIDE_GLASS_FLESH (SND_NULL); -const LLUUID SND_SLIDE_GLASS_GLASS (SND_NULL); -const LLUUID SND_SLIDE_GLASS_PLASTIC (SND_NULL); -const LLUUID SND_SLIDE_GLASS_RUBBER (SND_NULL); -const LLUUID SND_SLIDE_GLASS_WOOD (SND_NULL); -const LLUUID SND_SLIDE_METAL_FABRIC ("18b66e81-2958-42d4-a373-7a5054919adc"); -const LLUUID SND_SLIDE_METAL_FLESH ("dde65837-633c-4841-af2f-62ec471bf61e"); -const LLUUID SND_SLIDE_METAL_FLESH_02 ("f3cc2cbe-1a1a-4db7-a8d2-e9c8f8fa1f4f"); -const LLUUID SND_SLIDE_METAL_GLASS ("4188be39-7b1f-4495-bf2b-83ddd82eea05"); -const LLUUID SND_SLIDE_METAL_GLASS_02 ("336faa2b-9d96-4e14-93ad-b63b60074379"); -const LLUUID SND_SLIDE_METAL_GLASS_03 ("34d912aa-cf73-4462-b7d0-dcba2c66caba"); -const LLUUID SND_SLIDE_METAL_GLASS_04 ("97ffc063-e872-4469-8e95-1450ac6bad2b"); -const LLUUID SND_SLIDE_METAL_GRAVEL ("2bbff37d-009a-4cfc-9a0d-817652c08fbe"); -const LLUUID SND_SLIDE_METAL_GRAVEL_02 ("a906a228-783b-49e7-9f0a-e20a41d0e39f"); -const LLUUID SND_SLIDE_METAL_METAL ("09461277-c691-45de-b2c5-89dfd3712f79"); -const LLUUID SND_SLIDE_METAL_METAL_02 ("e00a5d97-8fdc-46c1-bd53-7e312727466c"); -const LLUUID SND_SLIDE_METAL_METAL_03 ("8ebfa780-c440-4b52-ab65-5edf3bc15bf1"); -const LLUUID SND_SLIDE_METAL_METAL_04 ("d6d03cb2-5b16-4e31-b7d4-2a81d2a0909b"); -const LLUUID SND_SLIDE_METAL_METAL_05 ("3a46f447-916e-47de-a1e5-95d1af46bd0f"); -const LLUUID SND_SLIDE_METAL_METAL_06 ("cd423231-e70d-4fd2-ad26-f1c6cf5f0610"); -const LLUUID SND_SLIDE_METAL_PLASTIC (SND_NULL); -const LLUUID SND_SLIDE_METAL_RUBBER ("12d97bc0-3c15-4744-b6bd-77d1316eb4f0"); -const LLUUID SND_SLIDE_METAL_WOOD ("4afb6926-a73f-4cb7-85d5-0f9a40107434"); -const LLUUID SND_SLIDE_METAL_WOOD_02 ("349970bf-187d-4bcb-b2cf-e7bb6581590f"); -const LLUUID SND_SLIDE_METAL_WOOD_03 ("64bf6e87-73d4-4cb4-84f7-55cecfd97cd3"); -const LLUUID SND_SLIDE_METAL_WOOD_04 ("0dc670a9-dbe8-41bc-b8ee-4d96d99219d5"); -const LLUUID SND_SLIDE_METAL_WOOD_05 ("6e3cc57b-c9aa-4829-86a1-8e82aeaccb47"); -const LLUUID SND_SLIDE_METAL_WOOD_06 ("c1237f4c-8c88-4da1-bfbc-2af26a8d9e5a"); -const LLUUID SND_SLIDE_METAL_WOOD_07 ("0e1ec243-063b-4dcb-a903-52b8dffed3d2"); -const LLUUID SND_SLIDE_METAL_WOOD_08 ("66736d0f-533d-4007-a8ee-0f27c2034126"); -const LLUUID SND_SLIDE_PLASTIC_GRAVEL ("35092c21-5c48-4b4d-a818-3cf240af2348"); -const LLUUID SND_SLIDE_PLASTIC_GRAVEL_02("c37f5776-0020-47e8-89a0-c74cc6f5742d"); -const LLUUID SND_SLIDE_PLASTIC_GRAVEL_03("d2fc8db6-2e66-464a-8ccb-f99b61ee4987"); -const LLUUID SND_SLIDE_PLASTIC_GRAVEL_04("93cbdb10-6e82-4c0b-a547-7b3b79ac25f6"); -const LLUUID SND_SLIDE_PLASTIC_GRAVEL_05("2f6d0542-fcd1-4264-a17b-f57bf5ebf402"); -const LLUUID SND_SLIDE_PLASTIC_GRAVEL_06("5b8887d4-3be2-45a0-b25d-85af3b1e6392"); -const LLUUID SND_SLIDE_PLASTIC_PLASTIC (SND_NULL); -const LLUUID SND_SLIDE_PLASTIC_PLASTIC_02 (SND_NULL); -const LLUUID SND_SLIDE_PLASTIC_PLASTIC_03 (SND_NULL); -const LLUUID SND_SLIDE_PLASTIC_FABRIC ("7294d9ad-3e41-4373-992c-a9f21d5d66ad"); -const LLUUID SND_SLIDE_PLASTIC_FABRIC_02("58608ce1-f524-472f-b447-bbe6ce4a46e0"); -const LLUUID SND_SLIDE_PLASTIC_FABRIC_03("06ae285e-0b34-4ea6-84ab-9c6c31b414fc"); -const LLUUID SND_SLIDE_PLASTIC_FABRIC_04("211613db-0461-49bd-9554-5c14ad8b31f6"); -const LLUUID SND_SLIDE_RUBBER_PLASTIC ("a98ffa5a-e48e-4f9d-9242-b9a3210ad84a"); -const LLUUID SND_SLIDE_RUBBER_PLASTIC_02 ("d4136c40-eeaa-49c6-a982-8e5a16f5d93a"); -const LLUUID SND_SLIDE_RUBBER_PLASTIC_03 ("29ec0fb2-0b23-47b2-835b-c83cc7cf9fb0"); -const LLUUID SND_SLIDE_RUBBER_RUBBER (SND_NULL); -const LLUUID SND_SLIDE_STONE_FLESH (SND_NULL); -const LLUUID SND_SLIDE_STONE_GLASS (SND_NULL); -const LLUUID SND_SLIDE_STONE_METAL (SND_NULL); -const LLUUID SND_SLIDE_STONE_PLASTIC ("afd0bcc3-d41a-4572-9e7f-08a29eeb0b8a"); -const LLUUID SND_SLIDE_STONE_PLASTIC_02 ("881b720a-96cf-4128-bb98-5d87e03e93c7"); -const LLUUID SND_SLIDE_STONE_PLASTIC_03 ("293dac42-658a-4c5a-a7a2-6d4c5e5658b0"); -const LLUUID SND_SLIDE_STONE_RUBBER ("0724b946-6a3f-4eeb-bb50-0a3b33120974"); -const LLUUID SND_SLIDE_STONE_RUBBER_02 ("ada93d00-76e2-4bf1-9ad9-493727630717"); -const LLUUID SND_SLIDE_STONE_STONE ("ade766dc-2e75-4699-9b41-7c8e53d2b3f2"); -const LLUUID SND_SLIDE_STONE_STONE_02 ("66698375-6594-47b0-8046-c3973de1291d"); -const LLUUID SND_SLIDE_STONE_WOOD ("174ef324-ed50-4f65-9479-b4da580aeb3c"); -const LLUUID SND_SLIDE_STONE_WOOD_02 ("33d517fd-ff11-4d01-a7b5-0e3abf818dcf"); -const LLUUID SND_SLIDE_STONE_WOOD_03 ("1bac4b63-e6fd-4659-9761-991284cf4582"); -const LLUUID SND_SLIDE_STONE_WOOD_04 ("a7d28564-6821-4c01-a378-cde98fba7ba9"); -const LLUUID SND_SLIDE_WOOD_FABRIC ("22c58e74-22cd-4960-9ab7-5bf08ab824e5"); -const LLUUID SND_SLIDE_WOOD_FABRIC_02 ("0b0ed22e-4a0f-4617-a4cf-20d0f2b78ccc"); -const LLUUID SND_SLIDE_WOOD_FABRIC_03 ("42b80abb-9823-4b74-a210-326ccf23636a"); -const LLUUID SND_SLIDE_WOOD_FABRIC_04 ("8538298a-1e6b-4b69-a9ee-5e01e4a02b35"); -const LLUUID SND_SLIDE_WOOD_FLESH ("84b026f3-a11c-4366-aa7c-07edcd89b2bb"); -const LLUUID SND_SLIDE_WOOD_FLESH_02 ("2644191f-4848-47ba-8ba7-bddc0bfcb3da"); -const LLUUID SND_SLIDE_WOOD_FLESH_03 ("edb978e4-9be9-456f-b2fc-e8502bfe25be"); -const LLUUID SND_SLIDE_WOOD_FLESH_04 ("bf2b972e-f42a-46d7-b53e-5fca38f5bc61"); -const LLUUID SND_SLIDE_WOOD_GRAVEL ("d063bb4d-0eff-4403-a6cc-c6c6c073e624"); -const LLUUID SND_SLIDE_WOOD_GRAVEL_02 ("511eb679-6d93-47fa-9141-c3ef9261c919"); -const LLUUID SND_SLIDE_WOOD_GRAVEL_03 ("4ed1fd43-4707-4e5c-b7b7-21ec4e72c1ac"); -const LLUUID SND_SLIDE_WOOD_GRAVEL_04 ("99ea89b3-aa76-4b87-99c8-670365c6d8c3"); -const LLUUID SND_SLIDE_WOOD_PLASTIC ("505ca3c4-94a0-4e28-8fc1-ea72a428396b"); -const LLUUID SND_SLIDE_WOOD_PLASTIC_02 ("fc404011-df71-4ed0-8f22-b72bdd18f63c"); -const LLUUID SND_SLIDE_WOOD_PLASTIC_03 ("67dbe225-26df-4efa-8c8b-f1ef669fec45"); -const LLUUID SND_SLIDE_WOOD_RUBBER (SND_NULL); -const LLUUID SND_SLIDE_WOOD_WOOD ("3079d569-b3e8-4df4-9e09-f0d4611213ef"); -const LLUUID SND_SLIDE_WOOD_WOOD_02 ("276b093d-dbcb-4279-a89e-a54b0b416af6"); -const LLUUID SND_SLIDE_WOOD_WOOD_03 ("c3f3ca5e-2768-4081-847f-247139310fdb"); -const LLUUID SND_SLIDE_WOOD_WOOD_04 ("f08d44b8-ff87-4a98-9561-c72f1f2fec81"); -const LLUUID SND_SLIDE_WOOD_WOOD_05 ("2d8a58cf-f139-4238-8503-27d334d05c85"); -const LLUUID SND_SLIDE_WOOD_WOOD_06 ("e157ebbd-b12d-4225-aa7c-d47b026a7687"); -const LLUUID SND_SLIDE_WOOD_WOOD_07 ("35e17956-e7b4-478c-b274-e37db8a166b2"); -const LLUUID SND_SLIDE_WOOD_WOOD_08 ("e606fc65-0643-4964-9979-ff964fa6a62c"); +extern const LLUUID SND_OOOH_SCARE_ME; +extern const LLUUID SND_PAYBACK_TIME; +extern const LLUUID SND_READY_FOR_BATTLE; +extern const LLUUID SND_FLESH_FLESH; +extern const LLUUID SND_FLESH_PLASTIC; +extern const LLUUID SND_FLESH_RUBBER; +extern const LLUUID SND_GLASS_FLESH; +extern const LLUUID SND_GLASS_GLASS; +extern const LLUUID SND_GLASS_PLASTIC; +extern const LLUUID SND_GLASS_RUBBER; +extern const LLUUID SND_GLASS_WOOD; +extern const LLUUID SND_METAL_FLESH; +extern const LLUUID SND_METAL_GLASS; +extern const LLUUID SND_METAL_METAL; +extern const LLUUID SND_METAL_PLASTIC; +extern const LLUUID SND_METAL_RUBBER; +extern const LLUUID SND_METAL_WOOD; +extern const LLUUID SND_PLASTIC_PLASTIC; +extern const LLUUID SND_RUBBER_PLASTIC; +extern const LLUUID SND_RUBBER_RUBBER; +extern const LLUUID SND_STONE_FLESH; +extern const LLUUID SND_STONE_GLASS; +extern const LLUUID SND_STONE_METAL; +extern const LLUUID SND_STONE_PLASTIC; +extern const LLUUID SND_STONE_RUBBER; +extern const LLUUID SND_STONE_STONE; +extern const LLUUID SND_STONE_WOOD; +extern const LLUUID SND_WOOD_FLESH; +extern const LLUUID SND_WOOD_PLASTIC; +extern const LLUUID SND_WOOD_RUBBER; +extern const LLUUID SND_WOOD_WOOD; -const LLUUID SND_ROLL_FLESH_FLESH (SND_NULL); -const LLUUID SND_ROLL_FLESH_PLASTIC ("89a0be4c-848d-4a6e-8886-298f56c2cff4"); -const LLUUID SND_ROLL_FLESH_PLASTIC_02 ("beb06343-1aa1-4af2-b320-5d2ec31c53b1"); -const LLUUID SND_ROLL_FLESH_RUBBER (SND_NULL); -const LLUUID SND_ROLL_GLASS_GRAVEL ("ba795c74-7e09-4572-b495-e09886a46b86"); -const LLUUID SND_ROLL_GLASS_GRAVEL_02 ("4c93c3b7-14cb-4d9b-a7df-628ad935f1f2"); -const LLUUID SND_ROLL_GLASS_FLESH (SND_NULL); -const LLUUID SND_ROLL_GLASS_GLASS (SND_NULL); -const LLUUID SND_ROLL_GLASS_PLASTIC (SND_NULL); -const LLUUID SND_ROLL_GLASS_RUBBER (SND_NULL); -const LLUUID SND_ROLL_GLASS_WOOD ("d40b1f48-a061-4f6e-b18f-4326a3dd5c29"); -const LLUUID SND_ROLL_GLASS_WOOD_02 ("78cd407a-bb36-4163-ba09-20f2e6d9d44b"); -const LLUUID SND_ROLL_GRAVEL_GRAVEL ("c7354cc3-6df5-4738-8dbb-b28a6ac46a05"); -const LLUUID SND_ROLL_GRAVEL_GRAVEL_02 ("01d194c4-72a6-47df-81a5-8db430faff87"); -const LLUUID SND_ROLL_METAL_FABRIC ("ce6e6564-20fd-48e4-81e2-cd3f81c00a3e"); -const LLUUID SND_ROLL_METAL_FABRIC_02 ("fc4d0065-32f6-4bb0-9f3f-f4737eb27163"); -const LLUUID SND_ROLL_METAL_FLESH (SND_NULL); -const LLUUID SND_ROLL_METAL_GLASS ("63d530bb-a41f-402b-aa1f-be6b11959809"); -const LLUUID SND_ROLL_METAL_GLASS_02 ("f62642c2-6db5-4faa-8b77-939067d837c3"); -const LLUUID SND_ROLL_METAL_GLASS_03 ("db5b5a15-2817-4cd7-9f0b-9ad49b5e52c8"); -const LLUUID SND_ROLL_METAL_GRAVEL ("447164e3-9646-4c1a-a16d-606892891466"); -const LLUUID SND_ROLL_METAL_METAL ("c3c22cf3-5d1f-4cc3-b4b5-708b9f65979c"); -const LLUUID SND_ROLL_METAL_METAL_02 ("d8386277-a1ea-460e-b6fd-bb285c323bf1"); -const LLUUID SND_ROLL_METAL_METAL_03 ("69ee1f02-f9cd-4c8b-aedd-39a2d6705680"); -const LLUUID SND_ROLL_METAL_METAL_04 ("5cc6b5fd-26ce-47ad-b21d-3a7c190dd375"); -const LLUUID SND_ROLL_METAL_PLASTIC ("c6a9bbf6-df15-4713-9f84-7237fce4051e"); -const LLUUID SND_ROLL_METAL_PLASTIC_01 ("0fedb59b-2dbb-4cec-b6cc-8559ec027749"); -const LLUUID SND_ROLL_METAL_RUBBER (SND_NULL); -const LLUUID SND_ROLL_METAL_WOOD ("1d76af57-01b1-4c73-9a1d-69523bfa50ea"); -const LLUUID SND_ROLL_METAL_WOOD_02 ("78aa4e71-8e7c-4b90-a561-3ebdc639f99b"); -const LLUUID SND_ROLL_METAL_WOOD_03 ("777d95bf-962f-48fa-93bf-8c1806557d72"); -const LLUUID SND_ROLL_METAL_WOOD_04 ("1833da76-45e2-4a8b-97da-d17413e056c9"); -const LLUUID SND_ROLL_METAL_WOOD_05 ("b13e1232-3d8d-42e9-92ec-b30f9f823962"); -const LLUUID SND_ROLL_PLASTIC_FABRIC ("616a1f03-209f-4c55-b264-83a000b6ef0a"); -const LLUUID SND_ROLL_PLASTIC_PLASTIC ("873f3d82-00b2-4082-9c69-7aef3461dba1"); -const LLUUID SND_ROLL_PLASTIC_PLASTIC_02 ("cc39879f-ebc8-4405-a4fc-8342f5bed31e"); -const LLUUID SND_ROLL_RUBBER_PLASTIC (SND_NULL); -const LLUUID SND_ROLL_RUBBER_RUBBER (SND_NULL); -const LLUUID SND_ROLL_STONE_FLESH (SND_NULL); -const LLUUID SND_ROLL_STONE_GLASS (SND_NULL); -const LLUUID SND_ROLL_STONE_METAL (SND_NULL); -const LLUUID SND_ROLL_STONE_PLASTIC ("155f65a8-cae7-476e-a58b-fd362be7fd0e"); -const LLUUID SND_ROLL_STONE_RUBBER (SND_NULL); -const LLUUID SND_ROLL_STONE_STONE ("67d56e3f-6ed5-4658-9418-14f020c38b11"); -const LLUUID SND_ROLL_STONE_STONE_02 ("43d99d10-d75b-4246-accf-4ceb2c909aa7"); -const LLUUID SND_ROLL_STONE_STONE_03 ("f04e83ff-eed7-4e99-8f45-eb97e4e1d3b7"); -const LLUUID SND_ROLL_STONE_STONE_04 ("10fcc5ad-fa89-48d6-b774-986b580c1efc"); -const LLUUID SND_ROLL_STONE_STONE_05 ("3d86f5a3-1a91-49d9-b99f-8521a7422497"); -const LLUUID SND_ROLL_STONE_WOOD ("53e46fb7-6c21-4fe1-bffe-0567475d48fa"); -const LLUUID SND_ROLL_STONE_WOOD_02 ("5eba8c9a-a014-4299-87f1-315c45ec795b"); -const LLUUID SND_ROLL_STONE_WOOD_03 ("ea6c05fc-6e9c-4526-8a20-bc47810bb549"); -const LLUUID SND_ROLL_STONE_WOOD_04 ("64618cbf-3f42-4728-8094-e77807545efb"); -const LLUUID SND_ROLL_WOOD_FLESH ("26ee185d-6fc3-49f8-89ba-51cab04cfc42"); -const LLUUID SND_ROLL_WOOD_FLESH_02 ("334faa25-1e80-4c99-b29f-4c9c2a3d079d"); -const LLUUID SND_ROLL_WOOD_FLESH_03 ("2f876626-4dce-4f71-a91e-a25302edfab7"); -const LLUUID SND_ROLL_WOOD_FLESH_04 ("d6877aac-07fc-4931-bcde-585f223802ad"); -const LLUUID SND_ROLL_WOOD_GRAVEL ("2a23ebb5-a4a2-4f1f-8d75-7384239354aa"); -const LLUUID SND_ROLL_WOOD_GRAVEL_02 ("208bf26d-f097-450c-95c4-9d26317c613c"); -const LLUUID SND_ROLL_WOOD_GRAVEL_03 ("a26ecaf4-92c6-4e32-9864-56b7c70cab8e"); -const LLUUID SND_ROLL_WOOD_PLASTIC ("71c1000a-9f16-4cc3-8ede-ec4aa3bf5723"); -const LLUUID SND_ROLL_WOOD_PLASTIC_02 ("7bc20ba6-1e6d-4eea-83ad-c5cc3ae0e409"); -const LLUUID SND_ROLL_WOOD_RUBBER (SND_NULL); -const LLUUID SND_ROLL_WOOD_WOOD ("2cc8eec4-bb4a-4ba8-b783-71526ec708e8"); -const LLUUID SND_ROLL_WOOD_WOOD_02 ("0a1f8070-a11a-4b4c-b260-5ffb6acb0a5d"); -const LLUUID SND_ROLL_WOOD_WOOD_03 ("160bef64-da9c-4be8-b07b-a5060b501700"); -const LLUUID SND_ROLL_WOOD_WOOD_04 ("1c62ea16-cc60-48ed-829a-68b8f4cf0c1c"); -const LLUUID SND_ROLL_WOOD_WOOD_05 ("be9cc8fe-b920-4bf5-8924-453088cbc03f"); -const LLUUID SND_ROLL_WOOD_WOOD_06 ("a76cfe60-56b0-43b1-8f31-93e56947d78b"); -const LLUUID SND_ROLL_WOOD_WOOD_07 ("0c6aa481-b5bc-4573-ae83-8e16ff27e750"); -const LLUUID SND_ROLL_WOOD_WOOD_08 ("214ab2c7-871a-451b-b0db-4c5677199011"); -const LLUUID SND_ROLL_WOOD_WOOD_09 ("0086e4db-3ac6-4545-b414-6f359bedd9a5"); -const LLUUID SND_SLIDE_STONE_STONE_01 ("2a7dcbd1-d3e6-4767-8432-8322648e7b9d"); +extern const LLUUID SND_SLIDE_FLESH_FLESH; +extern const LLUUID SND_SLIDE_FLESH_PLASTIC; +extern const LLUUID SND_SLIDE_FLESH_RUBBER; +extern const LLUUID SND_SLIDE_FLESH_FABRIC; +extern const LLUUID SND_SLIDE_FLESH_GRAVEL; +extern const LLUUID SND_SLIDE_FLESH_GRAVEL_02; +extern const LLUUID SND_SLIDE_FLESH_GRAVEL_03; +extern const LLUUID SND_SLIDE_GLASS_GRAVEL; +extern const LLUUID SND_SLIDE_GLASS_GRAVEL_02; +extern const LLUUID SND_SLIDE_GLASS_GRAVEL_03; +extern const LLUUID SND_SLIDE_GLASS_FLESH; +extern const LLUUID SND_SLIDE_GLASS_GLASS; +extern const LLUUID SND_SLIDE_GLASS_PLASTIC; +extern const LLUUID SND_SLIDE_GLASS_RUBBER; +extern const LLUUID SND_SLIDE_GLASS_WOOD; +extern const LLUUID SND_SLIDE_METAL_FABRIC; +extern const LLUUID SND_SLIDE_METAL_FLESH; +extern const LLUUID SND_SLIDE_METAL_FLESH_02; +extern const LLUUID SND_SLIDE_METAL_GLASS; +extern const LLUUID SND_SLIDE_METAL_GLASS_02; +extern const LLUUID SND_SLIDE_METAL_GLASS_03; +extern const LLUUID SND_SLIDE_METAL_GLASS_04; +extern const LLUUID SND_SLIDE_METAL_GRAVEL; +extern const LLUUID SND_SLIDE_METAL_GRAVEL_02; +extern const LLUUID SND_SLIDE_METAL_METAL; +extern const LLUUID SND_SLIDE_METAL_METAL_02; +extern const LLUUID SND_SLIDE_METAL_METAL_03; +extern const LLUUID SND_SLIDE_METAL_METAL_04; +extern const LLUUID SND_SLIDE_METAL_METAL_05; +extern const LLUUID SND_SLIDE_METAL_METAL_06; +extern const LLUUID SND_SLIDE_METAL_PLASTIC; +extern const LLUUID SND_SLIDE_METAL_RUBBER; +extern const LLUUID SND_SLIDE_METAL_WOOD; +extern const LLUUID SND_SLIDE_METAL_WOOD_02; +extern const LLUUID SND_SLIDE_METAL_WOOD_03; +extern const LLUUID SND_SLIDE_METAL_WOOD_04; +extern const LLUUID SND_SLIDE_METAL_WOOD_05; +extern const LLUUID SND_SLIDE_METAL_WOOD_06; +extern const LLUUID SND_SLIDE_METAL_WOOD_07; +extern const LLUUID SND_SLIDE_METAL_WOOD_08; +extern const LLUUID SND_SLIDE_PLASTIC_GRAVEL; +extern const LLUUID SND_SLIDE_PLASTIC_GRAVEL_02; +extern const LLUUID SND_SLIDE_PLASTIC_GRAVEL_03; +extern const LLUUID SND_SLIDE_PLASTIC_GRAVEL_04; +extern const LLUUID SND_SLIDE_PLASTIC_GRAVEL_05; +extern const LLUUID SND_SLIDE_PLASTIC_GRAVEL_06; +extern const LLUUID SND_SLIDE_PLASTIC_PLASTIC; +extern const LLUUID SND_SLIDE_PLASTIC_PLASTIC_02; +extern const LLUUID SND_SLIDE_PLASTIC_PLASTIC_03; +extern const LLUUID SND_SLIDE_PLASTIC_FABRIC; +extern const LLUUID SND_SLIDE_PLASTIC_FABRIC_02; +extern const LLUUID SND_SLIDE_PLASTIC_FABRIC_03; +extern const LLUUID SND_SLIDE_PLASTIC_FABRIC_04; +extern const LLUUID SND_SLIDE_RUBBER_PLASTIC; +extern const LLUUID SND_SLIDE_RUBBER_PLASTIC_02; +extern const LLUUID SND_SLIDE_RUBBER_PLASTIC_03; +extern const LLUUID SND_SLIDE_RUBBER_RUBBER; +extern const LLUUID SND_SLIDE_STONE_FLESH; +extern const LLUUID SND_SLIDE_STONE_GLASS; +extern const LLUUID SND_SLIDE_STONE_METAL; +extern const LLUUID SND_SLIDE_STONE_PLASTIC; +extern const LLUUID SND_SLIDE_STONE_PLASTIC_02; +extern const LLUUID SND_SLIDE_STONE_PLASTIC_03; +extern const LLUUID SND_SLIDE_STONE_RUBBER; +extern const LLUUID SND_SLIDE_STONE_RUBBER_02; +extern const LLUUID SND_SLIDE_STONE_STONE; +extern const LLUUID SND_SLIDE_STONE_STONE_02; +extern const LLUUID SND_SLIDE_STONE_WOOD; +extern const LLUUID SND_SLIDE_STONE_WOOD_02; +extern const LLUUID SND_SLIDE_STONE_WOOD_03; +extern const LLUUID SND_SLIDE_STONE_WOOD_04; +extern const LLUUID SND_SLIDE_WOOD_FABRIC; +extern const LLUUID SND_SLIDE_WOOD_FABRIC_02; +extern const LLUUID SND_SLIDE_WOOD_FABRIC_03; +extern const LLUUID SND_SLIDE_WOOD_FABRIC_04; +extern const LLUUID SND_SLIDE_WOOD_FLESH; +extern const LLUUID SND_SLIDE_WOOD_FLESH_02; +extern const LLUUID SND_SLIDE_WOOD_FLESH_03; +extern const LLUUID SND_SLIDE_WOOD_FLESH_04; +extern const LLUUID SND_SLIDE_WOOD_GRAVEL; +extern const LLUUID SND_SLIDE_WOOD_GRAVEL_02; +extern const LLUUID SND_SLIDE_WOOD_GRAVEL_03; +extern const LLUUID SND_SLIDE_WOOD_GRAVEL_04; +extern const LLUUID SND_SLIDE_WOOD_PLASTIC; +extern const LLUUID SND_SLIDE_WOOD_PLASTIC_02; +extern const LLUUID SND_SLIDE_WOOD_PLASTIC_03; +extern const LLUUID SND_SLIDE_WOOD_RUBBER; +extern const LLUUID SND_SLIDE_WOOD_WOOD; +extern const LLUUID SND_SLIDE_WOOD_WOOD_02; +extern const LLUUID SND_SLIDE_WOOD_WOOD_03; +extern const LLUUID SND_SLIDE_WOOD_WOOD_04; +extern const LLUUID SND_SLIDE_WOOD_WOOD_05; +extern const LLUUID SND_SLIDE_WOOD_WOOD_06; +extern const LLUUID SND_SLIDE_WOOD_WOOD_07; +extern const LLUUID SND_SLIDE_WOOD_WOOD_08; -const LLUUID SND_STONE_DIRT_01 ("97727335-392c-4338-ac4b-23a7883279c2"); -const LLUUID SND_STONE_DIRT_02 ("cbe75eb2-3375-41d8-9e3f-2ae46b4164ed"); -const LLUUID SND_STONE_DIRT_03 ("31e236ee-001b-4c8e-ad6c-c2074cb64357"); -const LLUUID SND_STONE_DIRT_04 ("c8091652-e04b-4a11-84ba-15dba06e7a1b"); -const LLUUID SND_STONE_STONE_02 ("ba4ef5ac-7435-4240-b826-c24ba8fa5a78"); -const LLUUID SND_STONE_STONE_04 ("ea296329-0f09-4993-af1b-e6784bab1dc9"); +extern const LLUUID SND_ROLL_FLESH_FLESH; +extern const LLUUID SND_ROLL_FLESH_PLASTIC; +extern const LLUUID SND_ROLL_FLESH_PLASTIC_02; +extern const LLUUID SND_ROLL_FLESH_RUBBER; +extern const LLUUID SND_ROLL_GLASS_GRAVEL; +extern const LLUUID SND_ROLL_GLASS_GRAVEL_02; +extern const LLUUID SND_ROLL_GLASS_FLESH; +extern const LLUUID SND_ROLL_GLASS_GLASS; +extern const LLUUID SND_ROLL_GLASS_PLASTIC; +extern const LLUUID SND_ROLL_GLASS_RUBBER; +extern const LLUUID SND_ROLL_GLASS_WOOD; +extern const LLUUID SND_ROLL_GLASS_WOOD_02; +extern const LLUUID SND_ROLL_GRAVEL_GRAVEL; +extern const LLUUID SND_ROLL_GRAVEL_GRAVEL_02; +extern const LLUUID SND_ROLL_METAL_FABRIC; +extern const LLUUID SND_ROLL_METAL_FABRIC_02; +extern const LLUUID SND_ROLL_METAL_FLESH; +extern const LLUUID SND_ROLL_METAL_GLASS; +extern const LLUUID SND_ROLL_METAL_GLASS_02; +extern const LLUUID SND_ROLL_METAL_GLASS_03; +extern const LLUUID SND_ROLL_METAL_GRAVEL; +extern const LLUUID SND_ROLL_METAL_METAL; +extern const LLUUID SND_ROLL_METAL_METAL_02; +extern const LLUUID SND_ROLL_METAL_METAL_03; +extern const LLUUID SND_ROLL_METAL_METAL_04; +extern const LLUUID SND_ROLL_METAL_PLASTIC; +extern const LLUUID SND_ROLL_METAL_PLASTIC_01; +extern const LLUUID SND_ROLL_METAL_RUBBER; +extern const LLUUID SND_ROLL_METAL_WOOD; +extern const LLUUID SND_ROLL_METAL_WOOD_02; +extern const LLUUID SND_ROLL_METAL_WOOD_03; +extern const LLUUID SND_ROLL_METAL_WOOD_04; +extern const LLUUID SND_ROLL_METAL_WOOD_05; +extern const LLUUID SND_ROLL_PLASTIC_FABRIC; +extern const LLUUID SND_ROLL_PLASTIC_PLASTIC; +extern const LLUUID SND_ROLL_PLASTIC_PLASTIC_02; +extern const LLUUID SND_ROLL_RUBBER_PLASTIC; +extern const LLUUID SND_ROLL_RUBBER_RUBBER; +extern const LLUUID SND_ROLL_STONE_FLESH; +extern const LLUUID SND_ROLL_STONE_GLASS; +extern const LLUUID SND_ROLL_STONE_METAL; +extern const LLUUID SND_ROLL_STONE_PLASTIC; +extern const LLUUID SND_ROLL_STONE_RUBBER; +extern const LLUUID SND_ROLL_STONE_STONE; +extern const LLUUID SND_ROLL_STONE_STONE_02; +extern const LLUUID SND_ROLL_STONE_STONE_03; +extern const LLUUID SND_ROLL_STONE_STONE_04; +extern const LLUUID SND_ROLL_STONE_STONE_05; +extern const LLUUID SND_ROLL_STONE_WOOD; +extern const LLUUID SND_ROLL_STONE_WOOD_02; +extern const LLUUID SND_ROLL_STONE_WOOD_03; +extern const LLUUID SND_ROLL_STONE_WOOD_04; +extern const LLUUID SND_ROLL_WOOD_FLESH; +extern const LLUUID SND_ROLL_WOOD_FLESH_02; +extern const LLUUID SND_ROLL_WOOD_FLESH_03; +extern const LLUUID SND_ROLL_WOOD_FLESH_04; +extern const LLUUID SND_ROLL_WOOD_GRAVEL; +extern const LLUUID SND_ROLL_WOOD_GRAVEL_02; +extern const LLUUID SND_ROLL_WOOD_GRAVEL_03; +extern const LLUUID SND_ROLL_WOOD_PLASTIC; +extern const LLUUID SND_ROLL_WOOD_PLASTIC_02; +extern const LLUUID SND_ROLL_WOOD_RUBBER; +extern const LLUUID SND_ROLL_WOOD_WOOD; +extern const LLUUID SND_ROLL_WOOD_WOOD_02; +extern const LLUUID SND_ROLL_WOOD_WOOD_03; +extern const LLUUID SND_ROLL_WOOD_WOOD_04; +extern const LLUUID SND_ROLL_WOOD_WOOD_05; +extern const LLUUID SND_ROLL_WOOD_WOOD_06; +extern const LLUUID SND_ROLL_WOOD_WOOD_07; +extern const LLUUID SND_ROLL_WOOD_WOOD_08; +extern const LLUUID SND_ROLL_WOOD_WOOD_09; +extern const LLUUID SND_SLIDE_STONE_STONE_01; +extern const LLUUID SND_STONE_DIRT_01; +extern const LLUUID SND_STONE_DIRT_02; +extern const LLUUID SND_STONE_DIRT_03; +extern const LLUUID SND_STONE_DIRT_04; -// extra guids -#if 0 -const LLUUID SND_ ("a839b8ac-b0af-4ba9-9fde-188754744e02"); -const LLUUID SND_ ("20165fa8-836f-4993-85dc-1529172dcd14"); -const LLUUID SND_ ("fba8e17b-a4b3-4693-9fce-c14800f8a349"); -const LLUUID SND_ ("2d48db8b-7260-4b02-ad2a-b2c6bee60e94"); -const LLUUID SND_ ("956d344b-1808-4d8b-88b1-cbc82b7a96a1"); -const LLUUID SND_ ("b8303cc6-f0b4-4c6f-a199-81f87aba342e"); -const LLUUID SND_ ("fbf7cd0c-bc8f-4cba-9c19-11f4dd03a06b"); -const LLUUID SND_ ("85047f7d-933a-4ce5-a7b5-34670243e1ab"); -const LLUUID SND_ ("0f81acf7-6a2e-4490-957f-c7b0eda00559"); -const LLUUID SND_ ("5631a6a1-79b4-4de8-bccf-1880b6882da1"); -const LLUUID SND_ ("43c87a6b-ffb2-437b-89a0-9deba890a4fc"); -const LLUUID SND_ ("58878d1d-3156-4d01-ac3c-0c4fb99f4d53"); -const LLUUID SND_ ("9a83f321-44bf-40f6-b006-46c085515345"); -const LLUUID SND_ ("ff144533-33ab-40f2-bac8-39c34699ecc4"); -const LLUUID SND_ ("09018e87-d52c-4cd5-9805-015f413319e7"); -const LLUUID SND_ ("17d4c057-7edd-401e-9589-d5b9fe981bf2"); -#endif +extern const LLUUID SND_STONE_STONE_02; +extern const LLUUID SND_STONE_STONE_04; #endif diff --git a/indra/llmessage/tests/commtest.h b/indra/llmessage/tests/commtest.h new file mode 100644 index 0000000000..32035783e2 --- /dev/null +++ b/indra/llmessage/tests/commtest.h @@ -0,0 +1,77 @@ +/** + * @file commtest.h + * @author Nat Goodspeed + * @date 2009-01-09 + * @brief + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#if ! defined(LL_COMMTEST_H) +#define LL_COMMTEST_H + +#include "networkio.h" +#include "llevents.h" +#include "llsd.h" +#include "llhost.h" +#include "stringize.h" +#include <string> + +/** + * This struct is shared by a couple of standalone comm tests (ADD_COMM_BUILD_TEST). + */ +struct commtest_data +{ + NetworkIO& netio; + LLEventPumps& pumps; + LLEventStream replyPump, errorPump; + LLSD result; + bool success; + LLHost host; + std::string server; + + commtest_data(): + netio(NetworkIO::instance()), + pumps(LLEventPumps::instance()), + replyPump("reply"), + errorPump("error"), + success(false), + host("127.0.0.1", 8000), + server(STRINGIZE("http://" << host.getString() << "/")) + { + replyPump.listen("self", boost::bind(&commtest_data::outcome, this, _1, true)); + errorPump.listen("self", boost::bind(&commtest_data::outcome, this, _1, false)); + } + + bool outcome(const LLSD& _result, bool _success) + { +// std::cout << "commtest_data::outcome(" << _result << ", " << _success << ")\n"; + result = _result; + success = _success; + // Break the wait loop in NetworkIO::pump(), otherwise devs get + // irritated at making the big monolithic test executable take longer + pumps.obtain("done").post(success); + return false; + } +}; + +#endif /* ! defined(LL_COMMTEST_H) */ diff --git a/indra/llmessage/tests/llareslistener_test.cpp b/indra/llmessage/tests/llareslistener_test.cpp new file mode 100644 index 0000000000..60c91e12cf --- /dev/null +++ b/indra/llmessage/tests/llareslistener_test.cpp @@ -0,0 +1,217 @@ +/** + * @file llareslistener_test.cpp + * @author Mark Palange + * @date 2009-02-26 + * @brief Tests of llareslistener.h. + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#if LL_WINDOWS +#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally +#endif + +// Precompiled header +#include "linden_common.h" +// associated header +#include "../llareslistener.h" +// STL headers +#include <iostream> +// std headers +// external library headers +#include <boost/bind.hpp> + +// other Linden headers +#include "llsd.h" +#include "llares.h" +#include "../test/lltut.h" +#include "llevents.h" +#include "tests/wrapllerrs.h" + +/***************************************************************************** +* Dummy stuff +*****************************************************************************/ +LLAres::LLAres(): + // Simulate this much of the real LLAres constructor: we need an + // LLAresListener instance. + mListener(new LLAresListener("LLAres", this)) +{} +LLAres::~LLAres() {} +void LLAres::rewriteURI(const std::string &uri, + LLAres::UriRewriteResponder *resp) +{ + // This is the only LLAres method I chose to implement. + // The effect is that LLAres returns immediately with + // a result that is equal to the input uri. + std::vector<std::string> result; + result.push_back(uri); + resp->rewriteResult(result); +} + +LLAres::QueryResponder::~QueryResponder() {} +void LLAres::QueryResponder::queryError(int) {} +void LLAres::QueryResponder::queryResult(char const*, size_t) {} +LLQueryResponder::LLQueryResponder() {} +void LLQueryResponder::queryResult(char const*, size_t) {} +void LLQueryResponder::querySuccess() {} +void LLAres::UriRewriteResponder::queryError(int) {} +void LLAres::UriRewriteResponder::querySuccess() {} +void LLAres::UriRewriteResponder::rewriteResult(const std::vector<std::string>& uris) {} + +/***************************************************************************** +* TUT +*****************************************************************************/ +namespace tut +{ + struct data + { + LLAres dummyAres; + }; + typedef test_group<data> llareslistener_group; + typedef llareslistener_group::object object; + llareslistener_group llareslistenergrp("llareslistener"); + + struct ResponseCallback + { + std::vector<std::string> mURIs; + bool operator()(const LLSD& response) + { + mURIs.clear(); + for (LLSD::array_const_iterator ri(response.beginArray()), rend(response.endArray()); + ri != rend; ++ri) + { + mURIs.push_back(*ri); + } + return false; + } + }; + + template<> template<> + void object::test<1>() + { + set_test_name("test event"); + // Tests the success and failure cases, since they both use + // the same code paths in the LLAres responder. + ResponseCallback response; + std::string pumpname("trigger"); + // Since we're asking LLEventPumps to obtain() the pump by the desired + // name, it will persist beyond the current scope, so ensure we + // disconnect from it when 'response' goes away. + LLTempBoundListener temp( + LLEventPumps::instance().obtain(pumpname).listen("rewriteURIresponse", + boost::bind(&ResponseCallback::operator(), &response, _1))); + // Now build an LLSD request that will direct its response events to + // that pump. + const std::string testURI("login.bar.com"); + LLSD request; + request["op"] = "rewriteURI"; + request["uri"] = testURI; + request["reply"] = pumpname; + LLEventPumps::instance().obtain("LLAres").post(request); + ensure_equals(response.mURIs.size(), 1); + ensure_equals(response.mURIs.front(), testURI); + } + + template<> template<> + void object::test<2>() + { + set_test_name("bad op"); + WrapLL_ERRS capture; + LLSD request; + request["op"] = "foo"; + std::string threw; + try + { + LLEventPumps::instance().obtain("LLAres").post(request); + } + catch (const WrapLL_ERRS::FatalException& e) + { + threw = e.what(); + } + ensure_contains("LLAresListener bad op", threw, "bad"); + } + + template<> template<> + void object::test<3>() + { + set_test_name("bad rewriteURI request"); + WrapLL_ERRS capture; + LLSD request; + request["op"] = "rewriteURI"; + std::string threw; + try + { + LLEventPumps::instance().obtain("LLAres").post(request); + } + catch (const WrapLL_ERRS::FatalException& e) + { + threw = e.what(); + } + ensure_contains("LLAresListener bad req", threw, "missing"); + ensure_contains("LLAresListener bad req", threw, "reply"); + ensure_contains("LLAresListener bad req", threw, "uri"); + } + + template<> template<> + void object::test<4>() + { + set_test_name("bad rewriteURI request"); + WrapLL_ERRS capture; + LLSD request; + request["op"] = "rewriteURI"; + request["reply"] = "nonexistent"; + std::string threw; + try + { + LLEventPumps::instance().obtain("LLAres").post(request); + } + catch (const WrapLL_ERRS::FatalException& e) + { + threw = e.what(); + } + ensure_contains("LLAresListener bad req", threw, "missing"); + ensure_contains("LLAresListener bad req", threw, "uri"); + ensure_does_not_contain("LLAresListener bad req", threw, "reply"); + } + + template<> template<> + void object::test<5>() + { + set_test_name("bad rewriteURI request"); + WrapLL_ERRS capture; + LLSD request; + request["op"] = "rewriteURI"; + request["uri"] = "foo.bar.com"; + std::string threw; + try + { + LLEventPumps::instance().obtain("LLAres").post(request); + } + catch (const WrapLL_ERRS::FatalException& e) + { + threw = e.what(); + } + ensure_contains("LLAresListener bad req", threw, "missing"); + ensure_contains("LLAresListener bad req", threw, "reply"); + ensure_does_not_contain("LLAresListener bad req", threw, "uri"); + } +} diff --git a/indra/llmessage/tests/llavatarnamecache_test.cpp b/indra/llmessage/tests/llavatarnamecache_test.cpp new file mode 100644 index 0000000000..ec6b65d483 --- /dev/null +++ b/indra/llmessage/tests/llavatarnamecache_test.cpp @@ -0,0 +1,102 @@ +/** + * @file llavatarnamecache_test.cpp + * @author James Cook + * @brief LLAvatarNameCache test cases. + * + * $LicenseInfo:firstyear=2010&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "../llavatarnamecache.h" + +#include "../test/lltut.h" + +namespace tut +{ + struct avatarnamecache_data + { + }; + typedef test_group<avatarnamecache_data> avatarnamecache_test; + typedef avatarnamecache_test::object avatarnamecache_object; + tut::avatarnamecache_test avatarnamecache_testcase("LLAvatarNameCache"); + + template<> template<> + void avatarnamecache_object::test<1>() + { + bool valid = false; + S32 max_age = 0; + + valid = max_age_from_cache_control("max-age=3600", &max_age); + ensure("typical input valid", valid); + ensure_equals("typical input parsed", max_age, 3600); + + valid = max_age_from_cache_control( + " max-age=600 , no-cache,private=\"stuff\" ", &max_age); + ensure("complex input valid", valid); + ensure_equals("complex input parsed", max_age, 600); + + valid = max_age_from_cache_control( + "no-cache, max-age = 123 ", &max_age); + ensure("complex input 2 valid", valid); + ensure_equals("complex input 2 parsed", max_age, 123); + } + + template<> template<> + void avatarnamecache_object::test<2>() + { + bool valid = false; + S32 max_age = -1; + + valid = max_age_from_cache_control("", &max_age); + ensure("empty input returns invalid", !valid); + ensure_equals("empty input doesn't change val", max_age, -1); + + valid = max_age_from_cache_control("no-cache", &max_age); + ensure("no max-age field returns invalid", !valid); + + valid = max_age_from_cache_control("max", &max_age); + ensure("just 'max' returns invalid", !valid); + + valid = max_age_from_cache_control("max-age", &max_age); + ensure("partial max-age is invalid", !valid); + + valid = max_age_from_cache_control("max-age=", &max_age); + ensure("longer partial max-age is invalid", !valid); + + valid = max_age_from_cache_control("max-age=FOO", &max_age); + ensure("invalid integer max-age is invalid", !valid); + + valid = max_age_from_cache_control("max-age 234", &max_age); + ensure("space separated max-age is invalid", !valid); + + valid = max_age_from_cache_control("max-age=0", &max_age); + ensure("zero max-age is valid", valid); + + // *TODO: Handle "0000" as zero + //valid = max_age_from_cache_control("max-age=0000", &max_age); + //ensure("multi-zero max-age is valid", valid); + + valid = max_age_from_cache_control("max-age=-123", &max_age); + ensure("less than zero max-age is invalid", !valid); + } +} diff --git a/indra/llmessage/tests/llcurl_stub.cpp b/indra/llmessage/tests/llcurl_stub.cpp new file mode 100644 index 0000000000..d84fe0a49f --- /dev/null +++ b/indra/llmessage/tests/llcurl_stub.cpp @@ -0,0 +1,95 @@ +/** + * @file llcurl_stub.cpp + * @brief stub class to allow unit testing + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "llcurl.h" + +LLCurl::Responder::Responder() + : mReferenceCount(0) +{ +} + +void LLCurl::Responder::completed(U32 status, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const &reason, + LLSD const& mContent) +{ + if (isGoodStatus(status)) + { + result(mContent); + } + else + { + errorWithContent(status, reason, mContent); + } +} + +void LLCurl::Responder::completedHeader(unsigned, + std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, + LLSD const&) +{ +} + +void LLCurl::Responder::completedRaw(unsigned, + std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, + LLChannelDescriptors const&, + boost::shared_ptr<LLBufferArray> const&) +{ +} + +void LLCurl::Responder::errorWithContent(unsigned, + std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, + LLSD const&) +{ +} + +LLCurl::Responder::~Responder () +{ +} + +void LLCurl::Responder::error(unsigned, + std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) +{ +} + +void LLCurl::Responder::result(LLSD const&) +{ +} + +namespace boost +{ + void intrusive_ptr_add_ref(LLCurl::Responder* p) + { + ++p->mReferenceCount; + } + + void intrusive_ptr_release(LLCurl::Responder* p) + { + if(p && 0 == --p->mReferenceCount) + { + delete p; + } + } +}; + diff --git a/indra/llmessage/tests/llhost_test.cpp b/indra/llmessage/tests/llhost_test.cpp new file mode 100644 index 0000000000..b20bceae1d --- /dev/null +++ b/indra/llmessage/tests/llhost_test.cpp @@ -0,0 +1,250 @@ +/** + * @file llhost_test.cpp + * @author Adroit + * @date 2007-02 + * @brief llhost test cases. + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "../llhost.h" + +#include "../test/lltut.h" + +namespace tut +{ + struct host_data + { + }; + typedef test_group<host_data> host_test; + typedef host_test::object host_object; + tut::host_test host_testcase("LLHost"); + + + template<> template<> + void host_object::test<1>() + { + LLHost host; + ensure("IP address is not NULL", (0 == host.getAddress()) && (0 == host.getPort()) && !host.isOk()); + } + template<> template<> + void host_object::test<2>() + { + U32 ip_addr = 0xc098017d; + U32 port = 8080; + LLHost host(ip_addr, port); + ensure("IP address is invalid", ip_addr == host.getAddress()); + ensure("Port Number is invalid", port == host.getPort()); + ensure("IP address and port number both should be ok", host.isOk()); + } + + template<> template<> + void host_object::test<3>() + { + const char* str = "192.168.1.1"; + U32 port = 8080; + LLHost host(str, port); + ensure("IP address could not be processed", (host.getAddress() == ip_string_to_u32(str))); + ensure("Port Number is invalid", (port == host.getPort())); + } + + template<> template<> + void host_object::test<4>() + { + U32 ip = ip_string_to_u32("192.168.1.1"); + U32 port = 22; + U64 ip_port = (((U64) ip) << 32) | port; + LLHost host(ip_port); + ensure("IP address is invalid", ip == host.getAddress()); + ensure("Port Number is invalid", port == host.getPort()); + } + + template<> template<> + void host_object::test<5>() + { + std::string ip_port_string = "192.168.1.1:8080"; + U32 ip = ip_string_to_u32("192.168.1.1"); + U32 port = 8080; + + LLHost host(ip_port_string); + ensure("IP address from IP:port is invalid", ip == host.getAddress()); + ensure("Port Number from from IP:port is invalid", port == host.getPort()); + } + + template<> template<> + void host_object::test<6>() + { + U32 ip = 0xc098017d, port = 8080; + LLHost host; + host.set(ip,port); + ensure("IP address is invalid", (ip == host.getAddress())); + ensure("Port Number is invalid", (port == host.getPort())); + } + + template<> template<> + void host_object::test<7>() + { + const char* str = "192.168.1.1"; + U32 port = 8080, ip; + LLHost host; + host.set(str,port); + ip = ip_string_to_u32(str); + ensure("IP address is invalid", (ip == host.getAddress())); + ensure("Port Number is invalid", (port == host.getPort())); + + str = "64.233.187.99"; + ip = ip_string_to_u32(str); + host.setAddress(str); + ensure("IP address is invalid", (ip == host.getAddress())); + + ip = 0xc098017b; + host.setAddress(ip); + ensure("IP address is invalid", (ip == host.getAddress())); + // should still use the old port + ensure("Port Number is invalid", (port == host.getPort())); + + port = 8084; + host.setPort(port); + ensure("Port Number is invalid", (port == host.getPort())); + // should still use the old address + ensure("IP address is invalid", (ip == host.getAddress())); + } + + template<> template<> + void host_object::test<8>() + { + const std::string str("192.168.1.1"); + U32 port = 8080; + LLHost host; + host.set(str,port); + + std::string ip_string = host.getIPString(); + ensure("Function Failed", (ip_string == str)); + + std::string ip_string_port = host.getIPandPort(); + ensure("Function Failed", (ip_string_port == "192.168.1.1:8080")); + } + + +// getHostName() and setHostByName + template<> template<> + void host_object::test<9>() + { +// skip("setHostByName(\"google.com\"); getHostName() -> (e.g.) \"yx-in-f100.1e100.net\""); + std::string hostStr = "linux.org"; + LLHost host; + host.setHostByName(hostStr); + + // reverse DNS will likely result in appending of some + // sub-domain to the main hostname. so look for + // the main domain name and not do the exact compare + + std::string hostname = host.getHostName(); + try + { + ensure("getHostName failed", hostname.find(hostStr) != std::string::npos); + } + catch (const std::exception&) + { + std::cerr << "set '" << hostStr << "'; reported '" << hostname << "'" << std::endl; + throw; + } + } + +// setHostByName for dotted IP + template<> template<> + void host_object::test<10>() + { + std::string hostStr = "64.233.167.99"; + LLHost host; + host.setHostByName(hostStr); + ensure("SetHostByName for dotted IP Address failed", host.getAddress() == ip_string_to_u32(hostStr.c_str())); + } + + template<> template<> + void host_object::test<11>() + { + LLHost host1(0xc098017d, 8080); + LLHost host2 = host1; + ensure("Both IP addresses are not same", (host1.getAddress() == host2.getAddress())); + ensure("Both port numbers are not same", (host1.getPort() == host2.getPort())); + } + + template<> template<> + void host_object::test<12>() + { + LLHost host1("192.168.1.1", 8080); + std::string str1 = "192.168.1.1:8080"; + std::ostringstream stream; + stream << host1; + ensure("Operator << failed", ( stream.str()== str1)); + + // There is no istream >> llhost operator. + //std::istringstream is(stream.str()); + //LLHost host2; + //is >> host2; + //ensure("Operator >> failed. Not compatible with <<", host1 == host2); + } + + // operators ==, !=, < + template<> template<> + void host_object::test<13>() + { + U32 ip_addr = 0xc098017d; + U32 port = 8080; + LLHost host1(ip_addr, port); + LLHost host2(ip_addr, port); + ensure("operator== failed", host1 == host2); + + // change port + host2.setPort(7070); + ensure("operator!= failed", host1 != host2); + + // set port back to 8080 and change IP address now + host2.setPort(8080); + host2.setAddress(ip_addr+10); + ensure("operator!= failed", host1 != host2); + + ensure("operator< failed", host1 < host2); + + // set IP address back to same value and change port + host2.setAddress(ip_addr); + host2.setPort(host1.getPort() + 10); + ensure("operator< failed", host1 < host2); + } + + // invalid ip address string + template<> template<> + void host_object::test<14>() + { + LLHost host1("10.0.1.2", 6143); + ensure("10.0.1.2 should be a valid address", host1.isOk()); + + LLHost host2("booger-brains", 6143); + ensure("booger-brains should be an invalid ip addess", !host2.isOk()); + + LLHost host3("255.255.255.255", 6143); + ensure("255.255.255.255 should be valid broadcast address", host3.isOk()); + } +} diff --git a/indra/llmessage/tests/llhttpclientadapter_test.cpp b/indra/llmessage/tests/llhttpclientadapter_test.cpp new file mode 100644 index 0000000000..13ce0a0edd --- /dev/null +++ b/indra/llmessage/tests/llhttpclientadapter_test.cpp @@ -0,0 +1,164 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llhttpclientadapter.h" + +#include "../test/lltut.h" +#include "llhttpclient.h" +#include "llcurl_stub.cpp" + +float const HTTP_REQUEST_EXPIRY_SECS = 1.0F; + +std::vector<std::string> get_urls; +std::vector<boost::intrusive_ptr<LLCurl::Responder> > get_responders; +void LLHTTPClient::get(const std::string& url, boost::intrusive_ptr<LLCurl::Responder> responder, const LLSD& headers, const F32 timeout) +{ + get_urls.push_back(url); + get_responders.push_back(responder); +} + +std::vector<std::string> put_urls; +std::vector<LLSD> put_body; +std::vector<boost::intrusive_ptr<LLCurl::Responder> > put_responders; + +void LLHTTPClient::put(const std::string& url, const LLSD& body, boost::intrusive_ptr<LLCurl::Responder> responder, const LLSD& headers, const F32 timeout) +{ + put_urls.push_back(url); + put_responders.push_back(responder); + put_body.push_back(body); + +} + + +namespace tut +{ + struct LLHTTPClientAdapterData + { + LLHTTPClientAdapterData() + { + get_urls.clear(); + get_responders.clear(); + put_urls.clear(); + put_responders.clear(); + put_body.clear(); + } + }; + + typedef test_group<LLHTTPClientAdapterData> factory; + typedef factory::object object; +} + +namespace +{ + tut::factory tf("LLHTTPClientAdapterData test"); +} + +namespace tut +{ + // Ensure we can create the object + template<> template<> + void object::test<1>() + { + LLHTTPClientAdapter adapter; + } + + // Does the get pass the appropriate arguments to the LLHTTPClient + template<> template<> + void object::test<2>() + { + LLHTTPClientAdapter adapter; + + boost::intrusive_ptr<LLCurl::Responder> responder = new LLCurl::Responder(); + + adapter.get("Made up URL", responder); + ensure_equals(get_urls.size(), 1); + ensure_equals(get_urls[0], "Made up URL"); + } + + // Ensure the responder matches the one passed to get + template<> template<> + void object::test<3>() + { + LLHTTPClientAdapter adapter; + boost::intrusive_ptr<LLCurl::Responder> responder = new LLCurl::Responder(); + + adapter.get("Made up URL", responder); + + ensure_equals(get_responders.size(), 1); + ensure_equals(get_responders[0].get(), responder.get()); + } + + // Ensure the correct url is used in the put + template<> template<> + void object::test<4>() + { + LLHTTPClientAdapter adapter; + + boost::intrusive_ptr<LLCurl::Responder> responder = new LLCurl::Responder(); + + LLSD body; + body["TestBody"] = "Foobar"; + + adapter.put("Made up URL", body, responder); + ensure_equals(put_urls.size(), 1); + ensure_equals(put_urls[0], "Made up URL"); + } + + // Ensure the correct responder is used by put + template<> template<> + void object::test<5>() + { + LLHTTPClientAdapter adapter; + + boost::intrusive_ptr<LLCurl::Responder> responder = new LLCurl::Responder(); + + LLSD body; + body["TestBody"] = "Foobar"; + + adapter.put("Made up URL", body, responder); + + ensure_equals(put_responders.size(), 1); + ensure_equals(put_responders[0].get(), responder.get()); + } + + // Ensure the message body is passed through the put properly + template<> template<> + void object::test<6>() + { + LLHTTPClientAdapter adapter; + + boost::intrusive_ptr<LLCurl::Responder> responder = new LLCurl::Responder(); + + LLSD body; + body["TestBody"] = "Foobar"; + + adapter.put("Made up URL", body, responder); + + ensure_equals(put_body.size(), 1); + ensure_equals(put_body[0]["TestBody"].asString(), "Foobar"); + } +} + diff --git a/indra/llmessage/tests/llmime_test.cpp b/indra/llmessage/tests/llmime_test.cpp new file mode 100644 index 0000000000..aed5c4589c --- /dev/null +++ b/indra/llmessage/tests/llmime_test.cpp @@ -0,0 +1,445 @@ +/** + * @file llmime_test.cpp + * @author Phoenix + * @date 2006-12-24 + * @brief BRIEF_DESC of llmime_test.cpp + * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llsdserialize.h" + +#include "../llmime.h" + +#include "../test/lltut.h" + +namespace tut +{ + struct mime_index + { + }; + typedef test_group<mime_index> mime_index_t; + typedef mime_index_t::object mime_index_object_t; + tut::mime_index_t tut_mime_index("LLMime"); + + template<> template<> + void mime_index_object_t::test<1>() + { + LLMimeIndex mime; + ensure("no headers", mime.headers().isUndefined()); + ensure_equals("invalid offset", mime.offset(), -1); + ensure_equals("invalid content length", mime.contentLength(), -1); + ensure("no content type", mime.contentType().empty()); + ensure("not multipart", !mime.isMultipart()); + ensure_equals("no attachments", mime.subPartCount(), 0); + } + + template<> template<> + void mime_index_object_t::test<2>() + { + const S32 CONTENT_LENGTH = 6000; + const S32 CONTENT_OFFSET = 100; + const std::string CONTENT_TYPE = std::string("image/j2c"); + LLSD headers; + headers["Content-Length"] = CONTENT_LENGTH; + headers["Content-Type"] = CONTENT_TYPE; + LLMimeIndex mime(headers, CONTENT_OFFSET); + ensure("headers are map", mime.headers().isMap()); + ensure_equals("offset", mime.offset(), CONTENT_OFFSET); + ensure_equals("content length", mime.contentLength(), CONTENT_LENGTH); + ensure_equals("type is image/j2c", mime.contentType(), CONTENT_TYPE); + ensure("not multipart", !mime.isMultipart()); + ensure_equals("no attachments", mime.subPartCount(), 0); + } + + template<> template<> + void mime_index_object_t::test<3>() + { + const S32 MULTI_CONTENT_LENGTH = 8000; + const S32 MULTI_CONTENT_OFFSET = 100; + const std::string MULTI_CONTENT_TYPE = std::string("multipart/mixed"); + LLSD headers; + headers["Content-Length"] = MULTI_CONTENT_LENGTH; + headers["Content-Type"] = MULTI_CONTENT_TYPE; + LLMimeIndex mime(headers, MULTI_CONTENT_OFFSET); + llinfos << "headers: " << LLSDOStreamer<LLSDNotationFormatter>(headers) + << llendl; + + + const S32 META_CONTENT_LENGTH = 700; + const S32 META_CONTENT_OFFSET = 69; + const std::string META_CONTENT_TYPE = std::string( + "text/llsd+xml"); + headers = LLSD::emptyMap(); + headers["Content-Length"] = META_CONTENT_LENGTH; + headers["Content-Type"] = META_CONTENT_TYPE; + LLMimeIndex meta(headers, META_CONTENT_OFFSET); + mime.attachSubPart(meta); + + const S32 IMAGE_CONTENT_LENGTH = 6000; + const S32 IMAGE_CONTENT_OFFSET = 200; + const std::string IMAGE_CONTENT_TYPE = std::string("image/j2c"); + headers = LLSD::emptyMap(); + headers["Content-Length"] = IMAGE_CONTENT_LENGTH; + headers["Content-Type"] = IMAGE_CONTENT_TYPE; + LLMimeIndex image(headers, IMAGE_CONTENT_OFFSET); + mime.attachSubPart(image); + + // make sure we have a valid multi-part + ensure("is multipart", mime.isMultipart()); + ensure_equals("multi offset", mime.offset(), MULTI_CONTENT_OFFSET); + ensure_equals( + "multi content length", + mime.contentLength(), + MULTI_CONTENT_LENGTH); + ensure_equals("two attachments", mime.subPartCount(), 2); + + // make sure ranged gets do the right thing with out of bounds + // sub-parts. + LLMimeIndex invalid_child(mime.subPart(-1)); + ensure("no headers", invalid_child.headers().isUndefined()); + ensure_equals("invalid offset", invalid_child.offset(), -1); + ensure_equals( + "invalid content length", invalid_child.contentLength(), -1); + ensure("no content type", invalid_child.contentType().empty()); + ensure("not multipart", !invalid_child.isMultipart()); + ensure_equals("no attachments", invalid_child.subPartCount(), 0); + + invalid_child = mime.subPart(2); + ensure("no headers", invalid_child.headers().isUndefined()); + ensure_equals("invalid offset", invalid_child.offset(), -1); + ensure_equals( + "invalid content length", invalid_child.contentLength(), -1); + ensure("no content type", invalid_child.contentType().empty()); + ensure("not multipart", !invalid_child.isMultipart()); + ensure_equals("no attachments", invalid_child.subPartCount(), 0); + } + + template<> template<> + void mime_index_object_t::test<4>() + { + const S32 MULTI_CONTENT_LENGTH = 8000; + const S32 MULTI_CONTENT_OFFSET = 100; + const std::string MULTI_CONTENT_TYPE = std::string("multipart/mixed"); + LLSD headers; + headers["Content-Length"] = MULTI_CONTENT_LENGTH; + headers["Content-Type"] = MULTI_CONTENT_TYPE; + LLMimeIndex mime(headers, MULTI_CONTENT_OFFSET); + + const S32 META_CONTENT_LENGTH = 700; + const S32 META_CONTENT_OFFSET = 69; + const std::string META_CONTENT_TYPE = std::string( + "application/llsd+xml"); + headers = LLSD::emptyMap(); + headers["Content-Length"] = META_CONTENT_LENGTH; + headers["Content-Type"] = META_CONTENT_TYPE; + LLMimeIndex meta(headers, META_CONTENT_OFFSET); + mime.attachSubPart(meta); + + const S32 IMAGE_CONTENT_LENGTH = 6000; + const S32 IMAGE_CONTENT_OFFSET = 200; + const std::string IMAGE_CONTENT_TYPE = std::string("image/j2c"); + headers = LLSD::emptyMap(); + headers["Content-Length"] = IMAGE_CONTENT_LENGTH; + headers["Content-Type"] = IMAGE_CONTENT_TYPE; + LLMimeIndex image(headers, IMAGE_CONTENT_OFFSET); + mime.attachSubPart(image); + + // check what we have + ensure("is multipart", mime.isMultipart()); + ensure_equals("multi offset", mime.offset(), MULTI_CONTENT_OFFSET); + ensure_equals( + "multi content length", + mime.contentLength(), + MULTI_CONTENT_LENGTH); + ensure_equals("two attachments", mime.subPartCount(), 2); + + LLMimeIndex actual_meta = mime.subPart(0); + ensure_equals( + "meta type", actual_meta.contentType(), META_CONTENT_TYPE); + ensure_equals( + "meta offset", actual_meta.offset(), META_CONTENT_OFFSET); + ensure_equals( + "meta content length", + actual_meta.contentLength(), + META_CONTENT_LENGTH); + + LLMimeIndex actual_image = mime.subPart(1); + ensure_equals( + "image type", actual_image.contentType(), IMAGE_CONTENT_TYPE); + ensure_equals( + "image offset", actual_image.offset(), IMAGE_CONTENT_OFFSET); + ensure_equals( + "image content length", + actual_image.contentLength(), + IMAGE_CONTENT_LENGTH); + } + +/* + template<> template<> + void mime_index_object_t::test<5>() + { + } + template<> template<> + void mime_index_object_t::test<6>() + { + } + template<> template<> + void mime_index_object_t::test<7>() + { + } + template<> template<> + void mime_index_object_t::test<8>() + { + } + template<> template<> + void mime_index_object_t::test<>() + { + } +*/ +} + + +namespace tut +{ + struct mime_parse + { + }; + typedef test_group<mime_parse> mime_parse_t; + typedef mime_parse_t::object mime_parse_object_t; + tut::mime_parse_t tut_mime_parse("LLMimeParse"); + + template<> template<> + void mime_parse_object_t::test<1>() + { + // parse one mime object + const std::string SERIALIZED_MIME("Content-Length: 200\r\nContent-Type: text/plain\r\n\r\naaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccc\r\n"); + std::stringstream istr; + istr.str(SERIALIZED_MIME); + LLMimeIndex mime; + LLMimeParser parser; + bool ok = parser.parseIndex(istr, mime); + ensure("Parse successful.", ok); + ensure_equals("content type", mime.contentType(), "text/plain"); + ensure_equals("content length", mime.contentLength(), 200); + ensure_equals("offset", mime.offset(), 49); + } + + template<> template<> + void mime_parse_object_t::test<2>() + { + // make sure we only parse one. + const std::string SERIALIZED_MIME("Content-Length: 200\r\nContent-Type: text/plain\r\n\r\naaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccc\r\n\r\nContent-Length: 200\r\nContent-Type: text/plain\r\n\r\naaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccc\r\n\r\n"); + std::stringstream istr; + istr.str(SERIALIZED_MIME); + LLMimeIndex mime; + LLMimeParser parser; + bool ok = parser.parseIndex(istr, mime); + ensure("Parse successful.", ok); + ensure("not multipart.", !mime.isMultipart()); + ensure_equals("content type", mime.contentType(), "text/plain"); + ensure_equals("content length", mime.contentLength(), 200); + ensure_equals("offset", mime.offset(), 49); + } + + template<> template<> + void mime_parse_object_t::test<3>() + { + // test multi-part and lack of content length for some of it. + /* +Content-Type: multipart/mixed; boundary="segment"rnContent-Length: 148rnrn--segmentrnContent-Type: text/plainrnrnsome datarnrn--segmentrnContent-Type: text/xml; charset=UTF-8rnContent-Length: 22rnrn<llsd><undef /></llsd>rnrn + */ + const std::string SERIALIZED_MIME("Content-Type: multipart/mixed; boundary=\"segment\"\r\nContent-Length: 150\r\n\r\n--segment\r\nContent-Type: text/plain\r\n\r\nsome data\r\n\r\n--segment\r\nContent-Type: text/xml; charset=UTF-8\r\nContent-Length: 22\r\n\r\n<llsd><undef /></llsd>\r\n\r\n"); + std::stringstream istr; + istr.str(SERIALIZED_MIME); + LLMimeIndex mime; + LLMimeParser parser; + bool ok = parser.parseIndex(istr, mime); + ensure("Parse successful.", ok); + ensure("is multipart.", mime.isMultipart()); + ensure_equals("sub-part count", mime.subPartCount(), 2); + ensure_equals("content length", mime.contentLength(), 150); + ensure_equals("data offset for multipart", mime.offset(), 74); + + LLMimeIndex mime_plain(mime.subPart(0)); + ensure_equals( + "first part type", + mime_plain.contentType(), + "text/plain"); + ensure_equals( + "first part content length not known.", + mime_plain.contentLength(), + -1); + ensure_equals("first part offset", mime_plain.offset(), 113); + + LLMimeIndex mime_xml(mime.subPart(1)); + ensure_equals( + "second part type", + mime_xml.contentType(), + "text/xml; charset=UTF-8"); + ensure_equals( + "second part content length", + mime_xml.contentLength(), + 22); + ensure_equals("second part offset", mime_xml.offset(), 198); + } + + template<> template<> + void mime_parse_object_t::test<4>() + { + // test multi-part, unquoted separator, and premature eof conditions + /* +Content-Type: multipart/mixed; boundary=segmentrnContent-Length: 220rnrn--segmentrnContent-Type: text/plainrnContent-Length: 55rnrnhow are you today?rnI do not know. I guess I am:n'fine'rnrn--segmentrnContent-Type: text/xml; charset=UTF-8rnContent-Length: 22rnrn<llsd><undef /></llsd>rnrn */ + const std::string SERIALIZED_MIME("Content-Type: multipart/mixed; boundary=segment\r\nContent-Length: 220\r\n\r\n--segment\r\nContent-Type: text/plain\r\nContent-Length: 55\r\n\r\nhow are you today?\r\nI do not know. I guess I am:\n'fine'\r\n\r\n--segment\r\nContent-Type: text/xml; charset=UTF-8\r\nContent-Length: 22\r\n\r\n<llsd><undef /></llsd>\r\n\r\n"); + std::stringstream istr; + istr.str(SERIALIZED_MIME); + LLMimeIndex mime; + LLMimeParser parser; + bool ok = parser.parseIndex(istr, mime); + ensure("Parse successful.", ok); + ensure("is multipart.", mime.isMultipart()); + ensure_equals("sub-part count", mime.subPartCount(), 2); + ensure_equals("content length", mime.contentLength(), 220); + ensure_equals("data offset for multipart", mime.offset(), 72); + + LLMimeIndex mime_plain(mime.subPart(0)); + ensure_equals( + "first part type", + mime_plain.contentType(), + "text/plain"); + ensure_equals( + "first part content length", + mime_plain.contentLength(), + 55); + ensure_equals("first part offset", mime_plain.offset(), 131); + + LLMimeIndex mime_xml(mime.subPart(1)); + ensure_equals( + "second part type", + mime_xml.contentType(), + "text/xml; charset=UTF-8"); + ensure_equals( + "second part content length", + mime_xml.contentLength(), + 22); + ensure_equals("second part offset", mime_xml.offset(), 262); + } + + template<> template<> + void mime_parse_object_t::test<5>() + { + // test multi-part with multiple params + const std::string SERIALIZED_MIME("Content-Type: multipart/mixed; boundary=segment; comment=\"testing multiple params.\"\r\nContent-Length: 220\r\n\r\n--segment\r\nContent-Type: text/plain\r\nContent-Length: 55\r\n\r\nhow are you today?\r\nI do not know. I guess I am:\n'fine'\r\n\r\n--segment\r\nContent-Type: text/xml; charset=UTF-8\r\nContent-Length: 22\r\n\r\n<llsd><undef /></llsd>\r\n\r\n"); + std::stringstream istr; + istr.str(SERIALIZED_MIME); + LLMimeIndex mime; + LLMimeParser parser; + bool ok = parser.parseIndex(istr, mime); + ensure("Parse successful.", ok); + ensure("is multipart.", mime.isMultipart()); + ensure_equals("sub-part count", mime.subPartCount(), 2); + ensure_equals("content length", mime.contentLength(), 220); + + LLMimeIndex mime_plain(mime.subPart(0)); + ensure_equals( + "first part type", + mime_plain.contentType(), + "text/plain"); + ensure_equals( + "first part content length", + mime_plain.contentLength(), + 55); + + LLMimeIndex mime_xml(mime.subPart(1)); + ensure_equals( + "second part type", + mime_xml.contentType(), + "text/xml; charset=UTF-8"); + ensure_equals( + "second part content length", + mime_xml.contentLength(), + 22); + } + + template<> template<> + void mime_parse_object_t::test<6>() + { + // test multi-part with no specified boundary and eof +/* +Content-Type: multipart/relatedrnContent-Length: 220rnrn--rnContent-Type: text/plainrnContent-Length: 55rnrnhow are you today?rnI do not know. I guess I am:n'fine'rnrn--rnContent-Type: text/xml; charset=UTF-8rnContent-Length: 22rnrn<llsd><undef /></llsd>rnrn +*/ + const std::string SERIALIZED_MIME("Content-Type: multipart/related\r\nContent-Length: 500\r\n\r\n--\r\nContent-Type: text/plain\r\nContent-Length: 55\r\n\r\nhow are you today?\r\nI do not know. I guess I am:\n'fine'\r\n\r\n--\r\nContent-Type: text/xml; charset=UTF-8\r\nContent-Length: 22\r\n\r\n<llsd><undef /></llsd>\r\n\r\n"); + std::stringstream istr; + istr.str(SERIALIZED_MIME); + LLMimeIndex mime; + LLMimeParser parser; + bool ok = parser.parseIndex(istr, mime); + ensure("Parse successful.", ok); + ensure("is multipart.", mime.isMultipart()); + ensure_equals("sub-part count", mime.subPartCount(), 2); + ensure_equals("content length", mime.contentLength(), 500); + ensure_equals("data offset for multipart", mime.offset(), 56); + + LLMimeIndex mime_plain(mime.subPart(0)); + ensure_equals( + "first part type", + mime_plain.contentType(), + "text/plain"); + ensure_equals( + "first part content length", + mime_plain.contentLength(), + 55); + ensure_equals("first part offset", mime_plain.offset(), 108); + + LLMimeIndex mime_xml(mime.subPart(1)); + ensure_equals( + "second part type", + mime_xml.contentType(), + "text/xml; charset=UTF-8"); + ensure_equals( + "second part content length", + mime_xml.contentLength(), + 22); + ensure_equals("second part offset", mime_xml.offset(), 232); + } + +/* + template<> template<> + void mime_parse_object_t::test<>() + { + } + template<> template<> + void mime_parse_object_t::test<>() + { + } + template<> template<> + void mime_parse_object_t::test<>() + { + } + template<> template<> + void mime_parse_object_t::test<>() + { + } +*/ +} diff --git a/indra/llmessage/tests/llmockhttpclient.h b/indra/llmessage/tests/llmockhttpclient.h new file mode 100644 index 0000000000..af26bf8803 --- /dev/null +++ b/indra/llmessage/tests/llmockhttpclient.h @@ -0,0 +1,66 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +/* Macro Definitions */ +#ifndef LL_LLMOCKHTTPCLIENT_H +#define LL_LLMOCKHTTPCLIENT_H + +#include "linden_common.h" +#include "llhttpclientinterface.h" + +#include <gmock/gmock.h> + +class LLMockHTTPClient : public LLHTTPClientInterface +{ +public: + MOCK_METHOD2(get, void(const std::string& url, LLCurl::ResponderPtr responder)); + MOCK_METHOD3(get, void(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers)); + MOCK_METHOD3(put, void(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder)); +}; + +// A helper to match responder types +template<typename T> +struct ResponderType +{ + bool operator()(LLCurl::ResponderPtr ptr) const + { + T* p = dynamic_cast<T*>(ptr.get()); + return p != NULL; + } +}; + +inline bool operator==(const LLSD& l, const LLSD& r) +{ + std::ostringstream ls, rs; + ls << l; + rs << r; + return ls.str() == rs.str(); + +} + + +#endif //LL_LLMOCKHTTPCLIENT_H + diff --git a/indra/llmessage/tests/llnamevalue_test.cpp b/indra/llmessage/tests/llnamevalue_test.cpp new file mode 100644 index 0000000000..8902fdd2e8 --- /dev/null +++ b/indra/llmessage/tests/llnamevalue_test.cpp @@ -0,0 +1,406 @@ +/** + * @file llnamevalue_test.cpp + * @author Adroit + * @date 2007-02 + * @brief LLNameValue unit test + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "llsdserialize.h" + +#include "../llnamevalue.h" + +#include "../test/lltut.h" + + +#if LL_WINDOWS +// disable unreachable code warnings +#pragma warning(disable: 4702) +#endif + +namespace tut +{ + struct namevalue_test + { + namevalue_test() + { + } + }; + typedef test_group<namevalue_test> namevalue_t; + typedef namevalue_t::object namevalue_object_t; + tut::namevalue_t tut_namevalue("LLNameValue"); + + + template<> template<> + void namevalue_object_t::test<1>() + { + // LLNameValue() + LLNameValue nValue; + ensure("mName should have been NULL", nValue.mName == NULL); + ensure("getTypeEnum failed",nValue.getTypeEnum() == NVT_NULL); + ensure("getClassEnum failed",nValue.getClassEnum() == NVC_NULL); + ensure("getSendtoEnum failed",nValue.getSendtoEnum() == NVS_NULL); + + LLNameValue nValue1(" SecondLife ASSET RW SIM 232324343"); + + } + + // LLNameValue(const char* data); + // LLNameValue(const char* name, const char* data, const char* type, const char* nvclass, const char* nvsendto, + // TNameValueCallback nvcb = NULL, void** user_data = NULL); + template<> template<> + void namevalue_object_t::test<2>() + { + LLNameValue nValue(" SecondLife ASSET RW S 232324343"); + ensure("mName not set correctly", (0 == strcmp(nValue.mName,"SecondLife"))); + ensure("getTypeEnum failed", nValue.getTypeEnum() == NVT_ASSET); + ensure("getClassEnum failed", nValue.getClassEnum() == NVC_READ_WRITE); + ensure("getSendtoEnum failed", nValue.getSendtoEnum() == NVS_SIM); + ensure("getString failed", (0==strcmp(nValue.getAsset(),"232324343"))); + ensure("sendToData or sendToViewer failed", !nValue.sendToData() && !nValue.sendToViewer()); + + LLNameValue nValue1("\n\r SecondLife_1 STRING READ_WRITE SIM 232324343"); + ensure("1. mName not set correctly", (0 == strcmp(nValue1.mName,"SecondLife_1"))); + ensure("1. getTypeEnum failed", nValue1.getTypeEnum() == NVT_STRING); + ensure("1. getClassEnum failed", nValue1.getClassEnum() == NVC_READ_WRITE); + ensure("1. getSendtoEnum failed", nValue1.getSendtoEnum() == NVS_SIM); + ensure("1. getString failed", (0==strcmp(nValue1.getString(),"232324343"))); + ensure("1. sendToData or sendToViewer failed", !nValue1.sendToData() && !nValue1.sendToViewer()); + + LLNameValue nValue2("SecondLife", "23.5", "F32", "R", "DS"); + ensure("2. getTypeEnum failed", nValue2.getTypeEnum() == NVT_F32); + ensure("2. getClassEnum failed", nValue2.getClassEnum() == NVC_READ_ONLY); + ensure("2. getSendtoEnum failed", nValue2.getSendtoEnum() == NVS_DATA_SIM); + ensure("2. getF32 failed", *nValue2.getF32() == 23.5f); + ensure("2. sendToData or sendToViewer failed", nValue2.sendToData() && !nValue2.sendToViewer()); + + LLNameValue nValue3("SecondLife", "-43456787", "S32", "READ_ONLY", "SIM_SPACE"); + ensure("3. getTypeEnum failed", nValue3.getTypeEnum() == NVT_S32); + ensure("3. getClassEnum failed", nValue3.getClassEnum() == NVC_READ_ONLY); + ensure("3. getSendtoEnum failed", nValue3.getSendtoEnum() == NVS_DATA_SIM); + ensure("3. getS32 failed", *nValue3.getS32() == -43456787); + ensure("sendToData or sendToViewer failed", nValue3.sendToData() && !nValue3.sendToViewer()); + + LLNameValue nValue4("SecondLife", "<1.0, 2.0, 3.0>", "VEC3", "RW", "SV"); + LLVector3 llvec4(1.0, 2.0, 3.0); + ensure("4. getTypeEnum failed", nValue4.getTypeEnum() == NVT_VEC3); + ensure("4. getClassEnum failed", nValue4.getClassEnum() == NVC_READ_WRITE); + ensure("4. getSendtoEnum failed", nValue4.getSendtoEnum() == NVS_SIM_VIEWER); + ensure("4. getVec3 failed", *nValue4.getVec3() == llvec4); + ensure("4. sendToData or sendToViewer failed", !nValue4.sendToData() && nValue4.sendToViewer()); + + LLNameValue nValue5("SecondLife", "-1.0, 2.4, 3", "VEC3", "RW", "SIM_VIEWER"); + LLVector3 llvec5(-1.0f, 2.4f, 3); + ensure("5. getTypeEnum failed", nValue5.getTypeEnum() == NVT_VEC3); + ensure("5. getClassEnum failed", nValue5.getClassEnum() == NVC_READ_WRITE); + ensure("5. getSendtoEnum failed", nValue5.getSendtoEnum() == NVS_SIM_VIEWER); + ensure("5. getVec3 failed", *nValue5.getVec3() == llvec5); + ensure("5. sendToData or sendToViewer failed", !nValue5.sendToData() && nValue5.sendToViewer()); + + LLNameValue nValue6("SecondLife", "89764323", "U32", "RW", "DSV"); + ensure("6. getTypeEnum failed", nValue6.getTypeEnum() == NVT_U32); + ensure("6. getClassEnum failed", nValue6.getClassEnum() == NVC_READ_WRITE); + ensure("6. getSendtoEnum failed", nValue6.getSendtoEnum() == NVS_DATA_SIM_VIEWER); + ensure("6. getU32 failed", *nValue6.getU32() == 89764323); + ensure("6. sendToData or sendToViewer failed", nValue6.sendToData() && nValue6.sendToViewer()); + + LLNameValue nValue7("SecondLife", "89764323323232", "U64", "RW", "SIM_SPACE_VIEWER"); + U64 u64_7 = U64L(89764323323232); + ensure("7. getTypeEnum failed", nValue7.getTypeEnum() == NVT_U64); + ensure("7. getClassEnum failed", nValue7.getClassEnum() == NVC_READ_WRITE); + ensure("7. getSendtoEnum failed", nValue7.getSendtoEnum() == NVS_DATA_SIM_VIEWER); + ensure("7. getU32 failed", *nValue7.getU64() == u64_7); + ensure("7. sendToData or sendToViewer failed", nValue7.sendToData() && nValue7.sendToViewer()); + } + + // LLNameValue(const char* name, const char* data, const char* type, const char* nvclass, + // TNameValueCallback nvcb = NULL, void** user_data = NULL); + template<> template<> + void namevalue_object_t::test<3>() + { + LLNameValue nValue("SecondLife", "232324343", "ASSET", "READ_WRITE"); + ensure("mName not set correctly", (0 == strcmp(nValue.mName,"SecondLife"))); + ensure("getTypeEnum failed", nValue.getTypeEnum() == NVT_ASSET); + ensure("getClassEnum failed", nValue.getClassEnum() == NVC_READ_WRITE); + ensure("getSendtoEnum failed", nValue.getSendtoEnum() == NVS_SIM); + ensure("getString failed", (0==strcmp(nValue.getAsset(),"232324343"))); + + LLNameValue nValue1("SecondLife", "232324343", "STRING", "READ_WRITE"); + ensure("1. mName not set correctly", (0 == strcmp(nValue1.mName,"SecondLife"))); + ensure("1. getTypeEnum failed", nValue1.getTypeEnum() == NVT_STRING); + ensure("1. getClassEnum failed", nValue1.getClassEnum() == NVC_READ_WRITE); + ensure("1. getSendtoEnum failed", nValue1.getSendtoEnum() == NVS_SIM); + ensure("1. getString failed", (0==strcmp(nValue1.getString(),"232324343"))); + + LLNameValue nValue2("SecondLife", "23.5", "F32", "R"); + ensure("2. getTypeEnum failed", nValue2.getTypeEnum() == NVT_F32); + ensure("2. getClassEnum failed", nValue2.getClassEnum() == NVC_READ_ONLY); + ensure("2. getSendtoEnum failed", nValue2.getSendtoEnum() == NVS_SIM); + ensure("2. getF32 failed", *nValue2.getF32() == 23.5f); + + LLNameValue nValue3("SecondLife", "-43456787", "S32", "READ_ONLY"); + ensure("3. getTypeEnum failed", nValue3.getTypeEnum() == NVT_S32); + ensure("3. getClassEnum failed", nValue3.getClassEnum() == NVC_READ_ONLY); + ensure("3. getSendtoEnum failed", nValue3.getSendtoEnum() == NVS_SIM); + ensure("3. getS32 failed", *nValue3.getS32() == -43456787); + + LLNameValue nValue4("SecondLife", "<1.0, 2.0, 3.0>", "VEC3", "RW"); + LLVector3 llvec4(1.0, 2.0, 3.0); + ensure("4. getTypeEnum failed", nValue4.getTypeEnum() == NVT_VEC3); + ensure("4. getClassEnum failed", nValue4.getClassEnum() == NVC_READ_WRITE); + ensure("4. getSendtoEnum failed", nValue4.getSendtoEnum() == NVS_SIM); + ensure("4. getVec3 failed", *nValue4.getVec3() == llvec4); + + LLNameValue nValue5("SecondLife", "-1.0, 2.4, 3", "VEC3", "RW"); + LLVector3 llvec5(-1.0f, 2.4f, 3); + ensure("5. getTypeEnum failed", nValue5.getTypeEnum() == NVT_VEC3); + ensure("5. getClassEnum failed", nValue5.getClassEnum() == NVC_READ_WRITE); + ensure("5. getSendtoEnum failed", nValue5.getSendtoEnum() == NVS_SIM); + ensure("5. getVec3 failed", *nValue5.getVec3() == llvec5); + + LLNameValue nValue6("SecondLife", "89764323", "U32", "RW"); + ensure("6. getTypeEnum failed", nValue6.getTypeEnum() == NVT_U32); + ensure("6. getClassEnum failed", nValue6.getClassEnum() == NVC_READ_WRITE); + ensure("6. getSendtoEnum failed", nValue6.getSendtoEnum() == NVS_SIM); + ensure("6. getU32 failed", *nValue6.getU32() == 89764323); + + LLNameValue nValue7("SecondLife", "89764323323232", "U64", "RW"); + U64 u64_7 = U64L(89764323323232); + ensure("7. getTypeEnum failed", nValue7.getTypeEnum() == NVT_U64); + ensure("7. getClassEnum failed", nValue7.getClassEnum() == NVC_READ_WRITE); + ensure("7. getSendtoEnum failed", nValue7.getSendtoEnum() == NVS_SIM); + ensure("7. getU32 failed", *nValue7.getU64() == u64_7); + } + + // LLNameValue(const char* name, const char* type, const char* nvclass, + // TNameValueCallback nvcb = NULL, void** user_data = NULL); + template<> template<> + void namevalue_object_t::test<4>() + { + LLNameValue nValue("SecondLife", "STRING", "READ_WRITE"); + ensure("mName not set correctly", (0 == strcmp(nValue.mName,"SecondLife"))); + ensure("getTypeEnum failed", nValue.getTypeEnum() == NVT_STRING); + ensure("getClassEnum failed", nValue.getClassEnum() == NVC_READ_WRITE); + ensure("getSendtoEnum failed", nValue.getSendtoEnum() == NVS_SIM); + + LLNameValue nValue1("SecondLife", "ASSET", "READ_WRITE"); + ensure("1. mName not set correctly", (0 == strcmp(nValue1.mName,"SecondLife"))); + ensure("1. getTypeEnum for RW failed", nValue1.getTypeEnum() == NVT_ASSET); + ensure("1. getClassEnum for RW failed", nValue1.getClassEnum() == NVC_READ_WRITE); + ensure("1. getSendtoEnum for RW failed", nValue1.getSendtoEnum() == NVS_SIM); + + LLNameValue nValue2("SecondLife", "F32", "READ_ONLY"); + ensure("2. getTypeEnum failed", nValue2.getTypeEnum() == NVT_F32); + ensure("2. getClassEnum failed", nValue2.getClassEnum() == NVC_READ_ONLY); + ensure("2. getSendtoEnum failed", nValue2.getSendtoEnum() == NVS_SIM); + + LLNameValue nValue3("SecondLife", "S32", "READ_ONLY"); + ensure("3. getTypeEnum failed", nValue3.getTypeEnum() == NVT_S32); + ensure("3. getClassEnum failed", nValue3.getClassEnum() == NVC_READ_ONLY); + ensure("3. getSendtoEnum failed", nValue3.getSendtoEnum() == NVS_SIM); + + LLNameValue nValue4("SecondLife", "VEC3", "READ_WRITE"); + ensure("4. getTypeEnum failed", nValue4.getTypeEnum() == NVT_VEC3); + ensure("4. getClassEnum failed", nValue4.getClassEnum() == NVC_READ_WRITE); + ensure("4. getSendtoEnum failed", nValue4.getSendtoEnum() == NVS_SIM); + + LLNameValue nValue6("SecondLife", "U32", "READ_WRITE"); + ensure("6. getTypeEnum failed", nValue6.getTypeEnum() == NVT_U32); + ensure("6. getClassEnum failed", nValue6.getClassEnum() == NVC_READ_WRITE); + ensure("6. getSendtoEnum failed", nValue6.getSendtoEnum() == NVS_SIM); + + LLNameValue nValue7("SecondLife", "U64", "READ_WRITE"); + ensure("7. getTypeEnum failed", nValue7.getTypeEnum() == NVT_U64); + ensure("7. getClassEnum failed", nValue7.getClassEnum() == NVC_READ_WRITE); + ensure("7. getSendtoEnum failed", nValue7.getSendtoEnum() == NVS_SIM); + } + + template<> template<> + void namevalue_object_t::test<5>() + { + LLNameValue nValue("SecondLife", "This is a test", "STRING", "RW", "SIM"); + + ensure("getString failed", (0 == strcmp(nValue.getString(),"This is a test"))); + } + + template<> template<> + void namevalue_object_t::test<6>() + { + LLNameValue nValue("SecondLife", "This is a test", "ASSET", "RW", "S"); + ensure("getAsset failed", (0 == strcmp(nValue.getAsset(),"This is a test"))); + } + + template<> template<> + void namevalue_object_t::test<7>() + { + LLNameValue nValue("SecondLife", "555555", "F32", "RW", "SIM"); + + ensure("getF32 failed",*nValue.getF32() == 555555.f); + } + + template<> template<> + void namevalue_object_t::test<8>() + { + LLNameValue nValue("SecondLife", "-5555", "S32", "RW", "SIM"); + + ensure("getS32 failed", *nValue.getS32() == -5555); + + S32 sVal = 0x7FFFFFFF; + nValue.setS32(sVal); + ensure("getS32 failed", *nValue.getS32() == sVal); + + sVal = -0x7FFFFFFF; + nValue.setS32(sVal); + ensure("getS32 failed", *nValue.getS32() == sVal); + + sVal = 0; + nValue.setS32(sVal); + ensure("getS32 failed", *nValue.getS32() == sVal); + } + + template<> template<> + void namevalue_object_t::test<9>() + { + LLNameValue nValue("SecondLife", "<-3, 2, 1>", "VEC3", "RW", "SIM"); + LLVector3 vecExpected(-3, 2, 1); + LLVector3 vec; + nValue.getVec3(vec); + ensure("getVec3 failed", vec == vecExpected); + } + + template<> template<> + void namevalue_object_t::test<10>() + { + LLNameValue nValue("SecondLife", "12345678", "U32", "RW", "SIM"); + + ensure("getU32 failed",*nValue.getU32() == 12345678); + + U32 val = 0xFFFFFFFF; + nValue.setU32(val); + ensure("U32 max", *nValue.getU32() == val); + + val = 0; + nValue.setU32(val); + ensure("U32 min", *nValue.getU32() == val); + } + + template<> template<> + void namevalue_object_t::test<11>() + { + //skip_fail("incomplete support for U64."); + LLNameValue nValue("SecondLife", "44444444444", "U64", "RW", "SIM"); + + ensure("getU64 failed",*nValue.getU64() == U64L(44444444444)); + + // there is no LLNameValue::setU64() + } + + + template<> template<> + void namevalue_object_t::test<12>() + { + //skip_fail("incomplete support for U64."); + LLNameValue nValue("SecondLife U64 RW DSV 44444444444"); + std::string ret_str = nValue.printNameValue(); + + ensure_equals("1:printNameValue failed",ret_str,"SecondLife U64 RW DSV 44444444444"); + + LLNameValue nValue1(ret_str.c_str()); + ensure_equals("Serialization of printNameValue failed", *nValue.getU64(), *nValue1.getU64()); + } + + template<> template<> + void namevalue_object_t::test<13>() + { + LLNameValue nValue("SecondLife STRING RW DSV 44444444444"); + std::string ret_str = nValue.printData(); + ensure_equals("1:printData failed",ret_str,"44444444444"); + + LLNameValue nValue1("SecondLife S32 RW DSV 44444"); + ret_str = nValue1.printData(); + ensure_equals("2:printData failed",ret_str,"44444"); + } + + template<> template<> + void namevalue_object_t::test<14>() + { + LLNameValue nValue("SecodLife STRING RW SIM 22222"); + std::ostringstream stream1,stream2,stream3, stream4, stream5; + stream1 << nValue; + ensure_equals("STRING << failed",stream1.str(),"22222"); + + LLNameValue nValue1("SecodLife F32 RW SIM 22222"); + stream2 << nValue1; + ensure_equals("F32 << failed",stream2.str(),"22222"); + + LLNameValue nValue2("SecodLife S32 RW SIM 22222"); + stream3<< nValue2; + ensure_equals("S32 << failed",stream3.str(),"22222"); + + LLNameValue nValue3("SecodLife U32 RW SIM 122222"); + stream4<< nValue3; + ensure_equals("U32 << failed",stream4.str(),"122222"); + + // I don't think we use U64 name value pairs. JC + //skip_fail("incomplete support for U64."); + //LLNameValue nValue4("SecodLife U64 RW SIM 22222"); + //stream5<< nValue4; + //ensure("U64 << failed",0 == strcmp((stream5.str()).c_str(),"22222")); + } + + template<> template<> + void namevalue_object_t::test<15>() + { + LLNameValue nValue("SecondLife", "This is a test", "ASSET", "R", "S"); + + ensure("getAsset failed", (0 == strcmp(nValue.getAsset(),"This is a test"))); + // this should not have updated as it is read only. + nValue.setAsset("New Value should not be updated"); + ensure("setAsset on ReadOnly failed", (0 == strcmp(nValue.getAsset(),"This is a test"))); + + LLNameValue nValue1("SecondLife", "1234", "U32", "R", "S"); + // this should not have updated as it is read only. + nValue1.setU32(4567); + ensure("setU32 on ReadOnly failed", *nValue1.getU32() == 1234); + + LLNameValue nValue2("SecondLife", "1234", "S32", "R", "S"); + // this should not have updated as it is read only. + nValue2.setS32(4567); + ensure("setS32 on ReadOnly failed", *nValue2.getS32() == 1234); + + LLNameValue nValue3("SecondLife", "1234", "F32", "R", "S"); + // this should not have updated as it is read only. + nValue3.setF32(4567); + ensure("setF32 on ReadOnly failed", *nValue3.getF32() == 1234); + + LLNameValue nValue4("SecondLife", "<1,2,3>", "VEC3", "R", "S"); + // this should not have updated as it is read only. + LLVector3 vec(4,5,6); + nValue3.setVec3(vec); + LLVector3 vec1(1,2,3); + ensure("setVec3 on ReadOnly failed", *nValue4.getVec3() == vec1); + + // cant test for U64 as no set64 exists nor any operators support U64 type + } +} diff --git a/indra/llmessage/tests/llpartdata_test.cpp b/indra/llmessage/tests/llpartdata_test.cpp new file mode 100644 index 0000000000..9123bd06c7 --- /dev/null +++ b/indra/llmessage/tests/llpartdata_test.cpp @@ -0,0 +1,216 @@ +/** + * @file llpartdata_tut.cpp + * @author Adroit + * @date March 2007 + * @brief LLPartData and LLPartSysData test cases. + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "lldatapacker.h" +#include "v3math.h" +#include "llsdserialize.h" +#include "message.h" + +#include "../llpartdata.h" + +#include "../test/lltut.h" + +namespace tut +{ + + struct partdata_test + { + }; + typedef test_group<partdata_test> partdata_test_t; + typedef partdata_test_t::object partdata_test_object_t; + tut::partdata_test_t tut_partdata_test("LLPartData"); + + template<> template<> + void partdata_test_object_t::test<1>() + { + LLPartData llpdata,llpdata1; + U8 pkbuf[128]; + + llpdata.setFlags(LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK | + LLPartData::LL_PART_BOUNCE_MASK | LLPartData::LL_PART_WIND_MASK | LLPartData::LL_PART_FOLLOW_SRC_MASK | + LLPartData::LL_PART_FOLLOW_VELOCITY_MASK | LLPartData::LL_PART_TARGET_POS_MASK | LLPartData::LL_PART_TARGET_LINEAR_MASK | + LLPartData::LL_PART_EMISSIVE_MASK | LLPartData::LL_PART_BEAM_MASK | LLPartData::LL_PART_DEAD_MASK); + + llpdata.setMaxAge(29.3f); + + LLVector3 llvec1(1.0f, .5f, .25f); + llpdata.setStartColor(llvec1); + llpdata.setStartAlpha(.7f); + + LLVector3 llvec2(.2f, .3f, 1.0f); + llpdata.setEndColor(llvec2); + llpdata.setEndAlpha(1.0f); + + llpdata.setStartScale(3.23f, 4.0f); + llpdata.setEndScale(2.4678f, 1.0f); + + LLDataPackerBinaryBuffer dp((U8*)pkbuf, 128); + llpdata.pack(dp); + + S32 cur_size = dp.getCurrentSize(); + + LLDataPackerBinaryBuffer dp1((U8*)pkbuf, cur_size); + llpdata1.unpack(dp1); + + ensure("1.mFlags values are different after unpacking", llpdata1.mFlags == llpdata.mFlags); + ensure_approximately_equals("2.mMaxAge values are different after unpacking", llpdata1.mMaxAge, llpdata.mMaxAge, 8); + + ensure_approximately_equals("3.mStartColor[0] values are different after unpacking", llpdata1.mStartColor.mV[0], llpdata.mStartColor.mV[0], 8); + ensure_approximately_equals("4.mStartColor[1] values are different after unpacking", llpdata1.mStartColor.mV[1], llpdata.mStartColor.mV[1], 8); + ensure_approximately_equals("5.mStartColor[2] values are different after unpacking", llpdata1.mStartColor.mV[2], llpdata.mStartColor.mV[2], 8); + ensure_approximately_equals("6.mStartColor[3] values are different after unpacking", llpdata1.mStartColor.mV[3], llpdata.mStartColor.mV[3], 8); + + ensure_approximately_equals("7.mEndColor[0] values are different after unpacking", llpdata1.mEndColor.mV[0], llpdata.mEndColor.mV[0], 8); + ensure_approximately_equals("8.mEndColor[1] values are different after unpacking", llpdata1.mEndColor.mV[1], llpdata.mEndColor.mV[1], 8); + ensure_approximately_equals("9.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[2], llpdata.mEndColor.mV[2], 8); + ensure_approximately_equals("10.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[3], llpdata.mEndColor.mV[3], 8); + + ensure_approximately_equals("11.mStartScale[0] values are different after unpacking", llpdata1.mStartScale.mV[0], llpdata.mStartScale.mV[0], 5); + ensure_approximately_equals("12.mStartScale[1] values are different after unpacking", llpdata1.mStartScale.mV[1], llpdata.mStartScale.mV[1], 5); + + ensure_approximately_equals("13.mEndScale[0] values are different after unpacking", llpdata1.mEndScale.mV[0], llpdata.mEndScale.mV[0], 5); + ensure_approximately_equals("14.mEndScale[1] values are different after unpacking", llpdata1.mEndScale.mV[1], llpdata.mEndScale.mV[1], 5); + } + + + template<> template<> + void partdata_test_object_t::test<2>() + { + LLPartData llpdata,llpdata1; + + llpdata.setFlags(LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK | + LLPartData::LL_PART_BOUNCE_MASK | LLPartData::LL_PART_WIND_MASK | LLPartData::LL_PART_FOLLOW_SRC_MASK | + LLPartData::LL_PART_FOLLOW_VELOCITY_MASK | LLPartData::LL_PART_TARGET_POS_MASK | LLPartData::LL_PART_TARGET_LINEAR_MASK | + LLPartData::LL_PART_EMISSIVE_MASK | LLPartData::LL_PART_BEAM_MASK | LLPartData::LL_PART_DEAD_MASK); + + llpdata.setMaxAge(29.3f); + + LLVector3 llvec1(1.0f, .5f, .25f); + llpdata.setStartColor(llvec1); + llpdata.setStartAlpha(.7f); + + LLVector3 llvec2(.2f, .3f, 1.0f); + llpdata.setEndColor(llvec2); + llpdata.setEndAlpha(1.0f); + + llpdata.setStartScale(3.23f, 4.0f); + llpdata.setEndScale(2.4678f, 1.0f); + + LLSD llsd = llpdata.asLLSD(); + + llpdata1.fromLLSD(llsd); + + ensure("1.mFlags values are different after unpacking", llpdata1.mFlags == llpdata.mFlags); + ensure_approximately_equals("2.mMaxAge values are different after unpacking", llpdata1.mMaxAge, llpdata.mMaxAge, 8); + + ensure_approximately_equals("3.mStartColor[0] values are different after unpacking", llpdata1.mStartColor.mV[0], llpdata.mStartColor.mV[0], 8); + ensure_approximately_equals("4.mStartColor[1] values are different after unpacking", llpdata1.mStartColor.mV[1], llpdata.mStartColor.mV[1], 8); + ensure_approximately_equals("5.mStartColor[2] values are different after unpacking", llpdata1.mStartColor.mV[2], llpdata.mStartColor.mV[2], 8); + ensure_approximately_equals("6.mStartColor[3] values are different after unpacking", llpdata1.mStartColor.mV[3], llpdata.mStartColor.mV[3], 8); + + ensure_approximately_equals("7.mEndColor[0] values are different after unpacking", llpdata1.mEndColor.mV[0], llpdata.mEndColor.mV[0], 8); + ensure_approximately_equals("8.mEndColor[1] values are different after unpacking", llpdata1.mEndColor.mV[1], llpdata.mEndColor.mV[1], 8); + ensure_approximately_equals("9.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[2], llpdata.mEndColor.mV[2], 8); + ensure_approximately_equals("10.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[3], llpdata.mEndColor.mV[3], 8); + + ensure_approximately_equals("11.mStartScale[0] values are different after unpacking", llpdata1.mStartScale.mV[0], llpdata.mStartScale.mV[0], 5); + ensure_approximately_equals("12.mStartScale[1] values are different after unpacking", llpdata1.mStartScale.mV[1], llpdata.mStartScale.mV[1], 5); + + ensure_approximately_equals("13.mEndScale[0] values are different after unpacking", llpdata1.mEndScale.mV[0], llpdata.mEndScale.mV[0], 5); + ensure_approximately_equals("14.mEndScale[1] values are different after unpacking", llpdata1.mEndScale.mV[1], llpdata.mEndScale.mV[1], 5); + } + + +//*********llpartsysdata*********** + + template<> template<> + void partdata_test_object_t::test<3>() + { + LLPartSysData llpsysdata, llpsysdata1; + U8 pkbuf[256]; + llpsysdata.setBurstSpeedMin(33.33f); + ensure("1.mBurstSpeedMin coudnt be set", 33.33f == llpsysdata.mBurstSpeedMin); + + llpsysdata.setBurstSpeedMax(44.44f); + ensure("2.mBurstSpeedMax coudnt be set", 44.44f == llpsysdata.mBurstSpeedMax); + + llpsysdata.setBurstRadius(45.55f); + ensure("3.mBurstRadius coudnt be set", 45.55f == llpsysdata.mBurstRadius); + + LLVector3 llvec(44.44f, 111.11f, -40.4f); + llpsysdata.setPartAccel(llvec); + + llpsysdata.mCRC = 0xFFFFFFFF; + llpsysdata.mFlags = 0x20; + + llpsysdata.mPattern = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY; + + llpsysdata.mMaxAge = 99.99f; + llpsysdata.mStartAge = 18.5f; + llpsysdata.mInnerAngle = 4.234f; + llpsysdata.mOuterAngle = 7.123f; + llpsysdata.mBurstRate = 245.53f; + llpsysdata.mBurstPartCount = 0xFF; + llpsysdata.mAngularVelocity = llvec; + + llpsysdata.mPartImageID.generate(); + llpsysdata.mTargetUUID.generate(); + + LLDataPackerBinaryBuffer dp((U8*)pkbuf, 256); + llpsysdata.pack(dp); + S32 cur_size = dp.getCurrentSize(); + LLDataPackerBinaryBuffer dp1((U8*)pkbuf, cur_size); + llpsysdata1.unpack(dp1); + + ensure("1.mCRC's not equal", llpsysdata.mCRC == llpsysdata1.mCRC); + ensure("2.mFlags's not equal", llpsysdata.mFlags == llpsysdata1.mFlags); + ensure("3.mPattern's not equal", llpsysdata.mPattern == llpsysdata1.mPattern); + ensure_approximately_equals("4.mMaxAge's not equal", llpsysdata.mMaxAge , llpsysdata1.mMaxAge, 8); + ensure_approximately_equals("5.mStartAge's not equal", llpsysdata.mStartAge, llpsysdata1.mStartAge, 8); + ensure_approximately_equals("6.mOuterAngle's not equal", llpsysdata.mOuterAngle, llpsysdata1.mOuterAngle, 5); + ensure_approximately_equals("7.mInnerAngles's not equal", llpsysdata.mInnerAngle, llpsysdata1.mInnerAngle, 5); + ensure_approximately_equals("8.mBurstRate's not equal", llpsysdata.mBurstRate, llpsysdata1.mBurstRate, 8); + ensure("9.mBurstPartCount's not equal", llpsysdata.mBurstPartCount == llpsysdata1.mBurstPartCount); + + ensure_approximately_equals("10.mBurstSpeedMin's not equal", llpsysdata.mBurstSpeedMin, llpsysdata1.mBurstSpeedMin, 8); + ensure_approximately_equals("11.mBurstSpeedMax's not equal", llpsysdata.mBurstSpeedMax, llpsysdata1.mBurstSpeedMax, 8); + + ensure_approximately_equals("12.mAngularVelocity's not equal", llpsysdata.mAngularVelocity.mV[0], llpsysdata1.mAngularVelocity.mV[0], 7); + ensure_approximately_equals("13.mAngularVelocity's not equal", llpsysdata.mAngularVelocity.mV[1], llpsysdata1.mAngularVelocity.mV[1], 7); + ensure_approximately_equals("14.mAngularVelocity's not equal", llpsysdata.mAngularVelocity.mV[2], llpsysdata1.mAngularVelocity.mV[2], 7); + + ensure_approximately_equals("15.mPartAccel's not equal", llpsysdata.mPartAccel.mV[0], llpsysdata1.mPartAccel.mV[0], 7); + ensure_approximately_equals("16.mPartAccel's not equal", llpsysdata.mPartAccel.mV[1], llpsysdata1.mPartAccel.mV[1], 7); + ensure_approximately_equals("17.mPartAccel's not equal", llpsysdata.mPartAccel.mV[2], llpsysdata1.mPartAccel.mV[2], 7); + + ensure("18.mPartImageID's not equal", llpsysdata.mPartImageID == llpsysdata1.mPartImageID); + ensure("19.mTargetUUID's not equal", llpsysdata.mTargetUUID == llpsysdata1.mTargetUUID); + ensure_approximately_equals("20.mBurstRadius's not equal", llpsysdata.mBurstRadius, llpsysdata1.mBurstRadius, 8); + } +} diff --git a/indra/llmessage/tests/llregionpresenceverifier_test.cpp b/indra/llmessage/tests/llregionpresenceverifier_test.cpp new file mode 100644 index 0000000000..5b89f2a8c6 --- /dev/null +++ b/indra/llmessage/tests/llregionpresenceverifier_test.cpp @@ -0,0 +1,108 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "../test/lltut.h" +#include "llregionpresenceverifier.h" +#include "llcurl_stub.cpp" +#include "llhost.cpp" +#include "net.cpp" +#include "lltesthttpclientadapter.cpp" + +class LLTestResponse : public LLRegionPresenceVerifier::Response +{ +public: + + virtual bool checkValidity(const LLSD& content) const + { + return true; + } + + virtual void onRegionVerified(const LLSD& region_details) + { + } + + virtual void onRegionVerificationFailed() + { + } + + virtual LLHTTPClientInterface& getHttpClient() + { + return mHttpInterface; + } + + LLTestHTTPClientAdapter mHttpInterface; +}; + +namespace tut +{ + struct LLRegionPresenceVerifierData + { + LLRegionPresenceVerifierData() : + mResponse(new LLTestResponse()), + mResponder("", LLRegionPresenceVerifier::ResponsePtr(mResponse), + LLSD(), 3) + { + } + + LLTestResponse* mResponse; + LLRegionPresenceVerifier::VerifiedDestinationResponder mResponder; + }; + + typedef test_group<LLRegionPresenceVerifierData> factory; + typedef factory::object object; +} + +namespace +{ + tut::factory tf("LLRegionPresenceVerifier"); +} + +namespace tut +{ + // Test that VerifiedDestinationResponder does retry + // on error when shouldRetry returns true. + template<> template<> + void object::test<1>() + { + mResponder.error(500, "Internal server error"); + ensure_equals(mResponse->mHttpInterface.mGetUrl.size(), 1); + } + + // Test that VerifiedDestinationResponder only retries + // on error until shouldRetry returns false. + template<> template<> + void object::test<2>() + { + mResponder.error(500, "Internal server error"); + mResponder.error(500, "Internal server error"); + mResponder.error(500, "Internal server error"); + mResponder.error(500, "Internal server error"); + ensure_equals(mResponse->mHttpInterface.mGetUrl.size(), 3); + } +} + diff --git a/indra/llmessage/tests/llsdmessage_test.cpp b/indra/llmessage/tests/llsdmessage_test.cpp new file mode 100644 index 0000000000..9998a1b8bb --- /dev/null +++ b/indra/llmessage/tests/llsdmessage_test.cpp @@ -0,0 +1,157 @@ +/** + * @file llsdmessage_test.cpp + * @author Nat Goodspeed + * @date 2008-12-22 + * @brief Test of llsdmessage.h + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#if LL_WINDOWS +#pragma warning (disable : 4675) // "resolved by ADL" -- just as I want! +#endif + +// Precompiled header +#include "linden_common.h" +// associated header +#include "llsdmessage.h" +// STL headers +#include <iostream> +// std headers +#include <stdexcept> +#include <typeinfo> +// external library headers +// other Linden headers +#include "../test/lltut.h" +#include "llsdserialize.h" +#include "llevents.h" +#include "stringize.h" +#include "llhost.h" +#include "tests/networkio.h" +#include "tests/commtest.h" + +/***************************************************************************** +* TUT +*****************************************************************************/ +namespace tut +{ + struct llsdmessage_data: public commtest_data + { + LLEventPump& httpPump; + + llsdmessage_data(): + httpPump(pumps.obtain("LLHTTPClient")) + { + LLSDMessage::link(); + } + }; + typedef test_group<llsdmessage_data> llsdmessage_group; + typedef llsdmessage_group::object llsdmessage_object; + llsdmessage_group llsdmgr("llsdmessage"); + + template<> template<> + void llsdmessage_object::test<1>() + { + bool threw = false; + // This should fail... + try + { + LLSDMessage localListener; + } + catch (const LLEventPump::DupPumpName&) + { + threw = true; + } + catch (const std::runtime_error& ex) + { + // This clause is because on Linux, on the viewer side, for this + // one test program (though not others!), the + // LLEventPump::DupPumpName exception isn't caught by the clause + // above. Warn the user... + std::cerr << "Failed to catch " << typeid(ex).name() << std::endl; + // But if the expected exception was thrown, allow the test to + // succeed anyway. Not sure how else to handle this odd case. + if (std::string(typeid(ex).name()) == typeid(LLEventPump::DupPumpName).name()) + { + threw = true; + } + else + { + // We don't even recognize this exception. Let it propagate + // out to TUT to fail the test. + throw; + } + } + catch (...) + { + std::cerr << "Utterly failed to catch expected exception!" << std::endl; + // This case is full of fail. We HAVE to address it. + throw; + } + ensure("second LLSDMessage should throw", threw); + } + + template<> template<> + void llsdmessage_object::test<2>() + { + LLSD request, body; + body["data"] = "yes"; + request["payload"] = body; + request["reply"] = replyPump.getName(); + request["error"] = errorPump.getName(); + bool threw = false; + try + { + httpPump.post(request); + } + catch (const LLSDMessage::ArgError&) + { + threw = true; + } + ensure("missing URL", threw); + } + + template<> template<> + void llsdmessage_object::test<3>() + { + LLSD request, body; + body["data"] = "yes"; + request["url"] = server + "got-message"; + request["payload"] = body; + request["reply"] = replyPump.getName(); + request["error"] = errorPump.getName(); + httpPump.post(request); + ensure("got response", netio.pump()); + ensure("success response", success); + ensure_equals(result.asString(), "success"); + + body["status"] = 499; + body["reason"] = "custom error message"; + request["url"] = server + "fail"; + request["payload"] = body; + httpPump.post(request); + ensure("got response", netio.pump()); + ensure("failure response", ! success); + ensure_equals(result["status"].asInteger(), body["status"].asInteger()); + ensure_equals(result["reason"].asString(), body["reason"].asString()); + } +} // namespace tut diff --git a/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp b/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp new file mode 100644 index 0000000000..3b04530c1a --- /dev/null +++ b/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp @@ -0,0 +1,159 @@ +/** + * @file lltrustedmessageservice_test.cpp + * @brief LLTrustedMessageService unit tests + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "lltemplatemessagedispatcher.h" +#include "lltut.h" + +#include "llhttpnode.h" +#include "llhost.h" +#include "message.h" +#include "llsd.h" + +#include "llhost.cpp" // Needed for copy operator +#include "net.cpp" // Needed by LLHost. + +LLMessageSystem * gMessageSystem = NULL; + +// sensor test doubles +bool gClearRecvWasCalled = false; +void LLMessageSystem::clearReceiveState(void) +{ + gClearRecvWasCalled = true; +} + +char gUdpDispatchedData[MAX_BUFFER_SIZE]; +bool gUdpDispatchWasCalled = false; +BOOL LLTemplateMessageReader::readMessage(const U8* data,class LLHost const &) +{ + gUdpDispatchWasCalled = true; + strcpy(gUdpDispatchedData, reinterpret_cast<const char*>(data)); + return true; +} + +BOOL gValidateMessage = FALSE; +BOOL LLTemplateMessageReader::validateMessage(const U8*, S32 buffer_size, LLHost const &sender, bool trusted) +{ + return gValidateMessage; +} + +LLHost host; +const LLHost& LLMessageSystem::getSender() const +{ + return host; +} + +const char* gBinaryTemplateData = "BINARYTEMPLATEDATA"; +void fillVector(std::vector<U8>& vector_data, const char* data) +{ + vector_data.resize(strlen(data) + 1); + strcpy(reinterpret_cast<char*>(&vector_data[0]), data); +} + +namespace tut +{ + static LLTemplateMessageReader::message_template_number_map_t numberMap; + + struct LLTemplateMessageDispatcherData + { + LLTemplateMessageDispatcherData() + { + mMessageName = "MessageName"; + gUdpDispatchWasCalled = false; + gClearRecvWasCalled = false; + gValidateMessage = FALSE; + mMessage["body"]["binary-template-data"] = std::vector<U8>(); + } + + LLSD mMessage; + LLHTTPNode::ResponsePtr mResponsePtr; + std::string mMessageName; + }; + + typedef test_group<LLTemplateMessageDispatcherData> factory; + typedef factory::object object; +} + +namespace +{ + tut::factory tf("LLTemplateMessageDispatcher"); +} + +namespace tut +{ + // does an empty message stop processing? + template<> template<> + void object::test<1>() + { + LLTemplateMessageReader* pReader = NULL; + LLTemplateMessageDispatcher t(*pReader); + t.dispatch(mMessageName, mMessage, mResponsePtr); + ensure(! gUdpDispatchWasCalled); + ensure(! gClearRecvWasCalled); + } + + // does the disaptch invoke the udp send method? + template<> template<> + void object::test<2>() + { + LLTemplateMessageReader* pReader = NULL; + LLTemplateMessageDispatcher t(*pReader); + gValidateMessage = TRUE; + std::vector<U8> vector_data; + fillVector(vector_data, gBinaryTemplateData); + mMessage["body"]["binary-template-data"] = vector_data; + t.dispatch(mMessageName, mMessage, mResponsePtr); + ensure("udp dispatch was called", gUdpDispatchWasCalled); + } + + // what if the message wasn't valid? We would hope the message gets cleared! + template<> template<> + void object::test<3>() + { + LLTemplateMessageReader* pReader = NULL; + LLTemplateMessageDispatcher t(*pReader); + std::vector<U8> vector_data; + fillVector(vector_data, gBinaryTemplateData); + mMessage["body"]["binary-template-data"] = vector_data; + gValidateMessage = FALSE; + t.dispatch(mMessageName, mMessage, mResponsePtr); + ensure("clear received message was called", gClearRecvWasCalled); + } + + // is the binary data passed through correctly? + template<> template<> + void object::test<4>() + { + LLTemplateMessageReader* pReader = NULL; + LLTemplateMessageDispatcher t(*pReader); + gValidateMessage = TRUE; + std::vector<U8> vector_data; + fillVector(vector_data, gBinaryTemplateData); + mMessage["body"]["binary-template-data"] = vector_data; + t.dispatch(mMessageName, mMessage, mResponsePtr); + ensure("data couriered correctly", strcmp(gBinaryTemplateData, gUdpDispatchedData) == 0); + } +} + diff --git a/indra/llmessage/tests/lltesthttpclientadapter.cpp b/indra/llmessage/tests/lltesthttpclientadapter.cpp new file mode 100644 index 0000000000..4539e4a540 --- /dev/null +++ b/indra/llmessage/tests/lltesthttpclientadapter.cpp @@ -0,0 +1,61 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "lltesthttpclientadapter.h" + +LLTestHTTPClientAdapter::LLTestHTTPClientAdapter() +{ +} + +LLTestHTTPClientAdapter::~LLTestHTTPClientAdapter() +{ +} + +void LLTestHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder) +{ + mGetUrl.push_back(url); + mGetResponder.push_back(responder); +} + +void LLTestHTTPClientAdapter::put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder) +{ + mPutUrl.push_back(url); + mPutBody.push_back(body); + mPutResponder.push_back(responder); +} + +U32 LLTestHTTPClientAdapter::putCalls() const +{ + return mPutUrl.size(); +} + +void LLTestHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers) +{ + mGetUrl.push_back(url); + mGetHeaders.push_back(headers); + mGetResponder.push_back(responder); +} + + diff --git a/indra/llmessage/tests/lltesthttpclientadapter.h b/indra/llmessage/tests/lltesthttpclientadapter.h new file mode 100644 index 0000000000..c29cbb3a2a --- /dev/null +++ b/indra/llmessage/tests/lltesthttpclientadapter.h @@ -0,0 +1,57 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +/* Macro Definitions */ +#ifndef LL_LLTESTHTTPCLIENTADAPTER_H +#define LL_LLTESTHTTPCLIENTADAPTER_H + + +#include "linden_common.h" +#include "llhttpclientinterface.h" + +class LLTestHTTPClientAdapter : public LLHTTPClientInterface +{ +public: + LLTestHTTPClientAdapter(); + virtual ~LLTestHTTPClientAdapter(); + virtual void get(const std::string& url, LLCurl::ResponderPtr responder); + virtual void get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers); + + virtual void put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder); + U32 putCalls() const; + + std::vector<LLSD> mPutBody; + std::vector<LLSD> mGetHeaders; + std::vector<std::string> mPutUrl; + std::vector<std::string> mGetUrl; + std::vector<LLCurl::ResponderPtr> mPutResponder; + std::vector<LLCurl::ResponderPtr> mGetResponder; +}; + + + +#endif //LL_LLSIMULATORPRESENCESENDER_H + diff --git a/indra/llmessage/tests/lltestmessagesender.cpp b/indra/llmessage/tests/lltestmessagesender.cpp new file mode 100644 index 0000000000..ee40e0249e --- /dev/null +++ b/indra/llmessage/tests/lltestmessagesender.cpp @@ -0,0 +1,38 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "lltestmessagesender.h" + +LLTestMessageSender::~LLTestMessageSender() +{ +} + + +S32 LLTestMessageSender::sendMessage(const LLHost& host, LLStoredMessagePtr message) +{ + mSendHosts.push_back(host); + mSendMessages.push_back(message); + return 0; +} diff --git a/indra/llmessage/tests/lltestmessagesender.h b/indra/llmessage/tests/lltestmessagesender.h new file mode 100644 index 0000000000..bb89289585 --- /dev/null +++ b/indra/llmessage/tests/lltestmessagesender.h @@ -0,0 +1,51 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +/* Macro Definitions */ +#ifndef LL_LLTESTMESSAGESENDER_H +#define LL_LLTESTMESSAGESENDER_H + + +#include "linden_common.h" +#include "llmessagesenderinterface.h" +#include <vector> + + + +class LLTestMessageSender : public LLMessageSenderInterface +{ +public: + virtual ~LLTestMessageSender(); + virtual S32 sendMessage(const LLHost& host, LLStoredMessagePtr message); + + std::vector<LLHost> mSendHosts; + std::vector<LLStoredMessagePtr> mSendMessages; +}; + + + +#endif //LL_LLTESTMESSAGESENDER_H + diff --git a/indra/llmessage/tests/lltrustedmessageservice_test.cpp b/indra/llmessage/tests/lltrustedmessageservice_test.cpp new file mode 100644 index 0000000000..b287a29841 --- /dev/null +++ b/indra/llmessage/tests/lltrustedmessageservice_test.cpp @@ -0,0 +1,140 @@ +/** + * @file lltrustedmessageservice_test.cpp + * @brief LLTrustedMessageService unit tests + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "lltrustedmessageservice.h" +#include "../test/lltut.h" + +#include "llhost.cpp" // LLHost is a value type for test purposes. +#include "net.cpp" // Needed by LLHost. + +#include "message.h" +#include "llmessageconfig.h" + +LLMessageSystem* gMessageSystem = NULL; + +LLMessageConfig::SenderTrust +LLMessageConfig::getSenderTrustedness(const std::string& msg_name) +{ + return LLMessageConfig::NOT_SET; +} + +void LLMessageSystem::receivedMessageFromTrustedSender() +{ +} + +bool LLMessageSystem::isTrustedSender(const LLHost& host) const +{ + return false; +} + +bool LLMessageSystem::isTrustedMessage(const std::string& name) const +{ + return false; +} + +bool messageDispatched = false; +bool messageDispatchedAsBinary = false; +LLSD lastLLSD; +std::string lastMessageName; + +void LLMessageSystem::dispatch(const std::string& msg_name, + const LLSD& message, + LLHTTPNode::ResponsePtr responsep) +{ + messageDispatched = true; + lastLLSD = message; + lastMessageName = msg_name; +} + +void LLMessageSystem::dispatchTemplate(const std::string& msg_name, + const LLSD& message, + LLHTTPNode::ResponsePtr responsep) +{ + lastLLSD = message; + lastMessageName = msg_name; + messageDispatchedAsBinary = true; +} + +namespace tut +{ + struct LLTrustedMessageServiceData + { + LLTrustedMessageServiceData() + { + LLSD emptyLLSD; + lastLLSD = emptyLLSD; + lastMessageName = "uninitialised message name"; + messageDispatched = false; + messageDispatchedAsBinary = false; + } + }; + + typedef test_group<LLTrustedMessageServiceData> factory; + typedef factory::object object; +} + +namespace +{ + tut::factory tf("LLTrustedMessageServiceData"); +} + +namespace tut +{ + // characterisation tests + + // 1) test that messages get forwarded with names etc. as current behaviour (something like LLMessageSystem::dispatch(name, data...) + + // test llsd messages are sent as normal using LLMessageSystem::dispatch() (eventually) + template<> template<> + void object::test<1>() + { + LLHTTPNode::ResponsePtr response; + LLSD input; + LLSD context; + LLTrustedMessageService adapter; + adapter.post(response, context, input); + // test original ting got called wit nowt, ya get me blood? + ensure_equals(messageDispatched, true); + ensure(lastLLSD.has("body")); + } + + // test that llsd wrapped binary-template-data messages are + // sent via LLMessageSystem::binaryDispatch() or similar + template<> template<> + void object::test<2>() + { + LLHTTPNode::ResponsePtr response; + LLSD input; + input["binary-template-data"] = "10001010110"; //make me a message here. + LLSD context; + LLTrustedMessageService adapter; + + adapter.post(response, context, input); + ensure("check template-binary-data message was dispatched as binary", messageDispatchedAsBinary); + ensure_equals(lastLLSD["body"]["binary-template-data"].asString(), "10001010110"); + // test somit got called with "10001010110" (something like LLMessageSystem::dispatchTemplate(blah)) + } +} diff --git a/indra/llmessage/tests/llxfer_file_test.cpp b/indra/llmessage/tests/llxfer_file_test.cpp new file mode 100644 index 0000000000..a8c1adf9b4 --- /dev/null +++ b/indra/llmessage/tests/llxfer_file_test.cpp @@ -0,0 +1,58 @@ +/** + * @file llxfer_test.cpp + * @author Moss + * @date 2007-04-17 + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "../llxfer_file.h" + +#include "../test/lltut.h" + +namespace tut +{ + struct llxfer_data + { + }; + typedef test_group<llxfer_data> llxfer_test; + typedef llxfer_test::object llxfer_object; + tut::llxfer_test llxfer("LLXferFile"); + + template<> template<> + void llxfer_object::test<1>() + { + // test that we handle an oversized filename correctly. + std::string oversized_filename; + U32 i; + for (i=0; i<LL_MAX_PATH*2; ++i) // create oversized filename + { + oversized_filename += 'X'; + } + + LLXfer_File xff(oversized_filename, FALSE, 1); + ensure("oversized local_filename nul-terminated", + xff.getFileName().length() < LL_MAX_PATH); + } +} diff --git a/indra/llmessage/tests/networkio.h b/indra/llmessage/tests/networkio.h new file mode 100644 index 0000000000..2aff90ca1e --- /dev/null +++ b/indra/llmessage/tests/networkio.h @@ -0,0 +1,110 @@ +/** + * @file networkio.h + * @author Nat Goodspeed + * @date 2009-01-09 + * @brief + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#if ! defined(LL_NETWORKIO_H) +#define LL_NETWORKIO_H + +#include "llmemory.h" // LLSingleton +#include "llapr.h" +#include "llares.h" +#include "llpumpio.h" +#include "llhttpclient.h" + +/***************************************************************************** +* NetworkIO +*****************************************************************************/ +// Doing this initialization in a class constructor makes sense. But we don't +// want to redo it for each different test. Nor do we want to do it at static- +// init time. Use the lazy, on-demand initialization we get from LLSingleton. +class NetworkIO: public LLSingleton<NetworkIO> +{ +public: + NetworkIO(): + mServicePump(NULL), + mDone(false) + { + ll_init_apr(); + if (! gAPRPoolp) + { + throw std::runtime_error("Can't initialize APR"); + } + + // Create IO Pump to use for HTTP Requests. + mServicePump = new LLPumpIO(gAPRPoolp); + LLHTTPClient::setPump(*mServicePump); + if (ll_init_ares() == NULL || !gAres->isInitialized()) + { + throw std::runtime_error("Can't start DNS resolver"); + } + + // You can interrupt pump() without waiting the full timeout duration + // by posting an event to the LLEventPump named "done". + LLEventPumps::instance().obtain("done").listen("self", + boost::bind(&NetworkIO::done, this, _1)); + } + + bool pump(F32 timeout=10) + { + // Reset the done flag so we don't pop out prematurely + mDone = false; + // Evidently the IO structures underlying LLHTTPClient need to be + // "pumped". Do some stuff normally performed in the viewer's main + // loop. + LLTimer timer; + while (timer.getElapsedTimeF32() < timeout) + { + if (mDone) + { +// std::cout << "NetworkIO::pump(" << timeout << "): breaking loop after " +// << timer.getElapsedTimeF32() << " seconds\n"; + return true; + } + pumpOnce(); + } + return false; + } + + void pumpOnce() + { + gAres->process(); + mServicePump->pump(); + mServicePump->callback(); + } + + bool done(const LLSD&) + { + mDone = true; + return false; + } + +private: + LLPumpIO* mServicePump; + bool mDone; +}; + +#endif /* ! defined(LL_NETWORKIO_H) */ diff --git a/indra/llmessage/tests/test_llsdmessage_peer.py b/indra/llmessage/tests/test_llsdmessage_peer.py new file mode 100644 index 0000000000..7eb198bb34 --- /dev/null +++ b/indra/llmessage/tests/test_llsdmessage_peer.py @@ -0,0 +1,123 @@ +#!/usr/bin/python +"""\ +@file test_llsdmessage_peer.py +@author Nat Goodspeed +@date 2008-10-09 +@brief This script asynchronously runs the executable (with args) specified on + the command line, returning its result code. While that executable is + running, we provide dummy local services for use by C++ tests. + +$LicenseInfo:firstyear=2008&license=viewerlgpl$ +Second Life Viewer Source Code +Copyright (C) 2010, Linden Research, Inc. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; +version 2.1 of the License only. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +$/LicenseInfo$ +""" + +import os +import sys +from threading import Thread +from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler + +mydir = os.path.dirname(__file__) # expected to be .../indra/llmessage/tests/ +sys.path.insert(0, os.path.join(mydir, os.pardir, os.pardir, "lib", "python")) +from indra.util.fastest_elementtree import parse as xml_parse +from indra.base import llsd +from testrunner import run, debug + +class TestHTTPRequestHandler(BaseHTTPRequestHandler): + """This subclass of BaseHTTPRequestHandler is to receive and echo + LLSD-flavored messages sent by the C++ LLHTTPClient. + """ + def read(self): + # The following logic is adapted from the library module + # SimpleXMLRPCServer.py. + # Get arguments by reading body of request. + # We read this in chunks to avoid straining + # socket.read(); around the 10 or 15Mb mark, some platforms + # begin to have problems (bug #792570). + try: + size_remaining = int(self.headers["content-length"]) + except (KeyError, ValueError): + return "" + max_chunk_size = 10*1024*1024 + L = [] + while size_remaining: + chunk_size = min(size_remaining, max_chunk_size) + chunk = self.rfile.read(chunk_size) + L.append(chunk) + size_remaining -= len(chunk) + return ''.join(L) + # end of swiped read() logic + + def read_xml(self): + # This approach reads the entire POST data into memory first + return llsd.parse(self.read()) +## # This approach attempts to stream in the LLSD XML from self.rfile, +## # assuming that the underlying XML parser reads its input file +## # incrementally. Unfortunately I haven't been able to make it work. +## tree = xml_parse(self.rfile) +## debug("Finished raw parse\n") +## debug("parsed XML tree %s\n" % tree) +## debug("parsed root node %s\n" % tree.getroot()) +## debug("root node tag %s\n" % tree.getroot().tag) +## return llsd.to_python(tree.getroot()) + + def do_GET(self): + # Of course, don't attempt to read data. + self.answer(dict(reply="success", status=500, + reason="Your GET operation requested failure")) + + def do_POST(self): + # Read the provided POST data. + self.answer(self.read_xml()) + + def answer(self, data): + if "fail" not in self.path: + response = llsd.format_xml(data.get("reply", llsd.LLSD("success"))) + self.send_response(200) + self.send_header("Content-type", "application/llsd+xml") + self.send_header("Content-Length", str(len(response))) + self.end_headers() + self.wfile.write(response) + else: # fail requested + status = data.get("status", 500) + reason = data.get("reason", + self.responses.get(status, + ("fail requested", + "Your request specified failure status %s " + "without providing a reason" % status))[1]) + self.send_error(status, reason) + + def log_request(self, code, size=None): + # For present purposes, we don't want the request splattered onto + # stderr, as it would upset devs watching the test run + pass + + def log_error(self, format, *args): + # Suppress error output as well + pass + +class TestHTTPServer(Thread): + def run(self): + httpd = HTTPServer(('127.0.0.1', 8000), TestHTTPRequestHandler) + debug("Starting HTTP server...\n") + httpd.serve_forever() + +if __name__ == "__main__": + sys.exit(run(server=TestHTTPServer(name="httpd"), *sys.argv[1:])) diff --git a/indra/llmessage/tests/testrunner.py b/indra/llmessage/tests/testrunner.py new file mode 100644 index 0000000000..4d58ef7130 --- /dev/null +++ b/indra/llmessage/tests/testrunner.py @@ -0,0 +1,70 @@ +#!/usr/bin/python +"""\ +@file testrunner.py +@author Nat Goodspeed +@date 2009-03-20 +@brief Utilities for writing wrapper scripts for ADD_COMM_BUILD_TEST unit tests + +$LicenseInfo:firstyear=2009&license=viewerlgpl$ +Second Life Viewer Source Code +Copyright (C) 2010, Linden Research, Inc. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; +version 2.1 of the License only. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +$/LicenseInfo$ +""" + +import os +import sys + +def debug(*args): + sys.stdout.writelines(args) + sys.stdout.flush() +# comment out the line below to enable debug output +debug = lambda *args: None + +def run(*args, **kwds): + """All positional arguments collectively form a command line, executed as + a synchronous child process. + In addition, pass server=new_thread_instance as an explicit keyword (to + differentiate it from an additional command-line argument). + new_thread_instance should be an instantiated but not yet started Thread + subclass instance, e.g.: + run("python", "-c", 'print "Hello, world!"', server=TestHTTPServer(name="httpd")) + """ + # If there's no server= keyword arg, don't start a server thread: simply + # run a child process. + try: + thread = kwds.pop("server") + except KeyError: + pass + else: + # Start server thread. Note that this and all other comm server + # threads should be daemon threads: we'll let them run "forever," + # confident that the whole process will terminate when the main thread + # terminates, which will be when the child process terminates. + thread.setDaemon(True) + thread.start() + # choice of os.spawnv(): + # - [v vs. l] pass a list of args vs. individual arguments, + # - [no p] don't use the PATH because we specifically want to invoke the + # executable passed as our first arg, + # - [no e] child should inherit this process's environment. + debug("Running %s...\n" % (" ".join(args))) + sys.stdout.flush() + rc = os.spawnv(os.P_WAIT, args[0], args) + debug("%s returned %s\n" % (args[0], rc)) + return rc |
