summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorDave Simmons <simon@lindenlab.com>2009-03-20 20:00:47 +0000
committerDave Simmons <simon@lindenlab.com>2009-03-20 20:00:47 +0000
commit24b26d71ee01211aa796b8061b66ec06a133e4ce (patch)
tree96bffcd019c933ad3ebbfd5f096968108b22aab5 /indra/llmessage
parent5dfd435872e36445dcc82f99443dfc5a7ee0805a (diff)
svn merge -r113004:115000 svn+ssh://svn.lindenlab.com/svn/linden/branches/server/server-1.26
Merge latest 1.26 into trunk
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llcachename.cpp1
-rw-r--r--indra/llmessage/llclassifiedflags.cpp25
-rw-r--r--indra/llmessage/llclassifiedflags.h17
-rw-r--r--indra/llmessage/lldispatcher.cpp32
-rw-r--r--indra/llmessage/lleventflags.h1
-rw-r--r--indra/llmessage/llhttpclient.cpp14
-rw-r--r--indra/llmessage/llhttpclientadapter.cpp11
-rw-r--r--indra/llmessage/llqueryflags.h32
-rwxr-xr-xindra/llmessage/llsdmessagereader.cpp6
-rw-r--r--indra/llmessage/message.cpp26
-rw-r--r--indra/llmessage/message.h1
-rw-r--r--indra/llmessage/message_prehash.cpp3
-rw-r--r--indra/llmessage/message_prehash.h2
13 files changed, 157 insertions, 14 deletions
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index 776f2b1535..1e6584a085 100644
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -566,6 +566,7 @@ void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callb
if(id.isNull())
{
callback(id, CN_NOBODY, "", is_group, user_data);
+ return;
}
LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id );
diff --git a/indra/llmessage/llclassifiedflags.cpp b/indra/llmessage/llclassifiedflags.cpp
index 62415cde5f..da608e490b 100644
--- a/indra/llmessage/llclassifiedflags.cpp
+++ b/indra/llmessage/llclassifiedflags.cpp
@@ -41,18 +41,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 1205112d41..9d3e49b90c 100644
--- a/indra/llmessage/llclassifiedflags.h
+++ b/indra/llmessage/llclassifiedflags.h
@@ -43,12 +43,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/lldispatcher.cpp b/indra/llmessage/lldispatcher.cpp
index 7ce3d11be4..bb7c833b49 100644
--- a/indra/llmessage/lldispatcher.cpp
+++ b/indra/llmessage/lldispatcher.cpp
@@ -111,14 +111,40 @@ bool LLDispatcher::unpackMessage(
LLUUID& invoice,
LLDispatcher::sparam_t& parameters)
{
+ char buf[MAX_STRING]; /*Flawfinder: ignore*/
msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, method);
msg->getUUIDFast(_PREHASH_MethodData, _PREHASH_Invoice, invoice);
+ S32 size;
S32 count = msg->getNumberOfBlocksFast(_PREHASH_ParamList);
for (S32 i = 0; i < count; ++i)
{
- std::string parameter;
- msg->getStringFast(_PREHASH_ParamList,_PREHASH_Parameter, parameter, i);
- parameters.push_back(parameter);
+ // 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)
+ {
+ // 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/lleventflags.h b/indra/llmessage/lleventflags.h
index 8d4d08be63..965d978a5c 100644
--- a/indra/llmessage/lleventflags.h
+++ b/indra/llmessage/lleventflags.h
@@ -37,5 +37,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/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 884ec1309d..a6041b4139 100644
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -402,6 +402,14 @@ LLSD LLHTTPClient::blockingGet(const std::string& url)
curl_easy_setopt(curlp, CURLOPT_ERRORBUFFER, curl_error_buffer);
curl_easy_setopt(curlp, CURLOPT_FAILONERROR, 1);
+ struct curl_slist *header_list = NULL;
+ header_list = curl_slist_append(header_list, "Accept: application/llsd+xml");
+ CURLcode curl_result = curl_easy_setopt(curlp, CURLOPT_HTTPHEADER, header_list);
+ if ( curl_result != CURLE_OK )
+ {
+ llinfos << "Curl is hosed - can't add Accept header for llsd+xml" << llendl;
+ }
+
LLSD response = LLSD::emptyMap();
S32 curl_success = curl_easy_perform(curlp);
@@ -423,6 +431,12 @@ LLSD LLHTTPClient::blockingGet(const std::string& url)
response["body"] = http_buffer.asLLSD();
}
+ if(header_list)
+ { // free the header list
+ curl_slist_free_all(header_list);
+ header_list = NULL;
+ }
+
curl_easy_cleanup(curlp);
return response;
diff --git a/indra/llmessage/llhttpclientadapter.cpp b/indra/llmessage/llhttpclientadapter.cpp
index f0e7654646..bbb56960df 100644
--- a/indra/llmessage/llhttpclientadapter.cpp
+++ b/indra/llmessage/llhttpclientadapter.cpp
@@ -38,12 +38,19 @@ LLHTTPClientAdapter::~LLHTTPClientAdapter()
void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder)
{
- LLHTTPClient::get(url, 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)
{
- LLHTTPClient::get(url, responder, 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)
diff --git a/indra/llmessage/llqueryflags.h b/indra/llmessage/llqueryflags.h
index d0496cc077..960d7777a7 100644
--- a/indra/llmessage/llqueryflags.h
+++ b/indra/llmessage/llqueryflags.h
@@ -65,6 +65,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;
@@ -73,4 +80,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/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp
index c47d4b78bc..e699ec9e28 100755
--- a/indra/llmessage/llsdmessagereader.cpp
+++ b/indra/llmessage/llsdmessagereader.cpp
@@ -108,6 +108,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);
}
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index 8ab12ce991..78af35bf65 100644
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -923,6 +923,28 @@ LLSD LLMessageSystem::wrapReceivedTemplateData() const
}
}
+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();
@@ -934,7 +956,7 @@ LLStoredMessagePtr LLMessageSystem::getReceivedMessage() const
LLStoredMessagePtr LLMessageSystem::getBuiltMessage() const
{
const std::string& name = mMessageBuilder->getMessageName();
- LLSD message = getBuiltMessageLLSD();
+ LLSD message = wrapBuiltTemplateData();
return LLStoredMessagePtr(new LLStoredMessage(name, message));
}
@@ -1131,7 +1153,7 @@ LLHTTPClient::ResponderPtr LLMessageSystem::createResponder(const std::string& n
return new LLFnPtrResponder(
NULL,
NULL,
- mMessageBuilder->getMessageName());
+ name);
}
}
diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h
index 4fda8f01d7..b25b27eb0f 100644
--- a/indra/llmessage/message.h
+++ b/indra/llmessage/message.h
@@ -395,6 +395,7 @@ private:
// 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:
diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp
index d554ec2f34..716d895334 100644
--- a/indra/llmessage/message_prehash.cpp
+++ b/indra/llmessage/message_prehash.cpp
@@ -314,6 +314,7 @@ char* _PREHASH_TextColor = LLMessageStringTable::getInstance()->getString("TextC
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");
@@ -1375,4 +1376,6 @@ char* _PREHASH_AgeVerificationBlock = LLMessageStringTable::getInstance()->getSt
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");
+
diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h
index e71518c6d6..c7bb7fff26 100644
--- a/indra/llmessage/message_prehash.h
+++ b/indra/llmessage/message_prehash.h
@@ -314,6 +314,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;
@@ -1375,5 +1376,6 @@ extern char * _PREHASH_AgeVerificationBlock;
extern char * _PREHASH_UCoord;
extern char * _PREHASH_VCoord;
extern char * _PREHASH_FaceIndex;
+extern char * _PREHASH_StatusData;
#endif