aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/SerializableRegionInfo.cs
diff options
context:
space:
mode:
authorTeravus Ovares2007-11-28 06:18:07 +0000
committerTeravus Ovares2007-11-28 06:18:07 +0000
commitb7d596a6af51bea7dba642cdc768ac5ff77af5f3 (patch)
tree967b749b10b548f6ed687d8ade4680e411793da4 /OpenSim/Framework/SerializableRegionInfo.cs
parentbuild ThrottleCheck function to clear up bits of the throttle (diff)
downloadopensim-SC-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.zip
opensim-SC-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.tar.gz
opensim-SC-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.tar.bz2
opensim-SC-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.tar.xz
* Restaring the sim works fine in grid mode now. Sims announce themselves to their neighbors when they start up. Neighbors get this message and tell their agents that there's a new sim up.
* Certain unrecoverable physics based crashes in ODE are now hooked up to the 'restart the sim' routine.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/SerializableRegionInfo.cs195
1 files changed, 195 insertions, 0 deletions
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}