aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/General/Types/NetworkServersInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/General/Types/NetworkServersInfo.cs')
-rw-r--r--OpenSim/Framework/General/Types/NetworkServersInfo.cs181
1 files changed, 181 insertions, 0 deletions
diff --git a/OpenSim/Framework/General/Types/NetworkServersInfo.cs b/OpenSim/Framework/General/Types/NetworkServersInfo.cs
new file mode 100644
index 0000000..73d7811
--- /dev/null
+++ b/OpenSim/Framework/General/Types/NetworkServersInfo.cs
@@ -0,0 +1,181 @@
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*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Framework.Interfaces;
32
33namespace OpenSim.Framework.Types
34{
35 public class NetworkServersInfo
36 {
37 public string AssetURL = "http://127.0.0.1:8003/";
38 public string AssetSendKey = "";
39
40 public string GridURL = "";
41 public string GridSendKey = "";
42 public string GridRecvKey = "";
43 public string UserURL = "";
44 public string UserSendKey = "";
45 public string UserRecvKey = "";
46 public bool isSandbox;
47
48 public uint DefaultHomeLocX = 0;
49 public uint DefaultHomeLocY = 0;
50
51 public int HttpListenerPort = 9000;
52 public int RemotingListenerPort = 8895;
53
54 public void InitConfig(bool sandboxMode, IGenericConfig configData)
55 {
56 this.isSandbox = sandboxMode;
57
58 try
59 {
60 string attri = "";
61
62 attri = "";
63 attri = configData.GetAttribute("HttpListenerPort");
64 if (attri == "")
65 {
66 string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Http Listener Port", "9000");
67 configData.SetAttribute("HttpListenerPort", location);
68 this.HttpListenerPort = Convert.ToInt32(location);
69 }
70 else
71 {
72 this.HttpListenerPort = Convert.ToInt32(attri);
73 }
74
75 attri = "";
76 attri = configData.GetAttribute("RemotingListenerPort");
77 if (attri == "")
78 {
79 string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Remoting Listener Port", "8895");
80 configData.SetAttribute("RemotingListenerPort", location);
81 this.RemotingListenerPort = Convert.ToInt32(location);
82 }
83 else
84 {
85 this.RemotingListenerPort = Convert.ToInt32(attri);
86 }
87
88 if (sandboxMode)
89 {
90 // default home location X
91 attri = "";
92 attri = configData.GetAttribute("DefaultLocationX");
93 if (attri == "")
94 {
95 string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default Home Location X", "1000");
96 configData.SetAttribute("DefaultLocationX", location);
97 this.DefaultHomeLocX = (uint)Convert.ToUInt32(location);
98 }
99 else
100 {
101 this.DefaultHomeLocX = (uint)Convert.ToUInt32(attri);
102 }
103
104 // default home location Y
105 attri = "";
106 attri = configData.GetAttribute("DefaultLocationY");
107 if (attri == "")
108 {
109 string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default Home Location Y", "1000");
110 configData.SetAttribute("DefaultLocationY", location);
111 this.DefaultHomeLocY = (uint)Convert.ToUInt32(location);
112 }
113 else
114 {
115 this.DefaultHomeLocY = (uint)Convert.ToUInt32(attri);
116 }
117 }
118 if (!isSandbox)
119 {
120 //Grid Server
121 attri = "";
122 attri = configData.GetAttribute("GridServerURL");
123 if (attri == "")
124 {
125 this.GridURL = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/");
126 configData.SetAttribute("GridServerURL", this.GridURL);
127 }
128 else
129 {
130 this.GridURL = attri;
131 }
132
133 //Grid Send Key
134 attri = "";
135 attri = configData.GetAttribute("GridSendKey");
136 if (attri == "")
137 {
138 this.GridSendKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to send to grid server", "null");
139 configData.SetAttribute("GridSendKey", this.GridSendKey);
140 }
141 else
142 {
143 this.GridSendKey = attri;
144 }
145
146 //Grid Receive Key
147 attri = "";
148 attri = configData.GetAttribute("GridRecvKey");
149 if (attri == "")
150 {
151 this.GridRecvKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to expect from grid server", "null");
152 configData.SetAttribute("GridRecvKey", this.GridRecvKey);
153 }
154 else
155 {
156 this.GridRecvKey = attri;
157 }
158
159 attri = "";
160 attri = configData.GetAttribute("AssetServerURL");
161 if (attri == "")
162 {
163 this.AssetURL = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/");
164 configData.SetAttribute("AssetServerURL", this.GridURL);
165 }
166 else
167 {
168 this.AssetURL = attri;
169 }
170
171 }
172 configData.Commit();
173 }
174 catch (Exception e)
175 {
176 OpenSim.Framework.Console.MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured");
177 OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString());
178 }
179 }
180 }
181}