aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llmessage/llcircuit.cpp11
-rw-r--r--linden/indra/llmessage/llcircuit.h8
-rw-r--r--linden/indra/llmessage/llcurl.cpp6
-rw-r--r--linden/indra/llmessage/llhttpassetstorage.cpp4
-rw-r--r--linden/indra/llmessage/llhttpclient.cpp112
-rw-r--r--linden/indra/llmessage/llhttpclient.h50
-rw-r--r--linden/indra/llmessage/lliohttpserver.cpp7
-rw-r--r--linden/indra/llmessage/llmail.cpp34
-rw-r--r--linden/indra/llmessage/llmail.h61
-rw-r--r--linden/indra/llmessage/llmessagetemplate.cpp22
-rw-r--r--linden/indra/llmessage/llmessagetemplate.h12
-rw-r--r--linden/indra/llmessage/llmessagethrottle.cpp4
-rw-r--r--linden/indra/llmessage/llnamevalue.cpp4
-rw-r--r--linden/indra/llmessage/llnamevalue.h4
-rw-r--r--linden/indra/llmessage/llpumpio.cpp6
-rw-r--r--linden/indra/llmessage/llregionflags.h6
-rw-r--r--linden/indra/llmessage/message.cpp32
-rw-r--r--linden/indra/llmessage/message.h16
18 files changed, 305 insertions, 94 deletions
diff --git a/linden/indra/llmessage/llcircuit.cpp b/linden/indra/llmessage/llcircuit.cpp
index 12a1520..7b2f241 100644
--- a/linden/indra/llmessage/llcircuit.cpp
+++ b/linden/indra/llmessage/llcircuit.cpp
@@ -60,6 +60,7 @@
60#include "llrand.h" 60#include "llrand.h"
61#include "llstl.h" 61#include "llstl.h"
62#include "lltransfermanager.h" 62#include "lltransfermanager.h"
63#include "llmodularmath.h"
63 64
64const F32 PING_INTERVAL = 5.f; // seconds 65const F32 PING_INTERVAL = 5.f; // seconds
65const S32 PING_START_BLOCK = 3; // How many pings behind we have to be to consider ourself blocked. 66const S32 PING_START_BLOCK = 3; // How many pings behind we have to be to consider ourself blocked.
@@ -676,6 +677,8 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
676 mPacketsIn++; 677 mPacketsIn++;
677 setPacketInID((id + 1) % LL_MAX_OUT_PACKET_ID); 678 setPacketInID((id + 1) % LL_MAX_OUT_PACKET_ID);
678 679
680 mLastPacketGap = 0;
681 mOutOfOrderRate.count(0);
679 return; 682 return;
680 } 683 }
681 684
@@ -683,6 +686,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
683 686
684 687
685 // now, check to see if we've got a gap 688 // now, check to see if we've got a gap
689 U32 gap = 0;
686 if ((mPacketsInID == id)) 690 if ((mPacketsInID == id))
687 { 691 {
688 // nope! bump and wrap the counter, then return 692 // nope! bump and wrap the counter, then return
@@ -704,6 +708,11 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
704 // otherwise, walk from mCurrentCircuit->mPacketsInID to id with wrapping, adding the values to the map 708 // otherwise, walk from mCurrentCircuit->mPacketsInID to id with wrapping, adding the values to the map
705 // and setting mPacketsInID to id + 1 % LL_MAX_OUT_PACKET_ID 709 // and setting mPacketsInID to id + 1 % LL_MAX_OUT_PACKET_ID
706 710
711 // babbage: all operands in expression are unsigned, so modular
712 // arithmetic will always find correct gap, regardless of wrap arounds.
713 const U8 width = 24;
714 gap = LLModularMath::subtract<width>(mPacketsInID, id);
715
707 if (mPotentialLostPackets.find(id) != mPotentialLostPackets.end()) 716 if (mPotentialLostPackets.find(id) != mPotentialLostPackets.end())
708 { 717 {
709 if(gMessageSystem->mVerboseLog) 718 if(gMessageSystem->mVerboseLog)
@@ -765,6 +774,8 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
765 774
766 } 775 }
767 } 776 }
777 mOutOfOrderRate.count(gap);
778 mLastPacketGap = gap;
768} 779}
769 780
770 781
diff --git a/linden/indra/llmessage/llcircuit.h b/linden/indra/llmessage/llcircuit.h
index 552b50f..b53c955 100644
--- a/linden/indra/llmessage/llcircuit.h
+++ b/linden/indra/llmessage/llcircuit.h
@@ -45,6 +45,7 @@
45#include "llpacketack.h" 45#include "llpacketack.h"
46#include "lluuid.h" 46#include "lluuid.h"
47#include "llthrottle.h" 47#include "llthrottle.h"
48#include "llstat.h"
48 49
49// 50//
50// Constants 51// Constants
@@ -133,6 +134,10 @@ public:
133 S32 getUnackedPacketCount() const { return mUnackedPacketCount; } 134 S32 getUnackedPacketCount() const { return mUnackedPacketCount; }
134 S32 getUnackedPacketBytes() const { return mUnackedPacketBytes; } 135 S32 getUnackedPacketBytes() const { return mUnackedPacketBytes; }
135 F64 getNextPingSendTime() const { return mNextPingSendTime; } 136 F64 getNextPingSendTime() const { return mNextPingSendTime; }
137 F32 getOutOfOrderRate(LLStatAccum::TimeScale scale = LLStatAccum::SCALE_MINUTE)
138 { return mOutOfOrderRate.meanValue(scale); }
139 U32 getLastPacketGap() const { return mLastPacketGap; }
140 LLHost getHost() const { return mHost; }
136 141
137 LLThrottleGroup &getThrottleGroup() { return mThrottles; } 142 LLThrottleGroup &getThrottleGroup() { return mThrottles; }
138 143
@@ -276,6 +281,9 @@ protected:
276 LLTimer mExistenceTimer; // initialized when circuit created, used to track bandwidth numbers 281 LLTimer mExistenceTimer; // initialized when circuit created, used to track bandwidth numbers
277 282
278 S32 mCurrentResendCount; // Number of resent packets since last spam 283 S32 mCurrentResendCount; // Number of resent packets since last spam
284 LLStatRate mOutOfOrderRate; // Rate of out of order packets coming in.
285 U32 mLastPacketGap; // Gap in sequence number of last packet.
286
279}; 287};
280 288
281 289
diff --git a/linden/indra/llmessage/llcurl.cpp b/linden/indra/llmessage/llcurl.cpp
index 834ec4b..167e237 100644
--- a/linden/indra/llmessage/llcurl.cpp
+++ b/linden/indra/llmessage/llcurl.cpp
@@ -265,6 +265,10 @@ LLCurl::Easy* LLCurl::Easy::getEasy()
265 delete easy; 265 delete easy;
266 return NULL; 266 return NULL;
267 } 267 }
268
269 // set no DMS caching as default for all easy handles. This prevents them adopting a
270 // multi handles cache if they are added to one.
271 curl_easy_setopt(easy->mCurlEasyHandle, CURLOPT_DNS_CACHE_TIMEOUT, 0);
268 ++gCurlEasyCount; 272 ++gCurlEasyCount;
269 return easy; 273 return easy;
270} 274}
@@ -747,7 +751,7 @@ bool LLCurlRequest::post(const std::string& url, const LLSD& data, LLCurl::Respo
747 easy->setopt(CURLOPT_POSTFIELDS, (void*)NULL); 751 easy->setopt(CURLOPT_POSTFIELDS, (void*)NULL);
748 easy->setopt(CURLOPT_POSTFIELDSIZE, bytes); 752 easy->setopt(CURLOPT_POSTFIELDSIZE, bytes);
749 753
750 easy->slist_append("Content-Type: application/xml"); 754 easy->slist_append("Content-Type: application/llsd+xml");
751 easy->setHeaders(); 755 easy->setHeaders();
752 756
753 lldebugs << "POSTING: " << bytes << " bytes." << llendl; 757 lldebugs << "POSTING: " << bytes << " bytes." << llendl;
diff --git a/linden/indra/llmessage/llhttpassetstorage.cpp b/linden/indra/llmessage/llhttpassetstorage.cpp
index fdd521f..6d5a716 100644
--- a/linden/indra/llmessage/llhttpassetstorage.cpp
+++ b/linden/indra/llmessage/llhttpassetstorage.cpp
@@ -256,6 +256,10 @@ void LLHTTPAssetRequest::setupCurlHandle()
256 // disable use of proxy, which can't handle chunked transfers 256 // disable use of proxy, which can't handle chunked transfers
257 } 257 }
258 mHTTPHeaders = curl_slist_append(mHTTPHeaders, "Pragma:"); 258 mHTTPHeaders = curl_slist_append(mHTTPHeaders, "Pragma:");
259
260 // bug in curl causes DNS to be cached for too long a time, 0 sets it to never cache DNS results internally (to curl)
261 curl_easy_setopt(mCurlHandle, CURLOPT_DNS_CACHE_TIMEOUT, 0);
262
259 // resist the temptation to explicitly add the Transfer-Encoding: chunked 263 // resist the temptation to explicitly add the Transfer-Encoding: chunked
260 // header here - invokes a libCURL bug 264 // header here - invokes a libCURL bug
261 curl_easy_setopt(mCurlHandle, CURLOPT_HTTPHEADER, mHTTPHeaders); 265 curl_easy_setopt(mCurlHandle, CURLOPT_HTTPHEADER, mHTTPHeaders);
diff --git a/linden/indra/llmessage/llhttpclient.cpp b/linden/indra/llmessage/llhttpclient.cpp
index ef163fa..a07f379 100644
--- a/linden/indra/llmessage/llhttpclient.cpp
+++ b/linden/indra/llmessage/llhttpclient.cpp
@@ -106,7 +106,7 @@ namespace
106 LLSDInjector(const LLSD& sd) : mSD(sd) {} 106 LLSDInjector(const LLSD& sd) : mSD(sd) {}
107 virtual ~LLSDInjector() {} 107 virtual ~LLSDInjector() {}
108 108
109 const char* contentType() { return "application/xml"; } 109 const char* contentType() { return "application/llsd+xml"; }
110 110
111 virtual EStatus process_impl(const LLChannelDescriptors& channels, 111 virtual EStatus process_impl(const LLChannelDescriptors& channels,
112 buffer_ptr_t& buffer, bool& eos, LLSD& context, LLPumpIO* pump) 112 buffer_ptr_t& buffer, bool& eos, LLSD& context, LLPumpIO* pump)
@@ -160,9 +160,10 @@ namespace
160 fstream.seekg(0, std::ios::end); 160 fstream.seekg(0, std::ios::end);
161 U32 fileSize = fstream.tellg(); 161 U32 fileSize = fstream.tellg();
162 fstream.seekg(0, std::ios::beg); 162 fstream.seekg(0, std::ios::beg);
163 std::vector<char> fileBuffer(fileSize); 163 char* fileBuffer;
164 fstream.read(&fileBuffer[0], fileSize); 164 fileBuffer = new char [fileSize];
165 ostream.write(&fileBuffer[0], fileSize); 165 fstream.read(fileBuffer, fileSize);
166 ostream.write(fileBuffer, fileSize);
166 fstream.close(); 167 fstream.close();
167 eos = true; 168 eos = true;
168 return STATUS_DONE; 169 return STATUS_DONE;
@@ -189,9 +190,10 @@ namespace
189 190
190 LLVFile vfile(gVFS, mUUID, mAssetType, LLVFile::READ); 191 LLVFile vfile(gVFS, mUUID, mAssetType, LLVFile::READ);
191 S32 fileSize = vfile.getSize(); 192 S32 fileSize = vfile.getSize();
192 std::vector<U8> fileBuffer(fileSize); 193 U8* fileBuffer;
193 vfile.read(&fileBuffer[0], fileSize); 194 fileBuffer = new U8 [fileSize];
194 ostream.write((char*)&fileBuffer[0], fileSize); 195 vfile.read(fileBuffer, fileSize);
196 ostream.write((char*)fileBuffer, fileSize);
195 eos = true; 197 eos = true;
196 return STATUS_DONE; 198 return STATUS_DONE;
197 } 199 }
@@ -236,7 +238,8 @@ static void request(
236 //the Pragma header it so gratuitously inserts 238 //the Pragma header it so gratuitously inserts
237 //Before inserting the header, force libcurl 239 //Before inserting the header, force libcurl
238 //to not use the proxy (read: llurlrequest.cpp) 240 //to not use the proxy (read: llurlrequest.cpp)
239 if ((iter->first == "Pragma") && (iter->second.asString() == "")) 241 static const std::string PRAGMA("Pragma");
242 if ((iter->first == PRAGMA) && (iter->second.asString().empty()))
240 { 243 {
241 req->useProxy(false); 244 req->useProxy(false);
242 } 245 }
@@ -245,6 +248,19 @@ static void request(
245 req->addHeader(header.str().c_str()); 248 req->addHeader(header.str().c_str());
246 } 249 }
247 } 250 }
251
252 // Check to see if we have already set Accept or not. If no one
253 // set it, set it to application/llsd+xml since that's what we
254 // almost always want.
255 if( method != LLURLRequest::HTTP_PUT && method != LLURLRequest::HTTP_POST )
256 {
257 static const std::string ACCEPT("Accept");
258 if(!headers.has(ACCEPT))
259 {
260 req->addHeader("Accept: application/llsd+xml");
261 }
262 }
263
248 req->setCallback(new LLHTTPClientURLAdaptor(responder)); 264 req->setCallback(new LLHTTPClientURLAdaptor(responder));
249 265
250 if (method == LLURLRequest::HTTP_POST && gMessageSystem) 266 if (method == LLURLRequest::HTTP_POST && gMessageSystem)
@@ -252,12 +268,22 @@ static void request(
252 req->addHeader(llformat("X-SecondLife-UDP-Listen-Port: %d", 268 req->addHeader(llformat("X-SecondLife-UDP-Listen-Port: %d",
253 gMessageSystem->mPort).c_str()); 269 gMessageSystem->mPort).c_str());
254 } 270 }
255 271
256 if (method == LLURLRequest::HTTP_PUT || method == LLURLRequest::HTTP_POST) 272 if (method == LLURLRequest::HTTP_PUT || method == LLURLRequest::HTTP_POST)
257 { 273 {
258 req->addHeader(llformat("Content-Type: %s", 274 static const std::string CONTENT_TYPE("Content-Type");
259 body_injector->contentType()).c_str()); 275 if(!headers.has(CONTENT_TYPE))
260 276 {
277 // If the Content-Type header was passed in, it has
278 // already been added as a header through req->addHeader
279 // in the loop above. We defer to the caller's wisdom, but
280 // if they did not specify a Content-Type, then ask the
281 // injector.
282 req->addHeader(
283 llformat(
284 "Content-Type: %s",
285 body_injector->contentType()).c_str());
286 }
261 chain.push_back(LLIOPipe::ptr_t(body_injector)); 287 chain.push_back(LLIOPipe::ptr_t(body_injector));
262 } 288 }
263 289
@@ -284,9 +310,13 @@ void LLHTTPClient::getByteRange(
284 request(url,LLURLRequest::HTTP_GET, NULL, responder, timeout, headers); 310 request(url,LLURLRequest::HTTP_GET, NULL, responder, timeout, headers);
285} 311}
286 312
287void LLHTTPClient::head(const std::string& url, ResponderPtr responder, const F32 timeout) 313void LLHTTPClient::head(
314 const std::string& url,
315 ResponderPtr responder,
316 const LLSD& headers,
317 const F32 timeout)
288{ 318{
289 request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout); 319 request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers);
290} 320}
291 321
292void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout) 322void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout)
@@ -397,39 +427,66 @@ LLSD LLHTTPClient::blockingGet(const std::string& url)
397 return response; 427 return response;
398} 428}
399 429
400void LLHTTPClient::put(const std::string& url, const LLSD& body, ResponderPtr responder, const F32 timeout) 430void LLHTTPClient::put(
431 const std::string& url,
432 const LLSD& body,
433 ResponderPtr responder,
434 const LLSD& headers,
435 const F32 timeout)
401{ 436{
402 request(url, LLURLRequest::HTTP_PUT, new LLSDInjector(body), responder, timeout); 437 request(url, LLURLRequest::HTTP_PUT, new LLSDInjector(body), responder, timeout, headers);
403} 438}
404 439
405void LLHTTPClient::post(const std::string& url, const LLSD& body, ResponderPtr responder, const F32 timeout) 440void LLHTTPClient::post(
441 const std::string& url,
442 const LLSD& body,
443 ResponderPtr responder,
444 const LLSD& headers,
445 const F32 timeout)
406{ 446{
407 request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout); 447 request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout, headers);
408} 448}
409 449
410void LLHTTPClient::postRaw(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout) 450void LLHTTPClient::postRaw(
451 const std::string& url,
452 const U8* data,
453 S32 size,
454 ResponderPtr responder,
455 const LLSD& headers,
456 const F32 timeout)
411{ 457{
412 request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout); 458 request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout, headers);
413} 459}
414 460
415void LLHTTPClient::postFile(const std::string& url, const std::string& filename, ResponderPtr responder, const F32 timeout) 461void LLHTTPClient::postFile(
462 const std::string& url,
463 const std::string& filename,
464 ResponderPtr responder,
465 const LLSD& headers,
466 const F32 timeout)
416{ 467{
417 request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, timeout); 468 request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, timeout, headers);
418} 469}
419 470
420void LLHTTPClient::postFile(const std::string& url, const LLUUID& uuid, 471void LLHTTPClient::postFile(
421 LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout) 472 const std::string& url,
473 const LLUUID& uuid,
474 LLAssetType::EType asset_type,
475 ResponderPtr responder,
476 const LLSD& headers,
477 const F32 timeout)
422{ 478{
423 request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout); 479 request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout, headers);
424} 480}
425 481
426// static 482// static
427void LLHTTPClient::del( 483void LLHTTPClient::del(
428 const std::string& url, 484 const std::string& url,
429 ResponderPtr responder, 485 ResponderPtr responder,
486 const LLSD& headers,
430 const F32 timeout) 487 const F32 timeout)
431{ 488{
432 request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout); 489 request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout, headers);
433} 490}
434 491
435// static 492// static
@@ -437,9 +494,10 @@ void LLHTTPClient::move(
437 const std::string& url, 494 const std::string& url,
438 const std::string& destination, 495 const std::string& destination,
439 ResponderPtr responder, 496 ResponderPtr responder,
497 const LLSD& hdrs,
440 const F32 timeout) 498 const F32 timeout)
441{ 499{
442 LLSD headers; 500 LLSD headers = hdrs;
443 headers["Destination"] = destination; 501 headers["Destination"] = destination;
444 request(url, LLURLRequest::HTTP_MOVE, NULL, responder, timeout, headers); 502 request(url, LLURLRequest::HTTP_MOVE, NULL, responder, timeout, headers);
445} 503}
diff --git a/linden/indra/llmessage/llhttpclient.h b/linden/indra/llmessage/llhttpclient.h
index 50c6f7a..367098f 100644
--- a/linden/indra/llmessage/llhttpclient.h
+++ b/linden/indra/llmessage/llhttpclient.h
@@ -62,28 +62,56 @@ public:
62 62
63 /** @name non-blocking API */ 63 /** @name non-blocking API */
64 //@{ 64 //@{
65 static void head(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 65 static void head(
66 const std::string& url,
67 ResponderPtr,
68 const LLSD& headers = LLSD(),
69 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
66 static void getByteRange(const std::string& url, S32 offset, S32 bytes, ResponderPtr, const LLSD& headers=LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 70 static void getByteRange(const std::string& url, S32 offset, S32 bytes, ResponderPtr, const LLSD& headers=LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
67 static void get(const std::string& url, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 71 static void get(const std::string& url, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
68 static void get(const std::string& url, const LLSD& query, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 72 static void get(const std::string& url, const LLSD& query, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
69 73
70 static void put(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 74 static void put(
75 const std::string& url,
76 const LLSD& body,
77 ResponderPtr,
78 const LLSD& headers = LLSD(),
79 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
71 static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 80 static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
72 static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 81 static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
73 82
74 static void post(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 83 static void post(
75 84 const std::string& url,
85 const LLSD& body,
86 ResponderPtr,
87 const LLSD& headers = LLSD(),
88 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
76 /** Takes ownership of data and deletes it when sent */ 89 /** Takes ownership of data and deletes it when sent */
77 static void postRaw(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 90 static void postRaw(
78 91 const std::string& url,
79 static void postFile(const std::string& url, const std::string& filename, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 92 const U8* data,
80 # 93 S32 size,
81 static void postFile(const std::string& url, const LLUUID& uuid, 94 ResponderPtr responder,
82 LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 95 const LLSD& headers = LLSD(),
96 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
97 static void postFile(
98 const std::string& url,
99 const std::string& filename,
100 ResponderPtr,
101 const LLSD& headers = LLSD(),
102 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
103 static void postFile(
104 const std::string& url,
105 const LLUUID& uuid,
106 LLAssetType::EType asset_type,
107 ResponderPtr responder,
108 const LLSD& headers = LLSD(),
109 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
83 110
84 static void del( 111 static void del(
85 const std::string& url, 112 const std::string& url,
86 ResponderPtr responder, 113 ResponderPtr responder,
114 const LLSD& headers = LLSD(),
87 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 115 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
88 ///< sends a DELETE method, but we can't call it delete in c++ 116 ///< sends a DELETE method, but we can't call it delete in c++
89 117
@@ -93,12 +121,14 @@ public:
93 * @param url The complete serialized (and escaped) url to get. 121 * @param url The complete serialized (and escaped) url to get.
94 * @param destination The complete serialized destination url. 122 * @param destination The complete serialized destination url.
95 * @param responder The responder that will handle the result. 123 * @param responder The responder that will handle the result.
124 * @param headers A map of key:value headers to pass to the request
96 * @param timeout The number of seconds to give the server to respond. 125 * @param timeout The number of seconds to give the server to respond.
97 */ 126 */
98 static void move( 127 static void move(
99 const std::string& url, 128 const std::string& url,
100 const std::string& destination, 129 const std::string& destination,
101 ResponderPtr responder, 130 ResponderPtr responder,
131 const LLSD& headers = LLSD(),
102 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 132 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
103 133
104 //@} 134 //@}
diff --git a/linden/indra/llmessage/lliohttpserver.cpp b/linden/indra/llmessage/lliohttpserver.cpp
index d4155f6..64222ff 100644
--- a/linden/indra/llmessage/lliohttpserver.cpp
+++ b/linden/indra/llmessage/lliohttpserver.cpp
@@ -47,6 +47,7 @@
47#include "llpumpio.h" 47#include "llpumpio.h"
48#include "llsd.h" 48#include "llsd.h"
49#include "llsdserialize_xml.h" 49#include "llsdserialize_xml.h"
50#include "llstat.h"
50#include "llstl.h" 51#include "llstl.h"
51#include "lltimer.h" 52#include "lltimer.h"
52 53
@@ -171,22 +172,26 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
171 std::string verb = context[CONTEXT_REQUEST][CONTEXT_VERB]; 172 std::string verb = context[CONTEXT_REQUEST][CONTEXT_VERB];
172 if(verb == HTTP_VERB_GET) 173 if(verb == HTTP_VERB_GET)
173 { 174 {
175 LLPerfBlock getblock("http_get");
174 mNode.get(LLHTTPNode::ResponsePtr(mResponse), context); 176 mNode.get(LLHTTPNode::ResponsePtr(mResponse), context);
175 } 177 }
176 else if(verb == HTTP_VERB_PUT) 178 else if(verb == HTTP_VERB_PUT)
177 { 179 {
180 LLPerfBlock putblock("http_put");
178 LLSD input; 181 LLSD input;
179 LLSDSerialize::fromXML(input, istr); 182 LLSDSerialize::fromXML(input, istr);
180 mNode.put(LLHTTPNode::ResponsePtr(mResponse), context, input); 183 mNode.put(LLHTTPNode::ResponsePtr(mResponse), context, input);
181 } 184 }
182 else if(verb == HTTP_VERB_POST) 185 else if(verb == HTTP_VERB_POST)
183 { 186 {
187 LLPerfBlock postblock("http_post");
184 LLSD input; 188 LLSD input;
185 LLSDSerialize::fromXML(input, istr); 189 LLSDSerialize::fromXML(input, istr);
186 mNode.post(LLHTTPNode::ResponsePtr(mResponse), context, input); 190 mNode.post(LLHTTPNode::ResponsePtr(mResponse), context, input);
187 } 191 }
188 else if(verb == HTTP_VERB_DELETE) 192 else if(verb == HTTP_VERB_DELETE)
189 { 193 {
194 LLPerfBlock delblock("http_delete");
190 mNode.del(LLHTTPNode::ResponsePtr(mResponse), context); 195 mNode.del(LLHTTPNode::ResponsePtr(mResponse), context);
191 } 196 }
192 else if(verb == HTTP_VERB_OPTIONS) 197 else if(verb == HTTP_VERB_OPTIONS)
@@ -240,7 +245,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
240 case STATE_GOOD_RESULT: 245 case STATE_GOOD_RESULT:
241 { 246 {
242 LLSD headers = mHeaders; 247 LLSD headers = mHeaders;
243 headers["Content-Type"] = "application/xml"; 248 headers["Content-Type"] = "application/llsd+xml";
244 context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = headers; 249 context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = headers;
245 LLBufferStream ostr(channels, buffer.get()); 250 LLBufferStream ostr(channels, buffer.get());
246 LLSDSerialize::toXML(mGoodResult, ostr); 251 LLSDSerialize::toXML(mGoodResult, ostr);
diff --git a/linden/indra/llmessage/llmail.cpp b/linden/indra/llmessage/llmail.cpp
index 8ae7206..0504080 100644
--- a/linden/indra/llmessage/llmail.cpp
+++ b/linden/indra/llmessage/llmail.cpp
@@ -51,6 +51,7 @@
51#include "llblowfishcipher.h" 51#include "llblowfishcipher.h"
52#include "llerror.h" 52#include "llerror.h"
53#include "llhost.h" 53#include "llhost.h"
54#include "llsd.h"
54#include "llstring.h" 55#include "llstring.h"
55#include "lluuid.h" 56#include "lluuid.h"
56#include "net.h" 57#include "net.h"
@@ -111,16 +112,22 @@ void disconnect_smtp()
111// Returns TRUE on success. 112// Returns TRUE on success.
112// message should NOT be SMTP escaped. 113// message should NOT be SMTP escaped.
113// static 114// static
114BOOL LLMail::send(const char* from_name, const char* from_address, 115BOOL LLMail::send(
115 const char* to_name, const char* to_address, 116 const char* from_name,
116 const char* subject, const char* message) 117 const char* from_address,
118 const char* to_name,
119 const char* to_address,
120 const char* subject,
121 const char* message,
122 const LLSD& headers)
117{ 123{
118 std::string header = buildSMTPTransaction( 124 std::string header = buildSMTPTransaction(
119 from_name, 125 from_name,
120 from_address, 126 from_address,
121 to_name, 127 to_name,
122 to_address, 128 to_address,
123 subject); 129 subject,
130 headers);
124 if(header.empty()) 131 if(header.empty())
125 { 132 {
126 return FALSE; 133 return FALSE;
@@ -192,7 +199,8 @@ std::string LLMail::buildSMTPTransaction(
192 const char* from_address, 199 const char* from_address,
193 const char* to_name, 200 const char* to_name,
194 const char* to_address, 201 const char* to_address,
195 const char* subject) 202 const char* subject,
203 const LLSD& headers)
196{ 204{
197 if(!from_address || !to_address) 205 if(!from_address || !to_address)
198 { 206 {
@@ -236,8 +244,20 @@ std::string LLMail::buildSMTPTransaction(
236 << "DATA\r\n" 244 << "DATA\r\n"
237 << "From: " << from_fmt.str() << "\r\n" 245 << "From: " << from_fmt.str() << "\r\n"
238 << "To: " << to_fmt.str() << "\r\n" 246 << "To: " << to_fmt.str() << "\r\n"
239 << "Subject: " << subject << "\r\n" 247 << "Subject: " << subject << "\r\n";
240 << "\r\n"; 248
249 if(headers.isMap())
250 {
251 LLSD::map_const_iterator iter = headers.beginMap();
252 LLSD::map_const_iterator end = headers.endMap();
253 for(; iter != end; ++iter)
254 {
255 header << (*iter).first << ": " << ((*iter).second).asString()
256 << "\r\n";
257 }
258 }
259
260 header << "\r\n";
241 return header.str(); 261 return header.str();
242} 262}
243 263
diff --git a/linden/indra/llmessage/llmail.h b/linden/indra/llmessage/llmail.h
index 86b7793..018e180 100644
--- a/linden/indra/llmessage/llmail.h
+++ b/linden/indra/llmessage/llmail.h
@@ -34,7 +34,7 @@
34 34
35typedef struct apr_pool_t apr_pool_t; 35typedef struct apr_pool_t apr_pool_t;
36 36
37class LLUUID; 37#include "llsd.h"
38 38
39class LLMail 39class LLMail
40{ 40{
@@ -45,34 +45,51 @@ public:
45 // Allow all email transmission to be disabled/enabled. 45 // Allow all email transmission to be disabled/enabled.
46 static void enable(bool mail_enabled); 46 static void enable(bool mail_enabled);
47 47
48 // returns TRUE if the call succeeds, FALSE otherwise. 48 /**
49 // 49 * @brief send an email
50 // Results in: 50 * @param from_name The name of the email sender
51 // From: "from_name" <from_address> 51 * @param from_address The email address for the sender
52 // To: "to_name" <to_address> 52 * @param to_name The name of the email recipient
53 // Subject: subject 53 * @param to_address The email recipient address
54 // message 54 * @param subject The subject of the email
55 static BOOL send(const char* from_name, const char* from_address, 55 * @param headers optional X-Foo headers in an llsd map.
56 const char* to_name, const char* to_address, 56 * @return Returns TRUE if the call succeeds, FALSE otherwise.
57 const char* subject, const char* message); 57 *
58 * Results in:
59 * From: "from_name" <from_address>
60 * To: "to_name" <to_address>
61 * Subject: subject
62 *
63 * message
64 */
65 static BOOL send(
66 const char* from_name,
67 const char* from_address,
68 const char* to_name,
69 const char* to_address,
70 const char* subject,
71 const char* message,
72 const LLSD& headers = LLSD());
58 73
59 /** 74 /**
60 * @brief build the complete smtp transaction & header for use in an 75 * @brief build the complete smtp transaction & header for use in an
61 * mail. 76 * mail.
62 * 77 *
63 * @param from_name The name of the email sender 78 * @param from_name The name of the email sender
64 * @param from_address The email address for the sender 79 * @param from_address The email address for the sender
65 * @param to_name The name of the email recipient 80 * @param to_name The name of the email recipient
66 * @param to_name The email recipient address 81 * @param to_address The email recipient address
67 * @param subject The subject of the email 82 * @param subject The subject of the email
68 * @return Returns the complete SMTP transaction mail header. 83 * @param headers optional X-Foo headers in an llsd map.
69 */ 84 * @return Returns the complete SMTP transaction mail header.
85 */
70 static std::string buildSMTPTransaction( 86 static std::string buildSMTPTransaction(
71 const char* from_name, 87 const char* from_name,
72 const char* from_address, 88 const char* from_address,
73 const char* to_name, 89 const char* to_name,
74 const char* to_address, 90 const char* to_address,
75 const char* subject); 91 const char* subject,
92 const LLSD& headers = LLSD());
76 93
77 /** 94 /**
78 * @brief send an email with header and body. 95 * @brief send an email with header and body.
diff --git a/linden/indra/llmessage/llmessagetemplate.cpp b/linden/indra/llmessage/llmessagetemplate.cpp
index 4a560ca..ff44d45 100644
--- a/linden/indra/llmessage/llmessagetemplate.cpp
+++ b/linden/indra/llmessage/llmessagetemplate.cpp
@@ -50,7 +50,7 @@ void LLMsgVarData::addData(const void *data, S32 size, EMsgVariableType type, S3
50 } 50 }
51 if(size) 51 if(size)
52 { 52 {
53 delete mData; // Delete it if it already exists 53 delete[] mData; // Delete it if it already exists
54 mData = new U8[size]; 54 mData = new U8[size];
55 htonmemcpy(mData, data, mType, size); 55 htonmemcpy(mData, data, mType, size);
56 } 56 }
@@ -175,3 +175,23 @@ std::ostream& operator<<(std::ostream& s, LLMessageTemplate &msg)
175 175
176 return s; 176 return s;
177} 177}
178
179void LLMessageTemplate::banUdp()
180{
181 static const char* deprecation[] = {
182 "NotDeprecated",
183 "Deprecated",
184 "UDPDeprecated",
185 "UDPBlackListed"
186 };
187 if (mDeprecation != MD_DEPRECATED)
188 {
189 llinfos << "Setting " << mName << " to UDPBlackListed was " << deprecation[mDeprecation] << llendl;
190 mDeprecation = MD_UDPBLACKLISTED;
191 }
192 else
193 {
194 llinfos << mName << " is already more deprecated than UDPBlackListed" << llendl;
195 }
196}
197
diff --git a/linden/indra/llmessage/llmessagetemplate.h b/linden/indra/llmessage/llmessagetemplate.h
index 716c618..445d1a8 100644
--- a/linden/indra/llmessage/llmessagetemplate.h
+++ b/linden/indra/llmessage/llmessagetemplate.h
@@ -34,6 +34,7 @@
34 34
35#include "lldarray.h" 35#include "lldarray.h"
36#include "message.h" // TODO: babbage: Remove... 36#include "message.h" // TODO: babbage: Remove...
37#include "llstat.h"
37#include "llstl.h" 38#include "llstl.h"
38 39
39class LLMsgVarData 40class LLMsgVarData
@@ -370,20 +371,23 @@ public:
370 { 371 {
371 if (mHandlerFunc) 372 if (mHandlerFunc)
372 { 373 {
374 LLPerfBlock msg_cb_time("msg_cb", mName);
373 mHandlerFunc(msgsystem, mUserData); 375 mHandlerFunc(msgsystem, mUserData);
374 return TRUE; 376 return TRUE;
375 } 377 }
376 return FALSE; 378 return FALSE;
377 } 379 }
378 380
379 bool isBanned(bool trustedSource) const 381 bool isUdpBanned() const
380 { 382 {
381 return trustedSource ? mBanFromTrusted : mBanFromUntrusted; 383 return mDeprecation == MD_UDPBLACKLISTED;
382 } 384 }
383 385
384 bool isUdpBanned() const 386 void banUdp();
387
388 bool isBanned(bool trustedSource) const
385 { 389 {
386 return mDeprecation == MD_UDPBLACKLISTED; 390 return trustedSource ? mBanFromTrusted : mBanFromUntrusted;
387 } 391 }
388 392
389 friend std::ostream& operator<<(std::ostream& s, LLMessageTemplate &msg); 393 friend std::ostream& operator<<(std::ostream& s, LLMessageTemplate &msg);
diff --git a/linden/indra/llmessage/llmessagethrottle.cpp b/linden/indra/llmessage/llmessagethrottle.cpp
index ad9df26..47e1bd6 100644
--- a/linden/indra/llmessage/llmessagethrottle.cpp
+++ b/linden/indra/llmessage/llmessagethrottle.cpp
@@ -119,7 +119,7 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg
119 full_mesg << to << mesg; 119 full_mesg << to << mesg;
120 120
121 // Create an entry for this message. 121 // Create an entry for this message.
122 size_t hash = llhash<const char*> (full_mesg.str().c_str()); 122 size_t hash = llhash(full_mesg.str().c_str());
123 LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime()); 123 LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime());
124 124
125 // Check if this message is already in the list. 125 // Check if this message is already in the list.
@@ -153,7 +153,7 @@ BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, c
153 full_mesg << agent << task << mesg; 153 full_mesg << agent << task << mesg;
154 154
155 // Create an entry for this message. 155 // Create an entry for this message.
156 size_t hash = llhash<const char*> (full_mesg.str().c_str()); 156 size_t hash = llhash(full_mesg.str().c_str());
157 LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime()); 157 LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime());
158 158
159 // Check if this message is already in the list. 159 // Check if this message is already in the list.
diff --git a/linden/indra/llmessage/llnamevalue.cpp b/linden/indra/llmessage/llnamevalue.cpp
index c44f6ce..f661261 100644
--- a/linden/indra/llmessage/llnamevalue.cpp
+++ b/linden/indra/llmessage/llnamevalue.cpp
@@ -896,7 +896,7 @@ void LLNameValue::setVec3(const LLVector3 &a)
896} 896}
897 897
898 898
899std::string LLNameValue::printNameValue() 899std::string LLNameValue::printNameValue() const
900{ 900{
901 std::string buffer; 901 std::string buffer;
902 buffer = llformat("%s %s %s %s ", mName, mStringType, mStringClass, mStringSendto); 902 buffer = llformat("%s %s %s %s ", mName, mStringType, mStringClass, mStringSendto);
@@ -905,7 +905,7 @@ std::string LLNameValue::printNameValue()
905 return buffer; 905 return buffer;
906} 906}
907 907
908std::string LLNameValue::printData() 908std::string LLNameValue::printData() const
909{ 909{
910 std::string buffer; 910 std::string buffer;
911 switch(mType) 911 switch(mType)
diff --git a/linden/indra/llmessage/llnamevalue.h b/linden/indra/llmessage/llnamevalue.h
index 52beb07..f6c5040 100644
--- a/linden/indra/llmessage/llnamevalue.h
+++ b/linden/indra/llmessage/llnamevalue.h
@@ -148,8 +148,8 @@ public:
148 BOOL sendToViewer() const; 148 BOOL sendToViewer() const;
149 149
150 void callCallback(); 150 void callCallback();
151 std::string printNameValue(); 151 std::string printNameValue() const;
152 std::string printData(); 152 std::string printData() const;
153 153
154 ENameValueType getTypeEnum() const { return mType; } 154 ENameValueType getTypeEnum() const { return mType; }
155 ENameValueClass getClassEnum() const { return mClass; } 155 ENameValueClass getClassEnum() const { return mClass; }
diff --git a/linden/indra/llmessage/llpumpio.cpp b/linden/indra/llmessage/llpumpio.cpp
index 6adf9c2..9ce0bab 100644
--- a/linden/indra/llmessage/llpumpio.cpp
+++ b/linden/indra/llmessage/llpumpio.cpp
@@ -41,6 +41,7 @@
41#include "llapr.h" 41#include "llapr.h"
42#include "llmemtype.h" 42#include "llmemtype.h"
43#include "llstl.h" 43#include "llstl.h"
44#include "llstat.h"
44 45
45// These should not be enabled in production, but they can be 46// These should not be enabled in production, but they can be
46// intensely useful during development for finding certain kinds of 47// intensely useful during development for finding certain kinds of
@@ -521,7 +522,10 @@ void LLPumpIO::pump(const S32& poll_timeout)
521 //llinfos << "polling" << llendl; 522 //llinfos << "polling" << llendl;
522 S32 count = 0; 523 S32 count = 0;
523 S32 client_id = 0; 524 S32 client_id = 0;
524 apr_pollset_poll(mPollset, poll_timeout, &count, &poll_fd); 525 {
526 LLPerfBlock polltime("pump_poll");
527 apr_pollset_poll(mPollset, poll_timeout, &count, &poll_fd);
528 }
525 PUMP_DEBUG; 529 PUMP_DEBUG;
526 for(S32 ii = 0; ii < count; ++ii) 530 for(S32 ii = 0; ii < count; ++ii)
527 { 531 {
diff --git a/linden/indra/llmessage/llregionflags.h b/linden/indra/llmessage/llregionflags.h
index af010ae..46624c1 100644
--- a/linden/indra/llmessage/llregionflags.h
+++ b/linden/indra/llmessage/llregionflags.h
@@ -60,8 +60,10 @@ const U32 REGION_FLAGS_BLOCK_LAND_RESELL = (1 << 7);
60// All content wiped once per night 60// All content wiped once per night
61const U32 REGION_FLAGS_SANDBOX = (1 << 8); 61const U32 REGION_FLAGS_SANDBOX = (1 << 8);
62const U32 REGION_FLAGS_NULL_LAYER = (1 << 9); 62const U32 REGION_FLAGS_NULL_LAYER = (1 << 9);
63const U32 REGION_FLAGS_SKIP_AGENT_ACTION = (1 << 10); 63// const U32 REGION_FLAGS_SKIP_AGENT_ACTION = (1 << 10);
64const U32 REGION_FLAGS_SKIP_UPDATE_INTEREST_LIST= (1 << 11); 64const U32 REGION_FLAGS_HARD_ALLOW_LAND_TRANSFER = (1 << 10); // Region allows land reselling
65// const U32 REGION_FLAGS_SKIP_UPDATE_INTEREST_LIST= (1 << 11);
66const U32 REGION_FLAGS_HARD_ALLOW_POST_CLASSIFIED = (1 << 11); // Region allows posting of classified ads
65const U32 REGION_FLAGS_SKIP_COLLISIONS = (1 << 12); // Pin all non agent rigid bodies 67const U32 REGION_FLAGS_SKIP_COLLISIONS = (1 << 12); // Pin all non agent rigid bodies
66const U32 REGION_FLAGS_SKIP_SCRIPTS = (1 << 13); 68const U32 REGION_FLAGS_SKIP_SCRIPTS = (1 << 13);
67const U32 REGION_FLAGS_SKIP_PHYSICS = (1 << 14); // Skip all physics 69const U32 REGION_FLAGS_SKIP_PHYSICS = (1 << 14); // Skip all physics
diff --git a/linden/indra/llmessage/message.cpp b/linden/indra/llmessage/message.cpp
index b20731a..3ee3c03 100644
--- a/linden/indra/llmessage/message.cpp
+++ b/linden/indra/llmessage/message.cpp
@@ -3956,22 +3956,27 @@ void LLMessageSystem::getString(const char *block, const char *var,
3956 blocknum); 3956 blocknum);
3957} 3957}
3958 3958
3959S32 LLMessageSystem::getNumberOfBlocksFast(const char *blockname) 3959BOOL LLMessageSystem::has(const char *blockname) const
3960{
3961 return getNumberOfBlocks(blockname) > 0;
3962}
3963
3964S32 LLMessageSystem::getNumberOfBlocksFast(const char *blockname) const
3960{ 3965{
3961 return mMessageReader->getNumberOfBlocks(blockname); 3966 return mMessageReader->getNumberOfBlocks(blockname);
3962} 3967}
3963 3968
3964S32 LLMessageSystem::getNumberOfBlocks(const char *blockname) 3969S32 LLMessageSystem::getNumberOfBlocks(const char *blockname) const
3965{ 3970{
3966 return getNumberOfBlocksFast(LLMessageStringTable::getInstance()->getString(blockname)); 3971 return getNumberOfBlocksFast(LLMessageStringTable::getInstance()->getString(blockname));
3967} 3972}
3968 3973
3969S32 LLMessageSystem::getSizeFast(const char *blockname, const char *varname) 3974S32 LLMessageSystem::getSizeFast(const char *blockname, const char *varname) const
3970{ 3975{
3971 return mMessageReader->getSize(blockname, varname); 3976 return mMessageReader->getSize(blockname, varname);
3972} 3977}
3973 3978
3974S32 LLMessageSystem::getSize(const char *blockname, const char *varname) 3979S32 LLMessageSystem::getSize(const char *blockname, const char *varname) const
3975{ 3980{
3976 return getSizeFast(LLMessageStringTable::getInstance()->getString(blockname), 3981 return getSizeFast(LLMessageStringTable::getInstance()->getString(blockname),
3977 LLMessageStringTable::getInstance()->getString(varname)); 3982 LLMessageStringTable::getInstance()->getString(varname));
@@ -3979,13 +3984,13 @@ S32 LLMessageSystem::getSize(const char *blockname, const char *varname)
3979 3984
3980// size in bytes of variable length data 3985// size in bytes of variable length data
3981S32 LLMessageSystem::getSizeFast(const char *blockname, S32 blocknum, 3986S32 LLMessageSystem::getSizeFast(const char *blockname, S32 blocknum,
3982 const char *varname) 3987 const char *varname) const
3983{ 3988{
3984 return mMessageReader->getSize(blockname, blocknum, varname); 3989 return mMessageReader->getSize(blockname, blocknum, varname);
3985} 3990}
3986 3991
3987S32 LLMessageSystem::getSize(const char *blockname, S32 blocknum, 3992S32 LLMessageSystem::getSize(const char *blockname, S32 blocknum,
3988 const char *varname) 3993 const char *varname) const
3989{ 3994{
3990 return getSizeFast(LLMessageStringTable::getInstance()->getString(blockname), blocknum, 3995 return getSizeFast(LLMessageStringTable::getInstance()->getString(blockname), blocknum,
3991 LLMessageStringTable::getInstance()->getString(varname)); 3996 LLMessageStringTable::getInstance()->getString(varname));
@@ -4021,3 +4026,18 @@ bool LLMessageSystem::checkAllMessages(S64 frame_count, LLPumpIO* http_pump)
4021 http_pump->callback(); 4026 http_pump->callback();
4022 return (mPacketsIn - packetsIn) > 0; 4027 return (mPacketsIn - packetsIn) > 0;
4023} 4028}
4029
4030void LLMessageSystem::banUdpMessage(const std::string& name)
4031{
4032 message_template_name_map_t::iterator itt = mMessageTemplates.find(
4033 LLMessageStringTable::getInstance()->getString(name.c_str())
4034 );
4035 if(itt != mMessageTemplates.end())
4036 {
4037 itt->second->banUdp();
4038 }
4039 else
4040 {
4041 llwarns << "Attempted to ban an unknown message: " << name << "." << llendl;
4042 }
4043}
diff --git a/linden/indra/llmessage/message.h b/linden/indra/llmessage/message.h
index 8807521..b72aa9a 100644
--- a/linden/indra/llmessage/message.h
+++ b/linden/indra/llmessage/message.h
@@ -562,6 +562,9 @@ public:
562 /** Return false true if name is unknown or trusted */ 562 /** Return false true if name is unknown or trusted */
563 bool isUntrustedMessage(const std::string& name) const; 563 bool isUntrustedMessage(const std::string& name) const;
564 564
565 // Change this message to be UDP black listed.
566 void banUdpMessage(const std::string& name);
567
565private: 568private:
566 // A list of the circuits that need to be sent DenyTrustedCircuit messages. 569 // A list of the circuits that need to be sent DenyTrustedCircuit messages.
567 typedef std::set<LLHost> host_set_t; 570 typedef std::set<LLHost> host_set_t;
@@ -591,13 +594,14 @@ public:
591 LLHost findHost(const U32 circuit_code); 594 LLHost findHost(const U32 circuit_code);
592 void sanityCheck(); 595 void sanityCheck();
593 596
594 S32 getNumberOfBlocksFast(const char *blockname); 597 BOOL has(const char *blockname) const;
595 S32 getNumberOfBlocks(const char *blockname); 598 S32 getNumberOfBlocksFast(const char *blockname) const;
596 S32 getSizeFast(const char *blockname, const char *varname); 599 S32 getNumberOfBlocks(const char *blockname) const;
597 S32 getSize(const char *blockname, const char *varname); 600 S32 getSizeFast(const char *blockname, const char *varname) const;
601 S32 getSize(const char *blockname, const char *varname) const;
598 S32 getSizeFast(const char *blockname, S32 blocknum, 602 S32 getSizeFast(const char *blockname, S32 blocknum,
599 const char *varname); // size in bytes of data 603 const char *varname) const; // size in bytes of data
600 S32 getSize(const char *blockname, S32 blocknum, const char *varname); 604 S32 getSize(const char *blockname, S32 blocknum, const char *varname) const;
601 605
602 void resetReceiveCounts(); // resets receive counts for all message types to 0 606 void resetReceiveCounts(); // resets receive counts for all message types to 0
603 void dumpReceiveCounts(); // dumps receive count for each message type to llinfos 607 void dumpReceiveCounts(); // dumps receive count for each message type to llinfos