aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llmessage
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/llmessage')
-rw-r--r--linden/indra/llmessage/CMakeLists.txt26
-rw-r--r--linden/indra/llmessage/llares.cpp23
-rw-r--r--linden/indra/llmessage/llares.h3
-rw-r--r--linden/indra/llmessage/llassetstorage.cpp23
-rw-r--r--linden/indra/llmessage/llassetstorage.h3
-rw-r--r--linden/indra/llmessage/llblowfishcipher.cpp3
-rw-r--r--linden/indra/llmessage/llblowfishcipher.h3
-rw-r--r--linden/indra/llmessage/llbuffer.cpp3
-rw-r--r--linden/indra/llmessage/llbuffer.h3
-rw-r--r--linden/indra/llmessage/llbufferstream.cpp3
-rw-r--r--linden/indra/llmessage/llbufferstream.h3
-rw-r--r--linden/indra/llmessage/llcachename.cpp228
-rw-r--r--linden/indra/llmessage/llcachename.h17
-rw-r--r--linden/indra/llmessage/llchainio.cpp3
-rw-r--r--linden/indra/llmessage/llchainio.h3
-rw-r--r--linden/indra/llmessage/llcipher.h3
-rw-r--r--linden/indra/llmessage/llcircuit.cpp36
-rw-r--r--linden/indra/llmessage/llcircuit.h19
-rw-r--r--linden/indra/llmessage/llclassifiedflags.cpp28
-rw-r--r--linden/indra/llmessage/llclassifiedflags.h20
-rw-r--r--linden/indra/llmessage/llcurl.cpp3
-rw-r--r--linden/indra/llmessage/llcurl.h3
-rw-r--r--linden/indra/llmessage/lldatapacker.cpp3
-rw-r--r--linden/indra/llmessage/lldatapacker.h3
-rw-r--r--linden/indra/llmessage/lldbstrings.h3
-rw-r--r--linden/indra/llmessage/lldispatcher.cpp50
-rw-r--r--linden/indra/llmessage/lldispatcher.h3
-rw-r--r--linden/indra/llmessage/lleventflags.h4
-rw-r--r--linden/indra/llmessage/llfiltersd2xmlrpc.cpp3
-rw-r--r--linden/indra/llmessage/llfiltersd2xmlrpc.h3
-rw-r--r--linden/indra/llmessage/llfollowcamparams.h3
-rw-r--r--linden/indra/llmessage/llhost.cpp3
-rw-r--r--linden/indra/llmessage/llhost.h3
-rw-r--r--linden/indra/llmessage/llhttpassetstorage.cpp4
-rw-r--r--linden/indra/llmessage/llhttpassetstorage.h3
-rw-r--r--linden/indra/llmessage/llhttpclient.cpp81
-rw-r--r--linden/indra/llmessage/llhttpclient.h53
-rw-r--r--linden/indra/llmessage/llhttpclientadapter.cpp61
-rw-r--r--linden/indra/llmessage/llhttpclientadapter.h49
-rw-r--r--linden/indra/llmessage/llhttpclientinterface.h51
-rw-r--r--linden/indra/llmessage/llhttpnode.cpp13
-rw-r--r--linden/indra/llmessage/llhttpnode.h78
-rw-r--r--linden/indra/llmessage/llhttpnodeadapter.h58
-rw-r--r--linden/indra/llmessage/llhttpsender.cpp3
-rw-r--r--linden/indra/llmessage/llhttpsender.h3
-rw-r--r--linden/indra/llmessage/llinstantmessage.cpp3
-rw-r--r--linden/indra/llmessage/llinstantmessage.h5
-rw-r--r--linden/indra/llmessage/llinvite.h3
-rw-r--r--linden/indra/llmessage/lliobuffer.cpp3
-rw-r--r--linden/indra/llmessage/lliobuffer.h3
-rw-r--r--linden/indra/llmessage/lliohttpserver.cpp75
-rw-r--r--linden/indra/llmessage/lliohttpserver.h15
-rw-r--r--linden/indra/llmessage/lliopipe.cpp3
-rw-r--r--linden/indra/llmessage/lliopipe.h3
-rw-r--r--linden/indra/llmessage/lliosocket.cpp3
-rw-r--r--linden/indra/llmessage/lliosocket.h3
-rw-r--r--linden/indra/llmessage/llioutil.cpp3
-rw-r--r--linden/indra/llmessage/llioutil.h3
-rw-r--r--linden/indra/llmessage/llloginflags.h3
-rw-r--r--linden/indra/llmessage/llmail.cpp3
-rw-r--r--linden/indra/llmessage/llmail.h3
-rw-r--r--linden/indra/llmessage/llmessagebuilder.cpp3
-rw-r--r--linden/indra/llmessage/llmessagebuilder.h3
-rw-r--r--linden/indra/llmessage/llmessageconfig.cpp3
-rw-r--r--linden/indra/llmessage/llmessageconfig.h3
-rw-r--r--linden/indra/llmessage/llmessagereader.cpp3
-rw-r--r--linden/indra/llmessage/llmessagereader.h9
-rw-r--r--linden/indra/llmessage/llmessagesenderinterface.h (renamed from linden/indra/llmessage/network.h)29
-rw-r--r--linden/indra/llmessage/llmessagetemplate.cpp3
-rw-r--r--linden/indra/llmessage/llmessagetemplate.h3
-rw-r--r--linden/indra/llmessage/llmessagetemplateparser.cpp3
-rw-r--r--linden/indra/llmessage/llmessagetemplateparser.h3
-rw-r--r--linden/indra/llmessage/llmessagethrottle.cpp7
-rw-r--r--linden/indra/llmessage/llmessagethrottle.h3
-rw-r--r--linden/indra/llmessage/llmime.cpp3
-rw-r--r--linden/indra/llmessage/llmime.h3
-rw-r--r--linden/indra/llmessage/llmsgvariabletype.h3
-rw-r--r--linden/indra/llmessage/llnamevalue.cpp4
-rw-r--r--linden/indra/llmessage/llnamevalue.h3
-rw-r--r--linden/indra/llmessage/llnullcipher.cpp3
-rw-r--r--linden/indra/llmessage/llnullcipher.h3
-rw-r--r--linden/indra/llmessage/llpacketack.cpp3
-rw-r--r--linden/indra/llmessage/llpacketack.h3
-rw-r--r--linden/indra/llmessage/llpacketbuffer.cpp6
-rw-r--r--linden/indra/llmessage/llpacketbuffer.h11
-rw-r--r--linden/indra/llmessage/llpacketring.cpp5
-rw-r--r--linden/indra/llmessage/llpacketring.h10
-rw-r--r--linden/indra/llmessage/llpartdata.cpp3
-rw-r--r--linden/indra/llmessage/llpartdata.h3
-rw-r--r--linden/indra/llmessage/llpumpio.cpp14
-rw-r--r--linden/indra/llmessage/llpumpio.h3
-rw-r--r--linden/indra/llmessage/llqueryflags.h35
-rw-r--r--linden/indra/llmessage/llregionflags.h9
-rw-r--r--linden/indra/llmessage/llregionhandle.h3
-rw-r--r--linden/indra/llmessage/llregionpresenceverifier.cpp98
-rw-r--r--linden/indra/llmessage/llregionpresenceverifier.h92
-rw-r--r--linden/indra/llmessage/llsdappservices.cpp3
-rw-r--r--linden/indra/llmessage/llsdappservices.h3
-rw-r--r--linden/indra/llmessage/llsdhttpserver.cpp3
-rw-r--r--linden/indra/llmessage/llsdhttpserver.h3
-rwxr-xr-xlinden/indra/llmessage/llsdmessagebuilder.cpp126
-rwxr-xr-xlinden/indra/llmessage/llsdmessagebuilder.h3
-rwxr-xr-xlinden/indra/llmessage/llsdmessagereader.cpp9
-rwxr-xr-xlinden/indra/llmessage/llsdmessagereader.h3
-rw-r--r--linden/indra/llmessage/llsdrpcclient.cpp3
-rw-r--r--linden/indra/llmessage/llsdrpcclient.h3
-rw-r--r--linden/indra/llmessage/llsdrpcserver.cpp3
-rw-r--r--linden/indra/llmessage/llsdrpcserver.h3
-rw-r--r--linden/indra/llmessage/llservice.cpp3
-rw-r--r--linden/indra/llmessage/llservice.h3
-rw-r--r--linden/indra/llmessage/llservicebuilder.cpp25
-rw-r--r--linden/indra/llmessage/llservicebuilder.h3
-rw-r--r--linden/indra/llmessage/llstoredmessage.cpp (renamed from linden/indra/llmessage/network.cpp)17
-rw-r--r--linden/indra/llmessage/llstoredmessage.h58
-rw-r--r--linden/indra/llmessage/lltaskname.h3
-rw-r--r--linden/indra/llmessage/llteleportflags.h3
-rw-r--r--linden/indra/llmessage/lltemplatemessagebuilder.cpp9
-rw-r--r--linden/indra/llmessage/lltemplatemessagebuilder.h8
-rw-r--r--linden/indra/llmessage/lltemplatemessagedispatcher.cpp73
-rw-r--r--linden/indra/llmessage/lltemplatemessagedispatcher.h54
-rw-r--r--linden/indra/llmessage/lltemplatemessagereader.cpp77
-rw-r--r--linden/indra/llmessage/lltemplatemessagereader.h5
-rw-r--r--linden/indra/llmessage/llthrottle.cpp3
-rw-r--r--linden/indra/llmessage/llthrottle.h3
-rw-r--r--linden/indra/llmessage/lltransfermanager.cpp3
-rw-r--r--linden/indra/llmessage/lltransfermanager.h3
-rw-r--r--linden/indra/llmessage/lltransfersourceasset.cpp3
-rw-r--r--linden/indra/llmessage/lltransfersourceasset.h3
-rw-r--r--linden/indra/llmessage/lltransfersourcefile.cpp3
-rw-r--r--linden/indra/llmessage/lltransfersourcefile.h3
-rw-r--r--linden/indra/llmessage/lltransfertargetfile.cpp3
-rw-r--r--linden/indra/llmessage/lltransfertargetfile.h3
-rw-r--r--linden/indra/llmessage/lltransfertargetvfile.cpp3
-rw-r--r--linden/indra/llmessage/lltransfertargetvfile.h3
-rw-r--r--linden/indra/llmessage/lltrustedmessageservice.cpp90
-rw-r--r--linden/indra/llmessage/lltrustedmessageservice.h52
-rw-r--r--linden/indra/llmessage/llurlrequest.cpp62
-rw-r--r--linden/indra/llmessage/llurlrequest.h16
-rw-r--r--linden/indra/llmessage/lluseroperation.cpp3
-rw-r--r--linden/indra/llmessage/lluseroperation.h3
-rw-r--r--linden/indra/llmessage/llvehicleparams.h3
-rw-r--r--linden/indra/llmessage/llxfer.cpp3
-rw-r--r--linden/indra/llmessage/llxfer.h3
-rw-r--r--linden/indra/llmessage/llxfer_file.cpp3
-rw-r--r--linden/indra/llmessage/llxfer_file.h3
-rw-r--r--linden/indra/llmessage/llxfer_mem.cpp3
-rw-r--r--linden/indra/llmessage/llxfer_mem.h3
-rw-r--r--linden/indra/llmessage/llxfer_vfile.cpp3
-rw-r--r--linden/indra/llmessage/llxfer_vfile.h3
-rw-r--r--linden/indra/llmessage/llxfermanager.cpp3
-rw-r--r--linden/indra/llmessage/llxfermanager.h3
-rw-r--r--linden/indra/llmessage/llxorcipher.cpp3
-rw-r--r--linden/indra/llmessage/llxorcipher.h3
-rw-r--r--linden/indra/llmessage/machine.h3
-rw-r--r--linden/indra/llmessage/mean_collision_data.h3
-rw-r--r--linden/indra/llmessage/message.cpp383
-rw-r--r--linden/indra/llmessage/message.h102
-rw-r--r--linden/indra/llmessage/message_prehash.cpp7
-rw-r--r--linden/indra/llmessage/message_prehash.h7
-rw-r--r--linden/indra/llmessage/message_string_table.cpp3
-rw-r--r--linden/indra/llmessage/net.cpp113
-rw-r--r--linden/indra/llmessage/net.h5
-rw-r--r--linden/indra/llmessage/partsyspacket.cpp3
-rw-r--r--linden/indra/llmessage/partsyspacket.h3
-rw-r--r--linden/indra/llmessage/patch_code.cpp3
-rw-r--r--linden/indra/llmessage/patch_code.h3
-rw-r--r--linden/indra/llmessage/patch_dct.cpp3
-rw-r--r--linden/indra/llmessage/patch_dct.h3
-rw-r--r--linden/indra/llmessage/patch_idct.cpp3
-rw-r--r--linden/indra/llmessage/sound_ids.h3
170 files changed, 2139 insertions, 844 deletions
diff --git a/linden/indra/llmessage/CMakeLists.txt b/linden/indra/llmessage/CMakeLists.txt
index fd22de9..0f3e159 100644
--- a/linden/indra/llmessage/CMakeLists.txt
+++ b/linden/indra/llmessage/CMakeLists.txt
@@ -7,6 +7,8 @@ include(LLCommon)
7include(LLMath) 7include(LLMath)
8include(LLMessage) 8include(LLMessage)
9include(LLVFS) 9include(LLVFS)
10include(LLAddBuildTest)
11include(Tut)
10 12
11include_directories (${CMAKE_CURRENT_SOURCE_DIR}) 13include_directories (${CMAKE_CURRENT_SOURCE_DIR})
12 14
@@ -34,6 +36,7 @@ set(llmessage_SOURCE_FILES
34 llhost.cpp 36 llhost.cpp
35 llhttpassetstorage.cpp 37 llhttpassetstorage.cpp
36 llhttpclient.cpp 38 llhttpclient.cpp
39 llhttpclientadapter.cpp
37 llhttpnode.cpp 40 llhttpnode.cpp
38 llhttpsender.cpp 41 llhttpsender.cpp
39 llinstantmessage.cpp 42 llinstantmessage.cpp
@@ -57,6 +60,7 @@ set(llmessage_SOURCE_FILES
57 llpacketring.cpp 60 llpacketring.cpp
58 llpartdata.cpp 61 llpartdata.cpp
59 llpumpio.cpp 62 llpumpio.cpp
63 llregionpresenceverifier.cpp
60 llsdappservices.cpp 64 llsdappservices.cpp
61 llsdhttpserver.cpp 65 llsdhttpserver.cpp
62 llsdmessagebuilder.cpp 66 llsdmessagebuilder.cpp
@@ -65,7 +69,9 @@ set(llmessage_SOURCE_FILES
65 llsdrpcserver.cpp 69 llsdrpcserver.cpp
66 llservicebuilder.cpp 70 llservicebuilder.cpp
67 llservice.cpp 71 llservice.cpp
72 llstoredmessage.cpp
68 lltemplatemessagebuilder.cpp 73 lltemplatemessagebuilder.cpp
74 lltemplatemessagedispatcher.cpp
69 lltemplatemessagereader.cpp 75 lltemplatemessagereader.cpp
70 llthrottle.cpp 76 llthrottle.cpp
71 lltransfermanager.cpp 77 lltransfermanager.cpp
@@ -73,6 +79,7 @@ set(llmessage_SOURCE_FILES
73 lltransfersourcefile.cpp 79 lltransfersourcefile.cpp
74 lltransfertargetfile.cpp 80 lltransfertargetfile.cpp
75 lltransfertargetvfile.cpp 81 lltransfertargetvfile.cpp
82 lltrustedmessageservice.cpp
76 llurlrequest.cpp 83 llurlrequest.cpp
77 lluseroperation.cpp 84 lluseroperation.cpp
78 llxfer.cpp 85 llxfer.cpp
@@ -85,7 +92,6 @@ set(llmessage_SOURCE_FILES
85 message_prehash.cpp 92 message_prehash.cpp
86 message_string_table.cpp 93 message_string_table.cpp
87 net.cpp 94 net.cpp
88 network.cpp
89 partsyspacket.cpp 95 partsyspacket.cpp
90 patch_code.cpp 96 patch_code.cpp
91 patch_dct.cpp 97 patch_dct.cpp
@@ -115,7 +121,10 @@ set(llmessage_HEADER_FILES
115 llhost.h 121 llhost.h
116 llhttpassetstorage.h 122 llhttpassetstorage.h
117 llhttpclient.h 123 llhttpclient.h
124 llhttpclientinterface.h
125 llhttpclientadapter.h
118 llhttpnode.h 126 llhttpnode.h
127 llhttpnodeadapter.h
119 llhttpsender.h 128 llhttpsender.h
120 llinstantmessage.h 129 llinstantmessage.h
121 llinvite.h 130 llinvite.h
@@ -144,6 +153,7 @@ set(llmessage_HEADER_FILES
144 llqueryflags.h 153 llqueryflags.h
145 llregionflags.h 154 llregionflags.h
146 llregionhandle.h 155 llregionhandle.h
156 llregionpresenceverifier.h
147 llsdappservices.h 157 llsdappservices.h
148 llsdhttpserver.h 158 llsdhttpserver.h
149 llsdmessagebuilder.h 159 llsdmessagebuilder.h
@@ -152,9 +162,11 @@ set(llmessage_HEADER_FILES
152 llsdrpcserver.h 162 llsdrpcserver.h
153 llservice.h 163 llservice.h
154 llservicebuilder.h 164 llservicebuilder.h
165 llstoredmessage.h
155 lltaskname.h 166 lltaskname.h
156 llteleportflags.h 167 llteleportflags.h
157 lltemplatemessagebuilder.h 168 lltemplatemessagebuilder.h
169 lltemplatemessagedispatcher.h
158 lltemplatemessagereader.h 170 lltemplatemessagereader.h
159 llthrottle.h 171 llthrottle.h
160 lltransfermanager.h 172 lltransfermanager.h
@@ -162,6 +174,7 @@ set(llmessage_HEADER_FILES
162 lltransfersourcefile.h 174 lltransfersourcefile.h
163 lltransfertargetfile.h 175 lltransfertargetfile.h
164 lltransfertargetvfile.h 176 lltransfertargetvfile.h
177 lltrustedmessageservice.h
165 llurlrequest.h 178 llurlrequest.h
166 lluseroperation.h 179 lluseroperation.h
167 llvehicleparams.h 180 llvehicleparams.h
@@ -176,7 +189,6 @@ set(llmessage_HEADER_FILES
176 message.h 189 message.h
177 message_prehash.h 190 message_prehash.h
178 net.h 191 net.h
179 network.h
180 partsyspacket.h 192 partsyspacket.h
181 patch_code.h 193 patch_code.h
182 patch_dct.h 194 patch_dct.h
@@ -197,3 +209,13 @@ target_link_libraries(
197 ${CRYPTO_LIBRARIES} 209 ${CRYPTO_LIBRARIES}
198 ${XMLRPCEPI_LIBRARIES} 210 ${XMLRPCEPI_LIBRARIES}
199 ) 211 )
212
213IF (NOT LINUX AND VIEWER)
214 # When building the viewer the tests links against the shared objects.
215 # These can not be found when we try to run the tests, so we had to disable them, for the viewer build.
216 # TODO: Can someone with viewer knowledge figure out how to make these find the correct so.
217 #ADD_BUILD_TEST(llhttpclientadapter llmessage)
218 ADD_BUILD_TEST(lltrustedmessageservice llmessage)
219 ADD_BUILD_TEST(lltemplatemessagedispatcher llmessage)
220ENDIF (NOT LINUX AND VIEWER)
221
diff --git a/linden/indra/llmessage/llares.cpp b/linden/indra/llmessage/llares.cpp
index 578304a..fe37fe8 100644
--- a/linden/indra/llmessage/llares.cpp
+++ b/linden/indra/llmessage/llares.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -469,9 +470,7 @@ bool LLAres::process(U64 timeout)
469 470
470 int socks[ARES_GETSOCK_MAXNUM]; 471 int socks[ARES_GETSOCK_MAXNUM];
471 apr_pollfd_t aprFds[ARES_GETSOCK_MAXNUM]; 472 apr_pollfd_t aprFds[ARES_GETSOCK_MAXNUM];
472 apr_int32_t nsds = 0; 473 apr_int32_t nsds = 0;
473 apr_status_t status;
474 apr_pool_t *pool;
475 int nactive = 0; 474 int nactive = 0;
476 int bitmask; 475 int bitmask;
477 476
@@ -479,10 +478,12 @@ bool LLAres::process(U64 timeout)
479 478
480 if (bitmask == 0) 479 if (bitmask == 0)
481 { 480 {
482 goto bail; 481 return nsds > 0;
483 } 482 }
484 483
485 status = apr_pool_create(&pool, gAPRPoolp); 484 apr_status_t status;
485 LLAPRPool pool;
486 status = pool.getStatus() ;
486 ll_apr_assert_status(status); 487 ll_apr_assert_status(status);
487 488
488 for (int i = 0; i < ARES_GETSOCK_MAXNUM; i++) 489 for (int i = 0; i < ARES_GETSOCK_MAXNUM; i++)
@@ -500,16 +501,16 @@ bool LLAres::process(U64 timeout)
500 501
501 apr_socket_t *aprSock = NULL; 502 apr_socket_t *aprSock = NULL;
502 503
503 status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], pool); 504 status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], pool.getAPRPool());
504 if (status != APR_SUCCESS) 505 if (status != APR_SUCCESS)
505 { 506 {
506 ll_apr_warn_status(status); 507 ll_apr_warn_status(status);
507 goto bail_pool; 508 return nsds > 0;
508 } 509 }
509 510
510 aprFds[nactive].desc.s = aprSock; 511 aprFds[nactive].desc.s = aprSock;
511 aprFds[nactive].desc_type = APR_POLL_SOCKET; 512 aprFds[nactive].desc_type = APR_POLL_SOCKET;
512 aprFds[nactive].p = pool; 513 aprFds[nactive].p = pool.getAPRPool();
513 aprFds[nactive].rtnevents = 0; 514 aprFds[nactive].rtnevents = 0;
514 aprFds[nactive].client_data = &socks[i]; 515 aprFds[nactive].client_data = &socks[i];
515 516
@@ -537,10 +538,6 @@ bool LLAres::process(U64 timeout)
537 } 538 }
538 } 539 }
539 540
540bail_pool:
541 apr_pool_destroy(pool);
542
543bail:
544 return nsds > 0; 541 return nsds > 0;
545} 542}
546 543
diff --git a/linden/indra/llmessage/llares.h b/linden/indra/llmessage/llares.h
index 96eed79..96d7f6d 100644
--- a/linden/indra/llmessage/llares.h
+++ b/linden/indra/llmessage/llares.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llassetstorage.cpp b/linden/indra/llmessage/llassetstorage.cpp
index a89a786..2966b60 100644
--- a/linden/indra/llmessage/llassetstorage.cpp
+++ b/linden/indra/llmessage/llassetstorage.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -539,8 +540,19 @@ void LLAssetStorage::downloadCompleteCallback(
539 return; 540 return;
540 } 541 }
541 542
542 req->setUUID(file_id); 543 // Inefficient since we're doing a find through a list that may have thousands of elements.
543 req->setType(file_type); 544 // This is due for refactoring; we will probably change mPendingDownloads into a set.
545 request_list_t::iterator download_iter = std::find(gAssetStorage->mPendingDownloads.begin(),
546 gAssetStorage->mPendingDownloads.end(),
547 req);
548 // If the LLAssetRequest doesn't exist in the downloads queue, then it either has already been deleted
549 // by _cleanupRequests, or it's a transfer.
550 if (download_iter != gAssetStorage->mPendingDownloads.end())
551 {
552 req->setUUID(file_id);
553 req->setType(file_type);
554 }
555
544 if (LL_ERR_NOERR == result) 556 if (LL_ERR_NOERR == result)
545 { 557 {
546 // we might have gotten a zero-size file 558 // we might have gotten a zero-size file
@@ -563,7 +575,7 @@ void LLAssetStorage::downloadCompleteCallback(
563 { 575 {
564 request_list_t::iterator curiter = iter++; 576 request_list_t::iterator curiter = iter++;
565 LLAssetRequest* tmp = *curiter; 577 LLAssetRequest* tmp = *curiter;
566 if ((tmp->getUUID() == req->getUUID()) && (tmp->getType()== req->getType())) 578 if ((tmp->getUUID() == file_id) && (tmp->getType()== file_type))
567 { 579 {
568 requests.push_front(tmp); 580 requests.push_front(tmp);
569 iter = gAssetStorage->mPendingDownloads.erase(curiter); 581 iter = gAssetStorage->mPendingDownloads.erase(curiter);
@@ -1198,6 +1210,9 @@ const char* LLAssetStorage::getErrorString(S32 status)
1198 case LL_ERR_CIRCUIT_GONE: 1210 case LL_ERR_CIRCUIT_GONE:
1199 return "Circuit gone"; 1211 return "Circuit gone";
1200 1212
1213 case LL_ERR_PRICE_MISMATCH:
1214 return "Viewer and server do not agree on price";
1215
1201 default: 1216 default:
1202 return "Unknown status"; 1217 return "Unknown status";
1203 } 1218 }
diff --git a/linden/indra/llmessage/llassetstorage.h b/linden/indra/llmessage/llassetstorage.h
index eefa9a1..f01ee6a 100644
--- a/linden/indra/llmessage/llassetstorage.h
+++ b/linden/indra/llmessage/llassetstorage.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llblowfishcipher.cpp b/linden/indra/llmessage/llblowfishcipher.cpp
index 908fb49..f24d103 100644
--- a/linden/indra/llmessage/llblowfishcipher.cpp
+++ b/linden/indra/llmessage/llblowfishcipher.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llblowfishcipher.h b/linden/indra/llmessage/llblowfishcipher.h
index 2d51a49..f8b5e1f 100644
--- a/linden/indra/llmessage/llblowfishcipher.h
+++ b/linden/indra/llmessage/llblowfishcipher.h
@@ -20,7 +20,8 @@
20 * There are special exceptions to the terms and conditions of the GPL as 20 * There are special exceptions to the terms and conditions of the GPL as
21 * it is applied to this Source Code. View the full text of the exception 21 * it is applied to this Source Code. View the full text of the exception
22 * in the file doc/FLOSS-exception.txt in this software distribution, or 22 * in the file doc/FLOSS-exception.txt in this software distribution, or
23 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 23 * online at
24 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
24 * 25 *
25 * By copying, modifying or distributing this software, you acknowledge 26 * By copying, modifying or distributing this software, you acknowledge
26 * that you have read and understood your obligations described above, 27 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llbuffer.cpp b/linden/indra/llmessage/llbuffer.cpp
index 4499b97..1ffcecd 100644
--- a/linden/indra/llmessage/llbuffer.cpp
+++ b/linden/indra/llmessage/llbuffer.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llbuffer.h b/linden/indra/llmessage/llbuffer.h
index 1c200b0..b031ee8 100644
--- a/linden/indra/llmessage/llbuffer.h
+++ b/linden/indra/llmessage/llbuffer.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llbufferstream.cpp b/linden/indra/llmessage/llbufferstream.cpp
index ea8d0bb..bdb0d68 100644
--- a/linden/indra/llmessage/llbufferstream.cpp
+++ b/linden/indra/llmessage/llbufferstream.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llbufferstream.h b/linden/indra/llmessage/llbufferstream.h
index fe9b2dc..de68884 100644
--- a/linden/indra/llmessage/llbufferstream.h
+++ b/linden/indra/llmessage/llbufferstream.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llcachename.cpp b/linden/indra/llmessage/llcachename.cpp
index 3acd881..1e6584a 100644
--- a/linden/indra/llmessage/llcachename.cpp
+++ b/linden/indra/llmessage/llcachename.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -41,8 +42,7 @@
41#include "llsdserialize.h" 42#include "llsdserialize.h"
42#include "lluuid.h" 43#include "lluuid.h"
43#include "message.h" 44#include "message.h"
44#include "llservicebuilder.h" 45
45#include "llframetimer.h"
46// Constants 46// Constants
47static const std::string CN_WAITING("(Loading...)"); // *TODO: translate 47static const std::string CN_WAITING("(Loading...)"); // *TODO: translate
48static const std::string CN_NOBODY("(nobody)"); // *TODO: translate 48static const std::string CN_NOBODY("(nobody)"); // *TODO: translate
@@ -197,8 +197,6 @@ class LLCacheName::Impl
197public: 197public:
198 LLMessageSystem* mMsg; 198 LLMessageSystem* mMsg;
199 LLHost mUpstreamHost; 199 LLHost mUpstreamHost;
200 std::string mGroupNameURL;
201 std::string mAgentNameURL;
202 200
203 Cache mCache; 201 Cache mCache;
204 // the map of UUIDs to names 202 // the map of UUIDs to names
@@ -224,8 +222,6 @@ public:
224 void processPendingReplies(); 222 void processPendingReplies();
225 void sendRequest(const char* msg_name, const AskQueue& queue); 223 void sendRequest(const char* msg_name, const AskQueue& queue);
226 bool isRequestPending(const LLUUID& id); 224 bool isRequestPending(const LLUUID& id);
227 void getAgentName(const AskQueue&);
228 void getGroupName(const AskQueue&);
229 225
230 // Message system callbacks. 226 // Message system callbacks.
231 void processUUIDRequest(LLMessageSystem* msg, bool isGroup); 227 void processUUIDRequest(LLMessageSystem* msg, bool isGroup);
@@ -239,35 +235,6 @@ public:
239 void notifyObservers(const LLUUID& id, const std::string& first, const std::string& last, BOOL group); 235 void notifyObservers(const LLUUID& id, const std::string& first, const std::string& last, BOOL group);
240}; 236};
241 237
242class LLHTTPAgentNamesResponse : public LLHTTPClient::Responder
243{
244public:
245 LLHTTPAgentNamesResponse(const LLSD& agent_ids)
246 : mAgentIDs(agent_ids)
247 { }
248 void result(const LLSD& content);
249private:
250 LLHost mSender;
251 LLSD mAgentIDs;
252
253};
254
255class LLHTTPGroupNamesResponse : public LLHTTPClient::Responder
256{
257public:
258 LLHTTPGroupNamesResponse(const LLSD& group_ids)
259 : mGroupIDs(group_ids)
260 { };
261
262 void result(const LLSD& content);
263private:
264 LLHost mSender;
265 LLSD mGroupIDs;
266
267};
268
269
270
271 238
272/// -------------------------------------------------------------------------- 239/// --------------------------------------------------------------------------
273/// class LLCacheName 240/// class LLCacheName
@@ -353,57 +320,6 @@ void LLCacheName::cancelCallback(const LLUUID& id, LLCacheNameCallback callback,
353 } 320 }
354} 321}
355 322
356void LLCacheName::sendAgentNames(const LLUUID& id, std::string& first, std::string& last)
357{
358
359 LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id);
360 if (!entry)
361 {
362 entry = new LLCacheNameEntry;
363 impl.mCache[id] = entry;
364
365 }
366 entry->mIsGroup = false;
367 entry->mCreateTime = (U32)LLFrameTimer::getTotalSeconds();
368 //entry->mFirstName = first;
369 //entry->mLastName = last;
370 //LLStringUtil::truncate(entry->mFirstName, DB_FIRST_NAME_BUF_SIZE);
371 //LLStringUtil::truncate(entry->mLastName, DB_LAST_NAME_BUF_SIZE);
372 entry->mFirstName = std::string(first, DB_FIRST_NAME_BUF_SIZE);
373 entry->mLastName = std::string(last, DB_LAST_NAME_BUF_SIZE);
374
375 impl.mPendingQueue.erase(id);
376 impl.notifyObservers(id,
377 entry->mFirstName, entry->mLastName,
378 FALSE);
379
380}
381
382void LLCacheName::sendGroupNames(const LLUUID& id, std::string& name)
383{
384
385 LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id);
386 if (!entry)
387 {
388 entry = new LLCacheNameEntry;
389 impl.mCache[id] = entry;
390
391 }
392
393 entry->mIsGroup = true;
394 entry->mCreateTime = (U32)time(NULL);
395
396 entry->mGroupName = std::string(name, DB_GROUP_NAME_BUF_SIZE);
397
398 impl.mPendingQueue.erase(id);
399
400 impl.notifyObservers(id,
401 entry->mFirstName, entry->mLastName,
402 FALSE);
403
404
405}
406
407void LLCacheName::importFile(LLFILE* fp) 323void LLCacheName::importFile(LLFILE* fp)
408{ 324{
409 S32 count = 0; 325 S32 count = 0;
@@ -609,16 +525,6 @@ BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname)
609 return res; 525 return res;
610} 526}
611 527
612void LLCacheName::setGroupURL(const std::string& group_url)
613{
614 impl.mGroupNameURL = group_url;
615}
616
617void LLCacheName::setAgentURL(const std::string& agent_url)
618{
619 impl.mAgentNameURL = agent_url;
620}
621
622BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) 528BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group)
623{ 529{
624 if(id.isNull()) 530 if(id.isNull())
@@ -653,111 +559,6 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group)
653 } 559 }
654} 560}
655 561
656void LLCacheName::Impl::getAgentName(const AskQueue &queue)
657{
658
659 // get the names from backbone module
660 if(queue.empty())
661 {
662 return;
663 }
664
665 LLSD request;
666 request["action"] = "GET";
667 LLSD id_block = LLSD::emptyArray();
668 AskQueue::const_iterator it = queue.begin();
669 AskQueue::const_iterator end = queue.end();
670 for(;it!=end;++it)
671 {
672 id_block.append(*it);
673 }
674 lldebugs<<LLSDOStreamer<LLSDNotationFormatter>(id_block) <<llendl;
675
676 request["agents"] = id_block;
677
678 LLHTTPClient::post(
679 mAgentNameURL,
680 request,
681 new LLHTTPAgentNamesResponse(id_block));
682
683
684 lldebugs<<"Service builder call to agent-name "<<mAgentNameURL<<llendl;
685
686}
687
688void LLHTTPAgentNamesResponse::result(const LLSD& content)
689{
690 LLUUID id;
691 lldebugs<<LLSDOStreamer<LLSDNotationFormatter>(content) <<llendl;
692
693 LLSD::map_const_iterator iter = content.beginMap();
694 for ( ; iter != content.endMap(); ++iter)
695 {
696 id.set((*iter).first);
697 LLSD name = (*iter).second;
698 LLCacheNameEntry* entry = new LLCacheNameEntry;
699 entry->mIsGroup = FALSE;
700 entry->mCreateTime = (U32)LLFrameTimer::getTotalSeconds();
701 std::string first = name["first"];
702 std::string last = name["last"];
703 entry->mFirstName = std::string(first, DB_FIRST_NAME_BUF_SIZE);
704 entry->mLastName = std::string(last, DB_LAST_NAME_BUF_SIZE);
705
706 gCacheName->sendAgentNames(id,first,last);
707 }
708}
709
710
711void LLCacheName::Impl::getGroupName(const AskQueue &queue)
712{
713 // get the group names from backbone module
714 if(queue.empty())
715 {
716 return;
717 }
718
719 LLSD request;
720 request["action"] = "GET";
721 LLSD id_block = LLSD::emptyArray();
722 AskQueue::const_iterator it = queue.begin();
723 AskQueue::const_iterator end = queue.end();
724 for(;it!=end;++it)
725 {
726 id_block.append(*it);
727 }
728
729 request["groups"] = id_block;
730
731 if(!mGroupNameURL.empty())
732 {
733 LLHTTPClient::post(
734 mGroupNameURL,
735 request,
736 new LLHTTPGroupNamesResponse(id_block));
737 }
738 lldebugs<<"Service builder call to group-name "<< mGroupNameURL<<llendl;
739}
740
741void LLHTTPGroupNamesResponse::result(const LLSD& content)
742{
743 lldebugs<<"Result"<<LLSDOStreamer<LLSDNotationFormatter>(content) << llendl;
744 LLUUID id;
745
746 LLSD::map_const_iterator iter = content.beginMap();
747 for ( ; iter != content.endMap(); ++iter)
748 {
749
750 id.set((*iter).first);
751 std::string name = (*iter).second.asString();
752 LLCacheNameEntry* entry = new LLCacheNameEntry;
753 entry->mIsGroup = TRUE;
754 entry->mCreateTime = (U32)time(NULL);
755 entry->mGroupName = std::string(name, DB_GROUP_NAME_BUF_SIZE);
756 lldebugs<<"Group Name"<<name<<llendl;
757 gCacheName->sendGroupNames(id,name);
758 }
759}
760
761// TODO: Make the cache name callback take a SINGLE std::string, 562// TODO: Make the cache name callback take a SINGLE std::string,
762// not a separate first and last name. 563// not a separate first and last name.
763void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callback, void* user_data) 564void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callback, void* user_data)
@@ -765,6 +566,7 @@ void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callb
765 if(id.isNull()) 566 if(id.isNull())
766 { 567 {
767 callback(id, CN_NOBODY, "", is_group, user_data); 568 callback(id, CN_NOBODY, "", is_group, user_data);
569 return;
768 } 570 }
769 571
770 LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id ); 572 LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id );
@@ -806,14 +608,12 @@ void LLCacheName::processPending()
806 return; 608 return;
807 } 609 }
808 610
809 /*
810 if(!impl.mUpstreamHost.isOk()) 611 if(!impl.mUpstreamHost.isOk())
811 { 612 {
812 lldebugs << "LLCacheName::processPending() - bad upstream host." 613 lldebugs << "LLCacheName::processPending() - bad upstream host."
813 << llendl; 614 << llendl;
814 return; 615 return;
815 } 616 }
816 */
817 617
818 impl.processPendingAsks(); 618 impl.processPendingAsks();
819 impl.processPendingReplies(); 619 impl.processPendingReplies();
@@ -895,16 +695,8 @@ std::string LLCacheName::getDefaultName()
895 695
896void LLCacheName::Impl::processPendingAsks() 696void LLCacheName::Impl::processPendingAsks()
897{ 697{
898 if (mUpstreamHost.isOk()) //its the vuewer asking for names send request to simulator 698 sendRequest(_PREHASH_UUIDNameRequest, mAskNameQueue);
899 { 699 sendRequest(_PREHASH_UUIDGroupNameRequest, mAskGroupQueue);
900 sendRequest(_PREHASH_UUIDNameRequest, mAskNameQueue);
901 sendRequest(_PREHASH_UUIDGroupNameRequest, mAskGroupQueue);
902 }
903 else //its simulator asking for names ask the backbone
904 {
905 getAgentName(mAskNameQueue);
906 getGroupName(mAskGroupQueue);
907 }
908 mAskNameQueue.clear(); 700 mAskNameQueue.clear();
909 mAskGroupQueue.clear(); 701 mAskGroupQueue.clear();
910} 702}
@@ -1025,15 +817,12 @@ void LLCacheName::Impl::processUUIDRequest(LLMessageSystem* msg, bool isGroup)
1025{ 817{
1026 // You should only get this message if the cache is at the simulator 818 // You should only get this message if the cache is at the simulator
1027 // level, hence having an upstream provider. 819 // level, hence having an upstream provider.
1028 // 03/31/2008 Simulator is talking to backbone and not dataserver
1029 // This check was for dataserver
1030 /*
1031 if (!mUpstreamHost.isOk()) 820 if (!mUpstreamHost.isOk())
1032 { 821 {
1033 llwarns << "LLCacheName - got UUID name/group request, but no upstream provider!" << llendl; 822 llwarns << "LLCacheName - got UUID name/group request, but no upstream provider!" << llendl;
1034 return; 823 return;
1035 } 824 }
1036 */ 825
1037 LLHost fromHost = msg->getSender(); 826 LLHost fromHost = msg->getSender();
1038 ReplySender sender(msg); 827 ReplySender sender(msg);
1039 828
@@ -1104,8 +893,9 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup)
1104 msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, entry->mLastName, i); 893 msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, entry->mLastName, i);
1105 } 894 }
1106 else 895 else
1107 { 896 { // is group
1108 msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_GroupName, entry->mGroupName, i); 897 msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_GroupName, entry->mGroupName, i);
898 LLStringFn::replace_ascii_controlchars(entry->mGroupName, LL_UNKNOWN_CHAR);
1109 } 899 }
1110 900
1111 if (!isGroup) 901 if (!isGroup)
diff --git a/linden/indra/llmessage/llcachename.h b/linden/indra/llmessage/llcachename.h
index 8626dd5..2757b86 100644
--- a/linden/indra/llmessage/llcachename.h
+++ b/linden/indra/llmessage/llcachename.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -31,9 +32,7 @@
31 32
32#ifndef LL_LLCACHENAME_H 33#ifndef LL_LLCACHENAME_H
33#define LL_LLCACHENAME_H 34#define LL_LLCACHENAME_H
34#include "llhttpclient.h" 35
35#include "llhost.h"
36#include "lluri.h"
37class LLMessageSystem; 36class LLMessageSystem;
38class LLHost; 37class LLHost;
39class LLUUID; 38class LLUUID;
@@ -99,15 +98,10 @@ public:
99 // This method needs to be called from time to time to send out 98 // This method needs to be called from time to time to send out
100 // requests. 99 // requests.
101 void processPending(); 100 void processPending();
102 void setAgentURL(const std::string& url); 101
103 void setGroupURL(const std::string& url);
104
105 // Expire entries created more than "secs" seconds ago. 102 // Expire entries created more than "secs" seconds ago.
106 void deleteEntriesOlderThan(S32 secs); 103 void deleteEntriesOlderThan(S32 secs);
107 104
108 //send the information retrived from backbone
109 void sendAgentNames(const LLUUID& id, std::string& first, std::string& last);
110 void sendGroupNames(const LLUUID& id, std::string& name);
111 // Debugging 105 // Debugging
112 void dump(); // Dumps the contents of the cache 106 void dump(); // Dumps the contents of the cache
113 void dumpStats(); // Dumps the sizes of the cache and associated queues. 107 void dumpStats(); // Dumps the sizes of the cache and associated queues.
@@ -118,9 +112,10 @@ private:
118 112
119 class Impl; 113 class Impl;
120 Impl& impl; 114 Impl& impl;
121
122}; 115};
123 116
117
118
124extern LLCacheName* gCacheName; 119extern LLCacheName* gCacheName;
125 120
126#endif 121#endif
diff --git a/linden/indra/llmessage/llchainio.cpp b/linden/indra/llmessage/llchainio.cpp
index dd76c46..9e61356 100644
--- a/linden/indra/llmessage/llchainio.cpp
+++ b/linden/indra/llmessage/llchainio.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llchainio.h b/linden/indra/llmessage/llchainio.h
index ab0410b..22140be 100644
--- a/linden/indra/llmessage/llchainio.h
+++ b/linden/indra/llmessage/llchainio.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llcipher.h b/linden/indra/llmessage/llcipher.h
index f8fadb3..b68a1ac 100644
--- a/linden/indra/llmessage/llcipher.h
+++ b/linden/indra/llmessage/llcipher.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llcircuit.cpp b/linden/indra/llmessage/llcircuit.cpp
index c58628b..725425c 100644
--- a/linden/indra/llmessage/llcircuit.cpp
+++ b/linden/indra/llmessage/llcircuit.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -62,7 +63,6 @@
62#include "lltransfermanager.h" 63#include "lltransfermanager.h"
63#include "llmodularmath.h" 64#include "llmodularmath.h"
64 65
65const F32 PING_INTERVAL = 5.f; // seconds
66const 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.
67const S32 PING_RELEASE_BLOCK = 2; // How many pings behind we have to be to consider ourself unblocked. 67const S32 PING_RELEASE_BLOCK = 2; // How many pings behind we have to be to consider ourself unblocked.
68 68
@@ -70,7 +70,8 @@ const F32 TARGET_PERIOD_LENGTH = 5.f; // seconds
70const F32 LL_DUPLICATE_SUPPRESSION_TIMEOUT = 60.f; //seconds - this can be long, as time-based cleanup is 70const F32 LL_DUPLICATE_SUPPRESSION_TIMEOUT = 60.f; //seconds - this can be long, as time-based cleanup is
71 // only done when wrapping packetids, now... 71 // only done when wrapping packetids, now...
72 72
73LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id) 73LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id,
74 const F32 circuit_heartbeat_interval, const F32 circuit_timeout)
74: mHost (host), 75: mHost (host),
75 mWrapID(0), 76 mWrapID(0),
76 mPacketsOutID(0), 77 mPacketsOutID(0),
@@ -105,7 +106,9 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id)
105 mPeakBPSOut(0), 106 mPeakBPSOut(0),
106 mPeriodTime(0.0), 107 mPeriodTime(0.0),
107 mExistenceTimer(), 108 mExistenceTimer(),
108 mCurrentResendCount(0) 109 mCurrentResendCount(0),
110 mHeartbeatInterval(circuit_heartbeat_interval),
111 mHeartbeatTimeout(circuit_timeout)
109{ 112{
110 // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been 113 // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been
111 // running a message system loop. 114 // running a message system loop.
@@ -113,9 +116,9 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id)
113 F32 distribution_offset = ll_frand(); 116 F32 distribution_offset = ll_frand();
114 117
115 mPingTime = mt_sec; 118 mPingTime = mt_sec;
116 mLastPingSendTime = mt_sec + PING_INTERVAL * distribution_offset; 119 mLastPingSendTime = mt_sec + mHeartbeatInterval * distribution_offset;
117 mLastPingReceivedTime = mt_sec; 120 mLastPingReceivedTime = mt_sec;
118 mNextPingSendTime = mLastPingSendTime + 0.95*PING_INTERVAL + ll_frand(0.1f*PING_INTERVAL); 121 mNextPingSendTime = mLastPingSendTime + 0.95*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval);
119 mPeriodTime = mt_sec; 122 mPeriodTime = mt_sec;
120 123
121 mTimeoutCallback = NULL; 124 mTimeoutCallback = NULL;
@@ -429,7 +432,8 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now)
429} 432}
430 433
431 434
432LLCircuit::LLCircuit() : mLastCircuit(NULL) 435LLCircuit::LLCircuit(const F32 circuit_heartbeat_interval, const F32 circuit_timeout) : mLastCircuit(NULL),
436 mHeartbeatInterval(circuit_heartbeat_interval), mHeartbeatTimeout(circuit_timeout)
433{ 437{
434} 438}
435 439
@@ -447,7 +451,7 @@ LLCircuitData *LLCircuit::addCircuitData(const LLHost &host, TPACKETID in_id)
447{ 451{
448 // This should really validate if one already exists 452 // This should really validate if one already exists
449 llinfos << "LLCircuit::addCircuitData for " << host << llendl; 453 llinfos << "LLCircuit::addCircuitData for " << host << llendl;
450 LLCircuitData *tempp = new LLCircuitData(host, in_id); 454 LLCircuitData *tempp = new LLCircuitData(host, in_id, mHeartbeatInterval, mHeartbeatTimeout);
451 mCircuitData.insert(circuit_data_map::value_type(host, tempp)); 455 mCircuitData.insert(circuit_data_map::value_type(host, tempp));
452 mPingSet.insert(tempp); 456 mPingSet.insert(tempp);
453 457
@@ -801,7 +805,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys)
801 // Always remember to remove it from the set before changing the sorting 805 // Always remember to remove it from the set before changing the sorting
802 // key (mNextPingSendTime) 806 // key (mNextPingSendTime)
803 mPingSet.erase(psit); 807 mPingSet.erase(psit);
804 cdp->mNextPingSendTime = cur_time + PING_INTERVAL; 808 cdp->mNextPingSendTime = cur_time + mHeartbeatInterval;
805 mPingSet.insert(cdp); 809 mPingSet.insert(cdp);
806 continue; 810 continue;
807 } 811 }
@@ -819,7 +823,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys)
819 if (cdp->updateWatchDogTimers(msgsys)) 823 if (cdp->updateWatchDogTimers(msgsys))
820 { 824 {
821 // Randomize our pings a bit by doing some up to 5% early or late 825 // Randomize our pings a bit by doing some up to 5% early or late
822 F64 dt = 0.95f*PING_INTERVAL + ll_frand(0.1f*PING_INTERVAL); 826 F64 dt = 0.95f*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval);
823 827
824 // Remove it, and reinsert it with the new next ping time. 828 // Remove it, and reinsert it with the new next ping time.
825 // Always remove before changing the sorting key. 829 // Always remove before changing the sorting key.
@@ -1047,7 +1051,7 @@ BOOL LLCircuitData::checkCircuitTimeout()
1047 F64 time_since_last_ping = LLMessageSystem::getMessageTimeSeconds() - mLastPingReceivedTime; 1051 F64 time_since_last_ping = LLMessageSystem::getMessageTimeSeconds() - mLastPingReceivedTime;
1048 1052
1049 // Nota Bene: This needs to be turned off if you are debugging multiple simulators 1053 // Nota Bene: This needs to be turned off if you are debugging multiple simulators
1050 if (time_since_last_ping > PING_INTERVAL_MAX) 1054 if (time_since_last_ping > mHeartbeatTimeout)
1051 { 1055 {
1052 llwarns << "LLCircuitData::checkCircuitTimeout for " << mHost << " last ping " << time_since_last_ping << " seconds ago." <<llendl; 1056 llwarns << "LLCircuitData::checkCircuitTimeout for " << mHost << " last ping " << time_since_last_ping << " seconds ago." <<llendl;
1053 setAlive(FALSE); 1057 setAlive(FALSE);
@@ -1063,10 +1067,7 @@ BOOL LLCircuitData::checkCircuitTimeout()
1063 return FALSE; 1067 return FALSE;
1064 } 1068 }
1065 } 1069 }
1066 else if (time_since_last_ping > PING_INTERVAL_ALARM) 1070
1067 {
1068 //llwarns << "Unresponsive circuit: " << mHost << ": " << time_since_last_ping << " seconds since last ping."<< llendl;
1069 }
1070 return TRUE; 1071 return TRUE;
1071} 1072}
1072 1073
@@ -1280,7 +1281,7 @@ void LLCircuitData::pingTimerStop(const U8 ping_id)
1280 delta_ping += 256; 1281 delta_ping += 256;
1281 } 1282 }
1282 1283
1283 U32 msec = (U32) ((delta_ping*PING_INTERVAL + time) * 1000.f); 1284 U32 msec = (U32) ((delta_ping*mHeartbeatInterval + time) * 1000.f);
1284 setPingDelay(msec); 1285 setPingDelay(msec);
1285 1286
1286 mPingsInTransit = delta_ping; 1287 mPingsInTransit = delta_ping;
@@ -1371,7 +1372,8 @@ F32 LLCircuitData::getPingInTransitTime()
1371 1372
1372 if (mPingsInTransit) 1373 if (mPingsInTransit)
1373 { 1374 {
1374 time_since_ping_was_sent = (F32)((mPingsInTransit*PING_INTERVAL - 1) + (LLMessageSystem::getMessageTimeSeconds() - mPingTime))*1000.f; 1375 time_since_ping_was_sent = (F32)((mPingsInTransit*mHeartbeatInterval - 1)
1376 + (LLMessageSystem::getMessageTimeSeconds() - mPingTime))*1000.f;
1375 } 1377 }
1376 1378
1377 return time_since_ping_was_sent; 1379 return time_since_ping_was_sent;
diff --git a/linden/indra/llmessage/llcircuit.h b/linden/indra/llmessage/llcircuit.h
index 6df7279..e373cb1 100644
--- a/linden/indra/llmessage/llcircuit.h
+++ b/linden/indra/llmessage/llcircuit.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -50,10 +51,6 @@
50// 51//
51// Constants 52// Constants
52// 53//
53const F32 PING_INTERVAL_MAX = 100.f;
54const F32 PING_INTERVAL_ALARM = 50.f;
55
56
57const F32 LL_AVERAGED_PING_ALPHA = 0.2f; // relaxation constant on ping running average 54const F32 LL_AVERAGED_PING_ALPHA = 0.2f; // relaxation constant on ping running average
58const F32 LL_AVERAGED_PING_MAX = 2000; // msec 55const F32 LL_AVERAGED_PING_MAX = 2000; // msec
59const F32 LL_AVERAGED_PING_MIN = 100; // msec // IW: increased to avoid retransmits when a process is slow 56const F32 LL_AVERAGED_PING_MIN = 100; // msec // IW: increased to avoid retransmits when a process is slow
@@ -85,7 +82,8 @@ class LLSD;
85class LLCircuitData 82class LLCircuitData
86{ 83{
87public: 84public:
88 LLCircuitData(const LLHost &host, TPACKETID in_id); 85 LLCircuitData(const LLHost &host, TPACKETID in_id,
86 const F32 circuit_heartbeat_interval, const F32 circuit_timeout);
89 ~LLCircuitData(); 87 ~LLCircuitData();
90 88
91 S32 resendUnackedPackets(const F64 now); 89 S32 resendUnackedPackets(const F64 now);
@@ -283,6 +281,9 @@ protected:
283 S32 mCurrentResendCount; // Number of resent packets since last spam 281 S32 mCurrentResendCount; // Number of resent packets since last spam
284 LLStatRate mOutOfOrderRate; // Rate of out of order packets coming in. 282 LLStatRate mOutOfOrderRate; // Rate of out of order packets coming in.
285 U32 mLastPacketGap; // Gap in sequence number of last packet. 283 U32 mLastPacketGap; // Gap in sequence number of last packet.
284
285 const F32 mHeartbeatInterval;
286 const F32 mHeartbeatTimeout;
286}; 287};
287 288
288 289
@@ -292,7 +293,7 @@ class LLCircuit
292{ 293{
293public: 294public:
294 // CREATORS 295 // CREATORS
295 LLCircuit(); 296 LLCircuit(const F32 circuit_heartbeat_interval, const F32 circuit_timeout);
296 ~LLCircuit(); 297 ~LLCircuit();
297 298
298 // ACCESSORS 299 // ACCESSORS
@@ -345,5 +346,9 @@ protected:
345 // optimize the many, many times we call findCircuit. This may be 346 // optimize the many, many times we call findCircuit. This may be
346 // set in otherwise const methods, so it is declared mutable. 347 // set in otherwise const methods, so it is declared mutable.
347 mutable LLCircuitData* mLastCircuit; 348 mutable LLCircuitData* mLastCircuit;
349
350private:
351 const F32 mHeartbeatInterval;
352 const F32 mHeartbeatTimeout;
348}; 353};
349#endif 354#endif
diff --git a/linden/indra/llmessage/llclassifiedflags.cpp b/linden/indra/llmessage/llclassifiedflags.cpp
index c0579b8..da608e4 100644
--- a/linden/indra/llmessage/llclassifiedflags.cpp
+++ b/linden/indra/llmessage/llclassifiedflags.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -40,18 +41,35 @@
40#include "linden_common.h" 41#include "linden_common.h"
41 42
42#include "llclassifiedflags.h" 43#include "llclassifiedflags.h"
43 44
44ClassifiedFlags pack_classified_flags(BOOL is_mature, BOOL auto_renew) 45ClassifiedFlags pack_classified_flags_request(BOOL auto_renew, BOOL inc_pg, BOOL inc_mature, BOOL inc_adult)
46{
47 U8 rv = 0;
48 if(inc_pg) rv |= CLASSIFIED_QUERY_INC_PG;
49 if(inc_mature) rv |= CLASSIFIED_QUERY_INC_MATURE;
50 if (inc_pg && !inc_mature) rv |= CLASSIFIED_FLAG_MATURE;
51 if(inc_adult) rv |= CLASSIFIED_QUERY_INC_ADULT;
52 if(auto_renew) rv |= CLASSIFIED_FLAG_AUTO_RENEW;
53 return rv;
54}
55
56ClassifiedFlags pack_classified_flags(BOOL auto_renew, BOOL inc_pg, BOOL inc_mature, BOOL inc_adult)
45{ 57{
46 U8 rv = 0; 58 U8 rv = 0;
47 if(is_mature) rv |= CLASSIFIED_FLAG_MATURE; 59 if(inc_pg) rv |= CLASSIFIED_QUERY_INC_PG;
60 if(inc_mature)
61 {
62 rv |= CLASSIFIED_QUERY_INC_MATURE;
63 rv |= CLASSIFIED_FLAG_MATURE;
64 }
65 if(inc_adult) rv |= CLASSIFIED_QUERY_INC_ADULT;
48 if(auto_renew) rv |= CLASSIFIED_FLAG_AUTO_RENEW; 66 if(auto_renew) rv |= CLASSIFIED_FLAG_AUTO_RENEW;
49 return rv; 67 return rv;
50} 68}
51 69
52bool is_cf_mature(ClassifiedFlags flags) 70bool is_cf_mature(ClassifiedFlags flags)
53{ 71{
54 return ((flags & CLASSIFIED_FLAG_MATURE) != 0); 72 return ((flags & CLASSIFIED_FLAG_MATURE) != 0) || ((flags & CLASSIFIED_QUERY_INC_MATURE) != 0);
55} 73}
56 74
57// Deprecated, but leaving commented out because someday we might 75// Deprecated, but leaving commented out because someday we might
diff --git a/linden/indra/llmessage/llclassifiedflags.h b/linden/indra/llmessage/llclassifiedflags.h
index 6c15042..9d3e49b 100644
--- a/linden/indra/llmessage/llclassifiedflags.h
+++ b/linden/indra/llmessage/llclassifiedflags.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -42,12 +43,23 @@ const U8 CLASSIFIED_FLAG_UPDATE_TIME= 1 << 4;
42const U8 CLASSIFIED_FLAG_AUTO_RENEW = 1 << 5; 43const U8 CLASSIFIED_FLAG_AUTO_RENEW = 1 << 5;
43 44
44const U8 CLASSIFIED_QUERY_FILTER_MATURE = 1 << 1; 45const U8 CLASSIFIED_QUERY_FILTER_MATURE = 1 << 1;
45const U8 CLASSIFIED_QUERY_FILTER_ENABLED = 1 << 2; 46//const U8 CLASSIFIED_QUERY_FILTER_ENABLED = 1 << 2;
46const U8 CLASSIFIED_QUERY_FILTER_PRICE = 1 << 3; 47//const U8 CLASSIFIED_QUERY_FILTER_PRICE = 1 << 3;
48
49// These are new with Adult-enabled viewers (1.23 and later)
50const U8 CLASSIFIED_QUERY_INC_PG = 1 << 2;
51const U8 CLASSIFIED_QUERY_INC_MATURE = 1 << 3;
52const U8 CLASSIFIED_QUERY_INC_ADULT = 1 << 6;
53const U8 CLASSIFIED_QUERY_INC_NEW_VIEWER = (CLASSIFIED_QUERY_INC_PG | CLASSIFIED_QUERY_INC_MATURE | CLASSIFIED_QUERY_INC_ADULT);
47 54
48const S32 MAX_CLASSIFIEDS = 100; 55const S32 MAX_CLASSIFIEDS = 100;
49 56
50ClassifiedFlags pack_classified_flags(BOOL is_mature, BOOL auto_renew); 57// This function is used in AO viewers to pack old query flags into the request
58// so that they can talk to old dataservers properly. When the AO servers are deployed on agni
59// we can revert back to ClassifiedFlags pack_classified_flags and get rider of this one.
60ClassifiedFlags pack_classified_flags_request(BOOL auto_renew, BOOL is_pg, BOOL is_mature, BOOL is_adult);
61
62ClassifiedFlags pack_classified_flags(BOOL auto_renew, BOOL is_pg, BOOL is_mature, BOOL is_adult);
51bool is_cf_mature(ClassifiedFlags flags); 63bool is_cf_mature(ClassifiedFlags flags);
52//bool is_cf_enabled(ClassifiedFlags flags); 64//bool is_cf_enabled(ClassifiedFlags flags);
53bool is_cf_update_time(ClassifiedFlags flags); 65bool is_cf_update_time(ClassifiedFlags flags);
diff --git a/linden/indra/llmessage/llcurl.cpp b/linden/indra/llmessage/llcurl.cpp
index 266bfac..a4eb90d 100644
--- a/linden/indra/llmessage/llcurl.cpp
+++ b/linden/indra/llmessage/llcurl.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llcurl.h b/linden/indra/llmessage/llcurl.h
index ca231a2..ff63904 100644
--- a/linden/indra/llmessage/llcurl.h
+++ b/linden/indra/llmessage/llcurl.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lldatapacker.cpp b/linden/indra/llmessage/lldatapacker.cpp
index 33aa699..1cdb475 100644
--- a/linden/indra/llmessage/lldatapacker.cpp
+++ b/linden/indra/llmessage/lldatapacker.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lldatapacker.h b/linden/indra/llmessage/lldatapacker.h
index 344b313..92bfec6 100644
--- a/linden/indra/llmessage/lldatapacker.h
+++ b/linden/indra/llmessage/lldatapacker.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lldbstrings.h b/linden/indra/llmessage/lldbstrings.h
index d551d49..cdee400 100644
--- a/linden/indra/llmessage/lldbstrings.h
+++ b/linden/indra/llmessage/lldbstrings.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lldispatcher.cpp b/linden/indra/llmessage/lldispatcher.cpp
index 2a0aa67..6632fbb 100644
--- a/linden/indra/llmessage/lldispatcher.cpp
+++ b/linden/indra/llmessage/lldispatcher.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -120,29 +121,32 @@ bool LLDispatcher::unpackMessage(
120 // we treat the SParam as binary data (since it might be an 121 // we treat the SParam as binary data (since it might be an
121 // LLUUID in compressed form which may have embedded \0's,) 122 // LLUUID in compressed form which may have embedded \0's,)
122 size = msg->getSizeFast(_PREHASH_ParamList, i, _PREHASH_Parameter); 123 size = msg->getSizeFast(_PREHASH_ParamList, i, _PREHASH_Parameter);
123 msg->getBinaryDataFast( 124 if (size >= 0)
124 _PREHASH_ParamList, _PREHASH_Parameter,
125 buf, size, i, MAX_STRING-1);
126
127 // If the last byte of the data is 0x0, this is either a normally
128 // packed string, or a binary packed UUID (which for these messages
129 // are packed with a 17th byte 0x0). Unpack into a std::string
130 // without the trailing \0, so "abc\0" becomes std::string("abc", 3)
131 // which matches const char* "abc".
132 if (size > 0
133 && buf[size-1] == 0x0)
134 {
135 // special char*/size constructor because UUIDs may have embedded
136 // 0x0 bytes.
137 std::string binary_data(buf, size-1);
138 parameters.push_back(binary_data);
139 }
140 else
141 { 125 {
142 // This is either a NULL string, or a string that was packed 126 msg->getBinaryDataFast(
143 // incorrectly as binary data, without the usual trailing '\0'. 127 _PREHASH_ParamList, _PREHASH_Parameter,
144 std::string string_data(buf, size); 128 buf, size, i, MAX_STRING-1);
145 parameters.push_back(string_data); 129
130 // If the last byte of the data is 0x0, this is either a normally
131 // packed string, or a binary packed UUID (which for these messages
132 // are packed with a 17th byte 0x0). Unpack into a std::string
133 // without the trailing \0, so "abc\0" becomes std::string("abc", 3)
134 // which matches const char* "abc".
135 if (size > 0
136 && buf[size-1] == 0x0)
137 {
138 // special char*/size constructor because UUIDs may have embedded
139 // 0x0 bytes.
140 std::string binary_data(buf, size-1);
141 parameters.push_back(binary_data);
142 }
143 else
144 {
145 // This is either a NULL string, or a string that was packed
146 // incorrectly as binary data, without the usual trailing '\0'.
147 std::string string_data(buf, size);
148 parameters.push_back(string_data);
149 }
146 } 150 }
147 } 151 }
148 return true; 152 return true;
diff --git a/linden/indra/llmessage/lldispatcher.h b/linden/indra/llmessage/lldispatcher.h
index 492ac04..520b740 100644
--- a/linden/indra/llmessage/lldispatcher.h
+++ b/linden/indra/llmessage/lldispatcher.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lleventflags.h b/linden/indra/llmessage/lleventflags.h
index 431ca01..965d978 100644
--- a/linden/indra/llmessage/lleventflags.h
+++ b/linden/indra/llmessage/lleventflags.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -36,5 +37,6 @@ const U32 EVENT_FLAG_NONE = 0x0000;
36 37
37// set for mature events 38// set for mature events
38const U32 EVENT_FLAG_MATURE = 0x0001; 39const U32 EVENT_FLAG_MATURE = 0x0001;
40const U32 EVENT_FLAG_ADULT = 0x0002;
39 41
40#endif 42#endif
diff --git a/linden/indra/llmessage/llfiltersd2xmlrpc.cpp b/linden/indra/llmessage/llfiltersd2xmlrpc.cpp
index 5a173f3..0560a31 100644
--- a/linden/indra/llmessage/llfiltersd2xmlrpc.cpp
+++ b/linden/indra/llmessage/llfiltersd2xmlrpc.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llfiltersd2xmlrpc.h b/linden/indra/llmessage/llfiltersd2xmlrpc.h
index 6be090a..f907bbd 100644
--- a/linden/indra/llmessage/llfiltersd2xmlrpc.h
+++ b/linden/indra/llmessage/llfiltersd2xmlrpc.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llfollowcamparams.h b/linden/indra/llmessage/llfollowcamparams.h
index ca9ca75..7dd8d56 100644
--- a/linden/indra/llmessage/llfollowcamparams.h
+++ b/linden/indra/llmessage/llfollowcamparams.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llhost.cpp b/linden/indra/llmessage/llhost.cpp
index 77126a5..8e9e233 100644
--- a/linden/indra/llmessage/llhost.cpp
+++ b/linden/indra/llmessage/llhost.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llhost.h b/linden/indra/llmessage/llhost.h
index 39e29f4..ac35980 100644
--- a/linden/indra/llmessage/llhost.h
+++ b/linden/indra/llmessage/llhost.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llhttpassetstorage.cpp b/linden/indra/llmessage/llhttpassetstorage.cpp
index d1ea777..dfdad59 100644
--- a/linden/indra/llmessage/llhttpassetstorage.cpp
+++ b/linden/indra/llmessage/llhttpassetstorage.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -234,6 +235,7 @@ LLSD LLHTTPAssetRequest::getFullDetails() const
234 235
235void LLHTTPAssetRequest::setupCurlHandle() 236void LLHTTPAssetRequest::setupCurlHandle()
236{ 237{
238 // *NOTE: Similar code exists in mapserver/llcurlutil.cpp JC
237 mCurlHandle = curl_easy_init(); 239 mCurlHandle = curl_easy_init();
238 curl_easy_setopt(mCurlHandle, CURLOPT_NOSIGNAL, 1); 240 curl_easy_setopt(mCurlHandle, CURLOPT_NOSIGNAL, 1);
239 curl_easy_setopt(mCurlHandle, CURLOPT_NOPROGRESS, 1); 241 curl_easy_setopt(mCurlHandle, CURLOPT_NOPROGRESS, 1);
diff --git a/linden/indra/llmessage/llhttpassetstorage.h b/linden/indra/llmessage/llhttpassetstorage.h
index 8704a04..5786c5d 100644
--- a/linden/indra/llmessage/llhttpassetstorage.h
+++ b/linden/indra/llmessage/llhttpassetstorage.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llhttpclient.cpp b/linden/indra/llmessage/llhttpclient.cpp
index 88a6afd..a6041b4 100644
--- a/linden/indra/llmessage/llhttpclient.cpp
+++ b/linden/indra/llmessage/llhttpclient.cpp
@@ -1,4 +1,4 @@
1 /** 1/**
2 * @file llhttpclient.cpp 2 * @file llhttpclient.cpp
3 * @brief Implementation of classes for making HTTP requests. 3 * @brief Implementation of classes for making HTTP requests.
4 * 4 *
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -310,9 +311,13 @@ void LLHTTPClient::getByteRange(
310 request(url,LLURLRequest::HTTP_GET, NULL, responder, timeout, headers); 311 request(url,LLURLRequest::HTTP_GET, NULL, responder, timeout, headers);
311} 312}
312 313
313void LLHTTPClient::head(const std::string& url, ResponderPtr responder, const F32 timeout) 314void LLHTTPClient::head(
315 const std::string& url,
316 ResponderPtr responder,
317 const LLSD& headers,
318 const F32 timeout)
314{ 319{
315 request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout); 320 request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers);
316} 321}
317 322
318void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout) 323void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout)
@@ -397,6 +402,14 @@ LLSD LLHTTPClient::blockingGet(const std::string& url)
397 curl_easy_setopt(curlp, CURLOPT_ERRORBUFFER, curl_error_buffer); 402 curl_easy_setopt(curlp, CURLOPT_ERRORBUFFER, curl_error_buffer);
398 curl_easy_setopt(curlp, CURLOPT_FAILONERROR, 1); 403 curl_easy_setopt(curlp, CURLOPT_FAILONERROR, 1);
399 404
405 struct curl_slist *header_list = NULL;
406 header_list = curl_slist_append(header_list, "Accept: application/llsd+xml");
407 CURLcode curl_result = curl_easy_setopt(curlp, CURLOPT_HTTPHEADER, header_list);
408 if ( curl_result != CURLE_OK )
409 {
410 llinfos << "Curl is hosed - can't add Accept header for llsd+xml" << llendl;
411 }
412
400 LLSD response = LLSD::emptyMap(); 413 LLSD response = LLSD::emptyMap();
401 414
402 S32 curl_success = curl_easy_perform(curlp); 415 S32 curl_success = curl_easy_perform(curlp);
@@ -418,44 +431,77 @@ LLSD LLHTTPClient::blockingGet(const std::string& url)
418 response["body"] = http_buffer.asLLSD(); 431 response["body"] = http_buffer.asLLSD();
419 } 432 }
420 433
434 if(header_list)
435 { // free the header list
436 curl_slist_free_all(header_list);
437 header_list = NULL;
438 }
439
421 curl_easy_cleanup(curlp); 440 curl_easy_cleanup(curlp);
422 441
423 return response; 442 return response;
424} 443}
425 444
426void LLHTTPClient::put(const std::string& url, const LLSD& body, ResponderPtr responder, const F32 timeout) 445void LLHTTPClient::put(
446 const std::string& url,
447 const LLSD& body,
448 ResponderPtr responder,
449 const LLSD& headers,
450 const F32 timeout)
427{ 451{
428 request(url, LLURLRequest::HTTP_PUT, new LLSDInjector(body), responder, timeout); 452 request(url, LLURLRequest::HTTP_PUT, new LLSDInjector(body), responder, timeout, headers);
429} 453}
430 454
431void LLHTTPClient::post(const std::string& url, const LLSD& body, ResponderPtr responder, const F32 timeout) 455void LLHTTPClient::post(
456 const std::string& url,
457 const LLSD& body,
458 ResponderPtr responder,
459 const LLSD& headers,
460 const F32 timeout)
432{ 461{
433 request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout); 462 request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout, headers);
434} 463}
435 464
436void LLHTTPClient::postRaw(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout) 465void LLHTTPClient::postRaw(
466 const std::string& url,
467 const U8* data,
468 S32 size,
469 ResponderPtr responder,
470 const LLSD& headers,
471 const F32 timeout)
437{ 472{
438 request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout); 473 request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout, headers);
439} 474}
440 475
441void LLHTTPClient::postFile(const std::string& url, const std::string& filename, ResponderPtr responder, const F32 timeout) 476void LLHTTPClient::postFile(
477 const std::string& url,
478 const std::string& filename,
479 ResponderPtr responder,
480 const LLSD& headers,
481 const F32 timeout)
442{ 482{
443 request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, timeout); 483 request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, timeout, headers);
444} 484}
445 485
446void LLHTTPClient::postFile(const std::string& url, const LLUUID& uuid, 486void LLHTTPClient::postFile(
447 LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout) 487 const std::string& url,
488 const LLUUID& uuid,
489 LLAssetType::EType asset_type,
490 ResponderPtr responder,
491 const LLSD& headers,
492 const F32 timeout)
448{ 493{
449 request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout); 494 request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout, headers);
450} 495}
451 496
452// static 497// static
453void LLHTTPClient::del( 498void LLHTTPClient::del(
454 const std::string& url, 499 const std::string& url,
455 ResponderPtr responder, 500 ResponderPtr responder,
501 const LLSD& headers,
456 const F32 timeout) 502 const F32 timeout)
457{ 503{
458 request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout); 504 request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout, headers);
459} 505}
460 506
461// static 507// static
@@ -463,9 +509,10 @@ void LLHTTPClient::move(
463 const std::string& url, 509 const std::string& url,
464 const std::string& destination, 510 const std::string& destination,
465 ResponderPtr responder, 511 ResponderPtr responder,
512 const LLSD& hdrs,
466 const F32 timeout) 513 const F32 timeout)
467{ 514{
468 LLSD headers; 515 LLSD headers = hdrs;
469 headers["Destination"] = destination; 516 headers["Destination"] = destination;
470 request(url, LLURLRequest::HTTP_MOVE, NULL, responder, timeout, headers); 517 request(url, LLURLRequest::HTTP_MOVE, NULL, responder, timeout, headers);
471} 518}
diff --git a/linden/indra/llmessage/llhttpclient.h b/linden/indra/llmessage/llhttpclient.h
index bfefc3a..a0c9fac 100644
--- a/linden/indra/llmessage/llhttpclient.h
+++ b/linden/indra/llmessage/llhttpclient.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -62,28 +63,56 @@ public:
62 63
63 /** @name non-blocking API */ 64 /** @name non-blocking API */
64 //@{ 65 //@{
65 static void head(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 66 static void head(
67 const std::string& url,
68 ResponderPtr,
69 const LLSD& headers = LLSD(),
70 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); 71 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); 72 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); 73 static void get(const std::string& url, const LLSD& query, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
69 74
70 static void put(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 75 static void put(
76 const std::string& url,
77 const LLSD& body,
78 ResponderPtr,
79 const LLSD& headers = LLSD(),
80 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
71 static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 81 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); 82 static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
73 83
74 static void post(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 84 static void post(
75 85 const std::string& url,
86 const LLSD& body,
87 ResponderPtr,
88 const LLSD& headers = LLSD(),
89 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
76 /** Takes ownership of data and deletes it when sent */ 90 /** 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); 91 static void postRaw(
78 92 const std::string& url,
79 static void postFile(const std::string& url, const std::string& filename, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 93 const U8* data,
80 # 94 S32 size,
81 static void postFile(const std::string& url, const LLUUID& uuid, 95 ResponderPtr responder,
82 LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 96 const LLSD& headers = LLSD(),
97 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
98 static void postFile(
99 const std::string& url,
100 const std::string& filename,
101 ResponderPtr,
102 const LLSD& headers = LLSD(),
103 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
104 static void postFile(
105 const std::string& url,
106 const LLUUID& uuid,
107 LLAssetType::EType asset_type,
108 ResponderPtr responder,
109 const LLSD& headers = LLSD(),
110 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
83 111
84 static void del( 112 static void del(
85 const std::string& url, 113 const std::string& url,
86 ResponderPtr responder, 114 ResponderPtr responder,
115 const LLSD& headers = LLSD(),
87 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 116 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
88 ///< sends a DELETE method, but we can't call it delete in c++ 117 ///< sends a DELETE method, but we can't call it delete in c++
89 118
@@ -93,12 +122,14 @@ public:
93 * @param url The complete serialized (and escaped) url to get. 122 * @param url The complete serialized (and escaped) url to get.
94 * @param destination The complete serialized destination url. 123 * @param destination The complete serialized destination url.
95 * @param responder The responder that will handle the result. 124 * @param responder The responder that will handle the result.
125 * @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. 126 * @param timeout The number of seconds to give the server to respond.
97 */ 127 */
98 static void move( 128 static void move(
99 const std::string& url, 129 const std::string& url,
100 const std::string& destination, 130 const std::string& destination,
101 ResponderPtr responder, 131 ResponderPtr responder,
132 const LLSD& headers = LLSD(),
102 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 133 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
103 134
104 //@} 135 //@}
diff --git a/linden/indra/llmessage/llhttpclientadapter.cpp b/linden/indra/llmessage/llhttpclientadapter.cpp
new file mode 100644
index 0000000..b698822
--- /dev/null
+++ b/linden/indra/llmessage/llhttpclientadapter.cpp
@@ -0,0 +1,61 @@
1/**
2 * @file
3 * @brief
4 *
5 * $LicenseInfo:firstyear=2009&license=viewergpl$
6 *
7 * Copyright (c) 2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "llhttpclientadapter.h"
34#include "llhttpclient.h"
35
36LLHTTPClientAdapter::~LLHTTPClientAdapter()
37{
38}
39
40void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder)
41{
42 LLSD empty_pragma_header;
43 // Pragma is required to stop curl adding "no-cache"
44 // Space is required to stop llurlrequest from turnning off proxying
45 empty_pragma_header["Pragma"] = " ";
46 LLHTTPClient::get(url, responder, empty_pragma_header);
47}
48
49void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers)
50{
51 LLSD empty_pragma_header = headers;
52 // as above
53 empty_pragma_header["Pragma"] = " ";
54 LLHTTPClient::get(url, responder, empty_pragma_header);
55}
56
57void LLHTTPClientAdapter::put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder)
58{
59 LLHTTPClient::put(url, body, responder);
60}
61
diff --git a/linden/indra/llmessage/llhttpclientadapter.h b/linden/indra/llmessage/llhttpclientadapter.h
new file mode 100644
index 0000000..7d61357
--- /dev/null
+++ b/linden/indra/llmessage/llhttpclientadapter.h
@@ -0,0 +1,49 @@
1/**
2 * @file
3 * @brief
4 *
5 * $LicenseInfo:firstyear=2008&license=viewergpl$
6 *
7 * Copyright (c) 2008-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#ifndef LL_HTTPCLIENTADAPTER_H
34#define LL_HTTPCLIENTADAPTER_H
35
36#include "llhttpclientinterface.h"
37#include "llmemory.h" // LLSingleton<>
38
39class LLHTTPClientAdapter : public LLHTTPClientInterface, public LLSingleton<LLHTTPClientAdapter>
40{
41public:
42 virtual ~LLHTTPClientAdapter();
43 virtual void get(const std::string& url, LLCurl::ResponderPtr responder);
44 virtual void get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers);
45 virtual void put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder);
46};
47
48#endif
49
diff --git a/linden/indra/llmessage/llhttpclientinterface.h b/linden/indra/llmessage/llhttpclientinterface.h
new file mode 100644
index 0000000..42a8e5c
--- /dev/null
+++ b/linden/indra/llmessage/llhttpclientinterface.h
@@ -0,0 +1,51 @@
1/**
2 * @file
3 * @brief
4 *
5 * $LicenseInfo:firstyear=2008&license=viewergpl$
6 *
7 * Copyright (c) 2008-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#ifndef LL_LLHTTPCLIENTINTERFACE_H
34#define LL_LLHTTPCLIENTINTERFACE_H
35
36#include "linden_common.h"
37#include "llcurl.h"
38
39#include <string>
40
41class LLHTTPClientInterface
42{
43public:
44 virtual ~LLHTTPClientInterface() {}
45 virtual void get(const std::string& url, LLCurl::ResponderPtr responder) = 0;
46 virtual void get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers) = 0;
47 virtual void put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder) = 0;
48};
49
50#endif // LL_LLHTTPCLIENTINTERFACE_H
51
diff --git a/linden/indra/llmessage/llhttpnode.cpp b/linden/indra/llmessage/llhttpnode.cpp
index 0d60a64..2ba900a 100644
--- a/linden/indra/llmessage/llhttpnode.cpp
+++ b/linden/indra/llmessage/llhttpnode.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -35,8 +36,8 @@
35#include <boost/tokenizer.hpp> 36#include <boost/tokenizer.hpp>
36 37
37#include "llstl.h" 38#include "llstl.h"
39#include "lliohttpserver.h" // for string constants
38 40
39static const std::string CONTEXT_REQUEST("request");
40static const std::string CONTEXT_WILDCARD("wildcard"); 41static const std::string CONTEXT_WILDCARD("wildcard");
41 42
42/** 43/**
@@ -180,7 +181,8 @@ void LLHTTPNode::options(ResponsePtr response, const LLSD& context) const
180 //llinfos << "options context: " << context << llendl; 181 //llinfos << "options context: " << context << llendl;
181 182
182 // default implementation constructs an url to the documentation. 183 // default implementation constructs an url to the documentation.
183 std::string host = context[CONTEXT_REQUEST]["headers"]["host"].asString(); 184 std::string host(
185 context[CONTEXT_REQUEST][CONTEXT_HEADERS]["host"].asString());
184 if(host.empty()) 186 if(host.empty())
185 { 187 {
186 response->status(400, "Bad Request -- need Host header"); 188 response->status(400, "Bad Request -- need Host header");
@@ -474,6 +476,11 @@ void LLSimpleResponse::result(const LLSD& result)
474 status(200, "OK"); 476 status(200, "OK");
475} 477}
476 478
479void LLSimpleResponse::extendedResult(S32 code, const std::string& body, const LLSD& headers)
480{
481 status(code,body);
482}
483
477void LLSimpleResponse::status(S32 code, const std::string& message) 484void LLSimpleResponse::status(S32 code, const std::string& message)
478{ 485{
479 mCode = code; 486 mCode = code;
diff --git a/linden/indra/llmessage/llhttpnode.h b/linden/indra/llmessage/llhttpnode.h
index ea89ee2..17ffd66 100644
--- a/linden/indra/llmessage/llhttpnode.h
+++ b/linden/indra/llmessage/llhttpnode.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -37,7 +38,6 @@
37 38
38class LLChainIOFactory; 39class LLChainIOFactory;
39 40
40
41/** 41/**
42 * These classes represent the HTTP framework: The URL tree, and the LLSD 42 * These classes represent the HTTP framework: The URL tree, and the LLSD
43 * REST interface that such nodes implement. 43 * REST interface that such nodes implement.
@@ -88,6 +88,9 @@ public:
88 virtual LLSD post(const LLSD& input) const; 88 virtual LLSD post(const LLSD& input) const;
89 virtual LLSD del(const LLSD& context) const; 89 virtual LLSD del(const LLSD& context) const;
90 90
91 /**
92 * @brief Abstract Base Class declaring Response interface.
93 */
91 class Response : public LLRefCount 94 class Response : public LLRefCount
92 { 95 {
93 protected: 96 protected:
@@ -95,53 +98,57 @@ public:
95 98
96 public: 99 public:
97 /** 100 /**
98 * @brief Return the LLSD content and a 200 OK. 101 * @brief Return the LLSD content and a 200 OK.
99 */ 102 */
100 virtual void result(const LLSD&) = 0; 103 virtual void result(const LLSD&) = 0;
101 104
102 /** 105 /**
106 * @brief return status code and message with headers.
107 */
108 virtual void extendedResult(S32 code, const std::string& message, const LLSD& headers) = 0;
109
110 /**
103 * @brief return status code and reason string on http header, 111 * @brief return status code and reason string on http header,
104 * but do not return a payload. 112 * but do not return a payload.
105 */ 113 */
106 virtual void status(S32 code, const std::string& message) = 0; 114 virtual void status(S32 code, const std::string& message) = 0;
107 115
108 /** 116 /**
109 * @brief Return no body, just status code and 'UNKNOWN ERROR'. 117 * @brief Return no body, just status code and 'UNKNOWN ERROR'.
110 */ 118 */
111 void status(S32 code); 119 virtual void status(S32 code);
112 120
113 void notFound(const std::string& message); 121 virtual void notFound(const std::string& message);
114 void notFound(); 122 virtual void notFound();
115 void methodNotAllowed(); 123 virtual void methodNotAllowed();
116 124
117 /** 125 /**
118 * @breif Add a name: value http header. 126 * @breif Add a name: value http header.
119 * 127 *
120 * No effort is made to ensure the response is a valid http 128 * No effort is made to ensure the response is a valid http
121 * header. 129 * header.
122 * The headers are stored as a map of header name : value. 130 * The headers are stored as a map of header name : value.
123 * Though HTTP allows the same header name to be transmitted 131 * Though HTTP allows the same header name to be transmitted
124 * more than once, this implementation only stores a header 132 * more than once, this implementation only stores a header
125 * name once. 133 * name once.
126 * @param name The name of the header, eg, "Content-Encoding" 134 * @param name The name of the header, eg, "Content-Encoding"
127 * @param value The value of the header, eg, "gzip" 135 * @param value The value of the header, eg, "gzip"
128 */ 136 */
129 void addHeader(const std::string& name, const std::string& value); 137 virtual void addHeader(const std::string& name, const std::string& value);
130 138
131 protected: 139 protected:
132 /** 140 /**
133 * @brief Headers to be sent back with the HTTP response. 141 * @brief Headers to be sent back with the HTTP response.
134 * 142 *
135 * Protected class membership since derived classes are 143 * Protected class membership since derived classes are
136 * expected to use it and there is no use case yet for other 144 * expected to use it and there is no use case yet for other
137 * uses. If such a use case arises, I suggest making a 145 * uses. If such a use case arises, I suggest making a
138 * headers() public method, and moving this member data into 146 * headers() public method, and moving this member data into
139 * private. 147 * private.
140 */ 148 */
141 LLSD mHeaders; 149 LLSD mHeaders;
142 }; 150 };
143 151
144
145 typedef LLPointer<Response> ResponsePtr; 152 typedef LLPointer<Response> ResponsePtr;
146 153
147 virtual void get(ResponsePtr, const LLSD& context) const; 154 virtual void get(ResponsePtr, const LLSD& context) const;
@@ -217,6 +224,14 @@ public:
217 const LLHTTPNode* rootNode() const; 224 const LLHTTPNode* rootNode() const;
218 const LLHTTPNode* findNode(const std::string& name) const; 225 const LLHTTPNode* findNode(const std::string& name) const;
219 226
227
228 enum EHTTPNodeContentType
229 {
230 CONTENT_TYPE_LLSD,
231 CONTENT_TYPE_TEXT
232 };
233
234 virtual EHTTPNodeContentType getContentType() const { return CONTENT_TYPE_LLSD; }
220 //@} 235 //@}
221 236
222 /* @name Description system 237 /* @name Description system
@@ -276,6 +291,7 @@ public:
276 static LLPointer<LLSimpleResponse> create(); 291 static LLPointer<LLSimpleResponse> create();
277 292
278 void result(const LLSD& result); 293 void result(const LLSD& result);
294 void extendedResult(S32 code, const std::string& body, const LLSD& headers);
279 void status(S32 code, const std::string& message); 295 void status(S32 code, const std::string& message);
280 296
281 void print(std::ostream& out) const; 297 void print(std::ostream& out) const;
diff --git a/linden/indra/llmessage/llhttpnodeadapter.h b/linden/indra/llmessage/llhttpnodeadapter.h
new file mode 100644
index 0000000..7c3e9d8
--- /dev/null
+++ b/linden/indra/llmessage/llhttpnodeadapter.h
@@ -0,0 +1,58 @@
1/**
2 * @file llhttpnodeadapter.h
3 * @brief Declaration of llhttpnode adapter classes
4 *
5 * $LicenseInfo:firstyear=2009&license=viewergpl$
6 *
7 * Copyright (c) 2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#ifndef LL_HTTP_NODE_ADAPTER_H
34#define LL_HTTP_NODE_ADAPTER_H
35
36#include "llhttpnode.h"
37
38template<typename T>
39class LLHTTPNodeAdapter : public LLHTTPNode
40{
41public:
42
43 virtual bool validate(const std::string& name, LLSD& context) const
44 {
45 T node;
46 return node.validate(name, context);
47 }
48
49 virtual void post(LLHTTPNode::ResponsePtr response,
50 const LLSD& context,
51 const LLSD& input) const
52 {
53 T node;
54 return node.post(response, context, input);
55 }
56};
57
58#endif // LL_HTTP_NODE_ADAPTER_H
diff --git a/linden/indra/llmessage/llhttpsender.cpp b/linden/indra/llmessage/llhttpsender.cpp
index 30b2cf0..0acd728 100644
--- a/linden/indra/llmessage/llhttpsender.cpp
+++ b/linden/indra/llmessage/llhttpsender.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llhttpsender.h b/linden/indra/llmessage/llhttpsender.h
index 1df9824..b6d8a3a 100644
--- a/linden/indra/llmessage/llhttpsender.h
+++ b/linden/indra/llmessage/llhttpsender.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llinstantmessage.cpp b/linden/indra/llmessage/llinstantmessage.cpp
index dbee96b..44be3ae 100644
--- a/linden/indra/llmessage/llinstantmessage.cpp
+++ b/linden/indra/llmessage/llinstantmessage.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llinstantmessage.h b/linden/indra/llmessage/llinstantmessage.h
index 0468c5a..96a2cf9 100644
--- a/linden/indra/llmessage/llinstantmessage.h
+++ b/linden/indra/llmessage/llinstantmessage.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -158,7 +159,7 @@ enum EInstantMessage
158 159
159 IM_FRIENDSHIP_OFFERED = 38, 160 IM_FRIENDSHIP_OFFERED = 38,
160 IM_FRIENDSHIP_ACCEPTED = 39, 161 IM_FRIENDSHIP_ACCEPTED = 39,
161 IM_FRIENDSHIP_DECLINED = 40, 162 IM_FRIENDSHIP_DECLINED_DEPRECATED = 40,
162 163
163 IM_TYPING_START = 41, 164 IM_TYPING_START = 41,
164 IM_TYPING_STOP = 42, 165 IM_TYPING_STOP = 42,
diff --git a/linden/indra/llmessage/llinvite.h b/linden/indra/llmessage/llinvite.h
index 1a7e5e3..7bafccb 100644
--- a/linden/indra/llmessage/llinvite.h
+++ b/linden/indra/llmessage/llinvite.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lliobuffer.cpp b/linden/indra/llmessage/lliobuffer.cpp
index a628bf6..71c1df8 100644
--- a/linden/indra/llmessage/lliobuffer.cpp
+++ b/linden/indra/llmessage/lliobuffer.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lliobuffer.h b/linden/indra/llmessage/lliobuffer.h
index ae776f9..16bef15 100644
--- a/linden/indra/llmessage/lliobuffer.h
+++ b/linden/indra/llmessage/lliobuffer.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lliohttpserver.cpp b/linden/indra/llmessage/lliohttpserver.cpp
index 167f212..83dfa94 100644
--- a/linden/indra/llmessage/lliohttpserver.cpp
+++ b/linden/indra/llmessage/lliohttpserver.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -56,15 +57,15 @@
56#include <boost/tokenizer.hpp> 57#include <boost/tokenizer.hpp>
57 58
58static const char HTTP_VERSION_STR[] = "HTTP/1.0"; 59static const char HTTP_VERSION_STR[] = "HTTP/1.0";
59static const std::string CONTEXT_REQUEST("request"); 60const std::string CONTEXT_REQUEST("request");
60static const std::string CONTEXT_RESPONSE("response"); 61const std::string CONTEXT_RESPONSE("response");
61static const std::string CONTEXT_VERB("verb"); 62const std::string CONTEXT_VERB("verb");
62static const std::string CONTEXT_HEADERS("headers"); 63const std::string CONTEXT_HEADERS("headers");
63static const std::string HTTP_VERB_GET("GET"); 64const std::string HTTP_VERB_GET("GET");
64static const std::string HTTP_VERB_PUT("PUT"); 65const std::string HTTP_VERB_PUT("PUT");
65static const std::string HTTP_VERB_POST("POST"); 66const std::string HTTP_VERB_POST("POST");
66static const std::string HTTP_VERB_DELETE("DELETE"); 67const std::string HTTP_VERB_DELETE("DELETE");
67static const std::string HTTP_VERB_OPTIONS("OPTIONS"); 68const std::string HTTP_VERB_OPTIONS("OPTIONS");
68 69
69static LLIOHTTPServer::timing_callback_t sTimingCallback = NULL; 70static LLIOHTTPServer::timing_callback_t sTimingCallback = NULL;
70static void* sTimingCallbackData = NULL; 71static void* sTimingCallbackData = NULL;
@@ -103,6 +104,7 @@ private:
103 104
104 // from LLHTTPNode::Response 105 // from LLHTTPNode::Response
105 virtual void result(const LLSD&); 106 virtual void result(const LLSD&);
107 virtual void extendedResult(S32 code, const std::string& body, const LLSD& headers);
106 virtual void status(S32 code, const std::string& message); 108 virtual void status(S32 code, const std::string& message);
107 109
108 void nullPipe(); 110 void nullPipe();
@@ -121,7 +123,8 @@ private:
121 STATE_DELAYED, 123 STATE_DELAYED,
122 STATE_LOCKED, 124 STATE_LOCKED,
123 STATE_GOOD_RESULT, 125 STATE_GOOD_RESULT,
124 STATE_STATUS_RESULT 126 STATE_STATUS_RESULT,
127 STATE_EXTENDED_RESULT
125 }; 128 };
126 State mState; 129 State mState;
127 130
@@ -179,14 +182,32 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
179 { 182 {
180 LLPerfBlock putblock("http_put"); 183 LLPerfBlock putblock("http_put");
181 LLSD input; 184 LLSD input;
182 LLSDSerialize::fromXML(input, istr); 185 if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_LLSD)
186 {
187 LLSDSerialize::fromXML(input, istr);
188 }
189 else if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_TEXT)
190 {
191 std::stringstream strstrm;
192 strstrm << istr.rdbuf();
193 input = strstrm.str();
194 }
183 mNode.put(LLHTTPNode::ResponsePtr(mResponse), context, input); 195 mNode.put(LLHTTPNode::ResponsePtr(mResponse), context, input);
184 } 196 }
185 else if(verb == HTTP_VERB_POST) 197 else if(verb == HTTP_VERB_POST)
186 { 198 {
187 LLPerfBlock postblock("http_post"); 199 LLPerfBlock postblock("http_post");
188 LLSD input; 200 LLSD input;
189 LLSDSerialize::fromXML(input, istr); 201 if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_LLSD)
202 {
203 LLSDSerialize::fromXML(input, istr);
204 }
205 else if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_TEXT)
206 {
207 std::stringstream strstrm;
208 strstrm << istr.rdbuf();
209 input = strstrm.str();
210 }
190 mNode.post(LLHTTPNode::ResponsePtr(mResponse), context, input); 211 mNode.post(LLHTTPNode::ResponsePtr(mResponse), context, input);
191 } 212 }
192 else if(verb == HTTP_VERB_DELETE) 213 else if(verb == HTTP_VERB_DELETE)
@@ -261,7 +282,16 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
261 context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode; 282 context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode;
262 context[CONTEXT_RESPONSE]["statusMessage"] = mStatusMessage; 283 context[CONTEXT_RESPONSE]["statusMessage"] = mStatusMessage;
263 LLBufferStream ostr(channels, buffer.get()); 284 LLBufferStream ostr(channels, buffer.get());
264 ostr << mStatusMessage << std::ends; 285 ostr << mStatusMessage;
286
287 return STATUS_DONE;
288 }
289 case STATE_EXTENDED_RESULT:
290 {
291 context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = mHeaders;
292 context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode;
293 LLBufferStream ostr(channels, buffer.get());
294 ostr << mStatusMessage;
265 295
266 return STATUS_DONE; 296 return STATUS_DONE;
267 } 297 }
@@ -308,6 +338,21 @@ void LLHTTPPipe::Response::result(const LLSD& r)
308 mPipe->unlockChain(); 338 mPipe->unlockChain();
309} 339}
310 340
341void LLHTTPPipe::Response::extendedResult(S32 code, const std::string& body, const LLSD& headers)
342{
343 if(! mPipe)
344 {
345 llwarns << "LLHTTPPipe::Response::status: NULL pipe" << llendl;
346 return;
347 }
348
349 mPipe->mStatusCode = code;
350 mPipe->mStatusMessage = body;
351 mPipe->mHeaders = headers;
352 mPipe->mState = STATE_EXTENDED_RESULT;
353 mPipe->unlockChain();
354}
355
311// virtual 356// virtual
312void LLHTTPPipe::Response::status(S32 code, const std::string& message) 357void LLHTTPPipe::Response::status(S32 code, const std::string& message)
313{ 358{
@@ -408,6 +453,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
408 } 453 }
409 454
410 ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n"; 455 ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n";
456
411 S32 content_length = buffer->countAfter(channels.in(), NULL); 457 S32 content_length = buffer->countAfter(channels.in(), NULL);
412 if(0 < content_length) 458 if(0 < content_length)
413 { 459 {
@@ -798,6 +844,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
798 = node->getProtocolHandler(); 844 = node->getProtocolHandler();
799 if (protocolHandler) 845 if (protocolHandler)
800 { 846 {
847 lldebugs << "HTTP context: " << context << llendl;
801 protocolHandler->build(chain, context); 848 protocolHandler->build(chain, context);
802 } 849 }
803 else 850 else
diff --git a/linden/indra/llmessage/lliohttpserver.h b/linden/indra/llmessage/lliohttpserver.h
index 0f39c30..d1c9bdd 100644
--- a/linden/indra/llmessage/lliohttpserver.h
+++ b/linden/indra/llmessage/lliohttpserver.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -39,6 +40,18 @@
39 40
40class LLPumpIO; 41class LLPumpIO;
41 42
43// common strings use for populating the context. bascally 'request',
44// 'wildcard', and 'headers'.
45extern const std::string CONTEXT_REQUEST;
46extern const std::string CONTEXT_RESPONSE;
47extern const std::string CONTEXT_VERB;
48extern const std::string CONTEXT_HEADERS;
49extern const std::string HTTP_VERB_GET;
50extern const std::string HTTP_VERB_PUT;
51extern const std::string HTTP_VERB_POST;
52extern const std::string HTTP_VERB_DELETE;
53extern const std::string HTTP_VERB_OPTIONS;
54
42class LLIOHTTPServer 55class LLIOHTTPServer
43{ 56{
44public: 57public:
diff --git a/linden/indra/llmessage/lliopipe.cpp b/linden/indra/llmessage/lliopipe.cpp
index 05a54d3..af9737d 100644
--- a/linden/indra/llmessage/lliopipe.cpp
+++ b/linden/indra/llmessage/lliopipe.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lliopipe.h b/linden/indra/llmessage/lliopipe.h
index 999916f..8c5f151 100644
--- a/linden/indra/llmessage/lliopipe.h
+++ b/linden/indra/llmessage/lliopipe.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lliosocket.cpp b/linden/indra/llmessage/lliosocket.cpp
index 2b9c478..7ec577c 100644
--- a/linden/indra/llmessage/lliosocket.cpp
+++ b/linden/indra/llmessage/lliosocket.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lliosocket.h b/linden/indra/llmessage/lliosocket.h
index 02610d9..ec09ad8 100644
--- a/linden/indra/llmessage/lliosocket.h
+++ b/linden/indra/llmessage/lliosocket.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llioutil.cpp b/linden/indra/llmessage/llioutil.cpp
index 494ac55..d282a7d 100644
--- a/linden/indra/llmessage/llioutil.cpp
+++ b/linden/indra/llmessage/llioutil.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llioutil.h b/linden/indra/llmessage/llioutil.h
index 668de97..5bc674a 100644
--- a/linden/indra/llmessage/llioutil.h
+++ b/linden/indra/llmessage/llioutil.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llloginflags.h b/linden/indra/llmessage/llloginflags.h
index 064e893..6f119e7 100644
--- a/linden/indra/llmessage/llloginflags.h
+++ b/linden/indra/llmessage/llloginflags.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmail.cpp b/linden/indra/llmessage/llmail.cpp
index 6945a45..d52ff6c 100644
--- a/linden/indra/llmessage/llmail.cpp
+++ b/linden/indra/llmessage/llmail.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmail.h b/linden/indra/llmessage/llmail.h
index 7049a5b..7effb84 100644
--- a/linden/indra/llmessage/llmail.h
+++ b/linden/indra/llmessage/llmail.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmessagebuilder.cpp b/linden/indra/llmessage/llmessagebuilder.cpp
index 21c2db6..def9f47 100644
--- a/linden/indra/llmessage/llmessagebuilder.cpp
+++ b/linden/indra/llmessage/llmessagebuilder.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmessagebuilder.h b/linden/indra/llmessage/llmessagebuilder.h
index 180cf1e..6fa218d 100644
--- a/linden/indra/llmessage/llmessagebuilder.h
+++ b/linden/indra/llmessage/llmessagebuilder.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmessageconfig.cpp b/linden/indra/llmessage/llmessageconfig.cpp
index 8721b09..d427935 100644
--- a/linden/indra/llmessage/llmessageconfig.cpp
+++ b/linden/indra/llmessage/llmessageconfig.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmessageconfig.h b/linden/indra/llmessage/llmessageconfig.h
index 17bcf00..e8b5164 100644
--- a/linden/indra/llmessage/llmessageconfig.h
+++ b/linden/indra/llmessage/llmessageconfig.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmessagereader.cpp b/linden/indra/llmessage/llmessagereader.cpp
index a7a4597..6237172 100644
--- a/linden/indra/llmessage/llmessagereader.cpp
+++ b/linden/indra/llmessage/llmessagereader.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmessagereader.h b/linden/indra/llmessage/llmessagereader.h
index b1aa6e1..6edc2f3 100644
--- a/linden/indra/llmessage/llmessagereader.h
+++ b/linden/indra/llmessage/llmessagereader.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -43,6 +44,12 @@ class LLVector3;
43class LLVector3d; 44class LLVector3d;
44class LLVector4; 45class LLVector4;
45 46
47// Error return values for getSize() functions
48const S32 LL_BLOCK_NOT_IN_MESSAGE = -1;
49const S32 LL_VARIABLE_NOT_IN_BLOCK = -2;
50const S32 LL_MESSAGE_ERROR = -3;
51
52
46class LLMessageReader 53class LLMessageReader
47{ 54{
48 public: 55 public:
diff --git a/linden/indra/llmessage/network.h b/linden/indra/llmessage/llmessagesenderinterface.h
index 781c4f4..119eb1d 100644
--- a/linden/indra/llmessage/network.h
+++ b/linden/indra/llmessage/llmessagesenderinterface.h
@@ -1,10 +1,10 @@
1/** 1/**
2 * @file network.h 2 * @file
3 * @brief Legacy file. 3 * @brief
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$ 5 * $LicenseInfo:firstyear=2008&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2000-2009, Linden Research, Inc. 7 * Copyright (c) 2008-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -29,3 +30,21 @@
29 * $/LicenseInfo$ 30 * $/LicenseInfo$
30 */ 31 */
31 32
33#ifndef LL_LLMESSAGESENDERINTERFACE_H
34#define LL_LLMESSAGESENDERINTERFACE_H
35
36#include "linden_common.h"
37#include "llstoredmessage.h"
38class LLHost;
39class LLSD;
40
41class LLMessageSenderInterface
42{
43public:
44 virtual ~LLMessageSenderInterface() {}
45 virtual S32 sendMessage(const LLHost& host, LLStoredMessagePtr message) = 0;
46
47};
48
49#endif // LL_LLMESSAGESENDERINTERFACE_H
50
diff --git a/linden/indra/llmessage/llmessagetemplate.cpp b/linden/indra/llmessage/llmessagetemplate.cpp
index 6cbffca..7f3a97f 100644
--- a/linden/indra/llmessage/llmessagetemplate.cpp
+++ b/linden/indra/llmessage/llmessagetemplate.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmessagetemplate.h b/linden/indra/llmessage/llmessagetemplate.h
index 2390eea..d7f02eb 100644
--- a/linden/indra/llmessage/llmessagetemplate.h
+++ b/linden/indra/llmessage/llmessagetemplate.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmessagetemplateparser.cpp b/linden/indra/llmessage/llmessagetemplateparser.cpp
index b7fe8f9..283547e 100644
--- a/linden/indra/llmessage/llmessagetemplateparser.cpp
+++ b/linden/indra/llmessage/llmessagetemplateparser.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmessagetemplateparser.h b/linden/indra/llmessage/llmessagetemplateparser.h
index 97e51c4..af66131 100644
--- a/linden/indra/llmessage/llmessagetemplateparser.h
+++ b/linden/indra/llmessage/llmessagetemplateparser.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmessagethrottle.cpp b/linden/indra/llmessage/llmessagethrottle.cpp
index 0d61f90..8fec4b3 100644
--- a/linden/indra/llmessage/llmessagethrottle.cpp
+++ b/linden/indra/llmessage/llmessagethrottle.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -119,7 +120,7 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg
119 full_mesg << to << mesg; 120 full_mesg << to << mesg;
120 121
121 // Create an entry for this message. 122 // Create an entry for this message.
122 size_t hash = llhash<const char*> (full_mesg.str().c_str()); 123 size_t hash = llhash(full_mesg.str().c_str());
123 LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime()); 124 LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime());
124 125
125 // Check if this message is already in the list. 126 // Check if this message is already in the list.
@@ -153,7 +154,7 @@ BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, c
153 full_mesg << agent << task << mesg; 154 full_mesg << agent << task << mesg;
154 155
155 // Create an entry for this message. 156 // Create an entry for this message.
156 size_t hash = llhash<const char*> (full_mesg.str().c_str()); 157 size_t hash = llhash(full_mesg.str().c_str());
157 LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime()); 158 LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime());
158 159
159 // Check if this message is already in the list. 160 // Check if this message is already in the list.
diff --git a/linden/indra/llmessage/llmessagethrottle.h b/linden/indra/llmessage/llmessagethrottle.h
index fdd1b4b..b8a5de0 100644
--- a/linden/indra/llmessage/llmessagethrottle.h
+++ b/linden/indra/llmessage/llmessagethrottle.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmime.cpp b/linden/indra/llmessage/llmime.cpp
index 355d0b7..fa623b6 100644
--- a/linden/indra/llmessage/llmime.cpp
+++ b/linden/indra/llmessage/llmime.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmime.h b/linden/indra/llmessage/llmime.h
index 9fbfcd7..29211a9 100644
--- a/linden/indra/llmessage/llmime.h
+++ b/linden/indra/llmessage/llmime.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llmsgvariabletype.h b/linden/indra/llmessage/llmsgvariabletype.h
index 08e5aef..b3b3589 100644
--- a/linden/indra/llmessage/llmsgvariabletype.h
+++ b/linden/indra/llmessage/llmsgvariabletype.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llnamevalue.cpp b/linden/indra/llmessage/llnamevalue.cpp
index d4db063..01e922e 100644
--- a/linden/indra/llmessage/llnamevalue.cpp
+++ b/linden/indra/llmessage/llnamevalue.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -38,7 +39,6 @@
38 39
39#include "u64.h" 40#include "u64.h"
40#include "llstring.h" 41#include "llstring.h"
41#include "llcamera.h"
42#include "string_table.h" 42#include "string_table.h"
43 43
44// Anonymous enumeration to provide constants in this file. 44// Anonymous enumeration to provide constants in this file.
diff --git a/linden/indra/llmessage/llnamevalue.h b/linden/indra/llmessage/llnamevalue.h
index eecfd4c..ad69d3a 100644
--- a/linden/indra/llmessage/llnamevalue.h
+++ b/linden/indra/llmessage/llnamevalue.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llnullcipher.cpp b/linden/indra/llmessage/llnullcipher.cpp
index 89c66cc..30279bc 100644
--- a/linden/indra/llmessage/llnullcipher.cpp
+++ b/linden/indra/llmessage/llnullcipher.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llnullcipher.h b/linden/indra/llmessage/llnullcipher.h
index 2b5a4a5..6e87720 100644
--- a/linden/indra/llmessage/llnullcipher.h
+++ b/linden/indra/llmessage/llnullcipher.h
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llpacketack.cpp b/linden/indra/llmessage/llpacketack.cpp
index 8eb6694..f7de44c 100644
--- a/linden/indra/llmessage/llpacketack.cpp
+++ b/linden/indra/llmessage/llpacketack.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llpacketack.h b/linden/indra/llmessage/llpacketack.h
index 1023295..6f78dda 100644
--- a/linden/indra/llmessage/llpacketack.h
+++ b/linden/indra/llmessage/llpacketack.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llpacketbuffer.cpp b/linden/indra/llmessage/llpacketbuffer.cpp
index cb42ab3..027d35c 100644
--- a/linden/indra/llmessage/llpacketbuffer.cpp
+++ b/linden/indra/llmessage/llpacketbuffer.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -73,5 +74,6 @@ void LLPacketBuffer::init (S32 hSocket)
73{ 74{
74 mSize = receive_packet(hSocket, mData); 75 mSize = receive_packet(hSocket, mData);
75 mHost = ::get_sender(); 76 mHost = ::get_sender();
77 mReceivingIF = ::get_receiving_interface();
76} 78}
77 79
diff --git a/linden/indra/llmessage/llpacketbuffer.h b/linden/indra/llmessage/llpacketbuffer.h
index b8c9f83..bbcbdf2 100644
--- a/linden/indra/llmessage/llpacketbuffer.h
+++ b/linden/indra/llmessage/llpacketbuffer.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -43,15 +44,17 @@ public:
43 LLPacketBuffer(S32 hSocket); // receive a packet 44 LLPacketBuffer(S32 hSocket); // receive a packet
44 ~LLPacketBuffer(); 45 ~LLPacketBuffer();
45 46
46 S32 getSize() const { return mSize; } 47 S32 getSize() const { return mSize; }
47 const char *getData() const { return mData; } 48 const char *getData() const { return mData; }
48 LLHost getHost() const { return mHost; } 49 LLHost getHost() const { return mHost; }
50 LLHost getReceivingInterface() const { return mReceivingIF; }
49 void init(S32 hSocket); 51 void init(S32 hSocket);
50 52
51protected: 53protected:
52 char mData[NET_BUFFER_SIZE]; // packet data /* Flawfinder : ignore */ 54 char mData[NET_BUFFER_SIZE]; // packet data /* Flawfinder : ignore */
53 S32 mSize; // size of buffer in bytes 55 S32 mSize; // size of buffer in bytes
54 LLHost mHost; // source/dest IP and port 56 LLHost mHost; // source/dest IP and port
57 LLHost mReceivingIF; // source/dest IP and port
55}; 58};
56 59
57#endif 60#endif
diff --git a/linden/indra/llmessage/llpacketring.cpp b/linden/indra/llmessage/llpacketring.cpp
index cd59b12..35d5aac 100644
--- a/linden/indra/llmessage/llpacketring.cpp
+++ b/linden/indra/llmessage/llpacketring.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -140,6 +141,7 @@ S32 LLPacketRing::receiveFromRing (S32 socket, char *datap)
140 } 141 }
141 // need to set sender IP/port!! 142 // need to set sender IP/port!!
142 mLastSender = packetp->getHost(); 143 mLastSender = packetp->getHost();
144 mLastReceivingIF = packetp->getReceivingInterface();
143 delete packetp; 145 delete packetp;
144 146
145 this->mInBufferLength -= packet_size; 147 this->mInBufferLength -= packet_size;
@@ -222,6 +224,7 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap)
222 // no delay, pull straight from net 224 // no delay, pull straight from net
223 packet_size = receive_packet(socket, datap); 225 packet_size = receive_packet(socket, datap);
224 mLastSender = ::get_sender(); 226 mLastSender = ::get_sender();
227 mLastReceivingIF = ::get_receiving_interface();
225 228
226 if (packet_size) // did we actually get a packet? 229 if (packet_size) // did we actually get a packet?
227 { 230 {
diff --git a/linden/indra/llmessage/llpacketring.h b/linden/indra/llmessage/llpacketring.h
index e914a32..4408abe 100644
--- a/linden/indra/llmessage/llpacketring.h
+++ b/linden/indra/llmessage/llpacketring.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -61,6 +62,7 @@ public:
61 BOOL sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host); 62 BOOL sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host);
62 63
63 inline LLHost getLastSender(); 64 inline LLHost getLastSender();
65 inline LLHost getLastReceivingInterface();
64 66
65 S32 getAndResetActualInBits() { S32 bits = mActualBitsIn; mActualBitsIn = 0; return bits;} 67 S32 getAndResetActualInBits() { S32 bits = mActualBitsIn; mActualBitsIn = 0; return bits;}
66 S32 getAndResetActualOutBits() { S32 bits = mActualBitsOut; mActualBitsOut = 0; return bits;} 68 S32 getAndResetActualOutBits() { S32 bits = mActualBitsOut; mActualBitsOut = 0; return bits;}
@@ -85,6 +87,7 @@ protected:
85 std::queue<LLPacketBuffer *> mSendQueue; 87 std::queue<LLPacketBuffer *> mSendQueue;
86 88
87 LLHost mLastSender; 89 LLHost mLastSender;
90 LLHost mLastReceivingIF;
88}; 91};
89 92
90 93
@@ -93,4 +96,9 @@ inline LLHost LLPacketRing::getLastSender()
93 return mLastSender; 96 return mLastSender;
94} 97}
95 98
99inline LLHost LLPacketRing::getLastReceivingInterface()
100{
101 return mLastReceivingIF;
102}
103
96#endif 104#endif
diff --git a/linden/indra/llmessage/llpartdata.cpp b/linden/indra/llmessage/llpartdata.cpp
index fe859fe..485bc6a 100644
--- a/linden/indra/llmessage/llpartdata.cpp
+++ b/linden/indra/llmessage/llpartdata.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llpartdata.h b/linden/indra/llmessage/llpartdata.h
index a72c6b2..6dcb311 100644
--- a/linden/indra/llmessage/llpartdata.h
+++ b/linden/indra/llmessage/llpartdata.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llpumpio.cpp b/linden/indra/llmessage/llpumpio.cpp
index 01a43ec..3e3f0b3 100644
--- a/linden/indra/llmessage/llpumpio.cpp
+++ b/linden/indra/llmessage/llpumpio.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -180,6 +181,8 @@ LLPumpIO::LLPumpIO(apr_pool_t* pool) :
180 mCallbackMutex(NULL), 181 mCallbackMutex(NULL),
181 mCurrentChain(mRunningChains.end()) 182 mCurrentChain(mRunningChains.end())
182{ 183{
184 mCurrentChain = mRunningChains.end();
185
183 LLMemType m1(LLMemType::MTYPE_IO_PUMP); 186 LLMemType m1(LLMemType::MTYPE_IO_PUMP);
184 initialize(pool); 187 initialize(pool);
185} 188}
@@ -273,12 +276,11 @@ bool LLPumpIO::setTimeoutSeconds(F32 timeout)
273 276
274void LLPumpIO::adjustTimeoutSeconds(F32 delta) 277void LLPumpIO::adjustTimeoutSeconds(F32 delta)
275{ 278{
276 // If no chain is running, bail 279 // Ensure a chain is running
277 if(mRunningChains.end() == mCurrentChain) 280 if(mRunningChains.end() != mCurrentChain)
278 { 281 {
279 return; 282 (*mCurrentChain).adjustTimeoutSeconds(delta);
280 } 283 }
281 (*mCurrentChain).adjustTimeoutSeconds(delta);
282} 284}
283 285
284static std::string events_2_string(apr_int16_t events) 286static std::string events_2_string(apr_int16_t events)
@@ -548,7 +550,7 @@ void LLPumpIO::pump(const S32& poll_timeout)
548 //lldebugs << "Running chain count: " << mRunningChains.size() << llendl; 550 //lldebugs << "Running chain count: " << mRunningChains.size() << llendl;
549 running_chains_t::iterator run_chain = mRunningChains.begin(); 551 running_chains_t::iterator run_chain = mRunningChains.begin();
550 bool process_this_chain = false; 552 bool process_this_chain = false;
551 for(; run_chain != mRunningChains.end(); ) 553 while( run_chain != mRunningChains.end() )
552 { 554 {
553 PUMP_DEBUG; 555 PUMP_DEBUG;
554 if((*run_chain).mInit 556 if((*run_chain).mInit
diff --git a/linden/indra/llmessage/llpumpio.h b/linden/indra/llmessage/llpumpio.h
index bf62832..fc0bfab 100644
--- a/linden/indra/llmessage/llpumpio.h
+++ b/linden/indra/llmessage/llpumpio.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llqueryflags.h b/linden/indra/llmessage/llqueryflags.h
index b4f7373..960d777 100644
--- a/linden/indra/llmessage/llqueryflags.h
+++ b/linden/indra/llmessage/llqueryflags.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -64,6 +65,13 @@ const U32 DFQ_LIMIT_BY_AREA = 0x1 << 21;
64const U32 DFQ_FILTER_MATURE = 0x1 << 22; 65const U32 DFQ_FILTER_MATURE = 0x1 << 22;
65const U32 DFQ_PG_PARCELS_ONLY = 0x1 << 23; 66const U32 DFQ_PG_PARCELS_ONLY = 0x1 << 23;
66 67
68const U32 DFQ_INC_PG = 0x1 << 24; // Flags appear in 1.23 viewer or later
69const U32 DFQ_INC_MATURE = 0x1 << 25;
70const U32 DFQ_INC_ADULT = 0x1 << 26;
71const U32 DFQ_INC_NEW_VIEWER = (DFQ_INC_PG | DFQ_INC_MATURE | DFQ_INC_ADULT); // Indicates 1.23 viewer or later
72
73const U32 DFQ_ADULT_SIMS_ONLY = 0x1 << 27;
74
67// Sell Type flags 75// Sell Type flags
68const U32 ST_AUCTION = 0x1 << 1; 76const U32 ST_AUCTION = 0x1 << 1;
69const U32 ST_NEWBIE = 0x1 << 2; 77const U32 ST_NEWBIE = 0x1 << 2;
@@ -72,4 +80,29 @@ const U32 ST_ESTATE = 0x1 << 4;
72 80
73const U32 ST_ALL = 0xFFFFFFFF; 81const U32 ST_ALL = 0xFFFFFFFF;
74 82
83// status flags embedded in search replay messages of classifieds, events, groups, and places.
84// Places
85const U32 STATUS_SEARCH_PLACES_NONE = 0x0;
86const U32 STATUS_SEARCH_PLACES_BANNEDWORD = 0x1 << 0;
87const U32 STATUS_SEARCH_PLACES_SHORTSTRING = 0x1 << 1;
88const U32 STATUS_SEARCH_PLACES_FOUNDNONE = 0x1 << 2;
89const U32 STATUS_SEARCH_PLACES_SEARCHDISABLED = 0x1 << 3;
90const U32 STATUS_SEARCH_PLACES_ESTATEEMPTY = 0x1 << 4;
91// Events
92const U32 STATUS_SEARCH_EVENTS_NONE = 0x0;
93const U32 STATUS_SEARCH_EVENTS_BANNEDWORD = 0x1 << 0;
94const U32 STATUS_SEARCH_EVENTS_SHORTSTRING = 0x1 << 1;
95const U32 STATUS_SEARCH_EVENTS_FOUNDNONE = 0x1 << 2;
96const U32 STATUS_SEARCH_EVENTS_SEARCHDISABLED = 0x1 << 3;
97const U32 STATUS_SEARCH_EVENTS_NODATEOFFSET = 0x1 << 4;
98const U32 STATUS_SEARCH_EVENTS_NOCATEGORY = 0x1 << 5;
99const U32 STATUS_SEARCH_EVENTS_NOQUERY = 0x1 << 6;
100
101//Classifieds
102const U32 STATUS_SEARCH_CLASSIFIEDS_NONE = 0x0;
103const U32 STATUS_SEARCH_CLASSIFIEDS_BANNEDWORD = 0x1 << 0;
104const U32 STATUS_SEARCH_CLASSIFIEDS_SHORTSTRING = 0x1 << 1;
105const U32 STATUS_SEARCH_CLASSIFIEDS_FOUNDNONE = 0x1 << 2;
106const U32 STATUS_SEARCH_CLASSIFIEDS_SEARCHDISABLED = 0x1 << 3;
107
75#endif 108#endif
diff --git a/linden/indra/llmessage/llregionflags.h b/linden/indra/llmessage/llregionflags.h
index 4c47199..2324785 100644
--- a/linden/indra/llmessage/llregionflags.h
+++ b/linden/indra/llmessage/llregionflags.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -60,8 +61,10 @@ const U32 REGION_FLAGS_BLOCK_LAND_RESELL = (1 << 7);
60// All content wiped once per night 61// All content wiped once per night
61const U32 REGION_FLAGS_SANDBOX = (1 << 8); 62const U32 REGION_FLAGS_SANDBOX = (1 << 8);
62const U32 REGION_FLAGS_NULL_LAYER = (1 << 9); 63const U32 REGION_FLAGS_NULL_LAYER = (1 << 9);
63const U32 REGION_FLAGS_SKIP_AGENT_ACTION = (1 << 10); 64// const U32 REGION_FLAGS_SKIP_AGENT_ACTION = (1 << 10);
64const U32 REGION_FLAGS_SKIP_UPDATE_INTEREST_LIST= (1 << 11); 65const U32 REGION_FLAGS_HARD_ALLOW_LAND_TRANSFER = (1 << 10); // Region allows land reselling
66// const U32 REGION_FLAGS_SKIP_UPDATE_INTEREST_LIST= (1 << 11);
67const 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 68const U32 REGION_FLAGS_SKIP_COLLISIONS = (1 << 12); // Pin all non agent rigid bodies
66const U32 REGION_FLAGS_SKIP_SCRIPTS = (1 << 13); 69const U32 REGION_FLAGS_SKIP_SCRIPTS = (1 << 13);
67const U32 REGION_FLAGS_SKIP_PHYSICS = (1 << 14); // Skip all physics 70const U32 REGION_FLAGS_SKIP_PHYSICS = (1 << 14); // Skip all physics
diff --git a/linden/indra/llmessage/llregionhandle.h b/linden/indra/llmessage/llregionhandle.h
index 80b79cd..da899cd 100644
--- a/linden/indra/llmessage/llregionhandle.h
+++ b/linden/indra/llmessage/llregionhandle.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llregionpresenceverifier.cpp b/linden/indra/llmessage/llregionpresenceverifier.cpp
new file mode 100644
index 0000000..24410a7
--- /dev/null
+++ b/linden/indra/llmessage/llregionpresenceverifier.cpp
@@ -0,0 +1,98 @@
1/**
2 * @file
3 * @brief
4 *
5 * $LicenseInfo:firstyear=2008&license=viewergpl$
6 *
7 * Copyright (c) 2008-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "llregionpresenceverifier.h"
34#include "llhttpclientinterface.h"
35#include <sstream>
36#include "net.h"
37#include "message.h"
38
39
40LLRegionPresenceVerifier::RegionResponder::RegionResponder(ResponsePtr data) : mSharedData(data)
41{
42}
43
44
45void LLRegionPresenceVerifier::RegionResponder::result(const LLSD& content)
46{
47 std::string host = content["private_host"].asString();
48 U32 port = content["private_port"].asInteger();
49 LLHost destination(host, port);
50 LLUUID id = content["region_id"];
51
52 llinfos << "Verifying " << destination.getString() << " is region " << id << llendl;
53
54 std::stringstream uri;
55 uri << "http://" << destination.getString() << "/state/basic";
56 mSharedData->getHttpClient().get(uri.str(), new VerifiedDestinationResponder(mSharedData, content));
57}
58
59void LLRegionPresenceVerifier::RegionResponder::completed(
60 U32 status,
61 const std::string& reason,
62 const LLSD& content)
63{
64 LLHTTPClient::Responder::completed(status, reason, content);
65
66 mSharedData->onCompletedRegionRequest();
67}
68
69
70LLRegionPresenceVerifier::VerifiedDestinationResponder::VerifiedDestinationResponder(ResponsePtr data, const LLSD& content) : mSharedData(data), mContent(content)
71{
72}
73
74
75
76
77void LLRegionPresenceVerifier::VerifiedDestinationResponder::result(const LLSD& content)
78{
79 LLUUID actual_region_id = content["region_id"];
80 LLUUID expected_region_id = mContent["region_id"];
81
82 if (mSharedData->checkValidity(content))
83 {
84 mSharedData->onRegionVerified(mContent);
85 }
86 else if ((mSharedData->shouldRetry()) && (actual_region_id != expected_region_id)) // If the region is correct, then it means we've deliberately changed the data
87 {
88 LLSD headers;
89 headers["Cache-Control"] = "no-cache, max-age=0";
90 llinfos << "Requesting region information, get uncached for region " << mSharedData->getRegionUri() << llendl;
91 mSharedData->decrementRetries();
92 mSharedData->getHttpClient().get(mSharedData->getRegionUri(), new RegionResponder(mSharedData), headers);
93 }
94 else
95 {
96 llwarns << "Could not correctly look up region from region presence service. Region: " << mSharedData->getRegionUri() << llendl;
97 }
98}
diff --git a/linden/indra/llmessage/llregionpresenceverifier.h b/linden/indra/llmessage/llregionpresenceverifier.h
new file mode 100644
index 0000000..54a7cce
--- /dev/null
+++ b/linden/indra/llmessage/llregionpresenceverifier.h
@@ -0,0 +1,92 @@
1/**
2 * @file
3 * @brief
4 *
5 * $LicenseInfo:firstyear=2008&license=viewergpl$
6 *
7 * Copyright (c) 2008-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33/* Macro Definitions */
34#ifndef LL_LLREGIONPRESENCEVERIFIER_H
35#define LL_LLREGIONPRESENCEVERIFIER_H
36
37#include "llhttpclient.h"
38#include <string>
39#include "llsd.h"
40#include <boost/shared_ptr.hpp>
41
42class LLHTTPClientInterface;
43
44class LLRegionPresenceVerifier
45{
46public:
47 class Response
48 {
49 public:
50 virtual ~Response() {}
51
52 virtual bool checkValidity(const LLSD& content) const = 0;
53 virtual void onRegionVerified(const LLSD& region_details) = 0;
54
55 virtual void decrementRetries() = 0;
56
57 virtual LLHTTPClientInterface& getHttpClient() = 0;
58 virtual std::string getRegionUri() const = 0;
59 virtual bool shouldRetry() const = 0;
60
61 virtual void onCompletedRegionRequest() {}
62 };
63
64 typedef boost::shared_ptr<Response> ResponsePtr;
65
66 class RegionResponder : public LLHTTPClient::Responder
67 {
68 public:
69 RegionResponder(ResponsePtr data);
70 virtual void result(const LLSD& content);
71 virtual void completed(
72 U32 status,
73 const std::string& reason,
74 const LLSD& content);
75
76 private:
77 ResponsePtr mSharedData;
78 };
79
80 class VerifiedDestinationResponder : public LLHTTPClient::Responder
81 {
82 public:
83 VerifiedDestinationResponder(ResponsePtr data, const LLSD& content);
84 virtual void result(const LLSD& content);
85 private:
86 ResponsePtr mSharedData;
87 LLSD mContent;
88 };
89};
90
91
92#endif //LL_LLREGIONPRESENCEVERIFIER_H
diff --git a/linden/indra/llmessage/llsdappservices.cpp b/linden/indra/llmessage/llsdappservices.cpp
index a051b4f..dc135c5 100644
--- a/linden/indra/llmessage/llsdappservices.cpp
+++ b/linden/indra/llmessage/llsdappservices.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llsdappservices.h b/linden/indra/llmessage/llsdappservices.h
index 71d7c4a..8f145e8 100644
--- a/linden/indra/llmessage/llsdappservices.h
+++ b/linden/indra/llmessage/llsdappservices.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llsdhttpserver.cpp b/linden/indra/llmessage/llsdhttpserver.cpp
index 9249d0a..00fc170 100644
--- a/linden/indra/llmessage/llsdhttpserver.cpp
+++ b/linden/indra/llmessage/llsdhttpserver.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llsdhttpserver.h b/linden/indra/llmessage/llsdhttpserver.h
index 432cd59..63ec195 100644
--- a/linden/indra/llmessage/llsdhttpserver.h
+++ b/linden/indra/llmessage/llsdhttpserver.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llsdmessagebuilder.cpp b/linden/indra/llmessage/llsdmessagebuilder.cpp
index d709f91..21937f0 100755
--- a/linden/indra/llmessage/llsdmessagebuilder.cpp
+++ b/linden/indra/llmessage/llsdmessagebuilder.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -267,10 +268,125 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data)
267 268
268 for(; dit != dend; ++dit) 269 for(; dit != dend; ++dit)
269 { 270 {
270 //const LLMsgVarData& mvci = *dit; 271 const LLMsgVarData& mvci = *dit;
271 272 const char* varname = mvci.getName();
272 // TODO: Copy mvci data in to block: 273
273 // (*mCurrentBlock)[varname] = v; 274 switch(mvci.getType())
275 {
276 case MVT_FIXED:
277 addBinaryData(varname, mvci.getData(), mvci.getSize());
278 break;
279
280 case MVT_VARIABLE:
281 {
282 const char end = ((const char*)mvci.getData())[mvci.getSize()-1]; // Ensure null terminated
283 if (mvci.getDataSize() == 1 && end == 0)
284 {
285 addString(varname, (const char*)mvci.getData());
286 }
287 else
288 {
289 addBinaryData(varname, mvci.getData(), mvci.getSize());
290 }
291 break;
292 }
293
294 case MVT_U8:
295 addU8(varname, *(U8*)mvci.getData());
296 break;
297
298 case MVT_U16:
299 addU16(varname, *(U16*)mvci.getData());
300 break;
301
302 case MVT_U32:
303 addU32(varname, *(U32*)mvci.getData());
304 break;
305
306 case MVT_U64:
307 addU64(varname, *(U64*)mvci.getData());
308 break;
309
310 case MVT_S8:
311 addS8(varname, *(S8*)mvci.getData());
312 break;
313
314 case MVT_S16:
315 addS16(varname, *(S16*)mvci.getData());
316 break;
317
318 case MVT_S32:
319 addS32(varname, *(S32*)mvci.getData());
320 break;
321
322 // S64 not supported in LLSD so we just truncate it
323 case MVT_S64:
324 addS32(varname, *(S64*)mvci.getData());
325 break;
326
327 case MVT_F32:
328 addF32(varname, *(F32*)mvci.getData());
329 break;
330
331 case MVT_F64:
332 addF64(varname, *(F64*)mvci.getData());
333 break;
334
335 case MVT_LLVector3:
336 addVector3(varname, *(LLVector3*)mvci.getData());
337 break;
338
339 case MVT_LLVector3d:
340 addVector3d(varname, *(LLVector3d*)mvci.getData());
341 break;
342
343 case MVT_LLVector4:
344 addVector4(varname, *(LLVector4*)mvci.getData());
345 break;
346
347 case MVT_LLQuaternion:
348 {
349 LLVector3 v = *(LLVector3*)mvci.getData();
350 LLQuaternion q;
351 q.unpackFromVector3(v);
352 addQuat(varname, q);
353 break;
354 }
355
356 case MVT_LLUUID:
357 addUUID(varname, *(LLUUID*)mvci.getData());
358 break;
359
360 case MVT_BOOL:
361 addBOOL(varname, *(BOOL*)mvci.getData());
362 break;
363
364 case MVT_IP_ADDR:
365 addIPAddr(varname, *(U32*)mvci.getData());
366 break;
367
368 case MVT_IP_PORT:
369 addIPPort(varname, *(U16*)mvci.getData());
370 break;
371
372 case MVT_U16Vec3:
373 //treated as an array of 6 bytes
374 addBinaryData(varname, mvci.getData(), 6);
375 break;
376
377 case MVT_U16Quat:
378 //treated as an array of 8 bytes
379 addBinaryData(varname, mvci.getData(), 8);
380 break;
381
382 case MVT_S16Array:
383 addBinaryData(varname, mvci.getData(), mvci.getSize());
384 break;
385
386 default:
387 llwarns << "Unknown type in conversion of message to LLSD" << llendl;
388 break;
389 }
274 } 390 }
275 } 391 }
276} 392}
diff --git a/linden/indra/llmessage/llsdmessagebuilder.h b/linden/indra/llmessage/llsdmessagebuilder.h
index 3bebef7..ef9ca35 100755
--- a/linden/indra/llmessage/llsdmessagebuilder.h
+++ b/linden/indra/llmessage/llsdmessagebuilder.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llsdmessagereader.cpp b/linden/indra/llmessage/llsdmessagereader.cpp
index 2cf74e8..e699ec9 100755
--- a/linden/indra/llmessage/llsdmessagereader.cpp
+++ b/linden/indra/llmessage/llsdmessagereader.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -107,6 +108,12 @@ void LLSDMessageReader::getBinaryData(const char *block, const char *var,
107 data_size = max_size; 108 data_size = max_size;
108 } 109 }
109 110
111 // Calls to memcpy will fail if data_size is not positive.
112 // Phoenix 2009-02-27
113 if(data_size <= 0)
114 {
115 return;
116 }
110 memcpy(datap, &(data[0]), data_size); 117 memcpy(datap, &(data[0]), data_size);
111} 118}
112 119
diff --git a/linden/indra/llmessage/llsdmessagereader.h b/linden/indra/llmessage/llsdmessagereader.h
index 2f824d3..7b38659 100755
--- a/linden/indra/llmessage/llsdmessagereader.h
+++ b/linden/indra/llmessage/llsdmessagereader.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llsdrpcclient.cpp b/linden/indra/llmessage/llsdrpcclient.cpp
index 4b2f069..3f36d23 100644
--- a/linden/indra/llmessage/llsdrpcclient.cpp
+++ b/linden/indra/llmessage/llsdrpcclient.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llsdrpcclient.h b/linden/indra/llmessage/llsdrpcclient.h
index 447af00..7d2d21e 100644
--- a/linden/indra/llmessage/llsdrpcclient.h
+++ b/linden/indra/llmessage/llsdrpcclient.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llsdrpcserver.cpp b/linden/indra/llmessage/llsdrpcserver.cpp
index f81f9a8..0c92e7d 100644
--- a/linden/indra/llmessage/llsdrpcserver.cpp
+++ b/linden/indra/llmessage/llsdrpcserver.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llsdrpcserver.h b/linden/indra/llmessage/llsdrpcserver.h
index dd54ad4..9307323 100644
--- a/linden/indra/llmessage/llsdrpcserver.h
+++ b/linden/indra/llmessage/llsdrpcserver.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llservice.cpp b/linden/indra/llmessage/llservice.cpp
index d9e70dd..9824c19 100644
--- a/linden/indra/llmessage/llservice.cpp
+++ b/linden/indra/llmessage/llservice.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llservice.h b/linden/indra/llmessage/llservice.h
index 0e37221..ab5abe0 100644
--- a/linden/indra/llmessage/llservice.h
+++ b/linden/indra/llmessage/llservice.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llservicebuilder.cpp b/linden/indra/llmessage/llservicebuilder.cpp
index 39f2f85..3f07147 100644
--- a/linden/indra/llmessage/llservicebuilder.cpp
+++ b/linden/indra/llmessage/llservicebuilder.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -85,6 +86,14 @@ void LLServiceBuilder::createServiceDefinition(
85 } 86 }
86} 87}
87 88
89static
90bool starts_with(const std::string& text, const char* prefix)
91{
92 return text.substr(0, strlen(prefix)) == prefix;
93}
94
95// TODO: Build a real services.xml for windows development.
96// and remove the base_url logic below.
88std::string LLServiceBuilder::buildServiceURI(const std::string& service_name) 97std::string LLServiceBuilder::buildServiceURI(const std::string& service_name)
89{ 98{
90 std::ostringstream service_url; 99 std::ostringstream service_url;
@@ -95,7 +104,19 @@ std::string LLServiceBuilder::buildServiceURI(const std::string& service_name)
95 LLApp* app = LLApp::instance(); 104 LLApp* app = LLApp::instance();
96 if(app) 105 if(app)
97 { 106 {
98 LLSD base_url = app->getOption("services-base-url"); 107 // We define a base-url for some development configurations
108 // In production neither of these are defined and all services have full urls
109 LLSD base_url;
110
111 if (starts_with(service_name,"cap"))
112 {
113 base_url = app->getOption("cap-base-url");
114 }
115
116 if (base_url.asString().empty())
117 {
118 base_url = app->getOption("services-base-url");
119 }
99 service_url << base_url.asString(); 120 service_url << base_url.asString();
100 } 121 }
101 service_url << mServiceMap[service_name]; 122 service_url << mServiceMap[service_name];
diff --git a/linden/indra/llmessage/llservicebuilder.h b/linden/indra/llmessage/llservicebuilder.h
index 9b4c925..40061a0 100644
--- a/linden/indra/llmessage/llservicebuilder.h
+++ b/linden/indra/llmessage/llservicebuilder.h
@@ -17,7 +17,8 @@
17* There are special exceptions to the terms and conditions of the GPL as 17* There are special exceptions to the terms and conditions of the GPL as
18* it is applied to this Source Code. View the full text of the exception 18* it is applied to this Source Code. View the full text of the exception
19* in the file doc/FLOSS-exception.txt in this software distribution, or 19* in the file doc/FLOSS-exception.txt in this software distribution, or
20* online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20* online at
21* http://secondlifegrid.net/programs/open_source/licensing/flossexception
21* 22*
22* By copying, modifying or distributing this software, you acknowledge 23* By copying, modifying or distributing this software, you acknowledge
23* that you have read and understood your obligations described above, 24* that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/network.cpp b/linden/indra/llmessage/llstoredmessage.cpp
index a5c5ea4..32cbb15 100644
--- a/linden/indra/llmessage/network.cpp
+++ b/linden/indra/llmessage/llstoredmessage.cpp
@@ -1,10 +1,10 @@
1/** 1/**
2 * @file network.cpp 2 * @file
3 * @brief Legacy file 3 * @brief
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$ 5 * $LicenseInfo:firstyear=2009&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2000-2009, Linden Research, Inc. 7 * Copyright (c) 2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -29,3 +30,9 @@
29 * $/LicenseInfo$ 30 * $/LicenseInfo$
30 */ 31 */
31 32
33#include "llstoredmessage.h"
34
35LLStoredMessage::LLStoredMessage(const std::string& name, const LLSD& message) : mMessage(message), mName(name)
36{
37}
38
diff --git a/linden/indra/llmessage/llstoredmessage.h b/linden/indra/llmessage/llstoredmessage.h
new file mode 100644
index 0000000..5069c2c
--- /dev/null
+++ b/linden/indra/llmessage/llstoredmessage.h
@@ -0,0 +1,58 @@
1/**
2 * @file
3 * @brief
4 *
5 * $LicenseInfo:firstyear=2009&license=viewergpl$
6 *
7 * Copyright (c) 2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#ifndef LL_STOREDMESSAGE_H
34#define LL_STOREDMESSAGE_H
35
36#include "linden_common.h"
37#include "llsd.h"
38#include <boost/shared_ptr.hpp>
39#include <string>
40
41
42class LLMessageSystem;
43
44class LLStoredMessage
45{
46public:
47 LLStoredMessage(const std::string& name, const LLSD& message);
48private:
49 friend class LLMessageSystem;
50
51 LLSD mMessage;
52 std::string mName;
53};
54
55typedef boost::shared_ptr<LLStoredMessage> LLStoredMessagePtr;
56
57
58#endif // LL_STOREDMESSAGE_H
diff --git a/linden/indra/llmessage/lltaskname.h b/linden/indra/llmessage/lltaskname.h
index cae642d..401d355 100644
--- a/linden/indra/llmessage/lltaskname.h
+++ b/linden/indra/llmessage/lltaskname.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llteleportflags.h b/linden/indra/llmessage/llteleportflags.h
index 1eb5a74..c418865 100644
--- a/linden/indra/llmessage/llteleportflags.h
+++ b/linden/indra/llmessage/llteleportflags.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lltemplatemessagebuilder.cpp b/linden/indra/llmessage/lltemplatemessagebuilder.cpp
index 2d8f3cf..e641980 100644
--- a/linden/indra/llmessage/lltemplatemessagebuilder.cpp
+++ b/linden/indra/llmessage/lltemplatemessagebuilder.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -40,7 +41,7 @@
40#include "v3math.h" 41#include "v3math.h"
41#include "v4math.h" 42#include "v4math.h"
42 43
43LLTemplateMessageBuilder::LLTemplateMessageBuilder(message_template_name_map_t& name_template_map) : 44LLTemplateMessageBuilder::LLTemplateMessageBuilder(const message_template_name_map_t& name_template_map) :
44 mCurrentSMessageData(NULL), 45 mCurrentSMessageData(NULL),
45 mCurrentSMessageTemplate(NULL), 46 mCurrentSMessageTemplate(NULL),
46 mCurrentSDataBlock(NULL), 47 mCurrentSDataBlock(NULL),
@@ -74,14 +75,14 @@ void LLTemplateMessageBuilder::newMessage(const char *name)
74 char* namep = (char*)name; 75 char* namep = (char*)name;
75 if (mMessageTemplates.count(namep) > 0) 76 if (mMessageTemplates.count(namep) > 0)
76 { 77 {
77 mCurrentSMessageTemplate = mMessageTemplates[namep]; 78 mCurrentSMessageTemplate = mMessageTemplates.find(name)->second;
78 mCurrentSMessageData = new LLMsgData(namep); 79 mCurrentSMessageData = new LLMsgData(namep);
79 mCurrentSMessageName = namep; 80 mCurrentSMessageName = namep;
80 mCurrentSDataBlock = NULL; 81 mCurrentSDataBlock = NULL;
81 mCurrentSBlockName = NULL; 82 mCurrentSBlockName = NULL;
82 83
83 // add at one of each block 84 // add at one of each block
84 const LLMessageTemplate* msg_template = mMessageTemplates[namep]; 85 const LLMessageTemplate* msg_template = mMessageTemplates.find(name)->second;
85 86
86 if (msg_template->getDeprecation() != MD_NOTDEPRECATED) 87 if (msg_template->getDeprecation() != MD_NOTDEPRECATED)
87 { 88 {
diff --git a/linden/indra/llmessage/lltemplatemessagebuilder.h b/linden/indra/llmessage/lltemplatemessagebuilder.h
index f4048fa..96e7ae1 100644
--- a/linden/indra/llmessage/lltemplatemessagebuilder.h
+++ b/linden/indra/llmessage/lltemplatemessagebuilder.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -48,7 +49,7 @@ public:
48 49
49 typedef std::map<const char* , LLMessageTemplate*> message_template_name_map_t; 50 typedef std::map<const char* , LLMessageTemplate*> message_template_name_map_t;
50 51
51 LLTemplateMessageBuilder(message_template_name_map_t&); 52 LLTemplateMessageBuilder(const message_template_name_map_t&);
52 virtual ~LLTemplateMessageBuilder(); 53 virtual ~LLTemplateMessageBuilder();
53 54
54 virtual void newMessage(const char* name); 55 virtual void newMessage(const char* name);
@@ -98,6 +99,7 @@ public:
98 virtual void copyFromMessageData(const LLMsgData& data); 99 virtual void copyFromMessageData(const LLMsgData& data);
99 virtual void copyFromLLSD(const LLSD&); 100 virtual void copyFromLLSD(const LLSD&);
100 101
102 LLMsgData* getCurrentMessage() const { return mCurrentSMessageData; }
101private: 103private:
102 void addData(const char* varname, const void* data, 104 void addData(const char* varname, const void* data,
103 EMsgVariableType type, S32 size); 105 EMsgVariableType type, S32 size);
@@ -113,7 +115,7 @@ private:
113 BOOL mbSBuilt; 115 BOOL mbSBuilt;
114 BOOL mbSClear; 116 BOOL mbSClear;
115 S32 mCurrentSendTotal; 117 S32 mCurrentSendTotal;
116 message_template_name_map_t& mMessageTemplates; 118 const message_template_name_map_t& mMessageTemplates;
117}; 119};
118 120
119#endif // LL_LLTEMPLATEMESSAGEBUILDER_H 121#endif // LL_LLTEMPLATEMESSAGEBUILDER_H
diff --git a/linden/indra/llmessage/lltemplatemessagedispatcher.cpp b/linden/indra/llmessage/lltemplatemessagedispatcher.cpp
new file mode 100644
index 0000000..ab1beb3
--- /dev/null
+++ b/linden/indra/llmessage/lltemplatemessagedispatcher.cpp
@@ -0,0 +1,73 @@
1/**
2 * @file lltemplatemessagedispatcher.h
3 * @brief LLTemplateMessageDispatcher class
4 *
5 * $LicenseInfo:firstyear=2009&license=viewergpl$
6 *
7 * Copyright (c) 2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33
34#include "lltemplatemessagedispatcher.h"
35
36#include "llhttpnode.h"
37#include "llhost.h"
38#include "message.h"
39#include "llsd.h"
40#include "lltemplatemessagereader.h"
41
42
43LLTemplateMessageDispatcher::LLTemplateMessageDispatcher(LLTemplateMessageReader &template_message_reader) :
44 mTemplateMessageReader(template_message_reader)
45{
46}
47
48void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name,
49 const LLSD& message,
50 LLHTTPNode::ResponsePtr responsep)
51{
52 std::vector<U8> data = message["body"]["binary-template-data"].asBinary();
53 U32 size = data.size();
54 if(size == 0)
55 {
56 return;
57 }
58
59 LLHost host;
60 host = gMessageSystem->getSender();
61
62 bool validate_message = mTemplateMessageReader.validateMessage(&(data[0]), data.size(), host, true);
63
64 if (validate_message)
65 {
66 mTemplateMessageReader.readMessage(&(data[0]),host);
67 }
68 else
69 {
70 gMessageSystem->clearReceiveState();
71 }
72}
73
diff --git a/linden/indra/llmessage/lltemplatemessagedispatcher.h b/linden/indra/llmessage/lltemplatemessagedispatcher.h
new file mode 100644
index 0000000..fa861e4
--- /dev/null
+++ b/linden/indra/llmessage/lltemplatemessagedispatcher.h
@@ -0,0 +1,54 @@
1/**
2 * @file lltemplatemessagedispatcher.h
3 * @brief LLTemplateMessageDispatcher class
4 *
5 * $LicenseInfo:firstyear=2009&license=viewergpl$
6 *
7 * Copyright (c) 2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#ifndef LLTEMPLATEMESSAGEDISPATCHER_H
34#define LLTEMPLATEMESSAGEDISPATCHER_H
35
36#include "linden_common.h"
37#include "llsd.h"
38#include "llhttpnode.h"
39#include "lltemplatemessagereader.h"
40
41
42class LLTemplateMessageDispatcher
43{
44public:
45 LLTemplateMessageDispatcher(LLTemplateMessageReader& template_message_reader);
46 void dispatch(const std::string& msg_name,
47 const LLSD& message,
48 LLHTTPNode::ResponsePtr responsep);
49
50private:
51 LLTemplateMessageReader &mTemplateMessageReader;
52};
53
54#endif // LLTEMPLATEMESSAGEDISPATCHER_H
diff --git a/linden/indra/llmessage/lltemplatemessagereader.cpp b/linden/indra/llmessage/lltemplatemessagereader.cpp
index 7a7d3bb..af04956 100644
--- a/linden/indra/llmessage/lltemplatemessagereader.cpp
+++ b/linden/indra/llmessage/lltemplatemessagereader.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -181,15 +182,15 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname)
181{ 182{
182 // is there a message ready to go? 183 // is there a message ready to go?
183 if (mReceiveSize == -1) 184 if (mReceiveSize == -1)
184 { 185 { // This is a serious error - crash
185 llerrs << "No message waiting for decode 4!" << llendl; 186 llerrs << "No message waiting for decode 4!" << llendl;
186 return -1; 187 return LL_MESSAGE_ERROR;
187 } 188 }
188 189
189 if (!mCurrentRMessageData) 190 if (!mCurrentRMessageData)
190 { 191 { // This is a serious error - crash
191 llerrs << "Invalid mCurrentRMessageData in getData!" << llendl; 192 llerrs << "Invalid mCurrentRMessageData in getData!" << llendl;
192 return -1; 193 return LL_MESSAGE_ERROR;
193 } 194 }
194 195
195 char *bnamep = (char *)blockname; 196 char *bnamep = (char *)blockname;
@@ -197,10 +198,10 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname)
197 LLMsgData::msg_blk_data_map_t::const_iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep); 198 LLMsgData::msg_blk_data_map_t::const_iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep);
198 199
199 if (iter == mCurrentRMessageData->mMemberBlocks.end()) 200 if (iter == mCurrentRMessageData->mMemberBlocks.end())
200 { 201 { // don't crash
201 llerrs << "Block " << bnamep << " not in message " 202 llinfos << "Block " << bnamep << " not in message "
202 << mCurrentRMessageData->mName << llendl; 203 << mCurrentRMessageData->mName << llendl;
203 return -1; 204 return LL_BLOCK_NOT_IN_MESSAGE;
204 } 205 }
205 206
206 char *vnamep = (char *)varname; 207 char *vnamep = (char *)varname;
@@ -209,17 +210,17 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname)
209 LLMsgVarData& vardata = msg_data->mMemberVarData[vnamep]; 210 LLMsgVarData& vardata = msg_data->mMemberVarData[vnamep];
210 211
211 if (!vardata.getName()) 212 if (!vardata.getName())
212 { 213 { // don't crash
213 llerrs << "Variable " << varname << " not in message " 214 llinfos << "Variable " << varname << " not in message "
214 << mCurrentRMessageData->mName << " block " << bnamep << llendl; 215 << mCurrentRMessageData->mName << " block " << bnamep << llendl;
215 return -1; 216 return LL_VARIABLE_NOT_IN_BLOCK;
216 } 217 }
217 218
218 if (mCurrentRMessageTemplate->mMemberBlocks[bnamep]->mType != MBT_SINGLE) 219 if (mCurrentRMessageTemplate->mMemberBlocks[bnamep]->mType != MBT_SINGLE)
219 { 220 { // This is a serious error - crash
220 llerrs << "Block " << bnamep << " isn't type MBT_SINGLE," 221 llerrs << "Block " << bnamep << " isn't type MBT_SINGLE,"
221 " use getSize with blocknum argument!" << llendl; 222 " use getSize with blocknum argument!" << llendl;
222 return -1; 223 return LL_MESSAGE_ERROR;
223 } 224 }
224 225
225 return vardata.getSize(); 226 return vardata.getSize();
@@ -229,15 +230,15 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const
229{ 230{
230 // is there a message ready to go? 231 // is there a message ready to go?
231 if (mReceiveSize == -1) 232 if (mReceiveSize == -1)
232 { 233 { // This is a serious error - crash
233 llerrs << "No message waiting for decode 5!" << llendl; 234 llerrs << "No message waiting for decode 5!" << llendl;
234 return -1; 235 return LL_MESSAGE_ERROR;
235 } 236 }
236 237
237 if (!mCurrentRMessageData) 238 if (!mCurrentRMessageData)
238 { 239 { // This is a serious error - crash
239 llerrs << "Invalid mCurrentRMessageData in getData!" << llendl; 240 llerrs << "Invalid mCurrentRMessageData in getData!" << llendl;
240 return -1; 241 return LL_MESSAGE_ERROR;
241 } 242 }
242 243
243 char *bnamep = (char *)blockname + blocknum; 244 char *bnamep = (char *)blockname + blocknum;
@@ -246,20 +247,20 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const
246 LLMsgData::msg_blk_data_map_t::const_iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep); 247 LLMsgData::msg_blk_data_map_t::const_iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep);
247 248
248 if (iter == mCurrentRMessageData->mMemberBlocks.end()) 249 if (iter == mCurrentRMessageData->mMemberBlocks.end())
249 { 250 { // don't crash
250 llerrs << "Block " << bnamep << " not in message " 251 llinfos << "Block " << bnamep << " not in message "
251 << mCurrentRMessageData->mName << llendl; 252 << mCurrentRMessageData->mName << llendl;
252 return -1; 253 return LL_BLOCK_NOT_IN_MESSAGE;
253 } 254 }
254 255
255 LLMsgBlkData* msg_data = iter->second; 256 LLMsgBlkData* msg_data = iter->second;
256 LLMsgVarData& vardata = msg_data->mMemberVarData[vnamep]; 257 LLMsgVarData& vardata = msg_data->mMemberVarData[vnamep];
257 258
258 if (!vardata.getName()) 259 if (!vardata.getName())
259 { 260 { // don't crash
260 llerrs << "Variable " << vnamep << " not in message " 261 llinfos << "Variable " << vnamep << " not in message "
261 << mCurrentRMessageData->mName << " block " << bnamep << llendl; 262 << mCurrentRMessageData->mName << " block " << bnamep << llendl;
262 return -1; 263 return LL_VARIABLE_NOT_IN_BLOCK;
263 } 264 }
264 265
265 return vardata.getSize(); 266 return vardata.getSize();
@@ -754,18 +755,38 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender
754 755
755BOOL LLTemplateMessageReader::validateMessage(const U8* buffer, 756BOOL LLTemplateMessageReader::validateMessage(const U8* buffer,
756 S32 buffer_size, 757 S32 buffer_size,
757 const LLHost& sender) 758 const LLHost& sender,
759 bool trusted)
758{ 760{
759 mReceiveSize = buffer_size; 761 mReceiveSize = buffer_size;
760 BOOL result = decodeTemplate(buffer, buffer_size, &mCurrentRMessageTemplate ); 762 BOOL valid = decodeTemplate(buffer, buffer_size, &mCurrentRMessageTemplate );
761 if(result) 763 if(valid)
762 { 764 {
763 mCurrentRMessageTemplate->mReceiveCount++; 765 mCurrentRMessageTemplate->mReceiveCount++;
764 //lldebugs << "MessageRecvd:" 766 //lldebugs << "MessageRecvd:"
765 // << mCurrentRMessageTemplate->mName 767 // << mCurrentRMessageTemplate->mName
766 // << " from " << sender << llendl; 768 // << " from " << sender << llendl;
767 } 769 }
768 return result; 770
771 if (valid && isBanned(trusted))
772 {
773 LL_WARNS("Messaging") << "LLMessageSystem::checkMessages "
774 << "received banned message "
775 << getMessageName()
776 << " from "
777 << ((trusted) ? "trusted " : "untrusted ")
778 << sender << llendl;
779 valid = FALSE;
780 }
781
782 if(valid && isUdpBanned())
783 {
784 llwarns << "Received UDP black listed message "
785 << getMessageName()
786 << " from " << sender << llendl;
787 valid = FALSE;
788 }
789 return valid;
769} 790}
770 791
771BOOL LLTemplateMessageReader::readMessage(const U8* buffer, 792BOOL LLTemplateMessageReader::readMessage(const U8* buffer,
diff --git a/linden/indra/llmessage/lltemplatemessagereader.h b/linden/indra/llmessage/lltemplatemessagereader.h
index 15b2a91..ab06ab4 100644
--- a/linden/indra/llmessage/lltemplatemessagereader.h
+++ b/linden/indra/llmessage/lltemplatemessagereader.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -104,7 +105,7 @@ public:
104 virtual void copyToBuilder(LLMessageBuilder&) const; 105 virtual void copyToBuilder(LLMessageBuilder&) const;
105 106
106 BOOL validateMessage(const U8* buffer, S32 buffer_size, 107 BOOL validateMessage(const U8* buffer, S32 buffer_size,
107 const LLHost& sender); 108 const LLHost& sender, bool trusted = false);
108 BOOL readMessage(const U8* buffer, const LLHost& sender); 109 BOOL readMessage(const U8* buffer, const LLHost& sender);
109 110
110 bool isTrusted() const; 111 bool isTrusted() const;
diff --git a/linden/indra/llmessage/llthrottle.cpp b/linden/indra/llmessage/llthrottle.cpp
index 78258f5..70279a3 100644
--- a/linden/indra/llmessage/llthrottle.cpp
+++ b/linden/indra/llmessage/llthrottle.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llthrottle.h b/linden/indra/llmessage/llthrottle.h
index 7e2d024..7d1679b 100644
--- a/linden/indra/llmessage/llthrottle.h
+++ b/linden/indra/llmessage/llthrottle.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lltransfermanager.cpp b/linden/indra/llmessage/lltransfermanager.cpp
index 2c08163..d67911e 100644
--- a/linden/indra/llmessage/lltransfermanager.cpp
+++ b/linden/indra/llmessage/lltransfermanager.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lltransfermanager.h b/linden/indra/llmessage/lltransfermanager.h
index ef5f530..0bb52f1 100644
--- a/linden/indra/llmessage/lltransfermanager.h
+++ b/linden/indra/llmessage/lltransfermanager.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lltransfersourceasset.cpp b/linden/indra/llmessage/lltransfersourceasset.cpp
index b9354ec..a4d5927 100644
--- a/linden/indra/llmessage/lltransfersourceasset.cpp
+++ b/linden/indra/llmessage/lltransfersourceasset.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lltransfersourceasset.h b/linden/indra/llmessage/lltransfersourceasset.h
index e372730..70b09b6 100644
--- a/linden/indra/llmessage/lltransfersourceasset.h
+++ b/linden/indra/llmessage/lltransfersourceasset.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lltransfersourcefile.cpp b/linden/indra/llmessage/lltransfersourcefile.cpp
index 795434a..ec0eaf1 100644
--- a/linden/indra/llmessage/lltransfersourcefile.cpp
+++ b/linden/indra/llmessage/lltransfersourcefile.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lltransfersourcefile.h b/linden/indra/llmessage/lltransfersourcefile.h
index b095b7c..004a3ee 100644
--- a/linden/indra/llmessage/lltransfersourcefile.h
+++ b/linden/indra/llmessage/lltransfersourcefile.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lltransfertargetfile.cpp b/linden/indra/llmessage/lltransfertargetfile.cpp
index 6d1aac5..445e4f1 100644
--- a/linden/indra/llmessage/lltransfertargetfile.cpp
+++ b/linden/indra/llmessage/lltransfertargetfile.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lltransfertargetfile.h b/linden/indra/llmessage/lltransfertargetfile.h
index 52c4ebb..18b9b52 100644
--- a/linden/indra/llmessage/lltransfertargetfile.h
+++ b/linden/indra/llmessage/lltransfertargetfile.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lltransfertargetvfile.cpp b/linden/indra/llmessage/lltransfertargetvfile.cpp
index f6c272e..e9bf2ba 100644
--- a/linden/indra/llmessage/lltransfertargetvfile.cpp
+++ b/linden/indra/llmessage/lltransfertargetvfile.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lltransfertargetvfile.h b/linden/indra/llmessage/lltransfertargetvfile.h
index c1011ca..8c2bc7e 100644
--- a/linden/indra/llmessage/lltransfertargetvfile.h
+++ b/linden/indra/llmessage/lltransfertargetvfile.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lltrustedmessageservice.cpp b/linden/indra/llmessage/lltrustedmessageservice.cpp
new file mode 100644
index 0000000..505ece5
--- /dev/null
+++ b/linden/indra/llmessage/lltrustedmessageservice.cpp
@@ -0,0 +1,90 @@
1/**
2 * @file lltrustedmessageservice.cpp
3 * @brief LLTrustedMessageService implementation
4 *
5 * $LicenseInfo:firstyear=2009&license=viewergpl$
6 *
7 * Copyright (c) 2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "linden_common.h"
34
35#include "lltrustedmessageservice.h"
36#include "llhost.h"
37#include "llmessageconfig.h"
38#include "message.h"
39
40
41bool LLTrustedMessageService::validate(const std::string& name, LLSD& context)
42const
43{
44 return true;
45}
46
47void LLTrustedMessageService::post(LLHTTPNode::ResponsePtr response,
48 const LLSD& context,
49 const LLSD& input) const
50{
51 std::string name = context["request"]["wildcard"]["message-name"];
52 std::string senderIP = context["request"]["remote-host"];
53 std::string senderPort = context["request"]["headers"]
54 ["x-secondlife-udp-listen-port"];
55
56 LLSD message_data;
57 std::string sender = senderIP + ":" + senderPort;
58 message_data["sender"] = sender;
59 message_data["body"] = input;
60
61 // untrusted senders should not have access to the trusted message
62 // service, but this can happen in development, so check and warn
63 LLMessageConfig::SenderTrust trust =
64 LLMessageConfig::getSenderTrustedness(name);
65 if ((trust == LLMessageConfig::TRUSTED ||
66 (trust == LLMessageConfig::NOT_SET &&
67 gMessageSystem->isTrustedMessage(name)))
68 && !gMessageSystem->isTrustedSender(LLHost(sender)))
69 {
70 LL_WARNS("Messaging") << "trusted message POST to /trusted-message/"
71 << name << " from unknown or untrusted sender "
72 << sender << llendl;
73 response->status(403, "Unknown or untrusted sender");
74 }
75 else
76 {
77 gMessageSystem->receivedMessageFromTrustedSender();
78 if (input.has("binary-template-data"))
79 {
80 llinfos << "Dispatching template: " << input << llendl;
81 // try and send this message using udp dispatch
82 LLMessageSystem::dispatchTemplate(name, message_data, response);
83 }
84 else
85 {
86 llinfos << "Dispatching without template: " << input << llendl;
87 LLMessageSystem::dispatch(name, message_data, response);
88 }
89 }
90}
diff --git a/linden/indra/llmessage/lltrustedmessageservice.h b/linden/indra/llmessage/lltrustedmessageservice.h
new file mode 100644
index 0000000..dc37702
--- /dev/null
+++ b/linden/indra/llmessage/lltrustedmessageservice.h
@@ -0,0 +1,52 @@
1/**
2 * @file lltrustedmessageservice.h
3 * @brief LLTrustedMessageService class
4 *
5 * $LicenseInfo:firstyear=2009&license=viewergpl$
6 *
7 * Copyright (c) 2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#ifndef LLTRUSTEDMESSAGESERVICE_H
34#define LLTRUSTEDMESSAGESERVICE_H
35
36#include "linden_common.h"
37#include "llhttpnode.h"
38
39class LLSD;
40
41class LLTrustedMessageService
42{
43public:
44
45 bool validate(const std::string& name, LLSD& context) const;
46
47 void post(LLHTTPNode::ResponsePtr response,
48 const LLSD& context,
49 const LLSD& input) const;
50};
51
52#endif // LLTRUSTEDMESSAGESERVICE_H
diff --git a/linden/indra/llmessage/llurlrequest.cpp b/linden/indra/llmessage/llurlrequest.cpp
index d2f854e..46e976f 100644
--- a/linden/indra/llmessage/llurlrequest.cpp
+++ b/linden/indra/llmessage/llurlrequest.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -43,7 +44,7 @@
43#include "llsd.h" 44#include "llsd.h"
44#include "llstring.h" 45#include "llstring.h"
45#include "apr_env.h" 46#include "apr_env.h"
46 47#include "llapr.h"
47static const U32 HTTP_STATUS_PIPE_ERROR = 499; 48static const U32 HTTP_STATUS_PIPE_ERROR = 499;
48 49
49/** 50/**
@@ -165,18 +166,16 @@ void LLURLRequest::useProxy(bool use_proxy)
165 if (use_proxy && (env_proxy == NULL)) 166 if (use_proxy && (env_proxy == NULL))
166 { 167 {
167 apr_status_t status; 168 apr_status_t status;
168 apr_pool_t* pool; 169 LLAPRPool pool;
169 apr_pool_create(&pool, NULL); 170 status = apr_env_get(&env_proxy, "ALL_PROXY", pool.getAPRPool());
170 status = apr_env_get(&env_proxy, "ALL_PROXY", pool);
171 if (status != APR_SUCCESS) 171 if (status != APR_SUCCESS)
172 { 172 {
173 status = apr_env_get(&env_proxy, "http_proxy", pool); 173 status = apr_env_get(&env_proxy, "http_proxy", pool.getAPRPool());
174 } 174 }
175 if (status != APR_SUCCESS) 175 if (status != APR_SUCCESS)
176 { 176 {
177 use_proxy = FALSE; 177 use_proxy = FALSE;
178 } 178 }
179 apr_pool_destroy(pool);
180 } 179 }
181 180
182 181
@@ -501,33 +500,25 @@ static size_t headerCallback(void* data, size_t size, size_t nmemb, void* user)
501 std::string header(header_line, header_len); 500 std::string header(header_line, header_len);
502 501
503 // Per HTTP spec the first header line must be the status line. 502 // Per HTTP spec the first header line must be the status line.
504 if (!complete->haveHTTPStatus()) 503 if (header.substr(0,5) == "HTTP/")
505 { 504 {
506 if (header.substr(0,5) == "HTTP/") 505 std::string::iterator end = header.end();
506 std::string::iterator pos1 = std::find(header.begin(), end, ' ');
507 if (pos1 != end) ++pos1;
508 std::string::iterator pos2 = std::find(pos1, end, ' ');
509 if (pos2 != end) ++pos2;
510 std::string::iterator pos3 = std::find(pos2, end, '\r');
511
512 std::string version(header.begin(), pos1);
513 std::string status(pos1, pos2);
514 std::string reason(pos2, pos3);
515
516 S32 status_code = atoi(status.c_str());
517 if (status_code > 0)
507 { 518 {
508 std::string::iterator end = header.end(); 519 complete->httpStatus((U32)status_code, reason);
509 std::string::iterator pos1 = std::find(header.begin(), end, ' '); 520 return header_len;
510 if (pos1 != end) ++pos1;
511 std::string::iterator pos2 = std::find(pos1, end, ' ');
512 if (pos2 != end) ++pos2;
513 std::string::iterator pos3 = std::find(pos2, end, '\r');
514
515 std::string version(header.begin(), pos1);
516 std::string status(pos1, pos2);
517 std::string reason(pos2, pos3);
518
519 int statusCode = atoi(status.c_str());
520 if (statusCode >= 300 && statusCode < 400)
521 {
522 // This is a redirect, ignore it and all headers
523 // until we find a normal status code.
524 }
525 else if (statusCode > 0)
526 {
527 complete->httpStatus((U32)statusCode, reason);
528 }
529 } 521 }
530 return header_len;
531 } 522 }
532 523
533 std::string::iterator sep = std::find(header.begin(),header.end(),':'); 524 std::string::iterator sep = std::find(header.begin(),header.end(),':');
@@ -592,8 +583,7 @@ LLIOPipe::EStatus LLContextURLExtractor::process_impl(
592 * LLURLRequestComplete 583 * LLURLRequestComplete
593 */ 584 */
594LLURLRequestComplete::LLURLRequestComplete() : 585LLURLRequestComplete::LLURLRequestComplete() :
595 mRequestStatus(LLIOPipe::STATUS_ERROR), 586 mRequestStatus(LLIOPipe::STATUS_ERROR)
596 mHaveHTTPStatus(false)
597{ 587{
598 LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST); 588 LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
599} 589}
@@ -610,12 +600,6 @@ void LLURLRequestComplete::header(const std::string& header, const std::string&
610} 600}
611 601
612//virtual 602//virtual
613void LLURLRequestComplete::httpStatus(U32 status, const std::string& reason)
614{
615 mHaveHTTPStatus = true;
616}
617
618//virtual
619void LLURLRequestComplete::complete(const LLChannelDescriptors& channels, 603void LLURLRequestComplete::complete(const LLChannelDescriptors& channels,
620 const buffer_ptr_t& buffer) 604 const buffer_ptr_t& buffer)
621{ 605{
diff --git a/linden/indra/llmessage/llurlrequest.h b/linden/indra/llmessage/llurlrequest.h
index c76eec8..d1facbf 100644
--- a/linden/indra/llmessage/llurlrequest.h
+++ b/linden/indra/llmessage/llurlrequest.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -286,11 +287,13 @@ class LLURLRequestComplete : public LLIOPipe
286{ 287{
287public: 288public:
288 289
290 // Called once for each header received, except status lines
289 virtual void header(const std::string& header, const std::string& value); 291 virtual void header(const std::string& header, const std::string& value);
290 ///< Called once for each header received, prior to httpStatus
291 292
292 virtual void httpStatus(U32 status, const std::string& reason); 293 // May be called more than once, particularly for redirects and proxy madness.
293 ///< Always called on request completion, prior to complete 294 // Ex. a 200 for a connection to https through a proxy, followed by the "real" status
295 // a 3xx for a redirect followed by a "real" status, or more redirects.
296 virtual void httpStatus(U32 status, const std::string& reason) { }
294 297
295 virtual void complete( 298 virtual void complete(
296 const LLChannelDescriptors& channels, 299 const LLChannelDescriptors& channels,
@@ -327,9 +330,6 @@ public:
327 LLURLRequestComplete(); 330 LLURLRequestComplete();
328 virtual ~LLURLRequestComplete(); 331 virtual ~LLURLRequestComplete();
329 332
330 // The first line of an http response must be the status line
331 // true if we have already parsed this line.
332 bool haveHTTPStatus() const { return mHaveHTTPStatus; }
333protected: 333protected:
334 /* @name LLIOPipe virtual implementations 334 /* @name LLIOPipe virtual implementations
335 */ 335 */
@@ -348,8 +348,6 @@ protected:
348 // value to note if we actually got the response. This value 348 // value to note if we actually got the response. This value
349 // depends on correct useage from the LLURLRequest instance. 349 // depends on correct useage from the LLURLRequest instance.
350 EStatus mRequestStatus; 350 EStatus mRequestStatus;
351
352 bool mHaveHTTPStatus;
353}; 351};
354 352
355 353
diff --git a/linden/indra/llmessage/lluseroperation.cpp b/linden/indra/llmessage/lluseroperation.cpp
index 4d34e48..9736efe 100644
--- a/linden/indra/llmessage/lluseroperation.cpp
+++ b/linden/indra/llmessage/lluseroperation.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/lluseroperation.h b/linden/indra/llmessage/lluseroperation.h
index 814e6bf..b3988c0 100644
--- a/linden/indra/llmessage/lluseroperation.h
+++ b/linden/indra/llmessage/lluseroperation.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llvehicleparams.h b/linden/indra/llmessage/llvehicleparams.h
index d37a83f..a839171 100644
--- a/linden/indra/llmessage/llvehicleparams.h
+++ b/linden/indra/llmessage/llvehicleparams.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llxfer.cpp b/linden/indra/llmessage/llxfer.cpp
index 6fdd399..8404f65 100644
--- a/linden/indra/llmessage/llxfer.cpp
+++ b/linden/indra/llmessage/llxfer.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llxfer.h b/linden/indra/llmessage/llxfer.h
index 85b3122..bd81462 100644
--- a/linden/indra/llmessage/llxfer.h
+++ b/linden/indra/llmessage/llxfer.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llxfer_file.cpp b/linden/indra/llmessage/llxfer_file.cpp
index c7bab07..80bea37 100644
--- a/linden/indra/llmessage/llxfer_file.cpp
+++ b/linden/indra/llmessage/llxfer_file.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llxfer_file.h b/linden/indra/llmessage/llxfer_file.h
index 0b3ee79..df29135 100644
--- a/linden/indra/llmessage/llxfer_file.h
+++ b/linden/indra/llmessage/llxfer_file.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llxfer_mem.cpp b/linden/indra/llmessage/llxfer_mem.cpp
index 64889a2..0d81fd5 100644
--- a/linden/indra/llmessage/llxfer_mem.cpp
+++ b/linden/indra/llmessage/llxfer_mem.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llxfer_mem.h b/linden/indra/llmessage/llxfer_mem.h
index b98e8e9..fa1b4cf 100644
--- a/linden/indra/llmessage/llxfer_mem.h
+++ b/linden/indra/llmessage/llxfer_mem.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llxfer_vfile.cpp b/linden/indra/llmessage/llxfer_vfile.cpp
index 288c5ff..625cf4a 100644
--- a/linden/indra/llmessage/llxfer_vfile.cpp
+++ b/linden/indra/llmessage/llxfer_vfile.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llxfer_vfile.h b/linden/indra/llmessage/llxfer_vfile.h
index e07326f..8f5b193 100644
--- a/linden/indra/llmessage/llxfer_vfile.h
+++ b/linden/indra/llmessage/llxfer_vfile.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llxfermanager.cpp b/linden/indra/llmessage/llxfermanager.cpp
index eea814c..08c9192 100644
--- a/linden/indra/llmessage/llxfermanager.cpp
+++ b/linden/indra/llmessage/llxfermanager.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llxfermanager.h b/linden/indra/llmessage/llxfermanager.h
index 1022bbe..0a83f84 100644
--- a/linden/indra/llmessage/llxfermanager.h
+++ b/linden/indra/llmessage/llxfermanager.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llxorcipher.cpp b/linden/indra/llmessage/llxorcipher.cpp
index 7b1c7af..fbcd893 100644
--- a/linden/indra/llmessage/llxorcipher.cpp
+++ b/linden/indra/llmessage/llxorcipher.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/llxorcipher.h b/linden/indra/llmessage/llxorcipher.h
index 434c88d..ef2bfd6 100644
--- a/linden/indra/llmessage/llxorcipher.h
+++ b/linden/indra/llmessage/llxorcipher.h
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/machine.h b/linden/indra/llmessage/machine.h
index 212334e..63a0381 100644
--- a/linden/indra/llmessage/machine.h
+++ b/linden/indra/llmessage/machine.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/mean_collision_data.h b/linden/indra/llmessage/mean_collision_data.h
index c7df839..03b96f9 100644
--- a/linden/indra/llmessage/mean_collision_data.h
+++ b/linden/indra/llmessage/mean_collision_data.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/message.cpp b/linden/indra/llmessage/message.cpp
index ccc3d79..78af35b 100644
--- a/linden/indra/llmessage/message.cpp
+++ b/linden/indra/llmessage/message.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -58,13 +59,16 @@
58#include "llerrorlegacy.h" 59#include "llerrorlegacy.h"
59#include "llfasttimer.h" 60#include "llfasttimer.h"
60#include "llhttpclient.h" 61#include "llhttpclient.h"
62#include "llhttpnodeadapter.h"
61#include "llhttpsender.h" 63#include "llhttpsender.h"
62#include "llmd5.h" 64#include "llmd5.h"
63#include "llmessagebuilder.h" 65#include "llmessagebuilder.h"
64#include "llmessageconfig.h" 66#include "llmessageconfig.h"
67#include "lltemplatemessagedispatcher.h"
65#include "llpumpio.h" 68#include "llpumpio.h"
66#include "lltemplatemessagebuilder.h" 69#include "lltemplatemessagebuilder.h"
67#include "lltemplatemessagereader.h" 70#include "lltemplatemessagereader.h"
71#include "lltrustedmessageservice.h"
68#include "llmessagetemplate.h" 72#include "llmessagetemplate.h"
69#include "llmessagetemplateparser.h" 73#include "llmessagetemplateparser.h"
70#include "llsd.h" 74#include "llsd.h"
@@ -141,52 +145,6 @@ namespace
141 }; 145 };
142} 146}
143 147
144
145class LLTrustedMessageService : public LLHTTPNode
146{
147 virtual bool validate(const std::string& name, LLSD& context) const
148 { return true; }
149
150 virtual void post(LLHTTPNode::ResponsePtr response,
151 const LLSD& context,
152 const LLSD& input) const;
153};
154
155//virtual
156void LLTrustedMessageService::post(LLHTTPNode::ResponsePtr response,
157 const LLSD& context,
158 const LLSD& input) const
159{
160 std::string name = context["request"]["wildcard"]["message-name"];
161 std::string senderIP = context["request"]["remote-host"];
162 std::string senderPort = context["request"]["headers"]
163 ["x-secondlife-udp-listen-port"];
164
165 LLSD message_data;
166 std::string sender = senderIP + ":" + senderPort;
167 message_data["sender"] = sender;
168 message_data["body"] = input;
169
170 // untrusted senders should not have access to the trusted message
171 // service, but this can happen in development, so check and warn
172 LLMessageConfig::SenderTrust trust =
173 LLMessageConfig::getSenderTrustedness(name);
174 if ((trust == LLMessageConfig::TRUSTED ||
175 (trust == LLMessageConfig::NOT_SET &&
176 gMessageSystem->isTrustedMessage(name)))
177 && !gMessageSystem->isTrustedSender(LLHost(sender)))
178 {
179 LL_WARNS("Messaging") << "trusted message POST to /trusted-message/"
180 << name << " from unknown or untrusted sender "
181 << sender << llendl;
182 response->status(403, "Unknown or untrusted sender");
183 }
184 else
185 {
186 LLMessageSystem::dispatch(name, message_data, response);
187 }
188}
189
190class LLMessageHandlerBridge : public LLHTTPNode 148class LLMessageHandlerBridge : public LLHTTPNode
191{ 149{
192 virtual bool validate(const std::string& name, LLSD& context) const 150 virtual bool validate(const std::string& name, LLSD& context) const
@@ -222,9 +180,6 @@ void LLMessageHandlerBridge::post(LLHTTPNode::ResponsePtr response,
222LLHTTPRegistration<LLMessageHandlerBridge> 180LLHTTPRegistration<LLMessageHandlerBridge>
223 gHTTPRegistrationMessageWildcard("/message/<message-name>"); 181 gHTTPRegistrationMessageWildcard("/message/<message-name>");
224 182
225LLHTTPRegistration<LLTrustedMessageService>
226 gHTTPRegistrationTrustedMessageWildcard("/trusted-message/<message-name>");
227
228//virtual 183//virtual
229LLUseCircuitCodeResponder::~LLUseCircuitCodeResponder() 184LLUseCircuitCodeResponder::~LLUseCircuitCodeResponder()
230{ 185{
@@ -290,7 +245,10 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
290 S32 version_major, 245 S32 version_major,
291 S32 version_minor, 246 S32 version_minor,
292 S32 version_patch, 247 S32 version_patch,
293 bool failure_is_fatal) 248 bool failure_is_fatal,
249 const F32 circuit_heartbeat_interval, const F32 circuit_timeout) :
250 mCircuitInfo(circuit_heartbeat_interval, circuit_timeout),
251 mLastMessageFromTrustedMessageService(false)
294{ 252{
295 init(); 253 init();
296 254
@@ -303,6 +261,9 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
303 // default to not accepting packets from not alive circuits 261 // default to not accepting packets from not alive circuits
304 mbProtected = TRUE; 262 mbProtected = TRUE;
305 263
264 // default to blocking trusted connections on a public interface if one is specified
265 mBlockUntrustedInterface = true;
266
306 mSendPacketFailureCount = 0; 267 mSendPacketFailureCount = 0;
307 268
308 mCircuitPrintFreq = 60.f; // seconds 269 mCircuitPrintFreq = 60.f; // seconds
@@ -437,7 +398,9 @@ void LLMessageSystem::clearReceiveState()
437 mCurrentRecvPacketID = 0; 398 mCurrentRecvPacketID = 0;
438 mIncomingCompressedSize = 0; 399 mIncomingCompressedSize = 0;
439 mLastSender.invalidate(); 400 mLastSender.invalidate();
401 mLastReceivingIF.invalidate();
440 mMessageReader->clearMessage(); 402 mMessageReader->clearMessage();
403 mLastMessageFromTrustedMessageService = false;
441} 404}
442 405
443 406
@@ -470,6 +433,17 @@ bool LLMessageSystem::isTrustedSender(const LLHost& host) const
470 return cdp->getTrusted(); 433 return cdp->getTrusted();
471} 434}
472 435
436void LLMessageSystem::receivedMessageFromTrustedSender()
437{
438 mLastMessageFromTrustedMessageService = true;
439}
440
441bool LLMessageSystem::isTrustedSender() const
442{
443 return mLastMessageFromTrustedMessageService ||
444 isTrustedSender(getSender());
445}
446
473static LLMessageSystem::message_template_name_map_t::const_iterator 447static LLMessageSystem::message_template_name_map_t::const_iterator
474findTemplate(const LLMessageSystem::message_template_name_map_t& templates, 448findTemplate(const LLMessageSystem::message_template_name_map_t& templates,
475 std::string name) 449 std::string name)
@@ -586,6 +560,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
586 560
587 receive_size = mTrueReceiveSize; 561 receive_size = mTrueReceiveSize;
588 mLastSender = mPacketRing.getLastSender(); 562 mLastSender = mPacketRing.getLastSender();
563 mLastReceivingIF = mPacketRing.getLastReceivingInterface();
589 564
590 if (receive_size < (S32) LL_MINIMUM_VALID_PACKET_SIZE) 565 if (receive_size < (S32) LL_MINIMUM_VALID_PACKET_SIZE)
591 { 566 {
@@ -709,11 +684,16 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
709 // UseCircuitCode can be a valid, off-circuit packet. 684 // UseCircuitCode can be a valid, off-circuit packet.
710 // But we don't want to acknowledge UseCircuitCode until the circuit is 685 // But we don't want to acknowledge UseCircuitCode until the circuit is
711 // available, which is why the acknowledgement test is done above. JC 686 // available, which is why the acknowledgement test is done above. JC
712 687 bool trusted = cdp && cdp->getTrusted();
713 valid_packet = mTemplateMessageReader->validateMessage( 688 valid_packet = mTemplateMessageReader->validateMessage(
714 buffer, 689 buffer,
715 receive_size, 690 receive_size,
716 host); 691 host,
692 trusted);
693 if (!valid_packet)
694 {
695 clearReceiveState();
696 }
717 697
718 // UseCircuitCode is allowed in even from an invalid circuit, so that 698 // UseCircuitCode is allowed in even from an invalid circuit, so that
719 // we can toss circuits around. 699 // we can toss circuits around.
@@ -741,29 +721,6 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
741 valid_packet = FALSE; 721 valid_packet = FALSE;
742 } 722 }
743 723
744 if (
745 valid_packet &&
746 mTemplateMessageReader->isBanned(cdp && cdp->getTrusted()))
747 {
748 LL_WARNS("Messaging") << "LLMessageSystem::checkMessages "
749 << "received banned message "
750 << mTemplateMessageReader->getMessageName()
751 << " from "
752 << ((cdp && cdp->getTrusted()) ? "trusted " : "untrusted ")
753 << host << llendl;
754 clearReceiveState();
755 valid_packet = FALSE;
756 }
757
758 if( valid_packet && mTemplateMessageReader->isUdpBanned())
759 {
760 llwarns << "Received UDP black listed message "
761 << mTemplateMessageReader->getMessageName()
762 << " from " << host << llendl;
763 clearReceiveState();
764 valid_packet = FALSE;
765 }
766
767 if( valid_packet ) 724 if( valid_packet )
768 { 725 {
769 logValidMsg(cdp, host, recv_reliable, recv_resent, (BOOL)(acks>0) ); 726 logValidMsg(cdp, host, recv_reliable, recv_resent, (BOOL)(acks>0) );
@@ -776,94 +733,6 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
776 733
777 if (valid_packet) 734 if (valid_packet)
778 { 735 {
779 // enable this for output of message names
780 //LL_INFOS("Messaging") << "< \"" << mTemplateMessageReader->getMessageName()
781 //<< "\"" << llendl;
782
783 /* Code for dumping the complete contents of a message. Keep for future use in optimizing messages.
784 if( 1 )
785 {
786 static char* object_update = LLMessageStringTable::getInstance()->getString("ObjectUpdate");
787 if(object_update == mTemplateMessageReader->getMessageName() )
788 {
789 LL_INFOS("Messaging") << "ObjectUpdate:" << llendl;
790 U32 i;
791 LL_INFOS("Messaging") << " Zero Encoded: " << zero_unexpanded_size << llendl;
792 for( i = 0; i<zero_unexpanded_size; i++ )
793 {
794 LL_INFOS("Messaging") << " " << i << ": " << (U32) zero_unexpanded_buffer[i] << llendl;
795 }
796 LL_INFOS("Messaging") << "" << llendl;
797
798 LL_INFOS("Messaging") << " Zero Unencoded: " << receive_size << llendl;
799 for( i = 0; i<receive_size; i++ )
800 {
801 LL_INFOS("Messaging") << " " << i << ": " << (U32) buffer[i] << llendl;
802 }
803 LL_INFOS("Messaging") << "" << llendl;
804
805 LL_INFOS("Messaging") << " Blocks and variables: " << llendl;
806 S32 byte_count = 0;
807 for (LLMessageTemplate::message_block_map_t::iterator
808 iter = mCurrentRMessageTemplate->mMemberBlocks.begin(),
809 end = mCurrentRMessageTemplate->mMemberBlocks.end();
810 iter != end; iter++)
811 {
812 LLMessageBlock* block = iter->second;
813 const char* block_name = block->mName;
814 for (LLMsgBlkData::msg_var_data_map_t::iterator
815 iter = block->mMemberVariables.begin(),
816 end = block->mMemberVariables.end();
817 iter != end; iter++)
818 {
819 const char* var_name = iter->first;
820
821 if( getNumberOfBlocksFast( block_name ) < 1 )
822 {
823 LL_INFOS("Messaging") << var_name << " has no blocks" << llendl;
824 }
825 for( S32 blocknum = 0; blocknum < getNumberOfBlocksFast( block_name ); blocknum++ )
826 {
827 char *bnamep = (char *)block_name + blocknum; // this works because it's just a hash. The bnamep is never derefference
828 char *vnamep = (char *)var_name;
829
830 LLMsgBlkData *msg_block_data = mCurrentRMessageData->mMemberBlocks[bnamep];
831
832 if (!msg_block_data)
833 {
834 std::string errmsg = llformat("Block %s #%d not in message %s", block_name, blocknum, mCurrentRMessageData->mName);
835 LL_ERRS("Messaging") << errmsg << llendl;
836 }
837
838 LLMsgVarData vardata = msg_block_data->mMemberVarData[vnamep];
839
840 if (!vardata.getName())
841 {
842 std::string errmsg = llformat("Variable %s not in message %s block %s", vnamep, mCurrentRMessageData->mName, bnamep);
843 LL_ERRS("Messaging") << errmsg << llendl;
844 }
845
846 const S32 vardata_size = vardata.getSize();
847 if( vardata_size )
848 {
849 for( i = 0; i < vardata_size; i++ )
850 {
851 byte_count++;
852 LL_INFOS("Messaging") << block_name << " " << var_name << " [" << blocknum << "][" << i << "]= " << (U32)(((U8*)vardata.getData())[i]) << llendl;
853 }
854 }
855 else
856 {
857 LL_INFOS("Messaging") << block_name << " " << var_name << " [" << blocknum << "] 0 bytes" << llendl;
858 }
859 }
860 }
861 }
862 LL_INFOS("Messaging") << "Byte count =" << byte_count << llendl;
863 }
864 }
865 */
866
867 mPacketsIn++; 736 mPacketsIn++;
868 mBytesIn += mTrueReceiveSize; 737 mBytesIn += mTrueReceiveSize;
869 738
@@ -891,9 +760,6 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
891 mInvalidOnCircuitPackets++; 760 mInvalidOnCircuitPackets++;
892 } 761 }
893 } 762 }
894
895 // Code for dumping the complete contents of a message
896 // delete [] zero_unexpanded_buffer;
897 } 763 }
898 } while (!valid_packet && receive_size > 0); 764 } while (!valid_packet && receive_size > 0);
899 765
@@ -996,7 +862,7 @@ void LLMessageSystem::processAcks()
996 } 862 }
997} 863}
998 864
999void LLMessageSystem::copyMessageRtoS() 865void LLMessageSystem::copyMessageReceivedToSend()
1000{ 866{
1001 // NOTE: babbage: switch builder to match reader to avoid 867 // NOTE: babbage: switch builder to match reader to avoid
1002 // converting message format 868 // converting message format
@@ -1013,6 +879,94 @@ void LLMessageSystem::copyMessageRtoS()
1013 mMessageReader->copyToBuilder(*mMessageBuilder); 879 mMessageReader->copyToBuilder(*mMessageBuilder);
1014} 880}
1015 881
882LLSD LLMessageSystem::getReceivedMessageLLSD() const
883{
884 LLSDMessageBuilder builder;
885 mMessageReader->copyToBuilder(builder);
886 return builder.getMessage();
887}
888
889LLSD LLMessageSystem::getBuiltMessageLLSD() const
890{
891 LLSD result;
892 if (mLLSDMessageBuilder == mMessageBuilder)
893 {
894 result = mLLSDMessageBuilder->getMessage();
895 }
896 else
897 {
898 // TODO: implement as below?
899 llerrs << "Message not built as LLSD." << llendl;
900 }
901 return result;
902}
903
904LLSD LLMessageSystem::wrapReceivedTemplateData() const
905{
906 if(mMessageReader == mTemplateMessageReader)
907 {
908 LLTemplateMessageBuilder builder(mMessageTemplates);
909 builder.newMessage(mMessageReader->getMessageName());
910 mMessageReader->copyToBuilder(builder);
911 U8 buffer[MAX_BUFFER_SIZE];
912 const U8 offset_to_data = 0;
913 U32 size = builder.buildMessage(buffer, MAX_BUFFER_SIZE,
914 offset_to_data);
915 std::vector<U8> binary_data(buffer, buffer+size);
916 LLSD wrapped_data = LLSD::emptyMap();
917 wrapped_data["binary-template-data"] = binary_data;
918 return wrapped_data;
919 }
920 else
921 {
922 return getReceivedMessageLLSD();
923 }
924}
925
926LLSD LLMessageSystem::wrapBuiltTemplateData() const
927{
928 LLSD result;
929 if (mLLSDMessageBuilder == mMessageBuilder)
930 {
931 result = getBuiltMessageLLSD();
932 }
933 else
934 {
935 U8 buffer[MAX_BUFFER_SIZE];
936 const U8 offset_to_data = 0;
937 U32 size = mTemplateMessageBuilder->buildMessage(
938 buffer, MAX_BUFFER_SIZE,
939 offset_to_data);
940 std::vector<U8> binary_data(buffer, buffer+size);
941 LLSD wrapped_data = LLSD::emptyMap();
942 wrapped_data["binary-template-data"] = binary_data;
943 result = wrapped_data;
944 }
945 return result;
946}
947
948LLStoredMessagePtr LLMessageSystem::getReceivedMessage() const
949{
950 const std::string& name = mMessageReader->getMessageName();
951 LLSD message = wrapReceivedTemplateData();
952
953 return LLStoredMessagePtr(new LLStoredMessage(name, message));
954}
955
956LLStoredMessagePtr LLMessageSystem::getBuiltMessage() const
957{
958 const std::string& name = mMessageBuilder->getMessageName();
959 LLSD message = wrapBuiltTemplateData();
960
961 return LLStoredMessagePtr(new LLStoredMessage(name, message));
962}
963
964S32 LLMessageSystem::sendMessage(const LLHost &host, LLStoredMessagePtr message)
965{
966 return sendMessage(host, message->mName.c_str(), message->mMessage);
967}
968
969
1016void LLMessageSystem::clearMessage() 970void LLMessageSystem::clearMessage()
1017{ 971{
1018 mSendReliable = FALSE; 972 mSendReliable = FALSE;
@@ -1025,6 +979,11 @@ void LLMessageSystem::nextBlockFast(const char *blockname)
1025 mMessageBuilder->nextBlock(blockname); 979 mMessageBuilder->nextBlock(blockname);
1026} 980}
1027 981
982void LLMessageSystem::nextBlock(const char *blockname)
983{
984 nextBlockFast(LLMessageStringTable::getInstance()->getString(blockname));
985}
986
1028BOOL LLMessageSystem::isSendFull(const char* blockname) 987BOOL LLMessageSystem::isSendFull(const char* blockname)
1029{ 988{
1030 char* stringTableName = NULL; 989 char* stringTableName = NULL;
@@ -1104,19 +1063,19 @@ S32 LLMessageSystem::sendReliable( const LLHost &host,
1104 1063
1105void LLMessageSystem::forwardMessage(const LLHost &host) 1064void LLMessageSystem::forwardMessage(const LLHost &host)
1106{ 1065{
1107 copyMessageRtoS(); 1066 copyMessageReceivedToSend();
1108 sendMessage(host); 1067 sendMessage(host);
1109} 1068}
1110 1069
1111void LLMessageSystem::forwardReliable(const LLHost &host) 1070void LLMessageSystem::forwardReliable(const LLHost &host)
1112{ 1071{
1113 copyMessageRtoS(); 1072 copyMessageReceivedToSend();
1114 sendReliable(host); 1073 sendReliable(host);
1115} 1074}
1116 1075
1117void LLMessageSystem::forwardReliable(const U32 circuit_code) 1076void LLMessageSystem::forwardReliable(const U32 circuit_code)
1118{ 1077{
1119 copyMessageRtoS(); 1078 copyMessageReceivedToSend();
1120 sendReliable(findHost(circuit_code)); 1079 sendReliable(findHost(circuit_code));
1121} 1080}
1122 1081
@@ -1127,7 +1086,7 @@ S32 LLMessageSystem::forwardReliable( const LLHost &host,
1127 void (*callback)(void **,S32), 1086 void (*callback)(void **,S32),
1128 void ** callback_data) 1087 void ** callback_data)
1129{ 1088{
1130 copyMessageRtoS(); 1089 copyMessageReceivedToSend();
1131 return sendReliable(host, retries, ping_based_timeout, timeout, callback, callback_data); 1090 return sendReliable(host, retries, ping_based_timeout, timeout, callback, callback_data);
1132} 1091}
1133 1092
@@ -1194,7 +1153,7 @@ LLHTTPClient::ResponderPtr LLMessageSystem::createResponder(const std::string& n
1194 return new LLFnPtrResponder( 1153 return new LLFnPtrResponder(
1195 NULL, 1154 NULL,
1196 NULL, 1155 NULL,
1197 mMessageBuilder->getMessageName()); 1156 name);
1198 } 1157 }
1199} 1158}
1200 1159
@@ -1455,13 +1414,6 @@ S32 LLMessageSystem::sendMessage(
1455 LL_WARNS("Messaging") << "trying to send message to invalid host" << llendl; 1414 LL_WARNS("Messaging") << "trying to send message to invalid host" << llendl;
1456 return 0; 1415 return 0;
1457 } 1416 }
1458 newMessage(name);
1459 if (mMessageBuilder != mLLSDMessageBuilder)
1460 {
1461 LL_WARNS("Messaging") << "trying to send llsd message when builder is not LLSD!"
1462 << llendl;
1463 return 0;
1464 }
1465 1417
1466 const LLHTTPSender& sender = LLHTTPSender::getSender(host); 1418 const LLHTTPSender& sender = LLHTTPSender::getSender(host);
1467 sender.send(host, name, message, createResponder(name)); 1419 sender.send(host, name, message, createResponder(name));
@@ -2170,6 +2122,15 @@ void LLMessageSystem::dispatch(
2170 handler->post(responsep, context, message); 2122 handler->post(responsep, context, message);
2171} 2123}
2172 2124
2125//static
2126void LLMessageSystem::dispatchTemplate(const std::string& msg_name,
2127 const LLSD& message,
2128 LLHTTPNode::ResponsePtr responsep)
2129{
2130 LLTemplateMessageDispatcher dispatcher(*(gMessageSystem->mTemplateMessageReader));
2131 dispatcher.dispatch(msg_name, message, responsep);
2132}
2133
2173static void check_for_unrecognized_messages( 2134static void check_for_unrecognized_messages(
2174 const char* type, 2135 const char* type,
2175 const LLSD& map, 2136 const LLSD& map,
@@ -2352,6 +2313,23 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
2352 return; 2313 return;
2353 } 2314 }
2354 2315
2316 U32 untrusted_interface = msg->getUntrustedInterface().getAddress();
2317 U32 last_interface = msg->getReceivingInterface().getAddress();
2318 if ( ( untrusted_interface != INVALID_HOST_IP_ADDRESS ) && ( untrusted_interface == last_interface ) )
2319 {
2320 if( msg->getBlockUntrustedInterface() )
2321 {
2322 LL_WARNS("Messaging") << "Ignoring CreateTrustedCircuit on public interface from host: "
2323 << msg->getSender() << llendl;
2324 return;
2325 }
2326 else
2327 {
2328 LL_WARNS("Messaging") << "Processing CreateTrustedCircuit on public interface from host: "
2329 << msg->getSender() << llendl;
2330 }
2331 }
2332
2355 char their_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */ 2333 char their_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
2356 S32 size = msg->getSizeFast(_PREHASH_DataBlock, _PREHASH_Digest); 2334 S32 size = msg->getSizeFast(_PREHASH_DataBlock, _PREHASH_Digest);
2357 if(size != MD5HEX_STR_BYTES) 2335 if(size != MD5HEX_STR_BYTES)
@@ -2408,6 +2386,24 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **)
2408 // Don't respond to requests that use the same end point ID 2386 // Don't respond to requests that use the same end point ID
2409 return; 2387 return;
2410 } 2388 }
2389
2390 U32 untrusted_interface = msg->getUntrustedInterface().getAddress();
2391 U32 last_interface = msg->getReceivingInterface().getAddress();
2392 if ( ( untrusted_interface != INVALID_HOST_IP_ADDRESS ) && ( untrusted_interface == last_interface ) )
2393 {
2394 if( msg->getBlockUntrustedInterface() )
2395 {
2396 LL_WARNS("Messaging") << "Ignoring DenyTrustedCircuit on public interface from host: "
2397 << msg->getSender() << llendl;
2398 return;
2399 }
2400 else
2401 {
2402 LL_WARNS("Messaging") << "Processing DenyTrustedCircuit on public interface from host: "
2403 << msg->getSender() << llendl;
2404 }
2405 }
2406
2411 2407
2412 // Assume that we require trust to proceed, so resend. 2408 // Assume that we require trust to proceed, so resend.
2413 // This catches the case where a circuit that was trusted 2409 // This catches the case where a circuit that was trusted
@@ -2496,7 +2492,9 @@ bool start_messaging_system(
2496 bool b_dump_prehash_file, 2492 bool b_dump_prehash_file,
2497 const std::string& secret, 2493 const std::string& secret,
2498 const LLUseCircuitCodeResponder* responder, 2494 const LLUseCircuitCodeResponder* responder,
2499 bool failure_is_fatal) 2495 bool failure_is_fatal,
2496 const F32 circuit_heartbeat_interval,
2497 const F32 circuit_timeout)
2500{ 2498{
2501 gMessageSystem = new LLMessageSystem( 2499 gMessageSystem = new LLMessageSystem(
2502 template_name, 2500 template_name,
@@ -2504,7 +2502,9 @@ bool start_messaging_system(
2504 version_major, 2502 version_major,
2505 version_minor, 2503 version_minor,
2506 version_patch, 2504 version_patch,
2507 failure_is_fatal); 2505 failure_is_fatal,
2506 circuit_heartbeat_interval,
2507 circuit_timeout);
2508 g_shared_secret.assign(secret); 2508 g_shared_secret.assign(secret);
2509 2509
2510 if (!gMessageSystem) 2510 if (!gMessageSystem)
@@ -2683,7 +2683,7 @@ void LLMessageSystem::summarizeLogs(std::ostream& str)
2683 str << "END MESSAGE LOG SUMMARY" << std::endl; 2683 str << "END MESSAGE LOG SUMMARY" << std::endl;
2684} 2684}
2685 2685
2686void end_messaging_system() 2686void end_messaging_system(bool print_summary)
2687{ 2687{
2688 gTransferManager.cleanup(); 2688 gTransferManager.cleanup();
2689 LLTransferTargetVFile::updateQueue(true); // shutdown LLTransferTargetVFile 2689 LLTransferTargetVFile::updateQueue(true); // shutdown LLTransferTargetVFile
@@ -2691,9 +2691,12 @@ void end_messaging_system()
2691 { 2691 {
2692 gMessageSystem->stopLogging(); 2692 gMessageSystem->stopLogging();
2693 2693
2694 std::ostringstream str; 2694 if (print_summary)
2695 gMessageSystem->summarizeLogs(str); 2695 {
2696 LL_INFOS("Messaging") << str.str().c_str() << llendl; 2696 std::ostringstream str;
2697 gMessageSystem->summarizeLogs(str);
2698 LL_INFOS("Messaging") << str.str().c_str() << llendl;
2699 }
2697 2700
2698 delete gMessageSystem; 2701 delete gMessageSystem;
2699 gMessageSystem = NULL; 2702 gMessageSystem = NULL;
@@ -4041,3 +4044,11 @@ void LLMessageSystem::banUdpMessage(const std::string& name)
4041 llwarns << "Attempted to ban an unknown message: " << name << "." << llendl; 4044 llwarns << "Attempted to ban an unknown message: " << name << "." << llendl;
4042 } 4045 }
4043} 4046}
4047const LLHost& LLMessageSystem::getSender() const
4048{
4049 return mLastSender;
4050}
4051
4052LLHTTPRegistration<LLHTTPNodeAdapter<LLTrustedMessageService> >
4053 gHTTPRegistrationTrustedMessageWildcard("/trusted-message/<message-name>");
4054
diff --git a/linden/indra/llmessage/message.h b/linden/indra/llmessage/message.h
index c503a58..b25b27e 100644
--- a/linden/indra/llmessage/message.h
+++ b/linden/indra/llmessage/message.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -62,6 +63,9 @@
62#include "llstl.h" 63#include "llstl.h"
63#include "llmsgvariabletype.h" 64#include "llmsgvariabletype.h"
64#include "llmsgvariabletype.h" 65#include "llmsgvariabletype.h"
66#include "llmessagesenderinterface.h"
67
68#include "llstoredmessage.h"
65 69
66const U32 MESSAGE_MAX_STRINGS_LENGTH = 64; 70const U32 MESSAGE_MAX_STRINGS_LENGTH = 64;
67const U32 MESSAGE_NUMBER_OF_HASH_BUCKETS = 8192; 71const U32 MESSAGE_NUMBER_OF_HASH_BUCKETS = 8192;
@@ -205,12 +209,15 @@ public:
205 virtual void complete(const LLHost& host, const LLUUID& agent) const = 0; 209 virtual void complete(const LLHost& host, const LLUUID& agent) const = 0;
206}; 210};
207 211
208class LLMessageSystem 212class LLMessageSystem : public LLMessageSenderInterface
209{ 213{
210 private: 214 private:
211 U8 mSendBuffer[MAX_BUFFER_SIZE]; 215 U8 mSendBuffer[MAX_BUFFER_SIZE];
212 S32 mSendSize; 216 S32 mSendSize;
213 217
218 bool mBlockUntrustedInterface;
219 LLHost mUntrustedInterface;
220
214 public: 221 public:
215 LLPacketRing mPacketRing; 222 LLPacketRing mPacketRing;
216 LLReliablePacketParams mReliablePacketParams; 223 LLReliablePacketParams mReliablePacketParams;
@@ -285,7 +292,8 @@ public:
285 // Read file and build message templates 292 // Read file and build message templates
286 LLMessageSystem(const std::string& filename, U32 port, S32 version_major, 293 LLMessageSystem(const std::string& filename, U32 port, S32 version_major,
287 S32 version_minor, S32 version_patch, 294 S32 version_minor, S32 version_patch,
288 bool failure_is_fatal = true); 295 bool failure_is_fatal,
296 const F32 circuit_heartbeat_interval, const F32 circuit_timeout);
289 297
290 ~LLMessageSystem(); 298 ~LLMessageSystem();
291 299
@@ -350,6 +358,8 @@ public:
350 U32 getSenderIP() const; // getSender() is preferred 358 U32 getSenderIP() const; // getSender() is preferred
351 U32 getSenderPort() const; // getSender() is preferred 359 U32 getSenderPort() const; // getSender() is preferred
352 360
361 const LLHost& getReceivingInterface() const;
362
353 // This method returns the uuid associated with the sender. The 363 // This method returns the uuid associated with the sender. The
354 // UUID will be null if it is not yet known or is a server 364 // UUID will be null if it is not yet known or is a server
355 // circuit. 365 // circuit.
@@ -366,14 +376,34 @@ public:
366 void newMessageFast(const char *name); 376 void newMessageFast(const char *name);
367 void newMessage(const char *name); 377 void newMessage(const char *name);
368 378
369 void copyMessageRtoS(); 379
370 void clearMessage(); 380public:
381 LLStoredMessagePtr getReceivedMessage() const;
382 LLStoredMessagePtr getBuiltMessage() const;
383 S32 sendMessage(const LLHost &host, LLStoredMessagePtr message);
384
385private:
386 LLSD getReceivedMessageLLSD() const;
387 LLSD getBuiltMessageLLSD() const;
388
389 // NOTE: babbage: Only use to support legacy misuse of the
390 // LLMessageSystem API where values are dangerously written
391 // as one type and read as another. LLSD does not support
392 // dangerous conversions and so converting the message to an
393 // LLSD would result in the reads failing. All code which
394 // misuses the message system in this way should be made safe
395 // but while the unsafe code is run in old processes, this
396 // method should be used to forward unsafe messages.
397 LLSD wrapReceivedTemplateData() const;
398 LLSD wrapBuiltTemplateData() const;
399
400public:
401
402 void copyMessageReceivedToSend();
403 void clearMessage();
371 404
372 void nextBlockFast(const char *blockname); 405 void nextBlockFast(const char *blockname);
373 void nextBlock(const char *blockname) 406 void nextBlock(const char *blockname);
374 {
375 nextBlockFast(LLMessageStringTable::getInstance()->getString(blockname));
376 }
377 407
378public: 408public:
379 void addBinaryDataFast(const char *varname, const void *data, S32 size); 409 void addBinaryDataFast(const char *varname, const void *data, S32 size);
@@ -454,14 +484,14 @@ public:
454 void (*callback)(void **,S32), void ** callback_data); 484 void (*callback)(void **,S32), void ** callback_data);
455 485
456 // flush sends a message only if data's been pushed on it. 486 // flush sends a message only if data's been pushed on it.
457 S32 flushSemiReliable( const LLHost &host, 487 S32 flushSemiReliable( const LLHost &host,
458 void (*callback)(void **,S32), void ** callback_data); 488 void (*callback)(void **,S32), void ** callback_data);
459 489
460 S32 flushReliable( const LLHost &host ); 490 S32 flushReliable( const LLHost &host );
461 491
462 void forwardMessage(const LLHost &host); 492 void forwardMessage(const LLHost &host);
463 void forwardReliable(const LLHost &host); 493 void forwardReliable(const LLHost &host);
464 void forwardReliable(const U32 circuit_code); 494 void forwardReliable(const U32 circuit_code);
465 S32 forwardReliable( 495 S32 forwardReliable(
466 const LLHost &host, 496 const LLHost &host,
467 S32 retries, 497 S32 retries,
@@ -473,9 +503,10 @@ public:
473 LLHTTPClient::ResponderPtr createResponder(const std::string& name); 503 LLHTTPClient::ResponderPtr createResponder(const std::string& name);
474 S32 sendMessage(const LLHost &host); 504 S32 sendMessage(const LLHost &host);
475 S32 sendMessage(const U32 circuit); 505 S32 sendMessage(const U32 circuit);
506private:
476 S32 sendMessage(const LLHost &host, const char* name, 507 S32 sendMessage(const LLHost &host, const char* name,
477 const LLSD& message); 508 const LLSD& message);
478 509public:
479 // BOOL decodeData(const U8 *buffer, const LLHost &host); 510 // BOOL decodeData(const U8 *buffer, const LLHost &host);
480 511
481 void getBinaryDataFast(const char *blockname, const char *varname, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX); 512 void getBinaryDataFast(const char *blockname, const char *varname, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX);
@@ -554,17 +585,28 @@ public:
554 void sendDenyTrustedCircuit(const LLHost &host); 585 void sendDenyTrustedCircuit(const LLHost &host);
555 586
556 /** Return false if host is unknown or untrusted */ 587 /** Return false if host is unknown or untrusted */
588 // Note:DaveH/Babbage some trusted messages can be received without a circuit
557 bool isTrustedSender(const LLHost& host) const; 589 bool isTrustedSender(const LLHost& host) const;
558 590
591 /** Return true if current message is from trusted source */
592 bool isTrustedSender() const;
593
559 /** Return false true if name is unknown or untrusted */ 594 /** Return false true if name is unknown or untrusted */
560 bool isTrustedMessage(const std::string& name) const; 595 bool isTrustedMessage(const std::string& name) const;
561 596
562 /** Return false true if name is unknown or trusted */ 597 /** Return false true if name is unknown or trusted */
563 bool isUntrustedMessage(const std::string& name) const; 598 bool isUntrustedMessage(const std::string& name) const;
564 599
600 // Mark an interface ineligible for trust
601 void setUntrustedInterface( const LLHost host ) { mUntrustedInterface = host; }
602 LLHost getUntrustedInterface() const { return mUntrustedInterface; }
603 void setBlockUntrustedInterface( bool block ) { mBlockUntrustedInterface = block; } // Throw a switch to allow, sending warnings only
604 bool getBlockUntrustedInterface() const { return mBlockUntrustedInterface; }
605
565 // Change this message to be UDP black listed. 606 // Change this message to be UDP black listed.
566 void banUdpMessage(const std::string& name); 607 void banUdpMessage(const std::string& name);
567 608
609
568private: 610private:
569 // A list of the circuits that need to be sent DenyTrustedCircuit messages. 611 // A list of the circuits that need to be sent DenyTrustedCircuit messages.
570 typedef std::set<LLHost> host_set_t; 612 typedef std::set<LLHost> host_set_t;
@@ -581,6 +623,7 @@ public:
581 void establishBidirectionalTrust(const LLHost &host, S64 frame_count = 0); 623 void establishBidirectionalTrust(const LLHost &host, S64 frame_count = 0);
582 624
583 // returns whether the given host is on a trusted circuit 625 // returns whether the given host is on a trusted circuit
626 // Note:DaveH/Babbage some trusted messages can be received without a circuit
584 BOOL getCircuitTrust(const LLHost &host); 627 BOOL getCircuitTrust(const LLHost &host);
585 628
586 void setCircuitAllowTimeout(const LLHost &host, BOOL allow); 629 void setCircuitAllowTimeout(const LLHost &host, BOOL allow);
@@ -650,6 +693,12 @@ public:
650 const LLSD& message, 693 const LLSD& message,
651 LLHTTPNode::ResponsePtr responsep); 694 LLHTTPNode::ResponsePtr responsep);
652 695
696 // this is added to support specific legacy messages and is
697 // ***not intended for general use*** Si, Gabriel, 2009
698 static void dispatchTemplate(const std::string& msg_name,
699 const LLSD& message,
700 LLHTTPNode::ResponsePtr responsep);
701
653 void setMessageBans(const LLSD& trusted, const LLSD& untrusted); 702 void setMessageBans(const LLSD& trusted, const LLSD& untrusted);
654 703
655 /** 704 /**
@@ -677,9 +726,18 @@ public:
677 726
678 // Check UDP messages and pump http_pump to receive HTTP messages. 727 // Check UDP messages and pump http_pump to receive HTTP messages.
679 bool checkAllMessages(S64 frame_count, LLPumpIO* http_pump); 728 bool checkAllMessages(S64 frame_count, LLPumpIO* http_pump);
729
730 // Moved to allow access from LLTemplateMessageDispatcher
731 void clearReceiveState();
732
733 // This will cause all trust queries to return true until the next message
734 // is read: use with caution!
735 void receivedMessageFromTrustedSender();
680 736
681private: 737private:
682 738
739 bool mLastMessageFromTrustedMessageService;
740
683 // The mCircuitCodes is a map from circuit codes to session 741 // The mCircuitCodes is a map from circuit codes to session
684 // ids. This allows us to verify sessions on connect. 742 // ids. This allows us to verify sessions on connect.
685 typedef std::map<U32, LLUUID> code_session_map_t; 743 typedef std::map<U32, LLUUID> code_session_map_t;
@@ -690,7 +748,6 @@ private:
690 LLUUID mSessionID; 748 LLUUID mSessionID;
691 749
692 void addTemplate(LLMessageTemplate *templatep); 750 void addTemplate(LLMessageTemplate *templatep);
693 void clearReceiveState();
694 BOOL decodeTemplate( const U8* buffer, S32 buffer_size, LLMessageTemplate** msg_template ); 751 BOOL decodeTemplate( const U8* buffer, S32 buffer_size, LLMessageTemplate** msg_template );
695 752
696 void logMsgFromInvalidCircuit( const LLHost& sender, BOOL recv_reliable ); 753 void logMsgFromInvalidCircuit( const LLHost& sender, BOOL recv_reliable );
@@ -745,6 +802,7 @@ private:
745 void init(); // ctor shared initialisation. 802 void init(); // ctor shared initialisation.
746 803
747 LLHost mLastSender; 804 LLHost mLastSender;
805 LLHost mLastReceivingIF;
748 S32 mIncomingCompressedSize; // original size of compressed msg (0 if uncomp.) 806 S32 mIncomingCompressedSize; // original size of compressed msg (0 if uncomp.)
749 TPACKETID mCurrentRecvPacketID; // packet ID of current receive packet (for reporting) 807 TPACKETID mCurrentRecvPacketID; // packet ID of current receive packet (for reporting)
750 808
@@ -780,10 +838,12 @@ bool start_messaging_system(
780 S32 version_patch, 838 S32 version_patch,
781 bool b_dump_prehash_file, 839 bool b_dump_prehash_file,
782 const std::string& secret, 840 const std::string& secret,
783 const LLUseCircuitCodeResponder* responder = NULL, 841 const LLUseCircuitCodeResponder* responder,
784 bool failure_is_fatal = true); 842 bool failure_is_fatal,
843 const F32 circuit_heartbeat_interval,
844 const F32 circuit_timeout);
785 845
786void end_messaging_system(); 846void end_messaging_system(bool print_summary = true);
787 847
788void null_message_callback(LLMessageSystem *msg, void **data); 848void null_message_callback(LLMessageSystem *msg, void **data);
789 849
@@ -960,8 +1020,7 @@ inline void *ntohmemcpy(void *s, const void *ct, EMsgVariableType type, size_t n
960 return(htonmemcpy(s,ct,type, n)); 1020 return(htonmemcpy(s,ct,type, n));
961} 1021}
962 1022
963 1023inline const LLHost& LLMessageSystem::getReceivingInterface() const {return mLastReceivingIF;}
964inline const LLHost& LLMessageSystem::getSender() const {return mLastSender;}
965 1024
966inline U32 LLMessageSystem::getSenderIP() const 1025inline U32 LLMessageSystem::getSenderIP() const
967{ 1026{
@@ -973,6 +1032,7 @@ inline U32 LLMessageSystem::getSenderPort() const
973 return mLastSender.getPort(); 1032 return mLastSender.getPort();
974} 1033}
975 1034
1035
976//----------------------------------------------------------------------------- 1036//-----------------------------------------------------------------------------
977// Transmission aliases 1037// Transmission aliases
978//----------------------------------------------------------------------------- 1038//-----------------------------------------------------------------------------
diff --git a/linden/indra/llmessage/message_prehash.cpp b/linden/indra/llmessage/message_prehash.cpp
index a286d0f..da16e6e 100644
--- a/linden/indra/llmessage/message_prehash.cpp
+++ b/linden/indra/llmessage/message_prehash.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -313,6 +314,7 @@ char* _PREHASH_TextColor = LLMessageStringTable::getInstance()->getString("TextC
313char* _PREHASH_SlaveID = LLMessageStringTable::getInstance()->getString("SlaveID"); 314char* _PREHASH_SlaveID = LLMessageStringTable::getInstance()->getString("SlaveID");
314char* _PREHASH_Charter = LLMessageStringTable::getInstance()->getString("Charter"); 315char* _PREHASH_Charter = LLMessageStringTable::getInstance()->getString("Charter");
315char* _PREHASH_AlertData = LLMessageStringTable::getInstance()->getString("AlertData"); 316char* _PREHASH_AlertData = LLMessageStringTable::getInstance()->getString("AlertData");
317char* _PREHASH_AlertInfo = LLMessageStringTable::getInstance()->getString("AlertInfo");
316char* _PREHASH_TargetBlock = LLMessageStringTable::getInstance()->getString("TargetBlock"); 318char* _PREHASH_TargetBlock = LLMessageStringTable::getInstance()->getString("TargetBlock");
317char* _PREHASH_CheckParcelAuctions = LLMessageStringTable::getInstance()->getString("CheckParcelAuctions"); 319char* _PREHASH_CheckParcelAuctions = LLMessageStringTable::getInstance()->getString("CheckParcelAuctions");
318char* _PREHASH_ParcelAuctions = LLMessageStringTable::getInstance()->getString("ParcelAuctions"); 320char* _PREHASH_ParcelAuctions = LLMessageStringTable::getInstance()->getString("ParcelAuctions");
@@ -1374,4 +1376,5 @@ char* _PREHASH_AgeVerificationBlock = LLMessageStringTable::getInstance()->getSt
1374char* _PREHASH_UCoord = LLMessageStringTable::getInstance()->getString("UCoord"); 1376char* _PREHASH_UCoord = LLMessageStringTable::getInstance()->getString("UCoord");
1375char* _PREHASH_VCoord = LLMessageStringTable::getInstance()->getString("VCoord"); 1377char* _PREHASH_VCoord = LLMessageStringTable::getInstance()->getString("VCoord");
1376char* _PREHASH_FaceIndex = LLMessageStringTable::getInstance()->getString("FaceIndex"); 1378char* _PREHASH_FaceIndex = LLMessageStringTable::getInstance()->getString("FaceIndex");
1377 1379char* _PREHASH_StatusData = LLMessageStringTable::getInstance()->getString("StatusData");
1380char* _PREHASH_ProductSKU = LLMessageStringTable::getInstance()->getString("ProductSKU");
diff --git a/linden/indra/llmessage/message_prehash.h b/linden/indra/llmessage/message_prehash.h
index d7014df..1445d6a 100644
--- a/linden/indra/llmessage/message_prehash.h
+++ b/linden/indra/llmessage/message_prehash.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -313,6 +314,7 @@ extern char * _PREHASH_TextColor;
313extern char * _PREHASH_SlaveID; 314extern char * _PREHASH_SlaveID;
314extern char * _PREHASH_Charter; 315extern char * _PREHASH_Charter;
315extern char * _PREHASH_AlertData; 316extern char * _PREHASH_AlertData;
317extern char * _PREHASH_AlertInfo;
316extern char * _PREHASH_TargetBlock; 318extern char * _PREHASH_TargetBlock;
317extern char * _PREHASH_CheckParcelAuctions; 319extern char * _PREHASH_CheckParcelAuctions;
318extern char * _PREHASH_ParcelAuctions; 320extern char * _PREHASH_ParcelAuctions;
@@ -1374,5 +1376,6 @@ extern char * _PREHASH_AgeVerificationBlock;
1374extern char * _PREHASH_UCoord; 1376extern char * _PREHASH_UCoord;
1375extern char * _PREHASH_VCoord; 1377extern char * _PREHASH_VCoord;
1376extern char * _PREHASH_FaceIndex; 1378extern char * _PREHASH_FaceIndex;
1377 1379extern char * _PREHASH_StatusData;
1380extern char * _PREHASH_ProductSKU;
1378#endif 1381#endif
diff --git a/linden/indra/llmessage/message_string_table.cpp b/linden/indra/llmessage/message_string_table.cpp
index 39ba399..cd60103 100644
--- a/linden/indra/llmessage/message_string_table.cpp
+++ b/linden/indra/llmessage/message_string_table.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/net.cpp b/linden/indra/llmessage/net.cpp
index 0f0cddf..f63faa5 100644
--- a/linden/indra/llmessage/net.cpp
+++ b/linden/indra/llmessage/net.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -50,7 +51,6 @@
50#endif 51#endif
51 52
52// linden library includes 53// linden library includes
53#include "network.h"
54#include "llerror.h" 54#include "llerror.h"
55#include "llhost.h" 55#include "llhost.h"
56#include "lltimer.h" 56#include "lltimer.h"
@@ -80,6 +80,7 @@ typedef int socklen_t;
80 80
81#endif 81#endif
82 82
83static U32 gsnReceivingIFAddr = INVALID_HOST_IP_ADDRESS; // Address to which datagram was sent
83 84
84const char* LOOPBACK_ADDRESS_STRING = "127.0.0.1"; 85const char* LOOPBACK_ADDRESS_STRING = "127.0.0.1";
85 86
@@ -109,6 +110,16 @@ U32 get_sender_port()
109 return ntohs(stSrcAddr.sin_port); 110 return ntohs(stSrcAddr.sin_port);
110} 111}
111 112
113LLHost get_receiving_interface()
114{
115 return LLHost(gsnReceivingIFAddr, INVALID_PORT);
116}
117
118U32 get_receiving_interface_ip(void)
119{
120 return gsnReceivingIFAddr;
121}
122
112const char* u32_to_ip_string(U32 ip) 123const char* u32_to_ip_string(U32 ip)
113{ 124{
114 static char buffer[MAXADDRSTR]; /* Flawfinder: ignore */ 125 static char buffer[MAXADDRSTR]; /* Flawfinder: ignore */
@@ -383,11 +394,30 @@ S32 start_net(S32& socket_out, int& nPort)
383 return 1; 394 return 1;
384 } 395 }
385 396
386 // Don't bind() if we want the operating system to assign our ports for
387 // us.
388 if (NET_USE_OS_ASSIGNED_PORT == nPort) 397 if (NET_USE_OS_ASSIGNED_PORT == nPort)
389 { 398 {
390 // Do nothing; the operating system will do it for us. 399 // Although bind is not required it will tell us which port we were
400 // assigned to.
401 stLclAddr.sin_family = AF_INET;
402 stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY);
403 stLclAddr.sin_port = htons(0);
404 llinfos << "attempting to connect on OS assigned port" << llendl;
405 nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr));
406 if (nRet < 0)
407 {
408 llwarns << "Failed to bind on an OS assigned port error: "
409 << nRet << llendl;
410 }
411 else
412 {
413 sockaddr_in socket_info;
414 socklen_t len = sizeof(sockaddr_in);
415 int err = getsockname(hSocket, (sockaddr*)&socket_info, &len);
416 llinfos << "Get socket returned: " << err << " length " << len << llendl;
417 nPort = ntohs(socket_info.sin_port);
418 llinfos << "Assigned port: " << nPort << llendl;
419
420 }
391 } 421 }
392 else 422 else
393 { 423 {
@@ -454,6 +484,21 @@ S32 start_net(S32& socket_out, int& nPort)
454 llinfos << "startNet - receive buffer size : " << rec_size << llendl; 484 llinfos << "startNet - receive buffer size : " << rec_size << llendl;
455 llinfos << "startNet - send buffer size : " << snd_size << llendl; 485 llinfos << "startNet - send buffer size : " << snd_size << llendl;
456 486
487#if LL_LINUX
488 // Turn on recipient address tracking
489 {
490 int use_pktinfo = 1;
491 if( setsockopt( hSocket, SOL_IP, IP_PKTINFO, &use_pktinfo, sizeof(use_pktinfo) ) == -1 )
492 {
493 llwarns << "No IP_PKTINFO available" << llendl;
494 }
495 else
496 {
497 llinfos << "IP_PKKTINFO enabled" << llendl;
498 }
499 }
500#endif
501
457 // Setup a destination address 502 // Setup a destination address
458 char achMCAddr[MAXADDRSTR] = "127.0.0.1"; /* Flawfinder: ignore */ 503 char achMCAddr[MAXADDRSTR] = "127.0.0.1"; /* Flawfinder: ignore */
459 stDstAddr.sin_family = AF_INET; 504 stDstAddr.sin_family = AF_INET;
@@ -472,6 +517,52 @@ void end_net(S32& socket_out)
472 } 517 }
473} 518}
474 519
520#if LL_LINUX
521static int recvfrom_destip( int socket, void *buf, int len, struct sockaddr *from, socklen_t *fromlen, U32 *dstip )
522{
523 int size;
524 struct iovec iov[1];
525 char cmsg[CMSG_SPACE(sizeof(struct in_pktinfo))];
526 struct cmsghdr *cmsgptr;
527 struct msghdr msg = {0};
528
529 iov[0].iov_base = buf;
530 iov[0].iov_len = len;
531
532 memset( &msg, 0, sizeof msg );
533 msg.msg_name = from;
534 msg.msg_namelen = *fromlen;
535 msg.msg_iov = iov;
536 msg.msg_iovlen = 1;
537 msg.msg_control = &cmsg;
538 msg.msg_controllen = sizeof(cmsg);
539
540 size = recvmsg( socket, &msg, 0 );
541
542 if( size == -1 )
543 {
544 return -1;
545 }
546
547 for( cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL; cmsgptr = CMSG_NXTHDR( &msg, cmsgptr ) )
548 {
549 if( cmsgptr->cmsg_level == SOL_IP && cmsgptr->cmsg_type == IP_PKTINFO )
550 {
551 in_pktinfo *pktinfo = (in_pktinfo *)CMSG_DATA(cmsgptr);
552 if( pktinfo )
553 {
554 // Two choices. routed and specified. ipi_addr is routed, ipi_spec_dst is
555 // routed. We should stay with specified until we go to multiple
556 // interfaces
557 *dstip = pktinfo->ipi_spec_dst.s_addr;
558 }
559 }
560 }
561
562 return size;
563}
564#endif
565
475int receive_packet(int hSocket, char * receiveBuffer) 566int receive_packet(int hSocket, char * receiveBuffer)
476{ 567{
477 // Receives data asynchronously from the socket set by initNet(). 568 // Receives data asynchronously from the socket set by initNet().
@@ -481,7 +572,14 @@ int receive_packet(int hSocket, char * receiveBuffer)
481 int nRet; 572 int nRet;
482 socklen_t addr_size = sizeof(struct sockaddr_in); 573 socklen_t addr_size = sizeof(struct sockaddr_in);
483 574
484 nRet = recvfrom(hSocket, receiveBuffer, NET_BUFFER_SIZE, 0, (struct sockaddr*)&stSrcAddr, &addr_size); 575 gsnReceivingIFAddr = INVALID_HOST_IP_ADDRESS;
576
577#if LL_LINUX
578 nRet = recvfrom_destip(hSocket, receiveBuffer, NET_BUFFER_SIZE, (struct sockaddr*)&stSrcAddr, &addr_size, &gsnReceivingIFAddr);
579#else
580 int recv_flags = 0;
581 nRet = recvfrom(hSocket, receiveBuffer, NET_BUFFER_SIZE, recv_flags, (struct sockaddr*)&stSrcAddr, &addr_size);
582#endif
485 583
486 if (nRet == -1) 584 if (nRet == -1)
487 { 585 {
@@ -489,6 +587,9 @@ int receive_packet(int hSocket, char * receiveBuffer)
489 return 0; 587 return 0;
490 } 588 }
491 589
590 // Uncomment for testing if/when implementing for Mac or Windows:
591 // llinfos << "Received datagram to in addr " << u32_to_ip_string(get_receiving_interface_ip()) << llendl;
592
492 return nRet; 593 return nRet;
493} 594}
494 595
diff --git a/linden/indra/llmessage/net.h b/linden/indra/llmessage/net.h
index ec2af59..45b07a0 100644
--- a/linden/indra/llmessage/net.h
+++ b/linden/indra/llmessage/net.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -54,6 +55,8 @@ BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, i
54LLHost get_sender(); 55LLHost get_sender();
55U32 get_sender_port(); 56U32 get_sender_port();
56U32 get_sender_ip(void); 57U32 get_sender_ip(void);
58LLHost get_receiving_interface();
59U32 get_receiving_interface_ip(void);
57 60
58const char* u32_to_ip_string(U32 ip); // Returns pointer to internal string buffer, "(bad IP addr)" on failure, cannot nest calls 61const char* u32_to_ip_string(U32 ip); // Returns pointer to internal string buffer, "(bad IP addr)" on failure, cannot nest calls
59char* u32_to_ip_string(U32 ip, char *ip_string); // NULL on failure, ip_string on success, you must allocate at least MAXADDRSTR chars 62char* u32_to_ip_string(U32 ip, char *ip_string); // NULL on failure, ip_string on success, you must allocate at least MAXADDRSTR chars
diff --git a/linden/indra/llmessage/partsyspacket.cpp b/linden/indra/llmessage/partsyspacket.cpp
index 9cef9c9..cfb3572 100644
--- a/linden/indra/llmessage/partsyspacket.cpp
+++ b/linden/indra/llmessage/partsyspacket.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/partsyspacket.h b/linden/indra/llmessage/partsyspacket.h
index 46564a1..b4edc8c 100644
--- a/linden/indra/llmessage/partsyspacket.h
+++ b/linden/indra/llmessage/partsyspacket.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/patch_code.cpp b/linden/indra/llmessage/patch_code.cpp
index baa8aca..90fb236 100644
--- a/linden/indra/llmessage/patch_code.cpp
+++ b/linden/indra/llmessage/patch_code.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/patch_code.h b/linden/indra/llmessage/patch_code.h
index c6fd90e..82fa6bb 100644
--- a/linden/indra/llmessage/patch_code.h
+++ b/linden/indra/llmessage/patch_code.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/patch_dct.cpp b/linden/indra/llmessage/patch_dct.cpp
index 8c1c0cb..be5e90c 100644
--- a/linden/indra/llmessage/patch_dct.cpp
+++ b/linden/indra/llmessage/patch_dct.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/patch_dct.h b/linden/indra/llmessage/patch_dct.h
index 204ed0d..663e146 100644
--- a/linden/indra/llmessage/patch_dct.h
+++ b/linden/indra/llmessage/patch_dct.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/patch_idct.cpp b/linden/indra/llmessage/patch_idct.cpp
index 39a6f52..b9a0931 100644
--- a/linden/indra/llmessage/patch_idct.cpp
+++ b/linden/indra/llmessage/patch_idct.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llmessage/sound_ids.h b/linden/indra/llmessage/sound_ids.h
index 884bf14..e7a9190 100644
--- a/linden/indra/llmessage/sound_ids.h
+++ b/linden/indra/llmessage/sound_ids.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,