aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer
diff options
context:
space:
mode:
authorMW2007-05-16 15:46:22 +0000
committerMW2007-05-16 15:46:22 +0000
commit3f39648605a432aae6a8c9ff9fb5ee481b06035e (patch)
tree52c5fab963a15b5a82b66a8617f2692b8d67674f /OpenSim.RegionServer
parent* deleted some user files (diff)
downloadopensim-SC-3f39648605a432aae6a8c9ff9fb5ee481b06035e.zip
opensim-SC-3f39648605a432aae6a8c9ff9fb5ee481b06035e.tar.gz
opensim-SC-3f39648605a432aae6a8c9ff9fb5ee481b06035e.tar.bz2
opensim-SC-3f39648605a432aae6a8c9ff9fb5ee481b06035e.tar.xz
More refactoring.
Changed AuthenticateSession handling, now calls a method in UDPServer. (but is likely to change again soon)
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.csproj12
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.dll.build1
-rw-r--r--OpenSim.RegionServer/OpenSim.csproj186
-rw-r--r--OpenSim.RegionServer/OpenSim.exe.build69
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs2
-rw-r--r--OpenSim.RegionServer/OpenSimNetworkHandler.cs3
-rw-r--r--OpenSim.RegionServer/SimClient.PacketHandlers.cs2
-rw-r--r--OpenSim.RegionServer/SimClient.ProcessPackets.cs417
-rw-r--r--OpenSim.RegionServer/SimClient.cs456
-rw-r--r--OpenSim.RegionServer/UDPServer.cs9
10 files changed, 479 insertions, 678 deletions
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
index 3c18bb6..8b23336 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
@@ -150,16 +150,24 @@
150 </Compile> 150 </Compile>
151 <Compile Include="SimClient.Grid.cs"> 151 <Compile Include="SimClient.Grid.cs">
152 <SubType>Code</SubType> 152 <SubType>Code</SubType>
153 <DependentUpon>SimClient.cs</DependentUpon>
153 </Compile> 154 </Compile>
154 <Compile Include="SimClient.PacketHandlers.cs"> 155 <Compile Include="SimClient.PacketHandlers.cs">
155 <SubType>Code</SubType> 156 <SubType>Code</SubType>
157 <DependentUpon>SimClient.cs</DependentUpon>
156 </Compile> 158 </Compile>
159 <Compile Include="SimClient.ProcessPackets.cs">
160 <SubType>Code</SubType>
161 <DependentUpon>SimClient.cs</DependentUpon>
162 </Compile>
163
157 <Compile Include="SimClientBase.cs"> 164 <Compile Include="SimClientBase.cs">
158 <SubType>Code</SubType> 165 <SubType>Code</SubType>
159 </Compile> 166 </Compile>
160 <Compile Include="UDPServer.cs"> 167 <Compile Include="UDPServer.cs">
161 <SubType>Code</SubType> 168 <SubType>Code</SubType>
162 </Compile> 169 </Compile>
170
163 <Compile Include="VersionInfo.cs"> 171 <Compile Include="VersionInfo.cs">
164 <SubType>Code</SubType> 172 <SubType>Code</SubType>
165 </Compile> 173 </Compile>
@@ -180,12 +188,14 @@
180 </Compile> 188 </Compile>
181 <Compile Include="world\Avatar.Client.cs"> 189 <Compile Include="world\Avatar.Client.cs">
182 <SubType>Code</SubType> 190 <SubType>Code</SubType>
191 <DependentUpon>Avatar.cs</DependentUpon>
183 </Compile> 192 </Compile>
184 <Compile Include="world\Avatar.cs"> 193 <Compile Include="world\Avatar.cs">
185 <SubType>Code</SubType> 194 <SubType>Code</SubType>
186 </Compile> 195 </Compile>
187 <Compile Include="world\Avatar.Update.cs"> 196 <Compile Include="world\Avatar.Update.cs">
188 <SubType>Code</SubType> 197 <SubType>Code</SubType>
198 <DependentUpon>Avatar.cs</DependentUpon>
189 </Compile> 199 </Compile>
190 <Compile Include="world\AvatarAnimations.cs"> 200 <Compile Include="world\AvatarAnimations.cs">
191 <SubType>Code</SubType> 201 <SubType>Code</SubType>
@@ -207,9 +217,11 @@
207 </Compile> 217 </Compile>
208 <Compile Include="world\World.PacketHandlers.cs"> 218 <Compile Include="world\World.PacketHandlers.cs">
209 <SubType>Code</SubType> 219 <SubType>Code</SubType>
220 <DependentUpon>World.cs</DependentUpon>
210 </Compile> 221 </Compile>
211 <Compile Include="world\World.Scripting.cs"> 222 <Compile Include="world\World.Scripting.cs">
212 <SubType>Code</SubType> 223 <SubType>Code</SubType>
224 <DependentUpon>World.cs</DependentUpon>
213 </Compile> 225 </Compile>
214 <Compile Include="world\scripting\IScriptContext.cs"> 226 <Compile Include="world\scripting\IScriptContext.cs">
215 <SubType>Code</SubType> 227 <SubType>Code</SubType>
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
index ab21d7e..25f4b60 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
@@ -21,6 +21,7 @@
21 <include name="SimClient.cs" /> 21 <include name="SimClient.cs" />
22 <include name="SimClient.Grid.cs" /> 22 <include name="SimClient.Grid.cs" />
23 <include name="SimClient.PacketHandlers.cs" /> 23 <include name="SimClient.PacketHandlers.cs" />
24 <include name="SimClient.ProcessPackets.cs" />
24 <include name="SimClientBase.cs" /> 25 <include name="SimClientBase.cs" />
25 <include name="UDPServer.cs" /> 26 <include name="UDPServer.cs" />
26 <include name="VersionInfo.cs" /> 27 <include name="VersionInfo.cs" />
diff --git a/OpenSim.RegionServer/OpenSim.csproj b/OpenSim.RegionServer/OpenSim.csproj
deleted file mode 100644
index 035f3e0..0000000
--- a/OpenSim.RegionServer/OpenSim.csproj
+++ /dev/null
@@ -1,186 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{6E597AD4-1F7D-4389-B04C-403EF1046AAB}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon>
10 </ApplicationIcon>
11 <AssemblyKeyContainerName>
12 </AssemblyKeyContainerName>
13 <AssemblyName>OpenSim</AssemblyName>
14 <DefaultClientScript>JScript</DefaultClientScript>
15 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
17 <DelaySign>false</DelaySign>
18 <OutputType>Exe</OutputType>
19 <AppDesignerFolder>
20 </AppDesignerFolder>
21 <RootNamespace>OpenSim</RootNamespace>
22 <StartupObject>
23 </StartupObject>
24 <FileUpgradeFlags>
25 </FileUpgradeFlags>
26 </PropertyGroup>
27 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
28 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
29 <BaseAddress>285212672</BaseAddress>
30 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
31 <ConfigurationOverrideFile>
32 </ConfigurationOverrideFile>
33 <DefineConstants>TRACE;DEBUG</DefineConstants>
34 <DocumentationFile>
35 </DocumentationFile>
36 <DebugSymbols>True</DebugSymbols>
37 <FileAlignment>4096</FileAlignment>
38 <Optimize>False</Optimize>
39 <OutputPath>..\bin\</OutputPath>
40 <RegisterForComInterop>False</RegisterForComInterop>
41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
43 <WarningLevel>4</WarningLevel>
44 <NoWarn>
45 </NoWarn>
46 </PropertyGroup>
47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
49 <BaseAddress>285212672</BaseAddress>
50 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
51 <ConfigurationOverrideFile>
52 </ConfigurationOverrideFile>
53 <DefineConstants>TRACE</DefineConstants>
54 <DocumentationFile>
55 </DocumentationFile>
56 <DebugSymbols>False</DebugSymbols>
57 <FileAlignment>4096</FileAlignment>
58 <Optimize>True</Optimize>
59 <OutputPath>..\bin\</OutputPath>
60 <RegisterForComInterop>False</RegisterForComInterop>
61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
63 <WarningLevel>4</WarningLevel>
64 <NoWarn>
65 </NoWarn>
66 </PropertyGroup>
67 <ItemGroup>
68 <Reference Include="System">
69 <HintPath>System.dll</HintPath>
70 <Private>False</Private>
71 </Reference>
72 <Reference Include="System.Data" />
73 <Reference Include="System.Xml">
74 <HintPath>System.Xml.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="libsecondlife.dll">
78 <HintPath>..\bin\libsecondlife.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 <Reference Include="Axiom.MathLib.dll">
82 <HintPath>..\bin\Axiom.MathLib.dll</HintPath>
83 <Private>False</Private>
84 </Reference>
85 <Reference Include="Db4objects.Db4o.dll">
86 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
87 <Private>False</Private>
88 </Reference>
89 </ItemGroup>
90 <ItemGroup>
91 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
92 <Name>OpenSim.Framework.Console</Name>
93 <Project>{1492353A-6133-4557-9AD8-6E24386D70F8}</Project>
94 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
95 <Private>False</Private>
96 </ProjectReference>
97 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
98 <Name>OpenSim.Physics.Manager</Name>
99 <Project>{0FD686EA-1917-469E-A885-1D9DEEA1D340}</Project>
100 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
101 <Private>False</Private>
102 </ProjectReference>
103 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
104 <Name>OpenSim.Framework</Name>
105 <Project>{E267CE4E-F355-4A27-8D0D-CA48FEE7F978}</Project>
106 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
107 <Private>False</Private>
108 </ProjectReference>
109 </ItemGroup>
110 <ItemGroup>
111 <Compile Include="Grid.cs">
112 <SubType>Code</SubType>
113 </Compile>
114 <Compile Include="OpenSimApplication.cs">
115 <SubType>Code</SubType>
116 </Compile>
117 <Compile Include="OpenSimMain.cs">
118 <SubType>Code</SubType>
119 </Compile>
120 <Compile Include="OpenSimRoot.cs">
121 <SubType>Code</SubType>
122 </Compile>
123 <Compile Include="QueItem.cs">
124 <SubType>Code</SubType>
125 </Compile>
126 <Compile Include="SimClient.cs">
127 <SubType>Code</SubType>
128 </Compile>
129 <Compile Include="SimConsole.cs">
130 <SubType>Code</SubType>
131 </Compile>
132 <Compile Include="VersionInfo.cs">
133 <SubType>Code</SubType>
134 </Compile>
135 <Compile Include="Assets\AssetCache.cs">
136 <SubType>Code</SubType>
137 </Compile>
138 <Compile Include="Assets\InventoryCache.cs">
139 <SubType>Code</SubType>
140 </Compile>
141 <Compile Include="CAPS\SimHttp.cs">
142 <SubType>Code</SubType>
143 </Compile>
144 <Compile Include="types\Mesh.cs">
145 <SubType>Code</SubType>
146 </Compile>
147 <Compile Include="types\Triangle.cs">
148 <SubType>Code</SubType>
149 </Compile>
150 <Compile Include="UserServer\LocalUserProfileManager.cs">
151 <SubType>Code</SubType>
152 </Compile>
153 <Compile Include="UserServer\LoginServer.cs">
154 <SubType>Code</SubType>
155 </Compile>
156 <Compile Include="world\Avatar.cs">
157 <SubType>Code</SubType>
158 </Compile>
159 <Compile Include="world\AvatarAnimations.cs" />
160 <Compile Include="world\Entity.cs">
161 <SubType>Code</SubType>
162 </Compile>
163 <Compile Include="world\Primitive.cs">
164 <SubType>Code</SubType>
165 </Compile>
166 <Compile Include="world\ScriptEngine.cs">
167 <SubType>Code</SubType>
168 </Compile>
169 <Compile Include="world\SurfacePatch.cs">
170 <SubType>Code</SubType>
171 </Compile>
172 <Compile Include="world\World.cs">
173 <SubType>Code</SubType>
174 </Compile>
175 <Compile Include="world\scripting\IScript.cs">
176 <SubType>Code</SubType>
177 </Compile>
178 </ItemGroup>
179 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
180 <PropertyGroup>
181 <PreBuildEvent>
182 </PreBuildEvent>
183 <PostBuildEvent>
184 </PostBuildEvent>
185 </PropertyGroup>
186</Project> \ No newline at end of file
diff --git a/OpenSim.RegionServer/OpenSim.exe.build b/OpenSim.RegionServer/OpenSim.exe.build
deleted file mode 100644
index 529f5fb..0000000
--- a/OpenSim.RegionServer/OpenSim.exe.build
+++ /dev/null
@@ -1,69 +0,0 @@
1<?xml version="1.0" ?>
2<project name="OpenSim" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
11 <resources prefix="OpenSim" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AgentAssetUpload.cs" />
15 <include name="Grid.cs" />
16 <include name="OpenSimApplication.cs" />
17 <include name="OpenSimMain.cs" />
18 <include name="OpenSimRoot.cs" />
19 <include name="QueItem.cs" />
20 <include name="SimClient.cs" />
21 <include name="SimConsole.cs" />
22 <include name="VersionInfo.cs" />
23 <include name="Assets/AssetCache.cs" />
24 <include name="Assets/InventoryCache.cs" />
25 <include name="CAPS/SimHttp.cs" />
26 <include name="types/Mesh.cs" />
27 <include name="types/Triangle.cs" />
28 <include name="UserServer/LocalUserProfileManager.cs" />
29 <include name="UserServer/LoginServer.cs" />
30 <include name="world/Avatar.cs" />
31 <include name="world/AvatarAnimations.cs" />
32 <include name="world/Entity.cs" />
33 <include name="world/Primitive.cs" />
34 <include name="world/ScriptEngine.cs" />
35 <include name="world/SurfacePatch.cs" />
36 <include name="world/World.cs" />
37 <include name="world/scripting/IScript.cs" />
38 </sources>
39 <references basedir="${project::get-base-directory()}">
40 <lib>
41 <include name="${project::get-base-directory()}" />
42 <include name="${project::get-base-directory()}/${build.dir}" />
43 </lib>
44 <include name="System.dll" />
45 <include name="System.Xml.dll.dll" />
46 <include name="../bin/libsecondlife.dll" />
47 <include name="../bin/Axiom.MathLib.dll" />
48 <include name="../bin/Db4objects.Db4o.dll" />
49 <include name="../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
50 <include name="../OpenSim.Physics/Manager/${build.dir}/OpenSim.Physics.Manager.dll" />
51 <include name="../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
52 </references>
53 </csc>
54 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
55 <mkdir dir="${project::get-base-directory()}/../bin/"/>
56 <copy todir="${project::get-base-directory()}/../bin/">
57 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
58 <include name="*.dll"/>
59 <include name="*.exe"/>
60 </fileset>
61 </copy>
62 </target>
63 <target name="clean">
64 <delete dir="${bin.dir}" failonerror="false" />
65 <delete dir="${obj.dir}" failonerror="false" />
66 </target>
67 <target name="doc" description="Creates documentation.">
68 </target>
69</project>
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index 46b682b..ce49074 100644
--- a/OpenSim.RegionServer/OpenSimMain.cs
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -267,7 +267,7 @@ namespace OpenSim
267 LocalWorld.LoadWorldMap(); 267 LocalWorld.LoadWorldMap();
268 268
269 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting up messaging system"); 269 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting up messaging system");
270 LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); //should be reading from the config file what physics engine to use 270 LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine);
271 LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); 271 LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D());
272 LocalWorld.LoadPrimsFromStorage(); 272 LocalWorld.LoadPrimsFromStorage();
273 } 273 }
diff --git a/OpenSim.RegionServer/OpenSimNetworkHandler.cs b/OpenSim.RegionServer/OpenSimNetworkHandler.cs
index e3a7375..15ee740 100644
--- a/OpenSim.RegionServer/OpenSimNetworkHandler.cs
+++ b/OpenSim.RegionServer/OpenSimNetworkHandler.cs
@@ -3,6 +3,8 @@ using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.Net; 4using System.Net;
5using System.Net.Sockets; 5using System.Net.Sockets;
6using libsecondlife;
7using OpenSim.Framework.Interfaces;
6 8
7namespace OpenSim 9namespace OpenSim
8{ 10{
@@ -11,5 +13,6 @@ namespace OpenSim
11 void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender); 13 void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender);
12 void RemoveClientCircuit(uint circuitcode); 14 void RemoveClientCircuit(uint circuitcode);
13 void RegisterPacketServer(PacketServer server); 15 void RegisterPacketServer(PacketServer server);
16 AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
14 } 17 }
15} 18}
diff --git a/OpenSim.RegionServer/SimClient.PacketHandlers.cs b/OpenSim.RegionServer/SimClient.PacketHandlers.cs
index 5007a60..f4de974 100644
--- a/OpenSim.RegionServer/SimClient.PacketHandlers.cs
+++ b/OpenSim.RegionServer/SimClient.PacketHandlers.cs
@@ -57,7 +57,7 @@ namespace OpenSim
57 m_world.RemoveViewerAgent(this); 57 m_world.RemoveViewerAgent(this);
58 //need to do other cleaning up here too 58 //need to do other cleaning up here too
59 m_clientThreads.Remove(this.CircuitCode); 59 m_clientThreads.Remove(this.CircuitCode);
60 m_application.RemoveClientCircuit(this.CircuitCode); 60 m_networkServer.RemoveClientCircuit(this.CircuitCode);
61 this.ClientThread.Abort(); 61 this.ClientThread.Abort();
62 return true; 62 return true;
63 } 63 }
diff --git a/OpenSim.RegionServer/SimClient.ProcessPackets.cs b/OpenSim.RegionServer/SimClient.ProcessPackets.cs
new file mode 100644
index 0000000..56818d2
--- /dev/null
+++ b/OpenSim.RegionServer/SimClient.ProcessPackets.cs
@@ -0,0 +1,417 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using libsecondlife;
5using libsecondlife.Packets;
6using Nwc.XmlRpc;
7using System.Net;
8using System.Net.Sockets;
9using System.IO;
10using System.Threading;
11using System.Timers;
12using OpenSim.Framework.Interfaces;
13using OpenSim.Framework.Types;
14using OpenSim.Framework.Inventory;
15using OpenSim.Framework.Utilities;
16using OpenSim.world;
17using OpenSim.Assets;
18
19namespace OpenSim
20{
21 public partial class SimClient
22 {
23 protected virtual void ProcessInPacket(Packet Pack)
24 {
25 ack_pack(Pack);
26 if (debug)
27 {
28 if (Pack.Type != PacketType.AgentUpdate)
29 {
30 Console.WriteLine(Pack.Type.ToString());
31 }
32 }
33
34 if (this.ProcessPacketMethod(Pack))
35 {
36 //there is a handler registered that handled this packet type
37 return;
38 }
39 else
40 {
41 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
42
43 switch (Pack.Type)
44 {
45 case PacketType.CompleteAgentMovement:
46 if (this.m_child) this.UpgradeClient();
47 ClientAvatar.CompleteMovement(m_world);
48 ClientAvatar.SendInitialPosition();
49 this.EnableNeighbours();
50 break;
51 case PacketType.RegionHandshakeReply:
52 m_world.SendLayerData(this);
53 break;
54 case PacketType.AgentWearablesRequest:
55 ClientAvatar.SendInitialAppearance();
56 foreach (SimClient client in m_clientThreads.Values)
57 {
58 if (client.AgentID != this.AgentID)
59 {
60 ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket();
61 this.OutPacket(objupdate);
62 client.ClientAvatar.SendAppearanceToOtherAgent(this);
63 }
64 }
65 m_world.GetInitialPrims(this);
66 break;
67 case PacketType.AgentIsNowWearing:
68 AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
69 //Console.WriteLine(Pack.ToString());
70 break;
71 case PacketType.AgentSetAppearance:
72 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
73 // Console.WriteLine(appear.ToString());
74 this.ClientAvatar.SetAppearance(appear);
75 break;
76 case PacketType.ObjectAdd:
77 m_world.AddNewPrim((ObjectAddPacket)Pack, this);
78 break;
79 case PacketType.ObjectLink:
80 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, Pack.ToString());
81 ObjectLinkPacket link = (ObjectLinkPacket)Pack;
82 uint parentprimid = 0;
83 OpenSim.world.Primitive parentprim = null;
84 if (link.ObjectData.Length > 1)
85 {
86 parentprimid = link.ObjectData[0].ObjectLocalID;
87 foreach (Entity ent in m_world.Entities.Values)
88 {
89 if (ent.localid == parentprimid)
90 {
91 parentprim = (OpenSim.world.Primitive)ent;
92
93 }
94 }
95 for (int i = 1; i < link.ObjectData.Length; i++)
96 {
97 foreach (Entity ent in m_world.Entities.Values)
98 {
99 if (ent.localid == link.ObjectData[i].ObjectLocalID)
100 {
101 ((OpenSim.world.Primitive)ent).MakeParent(parentprim);
102 }
103 }
104 }
105 }
106 break;
107 case PacketType.ObjectScale:
108 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, Pack.ToString());
109 break;
110 case PacketType.ObjectShape:
111 ObjectShapePacket shape = (ObjectShapePacket)Pack;
112 for (int i = 0; i < shape.ObjectData.Length; i++)
113 {
114 foreach (Entity ent in m_world.Entities.Values)
115 {
116 if (ent.localid == shape.ObjectData[i].ObjectLocalID)
117 {
118 ((OpenSim.world.Primitive)ent).UpdateShape(shape.ObjectData[i]);
119 }
120 }
121 }
122 break;
123 case PacketType.RequestImage:
124 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
125 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
126 {
127 m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
128 }
129 break;
130 case PacketType.TransferRequest:
131 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
132 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
133 m_assetCache.AddAssetRequest(this, transfer);
134 break;
135 case PacketType.AgentUpdate:
136 ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);
137 break;
138 case PacketType.ObjectImage:
139 ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
140 for (int i = 0; i < imagePack.ObjectData.Length; i++)
141 {
142 foreach (Entity ent in m_world.Entities.Values)
143 {
144 if (ent.localid == imagePack.ObjectData[i].ObjectLocalID)
145 {
146 ((OpenSim.world.Primitive)ent).UpdateTexture(imagePack.ObjectData[i].TextureEntry);
147 }
148 }
149 }
150 break;
151 case PacketType.ObjectFlagUpdate:
152 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
153 foreach (Entity ent in m_world.Entities.Values)
154 {
155 if (ent.localid == flags.AgentData.ObjectLocalID)
156 {
157 ((OpenSim.world.Primitive)ent).UpdateObjectFlags(flags);
158 }
159 }
160 break;
161 case PacketType.AssetUploadRequest:
162 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
163 this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID));
164 break;
165 case PacketType.RequestXfer:
166 //Console.WriteLine(Pack.ToString());
167 break;
168 case PacketType.SendXferPacket:
169 this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack);
170 break;
171 case PacketType.CreateInventoryFolder:
172 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
173 m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID);
174 //Console.WriteLine(Pack.ToString());
175 break;
176 case PacketType.CreateInventoryItem:
177 //Console.WriteLine(Pack.ToString());
178 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack;
179 if (createItem.InventoryBlock.TransactionID != LLUUID.Zero)
180 {
181 this.UploadAssets.CreateInventoryItem(createItem);
182 }
183 else
184 {
185 // Console.Write(Pack.ToString());
186 this.CreateInventoryItem(createItem);
187 }
188 break;
189 case PacketType.FetchInventory:
190 //Console.WriteLine("fetch item packet");
191 FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
192 m_inventoryCache.FetchInventory(this, FetchInventory);
193 break;
194 case PacketType.FetchInventoryDescendents:
195 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
196 m_inventoryCache.FetchInventoryDescendents(this, Fetch);
197 break;
198 case PacketType.UpdateInventoryItem:
199 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
200 //Console.WriteLine(Pack.ToString());
201 for (int i = 0; i < update.InventoryData.Length; i++)
202 {
203 if (update.InventoryData[i].TransactionID != LLUUID.Zero)
204 {
205 AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID));
206 if (asset != null)
207 {
208 // Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache");
209 m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset);
210 }
211 else
212 {
213 asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID);
214 if (asset != null)
215 {
216 //Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache");
217 m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset);
218 }
219 else
220 {
221 //Console.WriteLine("trying to update inventory item, but asset is null");
222 }
223 }
224 }
225 else
226 {
227 m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ;
228 }
229 }
230 break;
231 case PacketType.ViewerEffect:
232 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
233 foreach (SimClient client in m_clientThreads.Values)
234 {
235 if (client.AgentID != this.AgentID)
236 {
237 viewer.AgentData.AgentID = client.AgentID;
238 viewer.AgentData.SessionID = client.SessionID;
239 client.OutPacket(viewer);
240 }
241 }
242 break;
243 case PacketType.RequestTaskInventory:
244 // Console.WriteLine(Pack.ToString());
245 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
246 ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
247 bool foundent = false;
248 foreach (Entity ent in m_world.Entities.Values)
249 {
250 if (ent.localid == requesttask.InventoryData.LocalID)
251 {
252 replytask.InventoryData.TaskID = ent.uuid;
253 replytask.InventoryData.Serial = 0;
254 replytask.InventoryData.Filename = new byte[0];
255 foundent = true;
256 }
257 }
258 if (foundent)
259 {
260 this.OutPacket(replytask);
261 }
262 break;
263 case PacketType.UpdateTaskInventory:
264 // Console.WriteLine(Pack.ToString());
265 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
266 AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID);
267 if (myinventory != null)
268 {
269 if (updatetask.UpdateData.Key == 0)
270 {
271 if (myinventory.InventoryItems[updatetask.InventoryData.ItemID] != null)
272 {
273 if (myinventory.InventoryItems[updatetask.InventoryData.ItemID].Type == 7)
274 {
275 LLUUID noteaid = myinventory.InventoryItems[updatetask.InventoryData.ItemID].AssetID;
276 AssetBase assBase = this.m_assetCache.GetAsset(noteaid);
277 if (assBase != null)
278 {
279 foreach (Entity ent in m_world.Entities.Values)
280 {
281 if (ent.localid == updatetask.UpdateData.LocalID)
282 {
283 if (ent is OpenSim.world.Primitive)
284 {
285 this.m_world.AddScript(ent, Util.FieldToString(assBase.Data));
286 }
287 }
288 }
289 }
290 }
291 }
292 }
293 }
294 break;
295 case PacketType.AgentAnimation:
296 if (!m_child)
297 {
298 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
299 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
300 {
301 if (AgentAni.AnimationList[i].StartAnim)
302 {
303 ClientAvatar.current_anim = AgentAni.AnimationList[i].AnimID;
304 ClientAvatar.anim_seq = 1;
305 ClientAvatar.SendAnimPack();
306 }
307 }
308 }
309 break;
310 case PacketType.ObjectSelect:
311 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
312 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
313 {
314 foreach (Entity ent in m_world.Entities.Values)
315 {
316 if (ent.localid == incomingselect.ObjectData[i].ObjectLocalID)
317 {
318 ((OpenSim.world.Primitive)ent).GetProperites(this);
319 break;
320 }
321 }
322 }
323 break;
324 case PacketType.MapLayerRequest:
325 this.RequestMapLayer();
326 break;
327 case PacketType.MapBlockRequest:
328 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
329 this.RequestMapBlock(MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
330 break;
331
332 case PacketType.TeleportLandmarkRequest:
333 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
334
335 TeleportStartPacket tpStart = new TeleportStartPacket();
336 tpStart.Info.TeleportFlags = 8; // tp via lm
337 this.OutPacket(tpStart);
338
339 TeleportProgressPacket tpProgress = new TeleportProgressPacket();
340 tpProgress.Info.Message = (new System.Text.ASCIIEncoding()).GetBytes("sending_landmark");
341 tpProgress.Info.TeleportFlags = 8;
342 tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
343 this.OutPacket(tpProgress);
344
345 // Fetch landmark
346 LLUUID lmid = tpReq.Info.LandmarkID;
347 AssetBase lma = this.m_assetCache.GetAsset(lmid);
348 if (lma != null)
349 {
350 AssetLandmark lm = new AssetLandmark(lma);
351
352 if (lm.RegionID == m_regionData.SimUUID)
353 {
354 TeleportLocalPacket tpLocal = new TeleportLocalPacket();
355
356 tpLocal.Info.AgentID = tpReq.Info.AgentID;
357 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark
358 tpLocal.Info.LocationID = 2;
359 tpLocal.Info.Position = lm.Position;
360 OutPacket(tpLocal);
361 }
362 else
363 {
364 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
365 tpCancel.Info.AgentID = tpReq.Info.AgentID;
366 tpCancel.Info.SessionID = tpReq.Info.SessionID;
367 OutPacket(tpCancel);
368 }
369 }
370 else
371 {
372 Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented");
373
374 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
375 tpCancel.Info.AgentID = tpReq.Info.AgentID;
376 tpCancel.Info.SessionID = tpReq.Info.SessionID;
377 OutPacket(tpCancel);
378 }
379 break;
380
381 case PacketType.TeleportLocationRequest:
382 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
383 Console.WriteLine(tpLocReq.ToString());
384
385 tpStart = new TeleportStartPacket();
386 tpStart.Info.TeleportFlags = 16; // Teleport via location
387 Console.WriteLine(tpStart.ToString());
388 OutPacket(tpStart);
389
390 if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle)
391 {
392 /* m_gridServer.getRegion(tpLocReq.Info.RegionHandle); */
393 Console.WriteLine("Inter-sim teleport not yet implemented");
394 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
395 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
396 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
397
398 OutPacket(tpCancel);
399 }
400 else
401 {
402 Console.WriteLine("Local teleport");
403 TeleportLocalPacket tpLocal = new TeleportLocalPacket();
404 tpLocal.Info.AgentID = tpLocReq.AgentData.AgentID;
405 tpLocal.Info.TeleportFlags = tpStart.Info.TeleportFlags;
406 tpLocal.Info.LocationID = 2;
407 tpLocal.Info.LookAt = tpLocReq.Info.LookAt;
408 tpLocal.Info.Position = tpLocReq.Info.Position;
409 OutPacket(tpLocal);
410 }
411
412 break;
413 }
414 }
415 }
416 }
417}
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
index f5cfaad..81da10e 100644
--- a/OpenSim.RegionServer/SimClient.cs
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -80,7 +80,7 @@ namespace OpenSim
80 private AssetCache m_assetCache; 80 private AssetCache m_assetCache;
81 private IGridServer m_gridServer; 81 private IGridServer m_gridServer;
82 private IUserServer m_userServer = null; 82 private IUserServer m_userServer = null;
83 private OpenSimNetworkHandler m_application; 83 private OpenSimNetworkHandler m_networkServer;
84 private InventoryCache m_inventoryCache; 84 private InventoryCache m_inventoryCache;
85 public bool m_sandboxMode; 85 public bool m_sandboxMode;
86 private int cachedtextureserial = 0; 86 private int cachedtextureserial = 0;
@@ -104,12 +104,12 @@ namespace OpenSim
104 m_clientThreads = clientThreads; 104 m_clientThreads = clientThreads;
105 m_assetCache = assetCache; 105 m_assetCache = assetCache;
106 m_gridServer = gridServer; 106 m_gridServer = gridServer;
107 m_application = application; 107 m_networkServer = application;
108 m_inventoryCache = inventoryCache; 108 m_inventoryCache = inventoryCache;
109 m_sandboxMode = sandboxMode; 109 m_sandboxMode = sandboxMode;
110 m_child = child; 110 m_child = child;
111 m_regionData = regionDat; 111 m_regionData = regionDat;
112 112
113 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"OpenSimClient.cs - Started up new client thread to handle incoming request"); 113 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"OpenSimClient.cs - Started up new client thread to handle incoming request");
114 cirpack = initialcirpack; 114 cirpack = initialcirpack;
115 userEP = remoteEP; 115 userEP = remoteEP;
@@ -185,7 +185,7 @@ namespace OpenSim
185 m_world.RemoveViewerAgent(this); 185 m_world.RemoveViewerAgent(this);
186 186
187 m_clientThreads.Remove(this.CircuitCode); 187 m_clientThreads.Remove(this.CircuitCode);
188 m_application.RemoveClientCircuit(this.CircuitCode); 188 m_networkServer.RemoveClientCircuit(this.CircuitCode);
189 this.ClientThread.Abort(); 189 this.ClientThread.Abort();
190 } 190 }
191 191
@@ -266,399 +266,6 @@ namespace OpenSim
266 }*/ 266 }*/
267 } 267 }
268 268
269 protected virtual void ProcessInPacket(Packet Pack)
270 {
271 ack_pack(Pack);
272 if (debug)
273 {
274 if (Pack.Type != PacketType.AgentUpdate)
275 {
276 Console.WriteLine(Pack.Type.ToString());
277 }
278 }
279
280 if (this.ProcessPacketMethod(Pack))
281 {
282 //there is a handler registered that handled this packet type
283 return;
284 }
285 else
286 {
287 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
288
289 switch (Pack.Type)
290 {
291 case PacketType.CompleteAgentMovement:
292 if (this.m_child) this.UpgradeClient();
293 ClientAvatar.CompleteMovement(m_world);
294 ClientAvatar.SendInitialPosition();
295 this.EnableNeighbours();
296 break;
297 case PacketType.RegionHandshakeReply:
298 m_world.SendLayerData(this);
299 break;
300 case PacketType.AgentWearablesRequest:
301 ClientAvatar.SendInitialAppearance();
302 foreach (SimClient client in m_clientThreads.Values)
303 {
304 if (client.AgentID != this.AgentID)
305 {
306 ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket();
307 this.OutPacket(objupdate);
308 client.ClientAvatar.SendAppearanceToOtherAgent(this);
309 }
310 }
311 m_world.GetInitialPrims(this);
312 break;
313 case PacketType.AgentIsNowWearing:
314 AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
315 //Console.WriteLine(Pack.ToString());
316 break;
317 case PacketType.AgentSetAppearance:
318 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
319 // Console.WriteLine(appear.ToString());
320 this.ClientAvatar.SetAppearance(appear);
321 break;
322 case PacketType.ObjectAdd:
323 m_world.AddNewPrim((ObjectAddPacket)Pack, this);
324 break;
325 case PacketType.ObjectLink:
326 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,Pack.ToString());
327 ObjectLinkPacket link = (ObjectLinkPacket)Pack;
328 uint parentprimid = 0;
329 OpenSim.world.Primitive parentprim = null;
330 if (link.ObjectData.Length > 1)
331 {
332 parentprimid = link.ObjectData[0].ObjectLocalID;
333 foreach (Entity ent in m_world.Entities.Values)
334 {
335 if (ent.localid == parentprimid)
336 {
337 parentprim = (OpenSim.world.Primitive)ent;
338
339 }
340 }
341 for (int i = 1; i < link.ObjectData.Length; i++)
342 {
343 foreach (Entity ent in m_world.Entities.Values)
344 {
345 if (ent.localid == link.ObjectData[i].ObjectLocalID)
346 {
347 ((OpenSim.world.Primitive)ent).MakeParent(parentprim);
348 }
349 }
350 }
351 }
352 break;
353 case PacketType.ObjectScale:
354 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,Pack.ToString());
355 break;
356 case PacketType.ObjectShape:
357 ObjectShapePacket shape = (ObjectShapePacket)Pack;
358 for (int i = 0; i < shape.ObjectData.Length; i++)
359 {
360 foreach (Entity ent in m_world.Entities.Values)
361 {
362 if (ent.localid == shape.ObjectData[i].ObjectLocalID)
363 {
364 ((OpenSim.world.Primitive)ent).UpdateShape(shape.ObjectData[i]);
365 }
366 }
367 }
368 break;
369 case PacketType.RequestImage:
370 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
371 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
372 {
373 m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
374 }
375 break;
376 case PacketType.TransferRequest:
377 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
378 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
379 m_assetCache.AddAssetRequest(this, transfer);
380 break;
381 case PacketType.AgentUpdate:
382 ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);
383 break;
384 case PacketType.ObjectImage:
385 ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
386 for (int i = 0; i < imagePack.ObjectData.Length; i++)
387 {
388 foreach (Entity ent in m_world.Entities.Values)
389 {
390 if (ent.localid == imagePack.ObjectData[i].ObjectLocalID)
391 {
392 ((OpenSim.world.Primitive)ent).UpdateTexture(imagePack.ObjectData[i].TextureEntry);
393 }
394 }
395 }
396 break;
397 case PacketType.ObjectFlagUpdate:
398 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
399 foreach (Entity ent in m_world.Entities.Values)
400 {
401 if (ent.localid == flags.AgentData.ObjectLocalID)
402 {
403 ((OpenSim.world.Primitive)ent).UpdateObjectFlags(flags);
404 }
405 }
406 break;
407 case PacketType.AssetUploadRequest:
408 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
409 this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID));
410 break;
411 case PacketType.RequestXfer:
412 //Console.WriteLine(Pack.ToString());
413 break;
414 case PacketType.SendXferPacket:
415 this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack);
416 break;
417 case PacketType.CreateInventoryFolder:
418 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
419 m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID);
420 //Console.WriteLine(Pack.ToString());
421 break;
422 case PacketType.CreateInventoryItem:
423 //Console.WriteLine(Pack.ToString());
424 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack;
425 if (createItem.InventoryBlock.TransactionID != LLUUID.Zero)
426 {
427 this.UploadAssets.CreateInventoryItem(createItem);
428 }
429 else
430 {
431 // Console.Write(Pack.ToString());
432 this.CreateInventoryItem(createItem);
433 }
434 break;
435 case PacketType.FetchInventory:
436 //Console.WriteLine("fetch item packet");
437 FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
438 m_inventoryCache.FetchInventory(this, FetchInventory);
439 break;
440 case PacketType.FetchInventoryDescendents:
441 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
442 m_inventoryCache.FetchInventoryDescendents(this, Fetch);
443 break;
444 case PacketType.UpdateInventoryItem:
445 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
446 //Console.WriteLine(Pack.ToString());
447 for (int i = 0; i < update.InventoryData.Length; i++)
448 {
449 if (update.InventoryData[i].TransactionID != LLUUID.Zero)
450 {
451 AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID));
452 if (asset != null)
453 {
454 // Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache");
455 m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset);
456 }
457 else
458 {
459 asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID);
460 if (asset != null)
461 {
462 //Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache");
463 m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset);
464 }
465 else
466 {
467 //Console.WriteLine("trying to update inventory item, but asset is null");
468 }
469 }
470 }
471 else
472 {
473 m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ;
474 }
475 }
476 break;
477 case PacketType.ViewerEffect:
478 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
479 foreach (SimClient client in m_clientThreads.Values)
480 {
481 if (client.AgentID != this.AgentID)
482 {
483 viewer.AgentData.AgentID = client.AgentID;
484 viewer.AgentData.SessionID = client.SessionID;
485 client.OutPacket(viewer);
486 }
487 }
488 break;
489 case PacketType.RequestTaskInventory:
490 // Console.WriteLine(Pack.ToString());
491 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
492 ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
493 bool foundent = false;
494 foreach (Entity ent in m_world.Entities.Values)
495 {
496 if (ent.localid == requesttask.InventoryData.LocalID)
497 {
498 replytask.InventoryData.TaskID = ent.uuid;
499 replytask.InventoryData.Serial = 0;
500 replytask.InventoryData.Filename = new byte[0];
501 foundent = true;
502 }
503 }
504 if (foundent)
505 {
506 this.OutPacket(replytask);
507 }
508 break;
509 case PacketType.UpdateTaskInventory:
510 // Console.WriteLine(Pack.ToString());
511 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
512 AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID);
513 if (myinventory != null)
514 {
515 if (updatetask.UpdateData.Key == 0)
516 {
517 if (myinventory.InventoryItems[updatetask.InventoryData.ItemID] != null)
518 {
519 if (myinventory.InventoryItems[updatetask.InventoryData.ItemID].Type == 7)
520 {
521 LLUUID noteaid = myinventory.InventoryItems[updatetask.InventoryData.ItemID].AssetID;
522 AssetBase assBase = this.m_assetCache.GetAsset(noteaid);
523 if (assBase != null)
524 {
525 foreach (Entity ent in m_world.Entities.Values)
526 {
527 if (ent.localid == updatetask.UpdateData.LocalID)
528 {
529 if (ent is OpenSim.world.Primitive)
530 {
531 this.m_world.AddScript(ent, Util.FieldToString(assBase.Data));
532 }
533 }
534 }
535 }
536 }
537 }
538 }
539 }
540 break;
541 case PacketType.AgentAnimation:
542 if (!m_child)
543 {
544 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
545 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
546 {
547 if (AgentAni.AnimationList[i].StartAnim)
548 {
549 ClientAvatar.current_anim = AgentAni.AnimationList[i].AnimID;
550 ClientAvatar.anim_seq = 1;
551 ClientAvatar.SendAnimPack();
552 }
553 }
554 }
555 break;
556 case PacketType.ObjectSelect:
557 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
558 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
559 {
560 foreach (Entity ent in m_world.Entities.Values)
561 {
562 if (ent.localid == incomingselect.ObjectData[i].ObjectLocalID)
563 {
564 ((OpenSim.world.Primitive)ent).GetProperites(this);
565 break;
566 }
567 }
568 }
569 break;
570 case PacketType.MapLayerRequest:
571 this.RequestMapLayer();
572 break;
573 case PacketType.MapBlockRequest:
574 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
575 this.RequestMapBlock( MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
576 break;
577
578 case PacketType.TeleportLandmarkRequest:
579 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
580
581 TeleportStartPacket tpStart = new TeleportStartPacket();
582 tpStart.Info.TeleportFlags = 8; // tp via lm
583 this.OutPacket(tpStart);
584
585 TeleportProgressPacket tpProgress = new TeleportProgressPacket();
586 tpProgress.Info.Message = (new System.Text.ASCIIEncoding()).GetBytes("sending_landmark");
587 tpProgress.Info.TeleportFlags = 8;
588 tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
589 this.OutPacket(tpProgress);
590
591 // Fetch landmark
592 LLUUID lmid = tpReq.Info.LandmarkID;
593 AssetBase lma = this.m_assetCache.GetAsset(lmid);
594 if (lma != null)
595 {
596 AssetLandmark lm = new AssetLandmark(lma);
597
598 if (lm.RegionID == m_regionData.SimUUID)
599 {
600 TeleportLocalPacket tpLocal = new TeleportLocalPacket();
601
602 tpLocal.Info.AgentID = tpReq.Info.AgentID;
603 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark
604 tpLocal.Info.LocationID = 2;
605 tpLocal.Info.Position = lm.Position;
606 OutPacket(tpLocal);
607 }
608 else
609 {
610 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
611 tpCancel.Info.AgentID = tpReq.Info.AgentID;
612 tpCancel.Info.SessionID = tpReq.Info.SessionID;
613 OutPacket(tpCancel);
614 }
615 }
616 else
617 {
618 Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented");
619
620 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
621 tpCancel.Info.AgentID = tpReq.Info.AgentID;
622 tpCancel.Info.SessionID = tpReq.Info.SessionID;
623 OutPacket(tpCancel);
624 }
625 break;
626
627 case PacketType.TeleportLocationRequest:
628 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
629 Console.WriteLine(tpLocReq.ToString());
630
631 tpStart = new TeleportStartPacket();
632 tpStart.Info.TeleportFlags = 16; // Teleport via location
633 Console.WriteLine(tpStart.ToString());
634 OutPacket(tpStart);
635
636 if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle)
637 {
638 /* m_gridServer.getRegion(tpLocReq.Info.RegionHandle); */
639 Console.WriteLine("Inter-sim teleport not yet implemented");
640 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
641 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
642 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
643
644 OutPacket(tpCancel);
645 }
646 else {
647 Console.WriteLine("Local teleport");
648 TeleportLocalPacket tpLocal = new TeleportLocalPacket();
649 tpLocal.Info.AgentID = tpLocReq.AgentData.AgentID;
650 tpLocal.Info.TeleportFlags = tpStart.Info.TeleportFlags;
651 tpLocal.Info.LocationID = 2;
652 tpLocal.Info.LookAt = tpLocReq.Info.LookAt;
653 tpLocal.Info.Position = tpLocReq.Info.Position;
654 OutPacket(tpLocal);
655 }
656
657 break;
658 }
659 }
660 }
661
662 private void ResendUnacked() 269 private void ResendUnacked()
663 { 270 {
664 int now = Environment.TickCount; 271 int now = Environment.TickCount;
@@ -801,11 +408,11 @@ namespace OpenSim
801 if (Pack.Header.Zerocoded) 408 if (Pack.Header.Zerocoded)
802 { 409 {
803 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); 410 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
804 m_application.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, CircuitCode);//userEP); 411 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, CircuitCode);//userEP);
805 } 412 }
806 else 413 else
807 { 414 {
808 m_application.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, CircuitCode); //userEP); 415 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, CircuitCode); //userEP);
809 } 416 }
810 } 417 }
811 catch (Exception) 418 catch (Exception)
@@ -900,7 +507,8 @@ namespace OpenSim
900 507
901 protected virtual void AuthUser() 508 protected virtual void AuthUser()
902 { 509 {
903 AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); 510 // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
511 AuthenticateResponse sessionInfo = this.m_networkServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
904 if (!sessionInfo.Authorised) 512 if (!sessionInfo.Authorised)
905 { 513 {
906 //session/circuit not authorised 514 //session/circuit not authorised
@@ -925,36 +533,41 @@ namespace OpenSim
925 // Create Inventory, currently only works for sandbox mode 533 // Create Inventory, currently only works for sandbox mode
926 if (m_sandboxMode) 534 if (m_sandboxMode)
927 { 535 {
928 AgentInventory inventory = null; 536 this.SetupInventory(sessionInfo);
929 if (sessionInfo.LoginInfo.InventoryFolder != null) 537 }
538
539 ClientLoop();
540 }
541 }
542
543 #region Inventory Creation
544 private void SetupInventory(AuthenticateResponse sessionInfo)
545 {
546 AgentInventory inventory = null;
547 if (sessionInfo.LoginInfo.InventoryFolder != null)
548 {
549 inventory = this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder);
550 if (sessionInfo.LoginInfo.BaseFolder != null)
551 {
552 if (!inventory.HasFolder(sessionInfo.LoginInfo.BaseFolder))
930 { 553 {
931 inventory = this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder); 554 m_inventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder);
932 if (sessionInfo.LoginInfo.BaseFolder != null) 555 }
556 this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder;
557 AssetBase[] inventorySet = m_assetCache.CreateNewInventorySet(this.AgentID);
558 if (inventorySet != null)
559 {
560 for (int i = 0; i < inventorySet.Length; i++)
933 { 561 {
934 if (!inventory.HasFolder(sessionInfo.LoginInfo.BaseFolder)) 562 if (inventorySet[i] != null)
935 {
936 m_inventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder);
937 }
938 this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder;
939 AssetBase[] inventorySet = m_assetCache.CreateNewInventorySet(this.AgentID);
940 if (inventorySet != null)
941 { 563 {
942 for (int i = 0; i < inventorySet.Length; i++) 564 m_inventoryCache.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]);
943 {
944 if (inventorySet[i] != null)
945 {
946 m_inventoryCache.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]);
947 }
948 }
949 } 565 }
950 } 566 }
951 } 567 }
952 } 568 }
953
954 ClientLoop();
955 } 569 }
956 } 570 }
957
958 private AgentInventory CreateInventory(LLUUID baseFolder) 571 private AgentInventory CreateInventory(LLUUID baseFolder)
959 { 572 {
960 AgentInventory inventory = null; 573 AgentInventory inventory = null;
@@ -1015,6 +628,7 @@ namespace OpenSim
1015 m_assetCache.AddAsset(asset); 628 m_assetCache.AddAsset(asset);
1016 m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset); 629 m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset);
1017 } 630 }
631 #endregion
1018 632
1019 public class QueItem 633 public class QueItem
1020 { 634 {
diff --git a/OpenSim.RegionServer/UDPServer.cs b/OpenSim.RegionServer/UDPServer.cs
index 89c4f67..12f35ab 100644
--- a/OpenSim.RegionServer/UDPServer.cs
+++ b/OpenSim.RegionServer/UDPServer.cs
@@ -24,6 +24,8 @@ using OpenSim.GenericConfig;
24 24
25namespace OpenSim 25namespace OpenSim
26{ 26{
27 public delegate AuthenticateResponse AuthenticateSessionHandler(LLUUID sessionID, LLUUID agentID, uint circuitCode);
28
27 public class UDPServer : OpenSimNetworkHandler 29 public class UDPServer : OpenSimNetworkHandler
28 { 30 {
29 private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); 31 private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
@@ -45,6 +47,7 @@ namespace OpenSim
45 private bool m_sandbox = false; 47 private bool m_sandbox = false;
46 private bool user_accounts = false; 48 private bool user_accounts = false;
47 private ConsoleBase m_console; 49 private ConsoleBase m_console;
50 public AuthenticateSessionHandler AuthenticateHandler;
48 51
49 public PacketServer PacketServer 52 public PacketServer PacketServer
50 { 53 {
@@ -78,6 +81,7 @@ namespace OpenSim
78 this.user_accounts = accounts; 81 this.user_accounts = accounts;
79 this.m_console = console; 82 this.m_console = console;
80 PacketServer packetServer = new PacketServer(this); 83 PacketServer packetServer = new PacketServer(this);
84 this.AuthenticateHandler = new AuthenticateSessionHandler(this.m_gridServers.GridServer.AuthenticateSession);
81 } 85 }
82 86
83 protected virtual void OnReceivedData(IAsyncResult result) 87 protected virtual void OnReceivedData(IAsyncResult result)
@@ -178,5 +182,10 @@ namespace OpenSim
178 } 182 }
179 } 183 }
180 } 184 }
185
186 public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
187 {
188 return this.AuthenticateHandler(sessionID, agentID, circuitCode);
189 }
181 } 190 }
182} \ No newline at end of file 191} \ No newline at end of file