diff options
Switched in NameSpaceChanges
Diffstat (limited to 'OpenSim/Region/Communications')
13 files changed, 1292 insertions, 0 deletions
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs new file mode 100644 index 0000000..bacaa3e --- /dev/null +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using libsecondlife; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Types; | ||
36 | using OpenSim.Framework.Communications; | ||
37 | |||
38 | namespace OpenSim.Region.Communications.Local | ||
39 | { | ||
40 | public class CommunicationsLocal : CommunicationsManager | ||
41 | { | ||
42 | public LocalBackEndServices SandBoxServices = new LocalBackEndServices(); | ||
43 | public LocalUserServices UserServices; | ||
44 | |||
45 | public CommunicationsLocal(NetworkServersInfo serversInfo) | ||
46 | : base(serversInfo) | ||
47 | { | ||
48 | UserServices = new LocalUserServices(this,this.ServersInfo.DefaultHomeLocX,this.ServersInfo.DefaultHomeLocY); | ||
49 | UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); | ||
50 | UserServer = UserServices; | ||
51 | GridServer = SandBoxServices; | ||
52 | InterRegion = SandBoxServices; | ||
53 | } | ||
54 | |||
55 | internal void InformRegionOfLogin(ulong regionHandle, Login login) | ||
56 | { | ||
57 | this.SandBoxServices.AddNewSession(regionHandle, login); | ||
58 | } | ||
59 | } | ||
60 | } | ||
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs new file mode 100644 index 0000000..26834be --- /dev/null +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs | |||
@@ -0,0 +1,208 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using OpenSim.Framework.Types; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Communications; | ||
35 | |||
36 | namespace OpenSim.Region.Communications.Local | ||
37 | { | ||
38 | |||
39 | public class LocalBackEndServices : IGridServices, IInterRegionCommunications | ||
40 | { | ||
41 | protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>(); | ||
42 | protected Dictionary<ulong, RegionCommsListener> regionHosts = new Dictionary<ulong, RegionCommsListener>(); | ||
43 | |||
44 | public LocalBackEndServices() | ||
45 | { | ||
46 | |||
47 | } | ||
48 | |||
49 | /// <summary> | ||
50 | /// Register a region method with the BackEnd Services. | ||
51 | /// </summary> | ||
52 | /// <param name="regionInfo"></param> | ||
53 | /// <returns></returns> | ||
54 | public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) | ||
55 | { | ||
56 | //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); | ||
57 | if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) | ||
58 | { | ||
59 | //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); | ||
60 | this.regions.Add(regionInfo.RegionHandle, regionInfo); | ||
61 | RegionCommsListener regionHost = new RegionCommsListener(); | ||
62 | this.regionHosts.Add(regionInfo.RegionHandle, regionHost); | ||
63 | |||
64 | return regionHost; | ||
65 | } | ||
66 | |||
67 | //already in our list of regions so for now lets return null | ||
68 | return null; | ||
69 | } | ||
70 | |||
71 | /// <summary> | ||
72 | /// </summary> | ||
73 | /// <param name="regionInfo"></param> | ||
74 | /// <returns></returns> | ||
75 | public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) | ||
76 | { | ||
77 | // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); | ||
78 | List<RegionInfo> neighbours = new List<RegionInfo>(); | ||
79 | |||
80 | foreach (RegionInfo reg in this.regions.Values) | ||
81 | { | ||
82 | // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); | ||
83 | if (reg.RegionHandle != regionInfo.RegionHandle) | ||
84 | { | ||
85 | //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); | ||
86 | if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) | ||
87 | { | ||
88 | if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) | ||
89 | { | ||
90 | neighbours.Add(reg); | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | } | ||
95 | return neighbours; | ||
96 | } | ||
97 | |||
98 | /// <summary> | ||
99 | /// | ||
100 | /// </summary> | ||
101 | /// <param name="regionHandle"></param> | ||
102 | /// <returns></returns> | ||
103 | public RegionInfo RequestNeighbourInfo(ulong regionHandle) | ||
104 | { | ||
105 | if (this.regions.ContainsKey(regionHandle)) | ||
106 | { | ||
107 | return this.regions[regionHandle]; | ||
108 | } | ||
109 | return null; | ||
110 | } | ||
111 | |||
112 | /// <summary> | ||
113 | /// | ||
114 | /// </summary> | ||
115 | /// <param name="minX"></param> | ||
116 | /// <param name="minY"></param> | ||
117 | /// <param name="maxX"></param> | ||
118 | /// <param name="maxY"></param> | ||
119 | /// <returns></returns> | ||
120 | public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) | ||
121 | { | ||
122 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); | ||
123 | foreach(RegionInfo regInfo in this.regions.Values) | ||
124 | { | ||
125 | if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) | ||
126 | { | ||
127 | MapBlockData map = new MapBlockData(); | ||
128 | map.Name = regInfo.RegionName; | ||
129 | map.X = (ushort)regInfo.RegionLocX; | ||
130 | map.Y = (ushort)regInfo.RegionLocY; | ||
131 | map.WaterHeight =(byte) regInfo.estateSettings.waterHeight; | ||
132 | map.MapImageId = regInfo.estateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007"); | ||
133 | map.Agents = 1; | ||
134 | map.RegionFlags = 72458694; | ||
135 | map.Access = 13; | ||
136 | mapBlocks.Add(map); | ||
137 | } | ||
138 | } | ||
139 | return mapBlocks; | ||
140 | } | ||
141 | |||
142 | /// <summary> | ||
143 | /// </summary> | ||
144 | /// <param name="regionHandle"></param> | ||
145 | /// <param name="agentData"></param> | ||
146 | /// <returns></returns> | ||
147 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData | ||
148 | { | ||
149 | //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); | ||
150 | if (this.regionHosts.ContainsKey(regionHandle)) | ||
151 | { | ||
152 | // Console.WriteLine("CommsManager- Informing a region to expect child agent"); | ||
153 | this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); | ||
154 | return true; | ||
155 | } | ||
156 | return false; | ||
157 | } | ||
158 | |||
159 | /// <summary> | ||
160 | /// | ||
161 | /// </summary> | ||
162 | /// <param name="regionHandle"></param> | ||
163 | /// <param name="agentID"></param> | ||
164 | /// <param name="position"></param> | ||
165 | /// <returns></returns> | ||
166 | public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) | ||
167 | { | ||
168 | if (this.regionHosts.ContainsKey(regionHandle)) | ||
169 | { | ||
170 | // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); | ||
171 | this.regionHosts[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); | ||
172 | return true; | ||
173 | } | ||
174 | return false; | ||
175 | } | ||
176 | |||
177 | /// <summary> | ||
178 | /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session | ||
179 | /// </summary> | ||
180 | /// <param name="regionHandle"></param> | ||
181 | /// <param name="loginData"></param> | ||
182 | /// <returns></returns> | ||
183 | public bool AddNewSession(ulong regionHandle, Login loginData) | ||
184 | { | ||
185 | AgentCircuitData agent = new AgentCircuitData(); | ||
186 | agent.AgentID = loginData.Agent; | ||
187 | agent.firstname = loginData.First; | ||
188 | agent.lastname = loginData.Last; | ||
189 | agent.SessionID = loginData.Session; | ||
190 | agent.SecureSessionID = loginData.SecureSession; | ||
191 | agent.circuitcode = loginData.CircuitCode; | ||
192 | agent.BaseFolder = loginData.BaseFolder; | ||
193 | agent.InventoryFolder = loginData.InventoryFolder; | ||
194 | agent.startpos = new LLVector3(128, 128, 70); | ||
195 | agent.CapsPath = loginData.CapsPath; | ||
196 | |||
197 | if (this.regionHosts.ContainsKey(regionHandle)) | ||
198 | { | ||
199 | this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); | ||
200 | return true; | ||
201 | } | ||
202 | |||
203 | // region not found | ||
204 | return false; | ||
205 | } | ||
206 | } | ||
207 | } | ||
208 | |||
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs new file mode 100644 index 0000000..6cf254b --- /dev/null +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs | |||
@@ -0,0 +1,145 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | |||
6 | using OpenSim.Framework.Communications; | ||
7 | //using OpenSim.Framework.User; | ||
8 | using OpenSim.Framework.UserManagement; | ||
9 | using OpenSim.Framework.Data; | ||
10 | using OpenSim.Framework.Types; | ||
11 | using OpenSim.Framework.Utilities; | ||
12 | |||
13 | using libsecondlife; | ||
14 | |||
15 | namespace OpenSim.Region.Communications.Local | ||
16 | { | ||
17 | public class LocalUserServices : UserManagerBase, IUserServices | ||
18 | { | ||
19 | private CommunicationsLocal m_Parent; | ||
20 | |||
21 | private uint defaultHomeX ; | ||
22 | private uint defaultHomeY; | ||
23 | public LocalUserServices(CommunicationsLocal parent, uint defHomeX, uint defHomeY) | ||
24 | { | ||
25 | m_Parent = parent; | ||
26 | defaultHomeX = defHomeX; | ||
27 | defaultHomeY = defHomeY; | ||
28 | } | ||
29 | |||
30 | public UserProfileData GetUserProfile(string firstName, string lastName) | ||
31 | { | ||
32 | return GetUserProfile(firstName + " " + lastName); | ||
33 | } | ||
34 | |||
35 | public UserProfileData GetUserProfile(string name) | ||
36 | { | ||
37 | return this.getUserProfile(name); | ||
38 | } | ||
39 | |||
40 | public UserProfileData GetUserProfile(LLUUID avatarID) | ||
41 | { | ||
42 | return this.getUserProfile(avatarID); | ||
43 | } | ||
44 | |||
45 | /// <summary> | ||
46 | /// | ||
47 | /// </summary> | ||
48 | /// <returns></returns> | ||
49 | public override string GetMessage() | ||
50 | { | ||
51 | return "Welcome to OpenSim"; | ||
52 | } | ||
53 | |||
54 | public override UserProfileData GetTheUser(string firstname, string lastname) | ||
55 | { | ||
56 | UserProfileData profile = getUserProfile(firstname, lastname); | ||
57 | if (profile != null) | ||
58 | { | ||
59 | |||
60 | return profile; | ||
61 | } | ||
62 | |||
63 | //no current user account so make one | ||
64 | Console.WriteLine("No User account found so creating a new one "); | ||
65 | this.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); | ||
66 | |||
67 | profile = getUserProfile(firstname, lastname); | ||
68 | |||
69 | return profile; | ||
70 | } | ||
71 | |||
72 | public override bool AuthenticateUser(ref UserProfileData profile, string password) | ||
73 | { | ||
74 | //for now we will accept any password in sandbox mode | ||
75 | Console.WriteLine("authorising user"); | ||
76 | return true; | ||
77 | } | ||
78 | |||
79 | public override void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser) | ||
80 | { | ||
81 | ulong currentRegion = theUser.currentAgent.currentHandle; | ||
82 | RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion); | ||
83 | |||
84 | |||
85 | if (reg != null) | ||
86 | { | ||
87 | response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + | ||
88 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | ||
89 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | ||
90 | string capsPath = Util.GetRandomCapsPath(); | ||
91 | response.SimAddress = reg.CommsExternalAddress; | ||
92 | response.SimPort = (Int32)reg.CommsIPListenPort; | ||
93 | response.RegionX = reg.RegionLocX ; | ||
94 | response.RegionY = reg.RegionLocY ; | ||
95 | response.SeedCapability = "http://" + reg.CommsIPListenAddr + ":" + "9000" + "/CAPS/" + capsPath + "0000/"; | ||
96 | theUser.currentAgent.currentRegion = reg.SimUUID; | ||
97 | theUser.currentAgent.currentHandle = reg.RegionHandle; | ||
98 | |||
99 | Login _login = new Login(); | ||
100 | //copy data to login object | ||
101 | _login.First = response.Firstname; | ||
102 | _login.Last = response.Lastname; | ||
103 | _login.Agent = response.AgentID; | ||
104 | _login.Session = response.SessionID; | ||
105 | _login.SecureSession = response.SecureSessionID; | ||
106 | _login.CircuitCode = (uint)response.CircuitCode; | ||
107 | _login.CapsPath = capsPath; | ||
108 | |||
109 | m_Parent.InformRegionOfLogin(currentRegion, _login); | ||
110 | } | ||
111 | else | ||
112 | { | ||
113 | Console.WriteLine("not found region " + currentRegion); | ||
114 | } | ||
115 | |||
116 | } | ||
117 | |||
118 | public UserProfileData SetupMasterUser(string firstName, string lastName) | ||
119 | { | ||
120 | return SetupMasterUser(firstName, lastName, ""); | ||
121 | } | ||
122 | |||
123 | public UserProfileData SetupMasterUser(string firstName, string lastName, string password) | ||
124 | { | ||
125 | UserProfileData profile = getUserProfile(firstName, lastName); | ||
126 | if (profile != null) | ||
127 | { | ||
128 | |||
129 | return profile; | ||
130 | } | ||
131 | |||
132 | Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account"); | ||
133 | this.AddUserProfile(firstName, lastName, password, defaultHomeX, defaultHomeY); | ||
134 | |||
135 | profile = getUserProfile(firstName, lastName); | ||
136 | |||
137 | if (profile == null) | ||
138 | { | ||
139 | Console.WriteLine("Unknown Master User after creation attempt. No clue what to do here."); | ||
140 | } | ||
141 | |||
142 | return profile; | ||
143 | } | ||
144 | } | ||
145 | } | ||
diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj new file mode 100644 index 0000000..0a15a49 --- /dev/null +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj | |||
@@ -0,0 +1,121 @@ | |||
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>{BFB5D807-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Region.Communications.Local</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Region.Communications.Local</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="libsecondlife.dll" > | ||
62 | <HintPath>..\..\..\..\bin\libsecondlife.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System" > | ||
66 | <HintPath>System.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System.Xml" > | ||
70 | <HintPath>System.Xml.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | </ItemGroup> | ||
74 | <ItemGroup> | ||
75 | <ProjectReference Include="..\..\..\Framework\General\OpenSim.Framework.csproj"> | ||
76 | <Name>OpenSim.Framework</Name> | ||
77 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
78 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
79 | <Private>False</Private> | ||
80 | </ProjectReference> | ||
81 | <ProjectReference Include="..\..\..\Framework\Communications\OpenSim.Framework.Communications.csproj"> | ||
82 | <Name>OpenSim.Framework.Communications</Name> | ||
83 | <Project>{CB52B7E7-0000-0000-0000-000000000000}</Project> | ||
84 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
85 | <Private>False</Private> | ||
86 | </ProjectReference> | ||
87 | <ProjectReference Include="..\..\..\Framework\Data\OpenSim.Framework.Data.csproj"> | ||
88 | <Name>OpenSim.Framework.Data</Name> | ||
89 | <Project>{36B72A9B-0000-0000-0000-000000000000}</Project> | ||
90 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
91 | <Private>False</Private> | ||
92 | </ProjectReference> | ||
93 | <ProjectReference Include="..\..\..\Framework\UserManager\OpenSim.Framework.UserManagement.csproj"> | ||
94 | <Name>OpenSim.Framework.UserManagement</Name> | ||
95 | <Project>{586E2916-0000-0000-0000-000000000000}</Project> | ||
96 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
97 | <Private>False</Private> | ||
98 | </ProjectReference> | ||
99 | </ItemGroup> | ||
100 | <ItemGroup> | ||
101 | <Compile Include="CommunicationsLocal.cs"> | ||
102 | <SubType>Code</SubType> | ||
103 | </Compile> | ||
104 | <Compile Include="LocalBackEndServices.cs"> | ||
105 | <SubType>Code</SubType> | ||
106 | </Compile> | ||
107 | <Compile Include="LocalUserServices.cs"> | ||
108 | <SubType>Code</SubType> | ||
109 | </Compile> | ||
110 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
111 | <SubType>Code</SubType> | ||
112 | </Compile> | ||
113 | </ItemGroup> | ||
114 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
115 | <PropertyGroup> | ||
116 | <PreBuildEvent> | ||
117 | </PreBuildEvent> | ||
118 | <PostBuildEvent> | ||
119 | </PostBuildEvent> | ||
120 | </PropertyGroup> | ||
121 | </Project> | ||
diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build new file mode 100644 index 0000000..3cac9d3 --- /dev/null +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build | |||
@@ -0,0 +1,48 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Region.Communications.Local" 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="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenSim.Region.Communications.Local" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="CommunicationsLocal.cs" /> | ||
15 | <include name="LocalBackEndServices.cs" /> | ||
16 | <include name="LocalUserServices.cs" /> | ||
17 | <include name="Properties/AssemblyInfo.cs" /> | ||
18 | </sources> | ||
19 | <references basedir="${project::get-base-directory()}"> | ||
20 | <lib> | ||
21 | <include name="${project::get-base-directory()}" /> | ||
22 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
23 | </lib> | ||
24 | <include name="../../../../bin/libsecondlife.dll" /> | ||
25 | <include name="../../../../bin/OpenSim.Framework.dll" /> | ||
26 | <include name="../../../../bin/OpenSim.Framework.Communications.dll" /> | ||
27 | <include name="../../../../bin/OpenSim.Framework.Data.dll" /> | ||
28 | <include name="../../../../bin/OpenSim.Framework.UserManagement.dll" /> | ||
29 | <include name="System.dll" /> | ||
30 | <include name="System.Xml.dll" /> | ||
31 | </references> | ||
32 | </csc> | ||
33 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../../bin/" /> | ||
34 | <mkdir dir="${project::get-base-directory()}/../../../../bin/"/> | ||
35 | <copy todir="${project::get-base-directory()}/../../../../bin/"> | ||
36 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
37 | <include name="*.dll"/> | ||
38 | <include name="*.exe"/> | ||
39 | </fileset> | ||
40 | </copy> | ||
41 | </target> | ||
42 | <target name="clean"> | ||
43 | <delete dir="${bin.dir}" failonerror="false" /> | ||
44 | <delete dir="${obj.dir}" failonerror="false" /> | ||
45 | </target> | ||
46 | <target name="doc" description="Creates documentation."> | ||
47 | </target> | ||
48 | </project> | ||
diff --git a/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1eb7107 --- /dev/null +++ b/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,35 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenSim.Region.Communications.Local")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenSim.Region.Communications.Local")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Revision and Build Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | [assembly: AssemblyVersion("1.0.0.0")] | ||
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs new file mode 100644 index 0000000..870f577 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs | |||
@@ -0,0 +1,18 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Framework.Types; | ||
5 | using OpenSim.Framework.Communications; | ||
6 | namespace OpenSim.Region.Communications.OGS1 | ||
7 | { | ||
8 | public class CommunicationsOGS1 : CommunicationsManager | ||
9 | { | ||
10 | private OGS1GridServices gridInterComms = new OGS1GridServices(); | ||
11 | public CommunicationsOGS1(NetworkServersInfo serversInfo) :base(serversInfo) | ||
12 | { | ||
13 | GridServer = gridInterComms; | ||
14 | InterRegion = gridInterComms; | ||
15 | UserServer = new OGS1UserServices(this); | ||
16 | } | ||
17 | } | ||
18 | } | ||
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs new file mode 100644 index 0000000..5f0c80c --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -0,0 +1,248 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Collections; | ||
4 | using System.Text; | ||
5 | using System.Runtime.Remoting; | ||
6 | using System.Runtime.Remoting.Channels; | ||
7 | using System.Runtime.Remoting.Channels.Tcp; | ||
8 | |||
9 | using OpenSim.Framework.Servers; | ||
10 | using OpenSim.Framework; | ||
11 | using OpenSim.Framework.Types; | ||
12 | using OpenSim.Framework.Communications; | ||
13 | |||
14 | using Nwc.XmlRpc; | ||
15 | using libsecondlife; | ||
16 | |||
17 | namespace OpenSim.Region.Communications.OGS1 | ||
18 | { | ||
19 | public class OGS1GridServices : IGridServices, IInterRegionCommunications | ||
20 | { | ||
21 | public Dictionary<ulong, RegionCommsListener> listeners = new Dictionary<ulong, RegionCommsListener>(); | ||
22 | public GridInfo grid; | ||
23 | public BaseHttpServer httpListener; | ||
24 | private bool initialised = false; | ||
25 | |||
26 | public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) | ||
27 | { | ||
28 | Hashtable GridParams = new Hashtable(); | ||
29 | |||
30 | grid = gridInfo; | ||
31 | |||
32 | // Login / Authentication | ||
33 | GridParams["authkey"] = gridInfo.GridServerSendKey; | ||
34 | GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated(); | ||
35 | GridParams["sim_ip"] = regionInfo.CommsExternalAddress; | ||
36 | GridParams["sim_port"] = regionInfo.CommsIPListenPort.ToString(); | ||
37 | |||
38 | // Package into an XMLRPC Request | ||
39 | ArrayList SendParams = new ArrayList(); | ||
40 | SendParams.Add(GridParams); | ||
41 | |||
42 | // Send Request | ||
43 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); | ||
44 | XmlRpcResponse GridResp = GridReq.Send(gridInfo.GridServerURI, 3000); | ||
45 | Hashtable GridRespData = (Hashtable)GridResp.Value; | ||
46 | Hashtable griddatahash = GridRespData; | ||
47 | |||
48 | // Process Response | ||
49 | if (GridRespData.ContainsKey("error")) | ||
50 | { | ||
51 | string errorstring = (string)GridRespData["error"]; | ||
52 | OpenSim.Framework.Console.MainLog.Instance.Error("Unable to connect to grid: " + errorstring); | ||
53 | return null; | ||
54 | } | ||
55 | |||
56 | if (!this.listeners.ContainsKey(regionInfo.RegionHandle)) | ||
57 | { | ||
58 | // initialised = true; | ||
59 | httpListener = new BaseHttpServer(regionInfo.CommsIPListenPort); | ||
60 | httpListener.AddXmlRPCHandler("expect_user", this.ExpectUser); | ||
61 | httpListener.Start(); | ||
62 | } | ||
63 | |||
64 | // Initialise the background listeners | ||
65 | listeners[regionInfo.RegionHandle] = new RegionCommsListener(); | ||
66 | |||
67 | return listeners[regionInfo.RegionHandle]; | ||
68 | } | ||
69 | |||
70 | public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) | ||
71 | { | ||
72 | Hashtable respData = MapBlockQuery((int)regionInfo.RegionLocX - 1, (int)regionInfo.RegionLocY - 1, (int)regionInfo.RegionLocX + 1, (int)regionInfo.RegionLocY + 1); | ||
73 | |||
74 | List<RegionInfo> neighbours = new List<RegionInfo>(); | ||
75 | |||
76 | foreach (Hashtable n in (Hashtable)respData.Values) | ||
77 | { | ||
78 | RegionInfo neighbour = new RegionInfo(); | ||
79 | |||
80 | //OGS1 | ||
81 | neighbour.RegionHandle = (ulong)n["regionhandle"]; | ||
82 | neighbour.RegionLocX = (uint)n["x"]; | ||
83 | neighbour.RegionLocY = (uint)n["y"]; | ||
84 | neighbour.RegionName = (string)n["name"]; | ||
85 | |||
86 | //OGS1+ | ||
87 | neighbour.CommsIPListenAddr = (string)n["sim_ip"]; | ||
88 | neighbour.CommsIPListenPort = (int)n["sim_port"]; | ||
89 | neighbour.CommsExternalAddress = (string)n["sim_uri"]; | ||
90 | neighbour.SimUUID = (string)n["uuid"]; | ||
91 | |||
92 | neighbours.Add(neighbour); | ||
93 | } | ||
94 | |||
95 | return neighbours; | ||
96 | } | ||
97 | |||
98 | public RegionInfo RequestNeighbourInfo(ulong regionHandle) | ||
99 | { | ||
100 | OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented - RequestNeighbourInfo()"); | ||
101 | return null; | ||
102 | } | ||
103 | |||
104 | public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) | ||
105 | { | ||
106 | Hashtable respData = MapBlockQuery(minX, minY, maxX, maxY); | ||
107 | |||
108 | List<MapBlockData> neighbours = new List<MapBlockData>(); | ||
109 | |||
110 | foreach (Hashtable n in (Hashtable)respData.Values) | ||
111 | { | ||
112 | MapBlockData neighbour = new MapBlockData(); | ||
113 | |||
114 | neighbour.X = (ushort)n["x"]; | ||
115 | neighbour.Y = (ushort)n["y"]; | ||
116 | |||
117 | neighbour.Name = (string)n["name"]; | ||
118 | neighbour.Access = (byte)n["access"]; | ||
119 | neighbour.RegionFlags = (uint)n["region-flags"]; | ||
120 | neighbour.WaterHeight = (byte)n["water-height"]; | ||
121 | neighbour.MapImageId = (string)n["map-image-id"]; | ||
122 | |||
123 | neighbours.Add(neighbour); | ||
124 | } | ||
125 | |||
126 | return neighbours; | ||
127 | } | ||
128 | |||
129 | /// <summary> | ||
130 | /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates | ||
131 | /// </summary> | ||
132 | /// <remarks>REDUNDANT - OGS1 is to be phased out in favour of OGS2</remarks> | ||
133 | /// <param name="minX">Minimum X value</param> | ||
134 | /// <param name="minY">Minimum Y value</param> | ||
135 | /// <param name="maxX">Maximum X value</param> | ||
136 | /// <param name="maxY">Maximum Y value</param> | ||
137 | /// <returns>Hashtable of hashtables containing map data elements</returns> | ||
138 | private Hashtable MapBlockQuery(int minX, int minY, int maxX, int maxY) | ||
139 | { | ||
140 | Hashtable param = new Hashtable(); | ||
141 | param["xmin"] = minX; | ||
142 | param["ymin"] = minY; | ||
143 | param["xmax"] = maxX; | ||
144 | param["ymax"] = maxY; | ||
145 | IList parameters = new ArrayList(); | ||
146 | parameters.Add(param); | ||
147 | XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); | ||
148 | XmlRpcResponse resp = req.Send(grid.GridServerURI, 3000); | ||
149 | Hashtable respData = (Hashtable)resp.Value; | ||
150 | return respData; | ||
151 | } | ||
152 | |||
153 | // Grid Request Processing | ||
154 | public XmlRpcResponse ExpectUser(XmlRpcRequest request) | ||
155 | { | ||
156 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
157 | AgentCircuitData agentData = new AgentCircuitData(); | ||
158 | agentData.SessionID = new LLUUID((string)requestData["session_id"]); | ||
159 | agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); | ||
160 | agentData.firstname = (string)requestData["firstname"]; | ||
161 | agentData.lastname = (string)requestData["lastname"]; | ||
162 | agentData.AgentID = new LLUUID((string)requestData["agent_id"]); | ||
163 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | ||
164 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) | ||
165 | { | ||
166 | agentData.child = true; | ||
167 | } | ||
168 | else | ||
169 | { | ||
170 | agentData.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), Convert.ToUInt32(requestData["startpos_y"]), Convert.ToUInt32(requestData["startpos_z"])); | ||
171 | agentData.child = false; | ||
172 | |||
173 | } | ||
174 | |||
175 | if (listeners.ContainsKey((ulong)requestData["regionhandle"])) | ||
176 | { | ||
177 | this.listeners[(ulong)requestData["regionhandle"]].TriggerExpectUser((ulong)requestData["regionhandle"], agentData); | ||
178 | } | ||
179 | else | ||
180 | { | ||
181 | OpenSim.Framework.Console.MainLog.Instance.Error("ExpectUser() - Unknown region " + ((ulong)requestData["regionhandle"]).ToString()); | ||
182 | } | ||
183 | |||
184 | return new XmlRpcResponse(); | ||
185 | } | ||
186 | |||
187 | #region InterRegion Comms | ||
188 | private void StartRemoting() | ||
189 | { | ||
190 | TcpChannel ch = new TcpChannel(8895); | ||
191 | ChannelServices.RegisterChannel(ch); | ||
192 | |||
193 | WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry( Type.GetType("OGS1InterRegionRemoting"), "InterRegions", WellKnownObjectMode.Singleton); | ||
194 | RemotingConfiguration.RegisterWellKnownServiceType(wellType); | ||
195 | InterRegionSingleton.Instance.OnArrival += this.IncomingArrival; | ||
196 | InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent; | ||
197 | } | ||
198 | |||
199 | #region Methods called by regions in this instance | ||
200 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
201 | { | ||
202 | if (this.listeners.ContainsKey(regionHandle)) | ||
203 | { | ||
204 | this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData); | ||
205 | return true; | ||
206 | } | ||
207 | //TODO need to see if we know about where this region is and use .net remoting | ||
208 | // to inform it. | ||
209 | return false; | ||
210 | } | ||
211 | |||
212 | public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) | ||
213 | { | ||
214 | if (this.listeners.ContainsKey(regionHandle)) | ||
215 | { | ||
216 | this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); | ||
217 | return true; | ||
218 | } | ||
219 | //TODO need to see if we know about where this region is and use .net remoting | ||
220 | // to inform it. | ||
221 | return false; | ||
222 | } | ||
223 | #endregion | ||
224 | |||
225 | #region Methods triggered by calls from external instances | ||
226 | public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
227 | { | ||
228 | if (this.listeners.ContainsKey(regionHandle)) | ||
229 | { | ||
230 | this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData); | ||
231 | return true; | ||
232 | } | ||
233 | return false; | ||
234 | } | ||
235 | |||
236 | public bool IncomingArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) | ||
237 | { | ||
238 | if (this.listeners.ContainsKey(regionHandle)) | ||
239 | { | ||
240 | this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); | ||
241 | return true; | ||
242 | } | ||
243 | return false; | ||
244 | } | ||
245 | #endregion | ||
246 | #endregion | ||
247 | } | ||
248 | } | ||
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs new file mode 100644 index 0000000..51b33e9 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs | |||
@@ -0,0 +1,70 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Framework.Types; | ||
5 | using OpenSim.Framework.Communications; | ||
6 | namespace OpenSim.Region.Communications.OGS1 | ||
7 | { | ||
8 | public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); | ||
9 | public delegate bool ExpectArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position); | ||
10 | |||
11 | public sealed class InterRegionSingleton | ||
12 | { | ||
13 | static readonly InterRegionSingleton instance = new InterRegionSingleton(); | ||
14 | |||
15 | public event InformRegionChild OnChildAgent; | ||
16 | public event ExpectArrival OnArrival; | ||
17 | |||
18 | static InterRegionSingleton() | ||
19 | { | ||
20 | } | ||
21 | |||
22 | InterRegionSingleton() | ||
23 | { | ||
24 | } | ||
25 | |||
26 | public static InterRegionSingleton Instance | ||
27 | { | ||
28 | get | ||
29 | { | ||
30 | return instance; | ||
31 | } | ||
32 | } | ||
33 | |||
34 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
35 | { | ||
36 | if (OnChildAgent != null) | ||
37 | { | ||
38 | return OnChildAgent(regionHandle, agentData); | ||
39 | } | ||
40 | return false; | ||
41 | } | ||
42 | |||
43 | public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) | ||
44 | { | ||
45 | if (OnArrival != null) | ||
46 | { | ||
47 | return OnArrival(regionHandle, agentID, position); | ||
48 | } | ||
49 | return false; | ||
50 | } | ||
51 | } | ||
52 | |||
53 | public class OGS1InterRegionRemoting : MarshalByRefObject | ||
54 | { | ||
55 | |||
56 | public OGS1InterRegionRemoting() | ||
57 | { | ||
58 | } | ||
59 | |||
60 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
61 | { | ||
62 | return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, agentData); | ||
63 | } | ||
64 | |||
65 | public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) | ||
66 | { | ||
67 | return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position); | ||
68 | } | ||
69 | } | ||
70 | } | ||
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs new file mode 100644 index 0000000..856c447 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs | |||
@@ -0,0 +1,109 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | using OpenSim.Framework.Types; | ||
6 | using OpenSim.Framework.Communications; | ||
7 | using OpenSim.Framework.Data; | ||
8 | using libsecondlife; | ||
9 | |||
10 | using Nwc.XmlRpc; | ||
11 | |||
12 | namespace OpenSim.Region.Communications.OGS1 | ||
13 | { | ||
14 | public class OGS1UserServices :IUserServices | ||
15 | { | ||
16 | CommunicationsOGS1 m_parent; | ||
17 | public OGS1UserServices(CommunicationsOGS1 parent) | ||
18 | { | ||
19 | m_parent = parent; | ||
20 | } | ||
21 | |||
22 | public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data) | ||
23 | { | ||
24 | if (data.Contains("error_type")) | ||
25 | { | ||
26 | Console.WriteLine("Error sent by user server when trying to get user profile: (" + data["error_type"] + "): " + data["error_desc"]); | ||
27 | return null; | ||
28 | } | ||
29 | |||
30 | UserProfileData userData = new UserProfileData(); | ||
31 | userData.username = (string)data["firstname"]; | ||
32 | userData.surname = (string)data["lastname"]; | ||
33 | userData.UUID = new LLUUID((string)data["uuid"]); | ||
34 | userData.userInventoryURI = (string)data["server_inventory"]; | ||
35 | userData.userAssetURI = (string)data["server_asset"]; | ||
36 | userData.profileFirstText = (string)data["profile_firstlife_about"]; | ||
37 | userData.profileFirstImage = new LLUUID((string)data["profile_firstlife_image"]); | ||
38 | userData.profileCanDoMask = (uint)data["profile_can_do"]; | ||
39 | userData.profileWantDoMask = (uint)data["profile_want_do"]; | ||
40 | userData.profileImage = new LLUUID((string)data["profile_image"]); | ||
41 | userData.lastLogin = (int)data["profile_lastlogin"]; | ||
42 | userData.homeLocation = new LLVector3(); | ||
43 | userData.homeLookAt = new LLVector3(); | ||
44 | |||
45 | return userData; | ||
46 | } | ||
47 | public UserProfileData GetUserProfile(string firstName, string lastName) | ||
48 | { | ||
49 | return GetUserProfile(firstName + " " + lastName); | ||
50 | } | ||
51 | public UserProfileData GetUserProfile(string name) | ||
52 | { | ||
53 | |||
54 | try | ||
55 | { | ||
56 | Hashtable param = new Hashtable(); | ||
57 | param["avatar_name"] = name; | ||
58 | IList parameters = new ArrayList(); | ||
59 | parameters.Add(param); | ||
60 | XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); | ||
61 | XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000); | ||
62 | Hashtable respData = (Hashtable)resp.Value; | ||
63 | |||
64 | return ConvertXMLRPCDataToUserProfile(respData); | ||
65 | } | ||
66 | catch (Exception e) | ||
67 | { | ||
68 | Console.WriteLine("Error when trying to fetch profile data by name from remote user server: " + e.Message); | ||
69 | } | ||
70 | return null; | ||
71 | } | ||
72 | public UserProfileData GetUserProfile(LLUUID avatarID) | ||
73 | { | ||
74 | try | ||
75 | { | ||
76 | |||
77 | Hashtable param = new Hashtable(); | ||
78 | param["avatar_uuid"] = avatarID.ToString(); | ||
79 | IList parameters = new ArrayList(); | ||
80 | parameters.Add(param); | ||
81 | XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); | ||
82 | XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000); | ||
83 | Hashtable respData = (Hashtable)resp.Value; | ||
84 | |||
85 | return ConvertXMLRPCDataToUserProfile(respData); | ||
86 | } | ||
87 | catch (Exception e) | ||
88 | { | ||
89 | Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + e.Message); | ||
90 | } | ||
91 | return null; | ||
92 | } | ||
93 | |||
94 | public UserProfileData SetupMasterUser(string firstName, string lastName) | ||
95 | { | ||
96 | return SetupMasterUser(firstName, lastName, ""); | ||
97 | } | ||
98 | |||
99 | public UserProfileData SetupMasterUser(string firstName, string lastName, string password) | ||
100 | { | ||
101 | UserProfileData profile = GetUserProfile(firstName, lastName); | ||
102 | if (profile == null) | ||
103 | { | ||
104 | Console.WriteLine("Unknown Master User. Grid Mode: No clue what I should do. Probably would choose the grid owner UUID when that is implemented"); | ||
105 | } | ||
106 | return null; | ||
107 | } | ||
108 | } | ||
109 | } | ||
diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj new file mode 100644 index 0000000..d6abd13 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj | |||
@@ -0,0 +1,142 @@ | |||
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>{4806E378-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Region.Communications.OGS1</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Region.Communications.OGS1</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="libsecondlife.dll" > | ||
62 | <HintPath>..\..\..\..\bin\libsecondlife.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System" > | ||
66 | <HintPath>System.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System.Data" > | ||
70 | <HintPath>System.Data.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System.Runtime.Remoting" > | ||
74 | <HintPath>System.Runtime.Remoting.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System.Xml" > | ||
78 | <HintPath>System.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | <Reference Include="XMLRPC.dll" > | ||
82 | <HintPath>..\..\..\..\bin\XMLRPC.dll</HintPath> | ||
83 | <Private>False</Private> | ||
84 | </Reference> | ||
85 | </ItemGroup> | ||
86 | <ItemGroup> | ||
87 | <ProjectReference Include="..\..\..\Framework\General\OpenSim.Framework.csproj"> | ||
88 | <Name>OpenSim.Framework</Name> | ||
89 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
90 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
91 | <Private>False</Private> | ||
92 | </ProjectReference> | ||
93 | <ProjectReference Include="..\..\..\Framework\Communications\OpenSim.Framework.Communications.csproj"> | ||
94 | <Name>OpenSim.Framework.Communications</Name> | ||
95 | <Project>{CB52B7E7-0000-0000-0000-000000000000}</Project> | ||
96 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
97 | <Private>False</Private> | ||
98 | </ProjectReference> | ||
99 | <ProjectReference Include="..\..\..\Framework\Console\OpenSim.Framework.Console.csproj"> | ||
100 | <Name>OpenSim.Framework.Console</Name> | ||
101 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
102 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
103 | <Private>False</Private> | ||
104 | </ProjectReference> | ||
105 | <ProjectReference Include="..\..\..\Framework\Data\OpenSim.Framework.Data.csproj"> | ||
106 | <Name>OpenSim.Framework.Data</Name> | ||
107 | <Project>{36B72A9B-0000-0000-0000-000000000000}</Project> | ||
108 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
109 | <Private>False</Private> | ||
110 | </ProjectReference> | ||
111 | <ProjectReference Include="..\..\..\Framework\Servers\OpenSim.Framework.Servers.csproj"> | ||
112 | <Name>OpenSim.Framework.Servers</Name> | ||
113 | <Project>{2CC71860-0000-0000-0000-000000000000}</Project> | ||
114 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
115 | <Private>False</Private> | ||
116 | </ProjectReference> | ||
117 | </ItemGroup> | ||
118 | <ItemGroup> | ||
119 | <Compile Include="CommunicationsOGS1.cs"> | ||
120 | <SubType>Code</SubType> | ||
121 | </Compile> | ||
122 | <Compile Include="OGS1GridServices.cs"> | ||
123 | <SubType>Code</SubType> | ||
124 | </Compile> | ||
125 | <Compile Include="OGS1InterSimComms.cs"> | ||
126 | <SubType>Code</SubType> | ||
127 | </Compile> | ||
128 | <Compile Include="OGS1UserServices.cs"> | ||
129 | <SubType>Code</SubType> | ||
130 | </Compile> | ||
131 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
132 | <SubType>Code</SubType> | ||
133 | </Compile> | ||
134 | </ItemGroup> | ||
135 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
136 | <PropertyGroup> | ||
137 | <PreBuildEvent> | ||
138 | </PreBuildEvent> | ||
139 | <PostBuildEvent> | ||
140 | </PostBuildEvent> | ||
141 | </PropertyGroup> | ||
142 | </Project> | ||
diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build new file mode 100644 index 0000000..04d61b9 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build | |||
@@ -0,0 +1,53 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Region.Communications.OGS1" 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="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenSim.Region.Communications.OGS1" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="CommunicationsOGS1.cs" /> | ||
15 | <include name="OGS1GridServices.cs" /> | ||
16 | <include name="OGS1InterSimComms.cs" /> | ||
17 | <include name="OGS1UserServices.cs" /> | ||
18 | <include name="Properties/AssemblyInfo.cs" /> | ||
19 | </sources> | ||
20 | <references basedir="${project::get-base-directory()}"> | ||
21 | <lib> | ||
22 | <include name="${project::get-base-directory()}" /> | ||
23 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
24 | </lib> | ||
25 | <include name="../../../../bin/libsecondlife.dll" /> | ||
26 | <include name="../../../../bin/OpenSim.Framework.dll" /> | ||
27 | <include name="../../../../bin/OpenSim.Framework.Communications.dll" /> | ||
28 | <include name="../../../../bin/OpenSim.Framework.Console.dll" /> | ||
29 | <include name="../../../../bin/OpenSim.Framework.Data.dll" /> | ||
30 | <include name="../../../../bin/OpenSim.Framework.Servers.dll" /> | ||
31 | <include name="System.dll" /> | ||
32 | <include name="System.Data.dll" /> | ||
33 | <include name="System.Runtime.Remoting.dll" /> | ||
34 | <include name="System.Xml.dll" /> | ||
35 | <include name="../../../../bin/XMLRPC.dll" /> | ||
36 | </references> | ||
37 | </csc> | ||
38 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../../bin/" /> | ||
39 | <mkdir dir="${project::get-base-directory()}/../../../../bin/"/> | ||
40 | <copy todir="${project::get-base-directory()}/../../../../bin/"> | ||
41 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
42 | <include name="*.dll"/> | ||
43 | <include name="*.exe"/> | ||
44 | </fileset> | ||
45 | </copy> | ||
46 | </target> | ||
47 | <target name="clean"> | ||
48 | <delete dir="${bin.dir}" failonerror="false" /> | ||
49 | <delete dir="${obj.dir}" failonerror="false" /> | ||
50 | </target> | ||
51 | <target name="doc" description="Creates documentation."> | ||
52 | </target> | ||
53 | </project> | ||
diff --git a/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0c6f965 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,35 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenGrid.Framework.Communications.OGS1")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenGrid.Framework.Communications.OGS1")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Revision and Build Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | [assembly: AssemblyVersion("1.0.0.0")] | ||
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||