diff options
| author | RunitaiLinden <davep@lindenlab.com> | 2023-08-29 16:42:55 -0500 | 
|---|---|---|
| committer | RunitaiLinden <davep@lindenlab.com> | 2023-08-29 16:42:55 -0500 | 
| commit | 455bbcf742691b709353aa3c3e35a76d0ff38ee4 (patch) | |
| tree | fa806a884bde35d117c40a3d1348b52833dcd020 /indra/llmessage | |
| parent | a3a811606088f1b40d9e098ddff8b38a2420b8e9 (diff) | |
SL-20229 Add GenericStreamingMessage and use it to receive GLTF material overrides
Diffstat (limited to 'indra/llmessage')
| -rw-r--r-- | indra/llmessage/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | indra/llmessage/llgenericstreamingmessage.cpp | 72 | ||||
| -rw-r--r-- | indra/llmessage/llgenericstreamingmessage.h | 50 | ||||
| -rw-r--r-- | indra/llmessage/message_prehash.cpp | 1 | ||||
| -rw-r--r-- | indra/llmessage/message_prehash.h | 1 | 
5 files changed, 126 insertions, 0 deletions
| diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt index 4786956e85..e44309476b 100644 --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -30,6 +30,7 @@ set(llmessage_SOURCE_FILES      lldispatcher.cpp      llexperiencecache.cpp      llfiltersd2xmlrpc.cpp +    llgenericstreamingmessage.cpp      llhost.cpp      llhttpnode.cpp      llhttpsdhandler.cpp @@ -114,6 +115,7 @@ set(llmessage_HEADER_FILES      llextendedstatus.h      llfiltersd2xmlrpc.h      llfollowcamparams.h +    llgenericstreamingmessage.h      llhost.h      llhttpnode.h      llhttpnodeadapter.h diff --git a/indra/llmessage/llgenericstreamingmessage.cpp b/indra/llmessage/llgenericstreamingmessage.cpp new file mode 100644 index 0000000000..8627675c54 --- /dev/null +++ b/indra/llmessage/llgenericstreamingmessage.cpp @@ -0,0 +1,72 @@ +/** + * @file llgenericstreamingmessage.cpp + * @brief Generic Streaming Message helpers.  Shared between viewer and simulator. + * + * $LicenseInfo:firstyear=2023&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2023, 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 "llgenericstreamingmessage.h" + +#include "message.h" + +void LLGenericStreamingMessage::send(LLMessageSystem* msg) +{ +#if 0 // viewer cannot send GenericStreamingMessage +    msg->newMessageFast(_PREHASH_GenericStreamingMessage); + +    if (mData.size() < 1024 * 7) +    { // disable warning about big messages unless we're sending a REALLY big message +        msg->tempDisableWarnAboutBigMessage(); +    } +    else +    { +        LL_WARNS("Messaging") << "Attempted to send too large GenericStreamingMessage, dropping." << LL_ENDL; +        return; +    } + +    msg->nextBlockFast(_PREHASH_MethodData); +    msg->addU16Fast(_PREHASH_Method, mMethod); +    msg->nextBlockFast(_PREHASH_DataBlock); +    msg->addStringFast(_PREHASH_Data, mData.c_str()); +#endif +} + +void LLGenericStreamingMessage::unpack(LLMessageSystem* msg) +{ +    U16* m = (U16*)&mMethod; // squirrely pass enum as U16 by reference +    msg->getU16Fast(_PREHASH_MethodData, _PREHASH_Method, *m); + +    constexpr int MAX_SIZE = 7 * 1024; + +    char buffer[MAX_SIZE]; + +    // NOTE: don't use getStringFast to avoid 1200 byte truncation +    U32 size = msg->getSizeFast(_PREHASH_DataBlock, _PREHASH_Data); +    msg->getBinaryDataFast(_PREHASH_DataBlock, _PREHASH_Data, buffer, size, 0, MAX_SIZE); + +    mData.assign(buffer, size); +} + + + diff --git a/indra/llmessage/llgenericstreamingmessage.h b/indra/llmessage/llgenericstreamingmessage.h new file mode 100644 index 0000000000..9ac9719ea1 --- /dev/null +++ b/indra/llmessage/llgenericstreamingmessage.h @@ -0,0 +1,50 @@ +/** + * @file llgenericstreamingmessage.h + * @brief Generic Streaming Message helpers.  Shared between viewer and simulator. + * + * $LicenseInfo:firstyear=2023&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2023, 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$ + */ + +#pragma once + +#include <string> +#include "stdtypes.h" + +class LLMessageSystem; + +class LLGenericStreamingMessage +{ +public: +    enum Method : U16 +    { +        METHOD_GLTF_MATERIAL_OVERRIDE = 0x4175, +        METHOD_UNKNOWN = 0xFFFF, +    }; + +    void send(LLMessageSystem* msg); +    void unpack(LLMessageSystem* msg); + +    Method mMethod = METHOD_UNKNOWN; +    std::string mData; +}; + + diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index 57ea954054..4dccacb889 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -1367,6 +1367,7 @@ char const* const _PREHASH_MuteType = LLMessageStringTable::getInstance()->getSt  char const* const _PREHASH_IMViaEMail = LLMessageStringTable::getInstance()->getString("IMViaEMail");  char const* const _PREHASH_RentPrice = LLMessageStringTable::getInstance()->getString("RentPrice");  char const* const _PREHASH_GenericMessage = LLMessageStringTable::getInstance()->getString("GenericMessage"); +char const* const _PREHASH_GenericStreamingMessage = LLMessageStringTable::getInstance()->getString("GenericStreamingMessage");  char const* const _PREHASH_ChildAgentAlive = LLMessageStringTable::getInstance()->getString("ChildAgentAlive");  char const* const _PREHASH_AssetType = LLMessageStringTable::getInstance()->getString("AssetType");  char const* const _PREHASH_SpawnPointBlock = LLMessageStringTable::getInstance()->getString("SpawnPointBlock"); diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index 572dadd408..a393bbabb2 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -1368,6 +1368,7 @@ extern char const* const _PREHASH_MuteType;  extern char const* const _PREHASH_IMViaEMail;  extern char const* const _PREHASH_RentPrice;  extern char const* const _PREHASH_GenericMessage; +extern char const* const _PREHASH_GenericStreamingMessage;  extern char const* const _PREHASH_ChildAgentAlive;  extern char const* const _PREHASH_AssetType;  extern char const* const _PREHASH_SpawnPointBlock; | 
