diff options
author | mingchen | 2007-06-09 21:04:13 +0000 |
---|---|---|
committer | mingchen | 2007-06-09 21:04:13 +0000 |
commit | fa8f143aec69e36ee90fb34e2f144733b66ca951 (patch) | |
tree | 9442f049f83b4ea1cb89f9205aa07fd375c84594 /Common/OpenGrid.Framework.Communications/GridServer | |
parent | Number of small changes. (diff) | |
download | opensim-SC-fa8f143aec69e36ee90fb34e2f144733b66ca951.zip opensim-SC-fa8f143aec69e36ee90fb34e2f144733b66ca951.tar.gz opensim-SC-fa8f143aec69e36ee90fb34e2f144733b66ca951.tar.bz2 opensim-SC-fa8f143aec69e36ee90fb34e2f144733b66ca951.tar.xz |
*Reorganized RegionServerCommsManager for OGS and local support
Diffstat (limited to 'Common/OpenGrid.Framework.Communications/GridServer')
3 files changed, 190 insertions, 0 deletions
diff --git a/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerBase.cs b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerBase.cs new file mode 100644 index 0000000..11b5ea7 --- /dev/null +++ b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerBase.cs | |||
@@ -0,0 +1,50 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Framework.Types; | ||
5 | using OpenSim.Framework; | ||
6 | |||
7 | namespace OpenGrid.Framework.Communications.GridServer | ||
8 | { | ||
9 | public class GridCommsManagerBase | ||
10 | { | ||
11 | public GridCommsManagerBase() | ||
12 | { | ||
13 | } | ||
14 | /// <summary> | ||
15 | /// | ||
16 | /// </summary> | ||
17 | /// <param name="regionInfo"></param> | ||
18 | /// <returns></returns> | ||
19 | public virtual RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) | ||
20 | { | ||
21 | return null; | ||
22 | } | ||
23 | |||
24 | /// <summary> | ||
25 | /// | ||
26 | /// </summary> | ||
27 | /// <param name="regionInfo"></param> | ||
28 | /// <returns></returns> | ||
29 | public virtual List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) | ||
30 | { | ||
31 | return null; | ||
32 | } | ||
33 | |||
34 | /// <summary> | ||
35 | /// | ||
36 | /// </summary> | ||
37 | /// <returns></returns> | ||
38 | public virtual bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData | ||
39 | { | ||
40 | return false; | ||
41 | } | ||
42 | |||
43 | public virtual bool AddNewSession(ulong regionHandle, Login loginData) | ||
44 | { | ||
45 | return false; | ||
46 | } | ||
47 | |||
48 | |||
49 | } | ||
50 | } | ||
diff --git a/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerLocal.cs b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerLocal.cs new file mode 100644 index 0000000..774585a --- /dev/null +++ b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerLocal.cs | |||
@@ -0,0 +1,104 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | using OpenSim.Framework; | ||
6 | using OpenSim.Framework.Types; | ||
7 | |||
8 | using libsecondlife; | ||
9 | |||
10 | namespace OpenGrid.Framework.Communications.GridServer | ||
11 | { | ||
12 | public class GridCommsManagerLocal : GridCommsManagerBase | ||
13 | { | ||
14 | protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>(); | ||
15 | protected Dictionary<ulong, RegionCommsHostBase> regionHosts = new Dictionary<ulong, RegionCommsHostBase>(); | ||
16 | |||
17 | public GridCommsManagerLocal() | ||
18 | { | ||
19 | |||
20 | } | ||
21 | |||
22 | public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) | ||
23 | { | ||
24 | //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); | ||
25 | if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) | ||
26 | { | ||
27 | //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); | ||
28 | this.regions.Add(regionInfo.RegionHandle, regionInfo); | ||
29 | RegionCommsHostBase regionHost = new RegionCommsHostBase(); | ||
30 | this.regionHosts.Add(regionInfo.RegionHandle, regionHost); | ||
31 | return regionHost; | ||
32 | } | ||
33 | |||
34 | //already in our list of regions so for now lets return null | ||
35 | return null; | ||
36 | } | ||
37 | |||
38 | |||
39 | public override List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) | ||
40 | { | ||
41 | // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); | ||
42 | List<RegionInfo> neighbours = new List<RegionInfo>(); | ||
43 | |||
44 | foreach (RegionInfo reg in this.regions.Values) | ||
45 | { | ||
46 | // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); | ||
47 | if (reg.RegionHandle != regionInfo.RegionHandle) | ||
48 | { | ||
49 | //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); | ||
50 | if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) | ||
51 | { | ||
52 | if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) | ||
53 | { | ||
54 | neighbours.Add(reg); | ||
55 | } | ||
56 | } | ||
57 | } | ||
58 | } | ||
59 | return neighbours; | ||
60 | } | ||
61 | |||
62 | public override bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData | ||
63 | { | ||
64 | //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); | ||
65 | if (this.regionHosts.ContainsKey(regionHandle)) | ||
66 | { | ||
67 | // Console.WriteLine("CommsManager- Informing a region to expect child agent"); | ||
68 | this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); | ||
69 | return true; | ||
70 | } | ||
71 | return false; | ||
72 | } | ||
73 | |||
74 | /// <summary> | ||
75 | /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session | ||
76 | /// </summary> | ||
77 | /// <param name="regionHandle"></param> | ||
78 | /// <param name="loginData"></param> | ||
79 | /// <returns></returns> | ||
80 | public override bool AddNewSession(ulong regionHandle, Login loginData) | ||
81 | { | ||
82 | //Console.WriteLine(" comms manager been told to expect new user"); | ||
83 | AgentCircuitData agent = new AgentCircuitData(); | ||
84 | agent.AgentID = loginData.Agent; | ||
85 | agent.firstname = loginData.First; | ||
86 | agent.lastname = loginData.Last; | ||
87 | agent.SessionID = loginData.Session; | ||
88 | agent.SecureSessionID = loginData.SecureSession; | ||
89 | agent.circuitcode = loginData.CircuitCode; | ||
90 | agent.BaseFolder = loginData.BaseFolder; | ||
91 | agent.InventoryFolder = loginData.InventoryFolder; | ||
92 | agent.startpos = new LLVector3(128, 128, 70); | ||
93 | |||
94 | if (this.regionHosts.ContainsKey(regionHandle)) | ||
95 | { | ||
96 | this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); | ||
97 | return true; | ||
98 | } | ||
99 | |||
100 | // region not found | ||
101 | return false; | ||
102 | } | ||
103 | } | ||
104 | } | ||
diff --git a/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerOGS.cs b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerOGS.cs new file mode 100644 index 0000000..415c1d8 --- /dev/null +++ b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerOGS.cs | |||
@@ -0,0 +1,36 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | using OpenSim.Framework; | ||
6 | using OpenSim.Framework.Types; | ||
7 | |||
8 | namespace OpenGrid.Framework.Communications.GridServer | ||
9 | { | ||
10 | public class GridCommsManagerOGS : GridCommsManagerBase | ||
11 | { | ||
12 | public GridCommsManagerOGS() | ||
13 | { | ||
14 | } | ||
15 | |||
16 | public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) | ||
17 | { | ||
18 | return null; | ||
19 | } | ||
20 | |||
21 | public override List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) | ||
22 | { | ||
23 | return null; | ||
24 | } | ||
25 | |||
26 | public override bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData | ||
27 | { | ||
28 | return false; | ||
29 | } | ||
30 | |||
31 | public override bool AddNewSession(ulong regionHandle, Login loginData) | ||
32 | { | ||
33 | return false; | ||
34 | } | ||
35 | } | ||
36 | } | ||