diff options
Diffstat (limited to 'OpenSim/Region/Communications/Local/LocalBackEndServices.cs')
-rw-r--r-- | OpenSim/Region/Communications/Local/LocalBackEndServices.cs | 412 |
1 files changed, 206 insertions, 206 deletions
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index d0cd991..9322f3b 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs | |||
@@ -1,206 +1,206 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Framework.Communications; | 31 | using OpenSim.Framework.Communications; |
32 | using OpenSim.Framework.Types; | 32 | using OpenSim.Framework.Types; |
33 | 33 | ||
34 | namespace OpenSim.Region.Communications.Local | 34 | namespace OpenSim.Region.Communications.Local |
35 | { | 35 | { |
36 | 36 | ||
37 | public class LocalBackEndServices : IGridServices, IInterRegionCommunications | 37 | public class LocalBackEndServices : IGridServices, IInterRegionCommunications |
38 | { | 38 | { |
39 | protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>(); | 39 | protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>(); |
40 | protected Dictionary<ulong, RegionCommsListener> regionHosts = new Dictionary<ulong, RegionCommsListener>(); | 40 | protected Dictionary<ulong, RegionCommsListener> regionHosts = new Dictionary<ulong, RegionCommsListener>(); |
41 | 41 | ||
42 | public LocalBackEndServices() | 42 | public LocalBackEndServices() |
43 | { | 43 | { |
44 | 44 | ||
45 | } | 45 | } |
46 | 46 | ||
47 | /// <summary> | 47 | /// <summary> |
48 | /// Register a region method with the BackEnd Services. | 48 | /// Register a region method with the BackEnd Services. |
49 | /// </summary> | 49 | /// </summary> |
50 | /// <param name="regionInfo"></param> | 50 | /// <param name="regionInfo"></param> |
51 | /// <returns></returns> | 51 | /// <returns></returns> |
52 | public RegionCommsListener RegisterRegion(RegionInfo regionInfo) | 52 | public RegionCommsListener RegisterRegion(RegionInfo regionInfo) |
53 | { | 53 | { |
54 | //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); | 54 | //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); |
55 | if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) | 55 | if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) |
56 | { | 56 | { |
57 | //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); | 57 | //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); |
58 | this.regions.Add(regionInfo.RegionHandle, regionInfo); | 58 | this.regions.Add(regionInfo.RegionHandle, regionInfo); |
59 | RegionCommsListener regionHost = new RegionCommsListener(); | 59 | RegionCommsListener regionHost = new RegionCommsListener(); |
60 | this.regionHosts.Add(regionInfo.RegionHandle, regionHost); | 60 | this.regionHosts.Add(regionInfo.RegionHandle, regionHost); |
61 | 61 | ||
62 | return regionHost; | 62 | return regionHost; |
63 | } | 63 | } |
64 | 64 | ||
65 | //already in our list of regions so for now lets return null | 65 | //already in our list of regions so for now lets return null |
66 | return null; | 66 | return null; |
67 | } | 67 | } |
68 | 68 | ||
69 | /// <summary> | 69 | /// <summary> |
70 | /// </summary> | 70 | /// </summary> |
71 | /// <param name="regionInfo"></param> | 71 | /// <param name="regionInfo"></param> |
72 | /// <returns></returns> | 72 | /// <returns></returns> |
73 | public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) | 73 | public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) |
74 | { | 74 | { |
75 | // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); | 75 | // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); |
76 | List<RegionInfo> neighbours = new List<RegionInfo>(); | 76 | List<RegionInfo> neighbours = new List<RegionInfo>(); |
77 | 77 | ||
78 | foreach (RegionInfo reg in this.regions.Values) | 78 | foreach (RegionInfo reg in this.regions.Values) |
79 | { | 79 | { |
80 | // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); | 80 | // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); |
81 | if (reg.RegionHandle != regionInfo.RegionHandle) | 81 | if (reg.RegionHandle != regionInfo.RegionHandle) |
82 | { | 82 | { |
83 | //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); | 83 | //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); |
84 | if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) | 84 | if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) |
85 | { | 85 | { |
86 | if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) | 86 | if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) |
87 | { | 87 | { |
88 | neighbours.Add(reg); | 88 | neighbours.Add(reg); |
89 | } | 89 | } |
90 | } | 90 | } |
91 | } | 91 | } |
92 | } | 92 | } |
93 | return neighbours; | 93 | return neighbours; |
94 | } | 94 | } |
95 | 95 | ||
96 | /// <summary> | 96 | /// <summary> |
97 | /// | 97 | /// |
98 | /// </summary> | 98 | /// </summary> |
99 | /// <param name="regionHandle"></param> | 99 | /// <param name="regionHandle"></param> |
100 | /// <returns></returns> | 100 | /// <returns></returns> |
101 | public RegionInfo RequestNeighbourInfo(ulong regionHandle) | 101 | public RegionInfo RequestNeighbourInfo(ulong regionHandle) |
102 | { | 102 | { |
103 | if (this.regions.ContainsKey(regionHandle)) | 103 | if (this.regions.ContainsKey(regionHandle)) |
104 | { | 104 | { |
105 | return this.regions[regionHandle]; | 105 | return this.regions[regionHandle]; |
106 | } | 106 | } |
107 | return null; | 107 | return null; |
108 | } | 108 | } |
109 | 109 | ||
110 | /// <summary> | 110 | /// <summary> |
111 | /// | 111 | /// |
112 | /// </summary> | 112 | /// </summary> |
113 | /// <param name="minX"></param> | 113 | /// <param name="minX"></param> |
114 | /// <param name="minY"></param> | 114 | /// <param name="minY"></param> |
115 | /// <param name="maxX"></param> | 115 | /// <param name="maxX"></param> |
116 | /// <param name="maxY"></param> | 116 | /// <param name="maxY"></param> |
117 | /// <returns></returns> | 117 | /// <returns></returns> |
118 | public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) | 118 | public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) |
119 | { | 119 | { |
120 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); | 120 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); |
121 | foreach(RegionInfo regInfo in this.regions.Values) | 121 | foreach(RegionInfo regInfo in this.regions.Values) |
122 | { | 122 | { |
123 | if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) | 123 | if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) |
124 | { | 124 | { |
125 | MapBlockData map = new MapBlockData(); | 125 | MapBlockData map = new MapBlockData(); |
126 | map.Name = regInfo.RegionName; | 126 | map.Name = regInfo.RegionName; |
127 | map.X = (ushort)regInfo.RegionLocX; | 127 | map.X = (ushort)regInfo.RegionLocX; |
128 | map.Y = (ushort)regInfo.RegionLocY; | 128 | map.Y = (ushort)regInfo.RegionLocY; |
129 | map.WaterHeight =(byte) regInfo.estateSettings.waterHeight; | 129 | map.WaterHeight =(byte) regInfo.estateSettings.waterHeight; |
130 | map.MapImageId = regInfo.estateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007"); | 130 | map.MapImageId = regInfo.estateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007"); |
131 | map.Agents = 1; | 131 | map.Agents = 1; |
132 | map.RegionFlags = 72458694; | 132 | map.RegionFlags = 72458694; |
133 | map.Access = 13; | 133 | map.Access = 13; |
134 | mapBlocks.Add(map); | 134 | mapBlocks.Add(map); |
135 | } | 135 | } |
136 | } | 136 | } |
137 | return mapBlocks; | 137 | return mapBlocks; |
138 | } | 138 | } |
139 | 139 | ||
140 | /// <summary> | 140 | /// <summary> |
141 | /// </summary> | 141 | /// </summary> |
142 | /// <param name="regionHandle"></param> | 142 | /// <param name="regionHandle"></param> |
143 | /// <param name="agentData"></param> | 143 | /// <param name="agentData"></param> |
144 | /// <returns></returns> | 144 | /// <returns></returns> |
145 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData | 145 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData |
146 | { | 146 | { |
147 | //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); | 147 | //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); |
148 | if (this.regionHosts.ContainsKey(regionHandle)) | 148 | if (this.regionHosts.ContainsKey(regionHandle)) |
149 | { | 149 | { |
150 | // Console.WriteLine("CommsManager- Informing a region to expect child agent"); | 150 | // Console.WriteLine("CommsManager- Informing a region to expect child agent"); |
151 | this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); | 151 | this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); |
152 | return true; | 152 | return true; |
153 | } | 153 | } |
154 | return false; | 154 | return false; |
155 | } | 155 | } |
156 | 156 | ||
157 | /// <summary> | 157 | /// <summary> |
158 | /// | 158 | /// |
159 | /// </summary> | 159 | /// </summary> |
160 | /// <param name="regionHandle"></param> | 160 | /// <param name="regionHandle"></param> |
161 | /// <param name="agentID"></param> | 161 | /// <param name="agentID"></param> |
162 | /// <param name="position"></param> | 162 | /// <param name="position"></param> |
163 | /// <returns></returns> | 163 | /// <returns></returns> |
164 | public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) | 164 | public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) |
165 | { | 165 | { |
166 | if (this.regionHosts.ContainsKey(regionHandle)) | 166 | if (this.regionHosts.ContainsKey(regionHandle)) |
167 | { | 167 | { |
168 | // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); | 168 | // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); |
169 | this.regionHosts[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); | 169 | this.regionHosts[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); |
170 | return true; | 170 | return true; |
171 | } | 171 | } |
172 | return false; | 172 | return false; |
173 | } | 173 | } |
174 | 174 | ||
175 | /// <summary> | 175 | /// <summary> |
176 | /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session | 176 | /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session |
177 | /// </summary> | 177 | /// </summary> |
178 | /// <param name="regionHandle"></param> | 178 | /// <param name="regionHandle"></param> |
179 | /// <param name="loginData"></param> | 179 | /// <param name="loginData"></param> |
180 | /// <returns></returns> | 180 | /// <returns></returns> |
181 | public bool AddNewSession(ulong regionHandle, Login loginData) | 181 | public bool AddNewSession(ulong regionHandle, Login loginData) |
182 | { | 182 | { |
183 | AgentCircuitData agent = new AgentCircuitData(); | 183 | AgentCircuitData agent = new AgentCircuitData(); |
184 | agent.AgentID = loginData.Agent; | 184 | agent.AgentID = loginData.Agent; |
185 | agent.firstname = loginData.First; | 185 | agent.firstname = loginData.First; |
186 | agent.lastname = loginData.Last; | 186 | agent.lastname = loginData.Last; |
187 | agent.SessionID = loginData.Session; | 187 | agent.SessionID = loginData.Session; |
188 | agent.SecureSessionID = loginData.SecureSession; | 188 | agent.SecureSessionID = loginData.SecureSession; |
189 | agent.circuitcode = loginData.CircuitCode; | 189 | agent.circuitcode = loginData.CircuitCode; |
190 | agent.BaseFolder = loginData.BaseFolder; | 190 | agent.BaseFolder = loginData.BaseFolder; |
191 | agent.InventoryFolder = loginData.InventoryFolder; | 191 | agent.InventoryFolder = loginData.InventoryFolder; |
192 | agent.startpos = new LLVector3(128, 128, 70); | 192 | agent.startpos = new LLVector3(128, 128, 70); |
193 | agent.CapsPath = loginData.CapsPath; | 193 | agent.CapsPath = loginData.CapsPath; |
194 | 194 | ||
195 | if (this.regionHosts.ContainsKey(regionHandle)) | 195 | if (this.regionHosts.ContainsKey(regionHandle)) |
196 | { | 196 | { |
197 | this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); | 197 | this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); |
198 | return true; | 198 | return true; |
199 | } | 199 | } |
200 | 200 | ||
201 | // region not found | 201 | // region not found |
202 | return false; | 202 | return false; |
203 | } | 203 | } |
204 | } | 204 | } |
205 | } | 205 | } |
206 | 206 | ||