aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/IInterRegionCommunications.cs2
-rw-r--r--OpenSim/Framework/RegionInfo.cs14
-rw-r--r--OpenSim/Framework/SerializableRegionInfo.cs195
3 files changed, 207 insertions, 4 deletions
diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
index 55616a4..a492c51 100644
--- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs
+++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
@@ -35,7 +35,7 @@ namespace OpenSim.Framework.Communications
35 string rdebugRegionName{ get; set; } 35 string rdebugRegionName{ get; set; }
36 bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); 36 bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
37 bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData); 37 bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData);
38 bool RegionUp(RegionInfo region); 38 bool RegionUp(SearializableRegionInfo region);
39 39
40 bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); 40 bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
41 bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isFlying); 41 bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isFlying);
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index c604d53..dd4078b 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Framework
69 69
70 public LLUUID RegionID = LLUUID.Zero; 70 public LLUUID RegionID = LLUUID.Zero;
71 71
72 private uint m_remotingPort; 72 public uint m_remotingPort;
73 public uint RemotingPort 73 public uint RemotingPort
74 { 74 {
75 get 75 get
@@ -184,7 +184,7 @@ namespace OpenSim.Framework
184 } 184 }
185 } 185 }
186 } 186 }
187 [Serializable] 187
188 public class RegionInfo : SimpleRegionInfo 188 public class RegionInfo : SimpleRegionInfo
189 { 189 {
190 public string RegionName = ""; 190 public string RegionName = "";
@@ -235,7 +235,15 @@ namespace OpenSim.Framework
235 { 235 {
236 236
237 } 237 }
238 238 public RegionInfo(SearializableRegionInfo ConvertFrom)
239 {
240 m_regionLocX = ConvertFrom.RegionLocX;
241 m_regionLocY = ConvertFrom.RegionLocY;
242 m_internalEndPoint = ConvertFrom.InternalEndPoint;
243 m_externalHostName = ConvertFrom.ExternalHostName;
244 m_remotingPort = ConvertFrom.RemotingPort;
245 RemotingAddress = ConvertFrom.RemotingAddress;
246 }
239 //not in use, should swap to nini though. 247 //not in use, should swap to nini though.
240 public void LoadFromNiniSource(IConfigSource source) 248 public void LoadFromNiniSource(IConfigSource source)
241 { 249 {
diff --git a/OpenSim/Framework/SerializableRegionInfo.cs b/OpenSim/Framework/SerializableRegionInfo.cs
new file mode 100644
index 0000000..cd59b75
--- /dev/null
+++ b/OpenSim/Framework/SerializableRegionInfo.cs
@@ -0,0 +1,195 @@
1/*
2* Copyright (c) Contributors, http://opensimulator.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*/
28using System;
29using System.Globalization;
30using System.Net;
31using System.Xml;
32using System.Net.Sockets;
33using libsecondlife;
34
35
36
37
38namespace OpenSim.Framework
39{
40 [Serializable]
41 public class SearializableRegionInfo
42 {
43 public SearializableRegionInfo()
44 {
45 }
46 public SearializableRegionInfo(RegionInfo ConvertFrom)
47 {
48 m_regionLocX = ConvertFrom.RegionLocX;
49 m_regionLocY = ConvertFrom.RegionLocY;
50 m_internalEndPoint = ConvertFrom.InternalEndPoint;
51 m_externalHostName = ConvertFrom.ExternalHostName;
52 m_remotingPort = ConvertFrom.RemotingPort;
53 RemotingAddress = ConvertFrom.RemotingAddress;
54
55 }
56 public SearializableRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
57 {
58
59 m_regionLocX = regionLocX;
60 m_regionLocY = regionLocY;
61
62 m_internalEndPoint = internalEndPoint;
63 m_externalHostName = externalUri;
64 }
65
66 public SearializableRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port)
67 {
68
69 m_regionLocX = regionLocX;
70 m_regionLocY = regionLocY;
71
72 m_externalHostName = externalUri;
73
74 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port);
75 }
76
77 public LLUUID RegionID = LLUUID.Zero;
78
79 public uint m_remotingPort;
80 public uint RemotingPort
81 {
82 get
83 {
84 return m_remotingPort;
85 }
86 set
87 {
88 m_remotingPort = value;
89 }
90 }
91
92 public string RemotingAddress;
93
94
95 public IPEndPoint ExternalEndPoint
96 {
97 get
98 {
99 // Old one defaults to IPv6
100 //return new IPEndPoint( Dns.GetHostAddresses( m_externalHostName )[0], m_internalEndPoint.Port );
101
102 IPAddress ia = null;
103 // If it is already an IP, don't resolve it - just return directly
104 if (IPAddress.TryParse(m_externalHostName, out ia))
105 return new IPEndPoint(ia, m_internalEndPoint.Port);
106
107 // Reset for next check
108 ia = null;
109
110
111 // New method favors IPv4
112 foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
113 {
114 if (ia == null)
115 ia = Adr;
116
117 if (Adr.AddressFamily == AddressFamily.InterNetwork)
118 {
119 ia = Adr;
120 break;
121 }
122
123 }
124
125 return new IPEndPoint(ia, m_internalEndPoint.Port);
126 }
127
128 set
129 {
130 m_externalHostName = value.ToString();
131 }
132 }
133
134 protected string m_externalHostName;
135 public string ExternalHostName
136 {
137 get
138 {
139 return m_externalHostName;
140 }
141 set
142 {
143 m_externalHostName = value;
144 }
145 }
146
147 protected IPEndPoint m_internalEndPoint;
148 public IPEndPoint InternalEndPoint
149 {
150 get
151 {
152 return m_internalEndPoint;
153 }
154 set
155 {
156 m_internalEndPoint = value;
157 }
158 }
159
160 protected uint? m_regionLocX;
161 public uint RegionLocX
162 {
163 get
164 {
165 return m_regionLocX.Value;
166 }
167 set
168 {
169 m_regionLocX = value;
170 }
171 }
172
173 protected uint? m_regionLocY;
174 public uint RegionLocY
175 {
176 get
177 {
178 return m_regionLocY.Value;
179 }
180 set
181 {
182 m_regionLocY = value;
183 }
184 }
185
186 public ulong RegionHandle
187 {
188 get
189 {
190 return Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
191 }
192 }
193 }
194
195}