Compare commits
337 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ae55f6248 | ||
|
|
9500ba2ff5 | ||
|
|
8b70477556 | ||
|
|
04845c1898 | ||
|
|
f3c21524be | ||
|
|
5c23b4aa56 | ||
|
|
85646b157c | ||
|
|
7eda9364fd | ||
|
|
f8d49e0a30 | ||
|
|
68a4f897b4 | ||
|
|
43acd99bb3 | ||
|
|
b7457a0a5d | ||
|
|
c77444a821 | ||
|
|
1636f535ba | ||
|
|
fac55bc78b | ||
|
|
4433f53f72 | ||
|
|
a1c4585a39 | ||
|
|
9b6e89457c | ||
|
|
7ecd9b3f1a | ||
|
|
c6ba50b7e2 | ||
|
|
0b2b2daf23 | ||
|
|
58dac970af | ||
|
|
c4eaf195b5 | ||
|
|
d975bd8e5c | ||
|
|
7701ea2798 | ||
|
|
54cedfe432 | ||
|
|
94a46867ed | ||
|
|
c4c4c3696e | ||
|
|
0f3314c04c | ||
|
|
d834a2c3da | ||
|
|
e80e04c5fd | ||
|
|
309f440fc0 | ||
|
|
db5ea850f6 | ||
|
|
20e3de1f0a | ||
|
|
335c1b4420 | ||
|
|
a97a887ea4 | ||
|
|
e40acda6c8 | ||
|
|
e7be131b89 | ||
|
|
fd4a059e9b | ||
|
|
2f454843d8 | ||
|
|
a573b5767b | ||
|
|
5c04d768a6 | ||
|
|
4bf1598930 | ||
|
|
07b4889eab | ||
|
|
7a3bb266eb | ||
|
|
f34cc6b469 | ||
|
|
9b9e2a8c71 | ||
|
|
2fbbc13c71 | ||
|
|
35bf75a77a | ||
|
|
f505c1d0a4 | ||
|
|
04a68db195 | ||
|
|
e2a521742a | ||
|
|
956225f0e1 | ||
|
|
18ed68cd31 | ||
|
|
4d712ddaae | ||
|
|
dd544f811a | ||
|
|
e0b287961f | ||
|
|
add47befac | ||
|
|
0e36994fe7 | ||
|
|
3ea72eeabb | ||
|
|
1a2cbbc8c1 | ||
|
|
f35eb8819c | ||
|
|
e442c2a3f9 | ||
|
|
37815f3402 | ||
|
|
8cbd0d3b5f | ||
|
|
8198062610 | ||
|
|
80e4068b3e | ||
|
|
1379ae4310 | ||
|
|
7bd48d383d | ||
|
|
f6f6ef1532 | ||
|
|
4423630f1e | ||
|
|
5caae0293a | ||
|
|
c8c608acc8 | ||
|
|
3d053b194a | ||
|
|
2fdd535302 | ||
|
|
1f7a0cf892 | ||
|
|
83929c69e3 | ||
|
|
87590491b5 | ||
|
|
62dd83f473 | ||
|
|
84b0a23e19 | ||
|
|
393a782858 | ||
|
|
7f61de8f57 | ||
|
|
e99341d7df | ||
|
|
efd4810851 | ||
|
|
92a8d7ce6c | ||
|
|
d6eff8ebcf | ||
|
|
af2d20c5fa | ||
|
|
47a9e48f46 | ||
|
|
94c417c90c | ||
|
|
ce3e265575 | ||
|
|
b2fefe3e3f | ||
|
|
2084e08ad7 | ||
|
|
9568718add | ||
|
|
6a70349512 | ||
|
|
0ad8046582 | ||
|
|
ad38450f9c | ||
|
|
c8f3bb56ff | ||
|
|
59851ceee6 | ||
|
|
044979066c | ||
|
|
776d62b9c6 | ||
|
|
ae9362636e | ||
|
|
48134af616 | ||
|
|
fc1ac25935 | ||
|
|
0f1a3f8ed2 | ||
|
|
8c20610293 | ||
|
|
d5ed92cf38 | ||
|
|
6478617c93 | ||
|
|
0c5850237e | ||
|
|
9e37d24624 | ||
|
|
44c86cedcf | ||
|
|
cfca9e1e81 | ||
|
|
5b9ca6e35f | ||
|
|
862caa72a8 | ||
|
|
2d9b69c186 | ||
|
|
e9c9a74e0a | ||
|
|
b80ea00265 | ||
|
|
d2e17f4ffb | ||
|
|
1abb70cc73 | ||
|
|
946e06eb58 | ||
|
|
66692f90e3 | ||
|
|
a964431c21 | ||
|
|
496a8a4f7c | ||
|
|
24056dc98b | ||
|
|
6772c9d2b6 | ||
|
|
e3dbd79543 | ||
|
|
d9c48e70a9 | ||
|
|
51bb311565 | ||
|
|
f4e30664e6 | ||
|
|
44d523518a | ||
|
|
8c39392eaa | ||
|
|
884410501e | ||
|
|
a87d7a1296 | ||
|
|
f0152790cf | ||
|
|
8452c0869d | ||
|
|
20e748205e | ||
|
|
649d45a2d4 | ||
|
|
0ae861d7d7 | ||
|
|
511481e8d9 | ||
|
|
1676e70dfe | ||
|
|
46b5fe5acd | ||
|
|
089f5403a7 | ||
|
|
1597e33549 | ||
|
|
121c6b4835 | ||
|
|
a764eb5dc7 | ||
|
|
d22bdb5095 | ||
|
|
a2aadb78a9 | ||
|
|
71adb37fa8 | ||
|
|
6591f8a592 | ||
|
|
3724a38ab4 | ||
|
|
54e6c26def | ||
|
|
0907d5d69e | ||
|
|
53d3f46add | ||
|
|
d657b76dba | ||
|
|
253e2ed699 | ||
|
|
1121919b57 | ||
|
|
61ce884336 | ||
|
|
71fdc24f5c | ||
|
|
aa51b83fdc | ||
|
|
b321c0a932 | ||
|
|
3f901d313b | ||
|
|
67cfe34e67 | ||
|
|
643cc7a0ee | ||
|
|
b3cb99036c | ||
|
|
9602227eb6 | ||
|
|
5e103f2b2e | ||
|
|
d49d44923d | ||
|
|
cbe0841bc9 | ||
|
|
596af3f600 | ||
|
|
8f0d6d6b5c | ||
|
|
a08360e3cd | ||
|
|
06f639b8f3 | ||
|
|
ba3dfe4121 | ||
|
|
67cfac0cf1 | ||
|
|
8ad8bd6282 | ||
|
|
045a44b1af | ||
|
|
d321d23afe | ||
|
|
e3f60ce06f | ||
|
|
4b96a78039 | ||
|
|
19a5e606b3 | ||
|
|
a18f4964cf | ||
|
|
f5c310d9d4 | ||
|
|
a6c93ce875 | ||
|
|
1b8f91a0db | ||
|
|
7371c7662a | ||
|
|
f3a4860635 | ||
|
|
43c303e27a | ||
|
|
e51be5f4a7 | ||
|
|
59f683066a | ||
|
|
b19e564317 | ||
|
|
e881f35fbb | ||
|
|
59a841d69c | ||
|
|
e7439efc74 | ||
|
|
0054afd39b | ||
|
|
7f699fca9a | ||
|
|
e5e951d92c | ||
|
|
5a653ef96f | ||
|
|
165f193f78 | ||
|
|
6eecbc95e4 | ||
|
|
a9f4d7a29c | ||
|
|
c54e0953d0 | ||
|
|
b575bf2524 | ||
|
|
30f59370d3 | ||
|
|
73491cceed | ||
|
|
28c7bb99bf | ||
|
|
551727cd19 | ||
|
|
bde26a8282 | ||
|
|
11c4a2cfd0 | ||
|
|
93b930b937 | ||
|
|
b53b871669 | ||
|
|
0a29842caf | ||
|
|
49fbe0ddb4 | ||
|
|
46fea74726 | ||
|
|
69b551c516 | ||
|
|
fa0621b486 | ||
|
|
84a1a0a729 | ||
|
|
b891291135 | ||
|
|
d8d6e8a304 | ||
|
|
e3c1466047 | ||
|
|
df30b1c832 | ||
|
|
3d3e0ea4f3 | ||
|
|
c7a457f9ee | ||
|
|
31bf25d05e | ||
|
|
eecaa3d9dd | ||
|
|
e38e8ae987 | ||
|
|
6dbe25360e | ||
|
|
6483470ec5 | ||
|
|
83fad75e22 | ||
|
|
7cd44c1a81 | ||
|
|
f8b6bc8d11 | ||
|
|
0020afaf67 | ||
|
|
b8b4517211 | ||
|
|
824d7190c2 | ||
|
|
30d64444a0 | ||
|
|
9904700dfd | ||
|
|
49dbae65c9 | ||
|
|
b056c243e4 | ||
|
|
c00158b238 | ||
|
|
794419852b | ||
|
|
fbafd22124 | ||
|
|
b9cd66d510 | ||
|
|
b310efc50f | ||
|
|
0fdf883cbd | ||
|
|
1382dc976c | ||
|
|
54e4dcf454 | ||
|
|
f6b1344722 | ||
|
|
5ffd59e7b8 | ||
|
|
0889b5aef1 | ||
|
|
59ca92b10b | ||
|
|
956f337046 | ||
|
|
a6a6bf007a | ||
|
|
2e9890bbe6 | ||
|
|
f2427a7320 | ||
|
|
2a6dbd068e | ||
|
|
d092977f4a | ||
|
|
e3f229225c | ||
|
|
ee9d46c825 | ||
|
|
dbd8c400ce | ||
|
|
29a740ec8c | ||
|
|
c2d3afdeee | ||
|
|
9155c9ee37 | ||
|
|
0d1d437bd3 | ||
|
|
b15f20520f | ||
|
|
172e2f4e76 | ||
|
|
23cd1b1954 | ||
|
|
cade14c58c | ||
|
|
1e222d52e6 | ||
|
|
f9ae9afaac | ||
|
|
09bbfc1d56 | ||
|
|
79511ecce2 | ||
|
|
2fe75a62be | ||
|
|
da414fd509 | ||
|
|
f2891e7738 | ||
|
|
fbefa8273b | ||
|
|
ceccfe02d0 | ||
|
|
129de26032 | ||
|
|
43a6fa1d01 | ||
|
|
cc8246206d | ||
|
|
551696bb45 | ||
|
|
ded16d3529 | ||
|
|
2e6dce434f | ||
|
|
9888f95068 | ||
|
|
8bbb88ea4e | ||
|
|
69d83e1548 | ||
|
|
d3e7a52933 | ||
|
|
aa695e92f7 | ||
|
|
0ddd1ce0b7 | ||
|
|
cc18ab12f8 | ||
|
|
2c3f6aaa87 | ||
|
|
5dedacca3c | ||
|
|
ad2f0a1290 | ||
|
|
bd3b9f79c2 | ||
|
|
ed148eba32 | ||
|
|
06f41bb017 | ||
|
|
a27d33cb63 | ||
|
|
22c325aa5a | ||
|
|
ac2fcbe224 | ||
|
|
63b6b9cdce | ||
|
|
de55110247 | ||
|
|
b9d22aa821 | ||
|
|
de927adf27 | ||
|
|
79395bc7db | ||
|
|
c81f37cf82 | ||
|
|
25b4160434 | ||
|
|
32c464ad1f | ||
|
|
d5aceb6d95 | ||
|
|
81f7e9b462 | ||
|
|
8383bde768 | ||
|
|
d114713694 | ||
|
|
cad2bf5b08 | ||
|
|
247c66b3fe | ||
|
|
73c2162ff6 | ||
|
|
889ce36afa | ||
|
|
c3d4b66953 | ||
|
|
234b29cf66 | ||
|
|
31827b0286 | ||
|
|
df121a7cd0 | ||
|
|
03df03b269 | ||
|
|
f1522e6204 | ||
|
|
87bce90086 | ||
|
|
4a29a7f92c | ||
|
|
0149265ee8 | ||
|
|
0844e5951c | ||
|
|
251d1b8fbb | ||
|
|
7f0f5060ec | ||
|
|
d179f2cce9 | ||
|
|
5d0778014d | ||
|
|
4c10826caa | ||
|
|
873c9098d8 | ||
|
|
6ce5080049 | ||
|
|
b9546d12f2 | ||
|
|
a49c524c9e | ||
|
|
b7f1fc116e | ||
|
|
28aa8010b2 | ||
|
|
c09eb00031 | ||
|
|
1113b3b6eb | ||
|
|
a81a16f22f | ||
|
|
8428b25939 |
34
.gitignore
vendored
34
.gitignore
vendored
@@ -9,14 +9,6 @@
|
||||
*.pdb
|
||||
*.pidb
|
||||
*.dll.build
|
||||
*.dll
|
||||
*.VisualState.xml
|
||||
*/*/obj
|
||||
*/*/*/obj
|
||||
*/*/*/*/obj
|
||||
*/*/*/*/*/obj
|
||||
*/*/*/*/*/*/obj
|
||||
*/*/*/*/*/*/*/obj
|
||||
*/*/bin
|
||||
*/*/*/bin
|
||||
*/*/*/*/bin
|
||||
@@ -26,14 +18,9 @@
|
||||
bin/Debug/*.dll
|
||||
bin/*.dll.mdb
|
||||
bin/*.db
|
||||
bin/*.db-journal
|
||||
bin/addin-db-*
|
||||
bin/*.dll
|
||||
bin/OpenSim.vshost.exe.config
|
||||
bin/OpenSim.32BitLaunch.vshost.exe.config
|
||||
bin/OpenSim.32BitLaunch.log
|
||||
UpgradeLog.XML
|
||||
_UpgradeReport_Files/
|
||||
bin/ScriptEngines/*-*-*-*-*
|
||||
bin/ScriptEngines/*.dll
|
||||
bin/ScriptEngines/*/*.dll
|
||||
@@ -46,8 +33,6 @@ bin/Physics*
|
||||
bin/Terrain*
|
||||
bin/Regions/*
|
||||
bin/UserAssets
|
||||
bin/assetcache
|
||||
bin/maptiles
|
||||
bin/estate_settings.xml
|
||||
bin/config-include/CenomeCache.ini
|
||||
bin/config-include/FlotsamCache.ini
|
||||
@@ -60,7 +45,6 @@ bin/OpenSim.Grid.InventoryServer.log
|
||||
bin/OpenSim.Grid.MessagingServer.log
|
||||
bin/OpenSim.Grid.UserServer.log
|
||||
bin/OpenSim.log
|
||||
bin/*.manifest
|
||||
bin/crashes/
|
||||
Examples/*.dll
|
||||
OpenSim.build
|
||||
@@ -77,20 +61,4 @@ TAGS
|
||||
Makefile.local
|
||||
bin/.version
|
||||
compile.bat
|
||||
addon-modules
|
||||
OpenSim/Data/Tests/test-results/
|
||||
OpenSim/Framework/Serialization/Tests/test-results/
|
||||
OpenSim/Framework/Servers/Tests/test-results/
|
||||
OpenSim/Framework/Tests/test-results/
|
||||
OpenSim/Region/ClientStack/Linden/Caps/test-results/
|
||||
OpenSim/Region/ClientStack/Linden/UDP/Tests/test-results/
|
||||
OpenSim/Region/CoreModules/test-results/
|
||||
OpenSim/Region/Framework/test-results/
|
||||
OpenSim/Region/OptionalModules/test-results/
|
||||
OpenSim/Region/Physics/BulletDotNETPlugin/
|
||||
OpenSim/Region/Physics/Manager/test-results/
|
||||
OpenSim/Region/Physics/OdePlugin/Tests/test-results/
|
||||
OpenSim/Region/ScriptEngine/test-results/
|
||||
OpenSim/Tests/Common/test-results/
|
||||
OpenSim/Tests/test-results/
|
||||
test-results/
|
||||
|
||||
|
||||
@@ -2,38 +2,13 @@
|
||||
<!-- please leave the top comment for us emacs folks -->
|
||||
<property name="nunitcmd" value="nunit-console" />
|
||||
|
||||
<!-- This target produces a source distribution of OpenSimulator -->
|
||||
<!-- TODO: A few parameters still need to be tweaked after running this - need to do this automatically with sed or similar -->
|
||||
<target name="distsrc">
|
||||
<copy file="bin/OpenSim.ini.example" tofile="bin/OpenSim.ini"/>
|
||||
<copy file="bin/config-include/StandaloneCommon.ini.example" tofile="bin/config-include/StandaloneCommon.ini"/>
|
||||
<copy file="bin/config-include/FlotsamCache.ini.example" tofile="bin/config-include/FlotsamCache.ini"/>
|
||||
<!-- delete files generated by runprebuild.sh which had to be run in order to generate the build file for this target-->
|
||||
<delete>
|
||||
<fileset basedir="OpenSim">
|
||||
<include name="**/*.build"/>
|
||||
<include name="**/*.csproj*"/>
|
||||
<include name="**/*.dll.build"/>
|
||||
<include name="**/*.pidb"/>
|
||||
<exclude name="Tools/OpenSim.32BitLaunch/**"/>
|
||||
<exclude name="Tools/Robust.32BitLaunch/**"/>
|
||||
<exclude name="Tools/LaunchSLClient/**"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
<delete>
|
||||
<fileset>
|
||||
<include name="OpenSim.build"/>
|
||||
<include name="OpenSim.sln"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<property name="distbindir" value="distbin" />
|
||||
<!-- This target produces a binary directory called distbin/ in OpenSim/bin which contains everything needed for binary distribution -->
|
||||
<!-- For safety/laziness sake, we're going to take the approach of deleting known extraneous files here rather than
|
||||
trying to copy across only the essential ones -->
|
||||
<property name="distbindir" value="distbin" />
|
||||
<target name="distbin">
|
||||
<copy file="bin/OpenSim.ini.example" tofile="bin/OpenSim.ini"/>
|
||||
<delete dir="${distbindir}"/>
|
||||
<!-- <copy file="*" todir="${distbindir}"/> -->
|
||||
<copy todir="${distbindir}">
|
||||
<fileset>
|
||||
<include name="**"/>
|
||||
@@ -45,8 +20,6 @@
|
||||
<delete dir="${distbindir}/.nant"/>
|
||||
<delete>
|
||||
<fileset basedir="${distbindir}">
|
||||
<include name="compile.bat"/>
|
||||
<include name="BUILDING.txt"/>
|
||||
<include name="Makefile"/>
|
||||
<include name="nant-color"/>
|
||||
<include name="OpenSim.*"/>
|
||||
@@ -55,15 +28,59 @@
|
||||
<include name="TESTING.txt"/>
|
||||
<include name="TestResult.xml"/>
|
||||
<include name="bin/OpenSim.Server.ini"/>
|
||||
<include name="bin/Regions/Regions.ini"/>
|
||||
<include name="bin/Regions/*"/>
|
||||
<include name="bin/*.db"/>
|
||||
<include name="**/.git/**"/>
|
||||
<include name=".gitignore"/>
|
||||
<include name=".hgignore"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
</target>
|
||||
|
||||
<!-- I don't think these targets are being actively used. But just in case, we'll just comment them out for now - justincc -->
|
||||
<!--
|
||||
<property name="projectdir" value="opensim-0.6.9" />
|
||||
<target name="dist" depends="distdir">
|
||||
<zip zipfile="${projectdir}.zip">
|
||||
<fileset basedir=".">
|
||||
<include name="${projectdir}/**" />
|
||||
</fileset>
|
||||
</zip>
|
||||
<tar destfile="${projectdir}.tar.gz" compression="GZip">
|
||||
<fileset basedir=".">
|
||||
<include name="${projectdir}/**" />
|
||||
</fileset>
|
||||
</tar>
|
||||
</target>
|
||||
|
||||
<target name="distdir">
|
||||
<delete dir="${projectdir}" />
|
||||
<copy todir="${projectdir}">
|
||||
<fileset basedir=".">
|
||||
<include name="ThirdPartyLicenses/**" />
|
||||
<include name="CONTRIBUTORS.txt" />
|
||||
<include name="README" />
|
||||
<include name="OpenSim/**/*.cs" />
|
||||
<include name="**/*.build" />
|
||||
<include name="**/*.csproj" />
|
||||
<include name="**/*.csproj.user" />
|
||||
<include name="**/*.sln" />
|
||||
<include name="bin/*.dll" />
|
||||
<include name="bin/*.so" />
|
||||
<include name="bin/*.config" />
|
||||
<include name="bin/assets/**" />
|
||||
<include name="bin/data/**" />
|
||||
<include name="bin/OpenSim*xml" />
|
||||
<include name="bin/OpenSim.ini" />
|
||||
<include name="bin/defaultstripe.png" />
|
||||
<exclude name="bin/OpenSim.*dll" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<touch file="${projectdir}/bin/startup_commands.txt" />
|
||||
</target>
|
||||
-->
|
||||
|
||||
<target name="test" depends="build, find-nunit">
|
||||
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
||||
|
||||
@@ -72,16 +89,16 @@
|
||||
the assembly here as an exec, and you add the fail clause later.
|
||||
This lets all the unit tests run and tells you if they fail at the
|
||||
end, instead of stopping short -->
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests">
|
||||
<arg value="./bin/OpenSim.Tests.dll" />
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests)==0}" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.tests">
|
||||
<arg value="./bin/OpenSim.Framework.Tests.dll" />
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.communications.tests">
|
||||
<arg value="./bin/OpenSim.Framework.Communications.Tests.dll" />
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.communications.tests)==0}" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.servers.tests">
|
||||
<arg value="./bin/OpenSim.Framework.Servers.Tests.dll" />
|
||||
</exec>
|
||||
@@ -92,15 +109,12 @@
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.serialization.tests)==0}" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.clientstack.lindencaps.tests">
|
||||
<arg value="./bin/OpenSim.Region.ClientStack.LindenCaps.Tests.dll" />
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindencaps.tests)==0}" />
|
||||
|
||||
<!--
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.clientstack.lindenudp.tests">
|
||||
<arg value="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" />
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindenudp.tests)==0}" />
|
||||
-->
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.scriptengine.tests">
|
||||
<arg value="./bin/OpenSim.Region.ScriptEngine.Tests.dll" />
|
||||
@@ -112,49 +126,130 @@
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.optionalmodules.tests">
|
||||
<arg value="./bin/OpenSim.Region.OptionalModules.Tests.dll" />
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.optionalmodules.tests)==0}" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.framework.tests">
|
||||
<arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.tests">
|
||||
<arg value="./bin/OpenSim.Data.Tests.dll" />
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.sqlite.tests">
|
||||
<arg value="./bin/OpenSim.Data.SQLite.Tests.dll" />
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.sqlite.tests)==0}" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.capabilities.handlers.tests">
|
||||
<arg value="./bin/OpenSim.Capabilities.Handlers.Tests.dll" />
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.mysql.tests">
|
||||
<arg value="./bin/OpenSim.Data.MySQL.Tests.dll" />
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.mysql.tests)==0}" />
|
||||
|
||||
<delete dir="%temp%"/>
|
||||
</target>
|
||||
|
||||
<target name="test-stress" depends="build, find-nunit">
|
||||
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
||||
<target name="test-cov" depends="build">
|
||||
<!-- Code Coverage Test. Prototype, only works with mono 1.2. Instructions in http://opensimulator.org/wiki/Automated_Testing -->
|
||||
<mkdir dir="cov" failonerror="false" />
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Framework.Servers.cov,+[OpenSim.Framework.Servers]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Framework.Servers.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Framework.Servers" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Framework.Servers ./cov/OpenSim.Framework.Servers.cov" />
|
||||
</exec>
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.stress">
|
||||
<arg value="./bin/OpenSim.Tests.Stress.dll" />
|
||||
</exec>
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Framework.Communications.cov,+[OpenSim.Framework.Communications]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Framework.Communications.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Framework.Communications" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Framework.Servers ./cov/OpenSim.Framework.Communications.cov" />
|
||||
</exec>
|
||||
|
||||
<!--
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Region.ClientStack.LindenUDP.cov,+[OpenSim.Region.ClientStack.LindenUDP]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Region.ClientStack.LindenUDP" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Region.ClientStack.LindenUDP ./cov/OpenSim.Region.ClientStack.LindenUDP.cov" />
|
||||
</exec>
|
||||
-->
|
||||
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Region.ScriptEngine.Shared.cov,+[OpenSim.Region.ScriptEngine.Shared]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Region.ScriptEngine.Shared.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Region.ScriptEngine.Shared" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Region.ScriptEngine.Shared ./cov/OpenSim.Region.ScriptEngine.Shared.cov" />
|
||||
</exec>
|
||||
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Region.ScriptEngine.Shared.CodeTools.cov,+[OpenSim.Region.ScriptEngine.Shared.CodeTools]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Region.ScriptEngine.Shared.CodeTools" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Region.ScriptEngine.Shared.CodeTools ./cov/OpenSim.Region.ScriptEngine.Shared.CodeTools.cov" />
|
||||
</exec>
|
||||
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Region.CoreModules.cov,+[OpenSim.Region.CoreModules]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Region.CoreModules.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Region.CoreModules" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Region.CoreModules ./cov/OpenSim.Region.CoreModules.cov" />
|
||||
</exec>
|
||||
|
||||
<fail message="Failures reported in stress tests." unless="${int::parse(testresult.opensim.tests.stress)==0}" />
|
||||
<delete dir="%temp%"/>
|
||||
</target>
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Region.Framework.cov,+[OpenSim.Region.Framework]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Region.Framework" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Region.Framework ./cov/OpenSim.Region.Framework.cov" />
|
||||
</exec>
|
||||
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Data.SQLite.cov,+[OpenSim.Data.SQLite]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Data.SQLite.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Data.SQLite" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Data.SQLite ./cov/OpenSim.Data.SQLite.cov" />
|
||||
</exec>
|
||||
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Data.MySQL.cov,+[OpenSim.Data.MySQL.Tests]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Data.MySQL.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Data.MySQL" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Data.MySQL ./cov/OpenSim.Data.MySQL.cov" />
|
||||
</exec>
|
||||
|
||||
<target name="test-perf" depends="build, find-nunit">
|
||||
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
||||
<delete file="C:\NUnitPrimaryTrace.txt" failonerror="false" />
|
||||
<delete file="TestResult.xml" failonerror="false" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.performance">
|
||||
<arg value="./bin/OpenSim.Tests.Performance.dll" />
|
||||
</exec>
|
||||
|
||||
<fail message="Failures reported in performance tests." unless="${int::parse(testresult.opensim.tests.performance)==0}" />
|
||||
<delete dir="%temp%"/>
|
||||
</target>
|
||||
|
||||
<target name="find-nunit">
|
||||
@@ -167,24 +262,27 @@
|
||||
if="${int::parse(hasnunit2)==0}" />
|
||||
<property name="nunitcmd" value="nunit-console"
|
||||
if="${int::parse(hasnunit2)==1}" />
|
||||
|
||||
</target>
|
||||
|
||||
<!-- this is used for panda test execution -->
|
||||
<!-- work in progress -->
|
||||
|
||||
<target name="test-xml" depends="build, find-nunit">
|
||||
|
||||
|
||||
<mkdir dir="test-results" failonerror="false" />
|
||||
<!-- Unit Test Assembly -->
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.tests">
|
||||
<arg value="./bin/OpenSim.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.tests">
|
||||
<arg value="./bin/OpenSim.Framework.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Framework.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.communications.tests">
|
||||
<arg value="./bin/OpenSim.Framework.Communications.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Framework.Communications.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.serialization.tests">
|
||||
<arg value="./bin/OpenSim.Framework.Serialization.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Framework.Serialization.Tests.dll-Results.xml" />
|
||||
@@ -195,15 +293,12 @@
|
||||
<arg value="-xml=test-results/OpenSim.Framework.Servers.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.clientstack.lindencaps.tests">
|
||||
<arg value="./bin/OpenSim.Region.ClientStack.LindenCaps.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Region.ClientStack.LindenCaps.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<!--
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.clientstack.lindenudp.tests">
|
||||
<arg value="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Region.ClientStack.LindenUDP.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
-->
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.scriptengine.tests">
|
||||
<arg value="./bin/OpenSim.Region.ScriptEngine.Tests.dll" />
|
||||
@@ -215,37 +310,60 @@
|
||||
<arg value="-xml=test-results/OpenSim.Region.CoreModules.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.optionalmodules.tests">
|
||||
<arg value="./bin/OpenSim.Region.OptionalModules.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Region.OptionalModules.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.framework.tests">
|
||||
<arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Region.Framework.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.tests">
|
||||
<arg value="./bin/OpenSim.Data.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Data.Tests.dll-Results.xml" />
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.sqlite.tests">
|
||||
<arg value="./bin/OpenSim.Data.SQLite.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Data.SQLite.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.capabilities.handlers.tests">
|
||||
<arg value="./bin/OpenSim.Capabilities.Handlers.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Capabilities.Handlers.Tests.dll-Results.xml" />
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.mysql.tests">
|
||||
<arg value="./bin/OpenSim.Data.MySQL.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Data.MySQL.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.communications.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindenudp.tests)==0}" />
|
||||
<!-- <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindenudp.tests)==0}" /> -->
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.scriptengine.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.optionalmodules.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.sqlite.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.mysql.tests)==0}" />
|
||||
|
||||
</target>
|
||||
<!-- <exec program="nunit-console.exe" failonerror="false" resultproperty="testresult.acceptancetestassembly"> -->
|
||||
<!-- <arg value="AcceptanceTestAssembly.dll" /> -->
|
||||
<!-- <arg value="/xml=AcceptanceTestAssembly-Results.xml" /> -->
|
||||
<!-- </exec> -->
|
||||
|
||||
<!-- <fail message="Failures reported in unit tests." unless="${int::parse(testresult.unittestassembly)==0}" /> -->
|
||||
<!-- <fail message="Failures reported in acceptance tests." unless="${int::parse(testresult.acceptancetestassembly)==0}" /> -->
|
||||
<!-- </target> -->
|
||||
|
||||
|
||||
|
||||
<!-- <nunit2 failonerror="true" verbose="true"> -->
|
||||
<!-- <formatter type="Xml" usefile="true" extension=".xml" outputdir="./test-results" /> -->
|
||||
<!-- <test> -->
|
||||
<!-- <assemblies> -->
|
||||
<!-- <include name="./bin/OpenSim.Framework.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Framework.Communications.Tests.dll"/> -->
|
||||
<!-- <include name="./bin/OpenSim.Framework.Servers.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Region.ScriptEngine.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Region.CoreModules.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Region.Framework.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Data.SQLite.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Data.MySQL.Tests.dll" /> -->
|
||||
<!-- </assemblies> -->
|
||||
<!-- </test> -->
|
||||
<!-- </nunit2> -->
|
||||
<!-- </target> -->
|
||||
|
||||
<target name="doxygen">
|
||||
<exec program="doxygen" workingdir="doc" commandline="doxygen.conf" />
|
||||
|
||||
15
BUILDING.txt
15
BUILDING.txt
@@ -1,4 +1,4 @@
|
||||
==== Building OpenSim ====
|
||||
== Building OpenSim ==
|
||||
|
||||
=== Building on Windows ===
|
||||
|
||||
@@ -12,27 +12,18 @@ Steps:
|
||||
=== Building on Linux ===
|
||||
|
||||
Prereqs:
|
||||
* Mono >= 2.4.3
|
||||
* Mono >= 2.4.2
|
||||
* Nant >= 0.85
|
||||
* On some Linux distributions you may need to install additional packages.
|
||||
See http://opensimulator.org/wiki/Dependencies for more information.
|
||||
|
||||
* May also use xbuild (included in mono distributions)
|
||||
* May use Monodevelop, a cross-platform IDE
|
||||
|
||||
From the distribution type:
|
||||
* ./runprebuild.sh
|
||||
* nant (or xbuild)
|
||||
* nant
|
||||
* cd bin
|
||||
* copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include
|
||||
* run mono OpenSim.exe
|
||||
|
||||
=== Using Monodevelop ===
|
||||
|
||||
From the distribution type:
|
||||
* ./runprebuild.sh
|
||||
* type monodevelop OpenSim.sln
|
||||
|
||||
=== References ===
|
||||
|
||||
Helpful resources:
|
||||
|
||||
@@ -1,39 +1,34 @@
|
||||
<<<>>>>The following people have contributed to OpenSim (Thank you
|
||||
The following people have contributed to OpenSim (Thank you
|
||||
for your effort!)
|
||||
|
||||
Add your name in here if you have committed to OpenSim
|
||||
|
||||
= Current OpenSim Developers (in very rough order of appearance) =
|
||||
These folks represent the current core team for OpenSim, and are the
|
||||
people that make the day to day of OpenSim happen.
|
||||
|
||||
* justincc (OSVW Consulting, justincc.org)
|
||||
* chi11ken (Genkii)
|
||||
* dahlia
|
||||
* Melanie Thielker
|
||||
* Diva (Crista Lopes, University of California, Irvine)
|
||||
* Dan Lake (Intel)
|
||||
* Marck
|
||||
* Mic Bowman (Intel)
|
||||
* BlueWall (James Hughes)
|
||||
* Nebadon Izumi (Michael Cerquoni, OSgrid)
|
||||
* Snoopy Pfeffer
|
||||
* Richard Adams (Intel)
|
||||
|
||||
= Core Developers Following the White Rabbit =
|
||||
Core developers who have temporarily (we hope) gone chasing the white rabbit.
|
||||
They are in all similar to the active core developers, except that they haven't
|
||||
been that active lately, so their voting rights are awaiting their come back.
|
||||
|
||||
* MW (Tribal Media AB)
|
||||
* Adam Frisby (DeepThink Pty Ltd)
|
||||
* MingChen (DeepThink Pty Ltd)
|
||||
* lbsa71 (Tribal Media AB)
|
||||
* Sean Dague / sdague (IBM)
|
||||
* Tedd
|
||||
* justincc
|
||||
* Teravus (w3z)
|
||||
* Johan Berntsson (3Di)
|
||||
* Ckrinke (Charles Krinke)
|
||||
* chi11ken (Genkii)
|
||||
* adjohn (Genkii)
|
||||
* Dr Scofield aka Dirk Husemann (IBM Research - Zurich)
|
||||
* dahlia
|
||||
* mikem (3Di)
|
||||
* Melanie Thielker
|
||||
* Homer_Horwitz
|
||||
* idb (Ian Brown)
|
||||
* Diva (Crista Lopes, University of California, Irvine)
|
||||
* nlin (3Di)
|
||||
* Arthur Rodrigo S Valadares (IBM)
|
||||
* John Hurliman
|
||||
|
||||
|
||||
= Past Open Sim Developers =
|
||||
These folks are alumns of the OpenSim core group, but are now
|
||||
@@ -49,12 +44,6 @@ where we are today.
|
||||
* Dalien
|
||||
* Darok
|
||||
* Alondria
|
||||
* Sean Dague / sdague (IBM)
|
||||
* Tedd
|
||||
* MingChen (DeepThink Pty Ltd)
|
||||
* adjohn (Genkii)
|
||||
* idb (Ian Brown)
|
||||
* Johan Berntsson (3Di)
|
||||
|
||||
|
||||
= Additional OpenSim Contributors =
|
||||
@@ -71,7 +60,6 @@ what it is today.
|
||||
* CharlieO
|
||||
* ChrisDown
|
||||
* Chris Yeoh (IBM)
|
||||
* controlbreak
|
||||
* coyled
|
||||
* Daedius
|
||||
* Dong Jun Lan (IBM)
|
||||
@@ -81,18 +69,12 @@ what it is today.
|
||||
* dmiles (Daxtron Labs)
|
||||
* dslake (Intel)
|
||||
* FredoChaplin
|
||||
* Garmin Kawaguichi
|
||||
* Gerhard
|
||||
* Godfrey
|
||||
* Grumly57
|
||||
* GuduleLapointe
|
||||
* Ewe Loon
|
||||
* Fernando Oliveira
|
||||
* Fly-Man
|
||||
* Flyte Xevious
|
||||
* Garmin Kawaguichi
|
||||
* Gryc Ueusp
|
||||
* Hiro Lecker
|
||||
* Imaze Rhiano
|
||||
* Intimidated
|
||||
* Jeremy Bongio (IBM)
|
||||
@@ -106,31 +88,22 @@ what it is today.
|
||||
* Kitto Flora
|
||||
* KittyLiu
|
||||
* Kurt Taylor (IBM)
|
||||
* lkalif
|
||||
* lulurun
|
||||
* M.Igarashi
|
||||
* maimedleech
|
||||
* Mana Janus
|
||||
* MarcelEdward
|
||||
* Mic Bowman
|
||||
* Michelle Argus
|
||||
* Michael Cortez (The Flotsam Project, http://osflotsam.org/)
|
||||
* Micheil Merlin
|
||||
* Mike Osias (IBM)
|
||||
* Mike Pitman (IBM)
|
||||
* mikkopa/_someone - RealXtend
|
||||
* Misterblue (Intel)
|
||||
* Mircea Kitsune
|
||||
* mpallari
|
||||
* MrMonkE
|
||||
* Nebadon Izumi (Michael Cerquoni - http://OSgrid.org)
|
||||
* Neil Canham
|
||||
* nornalbion
|
||||
* Omar Vera Ustariz (IBM)
|
||||
* openlifegrid.com
|
||||
* Oren Hurvitz (Kitely)
|
||||
* otakup0pe
|
||||
* Pixel Tomsen
|
||||
* ralphos
|
||||
* RemedyTomm
|
||||
* Revolution
|
||||
@@ -141,15 +114,9 @@ what it is today.
|
||||
* Ruud Lathorp
|
||||
* SachaMagne
|
||||
* Salahzar Stenvaag
|
||||
* satguru p srivastava
|
||||
* sempuki
|
||||
* SignpostMarv
|
||||
* SpotOn3D
|
||||
* Stefan_Boom / stoehr
|
||||
* Snoopy
|
||||
* Strawberry Fride
|
||||
* Talun
|
||||
* TechplexEngineer (Blake Bourque)
|
||||
* TBG Renfold
|
||||
* tglion
|
||||
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
|
||||
* tyre
|
||||
@@ -197,8 +164,6 @@ This software uses components from the following developers:
|
||||
* log4net (http://logging.apache.org/log4net/)
|
||||
* GlynnTucker.Cache (http://gtcache.sourceforge.net/)
|
||||
* NDesk.Options 0.2.1 (http://www.ndesk.org/Options)
|
||||
* Json.NET 3.5 Release 6. The binary used is actually Newtonsoft.Json.Net20.dll for Mono 2.4 compatability (http://james.newtonking.com/projects/json-net.aspx)
|
||||
* zlib.net for C# 1.0.4 (http://www.componentace.com/zlib_.NET.htm)
|
||||
|
||||
Some plugins are based on Cable Beach
|
||||
Cable Beach is Copyright (c) 2008 Intel Corporation
|
||||
@@ -208,4 +173,3 @@ In addition, we would like to thank:
|
||||
* The Mono Project
|
||||
* The NANT Developers
|
||||
* Microsoft (.NET, MSSQL-Adapters)
|
||||
*x
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) Contributors, http://opensimulator.org/
|
||||
Copyright (c) Contributors, http://opensimulator.org/
|
||||
See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenSim.Data;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Communications.Services;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework.Communications.Osp;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Communications.Hypergrid;
|
||||
using OpenSim.Region.Communications.Local;
|
||||
using OpenSim.Region.Communications.OGS1;
|
||||
|
||||
namespace OpenSim.ApplicationPlugins.CreateCommsManager
|
||||
{
|
||||
public class CreateCommsManagerPlugin : IApplicationPlugin
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
#region IApplicationPlugin Members
|
||||
|
||||
// TODO: required by IPlugin, but likely not at all right
|
||||
private string m_name = "CreateCommsManagerPlugin";
|
||||
private string m_version = "0.0";
|
||||
|
||||
public string Version
|
||||
{
|
||||
get { return m_version; }
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return m_name; }
|
||||
}
|
||||
|
||||
protected OpenSimBase m_openSim;
|
||||
|
||||
protected BaseHttpServer m_httpServer;
|
||||
|
||||
protected CommunicationsManager m_commsManager;
|
||||
protected GridInfoService m_gridInfoService;
|
||||
|
||||
protected IRegionCreator m_regionCreator;
|
||||
|
||||
public void Initialise()
|
||||
{
|
||||
m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
|
||||
throw new PluginNotInitialisedException(Name);
|
||||
}
|
||||
|
||||
public void Initialise(OpenSimBase openSim)
|
||||
{
|
||||
m_openSim = openSim;
|
||||
m_httpServer = openSim.HttpServer;
|
||||
MainServer.Instance = m_httpServer;
|
||||
|
||||
InitialiseCommsManager(openSim);
|
||||
if (m_commsManager != null)
|
||||
{
|
||||
m_openSim.ApplicationRegistry.RegisterInterface<IUserService>(m_commsManager.UserService);
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (m_openSim.ApplicationRegistry.TryGet<IRegionCreator>(out m_regionCreator))
|
||||
{
|
||||
m_regionCreator.OnNewRegionCreated += RegionCreated;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void RegionCreated(IScene scene)
|
||||
{
|
||||
if (m_commsManager != null)
|
||||
{
|
||||
scene.RegisterModuleInterface<IUserService>(m_commsManager.UserService);
|
||||
}
|
||||
}
|
||||
|
||||
protected void InitialiseCommsManager(OpenSimBase openSim)
|
||||
{
|
||||
LibraryRootFolder libraryRootFolder = new LibraryRootFolder(m_openSim.ConfigurationSettings.LibrariesXMLFile);
|
||||
|
||||
bool hgrid = m_openSim.ConfigSource.Source.Configs["Startup"].GetBoolean("hypergrid", false);
|
||||
|
||||
if (hgrid)
|
||||
{
|
||||
InitialiseHGServices(openSim, libraryRootFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
InitialiseStandardServices(libraryRootFolder);
|
||||
}
|
||||
|
||||
openSim.CommunicationsManager = m_commsManager;
|
||||
}
|
||||
|
||||
protected void InitialiseHGServices(OpenSimBase openSim, LibraryRootFolder libraryRootFolder)
|
||||
{
|
||||
// Standalone mode is determined by !startupConfig.GetBoolean("gridmode", false)
|
||||
if (m_openSim.ConfigurationSettings.Standalone)
|
||||
{
|
||||
InitialiseHGStandaloneServices(libraryRootFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We are in grid mode
|
||||
InitialiseHGGridServices(libraryRootFolder);
|
||||
}
|
||||
}
|
||||
|
||||
protected void InitialiseStandardServices(LibraryRootFolder libraryRootFolder)
|
||||
{
|
||||
// Standalone mode is determined by !startupConfig.GetBoolean("gridmode", false)
|
||||
if (m_openSim.ConfigurationSettings.Standalone)
|
||||
{
|
||||
InitialiseStandaloneServices(libraryRootFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We are in grid mode
|
||||
InitialiseGridServices(libraryRootFolder);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialises the backend services for standalone mode, and registers some http handlers
|
||||
/// </summary>
|
||||
/// <param name="libraryRootFolder"></param>
|
||||
protected virtual void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder)
|
||||
{
|
||||
m_commsManager
|
||||
= new CommunicationsLocal(
|
||||
m_openSim.ConfigurationSettings, m_openSim.NetServersInfo,
|
||||
libraryRootFolder);
|
||||
|
||||
CreateGridInfoService();
|
||||
}
|
||||
|
||||
protected virtual void InitialiseGridServices(LibraryRootFolder libraryRootFolder)
|
||||
{
|
||||
m_commsManager
|
||||
= new CommunicationsOGS1(m_openSim.NetServersInfo, libraryRootFolder);
|
||||
|
||||
m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler());
|
||||
m_httpServer.AddStreamHandler(new OpenSim.XSimStatusHandler(m_openSim));
|
||||
if (m_openSim.userStatsURI != String.Empty)
|
||||
m_httpServer.AddStreamHandler(new OpenSim.UXSimStatusHandler(m_openSim));
|
||||
}
|
||||
|
||||
protected virtual void InitialiseHGStandaloneServices(LibraryRootFolder libraryRootFolder)
|
||||
{
|
||||
m_commsManager
|
||||
= new HGCommunicationsStandalone(
|
||||
m_openSim.ConfigurationSettings, m_openSim.NetServersInfo, m_httpServer,
|
||||
libraryRootFolder, false);
|
||||
|
||||
CreateGridInfoService();
|
||||
}
|
||||
|
||||
protected virtual void InitialiseHGGridServices(LibraryRootFolder libraryRootFolder)
|
||||
{
|
||||
m_commsManager
|
||||
= new HGCommunicationsGridMode(
|
||||
m_openSim.NetServersInfo,
|
||||
m_openSim.SceneManager, libraryRootFolder);
|
||||
|
||||
m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler());
|
||||
m_httpServer.AddStreamHandler(new OpenSim.XSimStatusHandler(m_openSim));
|
||||
if (m_openSim.userStatsURI != String.Empty)
|
||||
m_httpServer.AddStreamHandler(new OpenSim.UXSimStatusHandler(m_openSim));
|
||||
}
|
||||
|
||||
private void CreateGridInfoService()
|
||||
{
|
||||
// provide grid info
|
||||
m_gridInfoService = new GridInfoService(m_openSim.ConfigSource.Source);
|
||||
m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod);
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<Addin id="OpenSim.ApplicationPlugins.CreateCommsManager" version="0.1">
|
||||
<Runtime>
|
||||
<Import assembly="OpenSim.ApplicationPlugins.CreateCommsManager.dll"/>
|
||||
</Runtime>
|
||||
<Dependencies>
|
||||
<Addin id="OpenSim" version="0.5" />
|
||||
</Dependencies>
|
||||
<Extension path = "/OpenSim/Startup">
|
||||
<Plugin id="CreateCommsManager" type="OpenSim.ApplicationPlugins.CreateCommsManager.CreateCommsManagerPlugin" />
|
||||
</Extension>
|
||||
</Addin>
|
||||
@@ -30,7 +30,6 @@ using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.RegionLoader.Filesystem;
|
||||
using OpenSim.Framework.RegionLoader.Web;
|
||||
@@ -69,7 +68,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
|
||||
public void Initialise()
|
||||
{
|
||||
m_log.Error("[LOAD REGIONS PLUGIN]: " + Name + " cannot be default-initialized!");
|
||||
m_log.Error("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
|
||||
throw new PluginNotInitialisedException(Name);
|
||||
}
|
||||
|
||||
@@ -86,47 +85,46 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
IRegionLoader regionLoader;
|
||||
if (m_openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
|
||||
{
|
||||
m_log.Info("[LOAD REGIONS PLUGIN]: Loading region configurations from filesystem");
|
||||
m_log.Info("[LOADREGIONS]: Loading region configurations from filesystem");
|
||||
regionLoader = new RegionLoaderFileSystem();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("[LOAD REGIONS PLUGIN]: Loading region configurations from web");
|
||||
m_log.Info("[LOADREGIONSPLUGIN]: Loading region configurations from web");
|
||||
regionLoader = new RegionLoaderWebServer();
|
||||
}
|
||||
|
||||
m_log.Info("[LOADREGIONSPLUGIN]: Loading region configurations...");
|
||||
|
||||
regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source);
|
||||
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
|
||||
|
||||
m_log.Info("[LOAD REGIONS PLUGIN]: Loading specific shared modules...");
|
||||
m_log.Info("[LOAD REGIONS PLUGIN]: DynamicTextureModule...");
|
||||
m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules...");
|
||||
m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule...");
|
||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
|
||||
m_log.Info("[LOAD REGIONS PLUGIN]: LoadImageURLModule...");
|
||||
m_log.Info("[LOADREGIONSPLUGIN]: InstantMessageModule...");
|
||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule());
|
||||
m_log.Info("[LOADREGIONSPLUGIN]: LoadImageURLModule...");
|
||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
|
||||
m_log.Info("[LOAD REGIONS PLUGIN]: XMLRPCModule...");
|
||||
m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule...");
|
||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
|
||||
// m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
|
||||
// m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
|
||||
m_log.Info("[LOAD REGIONS PLUGIN]: Done.");
|
||||
m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
|
||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
|
||||
m_log.Info("[LOADREGIONSPLUGIN]: Done.");
|
||||
|
||||
if (!CheckRegionsForSanity(regionsToLoad))
|
||||
{
|
||||
m_log.Error("[LOAD REGIONS PLUGIN]: Halting startup due to conflicts in region configurations");
|
||||
m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < regionsToLoad.Length; i++)
|
||||
{
|
||||
IScene scene;
|
||||
m_log.Debug("[LOAD REGIONS PLUGIN]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
|
||||
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
|
||||
Thread.CurrentThread.ManagedThreadId.ToString() +
|
||||
")");
|
||||
|
||||
bool changed = m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]);
|
||||
m_openSim.CreateRegion(regionsToLoad[i], true, out scene);
|
||||
if (changed)
|
||||
regionsToLoad[i].EstateSettings.Save();
|
||||
|
||||
if (scene != null)
|
||||
{
|
||||
m_newRegionCreatedHandler = OnNewRegionCreated;
|
||||
@@ -154,20 +152,9 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
/// <returns>True if we're sane, false if we're insane</returns>
|
||||
private bool CheckRegionsForSanity(RegionInfo[] regions)
|
||||
{
|
||||
if (regions.Length == 0)
|
||||
if (regions.Length <= 1)
|
||||
return true;
|
||||
|
||||
foreach (RegionInfo region in regions)
|
||||
{
|
||||
if (region.RegionID == UUID.Zero)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[LOAD REGIONS PLUGIN]: Region {0} has invalid UUID {1}",
|
||||
region.RegionName, region.RegionID);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < regions.Length - 1; i++)
|
||||
{
|
||||
for (int j = i + 1; j < regions.Length; j++)
|
||||
@@ -175,7 +162,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
if (regions[i].RegionID == regions[j].RegionID)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same UUID {2}",
|
||||
"[LOADREGIONS]: Regions {0} and {1} have the same UUID {2}",
|
||||
regions[i].RegionName, regions[j].RegionName, regions[i].RegionID);
|
||||
return false;
|
||||
}
|
||||
@@ -183,14 +170,14 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
regions[i].RegionLocX == regions[j].RegionLocX && regions[i].RegionLocY == regions[j].RegionLocY)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same grid location ({2}, {3})",
|
||||
"[LOADREGIONS]: Regions {0} and {1} have the same grid location ({2}, {3})",
|
||||
regions[i].RegionName, regions[j].RegionName, regions[i].RegionLocX, regions[i].RegionLocY);
|
||||
return false;
|
||||
}
|
||||
else if (regions[i].InternalEndPoint.Port == regions[j].InternalEndPoint.Port)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same internal IP port {2}",
|
||||
"[LOADREGIONS]: Regions {0} and {1} have the same internal IP port {2}",
|
||||
regions[i].RegionName, regions[j].RegionName, regions[i].InternalEndPoint.Port);
|
||||
return false;
|
||||
}
|
||||
@@ -199,5 +186,35 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void LoadRegionFromConfig(OpenSimBase openSim, ulong regionhandle)
|
||||
{
|
||||
m_log.Info("[LOADREGIONS]: Load Regions addin being initialised");
|
||||
|
||||
IRegionLoader regionLoader;
|
||||
if (openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
|
||||
{
|
||||
m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem");
|
||||
regionLoader = new RegionLoaderFileSystem();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("[LOADREGIONS]: Loading Region Info from web");
|
||||
regionLoader = new RegionLoaderWebServer();
|
||||
}
|
||||
|
||||
regionLoader.SetIniConfigSource(openSim.ConfigSource.Source);
|
||||
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
|
||||
for (int i = 0; i < regionsToLoad.Length; i++)
|
||||
{
|
||||
if (regionhandle == regionsToLoad[i].RegionHandle)
|
||||
{
|
||||
IScene scene;
|
||||
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
|
||||
Thread.CurrentThread.ManagedThreadId.ToString() + ")");
|
||||
openSim.CreateRegion(regionsToLoad[i], true, out scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,12 +62,12 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
new List<ISharedRegionModule>();
|
||||
|
||||
#region IApplicationPlugin implementation
|
||||
|
||||
|
||||
public void Initialise (OpenSimBase openSim)
|
||||
{
|
||||
m_openSim = openSim;
|
||||
m_openSim.ApplicationRegistry.RegisterInterface<IRegionModulesController>(this);
|
||||
m_log.DebugFormat("[REGIONMODULES]: Initializing...");
|
||||
m_openSim = openSim;
|
||||
openSim.ApplicationRegistry.RegisterInterface<IRegionModulesController>(this);
|
||||
|
||||
// Who we are
|
||||
string id = AddinManager.CurrentAddin.Id;
|
||||
@@ -81,9 +81,9 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
|
||||
// The [Modules] section in the ini file
|
||||
IConfig modulesConfig =
|
||||
m_openSim.ConfigSource.Source.Configs["Modules"];
|
||||
openSim.ConfigSource.Source.Configs["Modules"];
|
||||
if (modulesConfig == null)
|
||||
modulesConfig = m_openSim.ConfigSource.Source.AddConfig("Modules");
|
||||
modulesConfig = openSim.ConfigSource.Source.AddConfig("Modules");
|
||||
|
||||
// Scan modules and load all that aren't disabled
|
||||
foreach (TypeExtensionNode node in
|
||||
@@ -91,24 +91,66 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
{
|
||||
if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null)
|
||||
{
|
||||
if (CheckModuleEnabled(node, modulesConfig))
|
||||
// Get the config string
|
||||
string moduleString =
|
||||
modulesConfig.GetString("Setup_" + node.Id, String.Empty);
|
||||
|
||||
// We have a selector
|
||||
if (moduleString != String.Empty)
|
||||
{
|
||||
m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type);
|
||||
m_sharedModules.Add(node);
|
||||
// Allow disabling modules even if they don't have
|
||||
// support for it
|
||||
if (moduleString == "disabled")
|
||||
continue;
|
||||
|
||||
// Split off port, if present
|
||||
string[] moduleParts = moduleString.Split(new char[] {'/'}, 2);
|
||||
// Format is [port/][class]
|
||||
string className = moduleParts[0];
|
||||
if (moduleParts.Length > 1)
|
||||
className = moduleParts[1];
|
||||
|
||||
// Match the class name if given
|
||||
if (className != String.Empty &&
|
||||
node.Type.ToString() != className)
|
||||
continue;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type);
|
||||
m_sharedModules.Add(node);
|
||||
}
|
||||
else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null)
|
||||
{
|
||||
if (CheckModuleEnabled(node, modulesConfig))
|
||||
// Get the config string
|
||||
string moduleString =
|
||||
modulesConfig.GetString("Setup_" + node.Id, String.Empty);
|
||||
|
||||
// We have a selector
|
||||
if (moduleString != String.Empty)
|
||||
{
|
||||
m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
|
||||
m_nonSharedModules.Add(node);
|
||||
// Allow disabling modules even if they don't have
|
||||
// support for it
|
||||
if (moduleString == "disabled")
|
||||
continue;
|
||||
|
||||
// Split off port, if present
|
||||
string[] moduleParts = moduleString.Split(new char[] {'/'}, 2);
|
||||
// Format is [port/][class]
|
||||
string className = moduleParts[0];
|
||||
if (moduleParts.Length > 1)
|
||||
className = moduleParts[1];
|
||||
|
||||
// Match the class name if given
|
||||
if (className != String.Empty &&
|
||||
node.Type.ToString() != className)
|
||||
continue;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
|
||||
m_nonSharedModules.Add(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type);
|
||||
}
|
||||
}
|
||||
|
||||
// Load and init the module. We try a constructor with a port
|
||||
@@ -120,7 +162,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
//
|
||||
foreach (TypeExtensionNode node in m_sharedModules)
|
||||
{
|
||||
Object[] ctorArgs = new Object[] { (uint)0 };
|
||||
Object[] ctorArgs = new Object[] {(uint)0};
|
||||
|
||||
// Read the config again
|
||||
string moduleString =
|
||||
@@ -130,7 +172,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
if (moduleString != String.Empty)
|
||||
{
|
||||
// Get the port number from the string
|
||||
string[] moduleParts = moduleString.Split(new char[] { '/' },
|
||||
string[] moduleParts = moduleString.Split(new char[] {'/'},
|
||||
2);
|
||||
if (moduleParts.Length > 1)
|
||||
ctorArgs[0] = Convert.ToUInt32(moduleParts[0]);
|
||||
@@ -153,13 +195,8 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
|
||||
// OK, we're up and running
|
||||
m_sharedInstances.Add(module);
|
||||
module.Initialise(m_openSim.ConfigSource.Source);
|
||||
module.Initialise(openSim.ConfigSource.Source);
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise ()
|
||||
{
|
||||
m_log.DebugFormat("[REGIONMODULES]: PostInitializing...");
|
||||
|
||||
// Immediately run PostInitialise on shared modules
|
||||
foreach (ISharedRegionModule module in m_sharedInstances)
|
||||
@@ -168,6 +205,10 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise ()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IPlugin implementation
|
||||
@@ -199,6 +240,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public string Version
|
||||
{
|
||||
get
|
||||
@@ -216,42 +258,6 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
}
|
||||
|
||||
#region IRegionModulesController implementation
|
||||
|
||||
/// <summary>
|
||||
/// Check that the given module is no disabled in the [Modules] section of the config files.
|
||||
/// </summary>
|
||||
/// <param name="node"></param>
|
||||
/// <param name="modulesConfig">The config section</param>
|
||||
/// <returns>true if the module is enabled, false if it is disabled</returns>
|
||||
protected bool CheckModuleEnabled(TypeExtensionNode node, IConfig modulesConfig)
|
||||
{
|
||||
// Get the config string
|
||||
string moduleString =
|
||||
modulesConfig.GetString("Setup_" + node.Id, String.Empty);
|
||||
|
||||
// We have a selector
|
||||
if (moduleString != String.Empty)
|
||||
{
|
||||
// Allow disabling modules even if they don't have
|
||||
// support for it
|
||||
if (moduleString == "disabled")
|
||||
return false;
|
||||
|
||||
// Split off port, if present
|
||||
string[] moduleParts = moduleString.Split(new char[] { '/' }, 2);
|
||||
// Format is [port/][class]
|
||||
string className = moduleParts[0];
|
||||
if (moduleParts.Length > 1)
|
||||
className = moduleParts[1];
|
||||
|
||||
// Match the class name if given
|
||||
if (className != String.Empty &&
|
||||
node.Type.ToString() != className)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// The root of all evil.
|
||||
// This is where we handle adding the modules to scenes when they
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,9 +35,6 @@ using System.Xml;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
{
|
||||
@@ -661,6 +658,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
{
|
||||
|
||||
int x;
|
||||
string HA1;
|
||||
string first;
|
||||
string last;
|
||||
|
||||
@@ -677,13 +675,17 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
last = String.Empty;
|
||||
}
|
||||
|
||||
UserAccount account = Rest.UserServices.GetUserAccount(UUID.Zero, first, last);
|
||||
UserProfileData udata = Rest.UserServices.GetUserProfile(first, last);
|
||||
|
||||
// If we don't recognize the user id, perhaps it is god?
|
||||
if (account == null)
|
||||
|
||||
if (udata == null)
|
||||
return pass == Rest.GodKey;
|
||||
|
||||
return (Rest.AuthServices.Authenticate(account.PrincipalID, pass, 1) != string.Empty);
|
||||
HA1 = HashToString(pass);
|
||||
HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt));
|
||||
|
||||
return (0 == sc.Compare(HA1, udata.PasswordHash));
|
||||
|
||||
}
|
||||
|
||||
@@ -895,10 +897,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
last = String.Empty;
|
||||
}
|
||||
|
||||
UserAccount account = Rest.UserServices.GetUserAccount(UUID.Zero, first, last);
|
||||
UserProfileData udata = Rest.UserServices.GetUserProfile(first, last);
|
||||
|
||||
// If we don;t recognize the user id, perhaps it is god?
|
||||
|
||||
if (account == null)
|
||||
if (udata == null)
|
||||
{
|
||||
Rest.Log.DebugFormat("{0} Administrator", MsgId);
|
||||
return Rest.GodKey;
|
||||
@@ -906,12 +909,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
else
|
||||
{
|
||||
Rest.Log.DebugFormat("{0} Normal User {1}", MsgId, user);
|
||||
|
||||
// !!! REFACTORING PROBLEM
|
||||
// This is what it was. It doesn't work in 0.7
|
||||
// Nothing retrieves the password from the authentication service, there's only authentication.
|
||||
//return udata.PasswordHash;
|
||||
return string.Empty;
|
||||
return udata.PasswordHash;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using IAvatarService = OpenSim.Services.Interfaces.IAvatarService;
|
||||
using IUserService = OpenSim.Framework.Communications.IUserService;
|
||||
|
||||
namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
{
|
||||
@@ -92,24 +92,24 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
/// initializes.
|
||||
/// </summary>
|
||||
|
||||
internal static CommunicationsManager Comms
|
||||
{
|
||||
get { return main.CommunicationsManager; }
|
||||
}
|
||||
|
||||
internal static IInventoryService InventoryServices
|
||||
{
|
||||
get { return main.SceneManager.CurrentOrFirstScene.InventoryService; }
|
||||
}
|
||||
|
||||
internal static IUserAccountService UserServices
|
||||
internal static IUserService UserServices
|
||||
{
|
||||
get { return main.SceneManager.CurrentOrFirstScene.UserAccountService; }
|
||||
get { return Comms.UserService; }
|
||||
}
|
||||
|
||||
internal static IAuthenticationService AuthServices
|
||||
{
|
||||
get { return main.SceneManager.CurrentOrFirstScene.AuthenticationService; }
|
||||
}
|
||||
|
||||
|
||||
internal static IAvatarService AvatarServices
|
||||
{
|
||||
get { return main.SceneManager.CurrentOrFirstScene.AvatarService; }
|
||||
get { return Comms.AvatarService; }
|
||||
}
|
||||
|
||||
internal static IAssetService AssetServices
|
||||
|
||||
@@ -27,24 +27,23 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
{
|
||||
|
||||
public class RestAppearanceServices : IRest
|
||||
{
|
||||
// private static readonly int PARM_USERID = 0;
|
||||
|
||||
private static readonly int PARM_USERID = 0;
|
||||
|
||||
// private static readonly int PARM_PATH = 1;
|
||||
|
||||
// private bool enabled = false;
|
||||
private bool enabled = false;
|
||||
private string qPrefix = "appearance";
|
||||
|
||||
/// <summary>
|
||||
@@ -64,7 +63,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
{
|
||||
Rest.Log.InfoFormat("{0} Domain is relative, adding absolute prefix", MsgId);
|
||||
qPrefix = String.Format("{0}{1}{2}", Rest.Prefix, Rest.UrlPathSeparator, qPrefix);
|
||||
qPrefix = String.Format("{0}{1}{2}", Rest.Prefix, Rest.UrlPathSeparator, qPrefix);
|
||||
Rest.Log.InfoFormat("{0} Domain is now <{1}>", MsgId, qPrefix);
|
||||
}
|
||||
|
||||
@@ -74,7 +72,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
|
||||
// Activate if everything went OK
|
||||
|
||||
// enabled = true;
|
||||
enabled = true;
|
||||
|
||||
Rest.Log.InfoFormat("{0} User appearance services initialization complete", MsgId);
|
||||
}
|
||||
@@ -95,7 +93,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
|
||||
public void Close()
|
||||
{
|
||||
// enabled = false;
|
||||
enabled = false;
|
||||
Rest.Log.InfoFormat("{0} User appearance services closing down", MsgId);
|
||||
}
|
||||
|
||||
@@ -137,153 +135,152 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
|
||||
private void DoAppearance(RequestData hdata)
|
||||
{
|
||||
// !!! REFACTORIMG PROBLEM. This needs rewriting for 0.7
|
||||
|
||||
//AppearanceRequestData rdata = (AppearanceRequestData) hdata;
|
||||
AppearanceRequestData rdata = (AppearanceRequestData) hdata;
|
||||
|
||||
//Rest.Log.DebugFormat("{0} DoAppearance ENTRY", MsgId);
|
||||
Rest.Log.DebugFormat("{0} DoAppearance ENTRY", MsgId);
|
||||
|
||||
//// If we're disabled, do nothing.
|
||||
// If we're disabled, do nothing.
|
||||
|
||||
//if (!enabled)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
if (!enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//// Now that we know this is a serious attempt to
|
||||
//// access inventory data, we should find out who
|
||||
//// is asking, and make sure they are authorized
|
||||
//// to do so. We need to validate the caller's
|
||||
//// identity before revealing anything about the
|
||||
//// status quo. Authenticate throws an exception
|
||||
//// via Fail if no identity information is present.
|
||||
////
|
||||
//// With the present HTTP server we can't use the
|
||||
//// builtin authentication mechanisms because they
|
||||
//// would be enforced for all in-bound requests.
|
||||
//// Instead we look at the headers ourselves and
|
||||
//// handle authentication directly.
|
||||
// Now that we know this is a serious attempt to
|
||||
// access inventory data, we should find out who
|
||||
// is asking, and make sure they are authorized
|
||||
// to do so. We need to validate the caller's
|
||||
// identity before revealing anything about the
|
||||
// status quo. Authenticate throws an exception
|
||||
// via Fail if no identity information is present.
|
||||
//
|
||||
// With the present HTTP server we can't use the
|
||||
// builtin authentication mechanisms because they
|
||||
// would be enforced for all in-bound requests.
|
||||
// Instead we look at the headers ourselves and
|
||||
// handle authentication directly.
|
||||
|
||||
//try
|
||||
//{
|
||||
// if (!rdata.IsAuthenticated)
|
||||
// {
|
||||
// rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
|
||||
// }
|
||||
//}
|
||||
//catch (RestException e)
|
||||
//{
|
||||
// if (e.statusCode == Rest.HttpStatusCodeNotAuthorized)
|
||||
// {
|
||||
// Rest.Log.WarnFormat("{0} User not authenticated", MsgId);
|
||||
// Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Rest.Log.ErrorFormat("{0} User authentication failed", MsgId);
|
||||
// Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
|
||||
// }
|
||||
// throw (e);
|
||||
//}
|
||||
try
|
||||
{
|
||||
if (!rdata.IsAuthenticated)
|
||||
{
|
||||
rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
|
||||
}
|
||||
}
|
||||
catch (RestException e)
|
||||
{
|
||||
if (e.statusCode == Rest.HttpStatusCodeNotAuthorized)
|
||||
{
|
||||
Rest.Log.WarnFormat("{0} User not authenticated", MsgId);
|
||||
Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Rest.Log.ErrorFormat("{0} User authentication failed", MsgId);
|
||||
Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
|
||||
}
|
||||
throw (e);
|
||||
}
|
||||
|
||||
//Rest.Log.DebugFormat("{0} Authenticated {1}", MsgId, rdata.userName);
|
||||
Rest.Log.DebugFormat("{0} Authenticated {1}", MsgId, rdata.userName);
|
||||
|
||||
//// We can only get here if we are authorized
|
||||
////
|
||||
//// The requestor may have specified an UUID or
|
||||
//// a conjoined FirstName LastName string. We'll
|
||||
//// try both. If we fail with the first, UUID,
|
||||
//// attempt, we try the other. As an example, the
|
||||
//// URI for a valid inventory request might be:
|
||||
////
|
||||
//// http://<host>:<port>/admin/inventory/Arthur Dent
|
||||
////
|
||||
//// Indicating that this is an inventory request for
|
||||
//// an avatar named Arthur Dent. This is ALL that is
|
||||
//// required to designate a GET for an entire
|
||||
//// inventory.
|
||||
////
|
||||
// We can only get here if we are authorized
|
||||
//
|
||||
// The requestor may have specified an UUID or
|
||||
// a conjoined FirstName LastName string. We'll
|
||||
// try both. If we fail with the first, UUID,
|
||||
// attempt, we try the other. As an example, the
|
||||
// URI for a valid inventory request might be:
|
||||
//
|
||||
// http://<host>:<port>/admin/inventory/Arthur Dent
|
||||
//
|
||||
// Indicating that this is an inventory request for
|
||||
// an avatar named Arthur Dent. This is ALL that is
|
||||
// required to designate a GET for an entire
|
||||
// inventory.
|
||||
//
|
||||
|
||||
//// Do we have at least a user agent name?
|
||||
// Do we have at least a user agent name?
|
||||
|
||||
//if (rdata.Parameters.Length < 1)
|
||||
//{
|
||||
// Rest.Log.WarnFormat("{0} Appearance: No user agent identifier specified", MsgId);
|
||||
// rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified");
|
||||
//}
|
||||
if (rdata.Parameters.Length < 1)
|
||||
{
|
||||
Rest.Log.WarnFormat("{0} Appearance: No user agent identifier specified", MsgId);
|
||||
rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified");
|
||||
}
|
||||
|
||||
//// The first parameter MUST be the agent identification, either an UUID
|
||||
//// or a space-separated First-name Last-Name specification. We check for
|
||||
//// an UUID first, if anyone names their character using a valid UUID
|
||||
//// that identifies another existing avatar will cause this a problem...
|
||||
// The first parameter MUST be the agent identification, either an UUID
|
||||
// or a space-separated First-name Last-Name specification. We check for
|
||||
// an UUID first, if anyone names their character using a valid UUID
|
||||
// that identifies another existing avatar will cause this a problem...
|
||||
|
||||
//try
|
||||
//{
|
||||
// rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]);
|
||||
// Rest.Log.DebugFormat("{0} UUID supplied", MsgId);
|
||||
// rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid);
|
||||
//}
|
||||
//catch
|
||||
//{
|
||||
// string[] names = rdata.Parameters[PARM_USERID].Split(Rest.CA_SPACE);
|
||||
// if (names.Length == 2)
|
||||
// {
|
||||
// Rest.Log.DebugFormat("{0} Agent Name supplied [2]", MsgId);
|
||||
// rdata.userProfile = Rest.UserServices.GetUserProfile(names[0],names[1]);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Rest.Log.WarnFormat("{0} A Valid UUID or both first and last names must be specified", MsgId);
|
||||
// rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid user identity");
|
||||
// }
|
||||
//}
|
||||
try
|
||||
{
|
||||
rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]);
|
||||
Rest.Log.DebugFormat("{0} UUID supplied", MsgId);
|
||||
rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid);
|
||||
}
|
||||
catch
|
||||
{
|
||||
string[] names = rdata.Parameters[PARM_USERID].Split(Rest.CA_SPACE);
|
||||
if (names.Length == 2)
|
||||
{
|
||||
Rest.Log.DebugFormat("{0} Agent Name supplied [2]", MsgId);
|
||||
rdata.userProfile = Rest.UserServices.GetUserProfile(names[0],names[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Rest.Log.WarnFormat("{0} A Valid UUID or both first and last names must be specified", MsgId);
|
||||
rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid user identity");
|
||||
}
|
||||
}
|
||||
|
||||
//// If the user profile is null then either the server is broken, or the
|
||||
//// user is not known. We always assume the latter case.
|
||||
// If the user profile is null then either the server is broken, or the
|
||||
// user is not known. We always assume the latter case.
|
||||
|
||||
//if (rdata.userProfile != null)
|
||||
//{
|
||||
// Rest.Log.DebugFormat("{0} User profile obtained for agent {1} {2}",
|
||||
// MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Rest.Log.WarnFormat("{0} No user profile for {1}", MsgId, rdata.path);
|
||||
// rdata.Fail(Rest.HttpStatusCodeNotFound, "unrecognized user identity");
|
||||
//}
|
||||
if (rdata.userProfile != null)
|
||||
{
|
||||
Rest.Log.DebugFormat("{0} User profile obtained for agent {1} {2}",
|
||||
MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Rest.Log.WarnFormat("{0} No user profile for {1}", MsgId, rdata.path);
|
||||
rdata.Fail(Rest.HttpStatusCodeNotFound, "unrecognized user identity");
|
||||
}
|
||||
|
||||
//// If we get to here, then we have effectively validated the user's
|
||||
// If we get to here, then we have effectively validated the user's
|
||||
|
||||
//switch (rdata.method)
|
||||
//{
|
||||
// case Rest.HEAD : // Do the processing, set the status code, suppress entity
|
||||
// DoGet(rdata);
|
||||
// rdata.buffer = null;
|
||||
// break;
|
||||
switch (rdata.method)
|
||||
{
|
||||
case Rest.HEAD : // Do the processing, set the status code, suppress entity
|
||||
DoGet(rdata);
|
||||
rdata.buffer = null;
|
||||
break;
|
||||
|
||||
// case Rest.GET : // Do the processing, set the status code, return entity
|
||||
// DoGet(rdata);
|
||||
// break;
|
||||
case Rest.GET : // Do the processing, set the status code, return entity
|
||||
DoGet(rdata);
|
||||
break;
|
||||
|
||||
// case Rest.PUT : // Update named element
|
||||
// DoUpdate(rdata);
|
||||
// break;
|
||||
case Rest.PUT : // Update named element
|
||||
DoUpdate(rdata);
|
||||
break;
|
||||
|
||||
// case Rest.POST : // Add new information to identified context.
|
||||
// DoExtend(rdata);
|
||||
// break;
|
||||
case Rest.POST : // Add new information to identified context.
|
||||
DoExtend(rdata);
|
||||
break;
|
||||
|
||||
// case Rest.DELETE : // Delete information
|
||||
// DoDelete(rdata);
|
||||
// break;
|
||||
case Rest.DELETE : // Delete information
|
||||
DoDelete(rdata);
|
||||
break;
|
||||
|
||||
// default :
|
||||
// Rest.Log.WarnFormat("{0} Method {1} not supported for {2}",
|
||||
// MsgId, rdata.method, rdata.path);
|
||||
// rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed,
|
||||
// String.Format("{0} not supported", rdata.method));
|
||||
// break;
|
||||
//}
|
||||
default :
|
||||
Rest.Log.WarnFormat("{0} Method {1} not supported for {2}",
|
||||
MsgId, rdata.method, rdata.path);
|
||||
rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed,
|
||||
String.Format("{0} not supported", rdata.method));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Interface
|
||||
@@ -295,31 +292,31 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
/// </summary>
|
||||
/// <param name=rdata>HTTP service request work area</param>
|
||||
|
||||
// private void DoGet(AppearanceRequestData rdata)
|
||||
// {
|
||||
// AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
|
||||
//
|
||||
// if (adata == null)
|
||||
// {
|
||||
// rdata.Fail(Rest.HttpStatusCodeNoContent,
|
||||
// String.Format("appearance data not found for user {0} {1}",
|
||||
// rdata.userProfile.FirstName, rdata.userProfile.SurName));
|
||||
// }
|
||||
// rdata.userAppearance = adata.ToAvatarAppearance(rdata.userProfile.ID);
|
||||
//
|
||||
// rdata.initXmlWriter();
|
||||
//
|
||||
// FormatUserAppearance(rdata);
|
||||
//
|
||||
// // Indicate a successful request
|
||||
//
|
||||
// rdata.Complete();
|
||||
//
|
||||
// // Send the response to the user. The body will be implicitly
|
||||
// // constructed from the result of the XML writer.
|
||||
//
|
||||
// rdata.Respond(String.Format("Appearance {0} Normal completion", rdata.method));
|
||||
// }
|
||||
private void DoGet(AppearanceRequestData rdata)
|
||||
{
|
||||
|
||||
rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
|
||||
|
||||
if (rdata.userAppearance == null)
|
||||
{
|
||||
rdata.Fail(Rest.HttpStatusCodeNoContent,
|
||||
String.Format("appearance data not found for user {0} {1}",
|
||||
rdata.userProfile.FirstName, rdata.userProfile.SurName));
|
||||
}
|
||||
|
||||
rdata.initXmlWriter();
|
||||
|
||||
FormatUserAppearance(rdata);
|
||||
|
||||
// Indicate a successful request
|
||||
|
||||
rdata.Complete();
|
||||
|
||||
// Send the response to the user. The body will be implicitly
|
||||
// constructed from the result of the XML writer.
|
||||
|
||||
rdata.Respond(String.Format("Appearance {0} Normal completion", rdata.method));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// POST adds NEW information to the user profile database.
|
||||
@@ -327,112 +324,108 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
/// characteristics supplied in the request.
|
||||
/// </summary>
|
||||
|
||||
// private void DoExtend(AppearanceRequestData rdata)
|
||||
// {
|
||||
//
|
||||
// bool created = false;
|
||||
// bool modified = false;
|
||||
// string newnode = String.Empty;
|
||||
//
|
||||
// Rest.Log.DebugFormat("{0} POST ENTRY", MsgId);
|
||||
//
|
||||
// //AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
|
||||
//
|
||||
// rdata.userAppearance = new AvatarAppearance();
|
||||
//
|
||||
// // Although the following behavior is admitted by HTTP I am becoming
|
||||
// // increasingly doubtful that it is appropriate for REST. If I attempt to
|
||||
// // add a new record, and it already exists, then it seems to me that the
|
||||
// // attempt should fail, rather than update the existing record.
|
||||
// AvatarData adata = null;
|
||||
// if (GetUserAppearance(rdata))
|
||||
// {
|
||||
// modified = rdata.userAppearance != null;
|
||||
// created = !modified;
|
||||
// adata = new AvatarData(rdata.userAppearance);
|
||||
// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
|
||||
// // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// created = true;
|
||||
// adata = new AvatarData(rdata.userAppearance);
|
||||
// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
|
||||
// // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
|
||||
// }
|
||||
//
|
||||
// if (created)
|
||||
// {
|
||||
// newnode = String.Format("{0} {1}", rdata.userProfile.FirstName,
|
||||
// rdata.userProfile.SurName);
|
||||
// // Must include a location header with a URI that identifies the new resource.
|
||||
//
|
||||
// rdata.AddHeader(Rest.HttpHeaderLocation,String.Format("http://{0}{1}:{2}{3}{4}",
|
||||
// rdata.hostname,rdata.port,rdata.path,Rest.UrlPathSeparator, newnode));
|
||||
// rdata.Complete(Rest.HttpStatusCodeCreated);
|
||||
//
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (modified)
|
||||
// {
|
||||
// rdata.Complete(Rest.HttpStatusCodeOK);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// rdata.Complete(Rest.HttpStatusCodeNoContent);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
|
||||
//
|
||||
// }
|
||||
private void DoExtend(AppearanceRequestData rdata)
|
||||
{
|
||||
|
||||
bool created = false;
|
||||
bool modified = false;
|
||||
string newnode = String.Empty;
|
||||
|
||||
Rest.Log.DebugFormat("{0} POST ENTRY", MsgId);
|
||||
|
||||
//AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
|
||||
|
||||
rdata.userAppearance = new AvatarAppearance();
|
||||
|
||||
// Although the following behavior is admitted by HTTP I am becoming
|
||||
// increasingly doubtful that it is appropriate for REST. If I attempt to
|
||||
// add a new record, and it already exists, then it seems to me that the
|
||||
// attempt should fail, rather than update the existing record.
|
||||
|
||||
if (GetUserAppearance(rdata))
|
||||
{
|
||||
modified = rdata.userAppearance != null;
|
||||
created = !modified;
|
||||
Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
|
||||
// Rest.UserServices.UpdateUserProfile(rdata.userProfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
created = true;
|
||||
Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
|
||||
// Rest.UserServices.UpdateUserProfile(rdata.userProfile);
|
||||
}
|
||||
|
||||
if (created)
|
||||
{
|
||||
newnode = String.Format("{0} {1}", rdata.userProfile.FirstName,
|
||||
rdata.userProfile.SurName);
|
||||
// Must include a location header with a URI that identifies the new resource.
|
||||
|
||||
rdata.AddHeader(Rest.HttpHeaderLocation,String.Format("http://{0}{1}:{2}{3}{4}",
|
||||
rdata.hostname,rdata.port,rdata.path,Rest.UrlPathSeparator, newnode));
|
||||
rdata.Complete(Rest.HttpStatusCodeCreated);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (modified)
|
||||
{
|
||||
rdata.Complete(Rest.HttpStatusCodeOK);
|
||||
}
|
||||
else
|
||||
{
|
||||
rdata.Complete(Rest.HttpStatusCodeNoContent);
|
||||
}
|
||||
}
|
||||
|
||||
rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This updates the user's appearance. not all aspects need to be provided,
|
||||
/// only those supplied will be changed.
|
||||
/// </summary>
|
||||
|
||||
// private void DoUpdate(AppearanceRequestData rdata)
|
||||
// {
|
||||
//
|
||||
// // REFACTORING PROBLEM This was commented out. It doesn't work for 0.7
|
||||
//
|
||||
// //bool created = false;
|
||||
// //bool modified = false;
|
||||
//
|
||||
//
|
||||
// //rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
|
||||
//
|
||||
// //// If the user exists then this is considered a modification regardless
|
||||
// //// of what may, or may not be, specified in the payload.
|
||||
//
|
||||
// //if (rdata.userAppearance != null)
|
||||
// //{
|
||||
// // modified = true;
|
||||
// // Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
|
||||
// // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
|
||||
// //}
|
||||
//
|
||||
// //if (created)
|
||||
// //{
|
||||
// // rdata.Complete(Rest.HttpStatusCodeCreated);
|
||||
// //}
|
||||
// //else
|
||||
// //{
|
||||
// // if (modified)
|
||||
// // {
|
||||
// // rdata.Complete(Rest.HttpStatusCodeOK);
|
||||
// // }
|
||||
// // else
|
||||
// // {
|
||||
// // rdata.Complete(Rest.HttpStatusCodeNoContent);
|
||||
// // }
|
||||
// //}
|
||||
//
|
||||
// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
|
||||
//
|
||||
// }
|
||||
private void DoUpdate(AppearanceRequestData rdata)
|
||||
{
|
||||
|
||||
bool created = false;
|
||||
bool modified = false;
|
||||
|
||||
|
||||
rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
|
||||
|
||||
// If the user exists then this is considered a modification regardless
|
||||
// of what may, or may not be, specified in the payload.
|
||||
|
||||
if (rdata.userAppearance != null)
|
||||
{
|
||||
modified = true;
|
||||
Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
|
||||
Rest.UserServices.UpdateUserProfile(rdata.userProfile);
|
||||
}
|
||||
|
||||
if (created)
|
||||
{
|
||||
rdata.Complete(Rest.HttpStatusCodeCreated);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (modified)
|
||||
{
|
||||
rdata.Complete(Rest.HttpStatusCodeOK);
|
||||
}
|
||||
else
|
||||
{
|
||||
rdata.Complete(Rest.HttpStatusCodeNoContent);
|
||||
}
|
||||
}
|
||||
|
||||
rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete the specified user's appearance. This actually performs a reset
|
||||
@@ -440,29 +433,30 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
/// Existing ownership is preserved. All prior updates are lost and can not
|
||||
/// be recovered.
|
||||
/// </summary>
|
||||
// private void DoDelete(AppearanceRequestData rdata)
|
||||
// {
|
||||
// AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
|
||||
//
|
||||
// if (adata != null)
|
||||
// {
|
||||
// AvatarAppearance old = adata.ToAvatarAppearance(rdata.userProfile.ID);
|
||||
// rdata.userAppearance = new AvatarAppearance();
|
||||
// rdata.userAppearance.Owner = old.Owner;
|
||||
// adata = new AvatarData(rdata.userAppearance);
|
||||
//
|
||||
// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
|
||||
//
|
||||
// rdata.Complete();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
//
|
||||
// rdata.Complete(Rest.HttpStatusCodeNoContent);
|
||||
// }
|
||||
//
|
||||
// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
|
||||
// }
|
||||
|
||||
private void DoDelete(AppearanceRequestData rdata)
|
||||
{
|
||||
|
||||
AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
|
||||
|
||||
if (old != null)
|
||||
{
|
||||
rdata.userAppearance = new AvatarAppearance();
|
||||
|
||||
rdata.userAppearance.Owner = old.Owner;
|
||||
|
||||
Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
|
||||
|
||||
rdata.Complete();
|
||||
}
|
||||
else
|
||||
{
|
||||
rdata.Complete(Rest.HttpStatusCodeNoContent);
|
||||
}
|
||||
|
||||
rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
|
||||
|
||||
}
|
||||
|
||||
#endregion method-specific processing
|
||||
|
||||
@@ -488,18 +482,17 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
rdata.userAppearance.AvatarHeight = (float) Convert.ToDouble(xml.Value);
|
||||
indata = true;
|
||||
}
|
||||
// if (xml.MoveToAttribute("Owner"))
|
||||
// {
|
||||
// rdata.userAppearance.Owner = (UUID)xml.Value;
|
||||
// indata = true;
|
||||
// }
|
||||
if (xml.MoveToAttribute("Owner"))
|
||||
{
|
||||
rdata.userAppearance.Owner = (UUID)xml.Value;
|
||||
indata = true;
|
||||
}
|
||||
if (xml.MoveToAttribute("Serial"))
|
||||
{
|
||||
rdata.userAppearance.Serial = Convert.ToInt32(xml.Value);
|
||||
indata = true;
|
||||
}
|
||||
break;
|
||||
/*
|
||||
case "Body" :
|
||||
if (xml.MoveToAttribute("Item"))
|
||||
{
|
||||
@@ -656,7 +649,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
indata = true;
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case "Attachment" :
|
||||
{
|
||||
|
||||
@@ -747,11 +739,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
rdata.writer.WriteStartElement("Appearance");
|
||||
|
||||
rdata.writer.WriteAttributeString("Height", rdata.userAppearance.AvatarHeight.ToString());
|
||||
// if (rdata.userAppearance.Owner != UUID.Zero)
|
||||
// rdata.writer.WriteAttributeString("Owner", rdata.userAppearance.Owner.ToString());
|
||||
if (rdata.userAppearance.Owner != UUID.Zero)
|
||||
rdata.writer.WriteAttributeString("Owner", rdata.userAppearance.Owner.ToString());
|
||||
rdata.writer.WriteAttributeString("Serial", rdata.userAppearance.Serial.ToString());
|
||||
|
||||
/*
|
||||
FormatPart(rdata, "Body", rdata.userAppearance.BodyItem, rdata.userAppearance.BodyAsset);
|
||||
FormatPart(rdata, "Skin", rdata.userAppearance.SkinItem, rdata.userAppearance.SkinAsset);
|
||||
FormatPart(rdata, "Hair", rdata.userAppearance.HairItem, rdata.userAppearance.HairAsset);
|
||||
@@ -768,20 +759,26 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
|
||||
FormatPart(rdata, "UnderShirt", rdata.userAppearance.UnderShirtItem, rdata.userAppearance.UnderShirtAsset);
|
||||
FormatPart(rdata, "UnderPants", rdata.userAppearance.UnderPantsItem, rdata.userAppearance.UnderPantsAsset);
|
||||
*/
|
||||
Rest.Log.DebugFormat("{0} FormatUserAppearance: Formatting attachments", MsgId);
|
||||
|
||||
rdata.writer.WriteStartElement("Attachments");
|
||||
List<AvatarAttachment> attachments = rdata.userAppearance.GetAttachments();
|
||||
foreach (AvatarAttachment attach in attachments)
|
||||
Hashtable attachments = rdata.userAppearance.GetAttachments();
|
||||
|
||||
if (attachments != null)
|
||||
{
|
||||
rdata.writer.WriteStartElement("Attachment");
|
||||
rdata.writer.WriteAttributeString("AtPoint", attach.AttachPoint.ToString());
|
||||
rdata.writer.WriteAttributeString("Item", attach.ItemID.ToString());
|
||||
rdata.writer.WriteAttributeString("Asset", attach.AssetID.ToString());
|
||||
|
||||
Rest.Log.DebugFormat("{0} FormatUserAppearance: Formatting attachments", MsgId);
|
||||
|
||||
rdata.writer.WriteStartElement("Attachments");
|
||||
for (int i = 0; i < attachments.Count; i++)
|
||||
{
|
||||
Hashtable attachment = attachments[i] as Hashtable;
|
||||
rdata.writer.WriteStartElement("Attachment");
|
||||
rdata.writer.WriteAttributeString("AtPoint", i.ToString());
|
||||
rdata.writer.WriteAttributeString("Item", (string) attachment["item"]);
|
||||
rdata.writer.WriteAttributeString("Asset", (string) attachment["asset"]);
|
||||
rdata.writer.WriteEndElement();
|
||||
}
|
||||
rdata.writer.WriteEndElement();
|
||||
}
|
||||
rdata.writer.WriteEndElement();
|
||||
|
||||
Primitive.TextureEntry texture = rdata.userAppearance.Texture;
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
modified = (asset != null);
|
||||
created = !modified;
|
||||
|
||||
asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type")), UUID.Zero.ToString());
|
||||
asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type")));
|
||||
asset.Description = xml.GetAttribute("desc");
|
||||
asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0;
|
||||
asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0;
|
||||
@@ -338,7 +338,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
modified = (asset != null);
|
||||
created = !modified;
|
||||
|
||||
asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type")), UUID.Zero.ToString());
|
||||
asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type")));
|
||||
asset.Description = xml.GetAttribute("desc");
|
||||
asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0;
|
||||
asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0;
|
||||
|
||||
@@ -539,6 +539,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
/// path has not already been registered, the method is added to the active
|
||||
/// handler table.
|
||||
/// </summary>
|
||||
|
||||
public void AddStreamHandler(string httpMethod, string path, RestMethod method)
|
||||
{
|
||||
if (!IsEnabled)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -123,15 +123,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
|
||||
|
||||
private void DoMove(RequestData rdata)
|
||||
{
|
||||
if (rdata.Parameters.Length < 6)
|
||||
{
|
||||
Rest.Log.WarnFormat("{0} Move: No movement information provided", MsgId);
|
||||
rdata.Fail(Rest.HttpStatusCodeBadRequest, "no movement information provided");
|
||||
}
|
||||
else
|
||||
if (rdata.Parameters.Length >= 6)
|
||||
{
|
||||
string[] names = rdata.Parameters[PARM_MOVE_AVATAR].Split(Rest.CA_SPACE);
|
||||
ScenePresence presence = null;
|
||||
ScenePresence avatar = null;
|
||||
Scene scene = null;
|
||||
|
||||
if (names.Length != 2)
|
||||
@@ -146,19 +141,21 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
|
||||
// The first parameter should be an avatar name, look for the
|
||||
// avatar in the known regions first.
|
||||
|
||||
Rest.main.SceneManager.ForEachScene(delegate(Scene s)
|
||||
foreach (Scene cs in Rest.main.SceneManager.Scenes)
|
||||
{
|
||||
s.ForEachRootScenePresence(delegate(ScenePresence sp)
|
||||
foreach (ScenePresence presence in cs.GetAvatars())
|
||||
{
|
||||
if (sp.Firstname == names[0] && sp.Lastname == names[1])
|
||||
if (presence.Firstname == names[0] &&
|
||||
presence.Lastname == names[1])
|
||||
{
|
||||
scene = s;
|
||||
presence = sp;
|
||||
scene = cs;
|
||||
avatar = presence;
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (presence != null)
|
||||
if (avatar != null)
|
||||
{
|
||||
Rest.Log.DebugFormat("{0} Move : Avatar {1} located in region {2}",
|
||||
MsgId, rdata.Parameters[PARM_MOVE_AVATAR], scene.RegionInfo.RegionName);
|
||||
@@ -168,14 +165,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
|
||||
float x = Convert.ToSingle(rdata.Parameters[PARM_MOVE_X]);
|
||||
float y = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Y]);
|
||||
float z = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Z]);
|
||||
Vector3 vector = new Vector3(x, y, z);
|
||||
presence.MoveToTarget(vector, false, false);
|
||||
Vector3 vector = new Vector3(x,y,z);
|
||||
avatar.DoAutoPilot(0,vector,avatar.ControllingClient);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
rdata.Fail(Rest.HttpStatusCodeBadRequest,
|
||||
String.Format("invalid parameters: {0}", e.Message));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -185,6 +183,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
|
||||
|
||||
rdata.Complete();
|
||||
rdata.Respond("OK");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Rest.Log.WarnFormat("{0} Move: No movement information provided", MsgId);
|
||||
rdata.Fail(Rest.HttpStatusCodeBadRequest, "no movement information provided");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
{
|
||||
#region GET methods
|
||||
public string GetHandler(string request, string path, string param,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
// foreach (string h in httpRequest.Headers.AllKeys)
|
||||
// foreach (string v in httpRequest.Headers.GetValues(h))
|
||||
@@ -64,7 +64,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
}
|
||||
}
|
||||
|
||||
public string GetHandlerRegions(IOSHttpResponse httpResponse)
|
||||
public string GetHandlerRegions(OSHttpResponse httpResponse)
|
||||
{
|
||||
RestXmlWriter rxw = new RestXmlWriter(new StringWriter());
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
return rxw.ToString();
|
||||
}
|
||||
|
||||
public string GetHandlerRegion(IOSHttpResponse httpResponse, string param)
|
||||
public string GetHandlerRegion(OSHttpResponse httpResponse, string param)
|
||||
{
|
||||
// be resilient and don't get confused by a terminating '/'
|
||||
param = param.TrimEnd(new char[]{'/'});
|
||||
@@ -180,7 +180,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
}
|
||||
#endregion GET methods
|
||||
|
||||
protected string RegionTerrain(IOSHttpResponse httpResponse, Scene scene)
|
||||
protected string RegionTerrain(OSHttpResponse httpResponse, Scene scene)
|
||||
{
|
||||
httpResponse.SendChunked = true;
|
||||
httpResponse.ContentType = "text/xml";
|
||||
@@ -190,7 +190,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
// "GET", "terrain not implemented");
|
||||
}
|
||||
|
||||
protected string RegionStats(IOSHttpResponse httpResponse, Scene scene)
|
||||
protected string RegionStats(OSHttpResponse httpResponse, Scene scene)
|
||||
{
|
||||
int users = scene.GetRootAgentCount();
|
||||
int objects = scene.Entities.Count - users;
|
||||
@@ -213,7 +213,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
return rxw.ToString();
|
||||
}
|
||||
|
||||
protected string RegionPrims(IOSHttpResponse httpResponse, Scene scene, Vector3 min, Vector3 max)
|
||||
protected string RegionPrims(OSHttpResponse httpResponse, Scene scene, Vector3 min, Vector3 max)
|
||||
{
|
||||
httpResponse.SendChunked = true;
|
||||
httpResponse.ContentType = "text/xml";
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
{
|
||||
#region GET methods
|
||||
public string GetRegionInfoHandler(string request, string path, string param,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
// foreach (string h in httpRequest.Headers.AllKeys)
|
||||
// foreach (string v in httpRequest.Headers.GetValues(h))
|
||||
@@ -64,7 +64,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
}
|
||||
}
|
||||
|
||||
public string GetRegionInfoHandlerRegions(IOSHttpResponse httpResponse)
|
||||
public string GetRegionInfoHandlerRegions(OSHttpResponse httpResponse)
|
||||
{
|
||||
RestXmlWriter rxw = new RestXmlWriter(new StringWriter());
|
||||
|
||||
@@ -113,6 +113,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
rxw.WriteString(s.RegionInfo.ExternalHostName);
|
||||
rxw.WriteEndAttribute();
|
||||
|
||||
rxw.WriteStartAttribute(String.Empty, "master_name", String.Empty);
|
||||
rxw.WriteString(String.Format("{0} {1}", s.RegionInfo.MasterAvatarFirstName, s.RegionInfo.MasterAvatarLastName));
|
||||
rxw.WriteEndAttribute();
|
||||
|
||||
rxw.WriteStartAttribute(String.Empty, "master_uuid", String.Empty);
|
||||
rxw.WriteString(s.RegionInfo.MasterAvatarAssignedUUID.ToString());
|
||||
rxw.WriteEndAttribute();
|
||||
|
||||
rxw.WriteStartAttribute(String.Empty, "ip", String.Empty);
|
||||
rxw.WriteString(s.RegionInfo.InternalEndPoint.ToString());
|
||||
rxw.WriteEndAttribute();
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
#region POST methods
|
||||
|
||||
public string PostHandler(string request, string path, string param,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
// foreach (string h in httpRequest.Headers.AllKeys)
|
||||
// foreach (string v in httpRequest.Headers.GetValues(h))
|
||||
@@ -92,7 +92,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
}
|
||||
}
|
||||
|
||||
public string CreateRegion(IOSHttpRequest request, IOSHttpResponse response)
|
||||
public string CreateRegion(OSHttpRequest request, OSHttpResponse response)
|
||||
{
|
||||
RestXmlWriter rxw = new RestXmlWriter(new StringWriter());
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
return rxw.ToString();
|
||||
}
|
||||
|
||||
public string LoadPrims(string requestBody, IOSHttpRequest request, IOSHttpResponse response, Scene scene)
|
||||
public string LoadPrims(string requestBody, OSHttpRequest request, OSHttpResponse response, Scene scene)
|
||||
{
|
||||
IRegionSerialiserModule serialiser = scene.RequestModuleInterface<IRegionSerialiserModule>();
|
||||
if (serialiser != null)
|
||||
|
||||
@@ -56,13 +56,20 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
region_id = regInfo.RegionID.ToString();
|
||||
region_x = regInfo.RegionLocX;
|
||||
region_y = regInfo.RegionLocY;
|
||||
region_owner_id = regInfo.EstateSettings.EstateOwner.ToString();
|
||||
if (regInfo.EstateSettings.EstateOwner != UUID.Zero)
|
||||
region_owner_id = regInfo.EstateSettings.EstateOwner.ToString();
|
||||
else
|
||||
region_owner_id = regInfo.MasterAvatarAssignedUUID.ToString();
|
||||
region_http_port = regInfo.HttpPort;
|
||||
region_server_uri = regInfo.ServerURI;
|
||||
region_external_hostname = regInfo.ExternalHostName;
|
||||
|
||||
Uri uri = new Uri(region_server_uri);
|
||||
region_port = (uint)uri.Port;
|
||||
|
||||
if (!String.IsNullOrEmpty(regInfo.MasterAvatarFirstName))
|
||||
region_owner = String.Format("{0} {1}", regInfo.MasterAvatarFirstName,
|
||||
regInfo.MasterAvatarLastName);
|
||||
}
|
||||
|
||||
public string this[string idx]
|
||||
|
||||
@@ -328,7 +328,7 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||
/// </summary>
|
||||
/// <param name="request">HTTP request header</param>
|
||||
/// <returns>true when the HTTP request came from god.</returns>
|
||||
protected bool IsGod(IOSHttpRequest request)
|
||||
protected bool IsGod(OSHttpRequest request)
|
||||
{
|
||||
string[] keys = request.Headers.GetValues("X-OpenSim-Godkey");
|
||||
if (null == keys) return false;
|
||||
@@ -342,7 +342,7 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||
/// HTTP header is indeed the password on file for the avatar
|
||||
/// specified by the UUID
|
||||
/// </summary>
|
||||
protected bool IsVerifiedUser(IOSHttpRequest request, UUID uuid)
|
||||
protected bool IsVerifiedUser(OSHttpRequest request, UUID uuid)
|
||||
{
|
||||
// XXX under construction
|
||||
return false;
|
||||
@@ -377,7 +377,7 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||
/// <param name="message">failure message</param>
|
||||
/// <remarks>This should probably set a return code as
|
||||
/// well. (?)</remarks>
|
||||
protected string Failure(IOSHttpResponse response, OSHttpStatusCode status,
|
||||
protected string Failure(OSHttpResponse response, OSHttpStatusCode status,
|
||||
string method, string format, params string[] msg)
|
||||
{
|
||||
string m = String.Format(format, msg);
|
||||
@@ -396,7 +396,7 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||
/// <param name="e">exception causing the failure message</param>
|
||||
/// <remarks>This should probably set a return code as
|
||||
/// well. (?)</remarks>
|
||||
public string Failure(IOSHttpResponse response, OSHttpStatusCode status,
|
||||
public string Failure(OSHttpResponse response, OSHttpStatusCode status,
|
||||
string method, Exception e)
|
||||
{
|
||||
string m = String.Format("exception occurred: {0}", e.Message);
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
// using OpenSim.Region.Framework.Interfaces;
|
||||
|
||||
namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that
|
||||
/// we can popup a message on the user's client if the inventory service has permanently failed). But I didn't want
|
||||
/// to just pass the whole Scene into CAPS.
|
||||
/// </summary>
|
||||
public delegate IClientAPI GetClientDelegate(UUID agentID);
|
||||
|
||||
public class Caps
|
||||
{
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_httpListenerHostName;
|
||||
private uint m_httpListenPort;
|
||||
|
||||
/// <summary>
|
||||
/// This is the uuid portion of every CAPS path. It is used to make capability urls private to the requester.
|
||||
/// </summary>
|
||||
private string m_capsObjectPath;
|
||||
public string CapsObjectPath { get { return m_capsObjectPath; } }
|
||||
|
||||
private CapsHandlers m_capsHandlers;
|
||||
private Dictionary<string, string> m_externalCapsHandlers;
|
||||
|
||||
private IHttpServer m_httpListener;
|
||||
private UUID m_agentID;
|
||||
private string m_regionName;
|
||||
|
||||
public UUID AgentID
|
||||
{
|
||||
get { return m_agentID; }
|
||||
}
|
||||
|
||||
public string RegionName
|
||||
{
|
||||
get { return m_regionName; }
|
||||
}
|
||||
|
||||
public string HostName
|
||||
{
|
||||
get { return m_httpListenerHostName; }
|
||||
}
|
||||
|
||||
public uint Port
|
||||
{
|
||||
get { return m_httpListenPort; }
|
||||
}
|
||||
|
||||
public IHttpServer HttpListener
|
||||
{
|
||||
get { return m_httpListener; }
|
||||
}
|
||||
|
||||
public bool SSLCaps
|
||||
{
|
||||
get { return m_httpListener.UseSSL; }
|
||||
}
|
||||
|
||||
public string SSLCommonName
|
||||
{
|
||||
get { return m_httpListener.SSLCommonName; }
|
||||
}
|
||||
|
||||
public CapsHandlers CapsHandlers
|
||||
{
|
||||
get { return m_capsHandlers; }
|
||||
}
|
||||
|
||||
public Dictionary<string, string> ExternalCapsHandlers
|
||||
{
|
||||
get { return m_externalCapsHandlers; }
|
||||
}
|
||||
|
||||
public Caps(IHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
|
||||
UUID agent, string regionName)
|
||||
{
|
||||
m_capsObjectPath = capsPath;
|
||||
m_httpListener = httpServer;
|
||||
m_httpListenerHostName = httpListen;
|
||||
|
||||
m_httpListenPort = httpPort;
|
||||
|
||||
if (httpServer != null && httpServer.UseSSL)
|
||||
{
|
||||
m_httpListenPort = httpServer.SSLPort;
|
||||
httpListen = httpServer.SSLCommonName;
|
||||
httpPort = httpServer.SSLPort;
|
||||
}
|
||||
|
||||
m_agentID = agent;
|
||||
m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
|
||||
m_externalCapsHandlers = new Dictionary<string, string>();
|
||||
m_regionName = regionName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register a handler. This allows modules to register handlers.
|
||||
/// </summary>
|
||||
/// <param name="capName"></param>
|
||||
/// <param name="handler"></param>
|
||||
public void RegisterHandler(string capName, IRequestHandler handler)
|
||||
{
|
||||
m_capsHandlers[capName] = handler;
|
||||
//m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register an external handler. The service for this capability is somewhere else
|
||||
/// given by the URL.
|
||||
/// </summary>
|
||||
/// <param name="capsName"></param>
|
||||
/// <param name="url"></param>
|
||||
public void RegisterHandler(string capsName, string url)
|
||||
{
|
||||
m_externalCapsHandlers.Add(capsName, url);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove all CAPS service handlers.
|
||||
/// </summary>
|
||||
public void DeregisterHandlers()
|
||||
{
|
||||
if (m_capsHandlers != null)
|
||||
{
|
||||
foreach (string capsName in m_capsHandlers.Caps)
|
||||
{
|
||||
m_capsHandlers.Remove(capsName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
|
||||
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class FetchInventory2Handler
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IInventoryService m_inventoryService;
|
||||
|
||||
public FetchInventory2Handler(IInventoryService invService)
|
||||
{
|
||||
m_inventoryService = invService;
|
||||
}
|
||||
|
||||
public string FetchInventoryRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capabilty request");
|
||||
|
||||
OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request));
|
||||
OSDArray itemsRequested = (OSDArray)requestmap["items"];
|
||||
|
||||
string reply;
|
||||
LLSDFetchInventory llsdReply = new LLSDFetchInventory();
|
||||
|
||||
foreach (OSDMap osdItemId in itemsRequested)
|
||||
{
|
||||
UUID itemId = osdItemId["item_id"].AsUUID();
|
||||
|
||||
InventoryItemBase item = m_inventoryService.GetItem(new InventoryItemBase(itemId));
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
// We don't know the agent that this request belongs to so we'll use the agent id of the item
|
||||
// which will be the same for all items.
|
||||
llsdReply.agent_id = item.Owner;
|
||||
|
||||
llsdReply.items.Array.Add(ConvertInventoryItem(item));
|
||||
}
|
||||
}
|
||||
|
||||
reply = LLSDHelpers.SerialiseLLSDReply(llsdReply);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert an internal inventory item object into an LLSD object.
|
||||
/// </summary>
|
||||
/// <param name="invItem"></param>
|
||||
/// <returns></returns>
|
||||
private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem)
|
||||
{
|
||||
LLSDInventoryItem llsdItem = new LLSDInventoryItem();
|
||||
llsdItem.asset_id = invItem.AssetID;
|
||||
llsdItem.created_at = invItem.CreationDate;
|
||||
llsdItem.desc = invItem.Description;
|
||||
llsdItem.flags = (int)invItem.Flags;
|
||||
llsdItem.item_id = invItem.ID;
|
||||
llsdItem.name = invItem.Name;
|
||||
llsdItem.parent_id = invItem.Folder;
|
||||
llsdItem.type = invItem.AssetType;
|
||||
llsdItem.inv_type = invItem.InvType;
|
||||
|
||||
llsdItem.permissions = new LLSDPermissions();
|
||||
llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
|
||||
llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions;
|
||||
llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions;
|
||||
llsdItem.permissions.group_id = invItem.GroupID;
|
||||
llsdItem.permissions.group_mask = (int)invItem.GroupPermissions;
|
||||
llsdItem.permissions.is_owner_group = invItem.GroupOwned;
|
||||
llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions;
|
||||
llsdItem.permissions.owner_id = invItem.Owner;
|
||||
llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
|
||||
llsdItem.sale_info = new LLSDSaleInfo();
|
||||
llsdItem.sale_info.sale_price = invItem.SalePrice;
|
||||
llsdItem.sale_info.sale_type = invItem.SaleType;
|
||||
|
||||
return llsdItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class FetchInventory2ServerConnector : ServiceConnector
|
||||
{
|
||||
private IInventoryService m_InventoryService;
|
||||
private string m_ConfigName = "CapsService";
|
||||
|
||||
public FetchInventory2ServerConnector(IConfigSource config, IHttpServer server, string configName)
|
||||
: base(config, server, configName)
|
||||
{
|
||||
if (configName != String.Empty)
|
||||
m_ConfigName = configName;
|
||||
|
||||
IConfig serverConfig = config.Configs[m_ConfigName];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
|
||||
|
||||
string invService = serverConfig.GetString("InventoryService", String.Empty);
|
||||
|
||||
if (invService == String.Empty)
|
||||
throw new Exception("No InventoryService in config file");
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);
|
||||
|
||||
if (m_InventoryService == null)
|
||||
throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName));
|
||||
|
||||
FetchInventory2Handler fiHandler = new FetchInventory2Handler(m_InventoryService);
|
||||
IRequestHandler reqHandler
|
||||
= new RestStreamHandler(
|
||||
"POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest, "FetchInventory", null);
|
||||
server.AddStreamHandler(reqHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class GetMeshHandler
|
||||
{
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IAssetService m_assetService;
|
||||
|
||||
public GetMeshHandler(IAssetService assService)
|
||||
{
|
||||
m_assetService = assService;
|
||||
}
|
||||
|
||||
public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap)
|
||||
{
|
||||
Hashtable responsedata = new Hashtable();
|
||||
responsedata["int_response_code"] = 400; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = "Request wasn't what was expected";
|
||||
|
||||
string meshStr = string.Empty;
|
||||
|
||||
if (request.ContainsKey("mesh_id"))
|
||||
meshStr = request["mesh_id"].ToString();
|
||||
|
||||
UUID meshID = UUID.Zero;
|
||||
if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID))
|
||||
{
|
||||
if (m_assetService == null)
|
||||
{
|
||||
responsedata["int_response_code"] = 404; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = "The asset service is unavailable. So is your mesh.";
|
||||
return responsedata;
|
||||
}
|
||||
|
||||
AssetBase mesh = m_assetService.Get(meshID.ToString());
|
||||
|
||||
if (mesh != null)
|
||||
{
|
||||
if (mesh.Type == (SByte)AssetType.Mesh)
|
||||
{
|
||||
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
|
||||
responsedata["content_type"] = "application/vnd.ll.mesh";
|
||||
responsedata["int_response_code"] = 200;
|
||||
}
|
||||
// Optionally add additional mesh types here
|
||||
else
|
||||
{
|
||||
responsedata["int_response_code"] = 404; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh.";
|
||||
return responsedata;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
responsedata["int_response_code"] = 404; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
|
||||
return responsedata;
|
||||
}
|
||||
}
|
||||
|
||||
return responsedata;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenSim.Framework.Servers;
|
||||
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class GetMeshServerConnector : ServiceConnector
|
||||
{
|
||||
private IAssetService m_AssetService;
|
||||
private string m_ConfigName = "CapsService";
|
||||
|
||||
public GetMeshServerConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||
base(config, server, configName)
|
||||
{
|
||||
if (configName != String.Empty)
|
||||
m_ConfigName = configName;
|
||||
|
||||
IConfig serverConfig = config.Configs[m_ConfigName];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
|
||||
|
||||
string assetService = serverConfig.GetString("AssetService", String.Empty);
|
||||
|
||||
if (assetService == String.Empty)
|
||||
throw new Exception("No AssetService in config file");
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
m_AssetService =
|
||||
ServerUtils.LoadPlugin<IAssetService>(assetService, args);
|
||||
|
||||
if (m_AssetService == null)
|
||||
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
|
||||
|
||||
GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService);
|
||||
IRequestHandler reqHandler
|
||||
= new RestHTTPHandler(
|
||||
"GET",
|
||||
"/CAPS/" + UUID.Random(),
|
||||
httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null),
|
||||
"GetMesh",
|
||||
null);
|
||||
server.AddStreamHandler(reqHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,369 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenMetaverse.Imaging;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class GetTextureHandler : BaseStreamHandler
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private IAssetService m_assetService;
|
||||
|
||||
public const string DefaultFormat = "x-j2c";
|
||||
|
||||
// TODO: Change this to a config option
|
||||
const string REDIRECT_URL = null;
|
||||
|
||||
public GetTextureHandler(string path, IAssetService assService, string name, string description)
|
||||
: base("GET", path, name, description)
|
||||
{
|
||||
m_assetService = assService;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// Try to parse the texture ID from the request URL
|
||||
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
||||
string textureStr = query.GetOne("texture_id");
|
||||
string format = query.GetOne("format");
|
||||
|
||||
//m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr);
|
||||
|
||||
if (m_assetService == null)
|
||||
{
|
||||
m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service");
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
}
|
||||
|
||||
UUID textureID;
|
||||
if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
|
||||
{
|
||||
// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID);
|
||||
|
||||
string[] formats;
|
||||
if (format != null && format != string.Empty)
|
||||
{
|
||||
formats = new string[1] { format.ToLower() };
|
||||
}
|
||||
else
|
||||
{
|
||||
formats = WebUtil.GetPreferredImageTypes(httpRequest.Headers.Get("Accept"));
|
||||
if (formats.Length == 0)
|
||||
formats = new string[1] { DefaultFormat }; // default
|
||||
|
||||
}
|
||||
// OK, we have an array with preferred formats, possibly with only one entry
|
||||
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
foreach (string f in formats)
|
||||
{
|
||||
if (FetchTexture(httpRequest, httpResponse, textureID, f))
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}",
|
||||
// textureID, httpResponse.StatusCode, httpResponse.ContentLength);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="httpRequest"></param>
|
||||
/// <param name="httpResponse"></param>
|
||||
/// <param name="textureID"></param>
|
||||
/// <param name="format"></param>
|
||||
/// <returns>False for "caller try another codec"; true otherwise</returns>
|
||||
private bool FetchTexture(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID textureID, string format)
|
||||
{
|
||||
// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
|
||||
AssetBase texture;
|
||||
|
||||
string fullID = textureID.ToString();
|
||||
if (format != DefaultFormat)
|
||||
fullID = fullID + "-" + format;
|
||||
|
||||
if (!String.IsNullOrEmpty(REDIRECT_URL))
|
||||
{
|
||||
// Only try to fetch locally cached textures. Misses are redirected
|
||||
texture = m_assetService.GetCached(fullID);
|
||||
|
||||
if (texture != null)
|
||||
{
|
||||
if (texture.Type != (sbyte)AssetType.Texture)
|
||||
{
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
return true;
|
||||
}
|
||||
WriteTextureData(httpRequest, httpResponse, texture, format);
|
||||
}
|
||||
else
|
||||
{
|
||||
string textureUrl = REDIRECT_URL + textureID.ToString();
|
||||
m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
|
||||
httpResponse.RedirectLocation = textureUrl;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else // no redirect
|
||||
{
|
||||
// try the cache
|
||||
texture = m_assetService.GetCached(fullID);
|
||||
|
||||
if (texture == null)
|
||||
{
|
||||
//m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache");
|
||||
|
||||
// Fetch locally or remotely. Misses return a 404
|
||||
texture = m_assetService.Get(textureID.ToString());
|
||||
|
||||
if (texture != null)
|
||||
{
|
||||
if (texture.Type != (sbyte)AssetType.Texture)
|
||||
{
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
return true;
|
||||
}
|
||||
if (format == DefaultFormat)
|
||||
{
|
||||
WriteTextureData(httpRequest, httpResponse, texture, format);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID);
|
||||
newTexture.Data = ConvertTextureData(texture, format);
|
||||
if (newTexture.Data.Length == 0)
|
||||
return false; // !!! Caller try another codec, please!
|
||||
|
||||
newTexture.Flags = AssetFlags.Collectable;
|
||||
newTexture.Temporary = true;
|
||||
m_assetService.Store(newTexture);
|
||||
WriteTextureData(httpRequest, httpResponse, newTexture, format);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // it was on the cache
|
||||
{
|
||||
//m_log.DebugFormat("[GETTEXTURE]: texture was in the cache");
|
||||
WriteTextureData(httpRequest, httpResponse, texture, format);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// not found
|
||||
// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void WriteTextureData(IOSHttpRequest request, IOSHttpResponse response, AssetBase texture, string format)
|
||||
{
|
||||
string range = request.Headers.GetOne("Range");
|
||||
|
||||
if (!String.IsNullOrEmpty(range)) // JP2's only
|
||||
{
|
||||
// Range request
|
||||
int start, end;
|
||||
if (TryParseRange(range, out start, out end))
|
||||
{
|
||||
|
||||
// Before clamping start make sure we can satisfy it in order to avoid
|
||||
// sending back the last byte instead of an error status
|
||||
if (start >= texture.Data.Length)
|
||||
{
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
|
||||
}
|
||||
else
|
||||
{
|
||||
end = Utils.Clamp(end, 0, texture.Data.Length - 1);
|
||||
start = Utils.Clamp(start, 0, end);
|
||||
int len = end - start + 1;
|
||||
|
||||
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
||||
|
||||
// Always return PartialContent, even if the range covered the entire data length
|
||||
// We were accidentally sending back 404 before in this situation
|
||||
// https://issues.apache.org/bugzilla/show_bug.cgi?id=51878 supports sending 206 even if the
|
||||
// entire range is requested, and viewer 3.2.2 (and very probably earlier) seems fine with this.
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
|
||||
|
||||
response.ContentLength = len;
|
||||
response.ContentType = texture.Metadata.ContentType;
|
||||
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length));
|
||||
|
||||
response.Body.Write(texture.Data, start, len);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("[GETTEXTURE]: Malformed Range header: " + range);
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
|
||||
}
|
||||
}
|
||||
else // JP2's or other formats
|
||||
{
|
||||
// Full content request
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||
response.ContentLength = texture.Data.Length;
|
||||
if (format == DefaultFormat)
|
||||
response.ContentType = texture.Metadata.ContentType;
|
||||
else
|
||||
response.ContentType = "image/" + format;
|
||||
response.Body.Write(texture.Data, 0, texture.Data.Length);
|
||||
}
|
||||
|
||||
// if (response.StatusCode < 200 || response.StatusCode > 299)
|
||||
// m_log.WarnFormat(
|
||||
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
|
||||
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
|
||||
// else
|
||||
// m_log.DebugFormat(
|
||||
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
|
||||
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
|
||||
}
|
||||
|
||||
private bool TryParseRange(string header, out int start, out int end)
|
||||
{
|
||||
if (header.StartsWith("bytes="))
|
||||
{
|
||||
string[] rangeValues = header.Substring(6).Split('-');
|
||||
if (rangeValues.Length == 2)
|
||||
{
|
||||
if (Int32.TryParse(rangeValues[0], out start) && Int32.TryParse(rangeValues[1], out end))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
start = end = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
private byte[] ConvertTextureData(AssetBase texture, string format)
|
||||
{
|
||||
m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format);
|
||||
byte[] data = new byte[0];
|
||||
|
||||
MemoryStream imgstream = new MemoryStream();
|
||||
Bitmap mTexture = new Bitmap(1, 1);
|
||||
ManagedImage managedImage;
|
||||
Image image = (Image)mTexture;
|
||||
|
||||
try
|
||||
{
|
||||
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
|
||||
|
||||
imgstream = new MemoryStream();
|
||||
|
||||
// Decode image to System.Drawing.Image
|
||||
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image))
|
||||
{
|
||||
// Save to bitmap
|
||||
mTexture = new Bitmap(image);
|
||||
|
||||
EncoderParameters myEncoderParameters = new EncoderParameters();
|
||||
myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, 95L);
|
||||
|
||||
// Save bitmap to stream
|
||||
ImageCodecInfo codec = GetEncoderInfo("image/" + format);
|
||||
if (codec != null)
|
||||
{
|
||||
mTexture.Save(imgstream, codec, myEncoderParameters);
|
||||
// Write the stream to a byte array for output
|
||||
data = imgstream.ToArray();
|
||||
}
|
||||
else
|
||||
m_log.WarnFormat("[GETTEXTURE]: No such codec {0}", format);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[GETTEXTURE]: Unable to convert texture {0} to {1}: {2}", texture.ID, format, e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Reclaim memory, these are unmanaged resources
|
||||
// If we encountered an exception, one or more of these will be null
|
||||
if (mTexture != null)
|
||||
mTexture.Dispose();
|
||||
|
||||
if (image != null)
|
||||
image.Dispose();
|
||||
|
||||
if (imgstream != null)
|
||||
{
|
||||
imgstream.Close();
|
||||
imgstream.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
// From msdn
|
||||
private static ImageCodecInfo GetEncoderInfo(String mimeType)
|
||||
{
|
||||
ImageCodecInfo[] encoders;
|
||||
encoders = ImageCodecInfo.GetImageEncoders();
|
||||
for (int j = 0; j < encoders.Length; ++j)
|
||||
{
|
||||
if (encoders[j].MimeType == mimeType)
|
||||
return encoders[j];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class GetTextureServerConnector : ServiceConnector
|
||||
{
|
||||
private IAssetService m_AssetService;
|
||||
private string m_ConfigName = "CapsService";
|
||||
|
||||
public GetTextureServerConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||
base(config, server, configName)
|
||||
{
|
||||
if (configName != String.Empty)
|
||||
m_ConfigName = configName;
|
||||
|
||||
IConfig serverConfig = config.Configs[m_ConfigName];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
|
||||
|
||||
string assetService = serverConfig.GetString("AssetService", String.Empty);
|
||||
|
||||
if (assetService == String.Empty)
|
||||
throw new Exception("No AssetService in config file");
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
m_AssetService =
|
||||
ServerUtils.LoadPlugin<IAssetService>(assetService, args);
|
||||
|
||||
if (m_AssetService == null)
|
||||
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
|
||||
|
||||
server.AddStreamHandler(
|
||||
new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenMetaverse.Imaging;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class UploadBakedTextureHandler
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Caps m_HostCapsObj;
|
||||
private IAssetService m_assetService;
|
||||
private bool m_persistBakedTextures;
|
||||
|
||||
public UploadBakedTextureHandler(Caps caps, IAssetService assetService, bool persistBakedTextures)
|
||||
{
|
||||
m_HostCapsObj = caps;
|
||||
m_assetService = assetService;
|
||||
m_persistBakedTextures = persistBakedTextures;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle a request from the client for a Uri to upload a baked texture.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <param name="httpRequest"></param>
|
||||
/// <param name="httpResponse"></param>
|
||||
/// <returns>The upload response if the request is successful, null otherwise.</returns>
|
||||
public string UploadBakedTexture(
|
||||
string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
try
|
||||
{
|
||||
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
|
||||
BakedTextureUploader uploader =
|
||||
new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener);
|
||||
uploader.OnUpLoad += BakedTextureUploaded;
|
||||
|
||||
m_HostCapsObj.HttpListener.AddStreamHandler(
|
||||
new BinaryStreamHandler(
|
||||
"POST", capsBase + uploaderPath, uploader.uploaderCaps, "UploadBakedTexture", null));
|
||||
|
||||
string protocol = "http://";
|
||||
|
||||
if (m_HostCapsObj.SSLCaps)
|
||||
protocol = "https://";
|
||||
|
||||
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" +
|
||||
m_HostCapsObj.Port.ToString() + capsBase + uploaderPath;
|
||||
|
||||
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
|
||||
uploadResponse.uploader = uploaderURL;
|
||||
uploadResponse.state = "upload";
|
||||
|
||||
return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[UPLOAD BAKED TEXTURE HANDLER]: {0}{1}", e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when a baked texture has been successfully uploaded by a client.
|
||||
/// </summary>
|
||||
/// <param name="assetID"></param>
|
||||
/// <param name="data"></param>
|
||||
private void BakedTextureUploaded(UUID assetID, byte[] data)
|
||||
{
|
||||
// m_log.DebugFormat("[UPLOAD BAKED TEXTURE HANDLER]: Received baked texture {0}", assetID.ToString());
|
||||
|
||||
AssetBase asset;
|
||||
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());
|
||||
asset.Data = data;
|
||||
asset.Temporary = true;
|
||||
asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are
|
||||
m_assetService.Store(asset);
|
||||
}
|
||||
}
|
||||
|
||||
class BakedTextureUploader
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public event Action<UUID, byte[]> OnUpLoad;
|
||||
|
||||
private string uploaderPath = String.Empty;
|
||||
private UUID newAssetID;
|
||||
private IHttpServer httpListener;
|
||||
|
||||
public BakedTextureUploader(string path, IHttpServer httpServer)
|
||||
{
|
||||
newAssetID = UUID.Random();
|
||||
uploaderPath = path;
|
||||
httpListener = httpServer;
|
||||
// m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle raw uploaded baked texture data.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public string uploaderCaps(byte[] data, string path, string param)
|
||||
{
|
||||
Action<UUID, byte[]> handlerUpLoad = OnUpLoad;
|
||||
|
||||
// Don't do this asynchronously, otherwise it's possible for the client to send set appearance information
|
||||
// on another thread which might send out avatar updates before the asset has been put into the asset
|
||||
// service.
|
||||
if (handlerUpLoad != null)
|
||||
handlerUpLoad(newAssetID, data);
|
||||
|
||||
string res = String.Empty;
|
||||
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
|
||||
uploadComplete.new_asset = newAssetID.ToString();
|
||||
uploadComplete.new_inventory_item = UUID.Zero;
|
||||
uploadComplete.state = "complete";
|
||||
|
||||
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
|
||||
|
||||
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
||||
|
||||
// m_log.DebugFormat("[BAKED TEXTURE UPLOADER]: baked texture upload completed for {0}", newAssetID);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,438 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class WebFetchInvDescHandler
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IInventoryService m_InventoryService;
|
||||
private ILibraryService m_LibraryService;
|
||||
// private object m_fetchLock = new Object();
|
||||
|
||||
public WebFetchInvDescHandler(IInventoryService invService, ILibraryService libService)
|
||||
{
|
||||
m_InventoryService = invService;
|
||||
m_LibraryService = libService;
|
||||
}
|
||||
|
||||
public string FetchInventoryDescendentsRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// lock (m_fetchLock)
|
||||
// {
|
||||
// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request {0}", request);
|
||||
|
||||
// nasty temporary hack here, the linden client falsely
|
||||
// identifies the uuid 00000000-0000-0000-0000-000000000000
|
||||
// as a string which breaks us
|
||||
//
|
||||
// correctly mark it as a uuid
|
||||
//
|
||||
request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
|
||||
|
||||
// another hack <integer>1</integer> results in a
|
||||
// System.ArgumentException: Object type System.Int32 cannot
|
||||
// be converted to target type: System.Boolean
|
||||
//
|
||||
request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
|
||||
request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
try
|
||||
{
|
||||
hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
|
||||
}
|
||||
catch (LLSD.LLSDParseException e)
|
||||
{
|
||||
m_log.ErrorFormat("[WEB FETCH INV DESC HANDLER]: Fetch error: {0}{1}" + e.Message, e.StackTrace);
|
||||
m_log.Error("Request: " + request);
|
||||
}
|
||||
|
||||
ArrayList foldersrequested = (ArrayList)hash["folders"];
|
||||
|
||||
string response = "";
|
||||
|
||||
for (int i = 0; i < foldersrequested.Count; i++)
|
||||
{
|
||||
string inventoryitemstr = "";
|
||||
Hashtable inventoryhash = (Hashtable)foldersrequested[i];
|
||||
|
||||
LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents();
|
||||
|
||||
try
|
||||
{
|
||||
LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Debug("[WEB FETCH INV DESC HANDLER]: caught exception doing OSD deserialize" + e);
|
||||
}
|
||||
LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest);
|
||||
|
||||
inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply);
|
||||
inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", "");
|
||||
inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", "");
|
||||
|
||||
response += inventoryitemstr;
|
||||
}
|
||||
|
||||
if (response.Length == 0)
|
||||
{
|
||||
// Ter-guess: If requests fail a lot, the client seems to stop requesting descendants.
|
||||
// Therefore, I'm concluding that the client only has so many threads available to do requests
|
||||
// and when a thread stalls.. is stays stalled.
|
||||
// Therefore we need to return something valid
|
||||
response = "<llsd><map><key>folders</key><array /></map></llsd>";
|
||||
}
|
||||
else
|
||||
{
|
||||
response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request");
|
||||
//m_log.Debug("[WEB FETCH INV DESC HANDLER] "+response);
|
||||
|
||||
return response;
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Construct an LLSD reply packet to a CAPS inventory request
|
||||
/// </summary>
|
||||
/// <param name="invFetch"></param>
|
||||
/// <returns></returns>
|
||||
private LLSDInventoryDescendents FetchInventoryReply(LLSDFetchInventoryDescendents invFetch)
|
||||
{
|
||||
LLSDInventoryDescendents reply = new LLSDInventoryDescendents();
|
||||
LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents();
|
||||
contents.agent_id = invFetch.owner_id;
|
||||
contents.owner_id = invFetch.owner_id;
|
||||
contents.folder_id = invFetch.folder_id;
|
||||
|
||||
reply.folders.Array.Add(contents);
|
||||
InventoryCollection inv = new InventoryCollection();
|
||||
inv.Folders = new List<InventoryFolderBase>();
|
||||
inv.Items = new List<InventoryItemBase>();
|
||||
int version = 0;
|
||||
int descendents = 0;
|
||||
|
||||
inv
|
||||
= Fetch(
|
||||
invFetch.owner_id, invFetch.folder_id, invFetch.owner_id,
|
||||
invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version, out descendents);
|
||||
|
||||
if (inv != null && inv.Folders != null)
|
||||
{
|
||||
foreach (InventoryFolderBase invFolder in inv.Folders)
|
||||
{
|
||||
contents.categories.Array.Add(ConvertInventoryFolder(invFolder));
|
||||
}
|
||||
|
||||
descendents += inv.Folders.Count;
|
||||
}
|
||||
|
||||
if (inv != null && inv.Items != null)
|
||||
{
|
||||
foreach (InventoryItemBase invItem in inv.Items)
|
||||
{
|
||||
contents.items.Array.Add(ConvertInventoryItem(invItem));
|
||||
}
|
||||
}
|
||||
|
||||
contents.descendents = descendents;
|
||||
contents.version = version;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[WEB FETCH INV DESC HANDLER]: Replying to request for folder {0} (fetch items {1}, fetch folders {2}) with {3} items and {4} folders for agent {5}",
|
||||
// invFetch.folder_id,
|
||||
// invFetch.fetch_items,
|
||||
// invFetch.fetch_folders,
|
||||
// contents.items.Array.Count,
|
||||
// contents.categories.Array.Count,
|
||||
// invFetch.owner_id);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle the caps inventory descendents fetch.
|
||||
/// </summary>
|
||||
/// <param name="agentID"></param>
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="ownerID"></param>
|
||||
/// <param name="fetchFolders"></param>
|
||||
/// <param name="fetchItems"></param>
|
||||
/// <param name="sortOrder"></param>
|
||||
/// <param name="version"></param>
|
||||
/// <returns>An empty InventoryCollection if the inventory look up failed</returns>
|
||||
private InventoryCollection Fetch(
|
||||
UUID agentID, UUID folderID, UUID ownerID,
|
||||
bool fetchFolders, bool fetchItems, int sortOrder, out int version, out int descendents)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
|
||||
// fetchFolders, fetchItems, folderID, agentID);
|
||||
|
||||
// FIXME MAYBE: We're not handling sortOrder!
|
||||
|
||||
version = 0;
|
||||
descendents = 0;
|
||||
|
||||
InventoryFolderImpl fold;
|
||||
if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner)
|
||||
{
|
||||
if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
|
||||
{
|
||||
InventoryCollection ret = new InventoryCollection();
|
||||
ret.Folders = new List<InventoryFolderBase>();
|
||||
ret.Items = fold.RequestListOfItems();
|
||||
descendents = ret.Folders.Count + ret.Items.Count;
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
InventoryCollection contents = new InventoryCollection();
|
||||
|
||||
if (folderID != UUID.Zero)
|
||||
{
|
||||
contents = m_InventoryService.GetFolderContent(agentID, folderID);
|
||||
InventoryFolderBase containingFolder = new InventoryFolderBase();
|
||||
containingFolder.ID = folderID;
|
||||
containingFolder.Owner = agentID;
|
||||
containingFolder = m_InventoryService.GetFolder(containingFolder);
|
||||
|
||||
if (containingFolder != null)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[WEB FETCH INV DESC HANDLER]: Retrieved folder {0} {1} for agent id {2}",
|
||||
// containingFolder.Name, containingFolder.ID, agentID);
|
||||
|
||||
version = containingFolder.Version;
|
||||
|
||||
if (fetchItems)
|
||||
{
|
||||
List<InventoryItemBase> itemsToReturn = contents.Items;
|
||||
List<InventoryItemBase> originalItems = new List<InventoryItemBase>(itemsToReturn);
|
||||
|
||||
// descendents must only include the links, not the linked items we add
|
||||
descendents = originalItems.Count;
|
||||
|
||||
// Add target items for links in this folder before the links themselves.
|
||||
foreach (InventoryItemBase item in originalItems)
|
||||
{
|
||||
if (item.AssetType == (int)AssetType.Link)
|
||||
{
|
||||
InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
|
||||
|
||||
// Take care of genuinely broken links where the target doesn't exist
|
||||
// HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
|
||||
// but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
|
||||
// rather than having to keep track of every folder requested in the recursion.
|
||||
if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
|
||||
itemsToReturn.Insert(0, linkedItem);
|
||||
}
|
||||
}
|
||||
|
||||
// Now scan for folder links and insert the items they target and those links at the head of the return data
|
||||
foreach (InventoryItemBase item in originalItems)
|
||||
{
|
||||
if (item.AssetType == (int)AssetType.LinkFolder)
|
||||
{
|
||||
InventoryCollection linkedFolderContents = m_InventoryService.GetFolderContent(ownerID, item.AssetID);
|
||||
List<InventoryItemBase> links = linkedFolderContents.Items;
|
||||
|
||||
itemsToReturn.InsertRange(0, links);
|
||||
|
||||
foreach (InventoryItemBase link in linkedFolderContents.Items)
|
||||
{
|
||||
// Take care of genuinely broken links where the target doesn't exist
|
||||
// HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
|
||||
// but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
|
||||
// rather than having to keep track of every folder requested in the recursion.
|
||||
if (link != null)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[WEB FETCH INV DESC HANDLER]: Adding item {0} {1} from folder {2} linked from {3}",
|
||||
// link.Name, (AssetType)link.AssetType, item.AssetID, containingFolder.Name);
|
||||
|
||||
InventoryItemBase linkedItem
|
||||
= m_InventoryService.GetItem(new InventoryItemBase(link.AssetID));
|
||||
|
||||
if (linkedItem != null)
|
||||
itemsToReturn.Insert(0, linkedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// foreach (InventoryItemBase item in contents.Items)
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[WEB FETCH INV DESC HANDLER]: Returning item {0}, type {1}, parent {2} in {3} {4}",
|
||||
// item.Name, (AssetType)item.AssetType, item.Folder, containingFolder.Name, containingFolder.ID);
|
||||
// }
|
||||
|
||||
// =====
|
||||
|
||||
//
|
||||
// foreach (InventoryItemBase linkedItem in linkedItemsToAdd)
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[WEB FETCH INV DESC HANDLER]: Inserted linked item {0} for link in folder {1} for agent {2}",
|
||||
// linkedItem.Name, folderID, agentID);
|
||||
//
|
||||
// contents.Items.Add(linkedItem);
|
||||
// }
|
||||
//
|
||||
// // If the folder requested contains links, then we need to send those folders first, otherwise the links
|
||||
// // will be broken in the viewer.
|
||||
// HashSet<UUID> linkedItemFolderIdsToSend = new HashSet<UUID>();
|
||||
// foreach (InventoryItemBase item in contents.Items)
|
||||
// {
|
||||
// if (item.AssetType == (int)AssetType.Link)
|
||||
// {
|
||||
// InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
|
||||
//
|
||||
// // Take care of genuinely broken links where the target doesn't exist
|
||||
// // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
|
||||
// // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
|
||||
// // rather than having to keep track of every folder requested in the recursion.
|
||||
// if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
|
||||
// {
|
||||
// // We don't need to send the folder if source and destination of the link are in the same
|
||||
// // folder.
|
||||
// if (linkedItem.Folder != containingFolder.ID)
|
||||
// linkedItemFolderIdsToSend.Add(linkedItem.Folder);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[WEB FETCH INV DESC HANDLER]: Recursively fetching folder {0} linked by item in folder {1} for agent {2}",
|
||||
// linkedItemFolderId, folderID, agentID);
|
||||
//
|
||||
// int dummyVersion;
|
||||
// InventoryCollection linkedCollection
|
||||
// = Fetch(
|
||||
// agentID, linkedItemFolderId, ownerID, fetchFolders, fetchItems, sortOrder, out dummyVersion);
|
||||
//
|
||||
// InventoryFolderBase linkedFolder = new InventoryFolderBase(linkedItemFolderId);
|
||||
// linkedFolder.Owner = agentID;
|
||||
// linkedFolder = m_InventoryService.GetFolder(linkedFolder);
|
||||
//
|
||||
//// contents.Folders.AddRange(linkedCollection.Folders);
|
||||
//
|
||||
// contents.Folders.Add(linkedFolder);
|
||||
// contents.Items.AddRange(linkedCollection.Items);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Lost items don't really need a version
|
||||
version = 1;
|
||||
}
|
||||
|
||||
return contents;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Convert an internal inventory folder object into an LLSD object.
|
||||
/// </summary>
|
||||
/// <param name="invFolder"></param>
|
||||
/// <returns></returns>
|
||||
private LLSDInventoryFolder ConvertInventoryFolder(InventoryFolderBase invFolder)
|
||||
{
|
||||
LLSDInventoryFolder llsdFolder = new LLSDInventoryFolder();
|
||||
llsdFolder.folder_id = invFolder.ID;
|
||||
llsdFolder.parent_id = invFolder.ParentID;
|
||||
llsdFolder.name = invFolder.Name;
|
||||
llsdFolder.type = invFolder.Type;
|
||||
llsdFolder.preferred_type = -1;
|
||||
|
||||
return llsdFolder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert an internal inventory item object into an LLSD object.
|
||||
/// </summary>
|
||||
/// <param name="invItem"></param>
|
||||
/// <returns></returns>
|
||||
private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem)
|
||||
{
|
||||
LLSDInventoryItem llsdItem = new LLSDInventoryItem();
|
||||
llsdItem.asset_id = invItem.AssetID;
|
||||
llsdItem.created_at = invItem.CreationDate;
|
||||
llsdItem.desc = invItem.Description;
|
||||
llsdItem.flags = (int)invItem.Flags;
|
||||
llsdItem.item_id = invItem.ID;
|
||||
llsdItem.name = invItem.Name;
|
||||
llsdItem.parent_id = invItem.Folder;
|
||||
llsdItem.type = invItem.AssetType;
|
||||
llsdItem.inv_type = invItem.InvType;
|
||||
|
||||
llsdItem.permissions = new LLSDPermissions();
|
||||
llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
|
||||
llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions;
|
||||
llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions;
|
||||
llsdItem.permissions.group_id = invItem.GroupID;
|
||||
llsdItem.permissions.group_mask = (int)invItem.GroupPermissions;
|
||||
llsdItem.permissions.is_owner_group = invItem.GroupOwned;
|
||||
llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions;
|
||||
llsdItem.permissions.owner_id = invItem.Owner;
|
||||
llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
|
||||
llsdItem.sale_info = new LLSDSaleInfo();
|
||||
llsdItem.sale_info.sale_price = invItem.SalePrice;
|
||||
llsdItem.sale_info.sale_type = invItem.SaleType;
|
||||
|
||||
return llsdItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class WebFetchInvDescServerConnector : ServiceConnector
|
||||
{
|
||||
private IInventoryService m_InventoryService;
|
||||
private ILibraryService m_LibraryService;
|
||||
private string m_ConfigName = "CapsService";
|
||||
|
||||
public WebFetchInvDescServerConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||
base(config, server, configName)
|
||||
{
|
||||
if (configName != String.Empty)
|
||||
m_ConfigName = configName;
|
||||
|
||||
IConfig serverConfig = config.Configs[m_ConfigName];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
|
||||
|
||||
string invService = serverConfig.GetString("InventoryService", String.Empty);
|
||||
|
||||
if (invService == String.Empty)
|
||||
throw new Exception("No InventoryService in config file");
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
m_InventoryService =
|
||||
ServerUtils.LoadPlugin<IInventoryService>(invService, args);
|
||||
|
||||
if (m_InventoryService == null)
|
||||
throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName));
|
||||
|
||||
string libService = serverConfig.GetString("LibraryService", String.Empty);
|
||||
m_LibraryService =
|
||||
ServerUtils.LoadPlugin<ILibraryService>(libService, args);
|
||||
|
||||
WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
|
||||
IRequestHandler reqHandler
|
||||
= new RestStreamHandler(
|
||||
"POST",
|
||||
"/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/,
|
||||
webFetchHandler.FetchInventoryDescendentsRequest,
|
||||
"WebFetchInvDesc",
|
||||
null);
|
||||
server.AddStreamHandler(reqHandler);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -26,53 +26,94 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Region.ClientStack;
|
||||
using OpenSim.Region.ClientStack.LindenUDP;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenSim.Server.Handlers.Authentication;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication
|
||||
namespace OpenSim.Client.Linden
|
||||
{
|
||||
public class AuthenticationServiceInConnectorModule : ISharedRegionModule
|
||||
/// <summary>
|
||||
/// Linden UDP Stack Region Module
|
||||
/// </summary>
|
||||
public class LLClientStackModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static bool m_Enabled = false;
|
||||
|
||||
private IConfigSource m_Config;
|
||||
bool m_Registered = false;
|
||||
|
||||
#region IRegionModule interface
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
/// <summary>
|
||||
/// Scene that contains the region's data
|
||||
/// </summary>
|
||||
protected Scene m_scene;
|
||||
protected bool m_createClientStack = false;
|
||||
protected IClientNetworkServer m_clientServer;
|
||||
protected ClientStackManager m_clientStackManager;
|
||||
protected IConfigSource m_source;
|
||||
|
||||
protected string m_clientStackDll = "OpenSim.Region.ClientStack.LindenUDP.dll";
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
m_Config = config;
|
||||
IConfig moduleConfig = config.Configs["Modules"];
|
||||
if (moduleConfig != null)
|
||||
if (m_scene == null)
|
||||
{
|
||||
m_Enabled = moduleConfig.GetBoolean("AuthenticationServiceInConnector", false);
|
||||
if (m_Enabled)
|
||||
{
|
||||
m_log.Info("[AUTHENTICATION IN CONNECTOR]: Authentication Service In Connector enabled");
|
||||
}
|
||||
m_source = source;
|
||||
|
||||
IConfig startupConfig = m_source.Configs["Startup"];
|
||||
if (startupConfig != null)
|
||||
{
|
||||
m_clientStackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (m_scene == null)
|
||||
{
|
||||
m_scene = scene;
|
||||
}
|
||||
|
||||
if ((m_scene != null) && (m_createClientStack))
|
||||
{
|
||||
m_log.Info("[LLClientStackModule] Starting up LLClientStack.");
|
||||
IPEndPoint endPoint = m_scene.RegionInfo.InternalEndPoint;
|
||||
|
||||
uint port = (uint)endPoint.Port;
|
||||
m_clientStackManager = new ClientStackManager(m_clientStackDll);
|
||||
|
||||
m_clientServer
|
||||
= m_clientStackManager.CreateServer(endPoint.Address,
|
||||
ref port, m_scene.RegionInfo.ProxyOffset, m_scene.RegionInfo.m_allow_alternate_ports, m_source,
|
||||
m_scene.AuthenticateHandler);
|
||||
|
||||
m_clientServer.AddScene(m_scene);
|
||||
|
||||
m_clientServer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
@@ -82,38 +123,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "AuthenticationServiceInConnectorModule"; }
|
||||
get { return "LLClientStackModule"; }
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
public bool IsSharedModule
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
if (!m_Registered)
|
||||
{
|
||||
m_Registered = true;
|
||||
|
||||
m_log.Info("[AUTHENTICATION IN CONNECTOR]: Starting...");
|
||||
|
||||
new AuthenticationServiceConnector(m_Config, MainServer.Instance, "AuthenticationService");
|
||||
}
|
||||
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
335
OpenSim/Client/Linden/LLProxyLoginModule.cs
Normal file
335
OpenSim/Client/Linden/LLProxyLoginModule.cs
Normal file
@@ -0,0 +1,335 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Nwc.XmlRpc;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Security.Authentication;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Client.Linden
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles login user (expect user) and logoff user messages from the remote LL login server
|
||||
/// </summary>
|
||||
public class LLProxyLoginModule : ISharedRegionModule
|
||||
{
|
||||
private uint m_port = 0;
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public LLProxyLoginModule(uint port)
|
||||
{
|
||||
m_log.DebugFormat("[CLIENT]: LLProxyLoginModule port {0}", port);
|
||||
m_port = port;
|
||||
}
|
||||
|
||||
protected List<Scene> m_scenes = new List<Scene>();
|
||||
protected Scene m_firstScene;
|
||||
|
||||
protected bool m_enabled = false; // Module is only enabled if running in grid mode
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig startupConfig = source.Configs["Modules"];
|
||||
if (startupConfig != null)
|
||||
{
|
||||
m_enabled = startupConfig.GetBoolean("LLProxyLoginModule", false);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (m_firstScene == null)
|
||||
{
|
||||
m_firstScene = scene;
|
||||
|
||||
if (m_enabled)
|
||||
{
|
||||
AddHttpHandlers();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_enabled)
|
||||
{
|
||||
AddScene(scene);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (m_enabled)
|
||||
{
|
||||
RemoveScene(scene);
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "LLProxyLoginModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Adds "expect_user" and "logoff_user" xmlrpc method handlers
|
||||
/// </summary>
|
||||
protected void AddHttpHandlers()
|
||||
{
|
||||
//we will add our handlers to the first scene we received, as all scenes share a http server. But will this ever change?
|
||||
MainServer.GetHttpServer(m_port).AddXmlRPCHandler("expect_user", ExpectUser, false);
|
||||
MainServer.GetHttpServer(m_port).AddXmlRPCHandler("logoff_user", LogOffUser, false);
|
||||
}
|
||||
|
||||
protected void AddScene(Scene scene)
|
||||
{
|
||||
lock (m_scenes)
|
||||
{
|
||||
if (!m_scenes.Contains(scene))
|
||||
{
|
||||
m_scenes.Add(scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void RemoveScene(Scene scene)
|
||||
{
|
||||
lock (m_scenes)
|
||||
{
|
||||
if (m_scenes.Contains(scene))
|
||||
{
|
||||
m_scenes.Remove(scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Received from the user server when a user starts logging in. This call allows
|
||||
/// the region to prepare for direct communication from the client. Sends back an empty
|
||||
/// xmlrpc response on completion.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public XmlRpcResponse ExpectUser(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
XmlRpcResponse resp = new XmlRpcResponse();
|
||||
|
||||
try
|
||||
{
|
||||
ulong regionHandle = 0;
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
AgentCircuitData agentData = new AgentCircuitData();
|
||||
if (requestData.ContainsKey("session_id"))
|
||||
agentData.SessionID = new UUID((string)requestData["session_id"]);
|
||||
if (requestData.ContainsKey("secure_session_id"))
|
||||
agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]);
|
||||
if (requestData.ContainsKey("firstname"))
|
||||
agentData.firstname = (string)requestData["firstname"];
|
||||
if (requestData.ContainsKey("lastname"))
|
||||
agentData.lastname = (string)requestData["lastname"];
|
||||
if (requestData.ContainsKey("agent_id"))
|
||||
agentData.AgentID = new UUID((string)requestData["agent_id"]);
|
||||
if (requestData.ContainsKey("circuit_code"))
|
||||
agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
|
||||
if (requestData.ContainsKey("caps_path"))
|
||||
agentData.CapsPath = (string)requestData["caps_path"];
|
||||
if (requestData.ContainsKey("regionhandle"))
|
||||
regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
|
||||
else
|
||||
m_log.Warn("[CLIENT]: request from login server did not contain regionhandle");
|
||||
|
||||
// Appearance
|
||||
if (requestData.ContainsKey("appearance"))
|
||||
agentData.Appearance = new AvatarAppearance((Hashtable)requestData["appearance"]);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}",
|
||||
agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode);
|
||||
|
||||
if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
|
||||
{
|
||||
//m_log.Debug("[CLIENT]: Child agent detected");
|
||||
agentData.child = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//m_log.Debug("[CLIENT]: Main agent detected");
|
||||
agentData.startpos =
|
||||
new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"], Culture.NumberFormatInfo),
|
||||
(float)Convert.ToDecimal((string)requestData["startpos_y"], Culture.NumberFormatInfo),
|
||||
(float)Convert.ToDecimal((string)requestData["startpos_z"], Culture.NumberFormatInfo));
|
||||
agentData.child = false;
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
string denyMess = "";
|
||||
|
||||
Scene scene;
|
||||
if (TryGetRegion(regionHandle, out scene))
|
||||
{
|
||||
if (scene.RegionInfo.EstateSettings.IsBanned(agentData.AgentID))
|
||||
{
|
||||
denyMess = "User is banned from this region";
|
||||
m_log.InfoFormat(
|
||||
"[CLIENT]: Denying access for user {0} {1} because user is banned",
|
||||
agentData.firstname, agentData.lastname);
|
||||
}
|
||||
else
|
||||
{
|
||||
string reason;
|
||||
if (scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
|
||||
{
|
||||
success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
denyMess = String.Format("Login refused by region: {0}", reason);
|
||||
m_log.InfoFormat(
|
||||
"[CLIENT]: Denying access for user {0} {1} because user connection was refused by the region",
|
||||
agentData.firstname, agentData.lastname);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
denyMess = "Region not found";
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
Hashtable respdata = new Hashtable();
|
||||
respdata["success"] = "TRUE";
|
||||
resp.Value = respdata;
|
||||
}
|
||||
else
|
||||
{
|
||||
Hashtable respdata = new Hashtable();
|
||||
respdata["success"] = "FALSE";
|
||||
respdata["reason"] = denyMess;
|
||||
resp.Value = respdata;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[CLIENT]: Unable to receive user. Reason: {0} ({1})", e, e.StackTrace);
|
||||
Hashtable respdata = new Hashtable();
|
||||
respdata["success"] = "FALSE";
|
||||
respdata["reason"] = "Exception occurred";
|
||||
resp.Value = respdata;
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
// Grid Request Processing
|
||||
/// <summary>
|
||||
/// Ooops, our Agent must be dead if we're getting this request!
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public XmlRpcResponse LogOffUser(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
m_log.Debug("[CONNECTION DEBUGGING]: LogOff User Called");
|
||||
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
string message = (string)requestData["message"];
|
||||
UUID agentID = UUID.Zero;
|
||||
UUID RegionSecret = UUID.Zero;
|
||||
UUID.TryParse((string)requestData["agent_id"], out agentID);
|
||||
UUID.TryParse((string)requestData["region_secret"], out RegionSecret);
|
||||
|
||||
ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
|
||||
|
||||
Scene scene;
|
||||
if (TryGetRegion(regionHandle, out scene))
|
||||
{
|
||||
scene.HandleLogOffUserFromGrid(agentID, RegionSecret, message);
|
||||
}
|
||||
|
||||
return new XmlRpcResponse();
|
||||
}
|
||||
|
||||
protected bool TryGetRegion(ulong regionHandle, out Scene scene)
|
||||
{
|
||||
lock (m_scenes)
|
||||
{
|
||||
foreach (Scene nextScene in m_scenes)
|
||||
{
|
||||
if (nextScene.RegionInfo.RegionHandle == regionHandle)
|
||||
{
|
||||
scene = nextScene;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scene = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
290
OpenSim/Client/Linden/LLStandaloneLoginModule.cs
Normal file
290
OpenSim/Client/Linden/LLStandaloneLoginModule.cs
Normal file
@@ -0,0 +1,290 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
|
||||
namespace OpenSim.Client.Linden
|
||||
{
|
||||
public class LLStandaloneLoginModule : ISharedRegionModule, ILoginServiceToRegionsConnector
|
||||
{
|
||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected List<Scene> m_scenes = new List<Scene>();
|
||||
protected Scene m_firstScene;
|
||||
|
||||
protected bool m_enabled = false; // Module is only enabled if running in standalone mode
|
||||
|
||||
protected bool authenticate;
|
||||
protected string welcomeMessage;
|
||||
|
||||
protected LLStandaloneLoginService m_loginService;
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig startupConfig = source.Configs["Startup"];
|
||||
if (startupConfig != null)
|
||||
{
|
||||
m_enabled = !startupConfig.GetBoolean("gridmode", false);
|
||||
}
|
||||
|
||||
if (m_enabled)
|
||||
{
|
||||
authenticate = true;
|
||||
welcomeMessage = "Welcome to OpenSim";
|
||||
IConfig standaloneConfig = source.Configs["StandAlone"];
|
||||
if (standaloneConfig != null)
|
||||
{
|
||||
authenticate = standaloneConfig.GetBoolean("accounts_authenticate", true);
|
||||
welcomeMessage = standaloneConfig.GetString("welcome_message");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (m_enabled)
|
||||
{
|
||||
RemoveScene(scene);
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (m_firstScene == null)
|
||||
{
|
||||
m_firstScene = scene;
|
||||
|
||||
if (m_enabled)
|
||||
{
|
||||
//TODO: fix casting.
|
||||
LibraryRootFolder rootFolder
|
||||
= m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder;
|
||||
|
||||
IHttpServer httpServer = MainServer.Instance;
|
||||
|
||||
//TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference
|
||||
m_loginService
|
||||
= new LLStandaloneLoginService(
|
||||
(UserManagerBase)m_firstScene.CommsManager.UserAdminService, welcomeMessage,
|
||||
m_firstScene.InventoryService, m_firstScene.CommsManager.NetworkServersInfo, authenticate,
|
||||
rootFolder, this);
|
||||
|
||||
httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
|
||||
|
||||
// provides the web form login
|
||||
httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin);
|
||||
|
||||
// Provides the LLSD login
|
||||
httpServer.SetDefaultLLSDHandler(m_loginService.LLSDLoginMethod);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_enabled)
|
||||
{
|
||||
AddScene(scene);
|
||||
}
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "LLStandaloneLoginModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected void AddScene(Scene scene)
|
||||
{
|
||||
lock (m_scenes)
|
||||
{
|
||||
if (!m_scenes.Contains(scene))
|
||||
{
|
||||
m_scenes.Add(scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void RemoveScene(Scene scene)
|
||||
{
|
||||
lock (m_scenes)
|
||||
{
|
||||
if (m_scenes.Contains(scene))
|
||||
{
|
||||
m_scenes.Remove(scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason)
|
||||
{
|
||||
Scene scene;
|
||||
if (TryGetRegion(regionHandle, out scene))
|
||||
{
|
||||
return scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
|
||||
}
|
||||
reason = "Region not found.";
|
||||
return false;
|
||||
}
|
||||
|
||||
public void LogOffUserFromGrid(ulong regionHandle, UUID AvatarID, UUID RegionSecret, string message)
|
||||
{
|
||||
Scene scene;
|
||||
if (TryGetRegion(regionHandle, out scene))
|
||||
{
|
||||
scene.HandleLogOffUserFromGrid(AvatarID, RegionSecret, message);
|
||||
}
|
||||
}
|
||||
|
||||
public RegionInfo RequestNeighbourInfo(ulong regionhandle)
|
||||
{
|
||||
Scene scene;
|
||||
if (TryGetRegion(regionhandle, out scene))
|
||||
{
|
||||
return scene.RegionInfo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public RegionInfo RequestClosestRegion(string region)
|
||||
{
|
||||
Scene scene;
|
||||
if (TryGetRegion(region, out scene))
|
||||
{
|
||||
return scene.RegionInfo;
|
||||
}
|
||||
else if (m_scenes.Count > 0)
|
||||
{
|
||||
return m_scenes[0].RegionInfo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public RegionInfo RequestNeighbourInfo(UUID regionID)
|
||||
{
|
||||
Scene scene;
|
||||
if (TryGetRegion(regionID, out scene))
|
||||
{
|
||||
return scene.RegionInfo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected bool TryGetRegion(ulong regionHandle, out Scene scene)
|
||||
{
|
||||
lock (m_scenes)
|
||||
{
|
||||
foreach (Scene nextScene in m_scenes)
|
||||
{
|
||||
if (nextScene.RegionInfo.RegionHandle == regionHandle)
|
||||
{
|
||||
scene = nextScene;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scene = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected bool TryGetRegion(UUID regionID, out Scene scene)
|
||||
{
|
||||
lock (m_scenes)
|
||||
{
|
||||
foreach (Scene nextScene in m_scenes)
|
||||
{
|
||||
if (nextScene.RegionInfo.RegionID == regionID)
|
||||
{
|
||||
scene = nextScene;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scene = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected bool TryGetRegion(string regionName, out Scene scene)
|
||||
{
|
||||
lock (m_scenes)
|
||||
{
|
||||
foreach (Scene nextScene in m_scenes)
|
||||
{
|
||||
if (nextScene.RegionInfo.RegionName.Equals(regionName, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
scene = nextScene;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scene = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
239
OpenSim/Client/Linden/LLStandaloneLoginService.cs
Normal file
239
OpenSim/Client/Linden/LLStandaloneLoginService.cs
Normal file
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Communications.Services;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Client.Linden
|
||||
{
|
||||
public class LLStandaloneLoginService : LoginService
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected NetworkServersInfo m_serversInfo;
|
||||
protected bool m_authUsers = false;
|
||||
|
||||
/// <summary>
|
||||
/// Used to make requests to the local regions.
|
||||
/// </summary>
|
||||
protected ILoginServiceToRegionsConnector m_regionsConnector;
|
||||
|
||||
public LLStandaloneLoginService(
|
||||
UserManagerBase userManager, string welcomeMess,
|
||||
IInventoryService interServiceInventoryService,
|
||||
NetworkServersInfo serversInfo,
|
||||
bool authenticate, LibraryRootFolder libraryRootFolder, ILoginServiceToRegionsConnector regionsConnector)
|
||||
: base(userManager, libraryRootFolder, welcomeMess)
|
||||
{
|
||||
this.m_serversInfo = serversInfo;
|
||||
m_defaultHomeX = this.m_serversInfo.DefaultHomeLocX;
|
||||
m_defaultHomeY = this.m_serversInfo.DefaultHomeLocY;
|
||||
m_authUsers = authenticate;
|
||||
|
||||
m_InventoryService = interServiceInventoryService;
|
||||
m_regionsConnector = regionsConnector;
|
||||
// Standard behavior: In StandAlone, silent logout of last hung session
|
||||
m_warn_already_logged = false;
|
||||
}
|
||||
|
||||
public override UserProfileData GetTheUser(string firstname, string lastname)
|
||||
{
|
||||
UserProfileData profile = m_userManager.GetUserProfile(firstname, lastname);
|
||||
if (profile != null)
|
||||
{
|
||||
return profile;
|
||||
}
|
||||
|
||||
if (!m_authUsers)
|
||||
{
|
||||
//no current user account so make one
|
||||
m_log.Info("[LOGIN]: No user account found so creating a new one.");
|
||||
|
||||
m_userManager.AddUser(firstname, lastname, "test", "", m_defaultHomeX, m_defaultHomeY);
|
||||
|
||||
return m_userManager.GetUserProfile(firstname, lastname);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool AuthenticateUser(UserProfileData profile, string password)
|
||||
{
|
||||
if (!m_authUsers)
|
||||
{
|
||||
//for now we will accept any password in sandbox mode
|
||||
m_log.Info("[LOGIN]: Authorising user (no actual password check)");
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info(
|
||||
"[LOGIN]: Authenticating " + profile.FirstName + " " + profile.SurName);
|
||||
|
||||
if (!password.StartsWith("$1$"))
|
||||
password = "$1$" + Util.Md5Hash(password);
|
||||
|
||||
password = password.Remove(0, 3); //remove $1$
|
||||
|
||||
string s = Util.Md5Hash(password + ":" + profile.PasswordSalt);
|
||||
|
||||
bool loginresult = (profile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase)
|
||||
|| profile.PasswordHash.Equals(password, StringComparison.InvariantCulture));
|
||||
return loginresult;
|
||||
}
|
||||
}
|
||||
|
||||
protected override RegionInfo RequestClosestRegion(string region)
|
||||
{
|
||||
return m_regionsConnector.RequestClosestRegion(region);
|
||||
}
|
||||
|
||||
protected override RegionInfo GetRegionInfo(ulong homeRegionHandle)
|
||||
{
|
||||
return m_regionsConnector.RequestNeighbourInfo(homeRegionHandle);
|
||||
}
|
||||
|
||||
protected override RegionInfo GetRegionInfo(UUID homeRegionId)
|
||||
{
|
||||
return m_regionsConnector.RequestNeighbourInfo(homeRegionId);
|
||||
}
|
||||
|
||||
protected override bool PrepareLoginToRegion(
|
||||
RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient)
|
||||
{
|
||||
IPEndPoint endPoint = regionInfo.ExternalEndPoint;
|
||||
response.SimAddress = endPoint.Address.ToString();
|
||||
response.SimPort = (uint)endPoint.Port;
|
||||
response.RegionX = regionInfo.RegionLocX;
|
||||
response.RegionY = regionInfo.RegionLocY;
|
||||
|
||||
string capsPath = CapsUtil.GetRandomCapsObjectPath();
|
||||
string capsSeedPath = CapsUtil.GetCapsSeedPath(capsPath);
|
||||
|
||||
// Don't use the following! It Fails for logging into any region not on the same port as the http server!
|
||||
// Kept here so it doesn't happen again!
|
||||
// response.SeedCapability = regionInfo.ServerURI + capsSeedPath;
|
||||
|
||||
string seedcap = "http://";
|
||||
|
||||
if (m_serversInfo.HttpUsesSSL)
|
||||
{
|
||||
// For NAT
|
||||
string host = NetworkUtil.GetHostFor(remoteClient.Address, m_serversInfo.HttpSSLCN);
|
||||
|
||||
seedcap = "https://" + host + ":" + m_serversInfo.httpSSLPort + capsSeedPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
// For NAT
|
||||
string host = NetworkUtil.GetHostFor(remoteClient.Address, regionInfo.ExternalHostName);
|
||||
|
||||
seedcap = "http://" + host + ":" + m_serversInfo.HttpListenerPort + capsSeedPath;
|
||||
}
|
||||
|
||||
response.SeedCapability = seedcap;
|
||||
|
||||
// Notify the target of an incoming user
|
||||
m_log.InfoFormat(
|
||||
"[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection",
|
||||
regionInfo.RegionName, response.RegionX, response.RegionY, regionInfo.ServerURI);
|
||||
|
||||
// Update agent with target sim
|
||||
user.CurrentAgent.Region = regionInfo.RegionID;
|
||||
user.CurrentAgent.Handle = regionInfo.RegionHandle;
|
||||
|
||||
AgentCircuitData agent = new AgentCircuitData();
|
||||
agent.AgentID = user.ID;
|
||||
agent.firstname = user.FirstName;
|
||||
agent.lastname = user.SurName;
|
||||
agent.SessionID = user.CurrentAgent.SessionID;
|
||||
agent.SecureSessionID = user.CurrentAgent.SecureSessionID;
|
||||
agent.circuitcode = Convert.ToUInt32(response.CircuitCode);
|
||||
agent.BaseFolder = UUID.Zero;
|
||||
agent.InventoryFolder = UUID.Zero;
|
||||
agent.startpos = user.CurrentAgent.Position;
|
||||
agent.CapsPath = capsPath;
|
||||
agent.Appearance = m_userManager.GetUserAppearance(user.ID);
|
||||
if (agent.Appearance == null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[INTER]: Appearance not found for {0} {1}. Creating default.", agent.firstname, agent.lastname);
|
||||
agent.Appearance = new AvatarAppearance(agent.AgentID);
|
||||
}
|
||||
|
||||
string reason;
|
||||
bool success = m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason);
|
||||
if (!success)
|
||||
{
|
||||
response.ErrorReason = "key";
|
||||
response.ErrorMessage = reason;
|
||||
}
|
||||
return success;
|
||||
// return m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason);
|
||||
}
|
||||
|
||||
public override void LogOffUser(UserProfileData theUser, string message)
|
||||
{
|
||||
RegionInfo SimInfo;
|
||||
try
|
||||
{
|
||||
SimInfo = this.m_regionsConnector.RequestNeighbourInfo(theUser.CurrentAgent.Handle);
|
||||
|
||||
if (SimInfo == null)
|
||||
{
|
||||
m_log.Error("[LOCAL LOGIN]: Region user was in isn't currently logged in");
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Error("[LOCAL LOGIN]: Unable to look up region to log user off");
|
||||
return;
|
||||
}
|
||||
|
||||
m_regionsConnector.LogOffUserFromGrid(
|
||||
SimInfo.RegionHandle, theUser.ID, theUser.CurrentAgent.SecureSessionID, "Logging you off");
|
||||
}
|
||||
}
|
||||
}
|
||||
15
OpenSim/Client/Linden/Resources/LindenModules.addin.xml
Normal file
15
OpenSim/Client/Linden/Resources/LindenModules.addin.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<Addin id="OpenSim.Client.Linden.LindenModules" version="0.2">
|
||||
<Runtime>
|
||||
<Import assembly="OpenSim.Client.Linden.dll"/>
|
||||
</Runtime>
|
||||
|
||||
<Dependencies>
|
||||
<Addin id="OpenSim" version="0.5" />
|
||||
</Dependencies>
|
||||
|
||||
<Extension path = "/OpenSim/RegionModules">
|
||||
<RegionModule id="LLStandaloneLoginModule" type="OpenSim.Client.Linden.LLStandaloneLoginModule" />
|
||||
<RegionModule id="LLProxyLoginModule" type="OpenSim.Client.Linden.LLProxyLoginModule" />
|
||||
<RegionModule id="LLClientStackModule" type="OpenSim.Client.Linden.LLClientStackModule" />
|
||||
</Extension>
|
||||
</Addin>
|
||||
1704
OpenSim/Client/MXP/ClientStack/MXPClientView.cs
Normal file
1704
OpenSim/Client/MXP/ClientStack/MXPClientView.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -26,103 +26,106 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Timers;
|
||||
using log4net;
|
||||
using MXP;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Client.MXP.PacketHandler;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenSim.Server.Handlers.Login;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Login
|
||||
namespace OpenSim.Client.MXP
|
||||
{
|
||||
public class LLLoginServiceInConnectorModule : ISharedRegionModule
|
||||
|
||||
/**
|
||||
* MXP Client Module which adds MXP support to client / region communication.
|
||||
*/
|
||||
public class MXPModule : IRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static bool m_Enabled = false;
|
||||
private static bool m_Registered = false;
|
||||
|
||||
private IConfigSource m_Config;
|
||||
private List<Scene> m_Scenes = new List<Scene>();
|
||||
private MXPPacketServer m_server;
|
||||
|
||||
#region IRegionModule interface
|
||||
private IConfigSource m_config;
|
||||
private int m_port = 1253;
|
||||
private Timer m_ticker;
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
private readonly Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
||||
private bool m_shutdown;
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource source)
|
||||
{
|
||||
m_Config = config;
|
||||
|
||||
IConfig moduleConfig = config.Configs["Modules"];
|
||||
if (moduleConfig != null)
|
||||
{
|
||||
m_Enabled = moduleConfig.GetBoolean("LLLoginServiceInConnector", false);
|
||||
if (m_Enabled)
|
||||
{
|
||||
m_log.Info("[LLLOGIN IN CONNECTOR]: LLLoginerviceInConnector enabled");
|
||||
}
|
||||
|
||||
}
|
||||
if (!m_scenes.ContainsKey(scene.RegionInfo.RegionID))
|
||||
m_scenes.Add(scene.RegionInfo.RegionID, scene);
|
||||
|
||||
m_config = source;
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
if (m_config.Configs["MXP"] != null)
|
||||
{
|
||||
IConfig con = m_config.Configs["MXP"];
|
||||
|
||||
m_log.Info("[LLLOGIN IN CONNECTOR]: Starting...");
|
||||
if (!con.GetBoolean("Enabled", false))
|
||||
return;
|
||||
|
||||
m_port = con.GetInt("Port", m_port);
|
||||
|
||||
m_server = new MXPPacketServer(m_port, m_scenes,m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate",true));
|
||||
|
||||
m_ticker = new Timer(100);
|
||||
m_ticker.AutoReset = false;
|
||||
m_ticker.Elapsed += ticker_Elapsed;
|
||||
|
||||
lock (m_ticker)
|
||||
m_ticker.Start();
|
||||
|
||||
m_log.Info("[MXP ClientStack] MXP Enabled and Listening");
|
||||
}
|
||||
}
|
||||
|
||||
void ticker_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_server.Process();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Error("[MXP ClientStack]: Unhandled exception in process loop: " + ex.ToString() + " :" + ex.StackTrace.ToString());
|
||||
}
|
||||
|
||||
if (!m_shutdown)
|
||||
{
|
||||
lock (m_ticker)
|
||||
m_ticker.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
m_shutdown = true;
|
||||
if (m_ticker != null)
|
||||
{
|
||||
lock (m_ticker)
|
||||
m_ticker.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "LLLoginServiceInConnectorModule"; }
|
||||
get { return "MXP ClientStack Module"; }
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
public bool IsSharedModule
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_Scenes.Add(scene);
|
||||
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (m_Enabled && m_Scenes.Contains(scene))
|
||||
m_Scenes.Remove(scene);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
if (!m_Registered)
|
||||
{
|
||||
m_Registered = true;
|
||||
new LLLoginServiceInConnector(m_Config, MainServer.Instance, scene);
|
||||
//Object[] args = new Object[] { m_Config, MainServer.Instance, this, scene };
|
||||
//ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:LLLoginServiceInConnector", args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -25,25 +25,18 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using OpenMetaverse;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using pCampBot.Interfaces;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace pCampBot
|
||||
namespace OpenSim.Client.MXP
|
||||
{
|
||||
public class AbstractBehaviour : IBehaviour
|
||||
public static class MXPUtil
|
||||
{
|
||||
public string Name { get; protected set; }
|
||||
|
||||
public Bot Bot { get; protected set; }
|
||||
|
||||
public virtual void Action() {}
|
||||
|
||||
public virtual void Initialize(Bot bot)
|
||||
public static string GenerateMXPURL(string server, int port, UUID bubbleID, Vector3 location)
|
||||
{
|
||||
Bot = bot;
|
||||
return string.Format("mxp://{0}:{1}/{2}/{3}", server, port, bubbleID.Guid, location);
|
||||
}
|
||||
}
|
||||
}
|
||||
629
OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
Normal file
629
OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
Normal file
@@ -0,0 +1,629 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* This file borrows heavily from MXPServer.cs - the reference MXPServer
|
||||
* See http://www.bubblecloud.org for a copy of the original file and
|
||||
* implementation details. */
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using MXP;
|
||||
using MXP.Messages;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Client.MXP.ClientStack;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Framework.Communications;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace OpenSim.Client.MXP.PacketHandler
|
||||
{
|
||||
public class MXPPacketServer
|
||||
{
|
||||
internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
#region Fields
|
||||
|
||||
private readonly List<MXPClientView> m_clients = new List<MXPClientView>();
|
||||
private readonly Dictionary<UUID, Scene> m_scenes;
|
||||
private readonly Transmitter m_transmitter;
|
||||
|
||||
// private readonly Thread m_clientThread;
|
||||
|
||||
private readonly IList<Session> m_sessions = new List<Session>();
|
||||
private readonly IList<Session> m_sessionsToClient = new List<Session>();
|
||||
private readonly IList<MXPClientView> m_sessionsToRemove = new List<MXPClientView>();
|
||||
|
||||
private readonly int m_port;
|
||||
private readonly bool m_accountsAuthenticate;
|
||||
|
||||
private readonly String m_programName;
|
||||
private readonly byte m_programMajorVersion;
|
||||
private readonly byte m_programMinorVersion;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public MXPPacketServer(int port, Dictionary<UUID, Scene> scenes, bool accountsAuthenticate)
|
||||
{
|
||||
m_port = port;
|
||||
m_accountsAuthenticate = accountsAuthenticate;
|
||||
|
||||
m_scenes = scenes;
|
||||
|
||||
m_programMinorVersion = 63;
|
||||
m_programMajorVersion = 0;
|
||||
m_programName = "OpenSimulator";
|
||||
|
||||
m_transmitter = new Transmitter(port);
|
||||
|
||||
StartListener();
|
||||
}
|
||||
|
||||
public void StartListener()
|
||||
{
|
||||
m_log.Info("[MXP ClientStack] Transmitter starting on UDP server port: " + m_port);
|
||||
m_transmitter.Startup();
|
||||
m_log.Info("[MXP ClientStack] Transmitter started. MXP version: "+MxpConstants.ProtocolMajorVersion+"."+MxpConstants.ProtocolMinorVersion+" Source Revision: "+MxpConstants.ProtocolSourceRevision);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Number of sessions pending. (Process() accepts pending sessions).
|
||||
/// </summary>
|
||||
public int PendingSessionCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_transmitter.PendingSessionCount;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Number of connected sessions.
|
||||
/// </summary>
|
||||
public int SessionCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_sessions.Count;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Property reflecting whether client transmitter threads are alive.
|
||||
/// </summary>
|
||||
public bool IsTransmitterAlive
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_transmitter != null && m_transmitter.IsAlive;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Number of packets sent.
|
||||
/// </summary>
|
||||
public ulong PacketsSent
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_transmitter != null ? m_transmitter.PacketsSent : 0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Number of packets received.
|
||||
/// </summary>
|
||||
public ulong PacketsReceived
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_transmitter != null ? m_transmitter.PacketsReceived : 0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Bytes client has received so far.
|
||||
/// </summary>
|
||||
public ulong BytesReceived
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_transmitter != null ? m_transmitter.BytesReceived : 0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Bytes client has sent so far.
|
||||
/// </summary>
|
||||
public ulong BytesSent
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_transmitter != null ? m_transmitter.BytesSent : 0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Number of bytes received (bytes per second) during past second.
|
||||
/// </summary>
|
||||
public double ReceiveRate
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_transmitter != null ? m_transmitter.ReceiveRate : 0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Number of bytes sent (bytes per second) during past second.
|
||||
/// </summary>
|
||||
public double SendRate
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_transmitter != null ? m_transmitter.SendRate : 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Session Management
|
||||
|
||||
public void Disconnect(Session session)
|
||||
{
|
||||
if (session.IsConnected)
|
||||
{
|
||||
Message message = MessageFactory.Current.ReserveMessage(typeof(LeaveRequestMessage));
|
||||
session.Send(message);
|
||||
MessageFactory.Current.ReleaseMessage(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Not connected.");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Processing
|
||||
|
||||
public void Process()
|
||||
{
|
||||
ProcessMessages();
|
||||
Clean();
|
||||
}
|
||||
|
||||
public void Clean()
|
||||
{
|
||||
foreach (MXPClientView clientView in m_clients)
|
||||
{
|
||||
if (clientView.Session.SessionState == SessionState.Disconnected)
|
||||
{
|
||||
m_sessionsToRemove.Add(clientView);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (MXPClientView clientView in m_sessionsToRemove)
|
||||
{
|
||||
clientView.Scene.RemoveClient(clientView.AgentId);
|
||||
clientView.OnClean();
|
||||
m_clients.Remove(clientView);
|
||||
m_sessions.Remove(clientView.Session);
|
||||
}
|
||||
|
||||
m_sessionsToRemove.Clear();
|
||||
}
|
||||
|
||||
public void ProcessMessages()
|
||||
{
|
||||
if (m_transmitter.PendingSessionCount > 0)
|
||||
{
|
||||
Session tmp = m_transmitter.AcceptPendingSession();
|
||||
m_sessions.Add(tmp);
|
||||
m_sessionsToClient.Add(tmp);
|
||||
|
||||
}
|
||||
|
||||
List<Session> tmpRemove = new List<Session>();
|
||||
|
||||
foreach (Session session in m_sessionsToClient)
|
||||
{
|
||||
while (session.AvailableMessages > 0)
|
||||
{
|
||||
Message message = session.Receive();
|
||||
|
||||
if (message.GetType() == typeof (JoinRequestMessage))
|
||||
{
|
||||
|
||||
JoinRequestMessage joinRequestMessage = (JoinRequestMessage) message;
|
||||
|
||||
m_log.Info("[MXP ClientStack]: Session join request: " + session.SessionId + " (" +
|
||||
(session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" +
|
||||
session.RemoteEndPoint.Port + ")");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
if (joinRequestMessage.BubbleId == Guid.Empty)
|
||||
{
|
||||
foreach (Scene scene in m_scenes.Values)
|
||||
{
|
||||
if (scene.RegionInfo.RegionName == joinRequestMessage.BubbleName)
|
||||
{
|
||||
m_log.Info("[MXP ClientStack]: Resolved region by name: " + joinRequestMessage.BubbleName + " (" + scene.RegionInfo.RegionID + ")");
|
||||
joinRequestMessage.BubbleId = scene.RegionInfo.RegionID.Guid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (joinRequestMessage.BubbleId == Guid.Empty)
|
||||
{
|
||||
m_log.Warn("[MXP ClientStack]: Failed to resolve region by name: " + joinRequestMessage.BubbleName);
|
||||
}
|
||||
|
||||
UUID sceneId = new UUID(joinRequestMessage.BubbleId);
|
||||
|
||||
bool regionExists = true;
|
||||
if (!m_scenes.ContainsKey(sceneId))
|
||||
{
|
||||
m_log.Info("[MXP ClientStack]: No such region: " + sceneId);
|
||||
regionExists = false;
|
||||
}
|
||||
|
||||
UserProfileData user = null;
|
||||
UUID userId = UUID.Zero;
|
||||
string firstName = null;
|
||||
string lastName = null;
|
||||
bool authorized = regionExists ? AuthoriseUser(joinRequestMessage.ParticipantName,
|
||||
joinRequestMessage.ParticipantPassphrase,
|
||||
new UUID(joinRequestMessage.BubbleId), out userId, out firstName, out lastName, out user)
|
||||
: false;
|
||||
|
||||
if (authorized)
|
||||
{
|
||||
Scene scene = m_scenes[sceneId];
|
||||
UUID mxpSessionID = UUID.Random();
|
||||
|
||||
string reason;
|
||||
|
||||
m_log.Debug("[MXP ClientStack]: Session join request success: " + session.SessionId + " (" +
|
||||
(session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" +
|
||||
session.RemoteEndPoint.Port + ")");
|
||||
|
||||
m_log.Debug("[MXP ClientStack]: Attaching UserAgent to UserProfile...");
|
||||
AttachUserAgentToUserProfile(session, mxpSessionID, sceneId, user);
|
||||
m_log.Debug("[MXP ClientStack]: Attached UserAgent to UserProfile.");
|
||||
m_log.Debug("[MXP ClientStack]: Preparing Scene to Connection...");
|
||||
if (!PrepareSceneForConnection(mxpSessionID, sceneId, user, out reason))
|
||||
{
|
||||
m_log.DebugFormat("[MXP ClientStack]: Scene refused connection: {0}", reason);
|
||||
DeclineConnection(session, joinRequestMessage);
|
||||
tmpRemove.Add(session);
|
||||
continue;
|
||||
}
|
||||
m_log.Debug("[MXP ClientStack]: Prepared Scene to Connection.");
|
||||
m_log.Debug("[MXP ClientStack]: Accepting connection...");
|
||||
AcceptConnection(session, joinRequestMessage, mxpSessionID, userId);
|
||||
m_log.Info("[MXP ClientStack]: Accepted connection.");
|
||||
|
||||
m_log.Debug("[MXP ClientStack]: Creating ClientView....");
|
||||
MXPClientView client = new MXPClientView(session, mxpSessionID, userId, scene, firstName, lastName);
|
||||
m_clients.Add(client);
|
||||
m_log.Debug("[MXP ClientStack]: Created ClientView.");
|
||||
|
||||
client.MXPSendSynchronizationBegin(m_scenes[new UUID(joinRequestMessage.BubbleId)].SceneContents.GetTotalObjectsCount());
|
||||
|
||||
m_log.Debug("[MXP ClientStack]: Starting ClientView...");
|
||||
try
|
||||
{
|
||||
client.Start();
|
||||
m_log.Debug("[MXP ClientStack]: Started ClientView.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e);
|
||||
}
|
||||
|
||||
m_log.Debug("[MXP ClientStack]: Connected");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("[MXP ClientStack]: Session join request failure: " + session.SessionId + " (" +
|
||||
(session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" +
|
||||
session.RemoteEndPoint.Port + ")");
|
||||
|
||||
DeclineConnection(session, joinRequestMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[MXP ClientStack]: Session join request failure: " + session.SessionId + " (" +
|
||||
(session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" +
|
||||
session.RemoteEndPoint.Port + "): "+e.ToString()+" :"+e.StackTrace.ToString());
|
||||
}
|
||||
tmpRemove.Add(session);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Session session in tmpRemove)
|
||||
{
|
||||
m_sessionsToClient.Remove(session);
|
||||
}
|
||||
|
||||
foreach (MXPClientView clientView in m_clients)
|
||||
{
|
||||
int messagesProcessedCount = 0;
|
||||
Session session = clientView.Session;
|
||||
|
||||
while (session.AvailableMessages > 0)
|
||||
{
|
||||
Message message = session.Receive();
|
||||
|
||||
if (message.GetType() == typeof(LeaveRequestMessage))
|
||||
{
|
||||
LeaveResponseMessage leaveResponseMessage = (LeaveResponseMessage)MessageFactory.Current.ReserveMessage(
|
||||
typeof(LeaveResponseMessage));
|
||||
|
||||
m_log.Debug("[MXP ClientStack]: Session leave request: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")");
|
||||
|
||||
leaveResponseMessage.RequestMessageId = message.MessageId;
|
||||
leaveResponseMessage.FailureCode = 0;
|
||||
session.Send(leaveResponseMessage);
|
||||
|
||||
if (session.SessionState != SessionState.Disconnected)
|
||||
{
|
||||
session.SetStateDisconnected();
|
||||
}
|
||||
|
||||
m_log.Debug("[MXP ClientStack]: Removing Client from Scene");
|
||||
//clientView.Scene.RemoveClient(clientView.AgentId);
|
||||
}
|
||||
if (message.GetType() == typeof(LeaveResponseMessage))
|
||||
{
|
||||
LeaveResponseMessage leaveResponseMessage = (LeaveResponseMessage)message;
|
||||
|
||||
m_log.Debug("[MXP ClientStack]: Session leave response: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")");
|
||||
|
||||
if (leaveResponseMessage.FailureCode == 0)
|
||||
{
|
||||
session.SetStateDisconnected();
|
||||
}
|
||||
|
||||
m_log.Debug("[MXP ClientStack]: Removing Client from Scene");
|
||||
//clientView.Scene.RemoveClient(clientView.AgentId);
|
||||
}
|
||||
else
|
||||
{
|
||||
clientView.MXPPRocessMessage(message);
|
||||
}
|
||||
|
||||
MessageFactory.Current.ReleaseMessage(message);
|
||||
messagesProcessedCount++;
|
||||
if (messagesProcessedCount > 1000)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AcceptConnection(Session session, JoinRequestMessage joinRequestMessage, UUID mxpSessionID, UUID userId)
|
||||
{
|
||||
JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage(
|
||||
typeof(JoinResponseMessage));
|
||||
|
||||
joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId;
|
||||
joinResponseMessage.FailureCode = MxpResponseCodes.SUCCESS;
|
||||
|
||||
joinResponseMessage.BubbleId = joinRequestMessage.BubbleId;
|
||||
joinResponseMessage.ParticipantId = userId.Guid;
|
||||
joinResponseMessage.AvatarId = userId.Guid;
|
||||
joinResponseMessage.BubbleAssetCacheUrl = "http://" +
|
||||
NetworkUtil.GetHostFor(session.RemoteEndPoint.Address,
|
||||
m_scenes[
|
||||
new UUID(joinRequestMessage.BubbleId)].
|
||||
RegionInfo.
|
||||
ExternalHostName) + ":" +
|
||||
m_scenes[new UUID(joinRequestMessage.BubbleId)].RegionInfo.
|
||||
HttpPort + "/assets/";
|
||||
|
||||
joinResponseMessage.BubbleName = m_scenes[new UUID(joinRequestMessage.BubbleId)].RegionInfo.RegionName;
|
||||
|
||||
joinResponseMessage.BubbleRange = 128;
|
||||
joinResponseMessage.BubblePerceptionRange = 128 + 256;
|
||||
joinResponseMessage.BubbleRealTime = 0;
|
||||
joinResponseMessage.ProgramName = m_programName;
|
||||
joinResponseMessage.ProgramMajorVersion = m_programMajorVersion;
|
||||
joinResponseMessage.ProgramMinorVersion = m_programMinorVersion;
|
||||
joinResponseMessage.ProtocolMajorVersion = MxpConstants.ProtocolMajorVersion;
|
||||
joinResponseMessage.ProtocolMinorVersion = MxpConstants.ProtocolMinorVersion;
|
||||
joinResponseMessage.ProtocolSourceRevision = MxpConstants.ProtocolSourceRevision;
|
||||
|
||||
session.Send(joinResponseMessage);
|
||||
|
||||
session.SetStateConnected();
|
||||
}
|
||||
|
||||
private void DeclineConnection(Session session, Message joinRequestMessage)
|
||||
{
|
||||
JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage(typeof(JoinResponseMessage));
|
||||
|
||||
joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId;
|
||||
joinResponseMessage.FailureCode = MxpResponseCodes.UNAUTHORIZED_OPERATION;
|
||||
|
||||
joinResponseMessage.ProgramName = m_programName;
|
||||
joinResponseMessage.ProgramMajorVersion = m_programMajorVersion;
|
||||
joinResponseMessage.ProgramMinorVersion = m_programMinorVersion;
|
||||
joinResponseMessage.ProtocolMajorVersion = MxpConstants.ProtocolMajorVersion;
|
||||
joinResponseMessage.ProtocolMinorVersion = MxpConstants.ProtocolMinorVersion;
|
||||
joinResponseMessage.ProtocolSourceRevision = MxpConstants.ProtocolSourceRevision;
|
||||
|
||||
session.Send(joinResponseMessage);
|
||||
|
||||
session.SetStateDisconnected();
|
||||
}
|
||||
|
||||
public bool AuthoriseUser(string participantName, string password, UUID sceneId, out UUID userId, out string firstName, out string lastName, out UserProfileData userProfile)
|
||||
{
|
||||
userId = UUID.Zero;
|
||||
firstName = "";
|
||||
lastName = "";
|
||||
userProfile = null;
|
||||
|
||||
string[] nameParts = participantName.Split(' ');
|
||||
if (nameParts.Length != 2)
|
||||
{
|
||||
m_log.Error("[MXP ClientStack]: Login failed as user name is not formed of first and last name separated by space: " + participantName);
|
||||
return false;
|
||||
}
|
||||
firstName = nameParts[0];
|
||||
lastName = nameParts[1];
|
||||
|
||||
userProfile = m_scenes[sceneId].CommsManager.UserService.GetUserProfile(firstName, lastName);
|
||||
|
||||
if (userProfile == null && !m_accountsAuthenticate)
|
||||
{
|
||||
userId = ((UserManagerBase)m_scenes[sceneId].CommsManager.UserService).AddUser(firstName, lastName, "test", "", 1000, 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (userProfile == null)
|
||||
{
|
||||
m_log.Error("[MXP ClientStack]: Login failed as user was not found: " + participantName);
|
||||
return false;
|
||||
}
|
||||
userId = userProfile.ID;
|
||||
}
|
||||
|
||||
if (m_accountsAuthenticate)
|
||||
{
|
||||
if (!password.StartsWith("$1$"))
|
||||
{
|
||||
password = "$1$" + Util.Md5Hash(password);
|
||||
}
|
||||
password = password.Remove(0, 3); //remove $1$
|
||||
string s = Util.Md5Hash(password + ":" + userProfile.PasswordSalt);
|
||||
return (userProfile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase)
|
||||
|| userProfile.PasswordHash.Equals(password, StringComparison.InvariantCulture));
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void AttachUserAgentToUserProfile(Session session, UUID sessionId, UUID sceneId, UserProfileData userProfile)
|
||||
{
|
||||
//Scene scene = m_scenes[sceneId];
|
||||
CommunicationsManager commsManager = m_scenes[sceneId].CommsManager;
|
||||
IUserService userService = (IUserService)commsManager.UserService;
|
||||
|
||||
UserAgentData agent = new UserAgentData();
|
||||
|
||||
// User connection
|
||||
agent.AgentOnline = true;
|
||||
agent.AgentIP = session.RemoteEndPoint.Address.ToString();
|
||||
agent.AgentPort = (uint)session.RemoteEndPoint.Port;
|
||||
|
||||
agent.SecureSessionID = UUID.Random();
|
||||
agent.SessionID = sessionId;
|
||||
|
||||
// Profile UUID
|
||||
agent.ProfileID = userProfile.ID;
|
||||
|
||||
// Current location/position/alignment
|
||||
if (userProfile.CurrentAgent != null)
|
||||
{
|
||||
agent.Region = userProfile.CurrentAgent.Region;
|
||||
agent.Handle = userProfile.CurrentAgent.Handle;
|
||||
agent.Position = userProfile.CurrentAgent.Position;
|
||||
agent.LookAt = userProfile.CurrentAgent.LookAt;
|
||||
}
|
||||
else
|
||||
{
|
||||
agent.Region = userProfile.HomeRegionID;
|
||||
agent.Handle = userProfile.HomeRegion;
|
||||
agent.Position = userProfile.HomeLocation;
|
||||
agent.LookAt = userProfile.HomeLookAt;
|
||||
}
|
||||
|
||||
// What time did the user login?
|
||||
agent.LoginTime = Util.UnixTimeSinceEpoch();
|
||||
agent.LogoutTime = 0;
|
||||
|
||||
userProfile.CurrentAgent = agent;
|
||||
|
||||
|
||||
userService.UpdateUserProfile(userProfile);
|
||||
//userService.CommitAgent(ref userProfile);
|
||||
}
|
||||
|
||||
private bool PrepareSceneForConnection(UUID sessionId, UUID sceneId, UserProfileData userProfile, out string reason)
|
||||
{
|
||||
Scene scene = m_scenes[sceneId];
|
||||
CommunicationsManager commsManager = m_scenes[sceneId].CommsManager;
|
||||
UserManagerBase userService = (UserManagerBase)commsManager.UserService;
|
||||
|
||||
AgentCircuitData agent = new AgentCircuitData();
|
||||
agent.AgentID = userProfile.ID;
|
||||
agent.firstname = userProfile.FirstName;
|
||||
agent.lastname = userProfile.SurName;
|
||||
agent.SessionID = sessionId;
|
||||
agent.SecureSessionID = userProfile.CurrentAgent.SecureSessionID;
|
||||
agent.circuitcode = sessionId.CRC();
|
||||
agent.BaseFolder = UUID.Zero;
|
||||
agent.InventoryFolder = UUID.Zero;
|
||||
agent.startpos = new Vector3(0, 0, 0); // TODO Fill in region start position
|
||||
agent.CapsPath = "http://localhost/";
|
||||
agent.Appearance = userService.GetUserAppearance(userProfile.ID);
|
||||
|
||||
if (agent.Appearance == null)
|
||||
{
|
||||
m_log.WarnFormat("[INTER]: Appearance not found for {0} {1}. Creating default.", agent.firstname, agent.lastname);
|
||||
agent.Appearance = new AvatarAppearance();
|
||||
}
|
||||
|
||||
return scene.NewUserConnection(agent, 0, out reason);
|
||||
}
|
||||
|
||||
public void PrintDebugInformation()
|
||||
{
|
||||
m_log.Info("[MXP ClientStack]: Statistics report");
|
||||
m_log.Info("Pending Sessions: " + PendingSessionCount);
|
||||
m_log.Info("Sessions: " + SessionCount + " (Clients: " + m_clients.Count + " )");
|
||||
m_log.Info("Transmitter Alive?: " + IsTransmitterAlive);
|
||||
m_log.Info("Packets Sent/Received: " + PacketsSent + " / " + PacketsReceived);
|
||||
m_log.Info("Bytes Sent/Received: " + BytesSent + " / " + BytesReceived);
|
||||
m_log.Info("Send/Receive Rate (bps): " + SendRate + " / " + ReceiveRate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
1195
OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs
Normal file
1195
OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs
Normal file
File diff suppressed because it is too large
Load Diff
630
OpenSim/Client/Sirikata/Protocol/MessageHeader.cs
Normal file
630
OpenSim/Client/Sirikata/Protocol/MessageHeader.cs
Normal file
@@ -0,0 +1,630 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
|
||||
using pb = global::Google.ProtocolBuffers;
|
||||
using pbc = global::Google.ProtocolBuffers.Collections;
|
||||
using pbd = global::Google.ProtocolBuffers.Descriptors;
|
||||
using scg = global::System.Collections.Generic;
|
||||
namespace Sirikata.Protocol._PBJ_Internal {
|
||||
|
||||
public static partial class MessageHeader {
|
||||
|
||||
#region Extension registration
|
||||
public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {
|
||||
}
|
||||
#endregion
|
||||
#region Static variables
|
||||
internal static pbd::MessageDescriptor internal__static_Sirikata_Protocol__PBJ_Internal_Header__Descriptor;
|
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Sirikata.Protocol._PBJ_Internal.Header, global::Sirikata.Protocol._PBJ_Internal.Header.Builder> internal__static_Sirikata_Protocol__PBJ_Internal_Header__FieldAccessorTable;
|
||||
#endregion
|
||||
#region Descriptor
|
||||
public static pbd::FileDescriptor Descriptor {
|
||||
get { return descriptor; }
|
||||
}
|
||||
private static pbd::FileDescriptor descriptor;
|
||||
|
||||
static MessageHeader() {
|
||||
byte[] descriptorData = global::System.Convert.FromBase64String(
|
||||
"ChNNZXNzYWdlSGVhZGVyLnByb3RvEh9TaXJpa2F0YS5Qcm90b2NvbC5fUEJK" +
|
||||
"X0ludGVybmFsIooDCgZIZWFkZXISFQoNc291cmNlX29iamVjdBgBIAEoDBIT" +
|
||||
"Cgtzb3VyY2VfcG9ydBgDIAEoDRIVCgxzb3VyY2Vfc3BhY2UYgAwgASgMEhoK" +
|
||||
"EmRlc3RpbmF0aW9uX29iamVjdBgCIAEoDBIYChBkZXN0aW5hdGlvbl9wb3J0" +
|
||||
"GAQgASgNEhoKEWRlc3RpbmF0aW9uX3NwYWNlGIEMIAEoDBIKCgJpZBgHIAEo" +
|
||||
"AxIQCghyZXBseV9pZBgIIAEoAxJMCg1yZXR1cm5fc3RhdHVzGIAOIAEoDjI0" +
|
||||
"LlNpcmlrYXRhLlByb3RvY29sLl9QQkpfSW50ZXJuYWwuSGVhZGVyLlJldHVy" +
|
||||
"blN0YXR1cyJ/CgxSZXR1cm5TdGF0dXMSCwoHU1VDQ0VTUxAAEhMKD05FVFdP" +
|
||||
"UktfRkFJTFVSRRABEhMKD1RJTUVPVVRfRkFJTFVSRRADEhIKDlBST1RPQ09M" +
|
||||
"X0VSUk9SEAQSEAoMUE9SVF9GQUlMVVJFEAUSEgoOVU5LTk9XTl9PQkpFQ1QQ" +
|
||||
"Bg==");
|
||||
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
|
||||
descriptor = root;
|
||||
internal__static_Sirikata_Protocol__PBJ_Internal_Header__Descriptor = Descriptor.MessageTypes[0];
|
||||
internal__static_Sirikata_Protocol__PBJ_Internal_Header__FieldAccessorTable =
|
||||
new pb::FieldAccess.FieldAccessorTable<global::Sirikata.Protocol._PBJ_Internal.Header, global::Sirikata.Protocol._PBJ_Internal.Header.Builder>(internal__static_Sirikata_Protocol__PBJ_Internal_Header__Descriptor,
|
||||
new string[] { "SourceObject", "SourcePort", "SourceSpace", "DestinationObject", "DestinationPort", "DestinationSpace", "Id", "ReplyId", "ReturnStatus", });
|
||||
return null;
|
||||
};
|
||||
pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
|
||||
new pbd::FileDescriptor[] {
|
||||
}, assigner);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#region Messages
|
||||
public sealed partial class Header : pb::GeneratedMessage<Header, Header.Builder> {
|
||||
private static readonly Header defaultInstance = new Builder().BuildPartial();
|
||||
public static Header DefaultInstance {
|
||||
get { return defaultInstance; }
|
||||
}
|
||||
|
||||
public override Header DefaultInstanceForType {
|
||||
get { return defaultInstance; }
|
||||
}
|
||||
|
||||
protected override Header ThisMessage {
|
||||
get { return this; }
|
||||
}
|
||||
|
||||
public static pbd::MessageDescriptor Descriptor {
|
||||
get { return global::Sirikata.Protocol._PBJ_Internal.MessageHeader.internal__static_Sirikata_Protocol__PBJ_Internal_Header__Descriptor; }
|
||||
}
|
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<Header, Header.Builder> InternalFieldAccessors {
|
||||
get { return global::Sirikata.Protocol._PBJ_Internal.MessageHeader.internal__static_Sirikata_Protocol__PBJ_Internal_Header__FieldAccessorTable; }
|
||||
}
|
||||
|
||||
#region Nested types
|
||||
public static class Types {
|
||||
public enum ReturnStatus {
|
||||
SUCCESS = 0,
|
||||
NETWORK_FAILURE = 1,
|
||||
TIMEOUT_FAILURE = 3,
|
||||
PROTOCOL_ERROR = 4,
|
||||
PORT_FAILURE = 5,
|
||||
UNKNOWN_OBJECT = 6,
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
public const int SourceObjectFieldNumber = 1;
|
||||
private bool hasSourceObject;
|
||||
private pb::ByteString sourceObject_ = pb::ByteString.Empty;
|
||||
public bool HasSourceObject {
|
||||
get { return hasSourceObject; }
|
||||
}
|
||||
public pb::ByteString SourceObject {
|
||||
get { return sourceObject_; }
|
||||
}
|
||||
|
||||
public const int SourcePortFieldNumber = 3;
|
||||
private bool hasSourcePort;
|
||||
private uint sourcePort_ = 0;
|
||||
public bool HasSourcePort {
|
||||
get { return hasSourcePort; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public uint SourcePort {
|
||||
get { return sourcePort_; }
|
||||
}
|
||||
|
||||
public const int SourceSpaceFieldNumber = 1536;
|
||||
private bool hasSourceSpace;
|
||||
private pb::ByteString sourceSpace_ = pb::ByteString.Empty;
|
||||
public bool HasSourceSpace {
|
||||
get { return hasSourceSpace; }
|
||||
}
|
||||
public pb::ByteString SourceSpace {
|
||||
get { return sourceSpace_; }
|
||||
}
|
||||
|
||||
public const int DestinationObjectFieldNumber = 2;
|
||||
private bool hasDestinationObject;
|
||||
private pb::ByteString destinationObject_ = pb::ByteString.Empty;
|
||||
public bool HasDestinationObject {
|
||||
get { return hasDestinationObject; }
|
||||
}
|
||||
public pb::ByteString DestinationObject {
|
||||
get { return destinationObject_; }
|
||||
}
|
||||
|
||||
public const int DestinationPortFieldNumber = 4;
|
||||
private bool hasDestinationPort;
|
||||
private uint destinationPort_ = 0;
|
||||
public bool HasDestinationPort {
|
||||
get { return hasDestinationPort; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public uint DestinationPort {
|
||||
get { return destinationPort_; }
|
||||
}
|
||||
|
||||
public const int DestinationSpaceFieldNumber = 1537;
|
||||
private bool hasDestinationSpace;
|
||||
private pb::ByteString destinationSpace_ = pb::ByteString.Empty;
|
||||
public bool HasDestinationSpace {
|
||||
get { return hasDestinationSpace; }
|
||||
}
|
||||
public pb::ByteString DestinationSpace {
|
||||
get { return destinationSpace_; }
|
||||
}
|
||||
|
||||
public const int IdFieldNumber = 7;
|
||||
private bool hasId;
|
||||
private long id_ = 0L;
|
||||
public bool HasId {
|
||||
get { return hasId; }
|
||||
}
|
||||
public long Id {
|
||||
get { return id_; }
|
||||
}
|
||||
|
||||
public const int ReplyIdFieldNumber = 8;
|
||||
private bool hasReplyId;
|
||||
private long replyId_ = 0L;
|
||||
public bool HasReplyId {
|
||||
get { return hasReplyId; }
|
||||
}
|
||||
public long ReplyId {
|
||||
get { return replyId_; }
|
||||
}
|
||||
|
||||
public const int ReturnStatusFieldNumber = 1792;
|
||||
private bool hasReturnStatus;
|
||||
private global::Sirikata.Protocol._PBJ_Internal.Header.Types.ReturnStatus returnStatus_ = global::Sirikata.Protocol._PBJ_Internal.Header.Types.ReturnStatus.SUCCESS;
|
||||
public bool HasReturnStatus {
|
||||
get { return hasReturnStatus; }
|
||||
}
|
||||
public global::Sirikata.Protocol._PBJ_Internal.Header.Types.ReturnStatus ReturnStatus {
|
||||
get { return returnStatus_; }
|
||||
}
|
||||
|
||||
public override bool IsInitialized {
|
||||
get {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteTo(pb::CodedOutputStream output) {
|
||||
if (HasSourceObject) {
|
||||
output.WriteBytes(1, SourceObject);
|
||||
}
|
||||
if (HasDestinationObject) {
|
||||
output.WriteBytes(2, DestinationObject);
|
||||
}
|
||||
if (HasSourcePort) {
|
||||
output.WriteUInt32(3, SourcePort);
|
||||
}
|
||||
if (HasDestinationPort) {
|
||||
output.WriteUInt32(4, DestinationPort);
|
||||
}
|
||||
if (HasId) {
|
||||
output.WriteInt64(7, Id);
|
||||
}
|
||||
if (HasReplyId) {
|
||||
output.WriteInt64(8, ReplyId);
|
||||
}
|
||||
if (HasSourceSpace) {
|
||||
output.WriteBytes(1536, SourceSpace);
|
||||
}
|
||||
if (HasDestinationSpace) {
|
||||
output.WriteBytes(1537, DestinationSpace);
|
||||
}
|
||||
if (HasReturnStatus) {
|
||||
output.WriteEnum(1792, (int) ReturnStatus);
|
||||
}
|
||||
UnknownFields.WriteTo(output);
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
public override int SerializedSize {
|
||||
get {
|
||||
int size = memoizedSerializedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (HasSourceObject) {
|
||||
size += pb::CodedOutputStream.ComputeBytesSize(1, SourceObject);
|
||||
}
|
||||
if (HasSourcePort) {
|
||||
size += pb::CodedOutputStream.ComputeUInt32Size(3, SourcePort);
|
||||
}
|
||||
if (HasSourceSpace) {
|
||||
size += pb::CodedOutputStream.ComputeBytesSize(1536, SourceSpace);
|
||||
}
|
||||
if (HasDestinationObject) {
|
||||
size += pb::CodedOutputStream.ComputeBytesSize(2, DestinationObject);
|
||||
}
|
||||
if (HasDestinationPort) {
|
||||
size += pb::CodedOutputStream.ComputeUInt32Size(4, DestinationPort);
|
||||
}
|
||||
if (HasDestinationSpace) {
|
||||
size += pb::CodedOutputStream.ComputeBytesSize(1537, DestinationSpace);
|
||||
}
|
||||
if (HasId) {
|
||||
size += pb::CodedOutputStream.ComputeInt64Size(7, Id);
|
||||
}
|
||||
if (HasReplyId) {
|
||||
size += pb::CodedOutputStream.ComputeInt64Size(8, ReplyId);
|
||||
}
|
||||
if (HasReturnStatus) {
|
||||
size += pb::CodedOutputStream.ComputeEnumSize(1792, (int) ReturnStatus);
|
||||
}
|
||||
size += UnknownFields.SerializedSize;
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
public static Header ParseFrom(pb::ByteString data) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
|
||||
}
|
||||
public static Header ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Header ParseFrom(byte[] data) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
|
||||
}
|
||||
public static Header ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Header ParseFrom(global::System.IO.Stream input) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
|
||||
}
|
||||
public static Header ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Header ParseDelimitedFrom(global::System.IO.Stream input) {
|
||||
return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
|
||||
}
|
||||
public static Header ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
|
||||
}
|
||||
public static Header ParseFrom(pb::CodedInputStream input) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
|
||||
}
|
||||
public static Header ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Builder CreateBuilder() { return new Builder(); }
|
||||
public override Builder ToBuilder() { return CreateBuilder(this); }
|
||||
public override Builder CreateBuilderForType() { return new Builder(); }
|
||||
public static Builder CreateBuilder(Header prototype) {
|
||||
return (Builder) new Builder().MergeFrom(prototype);
|
||||
}
|
||||
|
||||
public sealed partial class Builder : pb::GeneratedBuilder<Header, Builder> {
|
||||
protected override Builder ThisBuilder {
|
||||
get { return this; }
|
||||
}
|
||||
public Builder() {}
|
||||
|
||||
Header result = new Header();
|
||||
|
||||
protected override Header MessageBeingBuilt {
|
||||
get { return result; }
|
||||
}
|
||||
|
||||
public override Builder Clear() {
|
||||
result = new Header();
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Builder Clone() {
|
||||
return new Builder().MergeFrom(result);
|
||||
}
|
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType {
|
||||
get { return global::Sirikata.Protocol._PBJ_Internal.Header.Descriptor; }
|
||||
}
|
||||
|
||||
public override Header DefaultInstanceForType {
|
||||
get { return global::Sirikata.Protocol._PBJ_Internal.Header.DefaultInstance; }
|
||||
}
|
||||
|
||||
public override Header BuildPartial() {
|
||||
if (result == null) {
|
||||
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
|
||||
}
|
||||
Header returnMe = result;
|
||||
result = null;
|
||||
return returnMe;
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::IMessage other) {
|
||||
if (other is Header) {
|
||||
return MergeFrom((Header) other);
|
||||
} else {
|
||||
base.MergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(Header other) {
|
||||
if (other == global::Sirikata.Protocol._PBJ_Internal.Header.DefaultInstance) return this;
|
||||
if (other.HasSourceObject) {
|
||||
SourceObject = other.SourceObject;
|
||||
}
|
||||
if (other.HasSourcePort) {
|
||||
SourcePort = other.SourcePort;
|
||||
}
|
||||
if (other.HasSourceSpace) {
|
||||
SourceSpace = other.SourceSpace;
|
||||
}
|
||||
if (other.HasDestinationObject) {
|
||||
DestinationObject = other.DestinationObject;
|
||||
}
|
||||
if (other.HasDestinationPort) {
|
||||
DestinationPort = other.DestinationPort;
|
||||
}
|
||||
if (other.HasDestinationSpace) {
|
||||
DestinationSpace = other.DestinationSpace;
|
||||
}
|
||||
if (other.HasId) {
|
||||
Id = other.Id;
|
||||
}
|
||||
if (other.HasReplyId) {
|
||||
ReplyId = other.ReplyId;
|
||||
}
|
||||
if (other.HasReturnStatus) {
|
||||
ReturnStatus = other.ReturnStatus;
|
||||
}
|
||||
this.MergeUnknownFields(other.UnknownFields);
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input) {
|
||||
return MergeFrom(input, pb::ExtensionRegistry.Empty);
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
pb::UnknownFieldSet.Builder unknownFields = null;
|
||||
while (true) {
|
||||
uint tag = input.ReadTag();
|
||||
switch (tag) {
|
||||
case 0: {
|
||||
if (unknownFields != null) {
|
||||
this.UnknownFields = unknownFields.Build();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
default: {
|
||||
if (pb::WireFormat.IsEndGroupTag(tag)) {
|
||||
if (unknownFields != null) {
|
||||
this.UnknownFields = unknownFields.Build();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
if (unknownFields == null) {
|
||||
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
|
||||
}
|
||||
ParseUnknownField(input, unknownFields, extensionRegistry, tag);
|
||||
break;
|
||||
}
|
||||
case 10: {
|
||||
SourceObject = input.ReadBytes();
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
DestinationObject = input.ReadBytes();
|
||||
break;
|
||||
}
|
||||
case 24: {
|
||||
SourcePort = input.ReadUInt32();
|
||||
break;
|
||||
}
|
||||
case 32: {
|
||||
DestinationPort = input.ReadUInt32();
|
||||
break;
|
||||
}
|
||||
case 56: {
|
||||
Id = input.ReadInt64();
|
||||
break;
|
||||
}
|
||||
case 64: {
|
||||
ReplyId = input.ReadInt64();
|
||||
break;
|
||||
}
|
||||
case 12290: {
|
||||
SourceSpace = input.ReadBytes();
|
||||
break;
|
||||
}
|
||||
case 12298: {
|
||||
DestinationSpace = input.ReadBytes();
|
||||
break;
|
||||
}
|
||||
case 14336: {
|
||||
int rawValue = input.ReadEnum();
|
||||
if (!global::System.Enum.IsDefined(typeof(global::Sirikata.Protocol._PBJ_Internal.Header.Types.ReturnStatus), rawValue)) {
|
||||
if (unknownFields == null) {
|
||||
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
|
||||
}
|
||||
unknownFields.MergeVarintField(1792, (ulong) rawValue);
|
||||
} else {
|
||||
ReturnStatus = (global::Sirikata.Protocol._PBJ_Internal.Header.Types.ReturnStatus) rawValue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool HasSourceObject {
|
||||
get { return result.HasSourceObject; }
|
||||
}
|
||||
public pb::ByteString SourceObject {
|
||||
get { return result.SourceObject; }
|
||||
set { SetSourceObject(value); }
|
||||
}
|
||||
public Builder SetSourceObject(pb::ByteString value) {
|
||||
pb::ThrowHelper.ThrowIfNull(value, "value");
|
||||
result.hasSourceObject = true;
|
||||
result.sourceObject_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearSourceObject() {
|
||||
result.hasSourceObject = false;
|
||||
result.sourceObject_ = pb::ByteString.Empty;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasSourcePort {
|
||||
get { return result.HasSourcePort; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public uint SourcePort {
|
||||
get { return result.SourcePort; }
|
||||
set { SetSourcePort(value); }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public Builder SetSourcePort(uint value) {
|
||||
result.hasSourcePort = true;
|
||||
result.sourcePort_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearSourcePort() {
|
||||
result.hasSourcePort = false;
|
||||
result.sourcePort_ = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasSourceSpace {
|
||||
get { return result.HasSourceSpace; }
|
||||
}
|
||||
public pb::ByteString SourceSpace {
|
||||
get { return result.SourceSpace; }
|
||||
set { SetSourceSpace(value); }
|
||||
}
|
||||
public Builder SetSourceSpace(pb::ByteString value) {
|
||||
pb::ThrowHelper.ThrowIfNull(value, "value");
|
||||
result.hasSourceSpace = true;
|
||||
result.sourceSpace_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearSourceSpace() {
|
||||
result.hasSourceSpace = false;
|
||||
result.sourceSpace_ = pb::ByteString.Empty;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasDestinationObject {
|
||||
get { return result.HasDestinationObject; }
|
||||
}
|
||||
public pb::ByteString DestinationObject {
|
||||
get { return result.DestinationObject; }
|
||||
set { SetDestinationObject(value); }
|
||||
}
|
||||
public Builder SetDestinationObject(pb::ByteString value) {
|
||||
pb::ThrowHelper.ThrowIfNull(value, "value");
|
||||
result.hasDestinationObject = true;
|
||||
result.destinationObject_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearDestinationObject() {
|
||||
result.hasDestinationObject = false;
|
||||
result.destinationObject_ = pb::ByteString.Empty;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasDestinationPort {
|
||||
get { return result.HasDestinationPort; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public uint DestinationPort {
|
||||
get { return result.DestinationPort; }
|
||||
set { SetDestinationPort(value); }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public Builder SetDestinationPort(uint value) {
|
||||
result.hasDestinationPort = true;
|
||||
result.destinationPort_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearDestinationPort() {
|
||||
result.hasDestinationPort = false;
|
||||
result.destinationPort_ = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasDestinationSpace {
|
||||
get { return result.HasDestinationSpace; }
|
||||
}
|
||||
public pb::ByteString DestinationSpace {
|
||||
get { return result.DestinationSpace; }
|
||||
set { SetDestinationSpace(value); }
|
||||
}
|
||||
public Builder SetDestinationSpace(pb::ByteString value) {
|
||||
pb::ThrowHelper.ThrowIfNull(value, "value");
|
||||
result.hasDestinationSpace = true;
|
||||
result.destinationSpace_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearDestinationSpace() {
|
||||
result.hasDestinationSpace = false;
|
||||
result.destinationSpace_ = pb::ByteString.Empty;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasId {
|
||||
get { return result.HasId; }
|
||||
}
|
||||
public long Id {
|
||||
get { return result.Id; }
|
||||
set { SetId(value); }
|
||||
}
|
||||
public Builder SetId(long value) {
|
||||
result.hasId = true;
|
||||
result.id_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearId() {
|
||||
result.hasId = false;
|
||||
result.id_ = 0L;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasReplyId {
|
||||
get { return result.HasReplyId; }
|
||||
}
|
||||
public long ReplyId {
|
||||
get { return result.ReplyId; }
|
||||
set { SetReplyId(value); }
|
||||
}
|
||||
public Builder SetReplyId(long value) {
|
||||
result.hasReplyId = true;
|
||||
result.replyId_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearReplyId() {
|
||||
result.hasReplyId = false;
|
||||
result.replyId_ = 0L;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasReturnStatus {
|
||||
get { return result.HasReturnStatus; }
|
||||
}
|
||||
public global::Sirikata.Protocol._PBJ_Internal.Header.Types.ReturnStatus ReturnStatus {
|
||||
get { return result.ReturnStatus; }
|
||||
set { SetReturnStatus(value); }
|
||||
}
|
||||
public Builder SetReturnStatus(global::Sirikata.Protocol._PBJ_Internal.Header.Types.ReturnStatus value) {
|
||||
result.hasReturnStatus = true;
|
||||
result.returnStatus_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearReturnStatus() {
|
||||
result.hasReturnStatus = false;
|
||||
result.returnStatus_ = global::Sirikata.Protocol._PBJ_Internal.Header.Types.ReturnStatus.SUCCESS;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
static Header() {
|
||||
object.ReferenceEquals(global::Sirikata.Protocol._PBJ_Internal.MessageHeader.Descriptor, null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
339
OpenSim/Client/Sirikata/Protocol/MessageHeader.pbj.cs
Normal file
339
OpenSim/Client/Sirikata/Protocol/MessageHeader.pbj.cs
Normal file
@@ -0,0 +1,339 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using pbd = global::Google.ProtocolBuffers.Descriptors;
|
||||
using pb = global::Google.ProtocolBuffers;
|
||||
namespace Sirikata.Protocol {
|
||||
public class Header : PBJ.IMessage {
|
||||
protected _PBJ_Internal.Header super;
|
||||
public _PBJ_Internal.Header _PBJSuper{ get { return super;} }
|
||||
public Header() {
|
||||
super=new _PBJ_Internal.Header();
|
||||
}
|
||||
public Header(_PBJ_Internal.Header reference) {
|
||||
super=reference;
|
||||
}
|
||||
public static Header defaultInstance= new Header (_PBJ_Internal.Header.DefaultInstance);
|
||||
public static Header DefaultInstance{
|
||||
get {return defaultInstance;}
|
||||
}
|
||||
public static pbd.MessageDescriptor Descriptor {
|
||||
get { return _PBJ_Internal.Header.Descriptor; } }
|
||||
public static class Types {
|
||||
public enum ReturnStatus {
|
||||
SUCCESS=_PBJ_Internal.Header.Types.ReturnStatus.SUCCESS,
|
||||
NETWORK_FAILURE=_PBJ_Internal.Header.Types.ReturnStatus.NETWORK_FAILURE,
|
||||
TIMEOUT_FAILURE=_PBJ_Internal.Header.Types.ReturnStatus.TIMEOUT_FAILURE,
|
||||
PROTOCOL_ERROR=_PBJ_Internal.Header.Types.ReturnStatus.PROTOCOL_ERROR,
|
||||
PORT_FAILURE=_PBJ_Internal.Header.Types.ReturnStatus.PORT_FAILURE,
|
||||
UNKNOWN_OBJECT=_PBJ_Internal.Header.Types.ReturnStatus.UNKNOWN_OBJECT
|
||||
};
|
||||
}
|
||||
public static bool WithinReservedFieldTagRange(int field_tag) {
|
||||
return false||(field_tag>=1&&field_tag<=8)||(field_tag>=1536&&field_tag<=2560)||(field_tag>=229376&&field_tag<=294912);
|
||||
}
|
||||
public static bool WithinExtensionFieldTagRange(int field_tag) {
|
||||
return false;
|
||||
}
|
||||
public const int SourceObjectFieldTag=1;
|
||||
public bool HasSourceObject{ get {return super.HasSourceObject&&PBJ._PBJ.ValidateUuid(super.SourceObject);} }
|
||||
public PBJ.UUID SourceObject{ get {
|
||||
if (HasSourceObject) {
|
||||
return PBJ._PBJ.CastUuid(super.SourceObject);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int SourcePortFieldTag=3;
|
||||
public bool HasSourcePort{ get {return super.HasSourcePort&&PBJ._PBJ.ValidateUint32(super.SourcePort);} }
|
||||
public uint SourcePort{ get {
|
||||
if (HasSourcePort) {
|
||||
return PBJ._PBJ.CastUint32(super.SourcePort);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUint32();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int SourceSpaceFieldTag=1536;
|
||||
public bool HasSourceSpace{ get {return super.HasSourceSpace&&PBJ._PBJ.ValidateUuid(super.SourceSpace);} }
|
||||
public PBJ.UUID SourceSpace{ get {
|
||||
if (HasSourceSpace) {
|
||||
return PBJ._PBJ.CastUuid(super.SourceSpace);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int DestinationObjectFieldTag=2;
|
||||
public bool HasDestinationObject{ get {return super.HasDestinationObject&&PBJ._PBJ.ValidateUuid(super.DestinationObject);} }
|
||||
public PBJ.UUID DestinationObject{ get {
|
||||
if (HasDestinationObject) {
|
||||
return PBJ._PBJ.CastUuid(super.DestinationObject);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int DestinationPortFieldTag=4;
|
||||
public bool HasDestinationPort{ get {return super.HasDestinationPort&&PBJ._PBJ.ValidateUint32(super.DestinationPort);} }
|
||||
public uint DestinationPort{ get {
|
||||
if (HasDestinationPort) {
|
||||
return PBJ._PBJ.CastUint32(super.DestinationPort);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUint32();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int DestinationSpaceFieldTag=1537;
|
||||
public bool HasDestinationSpace{ get {return super.HasDestinationSpace&&PBJ._PBJ.ValidateUuid(super.DestinationSpace);} }
|
||||
public PBJ.UUID DestinationSpace{ get {
|
||||
if (HasDestinationSpace) {
|
||||
return PBJ._PBJ.CastUuid(super.DestinationSpace);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int IdFieldTag=7;
|
||||
public bool HasId{ get {return super.HasId&&PBJ._PBJ.ValidateInt64(super.Id);} }
|
||||
public long Id{ get {
|
||||
if (HasId) {
|
||||
return PBJ._PBJ.CastInt64(super.Id);
|
||||
} else {
|
||||
return PBJ._PBJ.CastInt64();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int ReplyIdFieldTag=8;
|
||||
public bool HasReplyId{ get {return super.HasReplyId&&PBJ._PBJ.ValidateInt64(super.ReplyId);} }
|
||||
public long ReplyId{ get {
|
||||
if (HasReplyId) {
|
||||
return PBJ._PBJ.CastInt64(super.ReplyId);
|
||||
} else {
|
||||
return PBJ._PBJ.CastInt64();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int ReturnStatusFieldTag=1792;
|
||||
public bool HasReturnStatus{ get {return super.HasReturnStatus;} }
|
||||
public Types.ReturnStatus ReturnStatus{ get {
|
||||
if (HasReturnStatus) {
|
||||
return (Types.ReturnStatus)super.ReturnStatus;
|
||||
} else {
|
||||
return new Types.ReturnStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override Google.ProtocolBuffers.IMessage _PBJISuper { get { return super; } }
|
||||
public override PBJ.IMessage.IBuilder WeakCreateBuilderForType() { return new Builder(); }
|
||||
public static Builder CreateBuilder() { return new Builder(); }
|
||||
public static Builder CreateBuilder(Header prototype) {
|
||||
return (Builder)new Builder().MergeFrom(prototype);
|
||||
}
|
||||
public static Header ParseFrom(pb::ByteString data) {
|
||||
return new Header(_PBJ_Internal.Header.ParseFrom(data));
|
||||
}
|
||||
public static Header ParseFrom(pb::ByteString data, pb::ExtensionRegistry er) {
|
||||
return new Header(_PBJ_Internal.Header.ParseFrom(data,er));
|
||||
}
|
||||
public static Header ParseFrom(byte[] data) {
|
||||
return new Header(_PBJ_Internal.Header.ParseFrom(data));
|
||||
}
|
||||
public static Header ParseFrom(byte[] data, pb::ExtensionRegistry er) {
|
||||
return new Header(_PBJ_Internal.Header.ParseFrom(data,er));
|
||||
}
|
||||
public static Header ParseFrom(global::System.IO.Stream data) {
|
||||
return new Header(_PBJ_Internal.Header.ParseFrom(data));
|
||||
}
|
||||
public static Header ParseFrom(global::System.IO.Stream data, pb::ExtensionRegistry er) {
|
||||
return new Header(_PBJ_Internal.Header.ParseFrom(data,er));
|
||||
}
|
||||
public static Header ParseFrom(pb::CodedInputStream data) {
|
||||
return new Header(_PBJ_Internal.Header.ParseFrom(data));
|
||||
}
|
||||
public static Header ParseFrom(pb::CodedInputStream data, pb::ExtensionRegistry er) {
|
||||
return new Header(_PBJ_Internal.Header.ParseFrom(data,er));
|
||||
}
|
||||
protected override bool _HasAllPBJFields{ get {
|
||||
return true
|
||||
;
|
||||
} }
|
||||
public bool IsInitialized { get {
|
||||
return super.IsInitialized&&_HasAllPBJFields;
|
||||
} }
|
||||
public class Builder : global::PBJ.IMessage.IBuilder{
|
||||
protected override bool _HasAllPBJFields{ get {
|
||||
return true
|
||||
;
|
||||
} }
|
||||
public bool IsInitialized { get {
|
||||
return super.IsInitialized&&_HasAllPBJFields;
|
||||
} }
|
||||
protected _PBJ_Internal.Header.Builder super;
|
||||
public override Google.ProtocolBuffers.IBuilder _PBJISuper { get { return super; } }
|
||||
public _PBJ_Internal.Header.Builder _PBJSuper{ get { return super;} }
|
||||
public Builder() {super = new _PBJ_Internal.Header.Builder();}
|
||||
public Builder(_PBJ_Internal.Header.Builder other) {
|
||||
super=other;
|
||||
}
|
||||
public Builder Clone() {return new Builder(super.Clone());}
|
||||
public Builder MergeFrom(Header prototype) { super.MergeFrom(prototype._PBJSuper);return this;}
|
||||
public Builder Clear() {super.Clear();return this;}
|
||||
public Header BuildPartial() {return new Header(super.BuildPartial());}
|
||||
public Header Build() {if (_HasAllPBJFields) return new Header(super.Build());return null;}
|
||||
public pbd::MessageDescriptor DescriptorForType {
|
||||
get { return Header.Descriptor; } }
|
||||
public Builder ClearSourceObject() { super.ClearSourceObject();return this;}
|
||||
public const int SourceObjectFieldTag=1;
|
||||
public bool HasSourceObject{ get {return super.HasSourceObject&&PBJ._PBJ.ValidateUuid(super.SourceObject);} }
|
||||
public PBJ.UUID SourceObject{ get {
|
||||
if (HasSourceObject) {
|
||||
return PBJ._PBJ.CastUuid(super.SourceObject);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.SourceObject=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearSourcePort() { super.ClearSourcePort();return this;}
|
||||
public const int SourcePortFieldTag=3;
|
||||
public bool HasSourcePort{ get {return super.HasSourcePort&&PBJ._PBJ.ValidateUint32(super.SourcePort);} }
|
||||
public uint SourcePort{ get {
|
||||
if (HasSourcePort) {
|
||||
return PBJ._PBJ.CastUint32(super.SourcePort);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUint32();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.SourcePort=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearSourceSpace() { super.ClearSourceSpace();return this;}
|
||||
public const int SourceSpaceFieldTag=1536;
|
||||
public bool HasSourceSpace{ get {return super.HasSourceSpace&&PBJ._PBJ.ValidateUuid(super.SourceSpace);} }
|
||||
public PBJ.UUID SourceSpace{ get {
|
||||
if (HasSourceSpace) {
|
||||
return PBJ._PBJ.CastUuid(super.SourceSpace);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.SourceSpace=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearDestinationObject() { super.ClearDestinationObject();return this;}
|
||||
public const int DestinationObjectFieldTag=2;
|
||||
public bool HasDestinationObject{ get {return super.HasDestinationObject&&PBJ._PBJ.ValidateUuid(super.DestinationObject);} }
|
||||
public PBJ.UUID DestinationObject{ get {
|
||||
if (HasDestinationObject) {
|
||||
return PBJ._PBJ.CastUuid(super.DestinationObject);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.DestinationObject=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearDestinationPort() { super.ClearDestinationPort();return this;}
|
||||
public const int DestinationPortFieldTag=4;
|
||||
public bool HasDestinationPort{ get {return super.HasDestinationPort&&PBJ._PBJ.ValidateUint32(super.DestinationPort);} }
|
||||
public uint DestinationPort{ get {
|
||||
if (HasDestinationPort) {
|
||||
return PBJ._PBJ.CastUint32(super.DestinationPort);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUint32();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.DestinationPort=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearDestinationSpace() { super.ClearDestinationSpace();return this;}
|
||||
public const int DestinationSpaceFieldTag=1537;
|
||||
public bool HasDestinationSpace{ get {return super.HasDestinationSpace&&PBJ._PBJ.ValidateUuid(super.DestinationSpace);} }
|
||||
public PBJ.UUID DestinationSpace{ get {
|
||||
if (HasDestinationSpace) {
|
||||
return PBJ._PBJ.CastUuid(super.DestinationSpace);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.DestinationSpace=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearId() { super.ClearId();return this;}
|
||||
public const int IdFieldTag=7;
|
||||
public bool HasId{ get {return super.HasId&&PBJ._PBJ.ValidateInt64(super.Id);} }
|
||||
public long Id{ get {
|
||||
if (HasId) {
|
||||
return PBJ._PBJ.CastInt64(super.Id);
|
||||
} else {
|
||||
return PBJ._PBJ.CastInt64();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.Id=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearReplyId() { super.ClearReplyId();return this;}
|
||||
public const int ReplyIdFieldTag=8;
|
||||
public bool HasReplyId{ get {return super.HasReplyId&&PBJ._PBJ.ValidateInt64(super.ReplyId);} }
|
||||
public long ReplyId{ get {
|
||||
if (HasReplyId) {
|
||||
return PBJ._PBJ.CastInt64(super.ReplyId);
|
||||
} else {
|
||||
return PBJ._PBJ.CastInt64();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.ReplyId=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearReturnStatus() { super.ClearReturnStatus();return this;}
|
||||
public const int ReturnStatusFieldTag=1792;
|
||||
public bool HasReturnStatus{ get {return super.HasReturnStatus;} }
|
||||
public Types.ReturnStatus ReturnStatus{ get {
|
||||
if (HasReturnStatus) {
|
||||
return (Types.ReturnStatus)super.ReturnStatus;
|
||||
} else {
|
||||
return new Types.ReturnStatus();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.ReturnStatus=((_PBJ_Internal.Header.Types.ReturnStatus)value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2104
OpenSim/Client/Sirikata/Protocol/PBJ.cs
Normal file
2104
OpenSim/Client/Sirikata/Protocol/PBJ.cs
Normal file
File diff suppressed because it is too large
Load Diff
3299
OpenSim/Client/Sirikata/Protocol/Persistence.cs
Normal file
3299
OpenSim/Client/Sirikata/Protocol/Persistence.cs
Normal file
File diff suppressed because it is too large
Load Diff
1543
OpenSim/Client/Sirikata/Protocol/Persistence.pbj.cs
Normal file
1543
OpenSim/Client/Sirikata/Protocol/Persistence.pbj.cs
Normal file
File diff suppressed because it is too large
Load Diff
840
OpenSim/Client/Sirikata/Protocol/Physics.cs
Normal file
840
OpenSim/Client/Sirikata/Protocol/Physics.cs
Normal file
@@ -0,0 +1,840 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
|
||||
using pb = global::Google.ProtocolBuffers;
|
||||
using pbc = global::Google.ProtocolBuffers.Collections;
|
||||
using pbd = global::Google.ProtocolBuffers.Descriptors;
|
||||
using scg = global::System.Collections.Generic;
|
||||
namespace Sirikata.Physics.Protocol._PBJ_Internal {
|
||||
|
||||
public static partial class Physics {
|
||||
|
||||
#region Extension registration
|
||||
public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {
|
||||
}
|
||||
#endregion
|
||||
#region Static variables
|
||||
internal static pbd::MessageDescriptor internal__static_Sirikata_Physics_Protocol__PBJ_Internal_CollisionBegin__Descriptor;
|
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Sirikata.Physics.Protocol._PBJ_Internal.CollisionBegin, global::Sirikata.Physics.Protocol._PBJ_Internal.CollisionBegin.Builder> internal__static_Sirikata_Physics_Protocol__PBJ_Internal_CollisionBegin__FieldAccessorTable;
|
||||
internal static pbd::MessageDescriptor internal__static_Sirikata_Physics_Protocol__PBJ_Internal_CollisionEnd__Descriptor;
|
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Sirikata.Physics.Protocol._PBJ_Internal.CollisionEnd, global::Sirikata.Physics.Protocol._PBJ_Internal.CollisionEnd.Builder> internal__static_Sirikata_Physics_Protocol__PBJ_Internal_CollisionEnd__FieldAccessorTable;
|
||||
#endregion
|
||||
#region Descriptor
|
||||
public static pbd::FileDescriptor Descriptor {
|
||||
get { return descriptor; }
|
||||
}
|
||||
private static pbd::FileDescriptor descriptor;
|
||||
|
||||
static Physics() {
|
||||
byte[] descriptorData = global::System.Convert.FromBase64String(
|
||||
"Cg1QaHlzaWNzLnByb3RvEidTaXJpa2F0YS5QaHlzaWNzLlByb3RvY29sLl9Q" +
|
||||
"QkpfSW50ZXJuYWwiqAEKDkNvbGxpc2lvbkJlZ2luEhEKCXRpbWVzdGFtcBgC" +
|
||||
"IAEoBhIZCg10aGlzX3Bvc2l0aW9uGAMgAygBQgIQARIaCg5vdGhlcl9wb3Np" +
|
||||
"dGlvbhgEIAMoAUICEAESFwoLdGhpc19ub3JtYWwYBSADKAJCAhABEhMKB2lt" +
|
||||
"cHVsc2UYBiADKAJCAhABEh4KFm90aGVyX29iamVjdF9yZWZlcmVuY2UYByAB" +
|
||||
"KAwiQQoMQ29sbGlzaW9uRW5kEhEKCXRpbWVzdGFtcBgCIAEoBhIeChZvdGhl" +
|
||||
"cl9vYmplY3RfcmVmZXJlbmNlGAYgASgM");
|
||||
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
|
||||
descriptor = root;
|
||||
internal__static_Sirikata_Physics_Protocol__PBJ_Internal_CollisionBegin__Descriptor = Descriptor.MessageTypes[0];
|
||||
internal__static_Sirikata_Physics_Protocol__PBJ_Internal_CollisionBegin__FieldAccessorTable =
|
||||
new pb::FieldAccess.FieldAccessorTable<global::Sirikata.Physics.Protocol._PBJ_Internal.CollisionBegin, global::Sirikata.Physics.Protocol._PBJ_Internal.CollisionBegin.Builder>(internal__static_Sirikata_Physics_Protocol__PBJ_Internal_CollisionBegin__Descriptor,
|
||||
new string[] { "Timestamp", "ThisPosition", "OtherPosition", "ThisNormal", "Impulse", "OtherObjectReference", });
|
||||
internal__static_Sirikata_Physics_Protocol__PBJ_Internal_CollisionEnd__Descriptor = Descriptor.MessageTypes[1];
|
||||
internal__static_Sirikata_Physics_Protocol__PBJ_Internal_CollisionEnd__FieldAccessorTable =
|
||||
new pb::FieldAccess.FieldAccessorTable<global::Sirikata.Physics.Protocol._PBJ_Internal.CollisionEnd, global::Sirikata.Physics.Protocol._PBJ_Internal.CollisionEnd.Builder>(internal__static_Sirikata_Physics_Protocol__PBJ_Internal_CollisionEnd__Descriptor,
|
||||
new string[] { "Timestamp", "OtherObjectReference", });
|
||||
return null;
|
||||
};
|
||||
pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
|
||||
new pbd::FileDescriptor[] {
|
||||
}, assigner);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#region Messages
|
||||
public sealed partial class CollisionBegin : pb::GeneratedMessage<CollisionBegin, CollisionBegin.Builder> {
|
||||
private static readonly CollisionBegin defaultInstance = new Builder().BuildPartial();
|
||||
public static CollisionBegin DefaultInstance {
|
||||
get { return defaultInstance; }
|
||||
}
|
||||
|
||||
public override CollisionBegin DefaultInstanceForType {
|
||||
get { return defaultInstance; }
|
||||
}
|
||||
|
||||
protected override CollisionBegin ThisMessage {
|
||||
get { return this; }
|
||||
}
|
||||
|
||||
public static pbd::MessageDescriptor Descriptor {
|
||||
get { return global::Sirikata.Physics.Protocol._PBJ_Internal.Physics.internal__static_Sirikata_Physics_Protocol__PBJ_Internal_CollisionBegin__Descriptor; }
|
||||
}
|
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<CollisionBegin, CollisionBegin.Builder> InternalFieldAccessors {
|
||||
get { return global::Sirikata.Physics.Protocol._PBJ_Internal.Physics.internal__static_Sirikata_Physics_Protocol__PBJ_Internal_CollisionBegin__FieldAccessorTable; }
|
||||
}
|
||||
|
||||
public const int TimestampFieldNumber = 2;
|
||||
private bool hasTimestamp;
|
||||
private ulong timestamp_ = 0;
|
||||
public bool HasTimestamp {
|
||||
get { return hasTimestamp; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public ulong Timestamp {
|
||||
get { return timestamp_; }
|
||||
}
|
||||
|
||||
public const int ThisPositionFieldNumber = 3;
|
||||
private int thisPositionMemoizedSerializedSize;
|
||||
private pbc::PopsicleList<double> thisPosition_ = new pbc::PopsicleList<double>();
|
||||
public scg::IList<double> ThisPositionList {
|
||||
get { return pbc::Lists.AsReadOnly(thisPosition_); }
|
||||
}
|
||||
public int ThisPositionCount {
|
||||
get { return thisPosition_.Count; }
|
||||
}
|
||||
public double GetThisPosition(int index) {
|
||||
return thisPosition_[index];
|
||||
}
|
||||
|
||||
public const int OtherPositionFieldNumber = 4;
|
||||
private int otherPositionMemoizedSerializedSize;
|
||||
private pbc::PopsicleList<double> otherPosition_ = new pbc::PopsicleList<double>();
|
||||
public scg::IList<double> OtherPositionList {
|
||||
get { return pbc::Lists.AsReadOnly(otherPosition_); }
|
||||
}
|
||||
public int OtherPositionCount {
|
||||
get { return otherPosition_.Count; }
|
||||
}
|
||||
public double GetOtherPosition(int index) {
|
||||
return otherPosition_[index];
|
||||
}
|
||||
|
||||
public const int ThisNormalFieldNumber = 5;
|
||||
private int thisNormalMemoizedSerializedSize;
|
||||
private pbc::PopsicleList<float> thisNormal_ = new pbc::PopsicleList<float>();
|
||||
public scg::IList<float> ThisNormalList {
|
||||
get { return pbc::Lists.AsReadOnly(thisNormal_); }
|
||||
}
|
||||
public int ThisNormalCount {
|
||||
get { return thisNormal_.Count; }
|
||||
}
|
||||
public float GetThisNormal(int index) {
|
||||
return thisNormal_[index];
|
||||
}
|
||||
|
||||
public const int ImpulseFieldNumber = 6;
|
||||
private int impulseMemoizedSerializedSize;
|
||||
private pbc::PopsicleList<float> impulse_ = new pbc::PopsicleList<float>();
|
||||
public scg::IList<float> ImpulseList {
|
||||
get { return pbc::Lists.AsReadOnly(impulse_); }
|
||||
}
|
||||
public int ImpulseCount {
|
||||
get { return impulse_.Count; }
|
||||
}
|
||||
public float GetImpulse(int index) {
|
||||
return impulse_[index];
|
||||
}
|
||||
|
||||
public const int OtherObjectReferenceFieldNumber = 7;
|
||||
private bool hasOtherObjectReference;
|
||||
private pb::ByteString otherObjectReference_ = pb::ByteString.Empty;
|
||||
public bool HasOtherObjectReference {
|
||||
get { return hasOtherObjectReference; }
|
||||
}
|
||||
public pb::ByteString OtherObjectReference {
|
||||
get { return otherObjectReference_; }
|
||||
}
|
||||
|
||||
public override bool IsInitialized {
|
||||
get {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteTo(pb::CodedOutputStream output) {
|
||||
if (HasTimestamp) {
|
||||
output.WriteFixed64(2, Timestamp);
|
||||
}
|
||||
if (thisPosition_.Count > 0) {
|
||||
output.WriteRawVarint32(26);
|
||||
output.WriteRawVarint32((uint) thisPositionMemoizedSerializedSize);
|
||||
foreach (double element in thisPosition_) {
|
||||
output.WriteDoubleNoTag(element);
|
||||
}
|
||||
}
|
||||
if (otherPosition_.Count > 0) {
|
||||
output.WriteRawVarint32(34);
|
||||
output.WriteRawVarint32((uint) otherPositionMemoizedSerializedSize);
|
||||
foreach (double element in otherPosition_) {
|
||||
output.WriteDoubleNoTag(element);
|
||||
}
|
||||
}
|
||||
if (thisNormal_.Count > 0) {
|
||||
output.WriteRawVarint32(42);
|
||||
output.WriteRawVarint32((uint) thisNormalMemoizedSerializedSize);
|
||||
foreach (float element in thisNormal_) {
|
||||
output.WriteFloatNoTag(element);
|
||||
}
|
||||
}
|
||||
if (impulse_.Count > 0) {
|
||||
output.WriteRawVarint32(50);
|
||||
output.WriteRawVarint32((uint) impulseMemoizedSerializedSize);
|
||||
foreach (float element in impulse_) {
|
||||
output.WriteFloatNoTag(element);
|
||||
}
|
||||
}
|
||||
if (HasOtherObjectReference) {
|
||||
output.WriteBytes(7, OtherObjectReference);
|
||||
}
|
||||
UnknownFields.WriteTo(output);
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
public override int SerializedSize {
|
||||
get {
|
||||
int size = memoizedSerializedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (HasTimestamp) {
|
||||
size += pb::CodedOutputStream.ComputeFixed64Size(2, Timestamp);
|
||||
}
|
||||
{
|
||||
int dataSize = 0;
|
||||
dataSize = 8 * thisPosition_.Count;
|
||||
size += dataSize;
|
||||
if (thisPosition_.Count!=0) size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize);
|
||||
thisPositionMemoizedSerializedSize = dataSize;
|
||||
}
|
||||
{
|
||||
int dataSize = 0;
|
||||
dataSize = 8 * otherPosition_.Count;
|
||||
size += dataSize;
|
||||
if (otherPosition_.Count!=0) size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize);
|
||||
otherPositionMemoizedSerializedSize = dataSize;
|
||||
}
|
||||
{
|
||||
int dataSize = 0;
|
||||
dataSize = 4 * thisNormal_.Count;
|
||||
size += dataSize;
|
||||
if (thisNormal_.Count!=0) size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize);
|
||||
thisNormalMemoizedSerializedSize = dataSize;
|
||||
}
|
||||
{
|
||||
int dataSize = 0;
|
||||
dataSize = 4 * impulse_.Count;
|
||||
size += dataSize;
|
||||
if (impulse_.Count!=0) size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize);
|
||||
impulseMemoizedSerializedSize = dataSize;
|
||||
}
|
||||
if (HasOtherObjectReference) {
|
||||
size += pb::CodedOutputStream.ComputeBytesSize(7, OtherObjectReference);
|
||||
}
|
||||
size += UnknownFields.SerializedSize;
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
public static CollisionBegin ParseFrom(pb::ByteString data) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
|
||||
}
|
||||
public static CollisionBegin ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static CollisionBegin ParseFrom(byte[] data) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
|
||||
}
|
||||
public static CollisionBegin ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static CollisionBegin ParseFrom(global::System.IO.Stream input) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
|
||||
}
|
||||
public static CollisionBegin ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static CollisionBegin ParseDelimitedFrom(global::System.IO.Stream input) {
|
||||
return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
|
||||
}
|
||||
public static CollisionBegin ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
|
||||
}
|
||||
public static CollisionBegin ParseFrom(pb::CodedInputStream input) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
|
||||
}
|
||||
public static CollisionBegin ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Builder CreateBuilder() { return new Builder(); }
|
||||
public override Builder ToBuilder() { return CreateBuilder(this); }
|
||||
public override Builder CreateBuilderForType() { return new Builder(); }
|
||||
public static Builder CreateBuilder(CollisionBegin prototype) {
|
||||
return (Builder) new Builder().MergeFrom(prototype);
|
||||
}
|
||||
|
||||
public sealed partial class Builder : pb::GeneratedBuilder<CollisionBegin, Builder> {
|
||||
protected override Builder ThisBuilder {
|
||||
get { return this; }
|
||||
}
|
||||
public Builder() {}
|
||||
|
||||
CollisionBegin result = new CollisionBegin();
|
||||
|
||||
protected override CollisionBegin MessageBeingBuilt {
|
||||
get { return result; }
|
||||
}
|
||||
|
||||
public override Builder Clear() {
|
||||
result = new CollisionBegin();
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Builder Clone() {
|
||||
return new Builder().MergeFrom(result);
|
||||
}
|
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType {
|
||||
get { return global::Sirikata.Physics.Protocol._PBJ_Internal.CollisionBegin.Descriptor; }
|
||||
}
|
||||
|
||||
public override CollisionBegin DefaultInstanceForType {
|
||||
get { return global::Sirikata.Physics.Protocol._PBJ_Internal.CollisionBegin.DefaultInstance; }
|
||||
}
|
||||
|
||||
public override CollisionBegin BuildPartial() {
|
||||
if (result == null) {
|
||||
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
|
||||
}
|
||||
result.thisPosition_.MakeReadOnly();
|
||||
result.otherPosition_.MakeReadOnly();
|
||||
result.thisNormal_.MakeReadOnly();
|
||||
result.impulse_.MakeReadOnly();
|
||||
CollisionBegin returnMe = result;
|
||||
result = null;
|
||||
return returnMe;
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::IMessage other) {
|
||||
if (other is CollisionBegin) {
|
||||
return MergeFrom((CollisionBegin) other);
|
||||
} else {
|
||||
base.MergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(CollisionBegin other) {
|
||||
if (other == global::Sirikata.Physics.Protocol._PBJ_Internal.CollisionBegin.DefaultInstance) return this;
|
||||
if (other.HasTimestamp) {
|
||||
Timestamp = other.Timestamp;
|
||||
}
|
||||
if (other.thisPosition_.Count != 0) {
|
||||
base.AddRange(other.thisPosition_, result.thisPosition_);
|
||||
}
|
||||
if (other.otherPosition_.Count != 0) {
|
||||
base.AddRange(other.otherPosition_, result.otherPosition_);
|
||||
}
|
||||
if (other.thisNormal_.Count != 0) {
|
||||
base.AddRange(other.thisNormal_, result.thisNormal_);
|
||||
}
|
||||
if (other.impulse_.Count != 0) {
|
||||
base.AddRange(other.impulse_, result.impulse_);
|
||||
}
|
||||
if (other.HasOtherObjectReference) {
|
||||
OtherObjectReference = other.OtherObjectReference;
|
||||
}
|
||||
this.MergeUnknownFields(other.UnknownFields);
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input) {
|
||||
return MergeFrom(input, pb::ExtensionRegistry.Empty);
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
pb::UnknownFieldSet.Builder unknownFields = null;
|
||||
while (true) {
|
||||
uint tag = input.ReadTag();
|
||||
switch (tag) {
|
||||
case 0: {
|
||||
if (unknownFields != null) {
|
||||
this.UnknownFields = unknownFields.Build();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
default: {
|
||||
if (pb::WireFormat.IsEndGroupTag(tag)) {
|
||||
if (unknownFields != null) {
|
||||
this.UnknownFields = unknownFields.Build();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
if (unknownFields == null) {
|
||||
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
|
||||
}
|
||||
ParseUnknownField(input, unknownFields, extensionRegistry, tag);
|
||||
break;
|
||||
}
|
||||
case 17: {
|
||||
Timestamp = input.ReadFixed64();
|
||||
break;
|
||||
}
|
||||
case 26: {
|
||||
int length = input.ReadInt32();
|
||||
int limit = input.PushLimit(length);
|
||||
while (!input.ReachedLimit) {
|
||||
AddThisPosition(input.ReadDouble());
|
||||
}
|
||||
input.PopLimit(limit);
|
||||
break;
|
||||
}
|
||||
case 34: {
|
||||
int length = input.ReadInt32();
|
||||
int limit = input.PushLimit(length);
|
||||
while (!input.ReachedLimit) {
|
||||
AddOtherPosition(input.ReadDouble());
|
||||
}
|
||||
input.PopLimit(limit);
|
||||
break;
|
||||
}
|
||||
case 42: {
|
||||
int length = input.ReadInt32();
|
||||
int limit = input.PushLimit(length);
|
||||
while (!input.ReachedLimit) {
|
||||
AddThisNormal(input.ReadFloat());
|
||||
}
|
||||
input.PopLimit(limit);
|
||||
break;
|
||||
}
|
||||
case 50: {
|
||||
int length = input.ReadInt32();
|
||||
int limit = input.PushLimit(length);
|
||||
while (!input.ReachedLimit) {
|
||||
AddImpulse(input.ReadFloat());
|
||||
}
|
||||
input.PopLimit(limit);
|
||||
break;
|
||||
}
|
||||
case 58: {
|
||||
OtherObjectReference = input.ReadBytes();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool HasTimestamp {
|
||||
get { return result.HasTimestamp; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public ulong Timestamp {
|
||||
get { return result.Timestamp; }
|
||||
set { SetTimestamp(value); }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public Builder SetTimestamp(ulong value) {
|
||||
result.hasTimestamp = true;
|
||||
result.timestamp_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearTimestamp() {
|
||||
result.hasTimestamp = false;
|
||||
result.timestamp_ = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
public pbc::IPopsicleList<double> ThisPositionList {
|
||||
get { return result.thisPosition_; }
|
||||
}
|
||||
public int ThisPositionCount {
|
||||
get { return result.ThisPositionCount; }
|
||||
}
|
||||
public double GetThisPosition(int index) {
|
||||
return result.GetThisPosition(index);
|
||||
}
|
||||
public Builder SetThisPosition(int index, double value) {
|
||||
result.thisPosition_[index] = value;
|
||||
return this;
|
||||
}
|
||||
public Builder AddThisPosition(double value) {
|
||||
result.thisPosition_.Add(value);
|
||||
return this;
|
||||
}
|
||||
public Builder AddRangeThisPosition(scg::IEnumerable<double> values) {
|
||||
base.AddRange(values, result.thisPosition_);
|
||||
return this;
|
||||
}
|
||||
public Builder ClearThisPosition() {
|
||||
result.thisPosition_.Clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
public pbc::IPopsicleList<double> OtherPositionList {
|
||||
get { return result.otherPosition_; }
|
||||
}
|
||||
public int OtherPositionCount {
|
||||
get { return result.OtherPositionCount; }
|
||||
}
|
||||
public double GetOtherPosition(int index) {
|
||||
return result.GetOtherPosition(index);
|
||||
}
|
||||
public Builder SetOtherPosition(int index, double value) {
|
||||
result.otherPosition_[index] = value;
|
||||
return this;
|
||||
}
|
||||
public Builder AddOtherPosition(double value) {
|
||||
result.otherPosition_.Add(value);
|
||||
return this;
|
||||
}
|
||||
public Builder AddRangeOtherPosition(scg::IEnumerable<double> values) {
|
||||
base.AddRange(values, result.otherPosition_);
|
||||
return this;
|
||||
}
|
||||
public Builder ClearOtherPosition() {
|
||||
result.otherPosition_.Clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
public pbc::IPopsicleList<float> ThisNormalList {
|
||||
get { return result.thisNormal_; }
|
||||
}
|
||||
public int ThisNormalCount {
|
||||
get { return result.ThisNormalCount; }
|
||||
}
|
||||
public float GetThisNormal(int index) {
|
||||
return result.GetThisNormal(index);
|
||||
}
|
||||
public Builder SetThisNormal(int index, float value) {
|
||||
result.thisNormal_[index] = value;
|
||||
return this;
|
||||
}
|
||||
public Builder AddThisNormal(float value) {
|
||||
result.thisNormal_.Add(value);
|
||||
return this;
|
||||
}
|
||||
public Builder AddRangeThisNormal(scg::IEnumerable<float> values) {
|
||||
base.AddRange(values, result.thisNormal_);
|
||||
return this;
|
||||
}
|
||||
public Builder ClearThisNormal() {
|
||||
result.thisNormal_.Clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
public pbc::IPopsicleList<float> ImpulseList {
|
||||
get { return result.impulse_; }
|
||||
}
|
||||
public int ImpulseCount {
|
||||
get { return result.ImpulseCount; }
|
||||
}
|
||||
public float GetImpulse(int index) {
|
||||
return result.GetImpulse(index);
|
||||
}
|
||||
public Builder SetImpulse(int index, float value) {
|
||||
result.impulse_[index] = value;
|
||||
return this;
|
||||
}
|
||||
public Builder AddImpulse(float value) {
|
||||
result.impulse_.Add(value);
|
||||
return this;
|
||||
}
|
||||
public Builder AddRangeImpulse(scg::IEnumerable<float> values) {
|
||||
base.AddRange(values, result.impulse_);
|
||||
return this;
|
||||
}
|
||||
public Builder ClearImpulse() {
|
||||
result.impulse_.Clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasOtherObjectReference {
|
||||
get { return result.HasOtherObjectReference; }
|
||||
}
|
||||
public pb::ByteString OtherObjectReference {
|
||||
get { return result.OtherObjectReference; }
|
||||
set { SetOtherObjectReference(value); }
|
||||
}
|
||||
public Builder SetOtherObjectReference(pb::ByteString value) {
|
||||
pb::ThrowHelper.ThrowIfNull(value, "value");
|
||||
result.hasOtherObjectReference = true;
|
||||
result.otherObjectReference_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearOtherObjectReference() {
|
||||
result.hasOtherObjectReference = false;
|
||||
result.otherObjectReference_ = pb::ByteString.Empty;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
static CollisionBegin() {
|
||||
object.ReferenceEquals(global::Sirikata.Physics.Protocol._PBJ_Internal.Physics.Descriptor, null);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed partial class CollisionEnd : pb::GeneratedMessage<CollisionEnd, CollisionEnd.Builder> {
|
||||
private static readonly CollisionEnd defaultInstance = new Builder().BuildPartial();
|
||||
public static CollisionEnd DefaultInstance {
|
||||
get { return defaultInstance; }
|
||||
}
|
||||
|
||||
public override CollisionEnd DefaultInstanceForType {
|
||||
get { return defaultInstance; }
|
||||
}
|
||||
|
||||
protected override CollisionEnd ThisMessage {
|
||||
get { return this; }
|
||||
}
|
||||
|
||||
public static pbd::MessageDescriptor Descriptor {
|
||||
get { return global::Sirikata.Physics.Protocol._PBJ_Internal.Physics.internal__static_Sirikata_Physics_Protocol__PBJ_Internal_CollisionEnd__Descriptor; }
|
||||
}
|
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<CollisionEnd, CollisionEnd.Builder> InternalFieldAccessors {
|
||||
get { return global::Sirikata.Physics.Protocol._PBJ_Internal.Physics.internal__static_Sirikata_Physics_Protocol__PBJ_Internal_CollisionEnd__FieldAccessorTable; }
|
||||
}
|
||||
|
||||
public const int TimestampFieldNumber = 2;
|
||||
private bool hasTimestamp;
|
||||
private ulong timestamp_ = 0;
|
||||
public bool HasTimestamp {
|
||||
get { return hasTimestamp; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public ulong Timestamp {
|
||||
get { return timestamp_; }
|
||||
}
|
||||
|
||||
public const int OtherObjectReferenceFieldNumber = 6;
|
||||
private bool hasOtherObjectReference;
|
||||
private pb::ByteString otherObjectReference_ = pb::ByteString.Empty;
|
||||
public bool HasOtherObjectReference {
|
||||
get { return hasOtherObjectReference; }
|
||||
}
|
||||
public pb::ByteString OtherObjectReference {
|
||||
get { return otherObjectReference_; }
|
||||
}
|
||||
|
||||
public override bool IsInitialized {
|
||||
get {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteTo(pb::CodedOutputStream output) {
|
||||
if (HasTimestamp) {
|
||||
output.WriteFixed64(2, Timestamp);
|
||||
}
|
||||
if (HasOtherObjectReference) {
|
||||
output.WriteBytes(6, OtherObjectReference);
|
||||
}
|
||||
UnknownFields.WriteTo(output);
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
public override int SerializedSize {
|
||||
get {
|
||||
int size = memoizedSerializedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (HasTimestamp) {
|
||||
size += pb::CodedOutputStream.ComputeFixed64Size(2, Timestamp);
|
||||
}
|
||||
if (HasOtherObjectReference) {
|
||||
size += pb::CodedOutputStream.ComputeBytesSize(6, OtherObjectReference);
|
||||
}
|
||||
size += UnknownFields.SerializedSize;
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
public static CollisionEnd ParseFrom(pb::ByteString data) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
|
||||
}
|
||||
public static CollisionEnd ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static CollisionEnd ParseFrom(byte[] data) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
|
||||
}
|
||||
public static CollisionEnd ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static CollisionEnd ParseFrom(global::System.IO.Stream input) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
|
||||
}
|
||||
public static CollisionEnd ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static CollisionEnd ParseDelimitedFrom(global::System.IO.Stream input) {
|
||||
return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
|
||||
}
|
||||
public static CollisionEnd ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
|
||||
}
|
||||
public static CollisionEnd ParseFrom(pb::CodedInputStream input) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
|
||||
}
|
||||
public static CollisionEnd ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Builder CreateBuilder() { return new Builder(); }
|
||||
public override Builder ToBuilder() { return CreateBuilder(this); }
|
||||
public override Builder CreateBuilderForType() { return new Builder(); }
|
||||
public static Builder CreateBuilder(CollisionEnd prototype) {
|
||||
return (Builder) new Builder().MergeFrom(prototype);
|
||||
}
|
||||
|
||||
public sealed partial class Builder : pb::GeneratedBuilder<CollisionEnd, Builder> {
|
||||
protected override Builder ThisBuilder {
|
||||
get { return this; }
|
||||
}
|
||||
public Builder() {}
|
||||
|
||||
CollisionEnd result = new CollisionEnd();
|
||||
|
||||
protected override CollisionEnd MessageBeingBuilt {
|
||||
get { return result; }
|
||||
}
|
||||
|
||||
public override Builder Clear() {
|
||||
result = new CollisionEnd();
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Builder Clone() {
|
||||
return new Builder().MergeFrom(result);
|
||||
}
|
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType {
|
||||
get { return global::Sirikata.Physics.Protocol._PBJ_Internal.CollisionEnd.Descriptor; }
|
||||
}
|
||||
|
||||
public override CollisionEnd DefaultInstanceForType {
|
||||
get { return global::Sirikata.Physics.Protocol._PBJ_Internal.CollisionEnd.DefaultInstance; }
|
||||
}
|
||||
|
||||
public override CollisionEnd BuildPartial() {
|
||||
if (result == null) {
|
||||
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
|
||||
}
|
||||
CollisionEnd returnMe = result;
|
||||
result = null;
|
||||
return returnMe;
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::IMessage other) {
|
||||
if (other is CollisionEnd) {
|
||||
return MergeFrom((CollisionEnd) other);
|
||||
} else {
|
||||
base.MergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(CollisionEnd other) {
|
||||
if (other == global::Sirikata.Physics.Protocol._PBJ_Internal.CollisionEnd.DefaultInstance) return this;
|
||||
if (other.HasTimestamp) {
|
||||
Timestamp = other.Timestamp;
|
||||
}
|
||||
if (other.HasOtherObjectReference) {
|
||||
OtherObjectReference = other.OtherObjectReference;
|
||||
}
|
||||
this.MergeUnknownFields(other.UnknownFields);
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input) {
|
||||
return MergeFrom(input, pb::ExtensionRegistry.Empty);
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
pb::UnknownFieldSet.Builder unknownFields = null;
|
||||
while (true) {
|
||||
uint tag = input.ReadTag();
|
||||
switch (tag) {
|
||||
case 0: {
|
||||
if (unknownFields != null) {
|
||||
this.UnknownFields = unknownFields.Build();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
default: {
|
||||
if (pb::WireFormat.IsEndGroupTag(tag)) {
|
||||
if (unknownFields != null) {
|
||||
this.UnknownFields = unknownFields.Build();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
if (unknownFields == null) {
|
||||
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
|
||||
}
|
||||
ParseUnknownField(input, unknownFields, extensionRegistry, tag);
|
||||
break;
|
||||
}
|
||||
case 17: {
|
||||
Timestamp = input.ReadFixed64();
|
||||
break;
|
||||
}
|
||||
case 50: {
|
||||
OtherObjectReference = input.ReadBytes();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool HasTimestamp {
|
||||
get { return result.HasTimestamp; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public ulong Timestamp {
|
||||
get { return result.Timestamp; }
|
||||
set { SetTimestamp(value); }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public Builder SetTimestamp(ulong value) {
|
||||
result.hasTimestamp = true;
|
||||
result.timestamp_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearTimestamp() {
|
||||
result.hasTimestamp = false;
|
||||
result.timestamp_ = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasOtherObjectReference {
|
||||
get { return result.HasOtherObjectReference; }
|
||||
}
|
||||
public pb::ByteString OtherObjectReference {
|
||||
get { return result.OtherObjectReference; }
|
||||
set { SetOtherObjectReference(value); }
|
||||
}
|
||||
public Builder SetOtherObjectReference(pb::ByteString value) {
|
||||
pb::ThrowHelper.ThrowIfNull(value, "value");
|
||||
result.hasOtherObjectReference = true;
|
||||
result.otherObjectReference_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearOtherObjectReference() {
|
||||
result.hasOtherObjectReference = false;
|
||||
result.otherObjectReference_ = pb::ByteString.Empty;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
static CollisionEnd() {
|
||||
object.ReferenceEquals(global::Sirikata.Physics.Protocol._PBJ_Internal.Physics.Descriptor, null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
421
OpenSim/Client/Sirikata/Protocol/Physics.pbj.cs
Normal file
421
OpenSim/Client/Sirikata/Protocol/Physics.pbj.cs
Normal file
@@ -0,0 +1,421 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using pbd = global::Google.ProtocolBuffers.Descriptors;
|
||||
using pb = global::Google.ProtocolBuffers;
|
||||
namespace Sirikata.Physics.Protocol {
|
||||
public class CollisionBegin : PBJ.IMessage {
|
||||
protected _PBJ_Internal.CollisionBegin super;
|
||||
public _PBJ_Internal.CollisionBegin _PBJSuper{ get { return super;} }
|
||||
public CollisionBegin() {
|
||||
super=new _PBJ_Internal.CollisionBegin();
|
||||
}
|
||||
public CollisionBegin(_PBJ_Internal.CollisionBegin reference) {
|
||||
super=reference;
|
||||
}
|
||||
public static CollisionBegin defaultInstance= new CollisionBegin (_PBJ_Internal.CollisionBegin.DefaultInstance);
|
||||
public static CollisionBegin DefaultInstance{
|
||||
get {return defaultInstance;}
|
||||
}
|
||||
public static pbd.MessageDescriptor Descriptor {
|
||||
get { return _PBJ_Internal.CollisionBegin.Descriptor; } }
|
||||
public static class Types {
|
||||
}
|
||||
public static bool WithinReservedFieldTagRange(int field_tag) {
|
||||
return false;
|
||||
}
|
||||
public static bool WithinExtensionFieldTagRange(int field_tag) {
|
||||
return false;
|
||||
}
|
||||
public const int TimestampFieldTag=2;
|
||||
public bool HasTimestamp{ get {return super.HasTimestamp&&PBJ._PBJ.ValidateTime(super.Timestamp);} }
|
||||
public PBJ.Time Timestamp{ get {
|
||||
if (HasTimestamp) {
|
||||
return PBJ._PBJ.CastTime(super.Timestamp);
|
||||
} else {
|
||||
return PBJ._PBJ.CastTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int ThisPositionFieldTag=3;
|
||||
public int ThisPositionCount { get { return super.ThisPositionCount/3;} }
|
||||
public bool HasThisPosition(int index) { return true; }
|
||||
public PBJ.Vector3d GetThisPosition(int index) {
|
||||
if (HasThisPosition(index)) {
|
||||
return PBJ._PBJ.CastVector3d(super.GetThisPosition(index*3+0),super.GetThisPosition(index*3+1),super.GetThisPosition(index*3+2));
|
||||
} else {
|
||||
return PBJ._PBJ.CastVector3d();
|
||||
}
|
||||
}
|
||||
public const int OtherPositionFieldTag=4;
|
||||
public int OtherPositionCount { get { return super.OtherPositionCount/3;} }
|
||||
public bool HasOtherPosition(int index) { return true; }
|
||||
public PBJ.Vector3d GetOtherPosition(int index) {
|
||||
if (HasOtherPosition(index)) {
|
||||
return PBJ._PBJ.CastVector3d(super.GetOtherPosition(index*3+0),super.GetOtherPosition(index*3+1),super.GetOtherPosition(index*3+2));
|
||||
} else {
|
||||
return PBJ._PBJ.CastVector3d();
|
||||
}
|
||||
}
|
||||
public const int ThisNormalFieldTag=5;
|
||||
public int ThisNormalCount { get { return super.ThisNormalCount/2;} }
|
||||
public bool HasThisNormal(int index) { return true; }
|
||||
public PBJ.Vector3f GetThisNormal(int index) {
|
||||
if (HasThisNormal(index)) {
|
||||
return PBJ._PBJ.CastNormal(super.GetThisNormal(index*2+0),super.GetThisNormal(index*2+1));
|
||||
} else {
|
||||
return PBJ._PBJ.CastNormal();
|
||||
}
|
||||
}
|
||||
public const int ImpulseFieldTag=6;
|
||||
public int ImpulseCount { get { return super.ImpulseCount;} }
|
||||
public bool HasImpulse(int index) {return PBJ._PBJ.ValidateFloat(super.GetImpulse(index));}
|
||||
public float Impulse(int index) {
|
||||
return (float)PBJ._PBJ.CastFloat(super.GetImpulse(index));
|
||||
}
|
||||
public const int OtherObjectReferenceFieldTag=7;
|
||||
public bool HasOtherObjectReference{ get {return super.HasOtherObjectReference&&PBJ._PBJ.ValidateUuid(super.OtherObjectReference);} }
|
||||
public PBJ.UUID OtherObjectReference{ get {
|
||||
if (HasOtherObjectReference) {
|
||||
return PBJ._PBJ.CastUuid(super.OtherObjectReference);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override Google.ProtocolBuffers.IMessage _PBJISuper { get { return super; } }
|
||||
public override PBJ.IMessage.IBuilder WeakCreateBuilderForType() { return new Builder(); }
|
||||
public static Builder CreateBuilder() { return new Builder(); }
|
||||
public static Builder CreateBuilder(CollisionBegin prototype) {
|
||||
return (Builder)new Builder().MergeFrom(prototype);
|
||||
}
|
||||
public static CollisionBegin ParseFrom(pb::ByteString data) {
|
||||
return new CollisionBegin(_PBJ_Internal.CollisionBegin.ParseFrom(data));
|
||||
}
|
||||
public static CollisionBegin ParseFrom(pb::ByteString data, pb::ExtensionRegistry er) {
|
||||
return new CollisionBegin(_PBJ_Internal.CollisionBegin.ParseFrom(data,er));
|
||||
}
|
||||
public static CollisionBegin ParseFrom(byte[] data) {
|
||||
return new CollisionBegin(_PBJ_Internal.CollisionBegin.ParseFrom(data));
|
||||
}
|
||||
public static CollisionBegin ParseFrom(byte[] data, pb::ExtensionRegistry er) {
|
||||
return new CollisionBegin(_PBJ_Internal.CollisionBegin.ParseFrom(data,er));
|
||||
}
|
||||
public static CollisionBegin ParseFrom(global::System.IO.Stream data) {
|
||||
return new CollisionBegin(_PBJ_Internal.CollisionBegin.ParseFrom(data));
|
||||
}
|
||||
public static CollisionBegin ParseFrom(global::System.IO.Stream data, pb::ExtensionRegistry er) {
|
||||
return new CollisionBegin(_PBJ_Internal.CollisionBegin.ParseFrom(data,er));
|
||||
}
|
||||
public static CollisionBegin ParseFrom(pb::CodedInputStream data) {
|
||||
return new CollisionBegin(_PBJ_Internal.CollisionBegin.ParseFrom(data));
|
||||
}
|
||||
public static CollisionBegin ParseFrom(pb::CodedInputStream data, pb::ExtensionRegistry er) {
|
||||
return new CollisionBegin(_PBJ_Internal.CollisionBegin.ParseFrom(data,er));
|
||||
}
|
||||
protected override bool _HasAllPBJFields{ get {
|
||||
return true
|
||||
;
|
||||
} }
|
||||
public bool IsInitialized { get {
|
||||
return super.IsInitialized&&_HasAllPBJFields;
|
||||
} }
|
||||
public class Builder : global::PBJ.IMessage.IBuilder{
|
||||
protected override bool _HasAllPBJFields{ get {
|
||||
return true
|
||||
;
|
||||
} }
|
||||
public bool IsInitialized { get {
|
||||
return super.IsInitialized&&_HasAllPBJFields;
|
||||
} }
|
||||
protected _PBJ_Internal.CollisionBegin.Builder super;
|
||||
public override Google.ProtocolBuffers.IBuilder _PBJISuper { get { return super; } }
|
||||
public _PBJ_Internal.CollisionBegin.Builder _PBJSuper{ get { return super;} }
|
||||
public Builder() {super = new _PBJ_Internal.CollisionBegin.Builder();}
|
||||
public Builder(_PBJ_Internal.CollisionBegin.Builder other) {
|
||||
super=other;
|
||||
}
|
||||
public Builder Clone() {return new Builder(super.Clone());}
|
||||
public Builder MergeFrom(CollisionBegin prototype) { super.MergeFrom(prototype._PBJSuper);return this;}
|
||||
public Builder Clear() {super.Clear();return this;}
|
||||
public CollisionBegin BuildPartial() {return new CollisionBegin(super.BuildPartial());}
|
||||
public CollisionBegin Build() {if (_HasAllPBJFields) return new CollisionBegin(super.Build());return null;}
|
||||
public pbd::MessageDescriptor DescriptorForType {
|
||||
get { return CollisionBegin.Descriptor; } }
|
||||
public Builder ClearTimestamp() { super.ClearTimestamp();return this;}
|
||||
public const int TimestampFieldTag=2;
|
||||
public bool HasTimestamp{ get {return super.HasTimestamp&&PBJ._PBJ.ValidateTime(super.Timestamp);} }
|
||||
public PBJ.Time Timestamp{ get {
|
||||
if (HasTimestamp) {
|
||||
return PBJ._PBJ.CastTime(super.Timestamp);
|
||||
} else {
|
||||
return PBJ._PBJ.CastTime();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.Timestamp=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearThisPosition() { super.ClearThisPosition();return this;}
|
||||
public const int ThisPositionFieldTag=3;
|
||||
public int ThisPositionCount { get { return super.ThisPositionCount/3;} }
|
||||
public bool HasThisPosition(int index) { return true; }
|
||||
public PBJ.Vector3d GetThisPosition(int index) {
|
||||
if (HasThisPosition(index)) {
|
||||
return PBJ._PBJ.CastVector3d(super.GetThisPosition(index*3+0),super.GetThisPosition(index*3+1),super.GetThisPosition(index*3+2));
|
||||
} else {
|
||||
return PBJ._PBJ.CastVector3d();
|
||||
}
|
||||
}
|
||||
public Builder AddThisPosition(PBJ.Vector3d value) {
|
||||
double[] _PBJtempArray=PBJ._PBJ.ConstructVector3d(value);
|
||||
super.AddThisPosition(_PBJtempArray[0]);
|
||||
super.AddThisPosition(_PBJtempArray[1]);
|
||||
super.AddThisPosition(_PBJtempArray[2]);
|
||||
return this;
|
||||
}
|
||||
public Builder SetThisPosition(int index,PBJ.Vector3d value) {
|
||||
double[] _PBJtempArray=PBJ._PBJ.ConstructVector3d(value);
|
||||
super.SetThisPosition(index*3+0,_PBJtempArray[0]);
|
||||
super.SetThisPosition(index*3+1,_PBJtempArray[1]);
|
||||
super.SetThisPosition(index*3+2,_PBJtempArray[2]);
|
||||
return this;
|
||||
}
|
||||
public Builder ClearOtherPosition() { super.ClearOtherPosition();return this;}
|
||||
public const int OtherPositionFieldTag=4;
|
||||
public int OtherPositionCount { get { return super.OtherPositionCount/3;} }
|
||||
public bool HasOtherPosition(int index) { return true; }
|
||||
public PBJ.Vector3d GetOtherPosition(int index) {
|
||||
if (HasOtherPosition(index)) {
|
||||
return PBJ._PBJ.CastVector3d(super.GetOtherPosition(index*3+0),super.GetOtherPosition(index*3+1),super.GetOtherPosition(index*3+2));
|
||||
} else {
|
||||
return PBJ._PBJ.CastVector3d();
|
||||
}
|
||||
}
|
||||
public Builder AddOtherPosition(PBJ.Vector3d value) {
|
||||
double[] _PBJtempArray=PBJ._PBJ.ConstructVector3d(value);
|
||||
super.AddOtherPosition(_PBJtempArray[0]);
|
||||
super.AddOtherPosition(_PBJtempArray[1]);
|
||||
super.AddOtherPosition(_PBJtempArray[2]);
|
||||
return this;
|
||||
}
|
||||
public Builder SetOtherPosition(int index,PBJ.Vector3d value) {
|
||||
double[] _PBJtempArray=PBJ._PBJ.ConstructVector3d(value);
|
||||
super.SetOtherPosition(index*3+0,_PBJtempArray[0]);
|
||||
super.SetOtherPosition(index*3+1,_PBJtempArray[1]);
|
||||
super.SetOtherPosition(index*3+2,_PBJtempArray[2]);
|
||||
return this;
|
||||
}
|
||||
public Builder ClearThisNormal() { super.ClearThisNormal();return this;}
|
||||
public const int ThisNormalFieldTag=5;
|
||||
public int ThisNormalCount { get { return super.ThisNormalCount/2;} }
|
||||
public bool HasThisNormal(int index) { return true; }
|
||||
public PBJ.Vector3f GetThisNormal(int index) {
|
||||
if (HasThisNormal(index)) {
|
||||
return PBJ._PBJ.CastNormal(super.GetThisNormal(index*2+0),super.GetThisNormal(index*2+1));
|
||||
} else {
|
||||
return PBJ._PBJ.CastNormal();
|
||||
}
|
||||
}
|
||||
public Builder AddThisNormal(PBJ.Vector3f value) {
|
||||
float[] _PBJtempArray=PBJ._PBJ.ConstructNormal(value);
|
||||
super.AddThisNormal(_PBJtempArray[0]);
|
||||
super.AddThisNormal(_PBJtempArray[1]);
|
||||
return this;
|
||||
}
|
||||
public Builder SetThisNormal(int index,PBJ.Vector3f value) {
|
||||
float[] _PBJtempArray=PBJ._PBJ.ConstructNormal(value);
|
||||
super.SetThisNormal(index*2+0,_PBJtempArray[0]);
|
||||
super.SetThisNormal(index*2+1,_PBJtempArray[1]);
|
||||
return this;
|
||||
}
|
||||
public Builder ClearImpulse() { super.ClearImpulse();return this;}
|
||||
public Builder SetImpulse(int index, float value) {
|
||||
super.SetImpulse(index,PBJ._PBJ.Construct(value));
|
||||
return this;
|
||||
}
|
||||
public const int ImpulseFieldTag=6;
|
||||
public int ImpulseCount { get { return super.ImpulseCount;} }
|
||||
public bool HasImpulse(int index) {return PBJ._PBJ.ValidateFloat(super.GetImpulse(index));}
|
||||
public float Impulse(int index) {
|
||||
return (float)PBJ._PBJ.CastFloat(super.GetImpulse(index));
|
||||
}
|
||||
public Builder AddImpulse(float value) {
|
||||
super.AddImpulse(PBJ._PBJ.Construct(value));
|
||||
return this;
|
||||
}
|
||||
public Builder ClearOtherObjectReference() { super.ClearOtherObjectReference();return this;}
|
||||
public const int OtherObjectReferenceFieldTag=7;
|
||||
public bool HasOtherObjectReference{ get {return super.HasOtherObjectReference&&PBJ._PBJ.ValidateUuid(super.OtherObjectReference);} }
|
||||
public PBJ.UUID OtherObjectReference{ get {
|
||||
if (HasOtherObjectReference) {
|
||||
return PBJ._PBJ.CastUuid(super.OtherObjectReference);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.OtherObjectReference=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Sirikata.Physics.Protocol {
|
||||
public class CollisionEnd : PBJ.IMessage {
|
||||
protected _PBJ_Internal.CollisionEnd super;
|
||||
public _PBJ_Internal.CollisionEnd _PBJSuper{ get { return super;} }
|
||||
public CollisionEnd() {
|
||||
super=new _PBJ_Internal.CollisionEnd();
|
||||
}
|
||||
public CollisionEnd(_PBJ_Internal.CollisionEnd reference) {
|
||||
super=reference;
|
||||
}
|
||||
public static CollisionEnd defaultInstance= new CollisionEnd (_PBJ_Internal.CollisionEnd.DefaultInstance);
|
||||
public static CollisionEnd DefaultInstance{
|
||||
get {return defaultInstance;}
|
||||
}
|
||||
public static pbd.MessageDescriptor Descriptor {
|
||||
get { return _PBJ_Internal.CollisionEnd.Descriptor; } }
|
||||
public static class Types {
|
||||
}
|
||||
public static bool WithinReservedFieldTagRange(int field_tag) {
|
||||
return false;
|
||||
}
|
||||
public static bool WithinExtensionFieldTagRange(int field_tag) {
|
||||
return false;
|
||||
}
|
||||
public const int TimestampFieldTag=2;
|
||||
public bool HasTimestamp{ get {return super.HasTimestamp&&PBJ._PBJ.ValidateTime(super.Timestamp);} }
|
||||
public PBJ.Time Timestamp{ get {
|
||||
if (HasTimestamp) {
|
||||
return PBJ._PBJ.CastTime(super.Timestamp);
|
||||
} else {
|
||||
return PBJ._PBJ.CastTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int OtherObjectReferenceFieldTag=6;
|
||||
public bool HasOtherObjectReference{ get {return super.HasOtherObjectReference&&PBJ._PBJ.ValidateUuid(super.OtherObjectReference);} }
|
||||
public PBJ.UUID OtherObjectReference{ get {
|
||||
if (HasOtherObjectReference) {
|
||||
return PBJ._PBJ.CastUuid(super.OtherObjectReference);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override Google.ProtocolBuffers.IMessage _PBJISuper { get { return super; } }
|
||||
public override PBJ.IMessage.IBuilder WeakCreateBuilderForType() { return new Builder(); }
|
||||
public static Builder CreateBuilder() { return new Builder(); }
|
||||
public static Builder CreateBuilder(CollisionEnd prototype) {
|
||||
return (Builder)new Builder().MergeFrom(prototype);
|
||||
}
|
||||
public static CollisionEnd ParseFrom(pb::ByteString data) {
|
||||
return new CollisionEnd(_PBJ_Internal.CollisionEnd.ParseFrom(data));
|
||||
}
|
||||
public static CollisionEnd ParseFrom(pb::ByteString data, pb::ExtensionRegistry er) {
|
||||
return new CollisionEnd(_PBJ_Internal.CollisionEnd.ParseFrom(data,er));
|
||||
}
|
||||
public static CollisionEnd ParseFrom(byte[] data) {
|
||||
return new CollisionEnd(_PBJ_Internal.CollisionEnd.ParseFrom(data));
|
||||
}
|
||||
public static CollisionEnd ParseFrom(byte[] data, pb::ExtensionRegistry er) {
|
||||
return new CollisionEnd(_PBJ_Internal.CollisionEnd.ParseFrom(data,er));
|
||||
}
|
||||
public static CollisionEnd ParseFrom(global::System.IO.Stream data) {
|
||||
return new CollisionEnd(_PBJ_Internal.CollisionEnd.ParseFrom(data));
|
||||
}
|
||||
public static CollisionEnd ParseFrom(global::System.IO.Stream data, pb::ExtensionRegistry er) {
|
||||
return new CollisionEnd(_PBJ_Internal.CollisionEnd.ParseFrom(data,er));
|
||||
}
|
||||
public static CollisionEnd ParseFrom(pb::CodedInputStream data) {
|
||||
return new CollisionEnd(_PBJ_Internal.CollisionEnd.ParseFrom(data));
|
||||
}
|
||||
public static CollisionEnd ParseFrom(pb::CodedInputStream data, pb::ExtensionRegistry er) {
|
||||
return new CollisionEnd(_PBJ_Internal.CollisionEnd.ParseFrom(data,er));
|
||||
}
|
||||
protected override bool _HasAllPBJFields{ get {
|
||||
return true
|
||||
;
|
||||
} }
|
||||
public bool IsInitialized { get {
|
||||
return super.IsInitialized&&_HasAllPBJFields;
|
||||
} }
|
||||
public class Builder : global::PBJ.IMessage.IBuilder{
|
||||
protected override bool _HasAllPBJFields{ get {
|
||||
return true
|
||||
;
|
||||
} }
|
||||
public bool IsInitialized { get {
|
||||
return super.IsInitialized&&_HasAllPBJFields;
|
||||
} }
|
||||
protected _PBJ_Internal.CollisionEnd.Builder super;
|
||||
public override Google.ProtocolBuffers.IBuilder _PBJISuper { get { return super; } }
|
||||
public _PBJ_Internal.CollisionEnd.Builder _PBJSuper{ get { return super;} }
|
||||
public Builder() {super = new _PBJ_Internal.CollisionEnd.Builder();}
|
||||
public Builder(_PBJ_Internal.CollisionEnd.Builder other) {
|
||||
super=other;
|
||||
}
|
||||
public Builder Clone() {return new Builder(super.Clone());}
|
||||
public Builder MergeFrom(CollisionEnd prototype) { super.MergeFrom(prototype._PBJSuper);return this;}
|
||||
public Builder Clear() {super.Clear();return this;}
|
||||
public CollisionEnd BuildPartial() {return new CollisionEnd(super.BuildPartial());}
|
||||
public CollisionEnd Build() {if (_HasAllPBJFields) return new CollisionEnd(super.Build());return null;}
|
||||
public pbd::MessageDescriptor DescriptorForType {
|
||||
get { return CollisionEnd.Descriptor; } }
|
||||
public Builder ClearTimestamp() { super.ClearTimestamp();return this;}
|
||||
public const int TimestampFieldTag=2;
|
||||
public bool HasTimestamp{ get {return super.HasTimestamp&&PBJ._PBJ.ValidateTime(super.Timestamp);} }
|
||||
public PBJ.Time Timestamp{ get {
|
||||
if (HasTimestamp) {
|
||||
return PBJ._PBJ.CastTime(super.Timestamp);
|
||||
} else {
|
||||
return PBJ._PBJ.CastTime();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.Timestamp=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearOtherObjectReference() { super.ClearOtherObjectReference();return this;}
|
||||
public const int OtherObjectReferenceFieldTag=6;
|
||||
public bool HasOtherObjectReference{ get {return super.HasOtherObjectReference&&PBJ._PBJ.ValidateUuid(super.OtherObjectReference);} }
|
||||
public PBJ.UUID OtherObjectReference{ get {
|
||||
if (HasOtherObjectReference) {
|
||||
return PBJ._PBJ.CastUuid(super.OtherObjectReference);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.OtherObjectReference=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
8074
OpenSim/Client/Sirikata/Protocol/Sirikata.cs
Normal file
8074
OpenSim/Client/Sirikata/Protocol/Sirikata.cs
Normal file
File diff suppressed because it is too large
Load Diff
3934
OpenSim/Client/Sirikata/Protocol/Sirikata.pbj.cs
Normal file
3934
OpenSim/Client/Sirikata/Protocol/Sirikata.pbj.cs
Normal file
File diff suppressed because it is too large
Load Diff
856
OpenSim/Client/Sirikata/Protocol/Subscription.cs
Normal file
856
OpenSim/Client/Sirikata/Protocol/Subscription.cs
Normal file
@@ -0,0 +1,856 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
|
||||
using pb = global::Google.ProtocolBuffers;
|
||||
using pbc = global::Google.ProtocolBuffers.Collections;
|
||||
using pbd = global::Google.ProtocolBuffers.Descriptors;
|
||||
using scg = global::System.Collections.Generic;
|
||||
namespace Sirikata.Subscription.Protocol._PBJ_Internal {
|
||||
|
||||
public static partial class Subscription {
|
||||
|
||||
#region Extension registration
|
||||
public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {
|
||||
}
|
||||
#endregion
|
||||
#region Static variables
|
||||
internal static pbd::MessageDescriptor internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Address__Descriptor;
|
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Sirikata.Subscription.Protocol._PBJ_Internal.Address, global::Sirikata.Subscription.Protocol._PBJ_Internal.Address.Builder> internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Address__FieldAccessorTable;
|
||||
internal static pbd::MessageDescriptor internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Subscribe__Descriptor;
|
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscribe, global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscribe.Builder> internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Subscribe__FieldAccessorTable;
|
||||
internal static pbd::MessageDescriptor internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Broadcast__Descriptor;
|
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Sirikata.Subscription.Protocol._PBJ_Internal.Broadcast, global::Sirikata.Subscription.Protocol._PBJ_Internal.Broadcast.Builder> internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Broadcast__FieldAccessorTable;
|
||||
#endregion
|
||||
#region Descriptor
|
||||
public static pbd::FileDescriptor Descriptor {
|
||||
get { return descriptor; }
|
||||
}
|
||||
private static pbd::FileDescriptor descriptor;
|
||||
|
||||
static Subscription() {
|
||||
byte[] descriptorData = global::System.Convert.FromBase64String(
|
||||
"ChJTdWJzY3JpcHRpb24ucHJvdG8SLFNpcmlrYXRhLlN1YnNjcmlwdGlvbi5Q" +
|
||||
"cm90b2NvbC5fUEJKX0ludGVybmFsIiwKB0FkZHJlc3MSEAoIaG9zdG5hbWUY" +
|
||||
"ASABKAkSDwoHc2VydmljZRgCIAEoCSKMAQoJU3Vic2NyaWJlElAKEWJyb2Fk" +
|
||||
"Y2FzdF9hZGRyZXNzGAcgASgLMjUuU2lyaWthdGEuU3Vic2NyaXB0aW9uLlBy" +
|
||||
"b3RvY29sLl9QQkpfSW50ZXJuYWwuQWRkcmVzcxIWCg5icm9hZGNhc3RfbmFt" +
|
||||
"ZRgIIAEoDBIVCg11cGRhdGVfcGVyaW9kGAkgASgQIiMKCUJyb2FkY2FzdBIW" +
|
||||
"Cg5icm9hZGNhc3RfbmFtZRgHIAEoDA==");
|
||||
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
|
||||
descriptor = root;
|
||||
internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Address__Descriptor = Descriptor.MessageTypes[0];
|
||||
internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Address__FieldAccessorTable =
|
||||
new pb::FieldAccess.FieldAccessorTable<global::Sirikata.Subscription.Protocol._PBJ_Internal.Address, global::Sirikata.Subscription.Protocol._PBJ_Internal.Address.Builder>(internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Address__Descriptor,
|
||||
new string[] { "Hostname", "Service", });
|
||||
internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Subscribe__Descriptor = Descriptor.MessageTypes[1];
|
||||
internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Subscribe__FieldAccessorTable =
|
||||
new pb::FieldAccess.FieldAccessorTable<global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscribe, global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscribe.Builder>(internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Subscribe__Descriptor,
|
||||
new string[] { "BroadcastAddress", "BroadcastName", "UpdatePeriod", });
|
||||
internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Broadcast__Descriptor = Descriptor.MessageTypes[2];
|
||||
internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Broadcast__FieldAccessorTable =
|
||||
new pb::FieldAccess.FieldAccessorTable<global::Sirikata.Subscription.Protocol._PBJ_Internal.Broadcast, global::Sirikata.Subscription.Protocol._PBJ_Internal.Broadcast.Builder>(internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Broadcast__Descriptor,
|
||||
new string[] { "BroadcastName", });
|
||||
return null;
|
||||
};
|
||||
pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
|
||||
new pbd::FileDescriptor[] {
|
||||
}, assigner);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#region Messages
|
||||
public sealed partial class Address : pb::GeneratedMessage<Address, Address.Builder> {
|
||||
private static readonly Address defaultInstance = new Builder().BuildPartial();
|
||||
public static Address DefaultInstance {
|
||||
get { return defaultInstance; }
|
||||
}
|
||||
|
||||
public override Address DefaultInstanceForType {
|
||||
get { return defaultInstance; }
|
||||
}
|
||||
|
||||
protected override Address ThisMessage {
|
||||
get { return this; }
|
||||
}
|
||||
|
||||
public static pbd::MessageDescriptor Descriptor {
|
||||
get { return global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscription.internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Address__Descriptor; }
|
||||
}
|
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<Address, Address.Builder> InternalFieldAccessors {
|
||||
get { return global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscription.internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Address__FieldAccessorTable; }
|
||||
}
|
||||
|
||||
public const int HostnameFieldNumber = 1;
|
||||
private bool hasHostname;
|
||||
private string hostname_ = "";
|
||||
public bool HasHostname {
|
||||
get { return hasHostname; }
|
||||
}
|
||||
public string Hostname {
|
||||
get { return hostname_; }
|
||||
}
|
||||
|
||||
public const int ServiceFieldNumber = 2;
|
||||
private bool hasService;
|
||||
private string service_ = "";
|
||||
public bool HasService {
|
||||
get { return hasService; }
|
||||
}
|
||||
public string Service {
|
||||
get { return service_; }
|
||||
}
|
||||
|
||||
public override bool IsInitialized {
|
||||
get {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteTo(pb::CodedOutputStream output) {
|
||||
if (HasHostname) {
|
||||
output.WriteString(1, Hostname);
|
||||
}
|
||||
if (HasService) {
|
||||
output.WriteString(2, Service);
|
||||
}
|
||||
UnknownFields.WriteTo(output);
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
public override int SerializedSize {
|
||||
get {
|
||||
int size = memoizedSerializedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (HasHostname) {
|
||||
size += pb::CodedOutputStream.ComputeStringSize(1, Hostname);
|
||||
}
|
||||
if (HasService) {
|
||||
size += pb::CodedOutputStream.ComputeStringSize(2, Service);
|
||||
}
|
||||
size += UnknownFields.SerializedSize;
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
public static Address ParseFrom(pb::ByteString data) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
|
||||
}
|
||||
public static Address ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Address ParseFrom(byte[] data) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
|
||||
}
|
||||
public static Address ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Address ParseFrom(global::System.IO.Stream input) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
|
||||
}
|
||||
public static Address ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Address ParseDelimitedFrom(global::System.IO.Stream input) {
|
||||
return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
|
||||
}
|
||||
public static Address ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
|
||||
}
|
||||
public static Address ParseFrom(pb::CodedInputStream input) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
|
||||
}
|
||||
public static Address ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Builder CreateBuilder() { return new Builder(); }
|
||||
public override Builder ToBuilder() { return CreateBuilder(this); }
|
||||
public override Builder CreateBuilderForType() { return new Builder(); }
|
||||
public static Builder CreateBuilder(Address prototype) {
|
||||
return (Builder) new Builder().MergeFrom(prototype);
|
||||
}
|
||||
|
||||
public sealed partial class Builder : pb::GeneratedBuilder<Address, Builder> {
|
||||
protected override Builder ThisBuilder {
|
||||
get { return this; }
|
||||
}
|
||||
public Builder() {}
|
||||
|
||||
Address result = new Address();
|
||||
|
||||
protected override Address MessageBeingBuilt {
|
||||
get { return result; }
|
||||
}
|
||||
|
||||
public override Builder Clear() {
|
||||
result = new Address();
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Builder Clone() {
|
||||
return new Builder().MergeFrom(result);
|
||||
}
|
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType {
|
||||
get { return global::Sirikata.Subscription.Protocol._PBJ_Internal.Address.Descriptor; }
|
||||
}
|
||||
|
||||
public override Address DefaultInstanceForType {
|
||||
get { return global::Sirikata.Subscription.Protocol._PBJ_Internal.Address.DefaultInstance; }
|
||||
}
|
||||
|
||||
public override Address BuildPartial() {
|
||||
if (result == null) {
|
||||
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
|
||||
}
|
||||
Address returnMe = result;
|
||||
result = null;
|
||||
return returnMe;
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::IMessage other) {
|
||||
if (other is Address) {
|
||||
return MergeFrom((Address) other);
|
||||
} else {
|
||||
base.MergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(Address other) {
|
||||
if (other == global::Sirikata.Subscription.Protocol._PBJ_Internal.Address.DefaultInstance) return this;
|
||||
if (other.HasHostname) {
|
||||
Hostname = other.Hostname;
|
||||
}
|
||||
if (other.HasService) {
|
||||
Service = other.Service;
|
||||
}
|
||||
this.MergeUnknownFields(other.UnknownFields);
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input) {
|
||||
return MergeFrom(input, pb::ExtensionRegistry.Empty);
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
pb::UnknownFieldSet.Builder unknownFields = null;
|
||||
while (true) {
|
||||
uint tag = input.ReadTag();
|
||||
switch (tag) {
|
||||
case 0: {
|
||||
if (unknownFields != null) {
|
||||
this.UnknownFields = unknownFields.Build();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
default: {
|
||||
if (pb::WireFormat.IsEndGroupTag(tag)) {
|
||||
if (unknownFields != null) {
|
||||
this.UnknownFields = unknownFields.Build();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
if (unknownFields == null) {
|
||||
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
|
||||
}
|
||||
ParseUnknownField(input, unknownFields, extensionRegistry, tag);
|
||||
break;
|
||||
}
|
||||
case 10: {
|
||||
Hostname = input.ReadString();
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
Service = input.ReadString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool HasHostname {
|
||||
get { return result.HasHostname; }
|
||||
}
|
||||
public string Hostname {
|
||||
get { return result.Hostname; }
|
||||
set { SetHostname(value); }
|
||||
}
|
||||
public Builder SetHostname(string value) {
|
||||
pb::ThrowHelper.ThrowIfNull(value, "value");
|
||||
result.hasHostname = true;
|
||||
result.hostname_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearHostname() {
|
||||
result.hasHostname = false;
|
||||
result.hostname_ = "";
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasService {
|
||||
get { return result.HasService; }
|
||||
}
|
||||
public string Service {
|
||||
get { return result.Service; }
|
||||
set { SetService(value); }
|
||||
}
|
||||
public Builder SetService(string value) {
|
||||
pb::ThrowHelper.ThrowIfNull(value, "value");
|
||||
result.hasService = true;
|
||||
result.service_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearService() {
|
||||
result.hasService = false;
|
||||
result.service_ = "";
|
||||
return this;
|
||||
}
|
||||
}
|
||||
static Address() {
|
||||
object.ReferenceEquals(global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscription.Descriptor, null);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed partial class Subscribe : pb::GeneratedMessage<Subscribe, Subscribe.Builder> {
|
||||
private static readonly Subscribe defaultInstance = new Builder().BuildPartial();
|
||||
public static Subscribe DefaultInstance {
|
||||
get { return defaultInstance; }
|
||||
}
|
||||
|
||||
public override Subscribe DefaultInstanceForType {
|
||||
get { return defaultInstance; }
|
||||
}
|
||||
|
||||
protected override Subscribe ThisMessage {
|
||||
get { return this; }
|
||||
}
|
||||
|
||||
public static pbd::MessageDescriptor Descriptor {
|
||||
get { return global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscription.internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Subscribe__Descriptor; }
|
||||
}
|
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<Subscribe, Subscribe.Builder> InternalFieldAccessors {
|
||||
get { return global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscription.internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Subscribe__FieldAccessorTable; }
|
||||
}
|
||||
|
||||
public const int BroadcastAddressFieldNumber = 7;
|
||||
private bool hasBroadcastAddress;
|
||||
private global::Sirikata.Subscription.Protocol._PBJ_Internal.Address broadcastAddress_ = global::Sirikata.Subscription.Protocol._PBJ_Internal.Address.DefaultInstance;
|
||||
public bool HasBroadcastAddress {
|
||||
get { return hasBroadcastAddress; }
|
||||
}
|
||||
public global::Sirikata.Subscription.Protocol._PBJ_Internal.Address BroadcastAddress {
|
||||
get { return broadcastAddress_; }
|
||||
}
|
||||
|
||||
public const int BroadcastNameFieldNumber = 8;
|
||||
private bool hasBroadcastName;
|
||||
private pb::ByteString broadcastName_ = pb::ByteString.Empty;
|
||||
public bool HasBroadcastName {
|
||||
get { return hasBroadcastName; }
|
||||
}
|
||||
public pb::ByteString BroadcastName {
|
||||
get { return broadcastName_; }
|
||||
}
|
||||
|
||||
public const int UpdatePeriodFieldNumber = 9;
|
||||
private bool hasUpdatePeriod;
|
||||
private long updatePeriod_ = 0;
|
||||
public bool HasUpdatePeriod {
|
||||
get { return hasUpdatePeriod; }
|
||||
}
|
||||
public long UpdatePeriod {
|
||||
get { return updatePeriod_; }
|
||||
}
|
||||
|
||||
public override bool IsInitialized {
|
||||
get {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteTo(pb::CodedOutputStream output) {
|
||||
if (HasBroadcastAddress) {
|
||||
output.WriteMessage(7, BroadcastAddress);
|
||||
}
|
||||
if (HasBroadcastName) {
|
||||
output.WriteBytes(8, BroadcastName);
|
||||
}
|
||||
if (HasUpdatePeriod) {
|
||||
output.WriteSFixed64(9, UpdatePeriod);
|
||||
}
|
||||
UnknownFields.WriteTo(output);
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
public override int SerializedSize {
|
||||
get {
|
||||
int size = memoizedSerializedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (HasBroadcastAddress) {
|
||||
size += pb::CodedOutputStream.ComputeMessageSize(7, BroadcastAddress);
|
||||
}
|
||||
if (HasBroadcastName) {
|
||||
size += pb::CodedOutputStream.ComputeBytesSize(8, BroadcastName);
|
||||
}
|
||||
if (HasUpdatePeriod) {
|
||||
size += pb::CodedOutputStream.ComputeSFixed64Size(9, UpdatePeriod);
|
||||
}
|
||||
size += UnknownFields.SerializedSize;
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
public static Subscribe ParseFrom(pb::ByteString data) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
|
||||
}
|
||||
public static Subscribe ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Subscribe ParseFrom(byte[] data) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
|
||||
}
|
||||
public static Subscribe ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Subscribe ParseFrom(global::System.IO.Stream input) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
|
||||
}
|
||||
public static Subscribe ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Subscribe ParseDelimitedFrom(global::System.IO.Stream input) {
|
||||
return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
|
||||
}
|
||||
public static Subscribe ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
|
||||
}
|
||||
public static Subscribe ParseFrom(pb::CodedInputStream input) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
|
||||
}
|
||||
public static Subscribe ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Builder CreateBuilder() { return new Builder(); }
|
||||
public override Builder ToBuilder() { return CreateBuilder(this); }
|
||||
public override Builder CreateBuilderForType() { return new Builder(); }
|
||||
public static Builder CreateBuilder(Subscribe prototype) {
|
||||
return (Builder) new Builder().MergeFrom(prototype);
|
||||
}
|
||||
|
||||
public sealed partial class Builder : pb::GeneratedBuilder<Subscribe, Builder> {
|
||||
protected override Builder ThisBuilder {
|
||||
get { return this; }
|
||||
}
|
||||
public Builder() {}
|
||||
|
||||
Subscribe result = new Subscribe();
|
||||
|
||||
protected override Subscribe MessageBeingBuilt {
|
||||
get { return result; }
|
||||
}
|
||||
|
||||
public override Builder Clear() {
|
||||
result = new Subscribe();
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Builder Clone() {
|
||||
return new Builder().MergeFrom(result);
|
||||
}
|
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType {
|
||||
get { return global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscribe.Descriptor; }
|
||||
}
|
||||
|
||||
public override Subscribe DefaultInstanceForType {
|
||||
get { return global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscribe.DefaultInstance; }
|
||||
}
|
||||
|
||||
public override Subscribe BuildPartial() {
|
||||
if (result == null) {
|
||||
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
|
||||
}
|
||||
Subscribe returnMe = result;
|
||||
result = null;
|
||||
return returnMe;
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::IMessage other) {
|
||||
if (other is Subscribe) {
|
||||
return MergeFrom((Subscribe) other);
|
||||
} else {
|
||||
base.MergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(Subscribe other) {
|
||||
if (other == global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscribe.DefaultInstance) return this;
|
||||
if (other.HasBroadcastAddress) {
|
||||
MergeBroadcastAddress(other.BroadcastAddress);
|
||||
}
|
||||
if (other.HasBroadcastName) {
|
||||
BroadcastName = other.BroadcastName;
|
||||
}
|
||||
if (other.HasUpdatePeriod) {
|
||||
UpdatePeriod = other.UpdatePeriod;
|
||||
}
|
||||
this.MergeUnknownFields(other.UnknownFields);
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input) {
|
||||
return MergeFrom(input, pb::ExtensionRegistry.Empty);
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
pb::UnknownFieldSet.Builder unknownFields = null;
|
||||
while (true) {
|
||||
uint tag = input.ReadTag();
|
||||
switch (tag) {
|
||||
case 0: {
|
||||
if (unknownFields != null) {
|
||||
this.UnknownFields = unknownFields.Build();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
default: {
|
||||
if (pb::WireFormat.IsEndGroupTag(tag)) {
|
||||
if (unknownFields != null) {
|
||||
this.UnknownFields = unknownFields.Build();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
if (unknownFields == null) {
|
||||
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
|
||||
}
|
||||
ParseUnknownField(input, unknownFields, extensionRegistry, tag);
|
||||
break;
|
||||
}
|
||||
case 58: {
|
||||
global::Sirikata.Subscription.Protocol._PBJ_Internal.Address.Builder subBuilder = global::Sirikata.Subscription.Protocol._PBJ_Internal.Address.CreateBuilder();
|
||||
if (HasBroadcastAddress) {
|
||||
subBuilder.MergeFrom(BroadcastAddress);
|
||||
}
|
||||
input.ReadMessage(subBuilder, extensionRegistry);
|
||||
BroadcastAddress = subBuilder.BuildPartial();
|
||||
break;
|
||||
}
|
||||
case 66: {
|
||||
BroadcastName = input.ReadBytes();
|
||||
break;
|
||||
}
|
||||
case 73: {
|
||||
UpdatePeriod = input.ReadSFixed64();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool HasBroadcastAddress {
|
||||
get { return result.HasBroadcastAddress; }
|
||||
}
|
||||
public global::Sirikata.Subscription.Protocol._PBJ_Internal.Address BroadcastAddress {
|
||||
get { return result.BroadcastAddress; }
|
||||
set { SetBroadcastAddress(value); }
|
||||
}
|
||||
public Builder SetBroadcastAddress(global::Sirikata.Subscription.Protocol._PBJ_Internal.Address value) {
|
||||
pb::ThrowHelper.ThrowIfNull(value, "value");
|
||||
result.hasBroadcastAddress = true;
|
||||
result.broadcastAddress_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder SetBroadcastAddress(global::Sirikata.Subscription.Protocol._PBJ_Internal.Address.Builder builderForValue) {
|
||||
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
|
||||
result.hasBroadcastAddress = true;
|
||||
result.broadcastAddress_ = builderForValue.Build();
|
||||
return this;
|
||||
}
|
||||
public Builder MergeBroadcastAddress(global::Sirikata.Subscription.Protocol._PBJ_Internal.Address value) {
|
||||
pb::ThrowHelper.ThrowIfNull(value, "value");
|
||||
if (result.HasBroadcastAddress &&
|
||||
result.broadcastAddress_ != global::Sirikata.Subscription.Protocol._PBJ_Internal.Address.DefaultInstance) {
|
||||
result.broadcastAddress_ = global::Sirikata.Subscription.Protocol._PBJ_Internal.Address.CreateBuilder(result.broadcastAddress_).MergeFrom(value).BuildPartial();
|
||||
} else {
|
||||
result.broadcastAddress_ = value;
|
||||
}
|
||||
result.hasBroadcastAddress = true;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearBroadcastAddress() {
|
||||
result.hasBroadcastAddress = false;
|
||||
result.broadcastAddress_ = global::Sirikata.Subscription.Protocol._PBJ_Internal.Address.DefaultInstance;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasBroadcastName {
|
||||
get { return result.HasBroadcastName; }
|
||||
}
|
||||
public pb::ByteString BroadcastName {
|
||||
get { return result.BroadcastName; }
|
||||
set { SetBroadcastName(value); }
|
||||
}
|
||||
public Builder SetBroadcastName(pb::ByteString value) {
|
||||
pb::ThrowHelper.ThrowIfNull(value, "value");
|
||||
result.hasBroadcastName = true;
|
||||
result.broadcastName_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearBroadcastName() {
|
||||
result.hasBroadcastName = false;
|
||||
result.broadcastName_ = pb::ByteString.Empty;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasUpdatePeriod {
|
||||
get { return result.HasUpdatePeriod; }
|
||||
}
|
||||
public long UpdatePeriod {
|
||||
get { return result.UpdatePeriod; }
|
||||
set { SetUpdatePeriod(value); }
|
||||
}
|
||||
public Builder SetUpdatePeriod(long value) {
|
||||
result.hasUpdatePeriod = true;
|
||||
result.updatePeriod_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearUpdatePeriod() {
|
||||
result.hasUpdatePeriod = false;
|
||||
result.updatePeriod_ = 0;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
static Subscribe() {
|
||||
object.ReferenceEquals(global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscription.Descriptor, null);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed partial class Broadcast : pb::GeneratedMessage<Broadcast, Broadcast.Builder> {
|
||||
private static readonly Broadcast defaultInstance = new Builder().BuildPartial();
|
||||
public static Broadcast DefaultInstance {
|
||||
get { return defaultInstance; }
|
||||
}
|
||||
|
||||
public override Broadcast DefaultInstanceForType {
|
||||
get { return defaultInstance; }
|
||||
}
|
||||
|
||||
protected override Broadcast ThisMessage {
|
||||
get { return this; }
|
||||
}
|
||||
|
||||
public static pbd::MessageDescriptor Descriptor {
|
||||
get { return global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscription.internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Broadcast__Descriptor; }
|
||||
}
|
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<Broadcast, Broadcast.Builder> InternalFieldAccessors {
|
||||
get { return global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscription.internal__static_Sirikata_Subscription_Protocol__PBJ_Internal_Broadcast__FieldAccessorTable; }
|
||||
}
|
||||
|
||||
public const int BroadcastNameFieldNumber = 7;
|
||||
private bool hasBroadcastName;
|
||||
private pb::ByteString broadcastName_ = pb::ByteString.Empty;
|
||||
public bool HasBroadcastName {
|
||||
get { return hasBroadcastName; }
|
||||
}
|
||||
public pb::ByteString BroadcastName {
|
||||
get { return broadcastName_; }
|
||||
}
|
||||
|
||||
public override bool IsInitialized {
|
||||
get {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteTo(pb::CodedOutputStream output) {
|
||||
if (HasBroadcastName) {
|
||||
output.WriteBytes(7, BroadcastName);
|
||||
}
|
||||
UnknownFields.WriteTo(output);
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
public override int SerializedSize {
|
||||
get {
|
||||
int size = memoizedSerializedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (HasBroadcastName) {
|
||||
size += pb::CodedOutputStream.ComputeBytesSize(7, BroadcastName);
|
||||
}
|
||||
size += UnknownFields.SerializedSize;
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
public static Broadcast ParseFrom(pb::ByteString data) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
|
||||
}
|
||||
public static Broadcast ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Broadcast ParseFrom(byte[] data) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
|
||||
}
|
||||
public static Broadcast ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Broadcast ParseFrom(global::System.IO.Stream input) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
|
||||
}
|
||||
public static Broadcast ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Broadcast ParseDelimitedFrom(global::System.IO.Stream input) {
|
||||
return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
|
||||
}
|
||||
public static Broadcast ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
|
||||
}
|
||||
public static Broadcast ParseFrom(pb::CodedInputStream input) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
|
||||
}
|
||||
public static Broadcast ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Builder CreateBuilder() { return new Builder(); }
|
||||
public override Builder ToBuilder() { return CreateBuilder(this); }
|
||||
public override Builder CreateBuilderForType() { return new Builder(); }
|
||||
public static Builder CreateBuilder(Broadcast prototype) {
|
||||
return (Builder) new Builder().MergeFrom(prototype);
|
||||
}
|
||||
|
||||
public sealed partial class Builder : pb::GeneratedBuilder<Broadcast, Builder> {
|
||||
protected override Builder ThisBuilder {
|
||||
get { return this; }
|
||||
}
|
||||
public Builder() {}
|
||||
|
||||
Broadcast result = new Broadcast();
|
||||
|
||||
protected override Broadcast MessageBeingBuilt {
|
||||
get { return result; }
|
||||
}
|
||||
|
||||
public override Builder Clear() {
|
||||
result = new Broadcast();
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Builder Clone() {
|
||||
return new Builder().MergeFrom(result);
|
||||
}
|
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType {
|
||||
get { return global::Sirikata.Subscription.Protocol._PBJ_Internal.Broadcast.Descriptor; }
|
||||
}
|
||||
|
||||
public override Broadcast DefaultInstanceForType {
|
||||
get { return global::Sirikata.Subscription.Protocol._PBJ_Internal.Broadcast.DefaultInstance; }
|
||||
}
|
||||
|
||||
public override Broadcast BuildPartial() {
|
||||
if (result == null) {
|
||||
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
|
||||
}
|
||||
Broadcast returnMe = result;
|
||||
result = null;
|
||||
return returnMe;
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::IMessage other) {
|
||||
if (other is Broadcast) {
|
||||
return MergeFrom((Broadcast) other);
|
||||
} else {
|
||||
base.MergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(Broadcast other) {
|
||||
if (other == global::Sirikata.Subscription.Protocol._PBJ_Internal.Broadcast.DefaultInstance) return this;
|
||||
if (other.HasBroadcastName) {
|
||||
BroadcastName = other.BroadcastName;
|
||||
}
|
||||
this.MergeUnknownFields(other.UnknownFields);
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input) {
|
||||
return MergeFrom(input, pb::ExtensionRegistry.Empty);
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
pb::UnknownFieldSet.Builder unknownFields = null;
|
||||
while (true) {
|
||||
uint tag = input.ReadTag();
|
||||
switch (tag) {
|
||||
case 0: {
|
||||
if (unknownFields != null) {
|
||||
this.UnknownFields = unknownFields.Build();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
default: {
|
||||
if (pb::WireFormat.IsEndGroupTag(tag)) {
|
||||
if (unknownFields != null) {
|
||||
this.UnknownFields = unknownFields.Build();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
if (unknownFields == null) {
|
||||
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
|
||||
}
|
||||
ParseUnknownField(input, unknownFields, extensionRegistry, tag);
|
||||
break;
|
||||
}
|
||||
case 58: {
|
||||
BroadcastName = input.ReadBytes();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool HasBroadcastName {
|
||||
get { return result.HasBroadcastName; }
|
||||
}
|
||||
public pb::ByteString BroadcastName {
|
||||
get { return result.BroadcastName; }
|
||||
set { SetBroadcastName(value); }
|
||||
}
|
||||
public Builder SetBroadcastName(pb::ByteString value) {
|
||||
pb::ThrowHelper.ThrowIfNull(value, "value");
|
||||
result.hasBroadcastName = true;
|
||||
result.broadcastName_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearBroadcastName() {
|
||||
result.hasBroadcastName = false;
|
||||
result.broadcastName_ = pb::ByteString.Empty;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
static Broadcast() {
|
||||
object.ReferenceEquals(global::Sirikata.Subscription.Protocol._PBJ_Internal.Subscription.Descriptor, null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
431
OpenSim/Client/Sirikata/Protocol/Subscription.pbj.cs
Normal file
431
OpenSim/Client/Sirikata/Protocol/Subscription.pbj.cs
Normal file
@@ -0,0 +1,431 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using pbd = global::Google.ProtocolBuffers.Descriptors;
|
||||
using pb = global::Google.ProtocolBuffers;
|
||||
namespace Sirikata.Subscription.Protocol {
|
||||
public class Address : PBJ.IMessage {
|
||||
protected _PBJ_Internal.Address super;
|
||||
public _PBJ_Internal.Address _PBJSuper{ get { return super;} }
|
||||
public Address() {
|
||||
super=new _PBJ_Internal.Address();
|
||||
}
|
||||
public Address(_PBJ_Internal.Address reference) {
|
||||
super=reference;
|
||||
}
|
||||
public static Address defaultInstance= new Address (_PBJ_Internal.Address.DefaultInstance);
|
||||
public static Address DefaultInstance{
|
||||
get {return defaultInstance;}
|
||||
}
|
||||
public static pbd.MessageDescriptor Descriptor {
|
||||
get { return _PBJ_Internal.Address.Descriptor; } }
|
||||
public static class Types {
|
||||
}
|
||||
public static bool WithinReservedFieldTagRange(int field_tag) {
|
||||
return false;
|
||||
}
|
||||
public static bool WithinExtensionFieldTagRange(int field_tag) {
|
||||
return false;
|
||||
}
|
||||
public const int HostnameFieldTag=1;
|
||||
public bool HasHostname{ get {return super.HasHostname&&PBJ._PBJ.ValidateString(super.Hostname);} }
|
||||
public string Hostname{ get {
|
||||
if (HasHostname) {
|
||||
return PBJ._PBJ.CastString(super.Hostname);
|
||||
} else {
|
||||
return PBJ._PBJ.CastString();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int ServiceFieldTag=2;
|
||||
public bool HasService{ get {return super.HasService&&PBJ._PBJ.ValidateString(super.Service);} }
|
||||
public string Service{ get {
|
||||
if (HasService) {
|
||||
return PBJ._PBJ.CastString(super.Service);
|
||||
} else {
|
||||
return PBJ._PBJ.CastString();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override Google.ProtocolBuffers.IMessage _PBJISuper { get { return super; } }
|
||||
public override PBJ.IMessage.IBuilder WeakCreateBuilderForType() { return new Builder(); }
|
||||
public static Builder CreateBuilder() { return new Builder(); }
|
||||
public static Builder CreateBuilder(Address prototype) {
|
||||
return (Builder)new Builder().MergeFrom(prototype);
|
||||
}
|
||||
public static Address ParseFrom(pb::ByteString data) {
|
||||
return new Address(_PBJ_Internal.Address.ParseFrom(data));
|
||||
}
|
||||
public static Address ParseFrom(pb::ByteString data, pb::ExtensionRegistry er) {
|
||||
return new Address(_PBJ_Internal.Address.ParseFrom(data,er));
|
||||
}
|
||||
public static Address ParseFrom(byte[] data) {
|
||||
return new Address(_PBJ_Internal.Address.ParseFrom(data));
|
||||
}
|
||||
public static Address ParseFrom(byte[] data, pb::ExtensionRegistry er) {
|
||||
return new Address(_PBJ_Internal.Address.ParseFrom(data,er));
|
||||
}
|
||||
public static Address ParseFrom(global::System.IO.Stream data) {
|
||||
return new Address(_PBJ_Internal.Address.ParseFrom(data));
|
||||
}
|
||||
public static Address ParseFrom(global::System.IO.Stream data, pb::ExtensionRegistry er) {
|
||||
return new Address(_PBJ_Internal.Address.ParseFrom(data,er));
|
||||
}
|
||||
public static Address ParseFrom(pb::CodedInputStream data) {
|
||||
return new Address(_PBJ_Internal.Address.ParseFrom(data));
|
||||
}
|
||||
public static Address ParseFrom(pb::CodedInputStream data, pb::ExtensionRegistry er) {
|
||||
return new Address(_PBJ_Internal.Address.ParseFrom(data,er));
|
||||
}
|
||||
protected override bool _HasAllPBJFields{ get {
|
||||
return true
|
||||
;
|
||||
} }
|
||||
public bool IsInitialized { get {
|
||||
return super.IsInitialized&&_HasAllPBJFields;
|
||||
} }
|
||||
public class Builder : global::PBJ.IMessage.IBuilder{
|
||||
protected override bool _HasAllPBJFields{ get {
|
||||
return true
|
||||
;
|
||||
} }
|
||||
public bool IsInitialized { get {
|
||||
return super.IsInitialized&&_HasAllPBJFields;
|
||||
} }
|
||||
protected _PBJ_Internal.Address.Builder super;
|
||||
public override Google.ProtocolBuffers.IBuilder _PBJISuper { get { return super; } }
|
||||
public _PBJ_Internal.Address.Builder _PBJSuper{ get { return super;} }
|
||||
public Builder() {super = new _PBJ_Internal.Address.Builder();}
|
||||
public Builder(_PBJ_Internal.Address.Builder other) {
|
||||
super=other;
|
||||
}
|
||||
public Builder Clone() {return new Builder(super.Clone());}
|
||||
public Builder MergeFrom(Address prototype) { super.MergeFrom(prototype._PBJSuper);return this;}
|
||||
public Builder Clear() {super.Clear();return this;}
|
||||
public Address BuildPartial() {return new Address(super.BuildPartial());}
|
||||
public Address Build() {if (_HasAllPBJFields) return new Address(super.Build());return null;}
|
||||
public pbd::MessageDescriptor DescriptorForType {
|
||||
get { return Address.Descriptor; } }
|
||||
public Builder ClearHostname() { super.ClearHostname();return this;}
|
||||
public const int HostnameFieldTag=1;
|
||||
public bool HasHostname{ get {return super.HasHostname&&PBJ._PBJ.ValidateString(super.Hostname);} }
|
||||
public string Hostname{ get {
|
||||
if (HasHostname) {
|
||||
return PBJ._PBJ.CastString(super.Hostname);
|
||||
} else {
|
||||
return PBJ._PBJ.CastString();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.Hostname=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearService() { super.ClearService();return this;}
|
||||
public const int ServiceFieldTag=2;
|
||||
public bool HasService{ get {return super.HasService&&PBJ._PBJ.ValidateString(super.Service);} }
|
||||
public string Service{ get {
|
||||
if (HasService) {
|
||||
return PBJ._PBJ.CastString(super.Service);
|
||||
} else {
|
||||
return PBJ._PBJ.CastString();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.Service=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Sirikata.Subscription.Protocol {
|
||||
public class Subscribe : PBJ.IMessage {
|
||||
protected _PBJ_Internal.Subscribe super;
|
||||
public _PBJ_Internal.Subscribe _PBJSuper{ get { return super;} }
|
||||
public Subscribe() {
|
||||
super=new _PBJ_Internal.Subscribe();
|
||||
}
|
||||
public Subscribe(_PBJ_Internal.Subscribe reference) {
|
||||
super=reference;
|
||||
}
|
||||
public static Subscribe defaultInstance= new Subscribe (_PBJ_Internal.Subscribe.DefaultInstance);
|
||||
public static Subscribe DefaultInstance{
|
||||
get {return defaultInstance;}
|
||||
}
|
||||
public static pbd.MessageDescriptor Descriptor {
|
||||
get { return _PBJ_Internal.Subscribe.Descriptor; } }
|
||||
public static class Types {
|
||||
}
|
||||
public static bool WithinReservedFieldTagRange(int field_tag) {
|
||||
return false||(field_tag>=1&&field_tag<=6)||(field_tag>=1536&&field_tag<=2560)||(field_tag>=229376&&field_tag<=294912);
|
||||
}
|
||||
public static bool WithinExtensionFieldTagRange(int field_tag) {
|
||||
return false;
|
||||
}
|
||||
public const int BroadcastAddressFieldTag=7;
|
||||
public bool HasBroadcastAddress{ get {return super.HasBroadcastAddress;} }
|
||||
public Address BroadcastAddress{ get {
|
||||
if (HasBroadcastAddress) {
|
||||
return new Address(super.BroadcastAddress);
|
||||
} else {
|
||||
return new Address();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int BroadcastNameFieldTag=8;
|
||||
public bool HasBroadcastName{ get {return super.HasBroadcastName&&PBJ._PBJ.ValidateUuid(super.BroadcastName);} }
|
||||
public PBJ.UUID BroadcastName{ get {
|
||||
if (HasBroadcastName) {
|
||||
return PBJ._PBJ.CastUuid(super.BroadcastName);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int UpdatePeriodFieldTag=9;
|
||||
public bool HasUpdatePeriod{ get {return super.HasUpdatePeriod&&PBJ._PBJ.ValidateDuration(super.UpdatePeriod);} }
|
||||
public PBJ.Duration UpdatePeriod{ get {
|
||||
if (HasUpdatePeriod) {
|
||||
return PBJ._PBJ.CastDuration(super.UpdatePeriod);
|
||||
} else {
|
||||
return PBJ._PBJ.CastDuration();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override Google.ProtocolBuffers.IMessage _PBJISuper { get { return super; } }
|
||||
public override PBJ.IMessage.IBuilder WeakCreateBuilderForType() { return new Builder(); }
|
||||
public static Builder CreateBuilder() { return new Builder(); }
|
||||
public static Builder CreateBuilder(Subscribe prototype) {
|
||||
return (Builder)new Builder().MergeFrom(prototype);
|
||||
}
|
||||
public static Subscribe ParseFrom(pb::ByteString data) {
|
||||
return new Subscribe(_PBJ_Internal.Subscribe.ParseFrom(data));
|
||||
}
|
||||
public static Subscribe ParseFrom(pb::ByteString data, pb::ExtensionRegistry er) {
|
||||
return new Subscribe(_PBJ_Internal.Subscribe.ParseFrom(data,er));
|
||||
}
|
||||
public static Subscribe ParseFrom(byte[] data) {
|
||||
return new Subscribe(_PBJ_Internal.Subscribe.ParseFrom(data));
|
||||
}
|
||||
public static Subscribe ParseFrom(byte[] data, pb::ExtensionRegistry er) {
|
||||
return new Subscribe(_PBJ_Internal.Subscribe.ParseFrom(data,er));
|
||||
}
|
||||
public static Subscribe ParseFrom(global::System.IO.Stream data) {
|
||||
return new Subscribe(_PBJ_Internal.Subscribe.ParseFrom(data));
|
||||
}
|
||||
public static Subscribe ParseFrom(global::System.IO.Stream data, pb::ExtensionRegistry er) {
|
||||
return new Subscribe(_PBJ_Internal.Subscribe.ParseFrom(data,er));
|
||||
}
|
||||
public static Subscribe ParseFrom(pb::CodedInputStream data) {
|
||||
return new Subscribe(_PBJ_Internal.Subscribe.ParseFrom(data));
|
||||
}
|
||||
public static Subscribe ParseFrom(pb::CodedInputStream data, pb::ExtensionRegistry er) {
|
||||
return new Subscribe(_PBJ_Internal.Subscribe.ParseFrom(data,er));
|
||||
}
|
||||
protected override bool _HasAllPBJFields{ get {
|
||||
return true
|
||||
;
|
||||
} }
|
||||
public bool IsInitialized { get {
|
||||
return super.IsInitialized&&_HasAllPBJFields;
|
||||
} }
|
||||
public class Builder : global::PBJ.IMessage.IBuilder{
|
||||
protected override bool _HasAllPBJFields{ get {
|
||||
return true
|
||||
;
|
||||
} }
|
||||
public bool IsInitialized { get {
|
||||
return super.IsInitialized&&_HasAllPBJFields;
|
||||
} }
|
||||
protected _PBJ_Internal.Subscribe.Builder super;
|
||||
public override Google.ProtocolBuffers.IBuilder _PBJISuper { get { return super; } }
|
||||
public _PBJ_Internal.Subscribe.Builder _PBJSuper{ get { return super;} }
|
||||
public Builder() {super = new _PBJ_Internal.Subscribe.Builder();}
|
||||
public Builder(_PBJ_Internal.Subscribe.Builder other) {
|
||||
super=other;
|
||||
}
|
||||
public Builder Clone() {return new Builder(super.Clone());}
|
||||
public Builder MergeFrom(Subscribe prototype) { super.MergeFrom(prototype._PBJSuper);return this;}
|
||||
public Builder Clear() {super.Clear();return this;}
|
||||
public Subscribe BuildPartial() {return new Subscribe(super.BuildPartial());}
|
||||
public Subscribe Build() {if (_HasAllPBJFields) return new Subscribe(super.Build());return null;}
|
||||
public pbd::MessageDescriptor DescriptorForType {
|
||||
get { return Subscribe.Descriptor; } }
|
||||
public Builder ClearBroadcastAddress() { super.ClearBroadcastAddress();return this;}
|
||||
public const int BroadcastAddressFieldTag=7;
|
||||
public bool HasBroadcastAddress{ get {return super.HasBroadcastAddress;} }
|
||||
public Address BroadcastAddress{ get {
|
||||
if (HasBroadcastAddress) {
|
||||
return new Address(super.BroadcastAddress);
|
||||
} else {
|
||||
return new Address();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.BroadcastAddress=value._PBJSuper;
|
||||
}
|
||||
}
|
||||
public Builder ClearBroadcastName() { super.ClearBroadcastName();return this;}
|
||||
public const int BroadcastNameFieldTag=8;
|
||||
public bool HasBroadcastName{ get {return super.HasBroadcastName&&PBJ._PBJ.ValidateUuid(super.BroadcastName);} }
|
||||
public PBJ.UUID BroadcastName{ get {
|
||||
if (HasBroadcastName) {
|
||||
return PBJ._PBJ.CastUuid(super.BroadcastName);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.BroadcastName=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearUpdatePeriod() { super.ClearUpdatePeriod();return this;}
|
||||
public const int UpdatePeriodFieldTag=9;
|
||||
public bool HasUpdatePeriod{ get {return super.HasUpdatePeriod&&PBJ._PBJ.ValidateDuration(super.UpdatePeriod);} }
|
||||
public PBJ.Duration UpdatePeriod{ get {
|
||||
if (HasUpdatePeriod) {
|
||||
return PBJ._PBJ.CastDuration(super.UpdatePeriod);
|
||||
} else {
|
||||
return PBJ._PBJ.CastDuration();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.UpdatePeriod=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Sirikata.Subscription.Protocol {
|
||||
public class Broadcast : PBJ.IMessage {
|
||||
protected _PBJ_Internal.Broadcast super;
|
||||
public _PBJ_Internal.Broadcast _PBJSuper{ get { return super;} }
|
||||
public Broadcast() {
|
||||
super=new _PBJ_Internal.Broadcast();
|
||||
}
|
||||
public Broadcast(_PBJ_Internal.Broadcast reference) {
|
||||
super=reference;
|
||||
}
|
||||
public static Broadcast defaultInstance= new Broadcast (_PBJ_Internal.Broadcast.DefaultInstance);
|
||||
public static Broadcast DefaultInstance{
|
||||
get {return defaultInstance;}
|
||||
}
|
||||
public static pbd.MessageDescriptor Descriptor {
|
||||
get { return _PBJ_Internal.Broadcast.Descriptor; } }
|
||||
public static class Types {
|
||||
}
|
||||
public static bool WithinReservedFieldTagRange(int field_tag) {
|
||||
return false||(field_tag>=1&&field_tag<=6)||(field_tag>=1536&&field_tag<=2560)||(field_tag>=229376&&field_tag<=294912);
|
||||
}
|
||||
public static bool WithinExtensionFieldTagRange(int field_tag) {
|
||||
return false;
|
||||
}
|
||||
public const int BroadcastNameFieldTag=7;
|
||||
public bool HasBroadcastName{ get {return super.HasBroadcastName&&PBJ._PBJ.ValidateUuid(super.BroadcastName);} }
|
||||
public PBJ.UUID BroadcastName{ get {
|
||||
if (HasBroadcastName) {
|
||||
return PBJ._PBJ.CastUuid(super.BroadcastName);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override Google.ProtocolBuffers.IMessage _PBJISuper { get { return super; } }
|
||||
public override PBJ.IMessage.IBuilder WeakCreateBuilderForType() { return new Builder(); }
|
||||
public static Builder CreateBuilder() { return new Builder(); }
|
||||
public static Builder CreateBuilder(Broadcast prototype) {
|
||||
return (Builder)new Builder().MergeFrom(prototype);
|
||||
}
|
||||
public static Broadcast ParseFrom(pb::ByteString data) {
|
||||
return new Broadcast(_PBJ_Internal.Broadcast.ParseFrom(data));
|
||||
}
|
||||
public static Broadcast ParseFrom(pb::ByteString data, pb::ExtensionRegistry er) {
|
||||
return new Broadcast(_PBJ_Internal.Broadcast.ParseFrom(data,er));
|
||||
}
|
||||
public static Broadcast ParseFrom(byte[] data) {
|
||||
return new Broadcast(_PBJ_Internal.Broadcast.ParseFrom(data));
|
||||
}
|
||||
public static Broadcast ParseFrom(byte[] data, pb::ExtensionRegistry er) {
|
||||
return new Broadcast(_PBJ_Internal.Broadcast.ParseFrom(data,er));
|
||||
}
|
||||
public static Broadcast ParseFrom(global::System.IO.Stream data) {
|
||||
return new Broadcast(_PBJ_Internal.Broadcast.ParseFrom(data));
|
||||
}
|
||||
public static Broadcast ParseFrom(global::System.IO.Stream data, pb::ExtensionRegistry er) {
|
||||
return new Broadcast(_PBJ_Internal.Broadcast.ParseFrom(data,er));
|
||||
}
|
||||
public static Broadcast ParseFrom(pb::CodedInputStream data) {
|
||||
return new Broadcast(_PBJ_Internal.Broadcast.ParseFrom(data));
|
||||
}
|
||||
public static Broadcast ParseFrom(pb::CodedInputStream data, pb::ExtensionRegistry er) {
|
||||
return new Broadcast(_PBJ_Internal.Broadcast.ParseFrom(data,er));
|
||||
}
|
||||
protected override bool _HasAllPBJFields{ get {
|
||||
return true
|
||||
;
|
||||
} }
|
||||
public bool IsInitialized { get {
|
||||
return super.IsInitialized&&_HasAllPBJFields;
|
||||
} }
|
||||
public class Builder : global::PBJ.IMessage.IBuilder{
|
||||
protected override bool _HasAllPBJFields{ get {
|
||||
return true
|
||||
;
|
||||
} }
|
||||
public bool IsInitialized { get {
|
||||
return super.IsInitialized&&_HasAllPBJFields;
|
||||
} }
|
||||
protected _PBJ_Internal.Broadcast.Builder super;
|
||||
public override Google.ProtocolBuffers.IBuilder _PBJISuper { get { return super; } }
|
||||
public _PBJ_Internal.Broadcast.Builder _PBJSuper{ get { return super;} }
|
||||
public Builder() {super = new _PBJ_Internal.Broadcast.Builder();}
|
||||
public Builder(_PBJ_Internal.Broadcast.Builder other) {
|
||||
super=other;
|
||||
}
|
||||
public Builder Clone() {return new Builder(super.Clone());}
|
||||
public Builder MergeFrom(Broadcast prototype) { super.MergeFrom(prototype._PBJSuper);return this;}
|
||||
public Builder Clear() {super.Clear();return this;}
|
||||
public Broadcast BuildPartial() {return new Broadcast(super.BuildPartial());}
|
||||
public Broadcast Build() {if (_HasAllPBJFields) return new Broadcast(super.Build());return null;}
|
||||
public pbd::MessageDescriptor DescriptorForType {
|
||||
get { return Broadcast.Descriptor; } }
|
||||
public Builder ClearBroadcastName() { super.ClearBroadcastName();return this;}
|
||||
public const int BroadcastNameFieldTag=7;
|
||||
public bool HasBroadcastName{ get {return super.HasBroadcastName&&PBJ._PBJ.ValidateUuid(super.BroadcastName);} }
|
||||
public PBJ.UUID BroadcastName{ get {
|
||||
if (HasBroadcastName) {
|
||||
return PBJ._PBJ.CastUuid(super.BroadcastName);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUuid();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.BroadcastName=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3773
OpenSim/Client/Sirikata/Protocol/Test.cs
Normal file
3773
OpenSim/Client/Sirikata/Protocol/Test.cs
Normal file
File diff suppressed because it is too large
Load Diff
1761
OpenSim/Client/Sirikata/Protocol/Test.pbj.cs
Normal file
1761
OpenSim/Client/Sirikata/Protocol/Test.pbj.cs
Normal file
File diff suppressed because it is too large
Load Diff
454
OpenSim/Client/Sirikata/Protocol/Time.cs
Normal file
454
OpenSim/Client/Sirikata/Protocol/Time.cs
Normal file
@@ -0,0 +1,454 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
|
||||
using pb = global::Google.ProtocolBuffers;
|
||||
using pbc = global::Google.ProtocolBuffers.Collections;
|
||||
using pbd = global::Google.ProtocolBuffers.Descriptors;
|
||||
using scg = global::System.Collections.Generic;
|
||||
namespace Sirikata.Network.Protocol._PBJ_Internal {
|
||||
|
||||
public static partial class Time {
|
||||
|
||||
#region Extension registration
|
||||
public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {
|
||||
}
|
||||
#endregion
|
||||
#region Static variables
|
||||
internal static pbd::MessageDescriptor internal__static_Sirikata_Network_Protocol__PBJ_Internal_TimeSync__Descriptor;
|
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Sirikata.Network.Protocol._PBJ_Internal.TimeSync, global::Sirikata.Network.Protocol._PBJ_Internal.TimeSync.Builder> internal__static_Sirikata_Network_Protocol__PBJ_Internal_TimeSync__FieldAccessorTable;
|
||||
#endregion
|
||||
#region Descriptor
|
||||
public static pbd::FileDescriptor Descriptor {
|
||||
get { return descriptor; }
|
||||
}
|
||||
private static pbd::FileDescriptor descriptor;
|
||||
|
||||
static Time() {
|
||||
byte[] descriptorData = global::System.Convert.FromBase64String(
|
||||
"CgpUaW1lLnByb3RvEidTaXJpa2F0YS5OZXR3b3JrLlByb3RvY29sLl9QQkpf" +
|
||||
"SW50ZXJuYWwirQEKCFRpbWVTeW5jEhMKC2NsaWVudF90aW1lGAkgASgGEhMK" +
|
||||
"C3NlcnZlcl90aW1lGAogASgGEhIKCnN5bmNfcm91bmQYCyABKAQSFgoOcmV0" +
|
||||
"dXJuX29wdGlvbnMYDiABKA0SEwoKcm91bmRfdHJpcBiBFCABKAYiNgoNUmV0" +
|
||||
"dXJuT3B0aW9ucxISCg5SRVBMWV9SRUxJQUJMRRABEhEKDVJFUExZX09SREVS" +
|
||||
"RUQQAg==");
|
||||
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
|
||||
descriptor = root;
|
||||
internal__static_Sirikata_Network_Protocol__PBJ_Internal_TimeSync__Descriptor = Descriptor.MessageTypes[0];
|
||||
internal__static_Sirikata_Network_Protocol__PBJ_Internal_TimeSync__FieldAccessorTable =
|
||||
new pb::FieldAccess.FieldAccessorTable<global::Sirikata.Network.Protocol._PBJ_Internal.TimeSync, global::Sirikata.Network.Protocol._PBJ_Internal.TimeSync.Builder>(internal__static_Sirikata_Network_Protocol__PBJ_Internal_TimeSync__Descriptor,
|
||||
new string[] { "ClientTime", "ServerTime", "SyncRound", "ReturnOptions", "RoundTrip", });
|
||||
return null;
|
||||
};
|
||||
pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
|
||||
new pbd::FileDescriptor[] {
|
||||
}, assigner);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#region Messages
|
||||
public sealed partial class TimeSync : pb::GeneratedMessage<TimeSync, TimeSync.Builder> {
|
||||
private static readonly TimeSync defaultInstance = new Builder().BuildPartial();
|
||||
public static TimeSync DefaultInstance {
|
||||
get { return defaultInstance; }
|
||||
}
|
||||
|
||||
public override TimeSync DefaultInstanceForType {
|
||||
get { return defaultInstance; }
|
||||
}
|
||||
|
||||
protected override TimeSync ThisMessage {
|
||||
get { return this; }
|
||||
}
|
||||
|
||||
public static pbd::MessageDescriptor Descriptor {
|
||||
get { return global::Sirikata.Network.Protocol._PBJ_Internal.Time.internal__static_Sirikata_Network_Protocol__PBJ_Internal_TimeSync__Descriptor; }
|
||||
}
|
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<TimeSync, TimeSync.Builder> InternalFieldAccessors {
|
||||
get { return global::Sirikata.Network.Protocol._PBJ_Internal.Time.internal__static_Sirikata_Network_Protocol__PBJ_Internal_TimeSync__FieldAccessorTable; }
|
||||
}
|
||||
|
||||
#region Nested types
|
||||
public static class Types {
|
||||
public enum ReturnOptions {
|
||||
REPLY_RELIABLE = 1,
|
||||
REPLY_ORDERED = 2,
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
public const int ClientTimeFieldNumber = 9;
|
||||
private bool hasClientTime;
|
||||
private ulong clientTime_ = 0;
|
||||
public bool HasClientTime {
|
||||
get { return hasClientTime; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public ulong ClientTime {
|
||||
get { return clientTime_; }
|
||||
}
|
||||
|
||||
public const int ServerTimeFieldNumber = 10;
|
||||
private bool hasServerTime;
|
||||
private ulong serverTime_ = 0;
|
||||
public bool HasServerTime {
|
||||
get { return hasServerTime; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public ulong ServerTime {
|
||||
get { return serverTime_; }
|
||||
}
|
||||
|
||||
public const int SyncRoundFieldNumber = 11;
|
||||
private bool hasSyncRound;
|
||||
private ulong syncRound_ = 0UL;
|
||||
public bool HasSyncRound {
|
||||
get { return hasSyncRound; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public ulong SyncRound {
|
||||
get { return syncRound_; }
|
||||
}
|
||||
|
||||
public const int ReturnOptionsFieldNumber = 14;
|
||||
private bool hasReturnOptions;
|
||||
private uint returnOptions_ = 0;
|
||||
public bool HasReturnOptions {
|
||||
get { return hasReturnOptions; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public uint ReturnOptions {
|
||||
get { return returnOptions_; }
|
||||
}
|
||||
|
||||
public const int RoundTripFieldNumber = 2561;
|
||||
private bool hasRoundTrip;
|
||||
private ulong roundTrip_ = 0;
|
||||
public bool HasRoundTrip {
|
||||
get { return hasRoundTrip; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public ulong RoundTrip {
|
||||
get { return roundTrip_; }
|
||||
}
|
||||
|
||||
public override bool IsInitialized {
|
||||
get {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteTo(pb::CodedOutputStream output) {
|
||||
if (HasClientTime) {
|
||||
output.WriteFixed64(9, ClientTime);
|
||||
}
|
||||
if (HasServerTime) {
|
||||
output.WriteFixed64(10, ServerTime);
|
||||
}
|
||||
if (HasSyncRound) {
|
||||
output.WriteUInt64(11, SyncRound);
|
||||
}
|
||||
if (HasReturnOptions) {
|
||||
output.WriteUInt32(14, ReturnOptions);
|
||||
}
|
||||
if (HasRoundTrip) {
|
||||
output.WriteFixed64(2561, RoundTrip);
|
||||
}
|
||||
UnknownFields.WriteTo(output);
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
public override int SerializedSize {
|
||||
get {
|
||||
int size = memoizedSerializedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (HasClientTime) {
|
||||
size += pb::CodedOutputStream.ComputeFixed64Size(9, ClientTime);
|
||||
}
|
||||
if (HasServerTime) {
|
||||
size += pb::CodedOutputStream.ComputeFixed64Size(10, ServerTime);
|
||||
}
|
||||
if (HasSyncRound) {
|
||||
size += pb::CodedOutputStream.ComputeUInt64Size(11, SyncRound);
|
||||
}
|
||||
if (HasReturnOptions) {
|
||||
size += pb::CodedOutputStream.ComputeUInt32Size(14, ReturnOptions);
|
||||
}
|
||||
if (HasRoundTrip) {
|
||||
size += pb::CodedOutputStream.ComputeFixed64Size(2561, RoundTrip);
|
||||
}
|
||||
size += UnknownFields.SerializedSize;
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
public static TimeSync ParseFrom(pb::ByteString data) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
|
||||
}
|
||||
public static TimeSync ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static TimeSync ParseFrom(byte[] data) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
|
||||
}
|
||||
public static TimeSync ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static TimeSync ParseFrom(global::System.IO.Stream input) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
|
||||
}
|
||||
public static TimeSync ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static TimeSync ParseDelimitedFrom(global::System.IO.Stream input) {
|
||||
return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
|
||||
}
|
||||
public static TimeSync ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
|
||||
}
|
||||
public static TimeSync ParseFrom(pb::CodedInputStream input) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
|
||||
}
|
||||
public static TimeSync ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
|
||||
}
|
||||
public static Builder CreateBuilder() { return new Builder(); }
|
||||
public override Builder ToBuilder() { return CreateBuilder(this); }
|
||||
public override Builder CreateBuilderForType() { return new Builder(); }
|
||||
public static Builder CreateBuilder(TimeSync prototype) {
|
||||
return (Builder) new Builder().MergeFrom(prototype);
|
||||
}
|
||||
|
||||
public sealed partial class Builder : pb::GeneratedBuilder<TimeSync, Builder> {
|
||||
protected override Builder ThisBuilder {
|
||||
get { return this; }
|
||||
}
|
||||
public Builder() {}
|
||||
|
||||
TimeSync result = new TimeSync();
|
||||
|
||||
protected override TimeSync MessageBeingBuilt {
|
||||
get { return result; }
|
||||
}
|
||||
|
||||
public override Builder Clear() {
|
||||
result = new TimeSync();
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Builder Clone() {
|
||||
return new Builder().MergeFrom(result);
|
||||
}
|
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType {
|
||||
get { return global::Sirikata.Network.Protocol._PBJ_Internal.TimeSync.Descriptor; }
|
||||
}
|
||||
|
||||
public override TimeSync DefaultInstanceForType {
|
||||
get { return global::Sirikata.Network.Protocol._PBJ_Internal.TimeSync.DefaultInstance; }
|
||||
}
|
||||
|
||||
public override TimeSync BuildPartial() {
|
||||
if (result == null) {
|
||||
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
|
||||
}
|
||||
TimeSync returnMe = result;
|
||||
result = null;
|
||||
return returnMe;
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::IMessage other) {
|
||||
if (other is TimeSync) {
|
||||
return MergeFrom((TimeSync) other);
|
||||
} else {
|
||||
base.MergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(TimeSync other) {
|
||||
if (other == global::Sirikata.Network.Protocol._PBJ_Internal.TimeSync.DefaultInstance) return this;
|
||||
if (other.HasClientTime) {
|
||||
ClientTime = other.ClientTime;
|
||||
}
|
||||
if (other.HasServerTime) {
|
||||
ServerTime = other.ServerTime;
|
||||
}
|
||||
if (other.HasSyncRound) {
|
||||
SyncRound = other.SyncRound;
|
||||
}
|
||||
if (other.HasReturnOptions) {
|
||||
ReturnOptions = other.ReturnOptions;
|
||||
}
|
||||
if (other.HasRoundTrip) {
|
||||
RoundTrip = other.RoundTrip;
|
||||
}
|
||||
this.MergeUnknownFields(other.UnknownFields);
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input) {
|
||||
return MergeFrom(input, pb::ExtensionRegistry.Empty);
|
||||
}
|
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
|
||||
pb::UnknownFieldSet.Builder unknownFields = null;
|
||||
while (true) {
|
||||
uint tag = input.ReadTag();
|
||||
switch (tag) {
|
||||
case 0: {
|
||||
if (unknownFields != null) {
|
||||
this.UnknownFields = unknownFields.Build();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
default: {
|
||||
if (pb::WireFormat.IsEndGroupTag(tag)) {
|
||||
if (unknownFields != null) {
|
||||
this.UnknownFields = unknownFields.Build();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
if (unknownFields == null) {
|
||||
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
|
||||
}
|
||||
ParseUnknownField(input, unknownFields, extensionRegistry, tag);
|
||||
break;
|
||||
}
|
||||
case 73: {
|
||||
ClientTime = input.ReadFixed64();
|
||||
break;
|
||||
}
|
||||
case 81: {
|
||||
ServerTime = input.ReadFixed64();
|
||||
break;
|
||||
}
|
||||
case 88: {
|
||||
SyncRound = input.ReadUInt64();
|
||||
break;
|
||||
}
|
||||
case 112: {
|
||||
ReturnOptions = input.ReadUInt32();
|
||||
break;
|
||||
}
|
||||
case 20489: {
|
||||
RoundTrip = input.ReadFixed64();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool HasClientTime {
|
||||
get { return result.HasClientTime; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public ulong ClientTime {
|
||||
get { return result.ClientTime; }
|
||||
set { SetClientTime(value); }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public Builder SetClientTime(ulong value) {
|
||||
result.hasClientTime = true;
|
||||
result.clientTime_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearClientTime() {
|
||||
result.hasClientTime = false;
|
||||
result.clientTime_ = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasServerTime {
|
||||
get { return result.HasServerTime; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public ulong ServerTime {
|
||||
get { return result.ServerTime; }
|
||||
set { SetServerTime(value); }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public Builder SetServerTime(ulong value) {
|
||||
result.hasServerTime = true;
|
||||
result.serverTime_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearServerTime() {
|
||||
result.hasServerTime = false;
|
||||
result.serverTime_ = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasSyncRound {
|
||||
get { return result.HasSyncRound; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public ulong SyncRound {
|
||||
get { return result.SyncRound; }
|
||||
set { SetSyncRound(value); }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public Builder SetSyncRound(ulong value) {
|
||||
result.hasSyncRound = true;
|
||||
result.syncRound_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearSyncRound() {
|
||||
result.hasSyncRound = false;
|
||||
result.syncRound_ = 0UL;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasReturnOptions {
|
||||
get { return result.HasReturnOptions; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public uint ReturnOptions {
|
||||
get { return result.ReturnOptions; }
|
||||
set { SetReturnOptions(value); }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public Builder SetReturnOptions(uint value) {
|
||||
result.hasReturnOptions = true;
|
||||
result.returnOptions_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearReturnOptions() {
|
||||
result.hasReturnOptions = false;
|
||||
result.returnOptions_ = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasRoundTrip {
|
||||
get { return result.HasRoundTrip; }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public ulong RoundTrip {
|
||||
get { return result.RoundTrip; }
|
||||
set { SetRoundTrip(value); }
|
||||
}
|
||||
[global::System.CLSCompliant(false)]
|
||||
public Builder SetRoundTrip(ulong value) {
|
||||
result.hasRoundTrip = true;
|
||||
result.roundTrip_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder ClearRoundTrip() {
|
||||
result.hasRoundTrip = false;
|
||||
result.roundTrip_ = 0;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
static TimeSync() {
|
||||
object.ReferenceEquals(global::Sirikata.Network.Protocol._PBJ_Internal.Time.Descriptor, null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
245
OpenSim/Client/Sirikata/Protocol/Time.pbj.cs
Normal file
245
OpenSim/Client/Sirikata/Protocol/Time.pbj.cs
Normal file
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using pbd = global::Google.ProtocolBuffers.Descriptors;
|
||||
using pb = global::Google.ProtocolBuffers;
|
||||
namespace Sirikata.Network.Protocol {
|
||||
public class TimeSync : PBJ.IMessage {
|
||||
protected _PBJ_Internal.TimeSync super;
|
||||
public _PBJ_Internal.TimeSync _PBJSuper{ get { return super;} }
|
||||
public TimeSync() {
|
||||
super=new _PBJ_Internal.TimeSync();
|
||||
}
|
||||
public TimeSync(_PBJ_Internal.TimeSync reference) {
|
||||
super=reference;
|
||||
}
|
||||
public static TimeSync defaultInstance= new TimeSync (_PBJ_Internal.TimeSync.DefaultInstance);
|
||||
public static TimeSync DefaultInstance{
|
||||
get {return defaultInstance;}
|
||||
}
|
||||
public static pbd.MessageDescriptor Descriptor {
|
||||
get { return _PBJ_Internal.TimeSync.Descriptor; } }
|
||||
public static class Types {
|
||||
public enum ReturnOptions {
|
||||
REPLY_RELIABLE=_PBJ_Internal.TimeSync.Types.ReturnOptions.REPLY_RELIABLE,
|
||||
REPLY_ORDERED=_PBJ_Internal.TimeSync.Types.ReturnOptions.REPLY_ORDERED
|
||||
};
|
||||
}
|
||||
public static bool WithinReservedFieldTagRange(int field_tag) {
|
||||
return false||(field_tag>=1&&field_tag<=8)||(field_tag>=1536&&field_tag<=2560)||(field_tag>=229376&&field_tag<=294912);
|
||||
}
|
||||
public static bool WithinExtensionFieldTagRange(int field_tag) {
|
||||
return false;
|
||||
}
|
||||
public const int ClientTimeFieldTag=9;
|
||||
public bool HasClientTime{ get {return super.HasClientTime&&PBJ._PBJ.ValidateTime(super.ClientTime);} }
|
||||
public PBJ.Time ClientTime{ get {
|
||||
if (HasClientTime) {
|
||||
return PBJ._PBJ.CastTime(super.ClientTime);
|
||||
} else {
|
||||
return PBJ._PBJ.CastTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int ServerTimeFieldTag=10;
|
||||
public bool HasServerTime{ get {return super.HasServerTime&&PBJ._PBJ.ValidateTime(super.ServerTime);} }
|
||||
public PBJ.Time ServerTime{ get {
|
||||
if (HasServerTime) {
|
||||
return PBJ._PBJ.CastTime(super.ServerTime);
|
||||
} else {
|
||||
return PBJ._PBJ.CastTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int SyncRoundFieldTag=11;
|
||||
public bool HasSyncRound{ get {return super.HasSyncRound&&PBJ._PBJ.ValidateUint64(super.SyncRound);} }
|
||||
public ulong SyncRound{ get {
|
||||
if (HasSyncRound) {
|
||||
return PBJ._PBJ.CastUint64(super.SyncRound);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUint64();
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int ReturnOptionsFieldTag=14;
|
||||
public bool HasReturnOptions { get {
|
||||
if (!super.HasReturnOptions) return false;
|
||||
return PBJ._PBJ.ValidateFlags(super.ReturnOptions,(ulong)Types.ReturnOptions.REPLY_RELIABLE|(ulong)Types.ReturnOptions.REPLY_ORDERED);
|
||||
} }
|
||||
public uint ReturnOptions{ get {
|
||||
if (HasReturnOptions) {
|
||||
return (uint)PBJ._PBJ.CastFlags(super.ReturnOptions,(ulong)Types.ReturnOptions.REPLY_RELIABLE|(ulong)Types.ReturnOptions.REPLY_ORDERED);
|
||||
} else {
|
||||
return (uint)PBJ._PBJ.CastFlags((ulong)Types.ReturnOptions.REPLY_RELIABLE|(ulong)Types.ReturnOptions.REPLY_ORDERED);
|
||||
}
|
||||
}
|
||||
}
|
||||
public const int RoundTripFieldTag=2561;
|
||||
public bool HasRoundTrip{ get {return super.HasRoundTrip&&PBJ._PBJ.ValidateTime(super.RoundTrip);} }
|
||||
public PBJ.Time RoundTrip{ get {
|
||||
if (HasRoundTrip) {
|
||||
return PBJ._PBJ.CastTime(super.RoundTrip);
|
||||
} else {
|
||||
return PBJ._PBJ.CastTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override Google.ProtocolBuffers.IMessage _PBJISuper { get { return super; } }
|
||||
public override PBJ.IMessage.IBuilder WeakCreateBuilderForType() { return new Builder(); }
|
||||
public static Builder CreateBuilder() { return new Builder(); }
|
||||
public static Builder CreateBuilder(TimeSync prototype) {
|
||||
return (Builder)new Builder().MergeFrom(prototype);
|
||||
}
|
||||
public static TimeSync ParseFrom(pb::ByteString data) {
|
||||
return new TimeSync(_PBJ_Internal.TimeSync.ParseFrom(data));
|
||||
}
|
||||
public static TimeSync ParseFrom(pb::ByteString data, pb::ExtensionRegistry er) {
|
||||
return new TimeSync(_PBJ_Internal.TimeSync.ParseFrom(data,er));
|
||||
}
|
||||
public static TimeSync ParseFrom(byte[] data) {
|
||||
return new TimeSync(_PBJ_Internal.TimeSync.ParseFrom(data));
|
||||
}
|
||||
public static TimeSync ParseFrom(byte[] data, pb::ExtensionRegistry er) {
|
||||
return new TimeSync(_PBJ_Internal.TimeSync.ParseFrom(data,er));
|
||||
}
|
||||
public static TimeSync ParseFrom(global::System.IO.Stream data) {
|
||||
return new TimeSync(_PBJ_Internal.TimeSync.ParseFrom(data));
|
||||
}
|
||||
public static TimeSync ParseFrom(global::System.IO.Stream data, pb::ExtensionRegistry er) {
|
||||
return new TimeSync(_PBJ_Internal.TimeSync.ParseFrom(data,er));
|
||||
}
|
||||
public static TimeSync ParseFrom(pb::CodedInputStream data) {
|
||||
return new TimeSync(_PBJ_Internal.TimeSync.ParseFrom(data));
|
||||
}
|
||||
public static TimeSync ParseFrom(pb::CodedInputStream data, pb::ExtensionRegistry er) {
|
||||
return new TimeSync(_PBJ_Internal.TimeSync.ParseFrom(data,er));
|
||||
}
|
||||
protected override bool _HasAllPBJFields{ get {
|
||||
return true
|
||||
;
|
||||
} }
|
||||
public bool IsInitialized { get {
|
||||
return super.IsInitialized&&_HasAllPBJFields;
|
||||
} }
|
||||
public class Builder : global::PBJ.IMessage.IBuilder{
|
||||
protected override bool _HasAllPBJFields{ get {
|
||||
return true
|
||||
;
|
||||
} }
|
||||
public bool IsInitialized { get {
|
||||
return super.IsInitialized&&_HasAllPBJFields;
|
||||
} }
|
||||
protected _PBJ_Internal.TimeSync.Builder super;
|
||||
public override Google.ProtocolBuffers.IBuilder _PBJISuper { get { return super; } }
|
||||
public _PBJ_Internal.TimeSync.Builder _PBJSuper{ get { return super;} }
|
||||
public Builder() {super = new _PBJ_Internal.TimeSync.Builder();}
|
||||
public Builder(_PBJ_Internal.TimeSync.Builder other) {
|
||||
super=other;
|
||||
}
|
||||
public Builder Clone() {return new Builder(super.Clone());}
|
||||
public Builder MergeFrom(TimeSync prototype) { super.MergeFrom(prototype._PBJSuper);return this;}
|
||||
public Builder Clear() {super.Clear();return this;}
|
||||
public TimeSync BuildPartial() {return new TimeSync(super.BuildPartial());}
|
||||
public TimeSync Build() {if (_HasAllPBJFields) return new TimeSync(super.Build());return null;}
|
||||
public pbd::MessageDescriptor DescriptorForType {
|
||||
get { return TimeSync.Descriptor; } }
|
||||
public Builder ClearClientTime() { super.ClearClientTime();return this;}
|
||||
public const int ClientTimeFieldTag=9;
|
||||
public bool HasClientTime{ get {return super.HasClientTime&&PBJ._PBJ.ValidateTime(super.ClientTime);} }
|
||||
public PBJ.Time ClientTime{ get {
|
||||
if (HasClientTime) {
|
||||
return PBJ._PBJ.CastTime(super.ClientTime);
|
||||
} else {
|
||||
return PBJ._PBJ.CastTime();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.ClientTime=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearServerTime() { super.ClearServerTime();return this;}
|
||||
public const int ServerTimeFieldTag=10;
|
||||
public bool HasServerTime{ get {return super.HasServerTime&&PBJ._PBJ.ValidateTime(super.ServerTime);} }
|
||||
public PBJ.Time ServerTime{ get {
|
||||
if (HasServerTime) {
|
||||
return PBJ._PBJ.CastTime(super.ServerTime);
|
||||
} else {
|
||||
return PBJ._PBJ.CastTime();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.ServerTime=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearSyncRound() { super.ClearSyncRound();return this;}
|
||||
public const int SyncRoundFieldTag=11;
|
||||
public bool HasSyncRound{ get {return super.HasSyncRound&&PBJ._PBJ.ValidateUint64(super.SyncRound);} }
|
||||
public ulong SyncRound{ get {
|
||||
if (HasSyncRound) {
|
||||
return PBJ._PBJ.CastUint64(super.SyncRound);
|
||||
} else {
|
||||
return PBJ._PBJ.CastUint64();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.SyncRound=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
public Builder ClearReturnOptions() { super.ClearReturnOptions();return this;}
|
||||
public const int ReturnOptionsFieldTag=14;
|
||||
public bool HasReturnOptions { get {
|
||||
if (!super.HasReturnOptions) return false;
|
||||
return PBJ._PBJ.ValidateFlags(super.ReturnOptions,(ulong)Types.ReturnOptions.REPLY_RELIABLE|(ulong)Types.ReturnOptions.REPLY_ORDERED);
|
||||
} }
|
||||
public uint ReturnOptions{ get {
|
||||
if (HasReturnOptions) {
|
||||
return (uint)PBJ._PBJ.CastFlags(super.ReturnOptions,(ulong)Types.ReturnOptions.REPLY_RELIABLE|(ulong)Types.ReturnOptions.REPLY_ORDERED);
|
||||
} else {
|
||||
return (uint)PBJ._PBJ.CastFlags((ulong)Types.ReturnOptions.REPLY_RELIABLE|(ulong)Types.ReturnOptions.REPLY_ORDERED);
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.ReturnOptions=((value));
|
||||
}
|
||||
}
|
||||
public Builder ClearRoundTrip() { super.ClearRoundTrip();return this;}
|
||||
public const int RoundTripFieldTag=2561;
|
||||
public bool HasRoundTrip{ get {return super.HasRoundTrip&&PBJ._PBJ.ValidateTime(super.RoundTrip);} }
|
||||
public PBJ.Time RoundTrip{ get {
|
||||
if (HasRoundTrip) {
|
||||
return PBJ._PBJ.CastTime(super.RoundTrip);
|
||||
} else {
|
||||
return PBJ._PBJ.CastTime();
|
||||
}
|
||||
}
|
||||
set {
|
||||
super.RoundTrip=(PBJ._PBJ.Construct(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
139
OpenSim/Client/Sirikata/SirikataModule.cs
Normal file
139
OpenSim/Client/Sirikata/SirikataModule.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
// THIS MODULE USES CODE FROM SIRIKATA, THE SIRIKATA LICENSE IS BELOW
|
||||
/*
|
||||
Sirikata is Licensed using the revised BSD license.
|
||||
If you have any questions, contact Patrick Horn at <patrick.horn@gmail.com>
|
||||
|
||||
|
||||
Copyright (c) 2008, the Sirikata developers (see AUTHORS file for credit).
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Sirikata nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Client.Sirikata.ClientStack;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Client.Sirikata
|
||||
{
|
||||
class SirikataModule : IRegionModule
|
||||
{
|
||||
private bool m_enabled = false;
|
||||
|
||||
private TcpListener m_listener;
|
||||
private bool m_running = true;
|
||||
|
||||
private List<Scene> m_scenes = new List<Scene>();
|
||||
private Dictionary<UUID,SirikataClientView> m_clients = new Dictionary<UUID, SirikataClientView>();
|
||||
|
||||
#region Implementation of IRegionModule
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource source)
|
||||
{
|
||||
lock (m_scenes)
|
||||
m_scenes.Add(scene);
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (!m_enabled)
|
||||
return;
|
||||
|
||||
m_listener = new TcpListener(IPAddress.Any, 5943);
|
||||
|
||||
}
|
||||
|
||||
private void ListenLoop()
|
||||
{
|
||||
while (m_running)
|
||||
{
|
||||
m_listener.BeginAcceptTcpClient(AcceptSocket, m_listener);
|
||||
}
|
||||
}
|
||||
|
||||
private void AcceptSocket(IAsyncResult ar)
|
||||
{
|
||||
TcpListener listener = (TcpListener) ar.AsyncState;
|
||||
TcpClient client = listener.EndAcceptTcpClient(ar);
|
||||
|
||||
SirikataClientView clientView = new SirikataClientView(client);
|
||||
|
||||
lock (m_clients)
|
||||
m_clients.Add(clientView.SessionId, clientView);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Sirikata ClientStack Module"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
1210
OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
Normal file
1210
OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
Normal file
File diff suppressed because it is too large
Load Diff
133
OpenSim/Client/VWoHTTP/VWoHTTPModule.cs
Normal file
133
OpenSim/Client/VWoHTTP/VWoHTTPModule.cs
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Client.VWoHTTP.ClientStack;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Client.VWoHTTP
|
||||
{
|
||||
class VWoHTTPModule : IRegionModule, IHttpAgentHandler
|
||||
{
|
||||
private bool m_disabled = true;
|
||||
|
||||
private IHttpServer m_httpd;
|
||||
|
||||
private readonly List<Scene> m_scenes = new List<Scene>();
|
||||
|
||||
private Dictionary<UUID, VWHClientView> m_clients = new Dictionary<UUID, VWHClientView>();
|
||||
|
||||
#region Implementation of IRegionModule
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource source)
|
||||
{
|
||||
if (m_disabled)
|
||||
return;
|
||||
|
||||
m_scenes.Add(scene);
|
||||
|
||||
m_httpd = MainServer.Instance;
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (m_disabled)
|
||||
return;
|
||||
|
||||
m_httpd.AddAgentHandler("vwohttp", this);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (m_disabled)
|
||||
return;
|
||||
|
||||
m_httpd.RemoveAgentHandler("vwohttp", this);
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "VWoHTTP ClientStack"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IHttpAgentHandler
|
||||
|
||||
public bool Handle(OSHttpRequest req, OSHttpResponse resp)
|
||||
{
|
||||
string[] urlparts = req.Url.AbsolutePath.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (urlparts.Length < 2)
|
||||
return false;
|
||||
|
||||
if (urlparts[1] == "connect")
|
||||
{
|
||||
UUID sessID = UUID.Random();
|
||||
|
||||
VWHClientView client = new VWHClientView(sessID, UUID.Random(), "VWoHTTPClient", m_scenes[0]);
|
||||
|
||||
m_clients.Add(sessID, client);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (urlparts.Length < 3)
|
||||
return false;
|
||||
|
||||
UUID sessionID;
|
||||
if (!UUID.TryParse(urlparts[1], out sessionID))
|
||||
return false;
|
||||
|
||||
if (!m_clients.ContainsKey(sessionID))
|
||||
return false;
|
||||
|
||||
return m_clients[sessionID].ProcessInMsg(req, resp);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Match(OSHttpRequest req, OSHttpResponse resp)
|
||||
{
|
||||
return req.Url.ToString().Contains("vwohttp");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -29,11 +29,9 @@ using Nini.Config;
|
||||
using log4net;
|
||||
using System.Reflection;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Collections.Generic;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenMetaverse;
|
||||
|
||||
@@ -75,18 +73,9 @@ namespace OpenSim.ConsoleClient
|
||||
|
||||
Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/StartSession/", String.Format("USER={0}&PASS={1}", m_User, m_Pass), LoginReply);
|
||||
|
||||
string pidFile = serverConfig.GetString("PIDFile", String.Empty);
|
||||
int res = m_Server.Run();
|
||||
|
||||
while (m_Server.Running)
|
||||
{
|
||||
System.Threading.Thread.Sleep(500);
|
||||
// MainConsole.Instance.Prompt();
|
||||
}
|
||||
|
||||
if (pidFile != String.Empty)
|
||||
File.Delete(pidFile);
|
||||
|
||||
Environment.Exit(0);
|
||||
Environment.Exit(res);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -94,14 +83,13 @@ namespace OpenSim.ConsoleClient
|
||||
private static void SendCommand(string module, string[] cmd)
|
||||
{
|
||||
string sendCmd = "";
|
||||
string[] cmdlist = new string[cmd.Length - 1];
|
||||
|
||||
sendCmd = cmd[0];
|
||||
|
||||
if (cmd.Length > 1)
|
||||
{
|
||||
Array.Copy(cmd, 1, cmdlist, 0, cmd.Length - 1);
|
||||
sendCmd += " \"" + String.Join("\" \"", cmdlist) + "\"";
|
||||
sendCmd = cmd[0];
|
||||
|
||||
Array.Copy(cmd, 1, cmd, 0, cmd.Length-1);
|
||||
Array.Resize(ref cmd, cmd.Length-1);
|
||||
sendCmd += "\"" + String.Join("\" \"", cmd) + "\"";
|
||||
}
|
||||
|
||||
Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/SessionCommand/", String.Format("ID={0}&COMMAND={1}", m_SessionID, sendCmd), CommandReply);
|
||||
@@ -195,27 +183,16 @@ namespace OpenSim.ConsoleClient
|
||||
while (lines.Count > 100)
|
||||
lines.RemoveAt(0);
|
||||
|
||||
string prompt = String.Empty;
|
||||
|
||||
foreach (string l in lines)
|
||||
{
|
||||
string[] parts = l.Split(new char[] {':'}, 3);
|
||||
if (parts.Length != 3)
|
||||
continue;
|
||||
|
||||
if (parts[2].StartsWith("+++") || parts[2].StartsWith("-++"))
|
||||
prompt = parts[2];
|
||||
else
|
||||
MainConsole.Instance.Output(parts[2].Trim(), parts[1]);
|
||||
MainConsole.Instance.Output(parts[2].Trim(), parts[1]);
|
||||
}
|
||||
|
||||
|
||||
Requester.MakeRequest(requestUrl, requestData, ReadResponses);
|
||||
|
||||
if (prompt.StartsWith("+++"))
|
||||
MainConsole.Instance.ReadLine(prompt.Substring(3), true, true);
|
||||
else if (prompt.StartsWith("-++"))
|
||||
SendCommand(String.Empty, new string[] { MainConsole.Instance.ReadLine(prompt.Substring(3), false, true) });
|
||||
}
|
||||
|
||||
public static void CommandReply(string requestUrl, string requestData, string replyData)
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenSim.ConsoleClient
|
||||
|
||||
request.ContentType = "application/x-www-form-urlencoded";
|
||||
|
||||
byte[] buffer = Encoding.ASCII.GetBytes(data);
|
||||
byte[] buffer = new System.Text.ASCIIEncoding().GetBytes(data);
|
||||
int length = (int) buffer.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
|
||||
@@ -48,6 +48,5 @@ namespace OpenSim.Data
|
||||
public abstract void Initialise(string connect);
|
||||
public abstract void Initialise();
|
||||
public abstract void Dispose();
|
||||
public abstract bool Delete(string id);
|
||||
}
|
||||
}
|
||||
|
||||
155
OpenSim/Data/DataPluginFactory.cs
Normal file
155
OpenSim/Data/DataPluginFactory.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// A static class containing methods for obtaining handles to database
|
||||
/// storage objects.
|
||||
/// </summary>
|
||||
public static class DataPluginFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Based on <typeparam name="T" />, returns the appropriate
|
||||
/// PluginInitialiserBase instance in <paramref name="init" /> and
|
||||
/// extension point path in <paramref name="path" />.
|
||||
/// </summary>
|
||||
/// <param name="connect">
|
||||
/// The DB connection string used when creating a new
|
||||
/// PluginInitialiserBase, returned in <paramref name="init" />.
|
||||
/// </param>
|
||||
/// <param name="init">
|
||||
/// A reference to a PluginInitialiserBase object in which the proper
|
||||
/// initialiser will be returned.
|
||||
/// </param>
|
||||
/// <param name="path">
|
||||
/// A string in which the proper extension point path will be returned.
|
||||
/// </param>
|
||||
/// <typeparam name="T">
|
||||
/// The type of data plugin requested.
|
||||
/// </typeparam>
|
||||
/// <exception cref="NotImplementedException">
|
||||
/// Thrown if <typeparamref name="T" /> is not one of the expected data
|
||||
/// interfaces.
|
||||
/// </exception>
|
||||
private static void PluginLoaderParamFactory<T>(string connect, out PluginInitialiserBase init, out string path) where T : IPlugin
|
||||
{
|
||||
Type type = typeof(T);
|
||||
|
||||
if (type == typeof(IInventoryDataPlugin))
|
||||
{
|
||||
init = new InventoryDataInitialiser(connect);
|
||||
path = "/OpenSim/InventoryData";
|
||||
}
|
||||
else if (type == typeof(IUserDataPlugin))
|
||||
{
|
||||
init = new UserDataInitialiser(connect);
|
||||
path = "/OpenSim/UserData";
|
||||
}
|
||||
else if (type == typeof(IGridDataPlugin))
|
||||
{
|
||||
init = new GridDataInitialiser(connect);
|
||||
path = "/OpenSim/GridData";
|
||||
}
|
||||
else if (type == typeof(ILogDataPlugin))
|
||||
{
|
||||
init = new LogDataInitialiser(connect);
|
||||
path = "/OpenSim/LogData";
|
||||
}
|
||||
else if (type == typeof(IAssetDataPlugin))
|
||||
{
|
||||
init = new AssetDataInitialiser(connect);
|
||||
path = "/OpenSim/AssetData";
|
||||
}
|
||||
else
|
||||
{
|
||||
// We don't support this data plugin.
|
||||
throw new NotImplementedException(String.Format("The type '{0}' is not a valid data plugin.", type));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of new <typeparamref name="T" /> data plugins.
|
||||
/// Plugins will be requested in the order they were added.
|
||||
/// </summary>
|
||||
/// <param name="provider">
|
||||
/// The filename of the inventory server plugin DLL.
|
||||
/// </param>
|
||||
/// <param name="connect">
|
||||
/// The connection string for the storage backend.
|
||||
/// </param>
|
||||
/// <typeparam name="T">
|
||||
/// The type of data plugin requested.
|
||||
/// </typeparam>
|
||||
/// <returns>
|
||||
/// A list of all loaded plugins matching <typeparamref name="T" />.
|
||||
/// </returns>
|
||||
public static List<T> LoadDataPlugins<T>(string provider, string connect) where T : IPlugin
|
||||
{
|
||||
PluginInitialiserBase pluginInitialiser;
|
||||
string extensionPointPath;
|
||||
|
||||
PluginLoaderParamFactory<T>(connect, out pluginInitialiser, out extensionPointPath);
|
||||
|
||||
using (PluginLoader<T> loader = new PluginLoader<T>(pluginInitialiser))
|
||||
{
|
||||
// loader will try to load all providers (MySQL, MSSQL, etc)
|
||||
// unless it is constrainted to the correct "Provider" entry in the addin.xml
|
||||
loader.Add(extensionPointPath, new PluginProviderFilter(provider));
|
||||
loader.Load();
|
||||
|
||||
return loader.Plugins;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a new <typeparamref name="T" /> data plugin instance if
|
||||
/// only one was loaded, otherwise returns null (<c>default(T)</c>).
|
||||
/// </summary>
|
||||
/// <param name="provider">
|
||||
/// The filename of the inventory server plugin DLL.
|
||||
/// </param>
|
||||
/// <param name="connect">
|
||||
/// The connection string for the storage backend.
|
||||
/// </param>
|
||||
/// <typeparam name="T">
|
||||
/// The type of data plugin requested.
|
||||
/// </typeparam>
|
||||
/// <returns>
|
||||
/// A list of all loaded plugins matching <typeparamref name="T" />.
|
||||
/// </returns>
|
||||
public static T LoadDataPlugin<T>(string provider, string connect) where T : IPlugin
|
||||
{
|
||||
List<T> plugins = LoadDataPlugins<T>(provider, connect);
|
||||
return (plugins.Count == 1) ? plugins[0] : default(T);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,21 +27,26 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// This interface exists to distinguish between the normal IAssetDataPlugin and the one used by XAssetService
|
||||
/// for now.
|
||||
/// </summary>
|
||||
public interface IXAssetDataPlugin : IPlugin
|
||||
public abstract class GridDataBase : IGridDataPlugin
|
||||
{
|
||||
AssetBase GetAsset(UUID uuid);
|
||||
void StoreAsset(AssetBase asset);
|
||||
bool ExistsAsset(UUID uuid);
|
||||
List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
|
||||
void Initialise(string connect);
|
||||
bool Delete(string id);
|
||||
public abstract RegionProfileData GetProfileByHandle(ulong regionHandle);
|
||||
public abstract RegionProfileData GetProfileByUUID(UUID UUID);
|
||||
public abstract RegionProfileData GetProfileByString(string regionName);
|
||||
public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
|
||||
public abstract List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum);
|
||||
public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
|
||||
public abstract DataResponse StoreProfile(RegionProfileData profile);
|
||||
public abstract ReservationData GetReservationAtPoint(uint x, uint y);
|
||||
public abstract DataResponse DeleteProfile(string uuid);
|
||||
|
||||
public abstract void Initialise();
|
||||
public abstract void Initialise(string connect);
|
||||
public abstract void Dispose();
|
||||
|
||||
public abstract string Name { get; }
|
||||
public abstract string Version { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,16 @@ namespace OpenSim.Data
|
||||
bool ExistsAsset(UUID uuid);
|
||||
List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
|
||||
void Initialise(string connect);
|
||||
bool Delete(string id);
|
||||
}
|
||||
|
||||
public class AssetDataInitialiser : PluginInitialiserBase
|
||||
{
|
||||
private string connect;
|
||||
public AssetDataInitialiser (string s) { connect = s; }
|
||||
public override void Initialise (IPlugin plugin)
|
||||
{
|
||||
IAssetDataPlugin p = plugin as IAssetDataPlugin;
|
||||
p.Initialise (connect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
134
OpenSim/Data/IGridData.cs
Normal file
134
OpenSim/Data/IGridData.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Data
|
||||
{
|
||||
public enum DataResponse
|
||||
{
|
||||
RESPONSE_OK,
|
||||
RESPONSE_AUTHREQUIRED,
|
||||
RESPONSE_INVALIDCREDENTIALS,
|
||||
RESPONSE_ERROR
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A standard grid interface
|
||||
/// </summary>
|
||||
public interface IGridDataPlugin : IPlugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Initialises the interface
|
||||
/// </summary>
|
||||
void Initialise(string connect);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a sim profile from a regionHandle
|
||||
/// </summary>
|
||||
/// <param name="regionHandle">A 64bit Region Handle</param>
|
||||
/// <returns>A simprofile</returns>
|
||||
RegionProfileData GetProfileByHandle(ulong regionHandle);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a sim profile from a UUID
|
||||
/// </summary>
|
||||
/// <param name="UUID">A 128bit UUID</param>
|
||||
/// <returns>A sim profile</returns>
|
||||
RegionProfileData GetProfileByUUID(UUID UUID);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a sim profile from a string match
|
||||
/// </summary>
|
||||
/// <param name="regionName">A string for a partial region name match</param>
|
||||
/// <returns>A sim profile</returns>
|
||||
RegionProfileData GetProfileByString(string regionName);
|
||||
|
||||
/// <summary>
|
||||
/// Returns all profiles within the specified range
|
||||
/// </summary>
|
||||
/// <param name="Xmin">Minimum sim coordinate (X)</param>
|
||||
/// <param name="Ymin">Minimum sim coordinate (Y)</param>
|
||||
/// <param name="Xmax">Maximum sim coordinate (X)</param>
|
||||
/// <param name="Ymin">Maximum sim coordinate (Y)</param>
|
||||
/// <returns>An array containing all the sim profiles in the specified range</returns>
|
||||
RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
|
||||
|
||||
/// <summary>
|
||||
/// Returns up to maxNum profiles of regions that have a name starting with namePrefix
|
||||
/// </summary>
|
||||
/// <param name="name">The name to match against</param>
|
||||
/// <param name="maxNum">Maximum number of profiles to return</param>
|
||||
/// <returns>A list of sim profiles</returns>
|
||||
List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum);
|
||||
|
||||
/// <summary>
|
||||
/// Authenticates a sim by use of its recv key.
|
||||
/// WARNING: Insecure
|
||||
/// </summary>
|
||||
/// <param name="UUID">The UUID sent by the sim</param>
|
||||
/// <param name="regionHandle">The regionhandle sent by the sim</param>
|
||||
/// <param name="simrecvkey">The receiving key sent by the sim</param>
|
||||
/// <returns>Whether the sim has been authenticated</returns>
|
||||
bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
|
||||
|
||||
/// <summary>
|
||||
/// Adds or updates a profile in the database
|
||||
/// </summary>
|
||||
/// <param name="profile">The profile to add</param>
|
||||
/// <returns>RESPONSE_OK if successful, error if not.</returns>
|
||||
DataResponse StoreProfile(RegionProfileData profile);
|
||||
|
||||
/// <summary>
|
||||
/// Remove a profile from the database
|
||||
/// </summary>
|
||||
/// <param name="UUID">ID of profile to remove</param>
|
||||
/// <returns></returns>
|
||||
DataResponse DeleteProfile(string UUID);
|
||||
|
||||
/// <summary>
|
||||
/// Function not used????
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
ReservationData GetReservationAtPoint(uint x, uint y);
|
||||
}
|
||||
|
||||
public class GridDataInitialiser : PluginInitialiserBase
|
||||
{
|
||||
private string connect;
|
||||
public GridDataInitialiser (string s) { connect = s; }
|
||||
public override void Initialise (IPlugin plugin)
|
||||
{
|
||||
IGridDataPlugin p = plugin as IGridDataPlugin;
|
||||
p.Initialise (connect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -155,4 +155,15 @@ namespace OpenSim.Data
|
||||
/// </returns>
|
||||
List<InventoryItemBase> fetchActiveGestures(UUID avatarID);
|
||||
}
|
||||
|
||||
public class InventoryDataInitialiser : PluginInitialiserBase
|
||||
{
|
||||
private string connect;
|
||||
public InventoryDataInitialiser (string s) { connect = s; }
|
||||
public override void Initialise (IPlugin plugin)
|
||||
{
|
||||
IInventoryDataPlugin p = plugin as IInventoryDataPlugin;
|
||||
p.Initialise (connect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,43 +25,63 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
namespace OpenSim.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides methods from manipulating media-on-a-prim
|
||||
/// The severity of an individual log message
|
||||
/// </summary>
|
||||
public interface IMoapModule
|
||||
public enum LogSeverity : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the media entry for a given prim face.
|
||||
/// Critical: systems failure
|
||||
/// </summary>
|
||||
/// A copy of the media entry is returned rather than the original, so this can be altered at will without
|
||||
/// affecting the original settings.
|
||||
/// <param name="part"></param>
|
||||
/// <param name="face"></param>
|
||||
/// <returns></returns>
|
||||
MediaEntry GetMediaEntry(SceneObjectPart part, int face);
|
||||
|
||||
CRITICAL = 1,
|
||||
/// <summary>
|
||||
/// Set the media entry for a given prim face.
|
||||
/// Major: warning prior to systems failure
|
||||
/// </summary>
|
||||
/// <param name="SceneObjectPart"></param>
|
||||
/// <param name="face"></param>
|
||||
/// <param name="me"></param>
|
||||
void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me);
|
||||
|
||||
MAJOR = 2,
|
||||
/// <summary>
|
||||
/// Clear the media entry for a given prim face.
|
||||
/// Medium: an individual non-critical task failed
|
||||
/// </summary>
|
||||
///
|
||||
/// This is the equivalent of setting a media entry of null
|
||||
///
|
||||
/// <param name="part"></param>
|
||||
/// <param name="face">/param>
|
||||
void ClearMediaEntry(SceneObjectPart part, int face);
|
||||
MEDIUM = 3,
|
||||
/// <summary>
|
||||
/// Low: Informational warning
|
||||
/// </summary>
|
||||
LOW = 4,
|
||||
/// <summary>
|
||||
/// Info: Information
|
||||
/// </summary>
|
||||
INFO = 5,
|
||||
/// <summary>
|
||||
/// Verbose: Debug Information
|
||||
/// </summary>
|
||||
VERBOSE = 6
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An interface to a LogData storage system
|
||||
/// </summary>
|
||||
public interface ILogDataPlugin : IPlugin
|
||||
{
|
||||
void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
|
||||
string logMessage);
|
||||
|
||||
/// <summary>
|
||||
/// Initialises the interface
|
||||
/// </summary>
|
||||
void Initialise(string connect);
|
||||
}
|
||||
|
||||
public class LogDataInitialiser : PluginInitialiserBase
|
||||
{
|
||||
private string connect;
|
||||
public LogDataInitialiser (string s) { connect = s; }
|
||||
public override void Initialise (IPlugin plugin)
|
||||
{
|
||||
ILogDataPlugin p = plugin as ILogDataPlugin;
|
||||
p.Initialise (connect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,26 +32,25 @@ using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Data
|
||||
{
|
||||
// This MUST be a ref type!
|
||||
public class PresenceData
|
||||
public struct PresenceData
|
||||
{
|
||||
public string UserID;
|
||||
public UUID RegionID;
|
||||
public UUID SessionID;
|
||||
public UUID UUID;
|
||||
public UUID currentRegion;
|
||||
public Dictionary<string, string> Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An interface for connecting to the presence datastore
|
||||
/// An interface for connecting to the authentication datastore
|
||||
/// </summary>
|
||||
public interface IPresenceData
|
||||
{
|
||||
bool Store(PresenceData data);
|
||||
|
||||
PresenceData Get(UUID sessionID);
|
||||
void LogoutRegionAgents(UUID regionID);
|
||||
bool ReportAgent(UUID sessionID, UUID regionID);
|
||||
PresenceData[] Get(string field, string data);
|
||||
bool Delete(string field, string val);
|
||||
PresenceData Get(UUID principalID);
|
||||
|
||||
bool SetUserDataItem(UUID principalID, string item, string value);
|
||||
bool SetRegionDataItem(UUID principalID, string item, string value);
|
||||
|
||||
bool Delete(UUID regionID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,30 +37,10 @@ namespace OpenSim.Data
|
||||
public UUID RegionID;
|
||||
public UUID ScopeID;
|
||||
public string RegionName;
|
||||
|
||||
/// <summary>
|
||||
/// The position in meters of this region.
|
||||
/// </summary>
|
||||
public int posX;
|
||||
|
||||
/// <summary>
|
||||
/// The position in meters of this region.
|
||||
/// </summary>
|
||||
public int posY;
|
||||
|
||||
public int sizeX;
|
||||
public int sizeY;
|
||||
|
||||
/// <summary>
|
||||
/// Return the x-coordinate of this region.
|
||||
/// </summary>
|
||||
public int coordX { get { return posX / (int)Constants.RegionSize; } }
|
||||
|
||||
/// <summary>
|
||||
/// Return the y-coordinate of this region.
|
||||
/// </summary>
|
||||
public int coordY { get { return posY / (int)Constants.RegionSize; } }
|
||||
|
||||
public Dictionary<string, object> Data;
|
||||
}
|
||||
|
||||
@@ -80,45 +60,5 @@ namespace OpenSim.Data
|
||||
|
||||
bool Delete(UUID regionID);
|
||||
|
||||
List<RegionData> GetDefaultRegions(UUID scopeID);
|
||||
List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y);
|
||||
List<RegionData> GetHyperlinks(UUID scopeID);
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum RegionFlags : int
|
||||
{
|
||||
DefaultRegion = 1, // Used for new Rez. Random if multiple defined
|
||||
FallbackRegion = 2, // Regions we redirect to when the destination is down
|
||||
RegionOnline = 4, // Set when a region comes online, unset when it unregisters and DeleteOnUnregister is false
|
||||
NoDirectLogin = 8, // Region unavailable for direct logins (by name)
|
||||
Persistent = 16, // Don't remove on unregister
|
||||
LockedOut = 32, // Don't allow registration
|
||||
NoMove = 64, // Don't allow moving this region
|
||||
Reservation = 128, // This is an inactive reservation
|
||||
Authenticate = 256, // Require authentication
|
||||
Hyperlink = 512 // Record represents a HG link
|
||||
}
|
||||
|
||||
public class RegionDataDistanceCompare : IComparer<RegionData>
|
||||
{
|
||||
private Vector2 m_origin;
|
||||
|
||||
public RegionDataDistanceCompare(int x, int y)
|
||||
{
|
||||
m_origin = new Vector2(x, y);
|
||||
}
|
||||
|
||||
public int Compare(RegionData regionA, RegionData regionB)
|
||||
{
|
||||
Vector2 vectorA = new Vector2(regionA.posX, regionA.posY);
|
||||
Vector2 vectorB = new Vector2(regionB.posX, regionB.posY);
|
||||
return Math.Sign(VectorDistance(m_origin, vectorA) - VectorDistance(m_origin, vectorB));
|
||||
}
|
||||
|
||||
private float VectorDistance(Vector2 x, Vector2 y)
|
||||
{
|
||||
return (x - y).Length();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
100
OpenSim/Data/IRegionProfileService.cs
Normal file
100
OpenSim/Data/IRegionProfileService.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Data
|
||||
{
|
||||
public interface IRegionProfileService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a region by argument
|
||||
/// </summary>
|
||||
/// <param name="uuid">A UUID key of the region to return</param>
|
||||
/// <returns>A SimProfileData for the region</returns>
|
||||
RegionProfileData GetRegion(UUID uuid);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a region by argument
|
||||
/// </summary>
|
||||
/// <param name="uuid">A regionHandle of the region to return</param>
|
||||
/// <returns>A SimProfileData for the region</returns>
|
||||
RegionProfileData GetRegion(ulong handle);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a region by argument
|
||||
/// </summary>
|
||||
/// <param name="regionName">A partial regionName of the region to return</param>
|
||||
/// <returns>A SimProfileData for the region</returns>
|
||||
RegionProfileData GetRegion(string regionName);
|
||||
|
||||
List<RegionProfileData> GetRegions(uint xmin, uint ymin, uint xmax, uint ymax);
|
||||
List<RegionProfileData> GetRegions(string name, int maxNum);
|
||||
DataResponse AddUpdateRegion(RegionProfileData sim, RegionProfileData existingSim);
|
||||
DataResponse DeleteRegion(string uuid);
|
||||
}
|
||||
|
||||
public interface IRegionProfileRouter
|
||||
{
|
||||
/// <summary>
|
||||
/// Request sim profile information from a grid server, by Region UUID
|
||||
/// </summary>
|
||||
/// <param name="regionId">The region UUID to look for</param>
|
||||
/// <param name="gridserverUrl"></param>
|
||||
/// <param name="gridserverSendkey"></param>
|
||||
/// <param name="gridserverRecvkey"></param>
|
||||
/// <returns>The sim profile. Null if there was a request failure</returns>
|
||||
/// <remarks>This method should be statics</remarks>
|
||||
RegionProfileData RequestSimProfileData(UUID regionId, Uri gridserverUrl,
|
||||
string gridserverSendkey, string gridserverRecvkey);
|
||||
|
||||
/// <summary>
|
||||
/// Request sim profile information from a grid server, by Region Handle
|
||||
/// </summary>
|
||||
/// <param name="regionHandle">the region handle to look for</param>
|
||||
/// <param name="gridserverUrl"></param>
|
||||
/// <param name="gridserverSendkey"></param>
|
||||
/// <param name="gridserverRecvkey"></param>
|
||||
/// <returns>The sim profile. Null if there was a request failure</returns>
|
||||
RegionProfileData RequestSimProfileData(ulong regionHandle, Uri gridserverUrl,
|
||||
string gridserverSendkey, string gridserverRecvkey);
|
||||
|
||||
/// <summary>
|
||||
/// Request sim profile information from a grid server, by Region Name
|
||||
/// </summary>
|
||||
/// <param name="regionName">the region name to look for</param>
|
||||
/// <param name="gridserverUrl"></param>
|
||||
/// <param name="gridserverSendkey"></param>
|
||||
/// <param name="gridserverRecvkey"></param>
|
||||
/// <returns>The sim profile. Null if there was a request failure</returns>
|
||||
RegionProfileData RequestSimProfileData(string regionName, Uri gridserverUrl,
|
||||
string gridserverSendkey, string gridserverRecvkey);
|
||||
}
|
||||
}
|
||||
@@ -36,19 +36,20 @@ namespace OpenSim.Data
|
||||
{
|
||||
public UUID PrincipalID;
|
||||
public UUID ScopeID;
|
||||
public string FirstName;
|
||||
public string LastName;
|
||||
public Dictionary<string, string> Data;
|
||||
public Dictionary<string, object> Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An interface for connecting to the user accounts datastore
|
||||
/// An interface for connecting to the authentication datastore
|
||||
/// </summary>
|
||||
public interface IUserAccountData
|
||||
{
|
||||
UserAccountData[] Get(string[] fields, string[] values);
|
||||
UserAccountData Get(UUID principalID, UUID ScopeID);
|
||||
|
||||
List<UserAccountData> Query(UUID principalID, UUID ScopeID, string query);
|
||||
|
||||
bool Store(UserAccountData data);
|
||||
bool Delete(string field, string val);
|
||||
UserAccountData[] GetUsers(UUID scopeID, string query);
|
||||
|
||||
bool SetDataItem(UUID principalID, string item, string value);
|
||||
}
|
||||
}
|
||||
|
||||
209
OpenSim/Data/IUserData.cs
Normal file
209
OpenSim/Data/IUserData.cs
Normal file
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// An interface for connecting to user storage servers.
|
||||
/// </summary>
|
||||
public interface IUserDataPlugin : IPlugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a user profile from a database via their UUID
|
||||
/// </summary>
|
||||
/// <param name="user">The user's UUID</param>
|
||||
/// <returns>The user data profile. Returns null if no user is found</returns>
|
||||
UserProfileData GetUserByUUID(UUID user);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a users profile by searching their username parts
|
||||
/// </summary>
|
||||
/// <param name="fname">Account firstname</param>
|
||||
/// <param name="lname">Account lastname</param>
|
||||
/// <returns>The user data profile. Null if no user is found</returns>
|
||||
UserProfileData GetUserByName(string fname, string lname);
|
||||
|
||||
/// <summary>
|
||||
/// Get a user from a given uri.
|
||||
/// </summary>
|
||||
/// <param name="uri"></param>
|
||||
/// <returns>The user data profile. Null if no user is found.</returns>
|
||||
UserProfileData GetUserByUri(Uri uri);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of UUIDs firstnames and lastnames that match string query entered into the avatar picker.
|
||||
/// </summary>
|
||||
/// <param name="queryID">ID associated with the user's query. This must match what the client sent</param>
|
||||
/// <param name="query">The filtered contents of the search box when the user hit search.</param>
|
||||
/// <returns>A list of user details. If there are no results than either an empty list or null</returns>
|
||||
List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the current agent for a user searching by it's UUID
|
||||
/// </summary>
|
||||
/// <param name="user">The users UUID</param>
|
||||
/// <returns>The current agent session. Null if no session was found</returns>
|
||||
UserAgentData GetAgentByUUID(UUID user);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the current session agent for a user searching by username
|
||||
/// </summary>
|
||||
/// <param name="name">The users account name</param>
|
||||
/// <returns>The current agent session</returns>
|
||||
UserAgentData GetAgentByName(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the current session agent for a user searching by username parts
|
||||
/// </summary>
|
||||
/// <param name="fname">The users first account name</param>
|
||||
/// <param name="lname">The users account surname</param>
|
||||
/// <returns>The current agent session</returns>
|
||||
UserAgentData GetAgentByName(string fname, string lname);
|
||||
|
||||
/// <summary>
|
||||
/// Stores new web-login key for user during web page login
|
||||
/// </summary>
|
||||
/// <param name="webLoginKey"></param>
|
||||
void StoreWebLoginKey(UUID agentID, UUID webLoginKey);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new User profile to the database
|
||||
/// </summary>
|
||||
/// <param name="user">UserProfile to add</param>
|
||||
void AddNewUserProfile(UserProfileData user);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a temporary user profile. A temporary userprofile is one that should exist only for the lifetime of
|
||||
/// the process.
|
||||
/// </summary>
|
||||
/// <param name="userProfile"></param>
|
||||
void AddTemporaryUserProfile(UserProfileData userProfile);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing user profile
|
||||
/// </summary>
|
||||
/// <param name="user">UserProfile to update</param>
|
||||
bool UpdateUserProfile(UserProfileData user);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new agent to the database
|
||||
/// </summary>
|
||||
/// <param name="agent">The agent to add</param>
|
||||
void AddNewUserAgent(UserAgentData agent);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new friend to the database for XUser
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">The agent that who's friends list is being added to</param>
|
||||
/// <param name="friend">The agent that being added to the friends list of the friends list owner</param>
|
||||
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
|
||||
void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms);
|
||||
|
||||
/// <summary>
|
||||
/// Delete friend on friendlistowner's friendlist.
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">The agent that who's friends list is being updated</param>
|
||||
/// <param name="friend">The Ex-friend agent</param>
|
||||
void RemoveUserFriend(UUID friendlistowner, UUID friend);
|
||||
|
||||
/// <summary>
|
||||
/// Update permissions for friend on friendlistowner's friendlist.
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">The agent that who's friends list is being updated</param>
|
||||
/// <param name="friend">The agent that is getting or loosing permissions</param>
|
||||
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
|
||||
void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
|
||||
/// <returns>The user's friends. If there are no results than either an empty list or null</returns>
|
||||
List<FriendListItem> GetUserFriendList(UUID friendlistowner);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of <see cref="FriendRegionInfo/>s for the specified UUIDs.
|
||||
/// </summary>
|
||||
/// <param name="uuids">
|
||||
/// A <see cref="List"/> of <see cref="UUID/>s to fetch info for
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A <see cref="Dictionary"/>, mapping the <see cref="UUID"/>s to <see cref="FriendRegionInfo"/>s.
|
||||
/// </returns>
|
||||
Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES)
|
||||
/// </summary>
|
||||
/// <param name="from">The account to transfer from</param>
|
||||
/// <param name="to">The account to transfer to</param>
|
||||
/// <param name="amount">The amount to transfer</param>
|
||||
/// <returns>Successful?</returns>
|
||||
bool MoneyTransferRequest(UUID from, UUID to, uint amount);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account.
|
||||
/// </summary>
|
||||
/// <param name="from">User to transfer from</param>
|
||||
/// <param name="to">User to transfer to</param>
|
||||
/// <param name="inventory">Specified inventory item</param>
|
||||
/// <returns>Successful?</returns>
|
||||
bool InventoryTransferRequest(UUID from, UUID to, UUID inventory);
|
||||
|
||||
/// <summary>
|
||||
/// Initialises the plugin (artificial constructor)
|
||||
/// </summary>
|
||||
void Initialise(string connect);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user appearance
|
||||
/// </summer>
|
||||
AvatarAppearance GetUserAppearance(UUID user);
|
||||
|
||||
void UpdateUserAppearance(UUID user, AvatarAppearance appearance);
|
||||
|
||||
void ResetAttachments(UUID userID);
|
||||
|
||||
void LogoutUsers(UUID regionID);
|
||||
}
|
||||
|
||||
public class UserDataInitialiser : PluginInitialiserBase
|
||||
{
|
||||
private string connect;
|
||||
public UserDataInitialiser (string s) { connect = s; }
|
||||
public override void Initialise (IPlugin plugin)
|
||||
{
|
||||
IUserDataPlugin p = plugin as IUserDataPlugin;
|
||||
p.Initialise (connect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,11 +40,6 @@ namespace OpenSim.Data
|
||||
public UUID folderID;
|
||||
public UUID agentID;
|
||||
public UUID parentFolderID;
|
||||
|
||||
public XInventoryFolder Clone()
|
||||
{
|
||||
return (XInventoryFolder)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
||||
public class XInventoryItem
|
||||
@@ -56,24 +51,19 @@ namespace OpenSim.Data
|
||||
public int inventoryNextPermissions;
|
||||
public int inventoryCurrentPermissions;
|
||||
public int invType;
|
||||
public string creatorID;
|
||||
public UUID creatorID;
|
||||
public int inventoryBasePermissions;
|
||||
public int inventoryEveryOnePermissions;
|
||||
public int salePrice;
|
||||
public int saleType;
|
||||
public int creationDate;
|
||||
public UUID groupID;
|
||||
public int groupOwned;
|
||||
public bool groupOwned;
|
||||
public int flags;
|
||||
public UUID inventoryID;
|
||||
public UUID avatarID;
|
||||
public UUID parentFolderID;
|
||||
public int inventoryGroupPermissions;
|
||||
|
||||
public XInventoryItem Clone()
|
||||
{
|
||||
return (XInventoryItem)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
||||
public interface IXInventoryData
|
||||
@@ -84,38 +74,9 @@ namespace OpenSim.Data
|
||||
bool StoreFolder(XInventoryFolder folder);
|
||||
bool StoreItem(XInventoryItem item);
|
||||
|
||||
/// <summary>
|
||||
/// Delete folders where field == val
|
||||
/// </summary>
|
||||
/// <param name="field"></param>
|
||||
/// <param name="val"></param>
|
||||
/// <returns>true if the delete was successful, false if it was not</returns>
|
||||
bool DeleteFolders(string field, string val);
|
||||
|
||||
/// <summary>
|
||||
/// Delete folders where field1 == val1, field2 == val2...
|
||||
/// </summary>
|
||||
/// <param name="fields"></param>
|
||||
/// <param name="vals"></param>
|
||||
/// <returns>true if the delete was successful, false if it was not</returns>
|
||||
bool DeleteFolders(string[] fields, string[] vals);
|
||||
|
||||
/// <summary>
|
||||
/// Delete items where field == val
|
||||
/// </summary>
|
||||
/// <param name="field"></param>
|
||||
/// <param name="val"></param>
|
||||
/// <returns>true if the delete was successful, false if it was not</returns>
|
||||
bool DeleteItems(string field, string val);
|
||||
|
||||
/// <summary>
|
||||
/// Delete items where field1 == val1, field2 == val2...
|
||||
/// </summary>
|
||||
/// <param name="fields"></param>
|
||||
/// <param name="vals"></param>
|
||||
/// <returns>true if the delete was successful, false if it was not</returns>
|
||||
bool DeleteItems(string[] fields, string[] vals);
|
||||
|
||||
bool MoveItem(string id, string newParent);
|
||||
XInventoryItem[] GetActiveGestures(UUID principalID);
|
||||
int GetAssetPermissions(UUID principalID, UUID assetID);
|
||||
|
||||
219
OpenSim/Data/MSSQL/AutoClosingSqlCommand.cs
Normal file
219
OpenSim/Data/MSSQL/AutoClosingSqlCommand.cs
Normal file
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
/// <summary>
|
||||
/// Encapsulates a SqlCommand object but ensures that when it is disposed, its connection is closed and disposed also.
|
||||
/// </summary>
|
||||
internal class AutoClosingSqlCommand : IDbCommand
|
||||
{
|
||||
private SqlCommand realCommand;
|
||||
|
||||
public AutoClosingSqlCommand(SqlCommand cmd)
|
||||
{
|
||||
realCommand = cmd;
|
||||
}
|
||||
|
||||
#region IDbCommand Members
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
realCommand.Cancel();
|
||||
}
|
||||
|
||||
public string CommandText
|
||||
{
|
||||
get
|
||||
{
|
||||
return realCommand.CommandText;
|
||||
}
|
||||
set
|
||||
{
|
||||
realCommand.CommandText = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int CommandTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return realCommand.CommandTimeout;
|
||||
}
|
||||
set
|
||||
{
|
||||
realCommand.CommandTimeout = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CommandType CommandType
|
||||
{
|
||||
get
|
||||
{
|
||||
return realCommand.CommandType;
|
||||
}
|
||||
set
|
||||
{
|
||||
realCommand.CommandType = value;
|
||||
}
|
||||
}
|
||||
|
||||
IDbConnection IDbCommand.Connection
|
||||
{
|
||||
get
|
||||
{
|
||||
return realCommand.Connection;
|
||||
}
|
||||
set
|
||||
{
|
||||
realCommand.Connection = (SqlConnection) value;
|
||||
}
|
||||
}
|
||||
|
||||
public SqlConnection Connection
|
||||
{
|
||||
get
|
||||
{
|
||||
return realCommand.Connection;
|
||||
}
|
||||
}
|
||||
|
||||
IDbDataParameter IDbCommand.CreateParameter()
|
||||
{
|
||||
return realCommand.CreateParameter();
|
||||
}
|
||||
|
||||
public SqlParameter CreateParameter()
|
||||
{
|
||||
return realCommand.CreateParameter();
|
||||
}
|
||||
|
||||
public int ExecuteNonQuery()
|
||||
{
|
||||
return realCommand.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
IDataReader IDbCommand.ExecuteReader(CommandBehavior behavior)
|
||||
{
|
||||
return realCommand.ExecuteReader(behavior);
|
||||
}
|
||||
|
||||
public SqlDataReader ExecuteReader(CommandBehavior behavior)
|
||||
{
|
||||
return realCommand.ExecuteReader(behavior);
|
||||
}
|
||||
|
||||
IDataReader IDbCommand.ExecuteReader()
|
||||
{
|
||||
return realCommand.ExecuteReader();
|
||||
}
|
||||
|
||||
public SqlDataReader ExecuteReader()
|
||||
{
|
||||
return realCommand.ExecuteReader();
|
||||
}
|
||||
|
||||
public object ExecuteScalar()
|
||||
{
|
||||
return realCommand.ExecuteScalar();
|
||||
}
|
||||
|
||||
IDataParameterCollection IDbCommand.Parameters
|
||||
{
|
||||
get { return realCommand.Parameters; }
|
||||
}
|
||||
|
||||
public SqlParameterCollection Parameters
|
||||
{
|
||||
get { return realCommand.Parameters; }
|
||||
}
|
||||
|
||||
public void Prepare()
|
||||
{
|
||||
realCommand.Prepare();
|
||||
}
|
||||
|
||||
// IDbTransaction IDbCommand.Transaction
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return realCommand.Transaction;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// realCommand.Transaction = (SqlTransaction) value;
|
||||
// }
|
||||
// }
|
||||
|
||||
public IDbTransaction Transaction
|
||||
{
|
||||
get { return realCommand.Transaction; }
|
||||
set { realCommand.Transaction = (SqlTransaction)value; }
|
||||
}
|
||||
|
||||
UpdateRowSource IDbCommand.UpdatedRowSource
|
||||
{
|
||||
get
|
||||
{
|
||||
return realCommand.UpdatedRowSource;
|
||||
}
|
||||
set
|
||||
{
|
||||
realCommand.UpdatedRowSource = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
SqlConnection conn = realCommand.Connection;
|
||||
try
|
||||
{
|
||||
realCommand.Dispose();
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,6 @@ namespace OpenSim.Data.MSSQL
|
||||
/// Database manager
|
||||
/// </summary>
|
||||
private MSSQLManager m_database;
|
||||
private string m_connectionString;
|
||||
|
||||
#region IPlugin Members
|
||||
|
||||
@@ -76,8 +75,23 @@ namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
m_ticksToEpoch = new System.DateTime(1970, 1, 1).Ticks;
|
||||
|
||||
m_database = new MSSQLManager(connectionString);
|
||||
m_connectionString = connectionString;
|
||||
if (!string.IsNullOrEmpty(connectionString))
|
||||
{
|
||||
m_database = new MSSQLManager(connectionString);
|
||||
}
|
||||
else
|
||||
{
|
||||
IniFile gridDataMSSqlFile = new IniFile("mssql_connection.ini");
|
||||
string settingDataSource = gridDataMSSqlFile.ParseFileReadValue("data_source");
|
||||
string settingInitialCatalog = gridDataMSSqlFile.ParseFileReadValue("initial_catalog");
|
||||
string settingPersistSecurityInfo = gridDataMSSqlFile.ParseFileReadValue("persist_security_info");
|
||||
string settingUserId = gridDataMSSqlFile.ParseFileReadValue("user_id");
|
||||
string settingPassword = gridDataMSSqlFile.ParseFileReadValue("password");
|
||||
|
||||
m_database =
|
||||
new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
|
||||
settingPassword);
|
||||
}
|
||||
|
||||
//New migration to check for DB changes
|
||||
m_database.CheckMigration(_migrationStore);
|
||||
@@ -111,26 +125,22 @@ namespace OpenSim.Data.MSSQL
|
||||
override public AssetBase GetAsset(UUID assetID)
|
||||
{
|
||||
string sql = "SELECT * FROM assets WHERE id = @id";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
using (AutoClosingSqlCommand command = m_database.Query(sql))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("id", assetID));
|
||||
conn.Open();
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
command.Parameters.Add(m_database.CreateParameter("id", assetID));
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
AssetBase asset = new AssetBase(
|
||||
DBGuid.FromDB(reader["id"]),
|
||||
new UUID((Guid)reader["id"]),
|
||||
(string)reader["name"],
|
||||
Convert.ToSByte(reader["assetType"]),
|
||||
reader["creatorid"].ToString()
|
||||
Convert.ToSByte(reader["assetType"])
|
||||
);
|
||||
// Region Main
|
||||
asset.Description = (string)reader["description"];
|
||||
asset.Local = Convert.ToBoolean(reader["local"]);
|
||||
asset.Temporary = Convert.ToBoolean(reader["temporary"]);
|
||||
asset.Flags = (AssetFlags)(Convert.ToInt32(reader["asset_flags"]));
|
||||
asset.Data = (byte[])reader["data"];
|
||||
return asset;
|
||||
}
|
||||
@@ -145,19 +155,26 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <param name="asset">the asset</param>
|
||||
override public void StoreAsset(AssetBase asset)
|
||||
{
|
||||
|
||||
string sql =
|
||||
@"IF EXISTS(SELECT * FROM assets WHERE id=@id)
|
||||
UPDATE assets set name = @name, description = @description, assetType = @assetType,
|
||||
local = @local, temporary = @temporary, creatorid = @creatorid, data = @data
|
||||
WHERE id=@id
|
||||
ELSE
|
||||
INSERT INTO assets
|
||||
([id], [name], [description], [assetType], [local],
|
||||
[temporary], [create_time], [access_time], [creatorid], [asset_flags], [data])
|
||||
VALUES
|
||||
(@id, @name, @description, @assetType, @local,
|
||||
@temporary, @create_time, @access_time, @creatorid, @asset_flags, @data)";
|
||||
if (ExistsAsset(asset.FullID))
|
||||
UpdateAsset(asset);
|
||||
else
|
||||
InsertAsset(asset);
|
||||
}
|
||||
|
||||
|
||||
private void InsertAsset(AssetBase asset)
|
||||
{
|
||||
if (ExistsAsset(asset.FullID))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string sql = @"INSERT INTO assets
|
||||
([id], [name], [description], [assetType], [local],
|
||||
[temporary], [create_time], [access_time], [data])
|
||||
VALUES
|
||||
(@id, @name, @description, @assetType, @local,
|
||||
@temporary, @create_time, @access_time, @data)";
|
||||
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
@@ -173,8 +190,7 @@ namespace OpenSim.Data.MSSQL
|
||||
m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add");
|
||||
}
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand command = new SqlCommand(sql, conn))
|
||||
using (AutoClosingSqlCommand command = m_database.Query(sql))
|
||||
{
|
||||
int now = (int)((System.DateTime.Now.Ticks - m_ticksToEpoch) / 10000000);
|
||||
command.Parameters.Add(m_database.CreateParameter("id", asset.FullID));
|
||||
@@ -185,21 +201,64 @@ namespace OpenSim.Data.MSSQL
|
||||
command.Parameters.Add(m_database.CreateParameter("temporary", asset.Temporary));
|
||||
command.Parameters.Add(m_database.CreateParameter("access_time", now));
|
||||
command.Parameters.Add(m_database.CreateParameter("create_time", now));
|
||||
command.Parameters.Add(m_database.CreateParameter("asset_flags", (int)asset.Flags));
|
||||
command.Parameters.Add(m_database.CreateParameter("creatorid", asset.Metadata.CreatorID));
|
||||
command.Parameters.Add(m_database.CreateParameter("data", asset.Data));
|
||||
conn.Open();
|
||||
|
||||
try
|
||||
{
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
m_log.Error("[ASSET DB]: Error storing item :" + e.Message);
|
||||
m_log.Error("[ASSET DB]: Error inserting item :" + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update asset in m_database
|
||||
/// </summary>
|
||||
/// <param name="asset">the asset</param>
|
||||
private void UpdateAsset(AssetBase asset)
|
||||
{
|
||||
string sql = @"UPDATE assets set id = @id, name = @name, description = @description, assetType = @assetType,
|
||||
local = @local, temporary = @temporary, data = @data
|
||||
WHERE id = @keyId;";
|
||||
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
{
|
||||
assetName = asset.Name.Substring(0, 64);
|
||||
m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on update");
|
||||
}
|
||||
|
||||
string assetDescription = asset.Description;
|
||||
if (asset.Description.Length > 64)
|
||||
{
|
||||
assetDescription = asset.Description.Substring(0, 64);
|
||||
m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on update");
|
||||
}
|
||||
|
||||
using (AutoClosingSqlCommand command = m_database.Query(sql))
|
||||
{
|
||||
command.Parameters.Add(m_database.CreateParameter("id", asset.FullID));
|
||||
command.Parameters.Add(m_database.CreateParameter("name", assetName));
|
||||
command.Parameters.Add(m_database.CreateParameter("description", assetDescription));
|
||||
command.Parameters.Add(m_database.CreateParameter("assetType", asset.Type));
|
||||
command.Parameters.Add(m_database.CreateParameter("local", asset.Local));
|
||||
command.Parameters.Add(m_database.CreateParameter("temporary", asset.Temporary));
|
||||
command.Parameters.Add(m_database.CreateParameter("data", asset.Data));
|
||||
command.Parameters.Add(m_database.CreateParameter("@keyId", asset.FullID));
|
||||
|
||||
try
|
||||
{
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Commented out since currently unused - this probably should be called in GetAsset()
|
||||
// private void UpdateAccessTime(AssetBase asset)
|
||||
@@ -245,34 +304,25 @@ namespace OpenSim.Data.MSSQL
|
||||
public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
|
||||
{
|
||||
List<AssetMetadata> retList = new List<AssetMetadata>(count);
|
||||
string sql = @"WITH OrderedAssets AS
|
||||
(
|
||||
SELECT id, name, description, assetType, temporary, creatorid,
|
||||
RowNumber = ROW_NUMBER() OVER (ORDER BY id)
|
||||
FROM assets
|
||||
)
|
||||
SELECT *
|
||||
FROM OrderedAssets
|
||||
WHERE RowNumber BETWEEN @start AND @stop;";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
string sql = @"SELECT (name,description,assetType,temporary,id), Row = ROW_NUMBER()
|
||||
OVER (ORDER BY (some column to order by))
|
||||
WHERE Row >= @Start AND Row < @Start + @Count";
|
||||
|
||||
using (AutoClosingSqlCommand command = m_database.Query(sql))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("start", start));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("stop", start + count - 1));
|
||||
conn.Open();
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
command.Parameters.Add(m_database.CreateParameter("start", start));
|
||||
command.Parameters.Add(m_database.CreateParameter("count", count));
|
||||
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
AssetMetadata metadata = new AssetMetadata();
|
||||
metadata.FullID = DBGuid.FromDB(reader["id"]);
|
||||
metadata.FullID = new UUID((Guid)reader["id"]);
|
||||
metadata.Name = (string)reader["name"];
|
||||
metadata.Description = (string)reader["description"];
|
||||
metadata.Type = Convert.ToSByte(reader["assetType"]);
|
||||
metadata.Temporary = Convert.ToBoolean(reader["temporary"]);
|
||||
metadata.CreatorID = (string)reader["creatorid"];
|
||||
retList.Add(metadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -280,10 +330,6 @@ namespace OpenSim.Data.MSSQL
|
||||
return retList;
|
||||
}
|
||||
|
||||
public override bool Delete(string id)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
conn.Open();
|
||||
Migration m = new Migration(conn, GetType().Assembly, "AuthStore");
|
||||
m_database = new MSSQLManager(m_ConnectionString);
|
||||
m.Update();
|
||||
}
|
||||
}
|
||||
@@ -169,14 +168,13 @@ namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
if (System.Environment.TickCount - m_LastExpire > 30000)
|
||||
DoExpire();
|
||||
|
||||
string sql = "insert into tokens (UUID, token, validity) values (@principalID, @token, @lifetime)";
|
||||
string sql = "insert into tokens (UUID, token, validity) values (@principalID, @token, date_add(now(), interval @lifetime minute))";
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@principalID", principalID));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@token", token));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@lifetime", DateTime.Now.AddMinutes(lifetime)));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@lifetime", lifetime));
|
||||
conn.Open();
|
||||
|
||||
if (cmd.ExecuteNonQuery() > 0)
|
||||
@@ -191,15 +189,13 @@ namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
if (System.Environment.TickCount - m_LastExpire > 30000)
|
||||
DoExpire();
|
||||
|
||||
DateTime validDate = DateTime.Now.AddMinutes(lifetime);
|
||||
string sql = "update tokens set validity = @validDate where UUID = @principalID and token = @token and validity > GetDate()";
|
||||
string sql = "update tokens set validity = date_add(now(), interval @lifetime minute) where UUID = @principalID and token = @token and validity > now()";
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@principalID", principalID));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@token", token));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@validDate", validDate));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@lifetime", lifetime));
|
||||
conn.Open();
|
||||
|
||||
if (cmd.ExecuteNonQuery() > 0)
|
||||
@@ -212,13 +208,11 @@ namespace OpenSim.Data.MSSQL
|
||||
|
||||
private void DoExpire()
|
||||
{
|
||||
DateTime currentDateTime = DateTime.Now;
|
||||
string sql = "delete from tokens where validity < @currentDateTime";
|
||||
string sql = "delete from tokens where validity < now()";
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
conn.Open();
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@currentDateTime", currentDateTime));
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
m_LastExpire = System.Environment.TickCount;
|
||||
|
||||
@@ -37,28 +37,19 @@ using OpenSim.Region.Framework.Interfaces;
|
||||
|
||||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
public class MSSQLEstateStore : IEstateDataStore
|
||||
public class MSSQLEstateData : IEstateDataStore
|
||||
{
|
||||
private const string _migrationStore = "EstateStore";
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog _Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private MSSQLManager _Database;
|
||||
private string m_connectionString;
|
||||
|
||||
private FieldInfo[] _Fields;
|
||||
private Dictionary<string, FieldInfo> _FieldMap = new Dictionary<string, FieldInfo>();
|
||||
|
||||
#region Public methods
|
||||
|
||||
public MSSQLEstateStore()
|
||||
{
|
||||
}
|
||||
|
||||
public MSSQLEstateStore(string connectionString)
|
||||
{
|
||||
Initialise(connectionString);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialises the estatedata class.
|
||||
/// </summary>
|
||||
@@ -67,17 +58,25 @@ namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
if (!string.IsNullOrEmpty(connectionString))
|
||||
{
|
||||
m_connectionString = connectionString;
|
||||
_Database = new MSSQLManager(connectionString);
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO when can this be deleted
|
||||
IniFile iniFile = new IniFile("mssql_connection.ini");
|
||||
string settingDataSource = iniFile.ParseFileReadValue("data_source");
|
||||
string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog");
|
||||
string settingPersistSecurityInfo = iniFile.ParseFileReadValue("persist_security_info");
|
||||
string settingUserId = iniFile.ParseFileReadValue("user_id");
|
||||
string settingPassword = iniFile.ParseFileReadValue("password");
|
||||
|
||||
_Database =
|
||||
new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
|
||||
settingPassword);
|
||||
}
|
||||
|
||||
//Migration settings
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
Migration m = new Migration(conn, GetType().Assembly, "EstateStore");
|
||||
m.Update();
|
||||
}
|
||||
_Database.CheckMigration(_migrationStore);
|
||||
|
||||
//Interesting way to get parameters! Maybe implement that also with other types
|
||||
Type t = typeof(EstateSettings);
|
||||
@@ -97,48 +96,40 @@ namespace OpenSim.Data.MSSQL
|
||||
/// </summary>
|
||||
/// <param name="regionID">region ID.</param>
|
||||
/// <returns></returns>
|
||||
public EstateSettings LoadEstateSettings(UUID regionID, bool create)
|
||||
public EstateSettings LoadEstateSettings(UUID regionID)
|
||||
{
|
||||
EstateSettings es = new EstateSettings();
|
||||
|
||||
string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) + " from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = @RegionID";
|
||||
|
||||
bool insertEstate = false;
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
|
||||
using (AutoClosingSqlCommand cmd = _Database.Query(sql))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@RegionID", regionID));
|
||||
conn.Open();
|
||||
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
foreach (string name in FieldList)
|
||||
{
|
||||
FieldInfo f = _FieldMap[name];
|
||||
object v = reader[name];
|
||||
if (f.FieldType == typeof(bool))
|
||||
if (_FieldMap[name].GetValue(es) is bool)
|
||||
{
|
||||
f.SetValue(es, Convert.ToInt32(v) != 0);
|
||||
int v = Convert.ToInt32(reader[name]);
|
||||
if (v != 0)
|
||||
_FieldMap[name].SetValue(es, true);
|
||||
else
|
||||
_FieldMap[name].SetValue(es, false);
|
||||
}
|
||||
else if (f.FieldType == typeof(UUID))
|
||||
else if (_FieldMap[name].GetValue(es) is UUID)
|
||||
{
|
||||
f.SetValue(es, new UUID((Guid)v)); // uuid);
|
||||
}
|
||||
else if (f.FieldType == typeof(string))
|
||||
{
|
||||
f.SetValue(es, v.ToString());
|
||||
}
|
||||
else if (f.FieldType == typeof(UInt32))
|
||||
{
|
||||
f.SetValue(es, Convert.ToUInt32(v));
|
||||
}
|
||||
else if (f.FieldType == typeof(Single))
|
||||
{
|
||||
f.SetValue(es, Convert.ToSingle(v));
|
||||
_FieldMap[name].SetValue(es, new UUID((Guid) reader[name])); // uuid);
|
||||
}
|
||||
else
|
||||
f.SetValue(es, v);
|
||||
{
|
||||
es.EstateID = Convert.ToUInt32(reader["EstateID"].ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -148,10 +139,70 @@ namespace OpenSim.Data.MSSQL
|
||||
}
|
||||
}
|
||||
|
||||
if (insertEstate && create)
|
||||
|
||||
if (insertEstate)
|
||||
{
|
||||
DoCreate(es);
|
||||
LinkRegion(regionID, (int)es.EstateID);
|
||||
List<string> names = new List<string>(FieldList);
|
||||
|
||||
names.Remove("EstateID");
|
||||
|
||||
sql = string.Format("insert into estate_settings ({0}) values ( @{1})", String.Join(",", names.ToArray()), String.Join(", @", names.ToArray()));
|
||||
|
||||
//_Log.Debug("[DB ESTATE]: SQL: " + sql);
|
||||
using (SqlConnection connection = _Database.DatabaseConnection())
|
||||
{
|
||||
using (SqlCommand insertCommand = connection.CreateCommand())
|
||||
{
|
||||
insertCommand.CommandText = sql + " SET @ID = SCOPE_IDENTITY()";
|
||||
|
||||
foreach (string name in names)
|
||||
{
|
||||
insertCommand.Parameters.Add(_Database.CreateParameter("@" + name, _FieldMap[name].GetValue(es)));
|
||||
}
|
||||
SqlParameter idParameter = new SqlParameter("@ID", SqlDbType.Int);
|
||||
idParameter.Direction = ParameterDirection.Output;
|
||||
insertCommand.Parameters.Add(idParameter);
|
||||
|
||||
insertCommand.ExecuteNonQuery();
|
||||
|
||||
es.EstateID = Convert.ToUInt32(idParameter.Value);
|
||||
}
|
||||
}
|
||||
|
||||
using (AutoClosingSqlCommand cmd = _Database.Query("INSERT INTO [estate_map] ([RegionID] ,[EstateID]) VALUES (@RegionID, @EstateID)"))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@RegionID", regionID));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID));
|
||||
// This will throw on dupe key
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_Log.DebugFormat("[ESTATE DB]: Error inserting regionID and EstateID in estate_map: {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// Munge and transfer the ban list
|
||||
|
||||
sql = string.Format("insert into estateban select {0}, bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = @UUID", es.EstateID);
|
||||
using (AutoClosingSqlCommand cmd = _Database.Query(sql))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@UUID", regionID));
|
||||
try
|
||||
{
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_Log.Debug("[ESTATE DB]: Error setting up estateban from regionban");
|
||||
}
|
||||
}
|
||||
|
||||
//TODO check if this is needed??
|
||||
es.Save();
|
||||
}
|
||||
|
||||
LoadBanList(es);
|
||||
@@ -165,53 +216,6 @@ namespace OpenSim.Data.MSSQL
|
||||
return es;
|
||||
}
|
||||
|
||||
public EstateSettings CreateNewEstate()
|
||||
{
|
||||
EstateSettings es = new EstateSettings();
|
||||
es.OnSave += StoreEstateSettings;
|
||||
|
||||
DoCreate(es);
|
||||
|
||||
LoadBanList(es);
|
||||
|
||||
es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
|
||||
es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
|
||||
es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups");
|
||||
|
||||
return es;
|
||||
}
|
||||
|
||||
private void DoCreate(EstateSettings es)
|
||||
{
|
||||
List<string> names = new List<string>(FieldList);
|
||||
|
||||
names.Remove("EstateID");
|
||||
|
||||
string sql = string.Format("insert into estate_settings ({0}) values ( @{1})", String.Join(",", names.ToArray()), String.Join(", @", names.ToArray()));
|
||||
|
||||
//_Log.Debug("[DB ESTATE]: SQL: " + sql);
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand insertCommand = new SqlCommand(sql, conn))
|
||||
{
|
||||
insertCommand.CommandText = sql + " SET @ID = SCOPE_IDENTITY()";
|
||||
|
||||
foreach (string name in names)
|
||||
{
|
||||
insertCommand.Parameters.Add(_Database.CreateParameter("@" + name, _FieldMap[name].GetValue(es)));
|
||||
}
|
||||
SqlParameter idParameter = new SqlParameter("@ID", SqlDbType.Int);
|
||||
idParameter.Direction = ParameterDirection.Output;
|
||||
insertCommand.Parameters.Add(idParameter);
|
||||
conn.Open();
|
||||
insertCommand.ExecuteNonQuery();
|
||||
|
||||
es.EstateID = Convert.ToUInt32(idParameter.Value);
|
||||
}
|
||||
|
||||
//TODO check if this is needed??
|
||||
es.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores the estate settings.
|
||||
/// </summary>
|
||||
@@ -222,7 +226,7 @@ namespace OpenSim.Data.MSSQL
|
||||
|
||||
names.Remove("EstateID");
|
||||
|
||||
string sql = string.Format("UPDATE estate_settings SET ");
|
||||
string sql = string.Format("UPDATE estate_settings SET ") ;
|
||||
foreach (string name in names)
|
||||
{
|
||||
sql += name + " = @" + name + ", ";
|
||||
@@ -230,8 +234,7 @@ namespace OpenSim.Data.MSSQL
|
||||
sql = sql.Remove(sql.LastIndexOf(","));
|
||||
sql += " WHERE EstateID = @EstateID";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
using (AutoClosingSqlCommand cmd = _Database.Query(sql))
|
||||
{
|
||||
foreach (string name in names)
|
||||
{
|
||||
@@ -239,7 +242,6 @@ namespace OpenSim.Data.MSSQL
|
||||
}
|
||||
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID));
|
||||
conn.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
@@ -264,13 +266,12 @@ namespace OpenSim.Data.MSSQL
|
||||
|
||||
string sql = "select bannedUUID from estateban where EstateID = @EstateID";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
using (AutoClosingSqlCommand cmd = _Database.Query(sql))
|
||||
{
|
||||
SqlParameter idParameter = new SqlParameter("@EstateID", SqlDbType.Int);
|
||||
idParameter.Value = es.EstateID;
|
||||
cmd.Parameters.Add(idParameter);
|
||||
conn.Open();
|
||||
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
@@ -292,11 +293,10 @@ namespace OpenSim.Data.MSSQL
|
||||
|
||||
string sql = string.Format("select uuid from {0} where EstateID = @EstateID", table);
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
using (AutoClosingSqlCommand cmd = _Database.Query(sql))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@EstateID", estateID));
|
||||
conn.Open();
|
||||
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
@@ -312,266 +312,58 @@ namespace OpenSim.Data.MSSQL
|
||||
private void SaveBanList(EstateSettings es)
|
||||
{
|
||||
//Delete first
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
string sql = "delete from estateban where EstateID = @EstateID";
|
||||
using (AutoClosingSqlCommand cmd = _Database.Query(sql))
|
||||
{
|
||||
conn.Open();
|
||||
using (SqlCommand cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from estateban where EstateID = @EstateID";
|
||||
cmd.Parameters.AddWithValue("@EstateID", (int)es.EstateID);
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID));
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
//Insert after
|
||||
cmd.CommandText = "insert into estateban (EstateID, bannedUUID,bannedIp, bannedIpHostMask, bannedNameMask) values ( @EstateID, @bannedUUID, '','','' )";
|
||||
cmd.Parameters.AddWithValue("@bannedUUID", Guid.Empty);
|
||||
foreach (EstateBan b in es.EstateBans)
|
||||
{
|
||||
cmd.Parameters["@bannedUUID"].Value = b.BannedUserID.Guid;
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
//Insert after
|
||||
sql = "insert into estateban (EstateID, bannedUUID) values ( @EstateID, @bannedUUID )";
|
||||
using (AutoClosingSqlCommand cmd = _Database.Query(sql))
|
||||
{
|
||||
foreach (EstateBan b in es.EstateBans)
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@bannedUUID", b.BannedUserID));
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveUUIDList(uint estateID, string table, UUID[] data)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
//Delete first
|
||||
string sql = string.Format("delete from {0} where EstateID = @EstateID", table);
|
||||
using (AutoClosingSqlCommand cmd = _Database.Query(sql))
|
||||
{
|
||||
conn.Open();
|
||||
using (SqlCommand cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@EstateID", (int)estateID);
|
||||
cmd.CommandText = string.Format("delete from {0} where EstateID = @EstateID", table);
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@EstateID", estateID));
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
cmd.CommandText = string.Format("insert into {0} (EstateID, uuid) values ( @EstateID, @uuid )", table);
|
||||
cmd.Parameters.AddWithValue("@uuid", Guid.Empty);
|
||||
foreach (UUID uuid in data)
|
||||
sql = string.Format("insert into {0} (EstateID, uuid) values ( @EstateID, @uuid )", table);
|
||||
using (AutoClosingSqlCommand cmd = _Database.Query(sql))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@EstateID", estateID));
|
||||
|
||||
bool createParamOnce = true;
|
||||
|
||||
foreach (UUID uuid in data)
|
||||
{
|
||||
if (createParamOnce)
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@uuid", uuid));
|
||||
createParamOnce = false;
|
||||
}
|
||||
else
|
||||
cmd.Parameters["@uuid"].Value = uuid.Guid; //.ToString(); //TODO check if this works
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EstateSettings LoadEstateSettings(int estateID)
|
||||
{
|
||||
EstateSettings es = new EstateSettings();
|
||||
string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) + " from estate_settings where EstateID = @EstateID";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@EstateID", (int)estateID);
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
foreach (string name in FieldList)
|
||||
{
|
||||
FieldInfo f = _FieldMap[name];
|
||||
object v = reader[name];
|
||||
if (f.FieldType == typeof(bool))
|
||||
{
|
||||
f.SetValue(es, Convert.ToInt32(v) != 0);
|
||||
}
|
||||
else if (f.FieldType == typeof(UUID))
|
||||
{
|
||||
f.SetValue(es, new UUID((Guid)v)); // uuid);
|
||||
}
|
||||
else if (f.FieldType == typeof(string))
|
||||
{
|
||||
f.SetValue(es, v.ToString());
|
||||
}
|
||||
else if (f.FieldType == typeof(UInt32))
|
||||
{
|
||||
f.SetValue(es, Convert.ToUInt32(v));
|
||||
}
|
||||
else if (f.FieldType == typeof(Single))
|
||||
{
|
||||
f.SetValue(es, Convert.ToSingle(v));
|
||||
}
|
||||
else
|
||||
f.SetValue(es, v);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
LoadBanList(es);
|
||||
|
||||
es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
|
||||
es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
|
||||
es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups");
|
||||
|
||||
//Set event
|
||||
es.OnSave += StoreEstateSettings;
|
||||
return es;
|
||||
|
||||
}
|
||||
|
||||
public List<EstateSettings> LoadEstateSettingsAll()
|
||||
{
|
||||
List<EstateSettings> allEstateSettings = new List<EstateSettings>();
|
||||
|
||||
List<int> allEstateIds = GetEstatesAll();
|
||||
|
||||
foreach (int estateId in allEstateIds)
|
||||
allEstateSettings.Add(LoadEstateSettings(estateId));
|
||||
|
||||
return allEstateSettings;
|
||||
}
|
||||
|
||||
public List<int> GetEstates(string search)
|
||||
{
|
||||
List<int> result = new List<int>();
|
||||
string sql = "select estateID from estate_settings where EstateName = @EstateName";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@EstateName", search);
|
||||
|
||||
using (IDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
result.Add(Convert.ToInt32(reader["EstateID"]));
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<int> GetEstatesAll()
|
||||
{
|
||||
List<int> result = new List<int>();
|
||||
string sql = "select estateID from estate_settings";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
using (IDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
result.Add(Convert.ToInt32(reader["EstateID"]));
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<int> GetEstatesByOwner(UUID ownerID)
|
||||
{
|
||||
List<int> result = new List<int>();
|
||||
string sql = "select estateID from estate_settings where EstateOwner = @EstateOwner";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@EstateOwner", ownerID);
|
||||
|
||||
using (IDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
result.Add(Convert.ToInt32(reader["EstateID"]));
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool LinkRegion(UUID regionID, int estateID)
|
||||
{
|
||||
string deleteSQL = "delete from estate_map where RegionID = @RegionID";
|
||||
string insertSQL = "insert into estate_map values (@RegionID, @EstateID)";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
SqlTransaction transaction = conn.BeginTransaction();
|
||||
|
||||
try
|
||||
{
|
||||
using (SqlCommand cmd = new SqlCommand(deleteSQL, conn))
|
||||
{
|
||||
cmd.Transaction = transaction;
|
||||
cmd.Parameters.AddWithValue("@RegionID", regionID.Guid);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
using (SqlCommand cmd = new SqlCommand(insertSQL, conn))
|
||||
{
|
||||
cmd.Transaction = transaction;
|
||||
cmd.Parameters.AddWithValue("@RegionID", regionID.Guid);
|
||||
cmd.Parameters.AddWithValue("@EstateID", estateID);
|
||||
|
||||
int ret = cmd.ExecuteNonQuery();
|
||||
|
||||
if (ret != 0)
|
||||
transaction.Commit();
|
||||
else
|
||||
transaction.Rollback();
|
||||
|
||||
return (ret != 0);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Error("[REGION DB]: LinkRegion failed: " + ex.Message);
|
||||
transaction.Rollback();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<UUID> GetRegions(int estateID)
|
||||
{
|
||||
List<UUID> result = new List<UUID>();
|
||||
string sql = "select RegionID from estate_map where EstateID = @EstateID";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@EstateID", estateID);
|
||||
|
||||
using (IDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
result.Add(DBGuid.FromDB(reader["RegionID"]));
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool DeleteEstate(int estateID)
|
||||
{
|
||||
// TODO: Implementation!
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ''AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using System.Data.SqlClient;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
public class MSSQLFriendsData : MSSQLGenericTableHandler<FriendsData>, IFriendsData
|
||||
{
|
||||
public MSSQLFriendsData(string connectionString, string realm)
|
||||
: base(connectionString, realm, "FriendsStore")
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
{
|
||||
conn.Open();
|
||||
Migration m = new Migration(conn, GetType().Assembly, "FriendsStore");
|
||||
m.Update();
|
||||
}
|
||||
}
|
||||
|
||||
public bool Delete(UUID principalID, string friend)
|
||||
{
|
||||
return Delete(principalID.ToString(), friend);
|
||||
}
|
||||
|
||||
public bool Delete(string principalID, string friend)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("delete from {0} where PrincipalID = @PrincipalID and Friend = @Friend", m_Realm);
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@PrincipalID", principalID.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@Friend", friend));
|
||||
cmd.Connection = conn;
|
||||
conn.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public FriendsData[] GetFriends(UUID principalID)
|
||||
{
|
||||
return GetFriends(principalID.ToString());
|
||||
}
|
||||
|
||||
public FriendsData[] GetFriends(string principalID)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
|
||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = @PrincipalID", m_Realm);
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@PrincipalID", principalID.ToString()));
|
||||
cmd.Connection = conn;
|
||||
conn.Open();
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public FriendsData[] GetFriends(Guid principalID)
|
||||
{
|
||||
return GetFriends(principalID.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,384 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using System.Data.SqlClient;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
public class MSSQLGenericTableHandler<T> where T : class, new()
|
||||
{
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected string m_ConnectionString;
|
||||
protected MSSQLManager m_database; //used for parameter type translation
|
||||
protected Dictionary<string, FieldInfo> m_Fields =
|
||||
new Dictionary<string, FieldInfo>();
|
||||
|
||||
protected List<string> m_ColumnNames = null;
|
||||
protected string m_Realm;
|
||||
protected FieldInfo m_DataField = null;
|
||||
|
||||
public MSSQLGenericTableHandler(string connectionString,
|
||||
string realm, string storeName)
|
||||
{
|
||||
m_Realm = realm;
|
||||
|
||||
m_ConnectionString = connectionString;
|
||||
|
||||
if (storeName != String.Empty)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
{
|
||||
conn.Open();
|
||||
Migration m = new Migration(conn, GetType().Assembly, storeName);
|
||||
m.Update();
|
||||
}
|
||||
|
||||
}
|
||||
m_database = new MSSQLManager(m_ConnectionString);
|
||||
|
||||
Type t = typeof(T);
|
||||
FieldInfo[] fields = t.GetFields(BindingFlags.Public |
|
||||
BindingFlags.Instance |
|
||||
BindingFlags.DeclaredOnly);
|
||||
|
||||
if (fields.Length == 0)
|
||||
return;
|
||||
|
||||
foreach (FieldInfo f in fields)
|
||||
{
|
||||
if (f.Name != "Data")
|
||||
m_Fields[f.Name] = f;
|
||||
else
|
||||
m_DataField = f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void CheckColumnNames(SqlDataReader reader)
|
||||
{
|
||||
if (m_ColumnNames != null)
|
||||
return;
|
||||
|
||||
m_ColumnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = reader.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
{
|
||||
if (row["ColumnName"] != null &&
|
||||
(!m_Fields.ContainsKey(row["ColumnName"].ToString())))
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> GetConstraints()
|
||||
{
|
||||
List<string> constraints = new List<string>();
|
||||
string query = string.Format(@"SELECT
|
||||
COL_NAME(ic.object_id,ic.column_id) AS column_name
|
||||
FROM sys.indexes AS i
|
||||
INNER JOIN sys.index_columns AS ic
|
||||
ON i.object_id = ic.object_id AND i.index_id = ic.index_id
|
||||
WHERE i.is_primary_key = 1
|
||||
AND i.object_id = OBJECT_ID('{0}');", m_Realm);
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(query, conn))
|
||||
{
|
||||
conn.Open();
|
||||
using (SqlDataReader rdr = cmd.ExecuteReader())
|
||||
{
|
||||
while (rdr.Read())
|
||||
{
|
||||
// query produces 0 to many rows of single column, so always add the first item in each row
|
||||
constraints.Add((string)rdr[0]);
|
||||
}
|
||||
}
|
||||
return constraints;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual T[] Get(string field, string key)
|
||||
{
|
||||
return Get(new string[] { field }, new string[] { key });
|
||||
}
|
||||
|
||||
public virtual T[] Get(string[] fields, string[] keys)
|
||||
{
|
||||
if (fields.Length != keys.Length)
|
||||
return new T[0];
|
||||
|
||||
List<string> terms = new List<string>();
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
|
||||
for (int i = 0; i < fields.Length; i++)
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter(fields[i], keys[i]));
|
||||
terms.Add("[" + fields[i] + "] = @" + fields[i]);
|
||||
}
|
||||
|
||||
string where = String.Join(" AND ", terms.ToArray());
|
||||
|
||||
string query = String.Format("SELECT * FROM {0} WHERE {1}",
|
||||
m_Realm, where);
|
||||
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = query;
|
||||
conn.Open();
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
protected T[] DoQuery(SqlCommand cmd)
|
||||
{
|
||||
List<T> result = new List<T>();
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if (reader == null)
|
||||
return new T[0];
|
||||
|
||||
CheckColumnNames(reader);
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
T row = new T();
|
||||
|
||||
foreach (string name in m_Fields.Keys)
|
||||
{
|
||||
if (m_Fields[name].GetValue(row) is bool)
|
||||
{
|
||||
int v = Convert.ToInt32(reader[name]);
|
||||
m_Fields[name].SetValue(row, v != 0 ? true : false);
|
||||
}
|
||||
else if (m_Fields[name].GetValue(row) is UUID)
|
||||
{
|
||||
UUID uuid = UUID.Zero;
|
||||
|
||||
UUID.TryParse(reader[name].ToString(), out uuid);
|
||||
m_Fields[name].SetValue(row, uuid);
|
||||
}
|
||||
else if (m_Fields[name].GetValue(row) is int)
|
||||
{
|
||||
int v = Convert.ToInt32(reader[name]);
|
||||
m_Fields[name].SetValue(row, v);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Fields[name].SetValue(row, reader[name]);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_DataField != null)
|
||||
{
|
||||
Dictionary<string, string> data =
|
||||
new Dictionary<string, string>();
|
||||
|
||||
foreach (string col in m_ColumnNames)
|
||||
{
|
||||
data[col] = reader[col].ToString();
|
||||
if (data[col] == null)
|
||||
data[col] = String.Empty;
|
||||
}
|
||||
|
||||
m_DataField.SetValue(row, data);
|
||||
}
|
||||
|
||||
result.Add(row);
|
||||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual T[] Get(string where)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
|
||||
string query = String.Format("SELECT * FROM {0} WHERE {1}",
|
||||
m_Realm, where);
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = query;
|
||||
|
||||
//m_log.WarnFormat("[MSSQLGenericTable]: SELECT {0} WHERE {1}", m_Realm, where);
|
||||
|
||||
conn.Open();
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Store(T row)
|
||||
{
|
||||
List<string> constraintFields = GetConstraints();
|
||||
List<KeyValuePair<string, string>> constraints = new List<KeyValuePair<string, string>>();
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
|
||||
StringBuilder query = new StringBuilder();
|
||||
List<String> names = new List<String>();
|
||||
List<String> values = new List<String>();
|
||||
|
||||
foreach (FieldInfo fi in m_Fields.Values)
|
||||
{
|
||||
names.Add(fi.Name);
|
||||
values.Add("@" + fi.Name);
|
||||
// Temporarily return more information about what field is unexpectedly null for
|
||||
// http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the
|
||||
// InventoryTransferModule or we may be required to substitute a DBNull here.
|
||||
if (fi.GetValue(row) == null)
|
||||
throw new NullReferenceException(
|
||||
string.Format(
|
||||
"[MSSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null",
|
||||
fi.Name, row));
|
||||
|
||||
if (constraintFields.Count > 0 && constraintFields.Contains(fi.Name))
|
||||
{
|
||||
constraints.Add(new KeyValuePair<string, string>(fi.Name, fi.GetValue(row).ToString()));
|
||||
}
|
||||
cmd.Parameters.Add(m_database.CreateParameter(fi.Name, fi.GetValue(row).ToString()));
|
||||
}
|
||||
|
||||
if (m_DataField != null)
|
||||
{
|
||||
Dictionary<string, string> data =
|
||||
(Dictionary<string, string>)m_DataField.GetValue(row);
|
||||
|
||||
foreach (KeyValuePair<string, string> kvp in data)
|
||||
{
|
||||
if (constraintFields.Count > 0 && constraintFields.Contains(kvp.Key))
|
||||
{
|
||||
constraints.Add(new KeyValuePair<string, string>(kvp.Key, kvp.Key));
|
||||
}
|
||||
names.Add(kvp.Key);
|
||||
values.Add("@" + kvp.Key);
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@" + kvp.Key, kvp.Value));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
query.AppendFormat("UPDATE {0} SET ", m_Realm);
|
||||
int i = 0;
|
||||
for (i = 0; i < names.Count - 1; i++)
|
||||
{
|
||||
query.AppendFormat("[{0}] = {1}, ", names[i], values[i]);
|
||||
}
|
||||
query.AppendFormat("[{0}] = {1} ", names[i], values[i]);
|
||||
if (constraints.Count > 0)
|
||||
{
|
||||
List<string> terms = new List<string>();
|
||||
for (int j = 0; j < constraints.Count; j++)
|
||||
{
|
||||
terms.Add(" [" + constraints[j].Key + "] = @" + constraints[j].Key);
|
||||
}
|
||||
string where = String.Join(" AND ", terms.ToArray());
|
||||
query.AppendFormat(" WHERE {0} ", where);
|
||||
|
||||
}
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = query.ToString();
|
||||
|
||||
conn.Open();
|
||||
if (cmd.ExecuteNonQuery() > 0)
|
||||
{
|
||||
//m_log.WarnFormat("[MSSQLGenericTable]: Updating {0}", m_Realm);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// assume record has not yet been inserted
|
||||
|
||||
query = new StringBuilder();
|
||||
query.AppendFormat("INSERT INTO {0} ([", m_Realm);
|
||||
query.Append(String.Join("],[", names.ToArray()));
|
||||
query.Append("]) values (" + String.Join(",", values.ToArray()) + ")");
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = query.ToString();
|
||||
//m_log.WarnFormat("[MSSQLGenericTable]: Inserting into {0}", m_Realm);
|
||||
if (conn.State != ConnectionState.Open)
|
||||
conn.Open();
|
||||
if (cmd.ExecuteNonQuery() > 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Delete(string field, string key)
|
||||
{
|
||||
return Delete(new string[] { field }, new string[] { key });
|
||||
}
|
||||
|
||||
public virtual bool Delete(string[] fields, string[] keys)
|
||||
{
|
||||
if (fields.Length != keys.Length)
|
||||
return false;
|
||||
|
||||
List<string> terms = new List<string>();
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
for (int i = 0; i < fields.Length; i++)
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter(fields[i], keys[i]));
|
||||
terms.Add("[" + fields[i] + "] = @" + fields[i]);
|
||||
}
|
||||
|
||||
string where = String.Join(" AND ", terms.ToArray());
|
||||
|
||||
string query = String.Format("DELETE FROM {0} WHERE {1}", m_Realm, where);
|
||||
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = query;
|
||||
conn.Open();
|
||||
|
||||
if (cmd.ExecuteNonQuery() > 0)
|
||||
{
|
||||
//m_log.Warn("[MSSQLGenericTable]: " + deleteCommand);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
587
OpenSim/Data/MSSQL/MSSQLGridData.cs
Normal file
587
OpenSim/Data/MSSQL/MSSQLGridData.cs
Normal file
@@ -0,0 +1,587 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
/// <summary>
|
||||
/// A grid data interface for MSSQL Server
|
||||
/// </summary>
|
||||
public class MSSQLGridData : GridDataBase
|
||||
{
|
||||
private const string _migrationStore = "GridStore";
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Database manager
|
||||
/// </summary>
|
||||
private MSSQLManager database;
|
||||
|
||||
private string m_regionsTableName = "regions";
|
||||
|
||||
#region IPlugin Members
|
||||
|
||||
// [Obsolete("Cannot be default-initialized!")]
|
||||
override public void Initialise()
|
||||
{
|
||||
m_log.Info("[GRID DB]: " + Name + " cannot be default-initialized!");
|
||||
throw new PluginNotInitialisedException(Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialises the Grid Interface
|
||||
/// </summary>
|
||||
/// <param name="connectionString">connect string</param>
|
||||
/// <remarks>use mssql_connection.ini</remarks>
|
||||
override public void Initialise(string connectionString)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(connectionString))
|
||||
{
|
||||
database = new MSSQLManager(connectionString);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: make the connect string actually do something
|
||||
IniFile iniFile = new IniFile("mssql_connection.ini");
|
||||
|
||||
string settingDataSource = iniFile.ParseFileReadValue("data_source");
|
||||
string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog");
|
||||
string settingPersistSecurityInfo = iniFile.ParseFileReadValue("persist_security_info");
|
||||
string settingUserId = iniFile.ParseFileReadValue("user_id");
|
||||
string settingPassword = iniFile.ParseFileReadValue("password");
|
||||
|
||||
m_regionsTableName = iniFile.ParseFileReadValue("regionstablename");
|
||||
if (m_regionsTableName == null)
|
||||
{
|
||||
m_regionsTableName = "regions";
|
||||
}
|
||||
|
||||
database =
|
||||
new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
|
||||
settingPassword);
|
||||
}
|
||||
|
||||
//New migrations check of store
|
||||
database.CheckMigration(_migrationStore);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shuts down the grid interface
|
||||
/// </summary>
|
||||
override public void Dispose()
|
||||
{
|
||||
database = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The name of this DB provider.
|
||||
/// </summary>
|
||||
/// <returns>A string containing the storage system name</returns>
|
||||
override public string Name
|
||||
{
|
||||
get { return "MSSQL OpenGridData"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Database provider version.
|
||||
/// </summary>
|
||||
/// <returns>A string containing the storage system version</returns>
|
||||
override public string Version
|
||||
{
|
||||
get { return "0.1"; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public override GridDataBase methods
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of regions within the specified ranges
|
||||
/// </summary>
|
||||
/// <param name="xmin">minimum X coordinate</param>
|
||||
/// <param name="ymin">minimum Y coordinate</param>
|
||||
/// <param name="xmax">maximum X coordinate</param>
|
||||
/// <param name="ymax">maximum Y coordinate</param>
|
||||
/// <returns>null</returns>
|
||||
/// <remarks>always return null</remarks>
|
||||
override public RegionProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax)
|
||||
{
|
||||
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM regions WHERE locX >= @xmin AND locX <= @xmax AND locY >= @ymin AND locY <= @ymax"))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("xmin", xmin));
|
||||
command.Parameters.Add(database.CreateParameter("ymin", ymin));
|
||||
command.Parameters.Add(database.CreateParameter("xmax", xmax));
|
||||
command.Parameters.Add(database.CreateParameter("ymax", ymax));
|
||||
|
||||
List<RegionProfileData> rows = new List<RegionProfileData>();
|
||||
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
rows.Add(ReadSimRow(reader));
|
||||
}
|
||||
}
|
||||
|
||||
if (rows.Count > 0)
|
||||
{
|
||||
return rows.ToArray();
|
||||
}
|
||||
}
|
||||
m_log.Info("[GRID DB] : Found no regions within range.");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns up to maxNum profiles of regions that have a name starting with namePrefix
|
||||
/// </summary>
|
||||
/// <param name="namePrefix">The name to match against</param>
|
||||
/// <param name="maxNum">Maximum number of profiles to return</param>
|
||||
/// <returns>A list of sim profiles</returns>
|
||||
override public List<RegionProfileData> GetRegionsByName (string namePrefix, uint maxNum)
|
||||
{
|
||||
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM regions WHERE regionName LIKE @name"))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("name", namePrefix + "%"));
|
||||
|
||||
List<RegionProfileData> rows = new List<RegionProfileData>();
|
||||
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
while (rows.Count < maxNum && reader.Read())
|
||||
{
|
||||
rows.Add(ReadSimRow(reader));
|
||||
}
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a sim profile from its location
|
||||
/// </summary>
|
||||
/// <param name="handle">Region location handle</param>
|
||||
/// <returns>Sim profile</returns>
|
||||
override public RegionProfileData GetProfileByHandle(ulong handle)
|
||||
{
|
||||
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM " + m_regionsTableName + " WHERE regionHandle = @handle"))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("handle", handle));
|
||||
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
return ReadSimRow(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_log.InfoFormat("[GRID DB] : No region found with handle : {0}", handle);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a sim profile from its UUID
|
||||
/// </summary>
|
||||
/// <param name="uuid">The region UUID</param>
|
||||
/// <returns>The sim profile</returns>
|
||||
override public RegionProfileData GetProfileByUUID(UUID uuid)
|
||||
{
|
||||
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM " + m_regionsTableName + " WHERE uuid = @uuid"))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("uuid", uuid));
|
||||
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
return ReadSimRow(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_log.InfoFormat("[GRID DB] : No region found with UUID : {0}", uuid);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a sim profile from it's Region name string
|
||||
/// </summary>
|
||||
/// <param name="regionName">The region name search query</param>
|
||||
/// <returns>The sim profile</returns>
|
||||
override public RegionProfileData GetProfileByString(string regionName)
|
||||
{
|
||||
if (regionName.Length > 2)
|
||||
{
|
||||
using (AutoClosingSqlCommand command = database.Query("SELECT top 1 * FROM " + m_regionsTableName + " WHERE regionName like @regionName order by regionName"))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("regionName", regionName + "%"));
|
||||
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
return ReadSimRow(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_log.InfoFormat("[GRID DB] : No region found with regionName : {0}", regionName);
|
||||
return null;
|
||||
}
|
||||
|
||||
m_log.Error("[GRID DB]: Searched for a Region Name shorter then 3 characters");
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new specified region to the database
|
||||
/// </summary>
|
||||
/// <param name="profile">The profile to add</param>
|
||||
/// <returns>A dataresponse enum indicating success</returns>
|
||||
override public DataResponse StoreProfile(RegionProfileData profile)
|
||||
{
|
||||
if (GetProfileByUUID(profile.UUID) == null)
|
||||
{
|
||||
if (InsertRegionRow(profile))
|
||||
{
|
||||
return DataResponse.RESPONSE_OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (UpdateRegionRow(profile))
|
||||
{
|
||||
return DataResponse.RESPONSE_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return DataResponse.RESPONSE_ERROR;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a sim profile from the database
|
||||
/// </summary>
|
||||
/// <param name="uuid">the sim UUID</param>
|
||||
/// <returns>Successful?</returns>
|
||||
//public DataResponse DeleteProfile(RegionProfileData profile)
|
||||
override public DataResponse DeleteProfile(string uuid)
|
||||
{
|
||||
using (AutoClosingSqlCommand command = database.Query("DELETE FROM regions WHERE uuid = @uuid;"))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("uuid", uuid));
|
||||
try
|
||||
{
|
||||
command.ExecuteNonQuery();
|
||||
return DataResponse.RESPONSE_OK;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[GRID DB] : Error deleting region info, error is : {0}", e.Message);
|
||||
return DataResponse.RESPONSE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods that are not used or deprecated (still needed because of base class)
|
||||
|
||||
/// <summary>
|
||||
/// DEPRECATED. Attempts to authenticate a region by comparing a shared secret.
|
||||
/// </summary>
|
||||
/// <param name="uuid">The UUID of the challenger</param>
|
||||
/// <param name="handle">The attempted regionHandle of the challenger</param>
|
||||
/// <param name="authkey">The secret</param>
|
||||
/// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
|
||||
override public bool AuthenticateSim(UUID uuid, ulong handle, string authkey)
|
||||
{
|
||||
bool throwHissyFit = false; // Should be true by 1.0
|
||||
|
||||
if (throwHissyFit)
|
||||
throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
|
||||
|
||||
RegionProfileData data = GetProfileByUUID(uuid);
|
||||
|
||||
return (handle == data.regionHandle && authkey == data.regionSecret);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
|
||||
/// </summary>
|
||||
/// <remarks>This requires a security audit.</remarks>
|
||||
/// <param name="uuid"></param>
|
||||
/// <param name="handle"></param>
|
||||
/// <param name="authhash"></param>
|
||||
/// <param name="challenge"></param>
|
||||
/// <returns></returns>
|
||||
public bool AuthenticateSim(UUID uuid, ulong handle, string authhash, string challenge)
|
||||
{
|
||||
// SHA512Managed HashProvider = new SHA512Managed();
|
||||
// Encoding TextProvider = new UTF8Encoding();
|
||||
|
||||
// byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge);
|
||||
// byte[] hash = HashProvider.ComputeHash(stream);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NOT IMPLEMENTED
|
||||
/// WHEN IS THIS GONNA BE IMPLEMENTED.
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns>null</returns>
|
||||
override public ReservationData GetReservationAtPoint(uint x, uint y)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region private methods
|
||||
|
||||
/// <summary>
|
||||
/// Reads a region row from a database reader
|
||||
/// </summary>
|
||||
/// <param name="reader">An active database reader</param>
|
||||
/// <returns>A region profile</returns>
|
||||
private static RegionProfileData ReadSimRow(IDataRecord reader)
|
||||
{
|
||||
RegionProfileData retval = new RegionProfileData();
|
||||
|
||||
// Region Main gotta-have-or-we-return-null parts
|
||||
UInt64 tmp64;
|
||||
if (!UInt64.TryParse(reader["regionHandle"].ToString(), out tmp64))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
retval.regionHandle = tmp64;
|
||||
|
||||
// UUID tmp_uuid;
|
||||
// if (!UUID.TryParse((string)reader["uuid"], out tmp_uuid))
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
retval.UUID = new UUID((Guid)reader["uuid"]); // tmp_uuid;
|
||||
|
||||
// non-critical parts
|
||||
retval.regionName = reader["regionName"].ToString();
|
||||
retval.originUUID = new UUID((Guid)reader["originUUID"]);
|
||||
|
||||
// Secrets
|
||||
retval.regionRecvKey = reader["regionRecvKey"].ToString();
|
||||
retval.regionSecret = reader["regionSecret"].ToString();
|
||||
retval.regionSendKey = reader["regionSendKey"].ToString();
|
||||
|
||||
// Region Server
|
||||
retval.regionDataURI = reader["regionDataURI"].ToString();
|
||||
retval.regionOnline = false; // Needs to be pinged before this can be set.
|
||||
retval.serverIP = reader["serverIP"].ToString();
|
||||
retval.serverPort = Convert.ToUInt32(reader["serverPort"]);
|
||||
retval.serverURI = reader["serverURI"].ToString();
|
||||
retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString());
|
||||
retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString());
|
||||
|
||||
// Location
|
||||
retval.regionLocX = Convert.ToUInt32(reader["locX"].ToString());
|
||||
retval.regionLocY = Convert.ToUInt32(reader["locY"].ToString());
|
||||
retval.regionLocZ = Convert.ToUInt32(reader["locZ"].ToString());
|
||||
|
||||
// Neighbours - 0 = No Override
|
||||
retval.regionEastOverrideHandle = Convert.ToUInt64(reader["eastOverrideHandle"].ToString());
|
||||
retval.regionWestOverrideHandle = Convert.ToUInt64(reader["westOverrideHandle"].ToString());
|
||||
retval.regionSouthOverrideHandle = Convert.ToUInt64(reader["southOverrideHandle"].ToString());
|
||||
retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString());
|
||||
|
||||
// Assets
|
||||
retval.regionAssetURI = reader["regionAssetURI"].ToString();
|
||||
retval.regionAssetRecvKey = reader["regionAssetRecvKey"].ToString();
|
||||
retval.regionAssetSendKey = reader["regionAssetSendKey"].ToString();
|
||||
|
||||
// Userserver
|
||||
retval.regionUserURI = reader["regionUserURI"].ToString();
|
||||
retval.regionUserRecvKey = reader["regionUserRecvKey"].ToString();
|
||||
retval.regionUserSendKey = reader["regionUserSendKey"].ToString();
|
||||
|
||||
// World Map Addition
|
||||
retval.regionMapTextureID = new UUID((Guid)reader["regionMapTexture"]);
|
||||
retval.owner_uuid = new UUID((Guid)reader["owner_uuid"]);
|
||||
retval.maturity = Convert.ToUInt32(reader["access"]);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the specified region in the database
|
||||
/// </summary>
|
||||
/// <param name="profile">The profile to update</param>
|
||||
/// <returns>success ?</returns>
|
||||
private bool UpdateRegionRow(RegionProfileData profile)
|
||||
{
|
||||
bool returnval = false;
|
||||
|
||||
//Insert new region
|
||||
string sql =
|
||||
"UPDATE " + m_regionsTableName + @" SET
|
||||
[regionHandle]=@regionHandle, [regionName]=@regionName,
|
||||
[regionRecvKey]=@regionRecvKey, [regionSecret]=@regionSecret, [regionSendKey]=@regionSendKey,
|
||||
[regionDataURI]=@regionDataURI, [serverIP]=@serverIP, [serverPort]=@serverPort, [serverURI]=@serverURI,
|
||||
[locX]=@locX, [locY]=@locY, [locZ]=@locZ, [eastOverrideHandle]=@eastOverrideHandle,
|
||||
[westOverrideHandle]=@westOverrideHandle, [southOverrideHandle]=@southOverrideHandle,
|
||||
[northOverrideHandle]=@northOverrideHandle, [regionAssetURI]=@regionAssetURI,
|
||||
[regionAssetRecvKey]=@regionAssetRecvKey, [regionAssetSendKey]=@regionAssetSendKey,
|
||||
[regionUserURI]=@regionUserURI, [regionUserRecvKey]=@regionUserRecvKey, [regionUserSendKey]=@regionUserSendKey,
|
||||
[regionMapTexture]=@regionMapTexture, [serverHttpPort]=@serverHttpPort,
|
||||
[serverRemotingPort]=@serverRemotingPort, [owner_uuid]=@owner_uuid , [originUUID]=@originUUID
|
||||
where [uuid]=@uuid";
|
||||
|
||||
using (AutoClosingSqlCommand command = database.Query(sql))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("regionHandle", profile.regionHandle));
|
||||
command.Parameters.Add(database.CreateParameter("regionName", profile.regionName));
|
||||
command.Parameters.Add(database.CreateParameter("uuid", profile.UUID));
|
||||
command.Parameters.Add(database.CreateParameter("regionRecvKey", profile.regionRecvKey));
|
||||
command.Parameters.Add(database.CreateParameter("regionSecret", profile.regionSecret));
|
||||
command.Parameters.Add(database.CreateParameter("regionSendKey", profile.regionSendKey));
|
||||
command.Parameters.Add(database.CreateParameter("regionDataURI", profile.regionDataURI));
|
||||
command.Parameters.Add(database.CreateParameter("serverIP", profile.serverIP));
|
||||
command.Parameters.Add(database.CreateParameter("serverPort", profile.serverPort));
|
||||
command.Parameters.Add(database.CreateParameter("serverURI", profile.serverURI));
|
||||
command.Parameters.Add(database.CreateParameter("locX", profile.regionLocX));
|
||||
command.Parameters.Add(database.CreateParameter("locY", profile.regionLocY));
|
||||
command.Parameters.Add(database.CreateParameter("locZ", profile.regionLocZ));
|
||||
command.Parameters.Add(database.CreateParameter("eastOverrideHandle", profile.regionEastOverrideHandle));
|
||||
command.Parameters.Add(database.CreateParameter("westOverrideHandle", profile.regionWestOverrideHandle));
|
||||
command.Parameters.Add(database.CreateParameter("northOverrideHandle", profile.regionNorthOverrideHandle));
|
||||
command.Parameters.Add(database.CreateParameter("southOverrideHandle", profile.regionSouthOverrideHandle));
|
||||
command.Parameters.Add(database.CreateParameter("regionAssetURI", profile.regionAssetURI));
|
||||
command.Parameters.Add(database.CreateParameter("regionAssetRecvKey", profile.regionAssetRecvKey));
|
||||
command.Parameters.Add(database.CreateParameter("regionAssetSendKey", profile.regionAssetSendKey));
|
||||
command.Parameters.Add(database.CreateParameter("regionUserURI", profile.regionUserURI));
|
||||
command.Parameters.Add(database.CreateParameter("regionUserRecvKey", profile.regionUserRecvKey));
|
||||
command.Parameters.Add(database.CreateParameter("regionUserSendKey", profile.regionUserSendKey));
|
||||
command.Parameters.Add(database.CreateParameter("regionMapTexture", profile.regionMapTextureID));
|
||||
command.Parameters.Add(database.CreateParameter("serverHttpPort", profile.httpPort));
|
||||
command.Parameters.Add(database.CreateParameter("serverRemotingPort", profile.remotingPort));
|
||||
command.Parameters.Add(database.CreateParameter("owner_uuid", profile.owner_uuid));
|
||||
command.Parameters.Add(database.CreateParameter("originUUID", profile.originUUID));
|
||||
|
||||
try
|
||||
{
|
||||
command.ExecuteNonQuery();
|
||||
returnval = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[GRID DB] : Error updating region, error: " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return returnval;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new region in the database
|
||||
/// </summary>
|
||||
/// <param name="profile">The region profile to insert</param>
|
||||
/// <returns>Successful?</returns>
|
||||
private bool InsertRegionRow(RegionProfileData profile)
|
||||
{
|
||||
bool returnval = false;
|
||||
|
||||
//Insert new region
|
||||
string sql =
|
||||
"INSERT INTO " + m_regionsTableName + @" ([regionHandle], [regionName], [uuid], [regionRecvKey], [regionSecret], [regionSendKey], [regionDataURI],
|
||||
[serverIP], [serverPort], [serverURI], [locX], [locY], [locZ], [eastOverrideHandle], [westOverrideHandle],
|
||||
[southOverrideHandle], [northOverrideHandle], [regionAssetURI], [regionAssetRecvKey], [regionAssetSendKey],
|
||||
[regionUserURI], [regionUserRecvKey], [regionUserSendKey], [regionMapTexture], [serverHttpPort],
|
||||
[serverRemotingPort], [owner_uuid], [originUUID], [access])
|
||||
VALUES (@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI,
|
||||
@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle,
|
||||
@southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, @regionAssetSendKey,
|
||||
@regionUserURI, @regionUserRecvKey, @regionUserSendKey, @regionMapTexture, @serverHttpPort, @serverRemotingPort, @owner_uuid, @originUUID, @access);";
|
||||
|
||||
using (AutoClosingSqlCommand command = database.Query(sql))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("regionHandle", profile.regionHandle));
|
||||
command.Parameters.Add(database.CreateParameter("regionName", profile.regionName));
|
||||
command.Parameters.Add(database.CreateParameter("uuid", profile.UUID));
|
||||
command.Parameters.Add(database.CreateParameter("regionRecvKey", profile.regionRecvKey));
|
||||
command.Parameters.Add(database.CreateParameter("regionSecret", profile.regionSecret));
|
||||
command.Parameters.Add(database.CreateParameter("regionSendKey", profile.regionSendKey));
|
||||
command.Parameters.Add(database.CreateParameter("regionDataURI", profile.regionDataURI));
|
||||
command.Parameters.Add(database.CreateParameter("serverIP", profile.serverIP));
|
||||
command.Parameters.Add(database.CreateParameter("serverPort", profile.serverPort));
|
||||
command.Parameters.Add(database.CreateParameter("serverURI", profile.serverURI));
|
||||
command.Parameters.Add(database.CreateParameter("locX", profile.regionLocX));
|
||||
command.Parameters.Add(database.CreateParameter("locY", profile.regionLocY));
|
||||
command.Parameters.Add(database.CreateParameter("locZ", profile.regionLocZ));
|
||||
command.Parameters.Add(database.CreateParameter("eastOverrideHandle", profile.regionEastOverrideHandle));
|
||||
command.Parameters.Add(database.CreateParameter("westOverrideHandle", profile.regionWestOverrideHandle));
|
||||
command.Parameters.Add(database.CreateParameter("northOverrideHandle", profile.regionNorthOverrideHandle));
|
||||
command.Parameters.Add(database.CreateParameter("southOverrideHandle", profile.regionSouthOverrideHandle));
|
||||
command.Parameters.Add(database.CreateParameter("regionAssetURI", profile.regionAssetURI));
|
||||
command.Parameters.Add(database.CreateParameter("regionAssetRecvKey", profile.regionAssetRecvKey));
|
||||
command.Parameters.Add(database.CreateParameter("regionAssetSendKey", profile.regionAssetSendKey));
|
||||
command.Parameters.Add(database.CreateParameter("regionUserURI", profile.regionUserURI));
|
||||
command.Parameters.Add(database.CreateParameter("regionUserRecvKey", profile.regionUserRecvKey));
|
||||
command.Parameters.Add(database.CreateParameter("regionUserSendKey", profile.regionUserSendKey));
|
||||
command.Parameters.Add(database.CreateParameter("regionMapTexture", profile.regionMapTextureID));
|
||||
command.Parameters.Add(database.CreateParameter("serverHttpPort", profile.httpPort));
|
||||
command.Parameters.Add(database.CreateParameter("serverRemotingPort", profile.remotingPort));
|
||||
command.Parameters.Add(database.CreateParameter("owner_uuid", profile.owner_uuid));
|
||||
command.Parameters.Add(database.CreateParameter("originUUID", profile.originUUID));
|
||||
command.Parameters.Add(database.CreateParameter("access", profile.maturity));
|
||||
|
||||
try
|
||||
{
|
||||
command.ExecuteNonQuery();
|
||||
returnval = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[GRID DB] : Error inserting region, error: " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return returnval;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,6 @@ namespace OpenSim.Data.MSSQL
|
||||
/// The database manager
|
||||
/// </summary>
|
||||
private MSSQLManager database;
|
||||
private string m_connectionString;
|
||||
|
||||
#region IPlugin members
|
||||
|
||||
@@ -67,9 +66,24 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <remarks>use mssql_connection.ini</remarks>
|
||||
public void Initialise(string connectionString)
|
||||
{
|
||||
m_connectionString = connectionString;
|
||||
database = new MSSQLManager(connectionString);
|
||||
|
||||
if (!string.IsNullOrEmpty(connectionString))
|
||||
{
|
||||
database = new MSSQLManager(connectionString);
|
||||
}
|
||||
else
|
||||
{
|
||||
IniFile gridDataMSSqlFile = new IniFile("mssql_connection.ini");
|
||||
string settingDataSource = gridDataMSSqlFile.ParseFileReadValue("data_source");
|
||||
string settingInitialCatalog = gridDataMSSqlFile.ParseFileReadValue("initial_catalog");
|
||||
string settingPersistSecurityInfo = gridDataMSSqlFile.ParseFileReadValue("persist_security_info");
|
||||
string settingUserId = gridDataMSSqlFile.ParseFileReadValue("user_id");
|
||||
string settingPassword = gridDataMSSqlFile.ParseFileReadValue("password");
|
||||
|
||||
database =
|
||||
new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
|
||||
settingPassword);
|
||||
}
|
||||
|
||||
//New migrations check of store
|
||||
database.CheckMigration(_migrationStore);
|
||||
}
|
||||
@@ -111,9 +125,6 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <returns>A list of folder objects</returns>
|
||||
public List<InventoryFolderBase> getUserRootFolders(UUID user)
|
||||
{
|
||||
if (user == UUID.Zero)
|
||||
return new List<InventoryFolderBase>();
|
||||
|
||||
return getInventoryFolders(UUID.Zero, user);
|
||||
}
|
||||
|
||||
@@ -158,13 +169,11 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <returns>A folder class</returns>
|
||||
public InventoryFolderBase getInventoryFolder(UUID folderID)
|
||||
{
|
||||
string sql = "SELECT * FROM inventoryfolders WHERE folderID = @folderID";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM inventoryfolders WHERE folderID = @folderID"))
|
||||
{
|
||||
cmd.Parameters.Add(database.CreateParameter("folderID", folderID));
|
||||
conn.Open();
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
command.Parameters.Add(database.CreateParameter("folderID", folderID));
|
||||
|
||||
using (IDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
@@ -187,32 +196,19 @@ namespace OpenSim.Data.MSSQL
|
||||
//Note maybe change this to use a Dataset that loading in all folders of a user and then go throw it that way.
|
||||
//Note this is changed so it opens only one connection to the database and not everytime it wants to get data.
|
||||
|
||||
/* NOTE: the implementation below is very inefficient (makes a separate request to get subfolders for
|
||||
* every found folder, recursively). Inventory code for other DBs has been already rewritten to get ALL
|
||||
* inventory for a specific user at once.
|
||||
*
|
||||
* Meanwhile, one little thing is corrected: getFolderHierarchy(UUID.Zero) doesn't make sense and should never
|
||||
* be used, so check for that and return an empty list.
|
||||
*/
|
||||
|
||||
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
||||
|
||||
if (parentID == UUID.Zero)
|
||||
return folders;
|
||||
|
||||
string sql = "SELECT * FROM inventoryfolders WHERE parentFolderID = @parentID";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentID"))
|
||||
{
|
||||
cmd.Parameters.Add(database.CreateParameter("@parentID", parentID));
|
||||
conn.Open();
|
||||
folders.AddRange(getInventoryFolders(cmd));
|
||||
command.Parameters.Add(database.CreateParameter("@parentID", parentID));
|
||||
|
||||
folders.AddRange(getInventoryFolders(command));
|
||||
|
||||
List<InventoryFolderBase> tempFolders = new List<InventoryFolderBase>();
|
||||
|
||||
foreach (InventoryFolderBase folderBase in folders)
|
||||
{
|
||||
tempFolders.AddRange(getFolderHierarchy(folderBase.ID, cmd));
|
||||
tempFolders.AddRange(getFolderHierarchy(folderBase.ID, command));
|
||||
}
|
||||
if (tempFolders.Count > 0)
|
||||
{
|
||||
@@ -237,19 +233,20 @@ namespace OpenSim.Data.MSSQL
|
||||
folderName = folderName.Substring(0, 64);
|
||||
m_log.Warn("[INVENTORY DB]: Name field truncated from " + folder.Name.Length.ToString() + " to " + folderName.Length + " characters on add");
|
||||
}
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
|
||||
using (AutoClosingSqlCommand command = database.Query(sql))
|
||||
{
|
||||
cmd.Parameters.Add(database.CreateParameter("folderID", folder.ID));
|
||||
cmd.Parameters.Add(database.CreateParameter("agentID", folder.Owner));
|
||||
cmd.Parameters.Add(database.CreateParameter("parentFolderID", folder.ParentID));
|
||||
cmd.Parameters.Add(database.CreateParameter("folderName", folderName));
|
||||
cmd.Parameters.Add(database.CreateParameter("type", folder.Type));
|
||||
cmd.Parameters.Add(database.CreateParameter("version", folder.Version));
|
||||
conn.Open();
|
||||
command.Parameters.Add(database.CreateParameter("folderID", folder.ID));
|
||||
command.Parameters.Add(database.CreateParameter("agentID", folder.Owner));
|
||||
command.Parameters.Add(database.CreateParameter("parentFolderID", folder.ParentID));
|
||||
command.Parameters.Add(database.CreateParameter("folderName", folderName));
|
||||
command.Parameters.Add(database.CreateParameter("type", folder.Type));
|
||||
command.Parameters.Add(database.CreateParameter("version", folder.Version));
|
||||
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
//IDbCommand result = database.Query(sql, param);
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -264,12 +261,13 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <param name="folder">Folder to update</param>
|
||||
public void updateInventoryFolder(InventoryFolderBase folder)
|
||||
{
|
||||
string sql = @"UPDATE inventoryfolders SET agentID = @agentID,
|
||||
string sql = @"UPDATE inventoryfolders SET folderID = @folderID,
|
||||
agentID = @agentID,
|
||||
parentFolderID = @parentFolderID,
|
||||
folderName = @folderName,
|
||||
type = @type,
|
||||
version = @version
|
||||
WHERE folderID = @folderID";
|
||||
WHERE folderID = @keyFolderID";
|
||||
|
||||
string folderName = folder.Name;
|
||||
if (folderName.Length > 64)
|
||||
@@ -277,19 +275,20 @@ namespace OpenSim.Data.MSSQL
|
||||
folderName = folderName.Substring(0, 64);
|
||||
m_log.Warn("[INVENTORY DB]: Name field truncated from " + folder.Name.Length.ToString() + " to " + folderName.Length + " characters on update");
|
||||
}
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
|
||||
using (AutoClosingSqlCommand command = database.Query(sql))
|
||||
{
|
||||
cmd.Parameters.Add(database.CreateParameter("folderID", folder.ID));
|
||||
cmd.Parameters.Add(database.CreateParameter("agentID", folder.Owner));
|
||||
cmd.Parameters.Add(database.CreateParameter("parentFolderID", folder.ParentID));
|
||||
cmd.Parameters.Add(database.CreateParameter("folderName", folderName));
|
||||
cmd.Parameters.Add(database.CreateParameter("type", folder.Type));
|
||||
cmd.Parameters.Add(database.CreateParameter("version", folder.Version));
|
||||
conn.Open();
|
||||
command.Parameters.Add(database.CreateParameter("folderID", folder.ID));
|
||||
command.Parameters.Add(database.CreateParameter("agentID", folder.Owner));
|
||||
command.Parameters.Add(database.CreateParameter("parentFolderID", folder.ParentID));
|
||||
command.Parameters.Add(database.CreateParameter("folderName", folderName));
|
||||
command.Parameters.Add(database.CreateParameter("type", folder.Type));
|
||||
command.Parameters.Add(database.CreateParameter("version", folder.Version));
|
||||
command.Parameters.Add(database.CreateParameter("@keyFolderID", folder.ID));
|
||||
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -305,15 +304,14 @@ namespace OpenSim.Data.MSSQL
|
||||
public void moveInventoryFolder(InventoryFolderBase folder)
|
||||
{
|
||||
string sql = @"UPDATE inventoryfolders SET parentFolderID = @parentFolderID WHERE folderID = @folderID";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
using (IDbCommand command = database.Query(sql))
|
||||
{
|
||||
cmd.Parameters.Add(database.CreateParameter("parentFolderID", folder.ParentID));
|
||||
cmd.Parameters.Add(database.CreateParameter("folderID", folder.ID));
|
||||
conn.Open();
|
||||
command.Parameters.Add(database.CreateParameter("parentFolderID", folder.ParentID));
|
||||
command.Parameters.Add(database.CreateParameter("@folderID", folder.ID));
|
||||
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -328,27 +326,30 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <param name="folderID">Id of folder to delete</param>
|
||||
public void deleteInventoryFolder(UUID folderID)
|
||||
{
|
||||
string sql = "SELECT * FROM inventoryfolders WHERE parentFolderID = @parentID";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
using (SqlConnection connection = database.DatabaseConnection())
|
||||
{
|
||||
List<InventoryFolderBase> subFolders;
|
||||
cmd.Parameters.Add(database.CreateParameter("@parentID", UUID.Zero));
|
||||
conn.Open();
|
||||
subFolders = getFolderHierarchy(folderID, cmd);
|
||||
|
||||
using (SqlCommand command = new SqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentID", connection))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("@parentID", UUID.Zero));
|
||||
|
||||
AutoClosingSqlCommand autoCommand = new AutoClosingSqlCommand(command);
|
||||
|
||||
subFolders = getFolderHierarchy(folderID, autoCommand);
|
||||
}
|
||||
|
||||
//Delete all sub-folders
|
||||
foreach (InventoryFolderBase f in subFolders)
|
||||
{
|
||||
DeleteOneFolder(f.ID, conn);
|
||||
DeleteItemsInFolder(f.ID, conn);
|
||||
DeleteOneFolder(f.ID, connection);
|
||||
DeleteItemsInFolder(f.ID, connection);
|
||||
}
|
||||
|
||||
//Delete the actual row
|
||||
DeleteOneFolder(folderID, conn);
|
||||
DeleteItemsInFolder(folderID, conn);
|
||||
DeleteOneFolder(folderID, connection);
|
||||
DeleteItemsInFolder(folderID, connection);
|
||||
|
||||
connection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,15 +364,13 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <returns>A list containing inventory items</returns>
|
||||
public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
|
||||
{
|
||||
string sql = "SELECT * FROM inventoryitems WHERE parentFolderID = @parentFolderID";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = @parentFolderID"))
|
||||
{
|
||||
cmd.Parameters.Add(database.CreateParameter("parentFolderID", folderID));
|
||||
conn.Open();
|
||||
command.Parameters.Add(database.CreateParameter("parentFolderID", folderID));
|
||||
|
||||
List<InventoryItemBase> items = new List<InventoryItemBase>();
|
||||
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
@@ -389,13 +388,11 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <returns>An inventory item</returns>
|
||||
public InventoryItemBase getInventoryItem(UUID itemID)
|
||||
{
|
||||
string sql = "SELECT * FROM inventoryitems WHERE inventoryID = @inventoryID";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
using (AutoClosingSqlCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = @inventoryID"))
|
||||
{
|
||||
cmd.Parameters.Add(database.CreateParameter("inventoryID", itemID));
|
||||
conn.Open();
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
result.Parameters.Add(database.CreateParameter("inventoryID", itemID));
|
||||
|
||||
using (IDataReader reader = result.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
@@ -444,9 +441,8 @@ namespace OpenSim.Data.MSSQL
|
||||
itemDesc = item.Description.Substring(0, 128);
|
||||
m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length.ToString() + " to " + itemDesc.Length.ToString() + " characters");
|
||||
}
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand command = new SqlCommand(sql, conn))
|
||||
|
||||
using (AutoClosingSqlCommand command = database.Query(sql))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("inventoryID", item.ID));
|
||||
command.Parameters.Add(database.CreateParameter("assetID", item.AssetID));
|
||||
@@ -468,7 +464,7 @@ namespace OpenSim.Data.MSSQL
|
||||
command.Parameters.Add(database.CreateParameter("groupID", item.GroupID));
|
||||
command.Parameters.Add(database.CreateParameter("groupOwned", item.GroupOwned));
|
||||
command.Parameters.Add(database.CreateParameter("flags", item.Flags));
|
||||
conn.Open();
|
||||
|
||||
try
|
||||
{
|
||||
command.ExecuteNonQuery();
|
||||
@@ -480,11 +476,9 @@ namespace OpenSim.Data.MSSQL
|
||||
}
|
||||
|
||||
sql = "UPDATE inventoryfolders SET version = version + 1 WHERE folderID = @folderID";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand command = new SqlCommand(sql, conn))
|
||||
using (AutoClosingSqlCommand command = database.Query(sql))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("folderID", item.Folder.ToString()));
|
||||
conn.Open();
|
||||
try
|
||||
{
|
||||
command.ExecuteNonQuery();
|
||||
@@ -502,7 +496,8 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <param name="item">Inventory item to update</param>
|
||||
public void updateInventoryItem(InventoryItemBase item)
|
||||
{
|
||||
string sql = @"UPDATE inventoryitems SET assetID = @assetID,
|
||||
string sql = @"UPDATE inventoryitems SET inventoryID = @inventoryID,
|
||||
assetID = @assetID,
|
||||
assetType = @assetType,
|
||||
parentFolderID = @parentFolderID,
|
||||
avatarID = @avatarID,
|
||||
@@ -514,14 +509,13 @@ namespace OpenSim.Data.MSSQL
|
||||
creatorID = @creatorID,
|
||||
inventoryBasePermissions = @inventoryBasePermissions,
|
||||
inventoryEveryOnePermissions = @inventoryEveryOnePermissions,
|
||||
inventoryGroupPermissions = @inventoryGroupPermissions,
|
||||
salePrice = @salePrice,
|
||||
saleType = @saleType,
|
||||
creationDate = @creationDate,
|
||||
groupID = @groupID,
|
||||
groupOwned = @groupOwned,
|
||||
flags = @flags
|
||||
WHERE inventoryID = @inventoryID";
|
||||
WHERE inventoryID = @keyInventoryID";
|
||||
|
||||
string itemName = item.Name;
|
||||
if (item.Name.Length > 64)
|
||||
@@ -536,9 +530,8 @@ namespace OpenSim.Data.MSSQL
|
||||
itemDesc = item.Description.Substring(0, 128);
|
||||
m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length.ToString() + " to " + itemDesc.Length.ToString() + " characters on update");
|
||||
}
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand command = new SqlCommand(sql, conn))
|
||||
|
||||
using (AutoClosingSqlCommand command = database.Query(sql))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("inventoryID", item.ID));
|
||||
command.Parameters.Add(database.CreateParameter("assetID", item.AssetID));
|
||||
@@ -550,17 +543,17 @@ namespace OpenSim.Data.MSSQL
|
||||
command.Parameters.Add(database.CreateParameter("inventoryNextPermissions", item.NextPermissions));
|
||||
command.Parameters.Add(database.CreateParameter("inventoryCurrentPermissions", item.CurrentPermissions));
|
||||
command.Parameters.Add(database.CreateParameter("invType", item.InvType));
|
||||
command.Parameters.Add(database.CreateParameter("creatorID", item.CreatorId));
|
||||
command.Parameters.Add(database.CreateParameter("creatorID", item.CreatorIdAsUuid));
|
||||
command.Parameters.Add(database.CreateParameter("inventoryBasePermissions", item.BasePermissions));
|
||||
command.Parameters.Add(database.CreateParameter("inventoryEveryOnePermissions", item.EveryOnePermissions));
|
||||
command.Parameters.Add(database.CreateParameter("inventoryGroupPermissions", item.GroupPermissions));
|
||||
command.Parameters.Add(database.CreateParameter("salePrice", item.SalePrice));
|
||||
command.Parameters.Add(database.CreateParameter("saleType", item.SaleType));
|
||||
command.Parameters.Add(database.CreateParameter("creationDate", item.CreationDate));
|
||||
command.Parameters.Add(database.CreateParameter("groupID", item.GroupID));
|
||||
command.Parameters.Add(database.CreateParameter("groupOwned", item.GroupOwned));
|
||||
command.Parameters.Add(database.CreateParameter("flags", item.Flags));
|
||||
conn.Open();
|
||||
command.Parameters.Add(database.CreateParameter("@keyInventoryID", item.ID));
|
||||
|
||||
try
|
||||
{
|
||||
command.ExecuteNonQuery();
|
||||
@@ -580,15 +573,13 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <param name="itemID">the item UUID</param>
|
||||
public void deleteInventoryItem(UUID itemID)
|
||||
{
|
||||
string sql = "DELETE FROM inventoryitems WHERE inventoryID=@inventoryID";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
using (AutoClosingSqlCommand command = database.Query("DELETE FROM inventoryitems WHERE inventoryID=@inventoryID"))
|
||||
{
|
||||
cmd.Parameters.Add(database.CreateParameter("inventoryID", itemID));
|
||||
command.Parameters.Add(database.CreateParameter("inventoryID", itemID));
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -616,14 +607,12 @@ namespace OpenSim.Data.MSSQL
|
||||
/// </returns>
|
||||
public List<InventoryItemBase> fetchActiveGestures(UUID avatarID)
|
||||
{
|
||||
string sql = "SELECT * FROM inventoryitems WHERE avatarId = @uuid AND assetType = @assetType and flags = 1";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM inventoryitems WHERE avatarId = @uuid AND assetType = @assetType and flags = 1"))
|
||||
{
|
||||
cmd.Parameters.Add(database.CreateParameter("uuid", avatarID));
|
||||
cmd.Parameters.Add(database.CreateParameter("assetType", (int)AssetType.Gesture));
|
||||
conn.Open();
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
command.Parameters.Add(database.CreateParameter("uuid", avatarID));
|
||||
command.Parameters.Add(database.CreateParameter("assetType", (int)AssetType.Gesture));
|
||||
|
||||
using (IDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
List<InventoryItemBase> gestureList = new List<InventoryItemBase>();
|
||||
while (reader.Read())
|
||||
@@ -667,7 +656,7 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <param name="parentID">parent ID.</param>
|
||||
/// <param name="command">SQL command/connection to database</param>
|
||||
/// <returns></returns>
|
||||
private static List<InventoryFolderBase> getFolderHierarchy(UUID parentID, SqlCommand command)
|
||||
private static List<InventoryFolderBase> getFolderHierarchy(UUID parentID, AutoClosingSqlCommand command)
|
||||
{
|
||||
command.Parameters["@parentID"].Value = parentID.Guid; //.ToString();
|
||||
|
||||
@@ -698,9 +687,7 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <returns></returns>
|
||||
private List<InventoryFolderBase> getInventoryFolders(UUID parentID, UUID user)
|
||||
{
|
||||
string sql = "SELECT * FROM inventoryfolders WHERE parentFolderID = @parentID AND agentID LIKE @uuid";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand command = new SqlCommand(sql, conn))
|
||||
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentID AND agentID LIKE @uuid"))
|
||||
{
|
||||
if (user == UUID.Zero)
|
||||
{
|
||||
@@ -711,7 +698,7 @@ namespace OpenSim.Data.MSSQL
|
||||
command.Parameters.Add(database.CreateParameter("uuid", user));
|
||||
}
|
||||
command.Parameters.Add(database.CreateParameter("parentID", parentID));
|
||||
conn.Open();
|
||||
|
||||
return getInventoryFolders(command);
|
||||
}
|
||||
}
|
||||
@@ -721,9 +708,9 @@ namespace OpenSim.Data.MSSQL
|
||||
/// </summary>
|
||||
/// <param name="command">SQLcommand.</param>
|
||||
/// <returns></returns>
|
||||
private static List<InventoryFolderBase> getInventoryFolders(SqlCommand command)
|
||||
private static List<InventoryFolderBase> getInventoryFolders(AutoClosingSqlCommand command)
|
||||
{
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
using (IDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
|
||||
List<InventoryFolderBase> items = new List<InventoryFolderBase>();
|
||||
@@ -740,14 +727,14 @@ namespace OpenSim.Data.MSSQL
|
||||
/// </summary>
|
||||
/// <param name="reader">A MSSQL Data Reader</param>
|
||||
/// <returns>A List containing inventory folders</returns>
|
||||
protected static InventoryFolderBase readInventoryFolder(SqlDataReader reader)
|
||||
protected static InventoryFolderBase readInventoryFolder(IDataReader reader)
|
||||
{
|
||||
try
|
||||
{
|
||||
InventoryFolderBase folder = new InventoryFolderBase();
|
||||
folder.Owner = DBGuid.FromDB(reader["agentID"]);
|
||||
folder.ParentID = DBGuid.FromDB(reader["parentFolderID"]);
|
||||
folder.ID = DBGuid.FromDB(reader["folderID"]);
|
||||
folder.Owner = new UUID((Guid)reader["agentID"]);
|
||||
folder.ParentID = new UUID((Guid)reader["parentFolderID"]);
|
||||
folder.ID = new UUID((Guid)reader["folderID"]);
|
||||
folder.Name = (string)reader["folderName"];
|
||||
folder.Type = (short)reader["type"];
|
||||
folder.Version = Convert.ToUInt16(reader["version"]);
|
||||
@@ -773,24 +760,24 @@ namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
|
||||
item.ID = DBGuid.FromDB(reader["inventoryID"]);
|
||||
item.AssetID = DBGuid.FromDB(reader["assetID"]);
|
||||
item.ID = new UUID((Guid)reader["inventoryID"]);
|
||||
item.AssetID = new UUID((Guid)reader["assetID"]);
|
||||
item.AssetType = Convert.ToInt32(reader["assetType"].ToString());
|
||||
item.Folder = DBGuid.FromDB(reader["parentFolderID"]);
|
||||
item.Owner = DBGuid.FromDB(reader["avatarID"]);
|
||||
item.Folder = new UUID((Guid)reader["parentFolderID"]);
|
||||
item.Owner = new UUID((Guid)reader["avatarID"]);
|
||||
item.Name = reader["inventoryName"].ToString();
|
||||
item.Description = reader["inventoryDescription"].ToString();
|
||||
item.NextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]);
|
||||
item.CurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]);
|
||||
item.InvType = Convert.ToInt32(reader["invType"].ToString());
|
||||
item.CreatorId = reader["creatorID"].ToString();
|
||||
item.CreatorId = ((Guid)reader["creatorID"]).ToString();
|
||||
item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]);
|
||||
item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]);
|
||||
item.GroupPermissions = Convert.ToUInt32(reader["inventoryGroupPermissions"]);
|
||||
item.SalePrice = Convert.ToInt32(reader["salePrice"]);
|
||||
item.SaleType = Convert.ToByte(reader["saleType"]);
|
||||
item.CreationDate = Convert.ToInt32(reader["creationDate"]);
|
||||
item.GroupID = DBGuid.FromDB(reader["groupID"]);
|
||||
item.GroupID = new UUID((Guid)reader["groupID"]);
|
||||
item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
|
||||
item.Flags = Convert.ToUInt32(reader["flags"]);
|
||||
|
||||
@@ -813,7 +800,7 @@ namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID and type=-1", connection))
|
||||
using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID", connection))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("folderID", folderID));
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
146
OpenSim/Data/MSSQL/MSSQLLogData.cs
Normal file
146
OpenSim/Data/MSSQL/MSSQLLogData.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
/// <summary>
|
||||
/// An interface to the log database for MSSQL
|
||||
/// </summary>
|
||||
internal class MSSQLLogData : ILogDataPlugin
|
||||
{
|
||||
private const string _migrationStore = "LogStore";
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// The database manager
|
||||
/// </summary>
|
||||
public MSSQLManager database;
|
||||
|
||||
[Obsolete("Cannot be default-initialized!")]
|
||||
public void Initialise()
|
||||
{
|
||||
m_log.Info("[LOG DB]: " + Name + " cannot be default-initialized!");
|
||||
throw new PluginNotInitialisedException (Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Artificial constructor called when the plugin is loaded
|
||||
/// </summary>
|
||||
public void Initialise(string connect)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(connect))
|
||||
{
|
||||
database = new MSSQLManager(connect);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: do something with the connect string
|
||||
IniFile gridDataMSSqlFile = new IniFile("mssql_connection.ini");
|
||||
string settingDataSource = gridDataMSSqlFile.ParseFileReadValue("data_source");
|
||||
string settingInitialCatalog = gridDataMSSqlFile.ParseFileReadValue("initial_catalog");
|
||||
string settingPersistSecurityInfo = gridDataMSSqlFile.ParseFileReadValue("persist_security_info");
|
||||
string settingUserId = gridDataMSSqlFile.ParseFileReadValue("user_id");
|
||||
string settingPassword = gridDataMSSqlFile.ParseFileReadValue("password");
|
||||
|
||||
database =
|
||||
new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
|
||||
settingPassword);
|
||||
}
|
||||
|
||||
//Updating mechanisme
|
||||
database.CheckMigration(_migrationStore);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves a log item to the database
|
||||
/// </summary>
|
||||
/// <param name="serverDaemon">The daemon triggering the event</param>
|
||||
/// <param name="target">The target of the action (region / agent UUID, etc)</param>
|
||||
/// <param name="methodCall">The method call where the problem occured</param>
|
||||
/// <param name="arguments">The arguments passed to the method</param>
|
||||
/// <param name="priority">How critical is this?</param>
|
||||
/// <param name="logMessage">The message to log</param>
|
||||
public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
|
||||
string logMessage)
|
||||
{
|
||||
string sql = "INSERT INTO logs ([target], [server], [method], [arguments], [priority], [message]) VALUES ";
|
||||
sql += "(@target, @server, @method, @arguments, @priority, @message);";
|
||||
|
||||
using (AutoClosingSqlCommand command = database.Query(sql))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("server", serverDaemon));
|
||||
command.Parameters.Add(database.CreateParameter("target",target));
|
||||
command.Parameters.Add(database.CreateParameter("method", methodCall));
|
||||
command.Parameters.Add(database.CreateParameter("arguments", arguments));
|
||||
command.Parameters.Add(database.CreateParameter("priority", priority.ToString()));
|
||||
command.Parameters.Add(database.CreateParameter("message", logMessage));
|
||||
|
||||
try
|
||||
{
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//Are we not in a loop here
|
||||
m_log.Error("[LOG DB] Error logging : " + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the name of this DB provider
|
||||
/// </summary>
|
||||
/// <returns>A string containing the DB provider name</returns>
|
||||
public string Name
|
||||
{
|
||||
get { return "MSSQL Logdata Interface"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the database provider
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
database = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the version of this DB provider
|
||||
/// </summary>
|
||||
/// <returns>A string containing the provider version</returns>
|
||||
public string Version
|
||||
{
|
||||
get { return "0.1"; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,13 +41,28 @@ namespace OpenSim.Data.MSSQL
|
||||
/// </summary>
|
||||
public class MSSQLManager
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Connection string for ADO.net
|
||||
/// </summary>
|
||||
private readonly string connectionString;
|
||||
|
||||
public MSSQLManager(string dataSource, string initialCatalog, string persistSecurityInfo, string userId,
|
||||
string password)
|
||||
{
|
||||
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
|
||||
|
||||
builder.DataSource = dataSource;
|
||||
builder.InitialCatalog = initialCatalog;
|
||||
builder.PersistSecurityInfo = Convert.ToBoolean(persistSecurityInfo);
|
||||
builder.UserID = userId;
|
||||
builder.Password = password;
|
||||
builder.ApplicationName = Assembly.GetEntryAssembly().Location;
|
||||
|
||||
connectionString = builder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the manager and set the connectionstring
|
||||
/// </summary>
|
||||
@@ -57,6 +72,94 @@ namespace OpenSim.Data.MSSQL
|
||||
connectionString = connection;
|
||||
}
|
||||
|
||||
public SqlConnection DatabaseConnection()
|
||||
{
|
||||
SqlConnection conn = new SqlConnection(connectionString);
|
||||
|
||||
//TODO is this good??? Opening connection here
|
||||
conn.Open();
|
||||
|
||||
return conn;
|
||||
}
|
||||
|
||||
#region Obsolete functions, can be removed!
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="dt"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="type"></param>
|
||||
[Obsolete("Do not use!")]
|
||||
protected static void createCol(DataTable dt, string name, Type type)
|
||||
{
|
||||
DataColumn col = new DataColumn(name, type);
|
||||
dt.Columns.Add(col);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Define Table function
|
||||
/// </summary>
|
||||
/// <param name="dt"></param>
|
||||
/// <returns></returns>
|
||||
/*
|
||||
[Obsolete("Do not use!")]
|
||||
protected static string defineTable(DataTable dt)
|
||||
{
|
||||
string sql = "create table " + dt.TableName + "(";
|
||||
string subsql = String.Empty;
|
||||
foreach (DataColumn col in dt.Columns)
|
||||
{
|
||||
if (subsql.Length > 0)
|
||||
{
|
||||
// a map function would rock so much here
|
||||
subsql += ",\n";
|
||||
}
|
||||
|
||||
subsql += col.ColumnName + " " + SqlType(col.DataType);
|
||||
if (col == dt.PrimaryKey[0])
|
||||
{
|
||||
subsql += " primary key";
|
||||
}
|
||||
}
|
||||
sql += subsql;
|
||||
sql += ")";
|
||||
return sql;
|
||||
}
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Type conversion function
|
||||
/// </summary>
|
||||
/// <param name="type">a type</param>
|
||||
/// <returns>a sqltype</returns>
|
||||
/// <remarks>this is something we'll need to implement for each db slightly differently.</remarks>
|
||||
/*
|
||||
[Obsolete("Used by a obsolete methods")]
|
||||
public static string SqlType(Type type)
|
||||
{
|
||||
if (type == typeof(String))
|
||||
{
|
||||
return "varchar(255)";
|
||||
}
|
||||
if (type == typeof(Int32))
|
||||
{
|
||||
return "integer";
|
||||
}
|
||||
if (type == typeof(Double))
|
||||
{
|
||||
return "float";
|
||||
}
|
||||
if (type == typeof(Byte[]))
|
||||
{
|
||||
return "image";
|
||||
}
|
||||
return "varchar(255)";
|
||||
}
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// Type conversion to a SQLDbType functions
|
||||
/// </summary>
|
||||
@@ -104,11 +207,6 @@ namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
return SqlDbType.BigInt;
|
||||
}
|
||||
if (type == typeof(DateTime))
|
||||
{
|
||||
return SqlDbType.DateTime;
|
||||
}
|
||||
|
||||
return SqlDbType.VarChar;
|
||||
}
|
||||
|
||||
@@ -185,22 +283,138 @@ namespace OpenSim.Data.MSSQL
|
||||
return parameter;
|
||||
}
|
||||
|
||||
private static readonly Dictionary<string, string> emptyDictionary = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Run a query and return a sql db command
|
||||
/// </summary>
|
||||
/// <param name="sql">The SQL query.</param>
|
||||
/// <returns></returns>
|
||||
internal AutoClosingSqlCommand Query(string sql)
|
||||
{
|
||||
return Query(sql, emptyDictionary);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a query with protection against SQL Injection by using parameterised input.
|
||||
/// </summary>
|
||||
/// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
|
||||
/// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param>
|
||||
/// <returns>A Sql DB Command</returns>
|
||||
internal AutoClosingSqlCommand Query(string sql, Dictionary<string, string> parameters)
|
||||
{
|
||||
SqlCommand dbcommand = DatabaseConnection().CreateCommand();
|
||||
dbcommand.CommandText = sql;
|
||||
foreach (KeyValuePair<string, string> param in parameters)
|
||||
{
|
||||
dbcommand.Parameters.AddWithValue(param.Key, param.Value);
|
||||
}
|
||||
|
||||
return new AutoClosingSqlCommand(dbcommand);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a query with protection against SQL Injection by using parameterised input.
|
||||
/// </summary>
|
||||
/// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
|
||||
/// <param name="sqlParameter">A parameter - use createparameter to create parameter</param>
|
||||
/// <returns></returns>
|
||||
internal AutoClosingSqlCommand Query(string sql, SqlParameter sqlParameter)
|
||||
{
|
||||
SqlCommand dbcommand = DatabaseConnection().CreateCommand();
|
||||
dbcommand.CommandText = sql;
|
||||
dbcommand.Parameters.Add(sqlParameter);
|
||||
|
||||
return new AutoClosingSqlCommand(dbcommand);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if we need to do some migrations to the database
|
||||
/// </summary>
|
||||
/// <param name="migrationStore">migrationStore.</param>
|
||||
public void CheckMigration(string migrationStore)
|
||||
{
|
||||
using (SqlConnection connection = new SqlConnection(connectionString))
|
||||
using (SqlConnection connection = DatabaseConnection())
|
||||
{
|
||||
connection.Open();
|
||||
Assembly assem = GetType().Assembly;
|
||||
MSSQLMigration migration = new MSSQLMigration(connection, assem, migrationStore);
|
||||
|
||||
migration.Update();
|
||||
|
||||
connection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
#region Old Testtable functions
|
||||
|
||||
/// <summary>
|
||||
/// Execute a SQL statement stored in a resource, as a string
|
||||
/// </summary>
|
||||
/// <param name="name">the ressource string</param>
|
||||
public void ExecuteResourceSql(string name)
|
||||
{
|
||||
using (IDbCommand cmd = Query(getResourceString(name), new Dictionary<string, string>()))
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Given a list of tables, return the version of the tables, as seen in the database
|
||||
/// </summary>
|
||||
/// <param name="tableList"></param>
|
||||
public void GetTableVersion(Dictionary<string, string> tableList)
|
||||
{
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["dbname"] = new SqlConnectionStringBuilder(connectionString).InitialCatalog;
|
||||
|
||||
using (IDbCommand tablesCmd =
|
||||
Query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG=@dbname", param))
|
||||
using (IDataReader tables = tablesCmd.ExecuteReader())
|
||||
{
|
||||
while (tables.Read())
|
||||
{
|
||||
try
|
||||
{
|
||||
string tableName = (string)tables["TABLE_NAME"];
|
||||
if (tableList.ContainsKey(tableName))
|
||||
tableList[tableName] = tableName;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.ToString());
|
||||
}
|
||||
}
|
||||
tables.Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
private string getResourceString(string name)
|
||||
{
|
||||
Assembly assem = GetType().Assembly;
|
||||
string[] names = assem.GetManifestResourceNames();
|
||||
|
||||
foreach (string s in names)
|
||||
if (s.EndsWith(name))
|
||||
using (Stream resource = assem.GetManifestResourceStream(s))
|
||||
{
|
||||
using (StreamReader resourceReader = new StreamReader(resource))
|
||||
{
|
||||
string resourceString = resourceReader.ReadToEnd();
|
||||
return resourceString;
|
||||
}
|
||||
}
|
||||
throw new Exception(string.Format("Resource '{0}' was not found", name));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns the version of this DB provider
|
||||
/// </summary>
|
||||
|
||||
@@ -29,19 +29,16 @@ using System;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Reflection;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
public class MSSQLMigration : Migration
|
||||
{
|
||||
public MSSQLMigration(DbConnection conn, Assembly assem, string type)
|
||||
: base(conn, assem, type)
|
||||
public MSSQLMigration(DbConnection conn, Assembly assem, string type) : base(conn, assem, type)
|
||||
{
|
||||
}
|
||||
|
||||
public MSSQLMigration(DbConnection conn, Assembly assem, string subtype, string type)
|
||||
: base(conn, assem, subtype, type)
|
||||
public MSSQLMigration(DbConnection conn, Assembly assem, string subtype, string type) : base(conn, assem, subtype, type)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -64,36 +61,10 @@ namespace OpenSim.Data.MSSQL
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Return -1 to indicate table does not exist
|
||||
return -1;
|
||||
// Something went wrong, so we're version 0
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
protected override void ExecuteScript(DbConnection conn, string[] script)
|
||||
{
|
||||
if (!(conn is SqlConnection))
|
||||
{
|
||||
base.ExecuteScript(conn, script);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (string sql in script)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlCommand cmd = new SqlCommand(sql, (SqlConnection)conn))
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new Exception(sql);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
/// <summary>
|
||||
/// A MySQL Interface for the Presence Server
|
||||
/// </summary>
|
||||
public class MSSQLPresenceData : MSSQLGenericTableHandler<PresenceData>,
|
||||
IPresenceData
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public MSSQLPresenceData(string connectionString, string realm) :
|
||||
base(connectionString, realm, "Presence")
|
||||
{
|
||||
}
|
||||
|
||||
public PresenceData Get(UUID sessionID)
|
||||
{
|
||||
PresenceData[] ret = Get("SessionID",
|
||||
sessionID.ToString());
|
||||
|
||||
if (ret.Length == 0)
|
||||
return null;
|
||||
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
public void LogoutRegionAgents(UUID regionID)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
|
||||
cmd.CommandText = String.Format("DELETE FROM {0} WHERE [RegionID]=@RegionID", m_Realm);
|
||||
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@RegionID", regionID.ToString()));
|
||||
cmd.Connection = conn;
|
||||
conn.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
{
|
||||
PresenceData[] pd = Get("SessionID", sessionID.ToString());
|
||||
if (pd.Length == 0)
|
||||
return false;
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
|
||||
cmd.CommandText = String.Format(@"UPDATE {0} SET
|
||||
[RegionID] = @RegionID
|
||||
WHERE [SessionID] = @SessionID", m_Realm);
|
||||
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@SessionID", sessionID.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@RegionID", regionID.ToString()));
|
||||
cmd.Connection = conn;
|
||||
conn.Open();
|
||||
if (cmd.ExecuteNonQuery() == 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,6 @@ namespace OpenSim.Data.MSSQL
|
||||
string sql = "select * from ["+m_Realm+"] where regionName like @regionName";
|
||||
if (scopeID != UUID.Zero)
|
||||
sql += " and ScopeID = @scopeID";
|
||||
sql += " order by regionName";
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
@@ -130,10 +129,10 @@ namespace OpenSim.Data.MSSQL
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@startX", startX));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@startY", startY));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@endX", endX));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@endY", endY));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@startX", startX.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@startY", startY.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@endX", endX.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@endY", endY.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
|
||||
conn.Open();
|
||||
return RunCommand(cmd);
|
||||
@@ -308,39 +307,5 @@ namespace OpenSim.Data.MSSQL
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<RegionData> GetDefaultRegions(UUID scopeID)
|
||||
{
|
||||
return Get((int)RegionFlags.DefaultRegion, scopeID);
|
||||
}
|
||||
|
||||
public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
|
||||
{
|
||||
List<RegionData> regions = Get((int)RegionFlags.FallbackRegion, scopeID);
|
||||
RegionDataDistanceCompare distanceComparer = new RegionDataDistanceCompare(x, y);
|
||||
regions.Sort(distanceComparer);
|
||||
|
||||
return regions;
|
||||
}
|
||||
|
||||
public List<RegionData> GetHyperlinks(UUID scopeID)
|
||||
{
|
||||
return Get((int)RegionFlags.Hyperlink, scopeID);
|
||||
}
|
||||
|
||||
private List<RegionData> Get(int regionFlags, UUID scopeID)
|
||||
{
|
||||
string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & " + regionFlags.ToString() + ") <> 0";
|
||||
if (scopeID != UUID.Zero)
|
||||
sql += " AND ScopeID = @scopeID";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
|
||||
conn.Open();
|
||||
return RunCommand(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,211 +36,153 @@ using System.Text;
|
||||
|
||||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
public class MSSQLUserAccountData : MSSQLGenericTableHandler<UserAccountData>,IUserAccountData
|
||||
public class MSSQLUserAccountData : IUserAccountData
|
||||
{
|
||||
public MSSQLUserAccountData(string connectionString, string realm) :
|
||||
base(connectionString, realm, "UserAccount")
|
||||
private string m_Realm;
|
||||
private List<string> m_ColumnNames = null;
|
||||
private string m_ConnectionString;
|
||||
private MSSQLManager m_database;
|
||||
|
||||
public MSSQLUserAccountData(string connectionString, string realm)
|
||||
{
|
||||
}
|
||||
//private string m_Realm;
|
||||
//private List<string> m_ColumnNames = null;
|
||||
//private MSSQLManager m_database;
|
||||
m_Realm = realm;
|
||||
m_ConnectionString = connectionString;
|
||||
m_database = new MSSQLManager(connectionString);
|
||||
|
||||
//public MSSQLUserAccountData(string connectionString, string realm)
|
||||
//{
|
||||
// m_Realm = realm;
|
||||
// m_ConnectionString = connectionString;
|
||||
// m_database = new MSSQLManager(connectionString);
|
||||
|
||||
// using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
// {
|
||||
// conn.Open();
|
||||
// Migration m = new Migration(conn, GetType().Assembly, "UserStore");
|
||||
// m.Update();
|
||||
// }
|
||||
//}
|
||||
|
||||
//public List<UserAccountData> Query(UUID principalID, UUID scopeID, string query)
|
||||
//{
|
||||
// return null;
|
||||
//}
|
||||
|
||||
//public UserAccountData Get(UUID principalID, UUID scopeID)
|
||||
//{
|
||||
// UserAccountData ret = new UserAccountData();
|
||||
// ret.Data = new Dictionary<string, string>();
|
||||
|
||||
// string sql = string.Format("select * from {0} where UUID = @principalID", m_Realm);
|
||||
// if (scopeID != UUID.Zero)
|
||||
// sql += " and ScopeID = @scopeID";
|
||||
|
||||
// using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
// using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
// {
|
||||
// cmd.Parameters.Add(m_database.CreateParameter("@principalID", principalID));
|
||||
// cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
|
||||
|
||||
// conn.Open();
|
||||
// using (SqlDataReader result = cmd.ExecuteReader())
|
||||
// {
|
||||
// if (result.Read())
|
||||
// {
|
||||
// ret.PrincipalID = principalID;
|
||||
// UUID scope;
|
||||
// UUID.TryParse(result["ScopeID"].ToString(), out scope);
|
||||
// ret.ScopeID = scope;
|
||||
|
||||
// if (m_ColumnNames == null)
|
||||
// {
|
||||
// m_ColumnNames = new List<string>();
|
||||
|
||||
// DataTable schemaTable = result.GetSchemaTable();
|
||||
// foreach (DataRow row in schemaTable.Rows)
|
||||
// m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
// }
|
||||
|
||||
// foreach (string s in m_ColumnNames)
|
||||
// {
|
||||
// if (s == "UUID")
|
||||
// continue;
|
||||
// if (s == "ScopeID")
|
||||
// continue;
|
||||
|
||||
// ret.Data[s] = result[s].ToString();
|
||||
// }
|
||||
// return ret;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
//}
|
||||
|
||||
//public bool Store(UserAccountData data)
|
||||
//{
|
||||
// if (data.Data.ContainsKey("UUID"))
|
||||
// data.Data.Remove("UUID");
|
||||
// if (data.Data.ContainsKey("ScopeID"))
|
||||
// data.Data.Remove("ScopeID");
|
||||
|
||||
// string[] fields = new List<string>(data.Data.Keys).ToArray();
|
||||
|
||||
// using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
// using (SqlCommand cmd = new SqlCommand())
|
||||
// {
|
||||
// StringBuilder updateBuilder = new StringBuilder();
|
||||
// updateBuilder.AppendFormat("update {0} set ", m_Realm);
|
||||
// bool first = true;
|
||||
// foreach (string field in fields)
|
||||
// {
|
||||
// if (!first)
|
||||
// updateBuilder.Append(", ");
|
||||
// updateBuilder.AppendFormat("{0} = @{0}", field);
|
||||
|
||||
// first = false;
|
||||
// cmd.Parameters.Add(m_database.CreateParameter("@" + field, data.Data[field]));
|
||||
// }
|
||||
|
||||
// updateBuilder.Append(" where UUID = @principalID");
|
||||
|
||||
// if (data.ScopeID != UUID.Zero)
|
||||
// updateBuilder.Append(" and ScopeID = @scopeID");
|
||||
|
||||
// cmd.CommandText = updateBuilder.ToString();
|
||||
// cmd.Connection = conn;
|
||||
// cmd.Parameters.Add(m_database.CreateParameter("@principalID", data.PrincipalID));
|
||||
// cmd.Parameters.Add(m_database.CreateParameter("@scopeID", data.ScopeID));
|
||||
// conn.Open();
|
||||
|
||||
// if (cmd.ExecuteNonQuery() < 1)
|
||||
// {
|
||||
// StringBuilder insertBuilder = new StringBuilder();
|
||||
// insertBuilder.AppendFormat("insert into {0} (UUID, ScopeID, ", m_Realm);
|
||||
// insertBuilder.Append(String.Join(", ", fields));
|
||||
// insertBuilder.Append(") values (@principalID, @scopeID, @");
|
||||
// insertBuilder.Append(String.Join(", @", fields));
|
||||
// insertBuilder.Append(")");
|
||||
|
||||
// cmd.CommandText = insertBuilder.ToString();
|
||||
|
||||
// if (cmd.ExecuteNonQuery() < 1)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
//}
|
||||
|
||||
//public bool Store(UserAccountData data, UUID principalID, string token)
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
|
||||
//public bool SetDataItem(UUID principalID, string item, string value)
|
||||
//{
|
||||
// string sql = string.Format("update {0} set {1} = @{1} where UUID = @UUID", m_Realm, item);
|
||||
// using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
// using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
// {
|
||||
// cmd.Parameters.Add(m_database.CreateParameter("@" + item, value));
|
||||
// cmd.Parameters.Add(m_database.CreateParameter("@UUID", principalID));
|
||||
|
||||
// conn.Open();
|
||||
|
||||
// if (cmd.ExecuteNonQuery() > 0)
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
//}
|
||||
|
||||
//public UserAccountData[] Get(string[] keys, string[] vals)
|
||||
//{
|
||||
// return null;
|
||||
//}
|
||||
|
||||
public UserAccountData[] GetUsers(UUID scopeID, string query)
|
||||
{
|
||||
string[] words = query.Split(new char[] { ' ' });
|
||||
|
||||
for (int i = 0; i < words.Length; i++)
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
{
|
||||
if (words[i].Length < 3)
|
||||
conn.Open();
|
||||
Migration m = new Migration(conn, GetType().Assembly, "UserStore");
|
||||
m.Update();
|
||||
}
|
||||
}
|
||||
|
||||
public List<UserAccountData> Query(UUID principalID, UUID scopeID, string query)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public UserAccountData Get(UUID principalID, UUID scopeID)
|
||||
{
|
||||
UserAccountData ret = new UserAccountData();
|
||||
ret.Data = new Dictionary<string, object>();
|
||||
|
||||
string sql = string.Format("select * from {0} where UUID = @principalID", m_Realm);
|
||||
if (scopeID != UUID.Zero)
|
||||
sql += " and ScopeID = @scopeID";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@principalID", principalID));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
|
||||
|
||||
conn.Open();
|
||||
using (SqlDataReader result = cmd.ExecuteReader())
|
||||
{
|
||||
if (i != words.Length - 1)
|
||||
Array.Copy(words, i + 1, words, i, words.Length - i - 1);
|
||||
Array.Resize(ref words, words.Length - 1);
|
||||
if (result.Read())
|
||||
{
|
||||
ret.PrincipalID = principalID;
|
||||
UUID scope;
|
||||
UUID.TryParse(result["ScopeID"].ToString(), out scope);
|
||||
ret.ScopeID = scope;
|
||||
|
||||
if (m_ColumnNames == null)
|
||||
{
|
||||
m_ColumnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = result.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
}
|
||||
|
||||
foreach (string s in m_ColumnNames)
|
||||
{
|
||||
if (s == "UUID")
|
||||
continue;
|
||||
if (s == "ScopeID")
|
||||
continue;
|
||||
|
||||
ret.Data[s] = result[s].ToString();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (words.Length == 0)
|
||||
return new UserAccountData[0];
|
||||
public bool Store(UserAccountData data)
|
||||
{
|
||||
if (data.Data.ContainsKey("UUID"))
|
||||
data.Data.Remove("UUID");
|
||||
if (data.Data.ContainsKey("ScopeID"))
|
||||
data.Data.Remove("ScopeID");
|
||||
|
||||
if (words.Length > 2)
|
||||
return new UserAccountData[0];
|
||||
|
||||
string sql = "";
|
||||
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
if (words.Length == 1)
|
||||
StringBuilder updateBuilder = new StringBuilder();
|
||||
updateBuilder.AppendFormat("update {0} set ", m_Realm);
|
||||
bool first = true;
|
||||
foreach (string field in fields)
|
||||
{
|
||||
sql = String.Format("select * from {0} where ([ScopeID]=@ScopeID or [ScopeID]='00000000-0000-0000-0000-000000000000') and ([FirstName] like @search or [LastName] like @search)", m_Realm);
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@search", "%" + words[0] + "%"));
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = String.Format("select * from {0} where ([ScopeID]=@ScopeID or [ScopeID]='00000000-0000-0000-0000-000000000000') and ([FirstName] like @searchFirst or [LastName] like @searchLast)", m_Realm);
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@searchFirst", "%" + words[0] + "%"));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@searchLast", "%" + words[1] + "%"));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@ScopeID", scopeID.ToString()));
|
||||
if (!first)
|
||||
updateBuilder.Append(", ");
|
||||
updateBuilder.AppendFormat("{0} = @{0}", field);
|
||||
|
||||
first = false;
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@" + field, data.Data[field]));
|
||||
}
|
||||
|
||||
updateBuilder.Append(" where UUID = @principalID");
|
||||
|
||||
if (data.ScopeID != UUID.Zero)
|
||||
updateBuilder.Append(" and ScopeID = @scopeID");
|
||||
|
||||
cmd.CommandText = updateBuilder.ToString();
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = sql;
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@principalID", data.PrincipalID));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@scopeID", data.ScopeID));
|
||||
conn.Open();
|
||||
return DoQuery(cmd);
|
||||
|
||||
if (cmd.ExecuteNonQuery() < 1)
|
||||
{
|
||||
StringBuilder insertBuilder = new StringBuilder();
|
||||
insertBuilder.AppendFormat("insert into {0} (UUID, ScopeID, ", m_Realm);
|
||||
insertBuilder.Append(String.Join(", ", fields));
|
||||
insertBuilder.Append(") values (@principalID, @scopeID, @");
|
||||
insertBuilder.Append(String.Join(", @", fields));
|
||||
insertBuilder.Append(")");
|
||||
|
||||
cmd.CommandText = insertBuilder.ToString();
|
||||
|
||||
if (cmd.ExecuteNonQuery() < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool SetDataItem(UUID principalID, string item, string value)
|
||||
{
|
||||
string sql = string.Format("update {0} set {1} = @{1} where UUID = @UUID", m_Realm, item);
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@" + item, value));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@UUID", principalID));
|
||||
|
||||
conn.Open();
|
||||
|
||||
if (cmd.ExecuteNonQuery() > 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1214
OpenSim/Data/MSSQL/MSSQLUserData.cs
Normal file
1214
OpenSim/Data/MSSQL/MSSQLUserData.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,202 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ''AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using System.Data.SqlClient;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
public class MSSQLXInventoryData : IXInventoryData
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(
|
||||
// MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private MSSQLGenericTableHandler<XInventoryFolder> m_Folders;
|
||||
private MSSQLItemHandler m_Items;
|
||||
|
||||
public MSSQLXInventoryData(string conn, string realm)
|
||||
{
|
||||
m_Folders = new MSSQLGenericTableHandler<XInventoryFolder>(
|
||||
conn, "inventoryfolders", "InventoryStore");
|
||||
m_Items = new MSSQLItemHandler(
|
||||
conn, "inventoryitems", String.Empty);
|
||||
}
|
||||
|
||||
public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
|
||||
{
|
||||
return m_Folders.Get(fields, vals);
|
||||
}
|
||||
|
||||
public XInventoryItem[] GetItems(string[] fields, string[] vals)
|
||||
{
|
||||
return m_Items.Get(fields, vals);
|
||||
}
|
||||
|
||||
public bool StoreFolder(XInventoryFolder folder)
|
||||
{
|
||||
if (folder.folderName.Length > 64)
|
||||
folder.folderName = folder.folderName.Substring(0, 64);
|
||||
return m_Folders.Store(folder);
|
||||
}
|
||||
|
||||
public bool StoreItem(XInventoryItem item)
|
||||
{
|
||||
if (item.inventoryName.Length > 64)
|
||||
item.inventoryName = item.inventoryName.Substring(0, 64);
|
||||
if (item.inventoryDescription.Length > 128)
|
||||
item.inventoryDescription = item.inventoryDescription.Substring(0, 128);
|
||||
|
||||
return m_Items.Store(item);
|
||||
}
|
||||
|
||||
public bool DeleteFolders(string field, string val)
|
||||
{
|
||||
return m_Folders.Delete(field, val);
|
||||
}
|
||||
public bool DeleteFolders(string[] fields, string[] vals)
|
||||
{
|
||||
return m_Folders.Delete(fields, vals);
|
||||
}
|
||||
|
||||
public bool DeleteItems(string field, string val)
|
||||
{
|
||||
return m_Items.Delete(field, val);
|
||||
}
|
||||
public bool DeleteItems(string[] fields, string[] vals)
|
||||
{
|
||||
return m_Items.Delete(fields, vals);
|
||||
}
|
||||
public bool MoveItem(string id, string newParent)
|
||||
{
|
||||
return m_Items.MoveItem(id, newParent);
|
||||
}
|
||||
|
||||
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
||||
{
|
||||
return m_Items.GetActiveGestures(principalID);
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(UUID principalID, UUID assetID)
|
||||
{
|
||||
return m_Items.GetAssetPermissions(principalID, assetID);
|
||||
}
|
||||
}
|
||||
|
||||
public class MSSQLItemHandler : MSSQLGenericTableHandler<XInventoryItem>
|
||||
{
|
||||
public MSSQLItemHandler(string c, string t, string m) :
|
||||
base(c, t, m)
|
||||
{
|
||||
}
|
||||
|
||||
public bool MoveItem(string id, string newParent)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
|
||||
cmd.CommandText = String.Format("update {0} set parentFolderID = @ParentFolderID where inventoryID = @InventoryID", m_Realm);
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@ParentFolderID", newParent));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@InventoryID", id));
|
||||
cmd.Connection = conn;
|
||||
conn.Open();
|
||||
return cmd.ExecuteNonQuery() == 0 ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = @uuid and assetType = @type and flags = 1", m_Realm);
|
||||
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@uuid", principalID.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@type", (int)AssetType.Gesture));
|
||||
cmd.Connection = conn;
|
||||
conn.Open();
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(UUID principalID, UUID assetID)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = @PrincipalID and assetID = @AssetID group by assetID", m_Realm);
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@PrincipalID", principalID.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@AssetID", assetID.ToString()));
|
||||
cmd.Connection = conn;
|
||||
conn.Open();
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
|
||||
int perms = 0;
|
||||
|
||||
if (reader.Read())
|
||||
{
|
||||
perms = Convert.ToInt32(reader["inventoryCurrentPermissions"]);
|
||||
}
|
||||
|
||||
return perms;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public override bool Store(XInventoryItem item)
|
||||
{
|
||||
if (!base.Store(item))
|
||||
return false;
|
||||
string sql = "update inventoryfolders set version=version+1 where folderID = @folderID";
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
cmd.Parameters.AddWithValue("@folderID", item.parentFolderID.ToString());
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
OpenSim/Data/MSSQL/Resources/001_AssetStore.sql
Normal file
13
OpenSim/Data/MSSQL/Resources/001_AssetStore.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
CREATE TABLE [assets] (
|
||||
[id] [varchar](36) NOT NULL,
|
||||
[name] [varchar](64) NOT NULL,
|
||||
[description] [varchar](64) NOT NULL,
|
||||
[assetType] [tinyint] NOT NULL,
|
||||
[local] [tinyint] NOT NULL,
|
||||
[temporary] [tinyint] NOT NULL,
|
||||
[data] [image] NOT NULL,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[id] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
85
OpenSim/Data/MSSQL/Resources/001_EstateStore.sql
Normal file
85
OpenSim/Data/MSSQL/Resources/001_EstateStore.sql
Normal file
@@ -0,0 +1,85 @@
|
||||
BEGIN TRANSACTION
|
||||
|
||||
CREATE TABLE [dbo].[estate_managers](
|
||||
[EstateID] [int] NOT NULL,
|
||||
[uuid] [varchar](36) NOT NULL,
|
||||
CONSTRAINT [PK_estate_managers] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[EstateID] ASC
|
||||
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY];
|
||||
|
||||
CREATE TABLE [dbo].[estate_groups](
|
||||
[EstateID] [int] NOT NULL,
|
||||
[uuid] [varchar](36) NOT NULL,
|
||||
CONSTRAINT [PK_estate_groups] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[EstateID] ASC
|
||||
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY];
|
||||
|
||||
|
||||
CREATE TABLE [dbo].[estate_users](
|
||||
[EstateID] [int] NOT NULL,
|
||||
[uuid] [varchar](36) NOT NULL,
|
||||
CONSTRAINT [PK_estate_users] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[EstateID] ASC
|
||||
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY];
|
||||
|
||||
|
||||
CREATE TABLE [dbo].[estateban](
|
||||
[EstateID] [int] NOT NULL,
|
||||
[bannedUUID] [varchar](36) NOT NULL,
|
||||
[bannedIp] [varchar](16) NOT NULL,
|
||||
[bannedIpHostMask] [varchar](16) NOT NULL,
|
||||
[bannedNameMask] [varchar](64) NULL DEFAULT (NULL),
|
||||
CONSTRAINT [PK_estateban] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[EstateID] ASC
|
||||
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY];
|
||||
|
||||
CREATE TABLE [dbo].[estate_settings](
|
||||
[EstateID] [int] IDENTITY(1,100) NOT NULL,
|
||||
[EstateName] [varchar](64) NULL DEFAULT (NULL),
|
||||
[AbuseEmailToEstateOwner] [bit] NOT NULL,
|
||||
[DenyAnonymous] [bit] NOT NULL,
|
||||
[ResetHomeOnTeleport] [bit] NOT NULL,
|
||||
[FixedSun] [bit] NOT NULL,
|
||||
[DenyTransacted] [bit] NOT NULL,
|
||||
[BlockDwell] [bit] NOT NULL,
|
||||
[DenyIdentified] [bit] NOT NULL,
|
||||
[AllowVoice] [bit] NOT NULL,
|
||||
[UseGlobalTime] [bit] NOT NULL,
|
||||
[PricePerMeter] [int] NOT NULL,
|
||||
[TaxFree] [bit] NOT NULL,
|
||||
[AllowDirectTeleport] [bit] NOT NULL,
|
||||
[RedirectGridX] [int] NOT NULL,
|
||||
[RedirectGridY] [int] NOT NULL,
|
||||
[ParentEstateID] [int] NOT NULL,
|
||||
[SunPosition] [float] NOT NULL,
|
||||
[EstateSkipScripts] [bit] NOT NULL,
|
||||
[BillableFactor] [float] NOT NULL,
|
||||
[PublicAccess] [bit] NOT NULL,
|
||||
[AbuseEmail] [varchar](255) NOT NULL,
|
||||
[EstateOwner] [varchar](36) NOT NULL,
|
||||
[DenyMinors] [bit] NOT NULL,
|
||||
CONSTRAINT [PK_estate_settings] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[EstateID] ASC
|
||||
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY];
|
||||
|
||||
|
||||
CREATE TABLE [dbo].[estate_map](
|
||||
[RegionID] [varchar](36) NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
|
||||
[EstateID] [int] NOT NULL,
|
||||
CONSTRAINT [PK_estate_map] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[RegionID] ASC
|
||||
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY];
|
||||
|
||||
COMMIT
|
||||
37
OpenSim/Data/MSSQL/Resources/001_GridStore.sql
Normal file
37
OpenSim/Data/MSSQL/Resources/001_GridStore.sql
Normal file
@@ -0,0 +1,37 @@
|
||||
BEGIN TRANSACTION
|
||||
|
||||
CREATE TABLE [dbo].[regions](
|
||||
[regionHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[regionName] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[uuid] [varchar](255) COLLATE Latin1_General_CI_AS NOT NULL,
|
||||
[regionRecvKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[regionSecret] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[regionSendKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[regionDataURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[serverIP] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[serverPort] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[serverURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[locX] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[locY] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[locZ] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[eastOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[westOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[southOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[northOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[regionAssetURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[regionAssetRecvKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[regionAssetSendKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[regionUserURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[regionUserRecvKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[regionUserSendKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[regionMapTexture] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[serverHttpPort] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[serverRemotingPort] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||
[owner_uuid] [varchar](36) COLLATE Latin1_General_CI_AS NULL,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[uuid] ASC
|
||||
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
|
||||
COMMIT
|
||||
64
OpenSim/Data/MSSQL/Resources/001_InventoryStore.sql
Normal file
64
OpenSim/Data/MSSQL/Resources/001_InventoryStore.sql
Normal file
@@ -0,0 +1,64 @@
|
||||
BEGIN TRANSACTION
|
||||
|
||||
CREATE TABLE [inventoryfolders] (
|
||||
[folderID] [varchar](36) NOT NULL default '',
|
||||
[agentID] [varchar](36) default NULL,
|
||||
[parentFolderID] [varchar](36) default NULL,
|
||||
[folderName] [varchar](64) default NULL,
|
||||
[type] [smallint] NOT NULL default 0,
|
||||
[version] [int] NOT NULL default 0,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[folderID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
|
||||
CREATE NONCLUSTERED INDEX [owner] ON [inventoryfolders]
|
||||
(
|
||||
[agentID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
|
||||
CREATE NONCLUSTERED INDEX [parent] ON [inventoryfolders]
|
||||
(
|
||||
[parentFolderID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
|
||||
|
||||
CREATE TABLE [inventoryitems] (
|
||||
[inventoryID] [varchar](36) NOT NULL default '',
|
||||
[assetID] [varchar](36) default NULL,
|
||||
[assetType] [int] default NULL,
|
||||
[parentFolderID] [varchar](36) default NULL,
|
||||
[avatarID] [varchar](36) default NULL,
|
||||
[inventoryName] [varchar](64) default NULL,
|
||||
[inventoryDescription] [varchar](128) default NULL,
|
||||
[inventoryNextPermissions] [int] default NULL,
|
||||
[inventoryCurrentPermissions] [int] default NULL,
|
||||
[invType] [int] default NULL,
|
||||
[creatorID] [varchar](36) default NULL,
|
||||
[inventoryBasePermissions] [int] NOT NULL default 0,
|
||||
[inventoryEveryOnePermissions] [int] NOT NULL default 0,
|
||||
[salePrice] [int] default NULL,
|
||||
[saleType] [tinyint] default NULL,
|
||||
[creationDate] [int] default NULL,
|
||||
[groupID] [varchar](36) default NULL,
|
||||
[groupOwned] [bit] default NULL,
|
||||
[flags] [int] default NULL,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[inventoryID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
|
||||
|
||||
CREATE NONCLUSTERED INDEX [owner] ON [inventoryitems]
|
||||
(
|
||||
[avatarID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
|
||||
CREATE NONCLUSTERED INDEX [folder] ON [inventoryitems]
|
||||
(
|
||||
[parentFolderID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
|
||||
COMMIT
|
||||
@@ -1,5 +1,3 @@
|
||||
:VERSION 1
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
CREATE TABLE [logs] (
|
||||
161
OpenSim/Data/MSSQL/Resources/001_RegionStore.sql
Normal file
161
OpenSim/Data/MSSQL/Resources/001_RegionStore.sql
Normal file
@@ -0,0 +1,161 @@
|
||||
CREATE TABLE [dbo].[prims](
|
||||
[UUID] [varchar](255) NOT NULL,
|
||||
[RegionUUID] [varchar](255) NULL,
|
||||
[ParentID] [int] NULL,
|
||||
[CreationDate] [int] NULL,
|
||||
[Name] [varchar](255) NULL,
|
||||
[SceneGroupID] [varchar](255) NULL,
|
||||
[Text] [varchar](255) NULL,
|
||||
[Description] [varchar](255) NULL,
|
||||
[SitName] [varchar](255) NULL,
|
||||
[TouchName] [varchar](255) NULL,
|
||||
[ObjectFlags] [int] NULL,
|
||||
[CreatorID] [varchar](255) NULL,
|
||||
[OwnerID] [varchar](255) NULL,
|
||||
[GroupID] [varchar](255) NULL,
|
||||
[LastOwnerID] [varchar](255) NULL,
|
||||
[OwnerMask] [int] NULL,
|
||||
[NextOwnerMask] [int] NULL,
|
||||
[GroupMask] [int] NULL,
|
||||
[EveryoneMask] [int] NULL,
|
||||
[BaseMask] [int] NULL,
|
||||
[PositionX] [float] NULL,
|
||||
[PositionY] [float] NULL,
|
||||
[PositionZ] [float] NULL,
|
||||
[GroupPositionX] [float] NULL,
|
||||
[GroupPositionY] [float] NULL,
|
||||
[GroupPositionZ] [float] NULL,
|
||||
[VelocityX] [float] NULL,
|
||||
[VelocityY] [float] NULL,
|
||||
[VelocityZ] [float] NULL,
|
||||
[AngularVelocityX] [float] NULL,
|
||||
[AngularVelocityY] [float] NULL,
|
||||
[AngularVelocityZ] [float] NULL,
|
||||
[AccelerationX] [float] NULL,
|
||||
[AccelerationY] [float] NULL,
|
||||
[AccelerationZ] [float] NULL,
|
||||
[RotationX] [float] NULL,
|
||||
[RotationY] [float] NULL,
|
||||
[RotationZ] [float] NULL,
|
||||
[RotationW] [float] NULL,
|
||||
[SitTargetOffsetX] [float] NULL,
|
||||
[SitTargetOffsetY] [float] NULL,
|
||||
[SitTargetOffsetZ] [float] NULL,
|
||||
[SitTargetOrientW] [float] NULL,
|
||||
[SitTargetOrientX] [float] NULL,
|
||||
[SitTargetOrientY] [float] NULL,
|
||||
[SitTargetOrientZ] [float] NULL,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[UUID] ASC
|
||||
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
|
||||
CREATE TABLE [dbo].[primshapes](
|
||||
[UUID] [varchar](255) NOT NULL,
|
||||
[Shape] [int] NULL,
|
||||
[ScaleX] [float] NULL,
|
||||
[ScaleY] [float] NULL,
|
||||
[ScaleZ] [float] NULL,
|
||||
[PCode] [int] NULL,
|
||||
[PathBegin] [int] NULL,
|
||||
[PathEnd] [int] NULL,
|
||||
[PathScaleX] [int] NULL,
|
||||
[PathScaleY] [int] NULL,
|
||||
[PathShearX] [int] NULL,
|
||||
[PathShearY] [int] NULL,
|
||||
[PathSkew] [int] NULL,
|
||||
[PathCurve] [int] NULL,
|
||||
[PathRadiusOffset] [int] NULL,
|
||||
[PathRevolutions] [int] NULL,
|
||||
[PathTaperX] [int] NULL,
|
||||
[PathTaperY] [int] NULL,
|
||||
[PathTwist] [int] NULL,
|
||||
[PathTwistBegin] [int] NULL,
|
||||
[ProfileBegin] [int] NULL,
|
||||
[ProfileEnd] [int] NULL,
|
||||
[ProfileCurve] [int] NULL,
|
||||
[ProfileHollow] [int] NULL,
|
||||
[State] [int] NULL,
|
||||
[Texture] [image] NULL,
|
||||
[ExtraParams] [image] NULL,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[UUID] ASC
|
||||
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||
|
||||
CREATE TABLE [dbo].[primitems](
|
||||
[itemID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
|
||||
[primID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[assetID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[parentFolderID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[invType] [int] NULL,
|
||||
[assetType] [int] NULL,
|
||||
[name] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[description] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[creationDate] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[creatorID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[ownerID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[lastOwnerID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[groupID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[nextPermissions] [int] NULL,
|
||||
[currentPermissions] [int] NULL,
|
||||
[basePermissions] [int] NULL,
|
||||
[everyonePermissions] [int] NULL,
|
||||
[groupPermissions] [int] NULL,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[itemID] ASC
|
||||
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
|
||||
CREATE TABLE [dbo].[terrain](
|
||||
[RegionUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[Revision] [int] NULL,
|
||||
[Heightfield] [image] NULL
|
||||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||
|
||||
CREATE TABLE [dbo].[land](
|
||||
[UUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
|
||||
[RegionUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[LocalLandID] [int] NULL,
|
||||
[Bitmap] [image] NULL,
|
||||
[Name] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[Description] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[OwnerUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[IsGroupOwned] [int] NULL,
|
||||
[Area] [int] NULL,
|
||||
[AuctionID] [int] NULL,
|
||||
[Category] [int] NULL,
|
||||
[ClaimDate] [int] NULL,
|
||||
[ClaimPrice] [int] NULL,
|
||||
[GroupUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[SalePrice] [int] NULL,
|
||||
[LandStatus] [int] NULL,
|
||||
[LandFlags] [int] NULL,
|
||||
[LandingType] [int] NULL,
|
||||
[MediaAutoScale] [int] NULL,
|
||||
[MediaTextureUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[MediaURL] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[MusicURL] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[PassHours] [float] NULL,
|
||||
[PassPrice] [int] NULL,
|
||||
[SnapshotUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[UserLocationX] [float] NULL,
|
||||
[UserLocationY] [float] NULL,
|
||||
[UserLocationZ] [float] NULL,
|
||||
[UserLookAtX] [float] NULL,
|
||||
[UserLookAtY] [float] NULL,
|
||||
[UserLookAtZ] [float] NULL,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[UUID] ASC
|
||||
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||
|
||||
CREATE TABLE [dbo].[landaccesslist](
|
||||
[LandUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[AccessUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[Flags] [int] NULL
|
||||
) ON [PRIMARY]
|
||||
112
OpenSim/Data/MSSQL/Resources/001_UserStore.sql
Normal file
112
OpenSim/Data/MSSQL/Resources/001_UserStore.sql
Normal file
@@ -0,0 +1,112 @@
|
||||
CREATE TABLE [users] (
|
||||
[UUID] [varchar](36) NOT NULL default '',
|
||||
[username] [varchar](32) NOT NULL,
|
||||
[lastname] [varchar](32) NOT NULL,
|
||||
[passwordHash] [varchar](32) NOT NULL,
|
||||
[passwordSalt] [varchar](32) NOT NULL,
|
||||
[homeRegion] [bigint] default NULL,
|
||||
[homeLocationX] [float] default NULL,
|
||||
[homeLocationY] [float] default NULL,
|
||||
[homeLocationZ] [float] default NULL,
|
||||
[homeLookAtX] [float] default NULL,
|
||||
[homeLookAtY] [float] default NULL,
|
||||
[homeLookAtZ] [float] default NULL,
|
||||
[created] [int] NOT NULL,
|
||||
[lastLogin] [int] NOT NULL,
|
||||
[userInventoryURI] [varchar](255) default NULL,
|
||||
[userAssetURI] [varchar](255) default NULL,
|
||||
[profileCanDoMask] [int] default NULL,
|
||||
[profileWantDoMask] [int] default NULL,
|
||||
[profileAboutText] [ntext],
|
||||
[profileFirstText] [ntext],
|
||||
[profileImage] [varchar](36) default NULL,
|
||||
[profileFirstImage] [varchar](36) default NULL,
|
||||
[webLoginKey] [varchar](36) default NULL,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[UUID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
|
||||
|
||||
CREATE NONCLUSTERED INDEX [usernames] ON [users]
|
||||
(
|
||||
[username] ASC,
|
||||
[lastname] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
|
||||
|
||||
CREATE TABLE [agents] (
|
||||
[UUID] [varchar](36) NOT NULL,
|
||||
[sessionID] [varchar](36) NOT NULL,
|
||||
[secureSessionID] [varchar](36) NOT NULL,
|
||||
[agentIP] [varchar](16) NOT NULL,
|
||||
[agentPort] [int] NOT NULL,
|
||||
[agentOnline] [tinyint] NOT NULL,
|
||||
[loginTime] [int] NOT NULL,
|
||||
[logoutTime] [int] NOT NULL,
|
||||
[currentRegion] [varchar](36) NOT NULL,
|
||||
[currentHandle] [bigint] NOT NULL,
|
||||
[currentPos] [varchar](64) NOT NULL,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[UUID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
|
||||
|
||||
CREATE NONCLUSTERED INDEX [session] ON [agents]
|
||||
(
|
||||
[sessionID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
|
||||
CREATE NONCLUSTERED INDEX [ssession] ON [agents]
|
||||
(
|
||||
[secureSessionID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
|
||||
|
||||
CREATE TABLE [dbo].[userfriends](
|
||||
[ownerID] [varchar](50) COLLATE Latin1_General_CI_AS NOT NULL,
|
||||
[friendID] [varchar](50) COLLATE Latin1_General_CI_AS NOT NULL,
|
||||
[friendPerms] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
|
||||
[datetimestamp] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
|
||||
) ON [PRIMARY]
|
||||
|
||||
CREATE TABLE [avatarappearance] (
|
||||
[Owner] [varchar](36) NOT NULL,
|
||||
[Serial] int NOT NULL,
|
||||
[Visual_Params] [image] NOT NULL,
|
||||
[Texture] [image] NOT NULL,
|
||||
[Avatar_Height] float NOT NULL,
|
||||
[Body_Item] [varchar](36) NOT NULL,
|
||||
[Body_Asset] [varchar](36) NOT NULL,
|
||||
[Skin_Item] [varchar](36) NOT NULL,
|
||||
[Skin_Asset] [varchar](36) NOT NULL,
|
||||
[Hair_Item] [varchar](36) NOT NULL,
|
||||
[Hair_Asset] [varchar](36) NOT NULL,
|
||||
[Eyes_Item] [varchar](36) NOT NULL,
|
||||
[Eyes_Asset] [varchar](36) NOT NULL,
|
||||
[Shirt_Item] [varchar](36) NOT NULL,
|
||||
[Shirt_Asset] [varchar](36) NOT NULL,
|
||||
[Pants_Item] [varchar](36) NOT NULL,
|
||||
[Pants_Asset] [varchar](36) NOT NULL,
|
||||
[Shoes_Item] [varchar](36) NOT NULL,
|
||||
[Shoes_Asset] [varchar](36) NOT NULL,
|
||||
[Socks_Item] [varchar](36) NOT NULL,
|
||||
[Socks_Asset] [varchar](36) NOT NULL,
|
||||
[Jacket_Item] [varchar](36) NOT NULL,
|
||||
[Jacket_Asset] [varchar](36) NOT NULL,
|
||||
[Gloves_Item] [varchar](36) NOT NULL,
|
||||
[Gloves_Asset] [varchar](36) NOT NULL,
|
||||
[Undershirt_Item] [varchar](36) NOT NULL,
|
||||
[Undershirt_Asset] [varchar](36) NOT NULL,
|
||||
[Underpants_Item] [varchar](36) NOT NULL,
|
||||
[Underpants_Asset] [varchar](36) NOT NULL,
|
||||
[Skirt_Item] [varchar](36) NOT NULL,
|
||||
[Skirt_Asset] [varchar](36) NOT NULL,
|
||||
|
||||
PRIMARY KEY CLUSTERED (
|
||||
[Owner]
|
||||
) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
29
OpenSim/Data/MSSQL/Resources/002_AssetStore.sql
Normal file
29
OpenSim/Data/MSSQL/Resources/002_AssetStore.sql
Normal file
@@ -0,0 +1,29 @@
|
||||
BEGIN TRANSACTION
|
||||
|
||||
CREATE TABLE Tmp_assets
|
||||
(
|
||||
id varchar(36) NOT NULL,
|
||||
name varchar(64) NOT NULL,
|
||||
description varchar(64) NOT NULL,
|
||||
assetType tinyint NOT NULL,
|
||||
local bit NOT NULL,
|
||||
temporary bit NOT NULL,
|
||||
data image NOT NULL
|
||||
) ON [PRIMARY]
|
||||
TEXTIMAGE_ON [PRIMARY]
|
||||
|
||||
IF EXISTS(SELECT * FROM assets)
|
||||
EXEC('INSERT INTO Tmp_assets (id, name, description, assetType, local, temporary, data)
|
||||
SELECT id, name, description, assetType, CONVERT(bit, local), CONVERT(bit, temporary), data FROM assets WITH (HOLDLOCK TABLOCKX)')
|
||||
|
||||
DROP TABLE assets
|
||||
|
||||
EXECUTE sp_rename N'Tmp_assets', N'assets', 'OBJECT'
|
||||
|
||||
ALTER TABLE dbo.assets ADD CONSTRAINT
|
||||
PK__assets__id PRIMARY KEY CLUSTERED
|
||||
(
|
||||
id
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
|
||||
COMMIT
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user