aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Common
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Common/OpenSim.Framework.Console/AssemblyInfo.cs58
-rw-r--r--Common/OpenSim.Framework.Console/ConsoleBase.cs220
-rw-r--r--Common/OpenSim.Framework.Console/ConsoleCallbacksBase.cs39
-rw-r--r--Common/OpenSim.Framework.Console/MainConsole.cs49
-rw-r--r--Common/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj89
-rw-r--r--Common/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build42
-rw-r--r--Common/OpenSim.Framework/AgentInventory.cs278
-rw-r--r--Common/OpenSim.Framework/BlockingQueue.cs60
-rw-r--r--Common/OpenSim.Framework/HeightMapGenHills.cs150
-rw-r--r--Common/OpenSim.Framework/Interfaces/IAssetServer.cs68
-rw-r--r--Common/OpenSim.Framework/Interfaces/IClientAPI.cs35
-rw-r--r--Common/OpenSim.Framework/Interfaces/IConfig.cs76
-rw-r--r--Common/OpenSim.Framework/Interfaces/IGenericConfig.cs15
-rw-r--r--Common/OpenSim.Framework/Interfaces/IGridConfig.cs64
-rw-r--r--Common/OpenSim.Framework/Interfaces/IGridServer.cs81
-rw-r--r--Common/OpenSim.Framework/Interfaces/ILocalStorage.cs68
-rw-r--r--Common/OpenSim.Framework/Interfaces/IScriptAPI.cs14
-rw-r--r--Common/OpenSim.Framework/Interfaces/IScriptEngine.cs14
-rw-r--r--Common/OpenSim.Framework/Interfaces/IUserConfig.cs58
-rw-r--r--Common/OpenSim.Framework/Interfaces/IUserServer.cs15
-rw-r--r--Common/OpenSim.Framework/Interfaces/LocalGridBase.cs24
-rw-r--r--Common/OpenSim.Framework/Interfaces/RemoteGridBase.cs37
-rw-r--r--Common/OpenSim.Framework/LoginService.cs42
-rw-r--r--Common/OpenSim.Framework/OpenSim.Framework.csproj200
-rw-r--r--Common/OpenSim.Framework/OpenSim.Framework.dll.build77
-rw-r--r--Common/OpenSim.Framework/Properties/AssemblyInfo.cs33
-rw-r--r--Common/OpenSim.Framework/Remoting.cs137
-rw-r--r--Common/OpenSim.Framework/SimProfile.cs110
-rw-r--r--Common/OpenSim.Framework/SimProfileBase.cs54
-rw-r--r--Common/OpenSim.Framework/Types/AgentCircuitData.cs50
-rw-r--r--Common/OpenSim.Framework/Types/AssetBase.cs49
-rw-r--r--Common/OpenSim.Framework/Types/AssetLandmark.cs61
-rw-r--r--Common/OpenSim.Framework/Types/AssetStorage.cs50
-rw-r--r--Common/OpenSim.Framework/Types/EstateSettings.cs96
-rw-r--r--Common/OpenSim.Framework/Types/Login.cs52
-rw-r--r--Common/OpenSim.Framework/Types/NeighbourInfo.cs47
-rw-r--r--Common/OpenSim.Framework/Types/OSVector3.cs46
-rw-r--r--Common/OpenSim.Framework/Types/ParcelData.cs115
-rw-r--r--Common/OpenSim.Framework/Types/PrimData.cs201
-rw-r--r--Common/OpenSim.Framework/UserProfile.cs89
-rw-r--r--Common/OpenSim.Framework/UserProfileManager.cs299
-rw-r--r--Common/OpenSim.Framework/UserProfileManagerBase.cs152
-rw-r--r--Common/OpenSim.Framework/Util.cs178
-rw-r--r--Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.csproj93
-rw-r--r--Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.dll.build42
-rw-r--r--Common/OpenSim.GenericConfig/Xml/Properties/AssemblyInfo.cs35
-rw-r--r--Common/OpenSim.GenericConfig/Xml/XmlConfig.cs136
-rw-r--r--Common/OpenSim.Servers/BaseHttpServer.cs283
-rw-r--r--Common/OpenSim.Servers/BaseServer.cs37
-rw-r--r--Common/OpenSim.Servers/CheckSumServer.cs139
-rw-r--r--Common/OpenSim.Servers/IRestHandler.cs35
-rw-r--r--Common/OpenSim.Servers/LocalUserProfileManager.cs124
-rw-r--r--Common/OpenSim.Servers/LoginResponse.cs669
-rw-r--r--Common/OpenSim.Servers/LoginServer.cs296
-rw-r--r--Common/OpenSim.Servers/OpenSim.Servers.csproj133
-rw-r--r--Common/OpenSim.Servers/OpenSim.Servers.dll.build53
-rw-r--r--Common/OpenSim.Servers/SocketRegistry.cs63
-rw-r--r--Common/OpenSim.Servers/UDPServerBase.cs103
-rw-r--r--Common/OpenSim.Servers/XmlRpcMethod.cs34
-rw-r--r--Common/XmlRpcCS/Logger.cs46
-rw-r--r--Common/XmlRpcCS/SimpleHttpRequest.cs234
-rw-r--r--Common/XmlRpcCS/XMLRPC.csproj138
-rw-r--r--Common/XmlRpcCS/XMLRPC.dll.build58
-rw-r--r--Common/XmlRpcCS/XmlRpcBoxcarRequest.cs78
-rw-r--r--Common/XmlRpcCS/XmlRpcClientProxy.cs88
-rw-r--r--Common/XmlRpcCS/XmlRpcDeserializer.cs222
-rw-r--r--Common/XmlRpcCS/XmlRpcErrorCodes.cs78
-rw-r--r--Common/XmlRpcCS/XmlRpcException.cs66
-rw-r--r--Common/XmlRpcCS/XmlRpcExposedAttribute.cs87
-rw-r--r--Common/XmlRpcCS/XmlRpcRequest.cs177
-rw-r--r--Common/XmlRpcCS/XmlRpcRequestDeserializer.cs92
-rw-r--r--Common/XmlRpcCS/XmlRpcRequestSerializer.cs78
-rw-r--r--Common/XmlRpcCS/XmlRpcResponder.cs127
-rw-r--r--Common/XmlRpcCS/XmlRpcResponse.cs112
-rw-r--r--Common/XmlRpcCS/XmlRpcResponseDeserializer.cs92
-rw-r--r--Common/XmlRpcCS/XmlRpcResponseSerializer.cs84
-rw-r--r--Common/XmlRpcCS/XmlRpcSerializer.cs143
-rw-r--r--Common/XmlRpcCS/XmlRpcServer.cs266
-rw-r--r--Common/XmlRpcCS/XmlRpcSystemObject.cs279
-rw-r--r--Common/XmlRpcCS/XmlRpcXmlTokens.cs103
80 files changed, 0 insertions, 8615 deletions
diff --git a/Common/OpenSim.Framework.Console/AssemblyInfo.cs b/Common/OpenSim.Framework.Console/AssemblyInfo.cs
deleted file mode 100644
index 8f715d2..0000000
--- a/Common/OpenSim.Framework.Console/AssemblyInfo.cs
+++ /dev/null
@@ -1,58 +0,0 @@
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.Reflection;
29using System.Runtime.CompilerServices;
30using System.Runtime.InteropServices;
31
32// Information about this assembly is defined by the following
33// attributes.
34//
35// change them to the information which is associated with the assembly
36// you compile.
37
38[assembly: AssemblyTitle("ServerConsole")]
39[assembly: AssemblyDescription("")]
40[assembly: AssemblyConfiguration("")]
41[assembly: AssemblyCompany("")]
42[assembly: AssemblyProduct("ServerConsole")]
43[assembly: AssemblyCopyright("")]
44[assembly: AssemblyTrademark("")]
45[assembly: AssemblyCulture("")]
46
47// This sets the default COM visibility of types in the assembly to invisible.
48// If you need to expose a type to COM, use [ComVisible(true)] on that type.
49[assembly: ComVisible(false)]
50
51// The assembly version has following format :
52//
53// Major.Minor.Build.Revision
54//
55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default):
57
58[assembly: AssemblyVersion("1.0.*")]
diff --git a/Common/OpenSim.Framework.Console/ConsoleBase.cs b/Common/OpenSim.Framework.Console/ConsoleBase.cs
deleted file mode 100644
index 30854fe..0000000
--- a/Common/OpenSim.Framework.Console/ConsoleBase.cs
+++ /dev/null
@@ -1,220 +0,0 @@
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.IO;
30
31namespace OpenSim.Framework.Console
32{
33 public enum LogPriority : int
34 {
35 CRITICAL,
36 HIGH,
37 MEDIUM,
38 NORMAL,
39 LOW,
40 VERBOSE,
41 EXTRAVERBOSE
42 }
43
44 public class ConsoleBase
45 {
46 StreamWriter Log;
47 public conscmd_callback cmdparser;
48 public string componentname;
49 private bool m_silent;
50
51 public ConsoleBase(string LogFile, string componentname, conscmd_callback cmdparser, bool silent )
52 {
53 this.componentname = componentname;
54 this.cmdparser = cmdparser;
55 this.m_silent = silent;
56 System.Console.WriteLine("ServerConsole.cs - creating new local console");
57 System.Console.WriteLine("Logs will be saved to current directory in " + LogFile);
58 Log = File.AppendText(LogFile);
59 Log.WriteLine("========================================================================");
60 Log.WriteLine(componentname + " Started at " + DateTime.Now.ToString());
61 }
62
63 public void Close()
64 {
65 Log.WriteLine("Shutdown at " + DateTime.Now.ToString());
66 Log.Close();
67 }
68
69 public void Write(string format, params object[] args)
70 {
71 Notice(format,args);
72 return;
73 }
74
75 public void Warn(string format, params object[] args)
76 {
77 WriteNewLine(ConsoleColor.Yellow, format, args);
78 return;
79 }
80
81 public void Notice(string format, params object[] args)
82 {
83 WriteNewLine(ConsoleColor.White, format, args);
84 return;
85 }
86
87 public void Error(string format, params object[] args)
88 {
89 WriteNewLine(ConsoleColor.Red, format, args);
90 return;
91 }
92
93 public void Verbose(string format, params object[] args)
94 {
95 WriteNewLine(ConsoleColor.Gray, format, args);
96 return;
97 }
98
99 public void Status(string format, params object[] args)
100 {
101 WriteNewLine(ConsoleColor.Blue, format, args);
102 return;
103 }
104
105 private void WriteNewLine(System.ConsoleColor color, string format, params object[] args)
106 {
107 Log.WriteLine(format, args);
108 Log.Flush();
109 if (!m_silent)
110 {
111 try
112 {
113 System.Console.ForegroundColor = color;
114 System.Console.WriteLine(format, args);
115 System.Console.ResetColor();
116 } // Because mono and old debian sucks.
117 catch (System.ArgumentNullException)
118 {
119 System.Console.WriteLine(format, args);
120 }
121 }
122 return;
123 }
124
125 public string ReadLine()
126 {
127 string TempStr = System.Console.ReadLine();
128 Log.WriteLine(TempStr);
129 return TempStr;
130 }
131
132 public int Read()
133 {
134 int TempInt = System.Console.Read();
135 Log.Write((char)TempInt);
136 return TempInt;
137 }
138
139 // Displays a prompt and waits for the user to enter a string, then returns that string
140 // Done with no echo and suitable for passwords
141 public string PasswdPrompt(string prompt)
142 {
143 // FIXME: Needs to be better abstracted
144 Log.WriteLine(prompt);
145 this.Write(prompt);
146 ConsoleColor oldfg = System.Console.ForegroundColor;
147 System.Console.ForegroundColor = System.Console.BackgroundColor;
148 string temp = System.Console.ReadLine();
149 System.Console.ForegroundColor = oldfg;
150 return temp;
151 }
152
153 // Displays a command prompt and waits for the user to enter a string, then returns that string
154 public string CmdPrompt(string prompt)
155 {
156 this.Write(String.Format("{0}: ", prompt));
157 return this.ReadLine();
158 }
159
160 // Displays a command prompt and returns a default value if the user simply presses enter
161 public string CmdPrompt(string prompt, string defaultresponse)
162 {
163 string temp = CmdPrompt(String.Format( "{0} [{1}]", prompt, defaultresponse ));
164 if (temp == "")
165 {
166 return defaultresponse;
167 }
168 else
169 {
170 return temp;
171 }
172 }
173
174 // Displays a command prompt and returns a default value, user may only enter 1 of 2 options
175 public string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB)
176 {
177 bool itisdone = false;
178 string temp = CmdPrompt(prompt, defaultresponse);
179 while (itisdone == false)
180 {
181 if ((temp == OptionA) || (temp == OptionB))
182 {
183 itisdone = true;
184 }
185 else
186 {
187 Notice("Valid options are " + OptionA + " or " + OptionB);
188 temp = CmdPrompt(prompt, defaultresponse);
189 }
190 }
191 return temp;
192 }
193
194 // Runs a command with a number of parameters
195 public Object RunCmd(string Cmd, string[] cmdparams)
196 {
197 cmdparser.RunCmd(Cmd, cmdparams);
198 return null;
199 }
200
201 // Shows data about something
202 public void ShowCommands(string ShowWhat)
203 {
204 cmdparser.Show(ShowWhat);
205 }
206
207 public void MainConsolePrompt()
208 {
209 string[] tempstrarray;
210 string tempstr = this.CmdPrompt(this.componentname + "# ");
211 tempstrarray = tempstr.Split(' ');
212 string cmd = tempstrarray[0];
213 Array.Reverse(tempstrarray);
214 Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1);
215 Array.Reverse(tempstrarray);
216 string[] cmdparams = (string[])tempstrarray;
217 RunCmd(cmd, cmdparams);
218 }
219 }
220}
diff --git a/Common/OpenSim.Framework.Console/ConsoleCallbacksBase.cs b/Common/OpenSim.Framework.Console/ConsoleCallbacksBase.cs
deleted file mode 100644
index e3847be..0000000
--- a/Common/OpenSim.Framework.Console/ConsoleCallbacksBase.cs
+++ /dev/null
@@ -1,39 +0,0 @@
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;
31
32namespace OpenSim.Framework.Console
33{
34 public interface conscmd_callback
35 {
36 void RunCmd(string cmd, string[] cmdparams);
37 void Show(string ShowWhat);
38 }
39}
diff --git a/Common/OpenSim.Framework.Console/MainConsole.cs b/Common/OpenSim.Framework.Console/MainConsole.cs
deleted file mode 100644
index 01aa3d1..0000000
--- a/Common/OpenSim.Framework.Console/MainConsole.cs
+++ /dev/null
@@ -1,49 +0,0 @@
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;
29
30namespace OpenSim.Framework.Console
31{
32 public class MainConsole {
33
34 private static ConsoleBase instance;
35
36 public static ConsoleBase Instance
37 {
38 get
39 {
40 return instance;
41 }
42 set
43 {
44 instance = value;
45 }
46 }
47 }
48
49}
diff --git a/Common/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj b/Common/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj
deleted file mode 100644
index 7af0eca..0000000
--- a/Common/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj
+++ /dev/null
@@ -1,89 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{A7CD0630-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Framework.Console</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.Framework.Console</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 </ItemGroup>
66 <ItemGroup>
67 </ItemGroup>
68 <ItemGroup>
69 <Compile Include="AssemblyInfo.cs">
70 <SubType>Code</SubType>
71 </Compile>
72 <Compile Include="ConsoleBase.cs">
73 <SubType>Code</SubType>
74 </Compile>
75 <Compile Include="ConsoleCallbacksBase.cs">
76 <SubType>Code</SubType>
77 </Compile>
78 <Compile Include="MainConsole.cs">
79 <SubType>Code</SubType>
80 </Compile>
81 </ItemGroup>
82 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
83 <PropertyGroup>
84 <PreBuildEvent>
85 </PreBuildEvent>
86 <PostBuildEvent>
87 </PostBuildEvent>
88 </PropertyGroup>
89</Project>
diff --git a/Common/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build b/Common/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build
deleted file mode 100644
index 9a03b54..0000000
--- a/Common/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build
+++ /dev/null
@@ -1,42 +0,0 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Framework.Console" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Framework.Console" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="ConsoleBase.cs" />
16 <include name="ConsoleCallbacksBase.cs" />
17 <include name="MainConsole.cs" />
18 </sources>
19 <references basedir="${project::get-base-directory()}">
20 <lib>
21 <include name="${project::get-base-directory()}" />
22 <include name="${project::get-base-directory()}/${build.dir}" />
23 </lib>
24 <include name="System.dll" />
25 </references>
26 </csc>
27 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
28 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
29 <copy todir="${project::get-base-directory()}/../../bin/">
30 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
31 <include name="*.dll"/>
32 <include name="*.exe"/>
33 </fileset>
34 </copy>
35 </target>
36 <target name="clean">
37 <delete dir="${bin.dir}" failonerror="false" />
38 <delete dir="${obj.dir}" failonerror="false" />
39 </target>
40 <target name="doc" description="Creates documentation.">
41 </target>
42</project>
diff --git a/Common/OpenSim.Framework/AgentInventory.cs b/Common/OpenSim.Framework/AgentInventory.cs
deleted file mode 100644
index b36982a..0000000
--- a/Common/OpenSim.Framework/AgentInventory.cs
+++ /dev/null
@@ -1,278 +0,0 @@
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 libsecondlife;
32using libsecondlife.Packets;
33using OpenSim.Framework.Types;
34using OpenSim.Framework.Utilities;
35
36namespace OpenSim.Framework.Inventory
37{
38 public class AgentInventory
39 {
40 //Holds the local copy of Inventory info for a agent
41 public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
42 public Dictionary<LLUUID, InventoryItem> InventoryItems;
43 public InventoryFolder InventoryRoot;
44 public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server
45 public LLUUID AgentID;
46 public AvatarWearable[] Wearables;
47
48 public AgentInventory()
49 {
50 InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
51 InventoryItems = new Dictionary<LLUUID, InventoryItem>();
52 this.Initialise();
53 }
54
55 public virtual void Initialise()
56 {
57 Wearables = new AvatarWearable[13]; //should be 12 of these
58 for (int i = 0; i < 13; i++)
59 {
60 Wearables[i] = new AvatarWearable();
61 }
62
63 }
64
65 public bool CreateNewFolder(LLUUID folderID, ushort type)
66 {
67 InventoryFolder Folder = new InventoryFolder();
68 Folder.FolderID = folderID;
69 Folder.OwnerID = this.AgentID;
70 Folder.DefaultType = type;
71 this.InventoryFolders.Add(Folder.FolderID, Folder);
72 return (true);
73 }
74
75 public void CreateRootFolder(LLUUID newAgentID, bool createTextures)
76 {
77 this.AgentID = newAgentID;
78 InventoryRoot = new InventoryFolder();
79 InventoryRoot.FolderID = LLUUID.Random();
80 InventoryRoot.ParentID = new LLUUID();
81 InventoryRoot.Version = 1;
82 InventoryRoot.DefaultType = 8;
83 InventoryRoot.OwnerID = this.AgentID;
84 InventoryRoot.FolderName = "My Inventory";
85 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
86 InventoryRoot.OwnerID = this.AgentID;
87 if (createTextures)
88 {
89 this.CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID);
90 }
91 }
92
93 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName)
94 {
95 InventoryFolder Folder = new InventoryFolder();
96 Folder.FolderID = folderID;
97 Folder.OwnerID = this.AgentID;
98 Folder.DefaultType = type;
99 Folder.FolderName = folderName;
100 this.InventoryFolders.Add(Folder.FolderID, Folder);
101
102 return (true);
103 }
104
105 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent)
106 {
107 if (!this.InventoryFolders.ContainsKey(folderID))
108 {
109 Console.WriteLine("creating new folder called " + folderName + " in agents inventory");
110 InventoryFolder Folder = new InventoryFolder();
111 Folder.FolderID = folderID;
112 Folder.OwnerID = this.AgentID;
113 Folder.DefaultType = type;
114 Folder.FolderName = folderName;
115 Folder.ParentID = parent;
116 this.InventoryFolders.Add(Folder.FolderID, Folder);
117 }
118
119 return (true);
120 }
121
122 public bool HasFolder(LLUUID folderID)
123 {
124 if (this.InventoryFolders.ContainsKey(folderID))
125 {
126 return true;
127 }
128 return false;
129 }
130
131 public LLUUID GetFolderID(string folderName)
132 {
133 foreach (InventoryFolder inv in this.InventoryFolders.Values)
134 {
135 if (inv.FolderName == folderName)
136 {
137 return inv.FolderID;
138 }
139 }
140
141 return LLUUID.Zero;
142 }
143
144 public bool UpdateItemAsset(LLUUID itemID, AssetBase asset)
145 {
146 if(this.InventoryItems.ContainsKey(itemID))
147 {
148 InventoryItem Item = this.InventoryItems[itemID];
149 Item.AssetID = asset.FullID;
150 Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + " so it now is set to asset " + asset.FullID.ToStringHyphenated());
151 //TODO need to update the rest of the info
152 }
153 return true;
154 }
155
156 public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet)
157 {
158 Console.WriteLine("updating inventory item details");
159 if (this.InventoryItems.ContainsKey(itemID))
160 {
161 Console.WriteLine("changing name to "+ Util.FieldToString(packet.Name));
162 InventoryItem Item = this.InventoryItems[itemID];
163 Item.Name = Util.FieldToString(packet.Name);
164 Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated());
165 //TODO need to update the rest of the info
166 }
167 return true;
168 }
169
170 public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
171 {
172 if (this.InventoryFolders.ContainsKey(folderID))
173 {
174 LLUUID NewItemID = LLUUID.Random();
175
176 InventoryItem Item = new InventoryItem();
177 Item.FolderID = folderID;
178 Item.OwnerID = AgentID;
179 Item.AssetID = asset.FullID;
180 Item.ItemID = NewItemID;
181 Item.Type = asset.Type;
182 Item.Name = asset.Name;
183 Item.Description = asset.Description;
184 Item.InvType = asset.InvType;
185 this.InventoryItems.Add(Item.ItemID, Item);
186 InventoryFolder Folder = InventoryFolders[Item.FolderID];
187 Folder.Items.Add(Item);
188 return (Item.ItemID);
189 }
190 else
191 {
192 return (null);
193 }
194 }
195
196 public bool DeleteFromInventory(LLUUID itemID)
197 {
198 bool res = false;
199 if (this.InventoryItems.ContainsKey(itemID))
200 {
201 InventoryItem item = this.InventoryItems[itemID];
202 this.InventoryItems.Remove(itemID);
203 foreach (InventoryFolder fold in InventoryFolders.Values)
204 {
205 if (fold.Items.Contains(item))
206 {
207 fold.Items.Remove(item);
208 break;
209 }
210 }
211 res = true;
212
213 }
214 return res;
215 }
216 }
217
218 public class InventoryFolder
219 {
220 public List<InventoryItem> Items;
221 //public List<InventoryFolder> Subfolders;
222 public LLUUID FolderID;
223 public LLUUID OwnerID;
224 public LLUUID ParentID = LLUUID.Zero;
225 public string FolderName;
226 public ushort DefaultType;
227 public ushort Version;
228
229 public InventoryFolder()
230 {
231 Items = new List<InventoryItem>();
232 //Subfolders = new List<InventoryFolder>();
233 }
234
235 }
236
237 public class InventoryItem
238 {
239 public LLUUID FolderID;
240 public LLUUID OwnerID;
241 public LLUUID ItemID;
242 public LLUUID AssetID;
243 public LLUUID CreatorID;
244 public sbyte InvType;
245 public sbyte Type;
246 public string Name ="";
247 public string Description;
248
249 public InventoryItem()
250 {
251 this.CreatorID = LLUUID.Zero;
252 }
253
254 public string ExportString()
255 {
256 string typ = "notecard";
257 string result = "";
258 result += "\tinv_object\t0\n\t{\n";
259 result += "\t\tobj_id\t%s\n";
260 result += "\t\tparent_id\t"+ ItemID.ToString() +"\n";
261 result += "\t\ttype\t"+ typ +"\n";
262 result += "\t\tname\t" + Name+"|\n";
263 result += "\t}\n";
264 return result;
265 }
266 }
267
268 public class AvatarWearable
269 {
270 public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
271 public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
272
273 public AvatarWearable()
274 {
275
276 }
277 }
278}
diff --git a/Common/OpenSim.Framework/BlockingQueue.cs b/Common/OpenSim.Framework/BlockingQueue.cs
deleted file mode 100644
index 667b8d8..0000000
--- a/Common/OpenSim.Framework/BlockingQueue.cs
+++ /dev/null
@@ -1,60 +0,0 @@
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.Threading;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Framework.Utilities
34{
35 public class BlockingQueue<T>
36 {
37 private Queue<T> _queue = new Queue<T>();
38 private object _queueSync = new object();
39
40 public void Enqueue(T value)
41 {
42 lock (_queueSync)
43 {
44 _queue.Enqueue(value);
45 Monitor.Pulse(_queueSync);
46 }
47 }
48
49 public T Dequeue()
50 {
51 lock (_queueSync)
52 {
53 if (_queue.Count < 1)
54 Monitor.Wait(_queueSync);
55
56 return _queue.Dequeue();
57 }
58 }
59 }
60}
diff --git a/Common/OpenSim.Framework/HeightMapGenHills.cs b/Common/OpenSim.Framework/HeightMapGenHills.cs
deleted file mode 100644
index 9777b82..0000000
--- a/Common/OpenSim.Framework/HeightMapGenHills.cs
+++ /dev/null
@@ -1,150 +0,0 @@
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*/
28
29using System;
30
31namespace OpenSim.Framework.Terrain
32{
33 public class HeightmapGenHills
34 {
35 private Random Rand = new Random();
36 private int NumHills;
37 private float HillMin;
38 private float HillMax;
39 private bool Island;
40 private float[] heightmap;
41
42 public float[] GenerateHeightmap(int numHills, float hillMin, float hillMax, bool island)
43 {
44 NumHills = numHills;
45 HillMin = hillMin;
46 HillMax = hillMax;
47 Island = island;
48
49 heightmap = new float[256 * 256];
50
51 for (int i = 0; i < numHills; i++)
52 {
53 AddHill();
54 }
55
56 Normalize();
57
58 return heightmap;
59 }
60
61 private void AddHill()
62 {
63 float x, y;
64 float radius = RandomRange(HillMin, HillMax);
65
66 if (Island)
67 {
68 // Which direction from the center of the map the hill is placed
69 float theta = RandomRange(0, 6.28f);
70
71 // How far from the center of the map to place the hill. The radius
72 // is subtracted from the range to prevent any part of the hill from
73 // reaching the edge of the map
74 float distance = RandomRange(radius / 2.0f, 128.0f - radius);
75
76 x = 128.0f + (float)Math.Cos(theta) * distance;
77 y = 128.0f + (float)Math.Sin(theta) * distance;
78 }
79 else
80 {
81 x = RandomRange(-radius, 256.0f + radius);
82 y = RandomRange(-radius, 256.0f + radius);
83 }
84
85 float radiusSq = radius * radius;
86 float distSq;
87 float height;
88
89 int xMin = (int)(x - radius) - 1;
90 int xMax = (int)(x + radius) + 1;
91 if (xMin < 0) xMin = 0;
92 if (xMax > 255) xMax = 255;
93
94 int yMin = (int)(y - radius) - 1;
95 int yMax = (int)(y + radius) + 1;
96 if (yMin < 0) yMin = 0;
97 if (yMax > 255) yMax = 255;
98
99 // Loop through each affected cell and determine the height at that point
100 for (int v = yMin; v <= yMax; ++v)
101 {
102 float fv = (float)v;
103
104 for (int h = xMin; h <= xMax; ++h)
105 {
106 float fh = (float)h;
107
108 // Determine how far from the center of this hill this point is
109 distSq = (x - fh) * (x - fh) + (y - fv) * (y - fv);
110 height = radiusSq - distSq;
111
112 // Don't add negative hill values
113 if (height > 0.0f) heightmap[h + v * 256] += height;
114 }
115 }
116 }
117
118 private void Normalize()
119 {
120 float min = heightmap[0];
121 float max = heightmap[0];
122
123 for (int x = 0; x < 256; x++)
124 {
125 for (int y = 0; y < 256; y++)
126 {
127 if (heightmap[x + y * 256] < min) min = heightmap[x + y * 256];
128 if (heightmap[x + y * 256] > max) max = heightmap[x + y * 256];
129 }
130 }
131
132 // Avoid a rare divide by zero
133 if (min != max)
134 {
135 for (int x = 0; x < 256; x++)
136 {
137 for (int y = 0; y < 256; y++)
138 {
139 heightmap[x + y * 256] = ((heightmap[x + y * 256] - min) / (max - min)) * (HillMax - HillMin);
140 }
141 }
142 }
143 }
144
145 private float RandomRange(float min, float max)
146 {
147 return (float)Rand.NextDouble() * (max - min) + min;
148 }
149 }
150}
diff --git a/Common/OpenSim.Framework/Interfaces/IAssetServer.cs b/Common/OpenSim.Framework/Interfaces/IAssetServer.cs
deleted file mode 100644
index 3f86acc..0000000
--- a/Common/OpenSim.Framework/Interfaces/IAssetServer.cs
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27using System;
28using System.Net;
29using System.Net.Sockets;
30using System.IO;
31using System.Threading;
32using libsecondlife;
33using OpenSim.Framework.Types;
34
35namespace OpenSim.Framework.Interfaces
36{
37 /// <summary>
38 /// Description of IAssetServer.
39 /// </summary>
40
41 public interface IAssetServer
42 {
43 void SetReceiver(IAssetReceiver receiver);
44 void RequestAsset(LLUUID assetID, bool isTexture);
45 void UpdateAsset(AssetBase asset);
46 void UploadNewAsset(AssetBase asset);
47 void SetServerInfo(string ServerUrl, string ServerKey);
48 void Close();
49 }
50
51 // could change to delegate?
52 public interface IAssetReceiver
53 {
54 void AssetReceived(AssetBase asset, bool IsTexture);
55 void AssetNotFound(AssetBase asset);
56 }
57
58 public interface IAssetPlugin
59 {
60 IAssetServer GetAssetServer();
61 }
62
63 public struct ARequest
64 {
65 public LLUUID AssetID;
66 public bool IsTexture;
67 }
68}
diff --git a/Common/OpenSim.Framework/Interfaces/IClientAPI.cs b/Common/OpenSim.Framework/Interfaces/IClientAPI.cs
deleted file mode 100644
index 9f7b619..0000000
--- a/Common/OpenSim.Framework/Interfaces/IClientAPI.cs
+++ /dev/null
@@ -1,35 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Inventory;
5using libsecondlife;
6using libsecondlife.Packets;
7using OpenSim.Framework.Types;
8
9namespace OpenSim.Framework.Interfaces
10{
11 public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
12 public delegate void RezObject(AssetBase primAsset, LLVector3 pos);
13 public delegate void ModifyTerrain(byte action, float north, float west);
14 public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
15 public delegate void StartAnim(LLUUID animID, int seq);
16 public delegate void LinkObjects(uint parent, List<uint> children);
17
18 public interface IClientAPI
19 {
20 event ChatFromViewer OnChatFromViewer;
21 event RezObject OnRezObject;
22 event ModifyTerrain OnModifyTerrain;
23 event SetAppearance OnSetAppearance;
24 event StartAnim OnStartAnim;
25 event LinkObjects OnLinkObjects;
26
27 LLVector3 StartPos
28 {
29 get;
30 set;
31 }
32 void SendAppearance(AvatarWearable[] wearables);
33 void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
34 }
35}
diff --git a/Common/OpenSim.Framework/Interfaces/IConfig.cs b/Common/OpenSim.Framework/Interfaces/IConfig.cs
deleted file mode 100644
index 7b4c040..0000000
--- a/Common/OpenSim.Framework/Interfaces/IConfig.cs
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Collections.Generic;
32using System.IO;
33using libsecondlife;
34//using OpenSim.world;
35
36namespace OpenSim.Framework.Interfaces
37{
38 /// <summary>
39 /// This class handles connection to the underlying database used for configuration of the region.
40 /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate
41 /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from
42 /// what is hardcoded here and then saved into opensim.yap for future startups.
43 /// </summary>
44
45
46 public abstract class SimConfig
47 {
48 public string RegionName;
49
50 public uint RegionLocX;
51 public uint RegionLocY;
52 public ulong RegionHandle;
53
54 public int IPListenPort;
55 public string IPListenAddr;
56
57 public string AssetURL;
58 public string AssetSendKey;
59
60 public string GridURL;
61 public string GridSendKey;
62 public string GridRecvKey;
63 public string UserURL;
64 public string UserSendKey;
65 public string UserRecvKey;
66
67 public abstract void InitConfig(bool sandboxMode);
68 public abstract void LoadFromGrid();
69
70 }
71
72 public interface ISimConfig
73 {
74 SimConfig GetConfigObject();
75 }
76}
diff --git a/Common/OpenSim.Framework/Interfaces/IGenericConfig.cs b/Common/OpenSim.Framework/Interfaces/IGenericConfig.cs
deleted file mode 100644
index a853fe4..0000000
--- a/Common/OpenSim.Framework/Interfaces/IGenericConfig.cs
+++ /dev/null
@@ -1,15 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.Interfaces
6{
7 public interface IGenericConfig
8 {
9 void LoadData();
10 string GetAttribute(string attributeName);
11 bool SetAttribute(string attributeName, string attributeValue);
12 void Commit();
13 void Close();
14 }
15}
diff --git a/Common/OpenSim.Framework/Interfaces/IGridConfig.cs b/Common/OpenSim.Framework/Interfaces/IGridConfig.cs
deleted file mode 100644
index b2f26da..0000000
--- a/Common/OpenSim.Framework/Interfaces/IGridConfig.cs
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Collections.Generic;
32using System.IO;
33using libsecondlife;
34//using OpenSim.world;
35
36namespace OpenSim.Framework.Interfaces
37{
38 /// <summary>
39 /// </summary>
40
41
42 public abstract class GridConfig
43 {
44 public string GridOwner;
45 public string DefaultStartupMsg;
46 public string DefaultAssetServer;
47 public string AssetSendKey;
48 public string AssetRecvKey;
49 public string DefaultUserServer;
50 public string UserSendKey;
51 public string UserRecvKey;
52 public string SimSendKey;
53 public string SimRecvKey;
54
55
56 public abstract void InitConfig();
57
58 }
59
60 public interface IGridConfig
61 {
62 GridConfig GetConfigObject();
63 }
64}
diff --git a/Common/OpenSim.Framework/Interfaces/IGridServer.cs b/Common/OpenSim.Framework/Interfaces/IGridServer.cs
deleted file mode 100644
index e67ea98..0000000
--- a/Common/OpenSim.Framework/Interfaces/IGridServer.cs
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28
29using System;
30using System.Collections;
31using System.Collections.Generic;
32using System.Net;
33using System.Net.Sockets;
34using System.IO;
35using libsecondlife;
36using OpenSim;
37using OpenSim.Framework.Types;
38
39namespace OpenSim.Framework.Interfaces
40{
41 /// <summary>
42 /// Handles connection to Grid Servers.
43 /// also Sim to Sim connections?
44 /// </summary>
45
46 public interface IGridServer
47 {
48 UUIDBlock RequestUUIDBlock();
49 NeighbourInfo[] RequestNeighbours(); //should return a array of neighbouring regions
50 AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
51 bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
52 string GetName();
53 bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port);
54 void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
55 IList RequestMapBlocks(int minX, int minY, int maxX, int maxY);
56 void Close();
57 }
58
59 public struct UUIDBlock
60 {
61 public LLUUID BlockStart;
62 public LLUUID BlockEnd;
63 }
64
65 public class AuthenticateResponse
66 {
67 public bool Authorised;
68 public Login LoginInfo;
69
70 public AuthenticateResponse()
71 {
72
73 }
74
75 }
76
77 public interface IGridPlugin
78 {
79 IGridServer GetGridServer();
80 }
81}
diff --git a/Common/OpenSim.Framework/Interfaces/ILocalStorage.cs b/Common/OpenSim.Framework/Interfaces/ILocalStorage.cs
deleted file mode 100644
index dd17b72..0000000
--- a/Common/OpenSim.Framework/Interfaces/ILocalStorage.cs
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28using System;
29using libsecondlife;
30using OpenSim.Framework.Types;
31
32namespace OpenSim.Framework.Interfaces
33{
34 /// <summary>
35 /// ILocalStorage. Really hacked together right now needs cleaning up
36 /// </summary>
37 public interface ILocalStorage
38 {
39 void Initialise(string datastore);
40
41 void StorePrim(PrimData prim);
42 void RemovePrim(LLUUID primID);
43 void LoadPrimitives(ILocalStorageReceiver receiver);
44
45 float[] LoadWorld();
46 void SaveMap(float[] heightmap);
47
48 void SaveParcels(ParcelData[] parcels);
49 void SaveParcel(ParcelData parcel);
50 void RemoveParcel(ParcelData parcel);
51 void RemoveAllParcels();
52 void LoadParcels(ILocalStorageParcelReceiver recv);
53
54 void ShutDown();
55 }
56
57 public interface ILocalStorageReceiver
58 {
59 void PrimFromStorage(PrimData prim);
60 }
61
62 public interface ILocalStorageParcelReceiver
63 {
64 void ParcelFromStorage(ParcelData data);
65 void NoParcelDataFromStorage();
66 }
67}
68
diff --git a/Common/OpenSim.Framework/Interfaces/IScriptAPI.cs b/Common/OpenSim.Framework/Interfaces/IScriptAPI.cs
deleted file mode 100644
index 3ad0f06..0000000
--- a/Common/OpenSim.Framework/Interfaces/IScriptAPI.cs
+++ /dev/null
@@ -1,14 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Types;
5
6namespace OpenSim.Framework.Interfaces
7{
8 public interface IScriptAPI
9 {
10 OSVector3 GetEntityPosition(uint localID);
11 void SetEntityPosition(uint localID, float x, float y, float z);
12 uint GetRandomAvatarID();
13 }
14}
diff --git a/Common/OpenSim.Framework/Interfaces/IScriptEngine.cs b/Common/OpenSim.Framework/Interfaces/IScriptEngine.cs
deleted file mode 100644
index ed8974c..0000000
--- a/Common/OpenSim.Framework/Interfaces/IScriptEngine.cs
+++ /dev/null
@@ -1,14 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.Interfaces
6{
7 public interface IScriptEngine
8 {
9 bool Init(IScriptAPI api);
10 string GetName();
11 void LoadScript(string script, string scriptName, uint entityID);
12 void OnFrame();
13 }
14}
diff --git a/Common/OpenSim.Framework/Interfaces/IUserConfig.cs b/Common/OpenSim.Framework/Interfaces/IUserConfig.cs
deleted file mode 100644
index e15867d..0000000
--- a/Common/OpenSim.Framework/Interfaces/IUserConfig.cs
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Collections.Generic;
32using System.IO;
33using libsecondlife;
34//using OpenSim.world;
35
36namespace OpenSim.Framework.Interfaces
37{
38 /// <summary>
39 /// </summary>
40
41
42 public abstract class UserConfig
43 {
44 public string DefaultStartupMsg;
45 public string GridServerURL;
46 public string GridSendKey;
47 public string GridRecvKey;
48
49
50 public abstract void InitConfig();
51
52 }
53
54 public interface IUserConfig
55 {
56 UserConfig GetConfigObject();
57 }
58}
diff --git a/Common/OpenSim.Framework/Interfaces/IUserServer.cs b/Common/OpenSim.Framework/Interfaces/IUserServer.cs
deleted file mode 100644
index 21f2721..0000000
--- a/Common/OpenSim.Framework/Interfaces/IUserServer.cs
+++ /dev/null
@@ -1,15 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Inventory;
5using libsecondlife;
6
7namespace OpenSim.Framework.Interfaces
8{
9 public interface IUserServer
10 {
11 AgentInventory RequestAgentsInventory(LLUUID agentID);
12 void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
13 bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory);
14 }
15}
diff --git a/Common/OpenSim.Framework/Interfaces/LocalGridBase.cs b/Common/OpenSim.Framework/Interfaces/LocalGridBase.cs
deleted file mode 100644
index ff46502..0000000
--- a/Common/OpenSim.Framework/Interfaces/LocalGridBase.cs
+++ /dev/null
@@ -1,24 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Framework.Types;
6using System.Collections;
7
8namespace OpenSim.Framework.Interfaces
9{
10 public abstract class LocalGridBase : IGridServer
11 {
12 public abstract UUIDBlock RequestUUIDBlock();
13 public abstract NeighbourInfo[] RequestNeighbours();
14 public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
15 public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
16 public abstract string GetName();
17 public abstract bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port);
18 public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
19 public abstract void AddNewSession(Login session);
20 public abstract IList RequestMapBlocks(int minX, int minY, int maxX, int maxY);
21 public abstract void Close();
22 }
23
24}
diff --git a/Common/OpenSim.Framework/Interfaces/RemoteGridBase.cs b/Common/OpenSim.Framework/Interfaces/RemoteGridBase.cs
deleted file mode 100644
index ed13ed5..0000000
--- a/Common/OpenSim.Framework/Interfaces/RemoteGridBase.cs
+++ /dev/null
@@ -1,37 +0,0 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Text;
5using libsecondlife;
6using OpenSim.Framework.Types;
7
8namespace OpenSim.Framework.Interfaces
9{
10 public abstract class RemoteGridBase : IGridServer
11 {
12 public abstract Dictionary<uint, AgentCircuitData> agentcircuits
13 {
14 get;
15 set;
16 }
17
18 public abstract UUIDBlock RequestUUIDBlock();
19 public abstract NeighbourInfo[] RequestNeighbours();
20 public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
21 public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
22 public abstract string GetName();
23 public abstract bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port);
24 public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
25 public abstract IList RequestMapBlocks(int minX, int minY, int maxX, int maxY);
26 public abstract void Close();
27 public abstract Hashtable GridData {
28 get;
29 set;
30 }
31
32 public abstract ArrayList neighbours {
33 get;
34 set;
35 }
36 }
37}
diff --git a/Common/OpenSim.Framework/LoginService.cs b/Common/OpenSim.Framework/LoginService.cs
deleted file mode 100644
index a4f3cc8..0000000
--- a/Common/OpenSim.Framework/LoginService.cs
+++ /dev/null
@@ -1,42 +0,0 @@
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*/
28
29using System;
30using System.Collections;
31using System.Collections.Generic;
32using System.Text;
33using Nwc.XmlRpc;
34using libsecondlife;
35
36namespace OpenSim.Framework.Grid
37{
38 public abstract class LoginService
39 {
40
41 }
42} \ No newline at end of file
diff --git a/Common/OpenSim.Framework/OpenSim.Framework.csproj b/Common/OpenSim.Framework/OpenSim.Framework.csproj
deleted file mode 100644
index 4cedbd9..0000000
--- a/Common/OpenSim.Framework/OpenSim.Framework.csproj
+++ /dev/null
@@ -1,200 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{8ACA2445-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Framework</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.Framework</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="Db4objects.Db4o.dll" >
62 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="libsecondlife.dll" >
66 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System" >
70 <HintPath>System.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="System.Xml" >
74 <HintPath>System.Xml.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 </ItemGroup>
78 <ItemGroup>
79 <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj">
80 <Name>XMLRPC</Name>
81 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
82 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
83 <Private>False</Private>
84 </ProjectReference>
85 </ItemGroup>
86 <ItemGroup>
87 <Compile Include="AgentInventory.cs">
88 <SubType>Code</SubType>
89 </Compile>
90 <Compile Include="BlockingQueue.cs">
91 <SubType>Code</SubType>
92 </Compile>
93 <Compile Include="HeightMapGenHills.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 <Compile Include="LoginService.cs">
97 <SubType>Code</SubType>
98 </Compile>
99 <Compile Include="Remoting.cs">
100 <SubType>Code</SubType>
101 </Compile>
102 <Compile Include="SimProfile.cs">
103 <SubType>Code</SubType>
104 </Compile>
105 <Compile Include="SimProfileBase.cs">
106 <SubType>Code</SubType>
107 </Compile>
108 <Compile Include="UserProfile.cs">
109 <SubType>Code</SubType>
110 </Compile>
111 <Compile Include="UserProfileManager.cs">
112 <SubType>Code</SubType>
113 </Compile>
114 <Compile Include="UserProfileManagerBase.cs">
115 <SubType>Code</SubType>
116 </Compile>
117 <Compile Include="Util.cs">
118 <SubType>Code</SubType>
119 </Compile>
120 <Compile Include="Interfaces\IAssetServer.cs">
121 <SubType>Code</SubType>
122 </Compile>
123 <Compile Include="Interfaces\IClientAPI.cs">
124 <SubType>Code</SubType>
125 </Compile>
126 <Compile Include="Interfaces\IConfig.cs">
127 <SubType>Code</SubType>
128 </Compile>
129 <Compile Include="Interfaces\IGenericConfig.cs">
130 <SubType>Code</SubType>
131 </Compile>
132 <Compile Include="Interfaces\IGridConfig.cs">
133 <SubType>Code</SubType>
134 </Compile>
135 <Compile Include="Interfaces\IGridServer.cs">
136 <SubType>Code</SubType>
137 </Compile>
138 <Compile Include="Interfaces\ILocalStorage.cs">
139 <SubType>Code</SubType>
140 </Compile>
141 <Compile Include="Interfaces\IScriptAPI.cs">
142 <SubType>Code</SubType>
143 </Compile>
144 <Compile Include="Interfaces\IScriptEngine.cs">
145 <SubType>Code</SubType>
146 </Compile>
147 <Compile Include="Interfaces\IUserConfig.cs">
148 <SubType>Code</SubType>
149 </Compile>
150 <Compile Include="Interfaces\IUserServer.cs">
151 <SubType>Code</SubType>
152 </Compile>
153 <Compile Include="Interfaces\LocalGridBase.cs">
154 <SubType>Code</SubType>
155 </Compile>
156 <Compile Include="Interfaces\RemoteGridBase.cs">
157 <SubType>Code</SubType>
158 </Compile>
159 <Compile Include="Properties\AssemblyInfo.cs">
160 <SubType>Code</SubType>
161 </Compile>
162 <Compile Include="Types\AgentCircuitData.cs">
163 <SubType>Code</SubType>
164 </Compile>
165 <Compile Include="Types\AssetBase.cs">
166 <SubType>Code</SubType>
167 </Compile>
168 <Compile Include="Types\AssetLandmark.cs">
169 <SubType>Code</SubType>
170 </Compile>
171 <Compile Include="Types\AssetStorage.cs">
172 <SubType>Code</SubType>
173 </Compile>
174 <Compile Include="Types\EstateSettings.cs">
175 <SubType>Code</SubType>
176 </Compile>
177 <Compile Include="Types\Login.cs">
178 <SubType>Code</SubType>
179 </Compile>
180 <Compile Include="Types\NeighbourInfo.cs">
181 <SubType>Code</SubType>
182 </Compile>
183 <Compile Include="Types\OSVector3.cs">
184 <SubType>Code</SubType>
185 </Compile>
186 <Compile Include="Types\ParcelData.cs">
187 <SubType>Code</SubType>
188 </Compile>
189 <Compile Include="Types\PrimData.cs">
190 <SubType>Code</SubType>
191 </Compile>
192 </ItemGroup>
193 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
194 <PropertyGroup>
195 <PreBuildEvent>
196 </PreBuildEvent>
197 <PostBuildEvent>
198 </PostBuildEvent>
199 </PropertyGroup>
200</Project>
diff --git a/Common/OpenSim.Framework/OpenSim.Framework.dll.build b/Common/OpenSim.Framework/OpenSim.Framework.dll.build
deleted file mode 100644
index 4d95c7d..0000000
--- a/Common/OpenSim.Framework/OpenSim.Framework.dll.build
+++ /dev/null
@@ -1,77 +0,0 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Framework" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Framework" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AgentInventory.cs" />
15 <include name="BlockingQueue.cs" />
16 <include name="HeightMapGenHills.cs" />
17 <include name="LoginService.cs" />
18 <include name="Remoting.cs" />
19 <include name="SimProfile.cs" />
20 <include name="SimProfileBase.cs" />
21 <include name="UserProfile.cs" />
22 <include name="UserProfileManager.cs" />
23 <include name="UserProfileManagerBase.cs" />
24 <include name="Util.cs" />
25 <include name="Interfaces/IAssetServer.cs" />
26 <include name="Interfaces/IClientAPI.cs" />
27 <include name="Interfaces/IConfig.cs" />
28 <include name="Interfaces/IGenericConfig.cs" />
29 <include name="Interfaces/IGridConfig.cs" />
30 <include name="Interfaces/IGridServer.cs" />
31 <include name="Interfaces/ILocalStorage.cs" />
32 <include name="Interfaces/IScriptAPI.cs" />
33 <include name="Interfaces/IScriptEngine.cs" />
34 <include name="Interfaces/IUserConfig.cs" />
35 <include name="Interfaces/IUserServer.cs" />
36 <include name="Interfaces/LocalGridBase.cs" />
37 <include name="Interfaces/RemoteGridBase.cs" />
38 <include name="Properties/AssemblyInfo.cs" />
39 <include name="Types/AgentCircuitData.cs" />
40 <include name="Types/AssetBase.cs" />
41 <include name="Types/AssetLandmark.cs" />
42 <include name="Types/AssetStorage.cs" />
43 <include name="Types/EstateSettings.cs" />
44 <include name="Types/Login.cs" />
45 <include name="Types/NeighbourInfo.cs" />
46 <include name="Types/OSVector3.cs" />
47 <include name="Types/ParcelData.cs" />
48 <include name="Types/PrimData.cs" />
49 </sources>
50 <references basedir="${project::get-base-directory()}">
51 <lib>
52 <include name="${project::get-base-directory()}" />
53 <include name="${project::get-base-directory()}/${build.dir}" />
54 </lib>
55 <include name="../../bin/Db4objects.Db4o.dll" />
56 <include name="../../bin/libsecondlife.dll" />
57 <include name="System.dll" />
58 <include name="System.Xml.dll" />
59 <include name="../../bin/XMLRPC.dll" />
60 </references>
61 </csc>
62 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
63 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
64 <copy todir="${project::get-base-directory()}/../../bin/">
65 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
66 <include name="*.dll"/>
67 <include name="*.exe"/>
68 </fileset>
69 </copy>
70 </target>
71 <target name="clean">
72 <delete dir="${bin.dir}" failonerror="false" />
73 <delete dir="${obj.dir}" failonerror="false" />
74 </target>
75 <target name="doc" description="Creates documentation.">
76 </target>
77</project>
diff --git a/Common/OpenSim.Framework/Properties/AssemblyInfo.cs b/Common/OpenSim.Framework/Properties/AssemblyInfo.cs
deleted file mode 100644
index 86f5cdb..0000000
--- a/Common/OpenSim.Framework/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.FrameWork")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OpenSim.FrameWork")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("a08e20c7-f191-4137-b1f0-9291408fa521")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Common/OpenSim.Framework/Remoting.cs b/Common/OpenSim.Framework/Remoting.cs
deleted file mode 100644
index 660cdde..0000000
--- a/Common/OpenSim.Framework/Remoting.cs
+++ /dev/null
@@ -1,137 +0,0 @@
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*/
28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.Security.Cryptography;
33
34namespace OpenSim.Framework
35{
36 /// <summary>
37 /// NEEDS AUDIT.
38 /// </summary>
39 /// <remarks>
40 /// Suggested implementation
41 /// <para>Store two digests for each foreign host. A local copy of the local hash using the local challenge (when issued), and a local copy of the remote hash using the remote challenge.</para>
42 /// <para>When sending data to the foreign host - run 'Sign' on the data and affix the returned byte[] to the message.</para>
43 /// <para>When recieving data from the foreign host - run 'Authenticate' against the data and the attached byte[].</para>
44 /// <para>Both hosts should be performing these operations for this to be effective.</para>
45 /// </remarks>
46 class RemoteDigest
47 {
48 private byte[] currentHash;
49 private byte[] secret;
50
51 private SHA512Managed SHA512;
52
53 /// <summary>
54 /// Initialises a new RemoteDigest authentication mechanism
55 /// </summary>
56 /// <remarks>Needs an audit by a cryptographic professional - was not "roll your own"'d by choice but rather a serious lack of decent authentication mechanisms in .NET remoting</remarks>
57 /// <param name="sharedSecret">The shared secret between systems (for inter-sim, this is provided in encrypted form during connection, for grid this is input manually in setup)</param>
58 /// <param name="salt">Binary salt - some common value - to be decided what</param>
59 /// <param name="challenge">The challenge key provided by the third party</param>
60 public RemoteDigest(string sharedSecret, byte[] salt, string challenge)
61 {
62 SHA512 = new SHA512Managed();
63 Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret,salt);
64 secret = RFC2898.GetBytes(512);
65 ASCIIEncoding ASCII = new ASCIIEncoding();
66
67 currentHash = SHA512.ComputeHash(AppendArrays(secret, ASCII.GetBytes(challenge)));
68 }
69
70 /// <summary>
71 /// Authenticates a piece of incoming data against the local digest. Upon successful authentication, digest string is incremented.
72 /// </summary>
73 /// <param name="data">The incoming data</param>
74 /// <param name="digest">The remote digest</param>
75 /// <returns></returns>
76 public bool Authenticate(byte[] data, byte[] digest)
77 {
78 byte[] newHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
79 if (digest == newHash)
80 {
81 currentHash = newHash;
82 return true;
83 }
84 else
85 {
86 throw new Exception("Hash comparison failed. Key resync required.");
87 }
88 }
89
90 /// <summary>
91 /// Signs a new bit of data with the current hash. Returns a byte array which should be affixed to the message.
92 /// Signing a piece of data will automatically increment the hash - if you sign data and do not send it, the
93 /// hashes will get out of sync and throw an exception when validation is attempted.
94 /// </summary>
95 /// <param name="data">The outgoing data</param>
96 /// <returns>The local digest</returns>
97 public byte[] Sign(byte[] data)
98 {
99 currentHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
100 return currentHash;
101 }
102
103 /// <summary>
104 /// Generates a new challenge string to be issued to a foreign host. Challenges are 1024-bit (effective strength of less than 512-bits) messages generated using the Crytographic Random Number Generator.
105 /// </summary>
106 /// <returns>A 128-character hexadecimal string containing the challenge.</returns>
107 public static string GenerateChallenge()
108 {
109 RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider();
110 byte[] bytes = new byte[64];
111 RNG.GetBytes(bytes);
112
113 StringBuilder sb = new StringBuilder(bytes.Length * 2);
114 foreach (byte b in bytes)
115 {
116 sb.AppendFormat("{0:x2}", b);
117 }
118 return sb.ToString();
119 }
120
121 /// <summary>
122 /// Helper function, merges two byte arrays
123 /// </summary>
124 /// <remarks>Sourced from MSDN Forum</remarks>
125 /// <param name="a">A</param>
126 /// <param name="b">B</param>
127 /// <returns>C</returns>
128 private byte[] AppendArrays(byte[] a, byte[] b)
129 {
130 byte[] c = new byte[a.Length + b.Length];
131 Buffer.BlockCopy(a, 0, c, 0, a.Length);
132 Buffer.BlockCopy(b, 0, c, a.Length, b.Length);
133 return c;
134 }
135
136 }
137}
diff --git a/Common/OpenSim.Framework/SimProfile.cs b/Common/OpenSim.Framework/SimProfile.cs
deleted file mode 100644
index 0d79ee9..0000000
--- a/Common/OpenSim.Framework/SimProfile.cs
+++ /dev/null
@@ -1,110 +0,0 @@
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.Collections;
31using System.Xml;
32using System.Text;
33using libsecondlife;
34using Nwc.XmlRpc;
35
36namespace OpenSim.Framework.Sims
37{
38 public class SimProfile : SimProfileBase
39 {
40 public SimProfile LoadFromGrid(ulong region_handle, string GridURL, string SendKey, string RecvKey)
41 {
42 try
43 {
44 Hashtable GridReqParams = new Hashtable();
45 GridReqParams["region_handle"] = region_handle.ToString();
46 GridReqParams["authkey"] = SendKey;
47 ArrayList SendParams = new ArrayList();
48 SendParams.Add(GridReqParams);
49 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
50
51 XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);
52
53 Hashtable RespData = (Hashtable)GridResp.Value;
54 this.UUID = new LLUUID((string)RespData["UUID"]);
55 this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256));
56 this.regionname = (string)RespData["regionname"];
57 this.sim_ip = (string)RespData["sim_ip"];
58 this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
59 this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/";
60 this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]);
61 this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]);
62 this.sendkey = SendKey;
63 this.recvkey = RecvKey;
64 }
65 catch (Exception e)
66 {
67 Console.WriteLine(e.ToString());
68 }
69 return this;
70 }
71
72 public SimProfile LoadFromGrid(LLUUID UUID, string GridURL, string SendKey, string RecvKey)
73 {
74 try
75 {
76 Hashtable GridReqParams = new Hashtable();
77 GridReqParams["UUID"] = UUID.ToString();
78 GridReqParams["authkey"] = SendKey;
79 ArrayList SendParams = new ArrayList();
80 SendParams.Add(GridReqParams);
81 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
82
83 XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);
84
85 Hashtable RespData = (Hashtable)GridResp.Value;
86 this.UUID = new LLUUID((string)RespData["UUID"]);
87 this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256));
88 this.regionname = (string)RespData["regionname"];
89 this.sim_ip = (string)RespData["sim_ip"];
90 this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
91 this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/";
92 this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]);
93 this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]);
94 this.sendkey = SendKey;
95 this.recvkey = RecvKey;
96 }
97 catch (Exception e)
98 {
99 Console.WriteLine(e.ToString());
100 }
101 return this;
102 }
103
104
105 public SimProfile()
106 {
107 }
108 }
109
110}
diff --git a/Common/OpenSim.Framework/SimProfileBase.cs b/Common/OpenSim.Framework/SimProfileBase.cs
deleted file mode 100644
index bab18be..0000000
--- a/Common/OpenSim.Framework/SimProfileBase.cs
+++ /dev/null
@@ -1,54 +0,0 @@
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 libsecondlife;
32
33namespace OpenSim.Framework.Sims
34{
35 [System.Obsolete("Depreciated, use SimProfileData instead")]
36 public class SimProfileBase
37 {
38 public LLUUID UUID;
39 public ulong regionhandle;
40 public string regionname;
41 public string sim_ip;
42 public uint sim_port;
43 public string caps_url;
44 public uint RegionLocX;
45 public uint RegionLocY;
46 public string sendkey;
47 public string recvkey;
48 public bool online;
49
50 public SimProfileBase()
51 {
52 }
53 }
54}
diff --git a/Common/OpenSim.Framework/Types/AgentCircuitData.cs b/Common/OpenSim.Framework/Types/AgentCircuitData.cs
deleted file mode 100644
index de79ce2..0000000
--- a/Common/OpenSim.Framework/Types/AgentCircuitData.cs
+++ /dev/null
@@ -1,50 +0,0 @@
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*/
28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife;
33
34namespace OpenSim.Framework.Types
35{
36 public class AgentCircuitData
37 {
38 public AgentCircuitData() { }
39 public LLUUID AgentID;
40 public LLUUID SessionID;
41 public LLUUID SecureSessionID;
42 public LLVector3 startpos;
43 public string firstname;
44 public string lastname;
45 public uint circuitcode;
46 public bool child;
47 public LLUUID InventoryFolder;
48 public LLUUID BaseFolder;
49 }
50}
diff --git a/Common/OpenSim.Framework/Types/AssetBase.cs b/Common/OpenSim.Framework/Types/AssetBase.cs
deleted file mode 100644
index 86586a6..0000000
--- a/Common/OpenSim.Framework/Types/AssetBase.cs
+++ /dev/null
@@ -1,49 +0,0 @@
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 libsecondlife;
32
33namespace OpenSim.Framework.Types
34{
35 public class AssetBase
36 {
37 public byte[] Data;
38 public LLUUID FullID;
39 public sbyte Type;
40 public sbyte InvType;
41 public string Name;
42 public string Description;
43
44 public AssetBase()
45 {
46
47 }
48 }
49}
diff --git a/Common/OpenSim.Framework/Types/AssetLandmark.cs b/Common/OpenSim.Framework/Types/AssetLandmark.cs
deleted file mode 100644
index 8a10b70..0000000
--- a/Common/OpenSim.Framework/Types/AssetLandmark.cs
+++ /dev/null
@@ -1,61 +0,0 @@
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 libsecondlife;
32
33namespace OpenSim.Framework.Types
34{
35 public class AssetLandmark : AssetBase
36 {
37 public int Version;
38 public LLVector3 Position;
39 public LLUUID RegionID;
40
41 public AssetLandmark(AssetBase a)
42 {
43 this.Data = a.Data;
44 this.FullID = a.FullID;
45 this.Type = a.Type;
46 this.InvType = a.InvType;
47 this.Name = a.Name;
48 this.Description = a.Description;
49 InternData();
50 }
51
52 private void InternData()
53 {
54 string temp = System.Text.Encoding.UTF8.GetString(Data).Trim();
55 string[] parts = temp.Split('\n');
56 int.TryParse(parts[0].Substring(17, 1), out Version);
57 LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID);
58 LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position);
59 }
60 }
61}
diff --git a/Common/OpenSim.Framework/Types/AssetStorage.cs b/Common/OpenSim.Framework/Types/AssetStorage.cs
deleted file mode 100644
index 8cac23a..0000000
--- a/Common/OpenSim.Framework/Types/AssetStorage.cs
+++ /dev/null
@@ -1,50 +0,0 @@
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 libsecondlife;
32
33namespace OpenSim.Framework.Types
34{
35 public class AssetStorage
36 {
37
38 public AssetStorage() {
39 }
40
41 public AssetStorage(LLUUID assetUUID) {
42 UUID=assetUUID;
43 }
44
45 public byte[] Data;
46 public sbyte Type;
47 public string Name;
48 public LLUUID UUID;
49 }
50}
diff --git a/Common/OpenSim.Framework/Types/EstateSettings.cs b/Common/OpenSim.Framework/Types/EstateSettings.cs
deleted file mode 100644
index baa3eef..0000000
--- a/Common/OpenSim.Framework/Types/EstateSettings.cs
+++ /dev/null
@@ -1,96 +0,0 @@
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*/
28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33using libsecondlife;
34
35namespace OpenSim.Framework.Types
36{
37 public class EstateSettings
38 {
39 //Settings to this island
40 public float billableFactor = (float)0.0;
41 public uint estateID = 0;
42 public uint parentEstateID = 0;
43
44 public byte maxAgents = 40;
45 public float objectBonusFactor = (float)1.0;
46
47 public int redirectGridX = 0; //??
48 public int redirectGridY = 0; //??
49 public libsecondlife.Simulator.RegionFlags regionFlags = libsecondlife.Simulator.RegionFlags.None; //Booleam values of various region settings
50 public libsecondlife.Simulator.SimAccess simAccess = libsecondlife.Simulator.SimAccess.Mature; //Is sim PG, Mature, etc? Mature by default.
51 public float sunHour = 0;
52
53 public float terrainRaiseLimit = 0;
54 public float terrainLowerLimit = 0;
55
56 public bool useFixedSun = false;
57 public int pricePerMeter = 1;
58
59 public ushort regionWaterHeight = 20;
60 public bool regionAllowTerraform = true;
61
62 // Region Information
63 // Low resolution 'base' textures. No longer used.
64 public LLUUID terrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); // Default
65 public LLUUID terrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); // Default
66 public LLUUID terrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); // Default
67 public LLUUID terrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); // Default
68
69 // Higher resolution terrain textures
70 public LLUUID terrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000");
71 public LLUUID terrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000");
72 public LLUUID terrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000");
73 public LLUUID terrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000");
74
75 // First quad - each point is bilinearly interpolated at each meter of terrain
76 public float terrainStartHeight0 = 10.0f;
77 public float terrainStartHeight1 = 10.0f;
78 public float terrainStartHeight2 = 10.0f;
79 public float terrainStartHeight3 = 10.0f;
80
81 // Second quad - also bilinearly interpolated.
82 // Terrain texturing is done that:
83 // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y]
84 public float terrainHeightRange0 = 60.0f; //00
85 public float terrainHeightRange1 = 60.0f; //01
86 public float terrainHeightRange2 = 60.0f; //10
87 public float terrainHeightRange3 = 60.0f; //11
88
89 // Terrain Default (Must be in F32 Format!)
90 public string terrainFile = "default.r32";
91 public double terrainMultiplier = 60.0;
92 public float waterHeight = (float)20.0;
93
94
95 }
96}
diff --git a/Common/OpenSim.Framework/Types/Login.cs b/Common/OpenSim.Framework/Types/Login.cs
deleted file mode 100644
index 2737cbb..0000000
--- a/Common/OpenSim.Framework/Types/Login.cs
+++ /dev/null
@@ -1,52 +0,0 @@
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*/
28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife;
33
34namespace OpenSim.Framework.Types
35{
36 public class Login
37 {
38 public string First = "Test";
39 public string Last = "User";
40 public LLUUID Agent;
41 public LLUUID Session;
42 public LLUUID SecureSession = LLUUID.Zero;
43 public LLUUID InventoryFolder;
44 public LLUUID BaseFolder;
45 public uint CircuitCode;
46
47 public Login()
48 {
49
50 }
51 }
52}
diff --git a/Common/OpenSim.Framework/Types/NeighbourInfo.cs b/Common/OpenSim.Framework/Types/NeighbourInfo.cs
deleted file mode 100644
index e3e9dbb..0000000
--- a/Common/OpenSim.Framework/Types/NeighbourInfo.cs
+++ /dev/null
@@ -1,47 +0,0 @@
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*/
28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Framework.Types
34{
35 public class NeighbourInfo
36 {
37 public NeighbourInfo()
38 {
39 }
40
41 public ulong regionhandle;
42 public uint RegionLocX;
43 public uint RegionLocY;
44 public string sim_ip;
45 public uint sim_port;
46 }
47}
diff --git a/Common/OpenSim.Framework/Types/OSVector3.cs b/Common/OpenSim.Framework/Types/OSVector3.cs
deleted file mode 100644
index 7e3a849..0000000
--- a/Common/OpenSim.Framework/Types/OSVector3.cs
+++ /dev/null
@@ -1,46 +0,0 @@
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*/
28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Framework.Types
34{
35 public class OSVector3
36 {
37 public float X;
38 public float Y;
39 public float Z;
40
41 public OSVector3()
42 {
43
44 }
45 }
46}
diff --git a/Common/OpenSim.Framework/Types/ParcelData.cs b/Common/OpenSim.Framework/Types/ParcelData.cs
deleted file mode 100644
index 40f128a..0000000
--- a/Common/OpenSim.Framework/Types/ParcelData.cs
+++ /dev/null
@@ -1,115 +0,0 @@
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 libsecondlife;
32
33namespace OpenSim.Framework.Types
34{
35
36 public class ParcelData
37 {
38 public byte[] parcelBitmapByteArray = new byte[512];
39 public string parcelName = "";
40 public string parcelDesc = "";
41 public LLUUID ownerID = new LLUUID();
42 public bool isGroupOwned = false;
43 public LLVector3 AABBMin = new LLVector3();
44 public LLVector3 AABBMax = new LLVector3();
45 public int area = 0;
46 public uint auctionID = 0; //Unemplemented. If set to 0, not being auctioned
47 public LLUUID authBuyerID = new LLUUID(); //Unemplemented. Authorized Buyer's UUID
48 public libsecondlife.Parcel.ParcelCategory category = new libsecondlife.Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category
49 public int claimDate = 0; //Unemplemented
50 public int claimPrice = 0; //Unemplemented
51 public LLUUID groupID = new LLUUID(); //Unemplemented
52 public int groupPrims = 0; //Unemplemented
53 public int salePrice = 0; //Unemeplemented. Parcels price.
54 public libsecondlife.Parcel.ParcelStatus parcelStatus = libsecondlife.Parcel.ParcelStatus.None;
55 public libsecondlife.Parcel.ParcelFlags parcelFlags = libsecondlife.Parcel.ParcelFlags.None;
56 public byte landingType = 0;
57 public byte mediaAutoScale = 0;
58 public LLUUID mediaID = LLUUID.Zero;
59 public int localID = 0;
60 public LLUUID globalID = new LLUUID();
61
62 public string mediaURL = "";
63 public string musicURL = "";
64 public float passHours = 0;
65 public int passPrice = 0;
66 public LLUUID snapshotID = LLUUID.Zero;
67 public LLVector3 userLocation = new LLVector3();
68 public LLVector3 userLookAt = new LLVector3();
69
70 public ParcelData()
71 {
72 globalID = LLUUID.Random();
73 }
74
75 public ParcelData Copy()
76 {
77 ParcelData parcelData = new ParcelData();
78
79 parcelData.AABBMax = this.AABBMax;
80 parcelData.AABBMin = this.AABBMin;
81 parcelData.area = this.area;
82 parcelData.auctionID = this.auctionID;
83 parcelData.authBuyerID = this.authBuyerID;
84 parcelData.category = this.category;
85 parcelData.claimDate = this.claimDate;
86 parcelData.claimPrice = this.claimPrice;
87 parcelData.globalID = this.globalID;
88 parcelData.groupID = this.groupID;
89 parcelData.groupPrims = this.groupPrims;
90 parcelData.isGroupOwned = this.isGroupOwned;
91 parcelData.localID = this.localID;
92 parcelData.landingType = this.landingType;
93 parcelData.mediaAutoScale = this.mediaAutoScale;
94 parcelData.mediaID = this.mediaID;
95 parcelData.mediaURL = this.mediaURL;
96 parcelData.musicURL = this.musicURL;
97 parcelData.ownerID = this.ownerID;
98 parcelData.parcelBitmapByteArray = (byte[])this.parcelBitmapByteArray.Clone();
99 parcelData.parcelDesc = this.parcelDesc;
100 parcelData.parcelFlags = this.parcelFlags;
101 parcelData.parcelName = this.parcelName;
102 parcelData.parcelStatus = this.parcelStatus;
103 parcelData.passHours = this.passHours;
104 parcelData.passPrice = this.passPrice;
105 parcelData.salePrice = this.salePrice;
106 parcelData.snapshotID = this.snapshotID;
107 parcelData.userLocation = this.userLocation;
108 parcelData.userLookAt = this.userLookAt;
109
110 return parcelData;
111
112 }
113 }
114
115}
diff --git a/Common/OpenSim.Framework/Types/PrimData.cs b/Common/OpenSim.Framework/Types/PrimData.cs
deleted file mode 100644
index a63be76..0000000
--- a/Common/OpenSim.Framework/Types/PrimData.cs
+++ /dev/null
@@ -1,201 +0,0 @@
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*/
28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife;
33
34namespace OpenSim.Framework.Types
35{
36 public class PrimData
37 {
38 private const uint FULL_MASK_PERMISSIONS = 2147483647;
39
40 public LLUUID OwnerID;
41 public byte PCode;
42 public ushort PathBegin;
43 public ushort PathEnd;
44 public byte PathScaleX;
45 public byte PathScaleY;
46 public byte PathShearX;
47 public byte PathShearY;
48 public sbyte PathSkew;
49 public ushort ProfileBegin;
50 public ushort ProfileEnd;
51 public LLVector3 Scale;
52 public byte PathCurve;
53 public byte ProfileCurve;
54 public uint ParentID = 0;
55 public ushort ProfileHollow;
56 public sbyte PathRadiusOffset;
57 public byte PathRevolutions;
58 public sbyte PathTaperX;
59 public sbyte PathTaperY;
60 public sbyte PathTwist;
61 public sbyte PathTwistBegin;
62 public byte[] Texture;
63
64
65 public Int32 CreationDate;
66 public uint OwnerMask = FULL_MASK_PERMISSIONS;
67 public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
68 public uint GroupMask = FULL_MASK_PERMISSIONS;
69 public uint EveryoneMask = FULL_MASK_PERMISSIONS;
70 public uint BaseMask = FULL_MASK_PERMISSIONS;
71
72 //following only used during prim storage
73 public LLVector3 Position;
74 public LLQuaternion Rotation = new LLQuaternion(0,1,0,0);
75 public uint LocalID;
76 public LLUUID FullID;
77
78 public PrimData()
79 {
80
81 }
82
83 public PrimData(byte[] data)
84 {
85 int i =0;
86
87 this.OwnerID = new LLUUID(data, i); i += 16;
88 this.PCode = data[i++];
89 this.PathBegin = (ushort)(data[i++] + (data[i++] << 8));
90 this.PathEnd = (ushort)(data[i++] + (data[i++] << 8));
91 this.PathScaleX = data[i++];
92 this.PathScaleY = data[i++];
93 this.PathShearX = data[i++];
94 this.PathShearY = data[i++];
95 this.PathSkew = (sbyte)data[i++];
96 this.ProfileBegin = (ushort)(data[i++] + (data[i++] << 8));
97 this.ProfileEnd = (ushort)(data[i++] + (data[i++] << 8));
98 this.Scale = new LLVector3(data, i); i += 12;
99 this.PathCurve = data[i++];
100 this.ProfileCurve = data[i++];
101 this.ParentID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
102 this.ProfileHollow = (ushort)(data[i++] + (data[i++] << 8));
103 this.PathRadiusOffset = (sbyte)data[i++];
104 this.PathRevolutions = data[i++];
105 this.PathTaperX = (sbyte)data[i++];
106 this.PathTaperY =(sbyte) data[i++];
107 this.PathTwist = (sbyte) data[i++];
108 this.PathTwistBegin = (sbyte) data[i++];
109 ushort length = (ushort)(data[i++] + (data[i++] << 8));
110 this.Texture = new byte[length];
111 Array.Copy(data, i, Texture, 0, length); i += length;
112 this.CreationDate = (Int32)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
113 this.OwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
114 this.NextOwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
115 this.GroupMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
116 this.EveryoneMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
117 this.BaseMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
118 this.Position = new LLVector3(data, i); i += 12;
119 this.Rotation = new LLQuaternion(data,i, true); i += 12;
120 this.LocalID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
121 this.FullID = new LLUUID(data, i); i += 16;
122
123 }
124
125 public byte[] ToBytes()
126 {
127 int i = 0;
128 byte[] bytes = new byte[126 + Texture.Length];
129 Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
130 bytes[i++] = this.PCode;
131 bytes[i++] = (byte)(this.PathBegin % 256);
132 bytes[i++] = (byte)((this.PathBegin >> 8) % 256);
133 bytes[i++] = (byte)(this.PathEnd % 256);
134 bytes[i++] = (byte)((this.PathEnd >> 8) % 256);
135 bytes[i++] = this.PathScaleX;
136 bytes[i++] = this.PathScaleY;
137 bytes[i++] = this.PathShearX;
138 bytes[i++] = this.PathShearY;
139 bytes[i++] = (byte)this.PathSkew;
140 bytes[i++] = (byte)(this.ProfileBegin % 256);
141 bytes[i++] = (byte)((this.ProfileBegin >> 8) % 256);
142 bytes[i++] = (byte)(this.ProfileEnd % 256);
143 bytes[i++] = (byte)((this.ProfileEnd >> 8) % 256);
144 Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
145 bytes[i++] = this.PathCurve;
146 bytes[i++] = this.ProfileCurve;
147 bytes[i++] = (byte)(ParentID % 256);
148 bytes[i++] = (byte)((ParentID >> 8) % 256);
149 bytes[i++] = (byte)((ParentID >> 16) % 256);
150 bytes[i++] = (byte)((ParentID >> 24) % 256);
151 bytes[i++] = (byte)(this.ProfileHollow %256);
152 bytes[i++] = (byte)((this.ProfileHollow >> 8)% 256);
153 bytes[i++] = ((byte)this.PathRadiusOffset);
154 bytes[i++] = this.PathRevolutions;
155 bytes[i++] = ((byte) this.PathTaperX);
156 bytes[i++] = ((byte) this.PathTaperY);
157 bytes[i++] = ((byte) this.PathTwist);
158 bytes[i++] = ((byte) this.PathTwistBegin);
159 bytes[i++] = (byte)(Texture.Length % 256);
160 bytes[i++] = (byte)((Texture.Length >> 8) % 256);
161 Array.Copy(Texture, 0, bytes, i, Texture.Length); i += Texture.Length;
162 bytes[i++] = (byte)(this.CreationDate % 256);
163 bytes[i++] = (byte)((this.CreationDate >> 8) % 256);
164 bytes[i++] = (byte)((this.CreationDate >> 16) % 256);
165 bytes[i++] = (byte)((this.CreationDate >> 24) % 256);
166 bytes[i++] = (byte)(this.OwnerMask % 256);
167 bytes[i++] = (byte)((this.OwnerMask >> 8) % 256);
168 bytes[i++] = (byte)((this.OwnerMask >> 16) % 256);
169 bytes[i++] = (byte)((this.OwnerMask >> 24) % 256);
170 bytes[i++] = (byte)(this.NextOwnerMask % 256);
171 bytes[i++] = (byte)((this.NextOwnerMask >> 8) % 256);
172 bytes[i++] = (byte)((this.NextOwnerMask >> 16) % 256);
173 bytes[i++] = (byte)((this.NextOwnerMask >> 24) % 256);
174 bytes[i++] = (byte)(this.GroupMask % 256);
175 bytes[i++] = (byte)((this.GroupMask >> 8) % 256);
176 bytes[i++] = (byte)((this.GroupMask >> 16) % 256);
177 bytes[i++] = (byte)((this.GroupMask >> 24) % 256);
178 bytes[i++] = (byte)(this.EveryoneMask % 256);
179 bytes[i++] = (byte)((this.EveryoneMask >> 8) % 256);
180 bytes[i++] = (byte)((this.EveryoneMask >> 16) % 256);
181 bytes[i++] = (byte)((this.EveryoneMask >> 24) % 256);
182 bytes[i++] = (byte)(this.BaseMask % 256);
183 bytes[i++] = (byte)((this.BaseMask >> 8) % 256);
184 bytes[i++] = (byte)((this.BaseMask >> 16) % 256);
185 bytes[i++] = (byte)((this.BaseMask >> 24) % 256);
186 Array.Copy(this.Position.GetBytes(), 0, bytes, i, 12); i += 12;
187 if (this.Rotation == new LLQuaternion(0,0,0,0))
188 {
189 this.Rotation = new LLQuaternion(0, 1, 0, 0);
190 }
191 Array.Copy(this.Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
192 bytes[i++] = (byte)(this.LocalID % 256);
193 bytes[i++] = (byte)((this.LocalID >> 8) % 256);
194 bytes[i++] = (byte)((this.LocalID >> 16) % 256);
195 bytes[i++] = (byte)((this.LocalID >> 24) % 256);
196 Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16;
197
198 return bytes;
199 }
200 }
201}
diff --git a/Common/OpenSim.Framework/UserProfile.cs b/Common/OpenSim.Framework/UserProfile.cs
deleted file mode 100644
index 04ff20b..0000000
--- a/Common/OpenSim.Framework/UserProfile.cs
+++ /dev/null
@@ -1,89 +0,0 @@
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 libsecondlife;
32using OpenSim.Framework.Inventory;
33using System.Security.Cryptography;
34
35namespace OpenSim.Framework.User
36{
37 public class UserProfile
38 {
39
40 public string firstname;
41 public string lastname;
42 public ulong homeregionhandle;
43 public LLVector3 homepos;
44 public LLVector3 homelookat;
45
46 public bool IsGridGod = false;
47 public bool IsLocal = true; // will be used in future for visitors from foreign grids
48 public string AssetURL;
49 public string MD5passwd;
50
51 public LLUUID CurrentSessionID;
52 public LLUUID CurrentSecureSessionID;
53 public LLUUID UUID;
54 public Dictionary<LLUUID, uint> Circuits = new Dictionary<LLUUID, uint>(); // tracks circuit codes
55
56 public AgentInventory Inventory;
57
58 public UserProfile()
59 {
60 Circuits = new Dictionary<LLUUID, uint>();
61 Inventory = new AgentInventory();
62 homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256));
63 homepos = new LLVector3();
64 homelookat = new LLVector3();
65 }
66
67 public void InitSessionData()
68 {
69 RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
70
71 byte[] randDataS = new byte[16];
72 byte[] randDataSS = new byte[16];
73
74 rand.GetBytes(randDataS);
75 rand.GetBytes(randDataSS);
76
77 CurrentSecureSessionID = new LLUUID(randDataSS,0);
78 CurrentSessionID = new LLUUID(randDataS,0);
79
80 }
81
82 public void AddSimCircuit(uint circuitCode, LLUUID regionUUID)
83 {
84 if (this.Circuits.ContainsKey(regionUUID) == false)
85 this.Circuits.Add(regionUUID, circuitCode);
86 }
87
88 }
89}
diff --git a/Common/OpenSim.Framework/UserProfileManager.cs b/Common/OpenSim.Framework/UserProfileManager.cs
deleted file mode 100644
index a4dac05..0000000
--- a/Common/OpenSim.Framework/UserProfileManager.cs
+++ /dev/null
@@ -1,299 +0,0 @@
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.Collections;
31using System.Text;
32using System.Text.RegularExpressions;
33using System.Xml;
34using libsecondlife;
35using Nwc.XmlRpc;
36using OpenSim.Framework.Sims;
37using OpenSim.Framework.Inventory;
38using OpenSim.Framework.Utilities;
39
40namespace OpenSim.Framework.User
41{
42 public class UserProfileManager : UserProfileManagerBase
43 {
44 public string GridURL;
45 public string GridSendKey;
46 public string GridRecvKey;
47 public string DefaultStartupMsg;
48
49 public UserProfileManager()
50 {
51
52 }
53
54 public void SetKeys(string sendKey, string recvKey, string url, string message)
55 {
56 GridRecvKey = recvKey;
57 GridSendKey = sendKey;
58 GridURL = url;
59 DefaultStartupMsg = message;
60 }
61
62 public virtual string ParseXMLRPC(string requestBody)
63 {
64
65 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
66
67 switch (request.MethodName)
68 {
69 case "login_to_simulator":
70 XmlRpcResponse response = XmlRpcLoginMethod(request);
71
72 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(response), "utf-16", "utf-8"));
73 }
74
75 return "";
76 }
77
78 public string RestDeleteUserSessionMethod( string request, string path, string param )
79 {
80 LLUUID sessionid = new LLUUID(param); // get usersessions/sessionid
81 foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys)
82 {
83 if ( UserProfiles[UUID].CurrentSessionID == sessionid)
84 {
85 UserProfiles[UUID].CurrentSessionID = null;
86 UserProfiles[UUID].CurrentSecureSessionID = null;
87 UserProfiles[UUID].Circuits.Clear();
88 }
89 }
90
91 return "OK";
92 }
93
94 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
95 {
96 XmlRpcResponse response = new XmlRpcResponse();
97 Hashtable requestData = (Hashtable)request.Params[0];
98
99 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
100 bool GoodLogin = false;
101 string firstname = "";
102 string lastname = "";
103 string passwd = "";
104
105 if (GoodXML)
106 {
107 firstname = (string)requestData["first"];
108 lastname = (string)requestData["last"];
109 passwd = (string)requestData["passwd"];
110 GoodLogin = AuthenticateUser(firstname, lastname, passwd);
111 }
112
113
114 if (!(GoodXML && GoodLogin))
115 {
116 response = CreateErrorConnectingToGridResponse();
117 }
118 else
119 {
120 UserProfile TheUser = GetProfileByName(firstname, lastname);
121 //we need to sort out how sessions are logged out , currently the sim tells the gridserver
122 //but if as this suggests the userserver handles it then please have the sim telling the userserver instead
123 //as it really makes things messy for sandbox mode
124 //if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null)))
125 // {
126 // response = CreateAlreadyLoggedInResponse();
127 // }
128 //else
129 //{
130 try
131 {
132 Hashtable responseData = new Hashtable();
133
134 LLUUID AgentID = TheUser.UUID;
135 TheUser.InitSessionData();
136
137 //for loading data from a grid server, make any changes in CustomiseResponse() (or create a sub class of this and override that method)
138 //SimProfile SimInfo = new SimProfile();
139 //SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
140
141
142 Hashtable GlobalT = new Hashtable();
143 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
144 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
145 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
146 ArrayList GlobalTextures = new ArrayList();
147 GlobalTextures.Add(GlobalT);
148
149 Hashtable LoginFlagsHash = new Hashtable();
150 LoginFlagsHash["daylight_savings"] = "N";
151 LoginFlagsHash["stipend_since_login"] = "N";
152 LoginFlagsHash["gendered"] = "Y";
153 LoginFlagsHash["ever_logged_in"] = "Y";
154 ArrayList LoginFlags = new ArrayList();
155 LoginFlags.Add(LoginFlagsHash);
156
157 Hashtable uiconfig = new Hashtable();
158 uiconfig["allow_first_life"] = "Y";
159 ArrayList ui_config = new ArrayList();
160 ui_config.Add(uiconfig);
161
162 Hashtable ClassifiedCategoriesHash = new Hashtable();
163 ClassifiedCategoriesHash["category_name"] = "bla bla";
164 ClassifiedCategoriesHash["category_id"] = (Int32)1;
165 ArrayList ClassifiedCategories = new ArrayList();
166 ClassifiedCategories.Add(ClassifiedCategoriesHash);
167
168 ArrayList AgentInventory = new ArrayList();
169 Console.WriteLine("adding inventory to response");
170 Hashtable TempHash;
171 foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values)
172 {
173 TempHash = new Hashtable();
174 Console.WriteLine("adding folder " + InvFolder.FolderName + ", ID: " + InvFolder.FolderID.ToStringHyphenated() + " with parent: " + InvFolder.ParentID.ToStringHyphenated());
175 TempHash["name"] = InvFolder.FolderName;
176 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
177 TempHash["version"] = (Int32)InvFolder.Version;
178 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
179 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
180 AgentInventory.Add(TempHash);
181 }
182
183 Hashtable InventoryRootHash = new Hashtable();
184 InventoryRootHash["folder_id"] = TheUser.Inventory.InventoryRoot.FolderID.ToStringHyphenated();
185 ArrayList InventoryRoot = new ArrayList();
186 InventoryRoot.Add(InventoryRootHash);
187
188 Hashtable InitialOutfitHash = new Hashtable();
189 InitialOutfitHash["folder_name"] = "Nightclub Female";
190 InitialOutfitHash["gender"] = "female";
191 ArrayList InitialOutfit = new ArrayList();
192 InitialOutfit.Add(InitialOutfitHash);
193
194 uint circode = (uint)(Util.RandomClass.Next());
195 //TheUser.AddSimCircuit(circode, SimInfo.UUID);
196
197 responseData["last_name"] = TheUser.lastname;
198 responseData["ui-config"] = ui_config;
199 responseData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString();
200 responseData["login-flags"] = LoginFlags;
201 responseData["global-textures"] = GlobalTextures;
202 responseData["classified_categories"] = ClassifiedCategories;
203 responseData["event_categories"] = new ArrayList();
204 responseData["inventory-skeleton"] = AgentInventory;
205 responseData["inventory-skel-lib"] = new ArrayList();
206 responseData["inventory-root"] = InventoryRoot;
207 responseData["event_notifications"] = new ArrayList();
208 responseData["gestures"] = new ArrayList();
209 responseData["inventory-lib-owner"] = new ArrayList();
210 responseData["initial-outfit"] = InitialOutfit;
211 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
212 responseData["start_location"] = "last";
213 responseData["home"] = "{'region_handle':[r" + (0 * 256).ToString() + ",r" + (0 * 256).ToString() + "], 'position':[r" + TheUser.homepos.X.ToString() + ",r" + TheUser.homepos.Y.ToString() + ",r" + TheUser.homepos.Z.ToString() + "], 'look_at':[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]}";
214 responseData["message"] = DefaultStartupMsg;
215 responseData["first_name"] = TheUser.firstname;
216 responseData["circuit_code"] = (Int32)circode;
217 responseData["sim_port"] = 0; //(Int32)SimInfo.sim_port;
218 responseData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated();
219 responseData["look_at"] = "\n[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]\n";
220 responseData["agent_id"] = AgentID.ToStringHyphenated();
221 responseData["region_y"] = (Int32)0 * 256; // (Int32)SimInfo.RegionLocY * 256;
222 responseData["region_x"] = (Int32)0 * 256; //SimInfo.RegionLocX * 256;
223 responseData["seed_capability"] = "";
224 responseData["agent_access"] = "M";
225 responseData["session_id"] = TheUser.CurrentSessionID.ToStringHyphenated();
226 responseData["login"] = "true";
227
228 this.CustomiseResponse(ref responseData, TheUser);
229 response.Value = responseData;
230 // TheUser.SendDataToSim(SimInfo);
231 return response;
232
233 }
234 catch (Exception E)
235 {
236 Console.WriteLine(E.ToString());
237 }
238 //}
239 }
240 return response;
241
242 }
243
244 private static XmlRpcResponse CreateErrorConnectingToGridResponse()
245 {
246 XmlRpcResponse response = new XmlRpcResponse();
247 Hashtable ErrorRespData = new Hashtable();
248 ErrorRespData["reason"] = "key";
249 ErrorRespData["message"] = "Error connecting to grid. Please double check your login details and check with the grid owner if you are sure these are correct";
250 ErrorRespData["login"] = "false";
251 response.Value = ErrorRespData;
252 return response;
253 }
254
255 private static XmlRpcResponse CreateAlreadyLoggedInResponse()
256 {
257 XmlRpcResponse response = new XmlRpcResponse();
258 Hashtable PresenceErrorRespData = new Hashtable();
259 PresenceErrorRespData["reason"] = "presence";
260 PresenceErrorRespData["message"] = "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner";
261 PresenceErrorRespData["login"] = "false";
262 response.Value = PresenceErrorRespData;
263 return response;
264 }
265
266 public virtual void CustomiseResponse(ref Hashtable response, UserProfile theUser)
267 {
268 //default method set up to act as ogs user server
269 SimProfile SimInfo= new SimProfile();
270 //get siminfo from grid server
271 SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
272 Int32 circode = (Int32)Convert.ToUInt32(response["circuit_code"]);
273 theUser.AddSimCircuit((uint)circode, SimInfo.UUID);
274 response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
275 response["sim_ip"] = SimInfo.sim_ip;
276 response["sim_port"] = (Int32)SimInfo.sim_port;
277 response["region_y"] = (Int32)SimInfo.RegionLocY * 256;
278 response["region_x"] = (Int32)SimInfo.RegionLocX * 256;
279
280 //default is ogs user server, so let the sim know about the user via a XmlRpcRequest
281 Console.WriteLine(SimInfo.caps_url);
282 Hashtable SimParams = new Hashtable();
283 SimParams["session_id"] = theUser.CurrentSessionID.ToString();
284 SimParams["secure_session_id"] = theUser.CurrentSecureSessionID.ToString();
285 SimParams["firstname"] = theUser.firstname;
286 SimParams["lastname"] = theUser.lastname;
287 SimParams["agent_id"] = theUser.UUID.ToString();
288 SimParams["circuit_code"] = (Int32)circode;
289 SimParams["startpos_x"] = theUser.homepos.X.ToString();
290 SimParams["startpos_y"] = theUser.homepos.Y.ToString();
291 SimParams["startpos_z"] = theUser.homepos.Z.ToString();
292 ArrayList SendParams = new ArrayList();
293 SendParams.Add(SimParams);
294
295 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
296 XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000);
297 }
298 }
299}
diff --git a/Common/OpenSim.Framework/UserProfileManagerBase.cs b/Common/OpenSim.Framework/UserProfileManagerBase.cs
deleted file mode 100644
index e0c0174..0000000
--- a/Common/OpenSim.Framework/UserProfileManagerBase.cs
+++ /dev/null
@@ -1,152 +0,0 @@
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 libsecondlife;
32using OpenSim.Framework.Utilities;
33using OpenSim.Framework.Inventory;
34using Db4objects.Db4o;
35
36namespace OpenSim.Framework.User
37{
38 public class UserProfileManagerBase
39 {
40
41 public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>();
42
43 public UserProfileManagerBase()
44 {
45 }
46
47 public virtual void InitUserProfiles()
48 {
49 IObjectContainer db;
50 db = Db4oFactory.OpenFile("userprofiles.yap");
51 IObjectSet result = db.Get(typeof(UserProfile));
52 foreach (UserProfile userprof in result)
53 {
54 UserProfiles.Add(userprof.UUID, userprof);
55 }
56 Console.WriteLine("UserProfiles.Cs:InitUserProfiles() - Successfully loaded " + result.Count.ToString() + " from database");
57 db.Close();
58 }
59
60 public virtual void SaveUserProfiles() // ZOMG! INEFFICIENT!
61 {
62 IObjectContainer db;
63 db = Db4oFactory.OpenFile("userprofiles.yap");
64 IObjectSet result = db.Get(typeof(UserProfile));
65 foreach (UserProfile userprof in result)
66 {
67 db.Delete(userprof);
68 db.Commit();
69 }
70 foreach (UserProfile userprof in UserProfiles.Values)
71 {
72 db.Set(userprof);
73 db.Commit();
74 }
75 db.Close();
76 }
77
78 public UserProfile GetProfileByName(string firstname, string lastname)
79 {
80 foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys)
81 {
82 if (UserProfiles[UUID].firstname.Equals(firstname)) if (UserProfiles[UUID].lastname.Equals(lastname))
83 {
84 return UserProfiles[UUID];
85 }
86 }
87 return null;
88 }
89
90 public UserProfile GetProfileByLLUUID(LLUUID ProfileLLUUID)
91 {
92 return UserProfiles[ProfileLLUUID];
93 }
94
95 public virtual bool AuthenticateUser(string firstname, string lastname, string passwd)
96 {
97 UserProfile TheUser = GetProfileByName(firstname, lastname);
98 passwd = passwd.Remove(0, 3); //remove $1$
99 if (TheUser != null)
100 {
101 if (TheUser.MD5passwd == passwd)
102 {
103 Console.WriteLine("UserProfile - authorised " + firstname + " " + lastname);
104 return true;
105 }
106 else
107 {
108 Console.WriteLine("UserProfile - not authorised, password not match " + TheUser.MD5passwd + " and " + passwd);
109 return false;
110 }
111 }
112 else
113 {
114 Console.WriteLine("UserProfile - not authorised , unkown: " + firstname + " , " + lastname);
115 return false;
116 }
117
118 }
119
120 public void SetGod(LLUUID GodID)
121 {
122 this.UserProfiles[GodID].IsGridGod = true;
123 }
124
125 public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd)
126 {
127 Console.WriteLine("creating new profile for : " + firstname + " , " + lastname);
128 UserProfile newprofile = new UserProfile();
129 newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256));
130 newprofile.firstname = firstname;
131 newprofile.lastname = lastname;
132 newprofile.MD5passwd = MD5passwd;
133 newprofile.UUID = LLUUID.Random();
134 newprofile.Inventory.CreateRootFolder(newprofile.UUID, true);
135 this.UserProfiles.Add(newprofile.UUID, newprofile);
136 SaveUserProfiles();
137 return newprofile;
138 }
139
140 public virtual AgentInventory GetUsersInventory(LLUUID agentID)
141 {
142 UserProfile user = this.GetProfileByLLUUID(agentID);
143 if (user != null)
144 {
145 return user.Inventory;
146 }
147
148 return null;
149 }
150
151 }
152}
diff --git a/Common/OpenSim.Framework/Util.cs b/Common/OpenSim.Framework/Util.cs
deleted file mode 100644
index 10e3fdf..0000000
--- a/Common/OpenSim.Framework/Util.cs
+++ /dev/null
@@ -1,178 +0,0 @@
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.Security.Cryptography;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife;
33using libsecondlife.Packets;
34
35namespace OpenSim.Framework.Utilities
36{
37 public class Util
38 {
39 private static Random randomClass = new Random();
40 private static uint nextXferID = 5000;
41 private static object XferLock = new object();
42
43 public static ulong UIntsToLong(uint X, uint Y)
44 {
45 return Helpers.UIntsToLong(X, Y);
46 }
47
48 public static Random RandomClass
49 {
50 get
51 {
52 return randomClass;
53 }
54 }
55
56 public static uint GetNextXferID()
57 {
58 uint id = 0;
59 lock(XferLock)
60 {
61 id = nextXferID;
62 nextXferID++;
63 }
64 return id;
65 }
66
67 public static int UnixTimeSinceEpoch()
68 {
69 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
70 int timestamp = (int)t.TotalSeconds;
71 return timestamp;
72 }
73
74 public static string Md5Hash(string pass)
75 {
76 MD5 md5 = MD5CryptoServiceProvider.Create();
77 byte[] dataMd5 = md5.ComputeHash(Encoding.Default.GetBytes(pass));
78 StringBuilder sb = new StringBuilder();
79 for (int i = 0; i < dataMd5.Length; i++)
80 sb.AppendFormat("{0:x2}", dataMd5[i]);
81 return sb.ToString();
82 }
83
84 //public static int fast_distance2d(int x, int y)
85 //{
86 // x = System.Math.Abs(x);
87 // y = System.Math.Abs(y);
88
89 // int min = System.Math.Min(x, y);
90
91 // return (x + y - (min >> 1) - (min >> 2) + (min >> 4));
92 //}
93
94 public static string FieldToString(byte[] bytes)
95 {
96 return FieldToString(bytes, String.Empty);
97 }
98
99 /// <summary>
100 /// Convert a variable length field (byte array) to a string, with a
101 /// field name prepended to each line of the output
102 /// </summary>
103 /// <remarks>If the byte array has unprintable characters in it, a
104 /// hex dump will be put in the string instead</remarks>
105 /// <param name="bytes">The byte array to convert to a string</param>
106 /// <param name="fieldName">A field name to prepend to each line of output</param>
107 /// <returns>An ASCII string or a string containing a hex dump, minus
108 /// the null terminator</returns>
109 public static string FieldToString(byte[] bytes, string fieldName)
110 {
111 // Check for a common case
112 if (bytes.Length == 0) return String.Empty;
113
114 StringBuilder output = new StringBuilder();
115 bool printable = true;
116
117 for (int i = 0; i < bytes.Length; ++i)
118 {
119 // Check if there are any unprintable characters in the array
120 if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09
121 && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00)
122 {
123 printable = false;
124 break;
125 }
126 }
127
128 if (printable)
129 {
130 if (fieldName.Length > 0)
131 {
132 output.Append(fieldName);
133 output.Append(": ");
134 }
135
136 if (bytes[bytes.Length - 1] == 0x00)
137 output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1));
138 else
139 output.Append(UTF8Encoding.UTF8.GetString(bytes));
140 }
141 else
142 {
143 for (int i = 0; i < bytes.Length; i += 16)
144 {
145 if (i != 0)
146 output.Append(Environment.NewLine);
147 if (fieldName.Length > 0)
148 {
149 output.Append(fieldName);
150 output.Append(": ");
151 }
152
153 for (int j = 0; j < 16; j++)
154 {
155 if ((i + j) < bytes.Length)
156 output.Append(String.Format("{0:X2} ", bytes[i + j]));
157 else
158 output.Append(" ");
159 }
160
161 for (int j = 0; j < 16 && (i + j) < bytes.Length; j++)
162 {
163 if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E)
164 output.Append((char)bytes[i + j]);
165 else
166 output.Append(".");
167 }
168 }
169 }
170
171 return output.ToString();
172 }
173 public Util()
174 {
175
176 }
177 }
178}
diff --git a/Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.csproj b/Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.csproj
deleted file mode 100644
index df68722..0000000
--- a/Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.csproj
+++ /dev/null
@@ -1,93 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{E88EF749-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.GenericConfig.Xml</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.GenericConfig.Xml</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 </ItemGroup>
70 <ItemGroup>
71 <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
72 <Name>OpenSim.Framework</Name>
73 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
74 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
75 <Private>False</Private>
76 </ProjectReference>
77 </ItemGroup>
78 <ItemGroup>
79 <Compile Include="XmlConfig.cs">
80 <SubType>Code</SubType>
81 </Compile>
82 <Compile Include="Properties\AssemblyInfo.cs">
83 <SubType>Code</SubType>
84 </Compile>
85 </ItemGroup>
86 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
87 <PropertyGroup>
88 <PreBuildEvent>
89 </PreBuildEvent>
90 <PostBuildEvent>
91 </PostBuildEvent>
92 </PropertyGroup>
93</Project>
diff --git a/Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.dll.build b/Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.dll.build
deleted file mode 100644
index 075ea7f..0000000
--- a/Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.dll.build
+++ /dev/null
@@ -1,42 +0,0 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.GenericConfig.Xml" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.GenericConfig.Xml" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="XmlConfig.cs" />
15 <include name="Properties/AssemblyInfo.cs" />
16 </sources>
17 <references basedir="${project::get-base-directory()}">
18 <lib>
19 <include name="${project::get-base-directory()}" />
20 <include name="${project::get-base-directory()}/${build.dir}" />
21 </lib>
22 <include name="../../../bin/OpenSim.Framework.dll" />
23 <include name="System.dll" />
24 <include name="System.Xml.dll" />
25 </references>
26 </csc>
27 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" />
28 <mkdir dir="${project::get-base-directory()}/../../../bin/"/>
29 <copy todir="${project::get-base-directory()}/../../../bin/">
30 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
31 <include name="*.dll"/>
32 <include name="*.exe"/>
33 </fileset>
34 </copy>
35 </target>
36 <target name="clean">
37 <delete dir="${bin.dir}" failonerror="false" />
38 <delete dir="${obj.dir}" failonerror="false" />
39 </target>
40 <target name="doc" description="Creates documentation.">
41 </target>
42</project>
diff --git a/Common/OpenSim.GenericConfig/Xml/Properties/AssemblyInfo.cs b/Common/OpenSim.GenericConfig/Xml/Properties/AssemblyInfo.cs
deleted file mode 100644
index de5f48d..0000000
--- a/Common/OpenSim.GenericConfig/Xml/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.GenericConfig")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OpenSim.GenericConfig")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("285a3047-f165-46c8-8767-b51428738a09")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")]
35[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Common/OpenSim.GenericConfig/Xml/XmlConfig.cs b/Common/OpenSim.GenericConfig/Xml/XmlConfig.cs
deleted file mode 100644
index 40c252f..0000000
--- a/Common/OpenSim.GenericConfig/Xml/XmlConfig.cs
+++ /dev/null
@@ -1,136 +0,0 @@
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 System.Xml;
32using OpenSim.Framework.Interfaces;
33
34namespace OpenSim.GenericConfig
35{
36 public class XmlConfig : IGenericConfig
37 {
38 private XmlDocument doc;
39 private XmlNode rootNode;
40 private XmlNode configNode;
41 private string fileName;
42 private bool createdFile = false;
43
44 public XmlConfig(string filename)
45 {
46 fileName = filename;
47 }
48
49 public void LoadData()
50 {
51 doc = new XmlDocument();
52 try
53 {
54 if (System.IO.File.Exists(fileName))
55 {
56 XmlTextReader reader = new XmlTextReader(fileName);
57 reader.WhitespaceHandling = WhitespaceHandling.None;
58 doc.Load(reader);
59 reader.Close();
60 }
61 else
62 {
63 createdFile = true;
64 rootNode = doc.CreateNode(XmlNodeType.Element, "Root", "");
65 doc.AppendChild(rootNode);
66 configNode = doc.CreateNode(XmlNodeType.Element, "Config", "");
67 rootNode.AppendChild(configNode);
68 }
69
70 }
71 catch (Exception e)
72 {
73 Console.WriteLine(e.Message);
74 return;
75 }
76 try
77 {
78 rootNode = doc.FirstChild;
79 if (rootNode.Name != "Root")
80 throw new Exception("Error: Invalid .xml File. Missing <Root>");
81
82 configNode = rootNode.FirstChild;
83 if (configNode.Name != "Config")
84 throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>");
85
86 }
87 catch (Exception e)
88 {
89 Console.WriteLine(e.Message);
90 }
91 if (createdFile)
92 {
93 this.Commit();
94 }
95 }
96
97 public string GetAttribute(string attributeName)
98 {
99 string result = "";
100 if (configNode.Attributes[attributeName] != null)
101 {
102 result = ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value;
103 }
104 return result;
105 }
106
107 public bool SetAttribute(string attributeName, string attributeValue)
108 {
109 if (configNode.Attributes[attributeName] != null)
110 {
111 ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue;
112 }
113 else
114 {
115 XmlAttribute attri;
116 attri = doc.CreateAttribute(attributeName);
117 attri.Value = attributeValue;
118 configNode.Attributes.Append(attri);
119 }
120 return true;
121 }
122
123 public void Commit()
124 {
125 doc.Save(fileName);
126 }
127
128 public void Close()
129 {
130 configNode = null;
131 rootNode = null;
132 doc = null;
133 }
134
135 }
136}
diff --git a/Common/OpenSim.Servers/BaseHttpServer.cs b/Common/OpenSim.Servers/BaseHttpServer.cs
deleted file mode 100644
index ec5a6d7..0000000
--- a/Common/OpenSim.Servers/BaseHttpServer.cs
+++ /dev/null
@@ -1,283 +0,0 @@
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.Net;
31using System.Text;
32using System.Text.RegularExpressions;
33using System.Threading;
34//using OpenSim.CAPS;
35using Nwc.XmlRpc;
36using System.Collections;
37using OpenSim.Framework.Console;
38
39namespace OpenSim.Servers
40{
41 public class BaseHttpServer
42 {
43 protected class RestMethodEntry
44 {
45 private string m_path;
46 public string Path
47 {
48 get { return m_path; }
49 }
50
51 private RestMethod m_restMethod;
52 public RestMethod RestMethod
53 {
54 get { return m_restMethod; }
55 }
56
57 public RestMethodEntry(string path, RestMethod restMethod)
58 {
59 m_path = path;
60 m_restMethod = restMethod;
61 }
62 }
63
64 protected Thread m_workerThread;
65 protected HttpListener m_httpListener;
66 protected Dictionary<string, RestMethodEntry> m_restHandlers = new Dictionary<string, RestMethodEntry>();
67 protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
68 protected int m_port;
69
70 public BaseHttpServer(int port)
71 {
72 m_port = port;
73 }
74
75 public bool AddRestHandler(string method, string path, RestMethod handler)
76 {
77 string methodKey = String.Format("{0}: {1}", method, path);
78
79 if (!this.m_restHandlers.ContainsKey(methodKey))
80 {
81 this.m_restHandlers.Add(methodKey, new RestMethodEntry(path, handler));
82 return true;
83 }
84
85 //must already have a handler for that path so return false
86 return false;
87 }
88
89 public bool AddXmlRPCHandler(string method, XmlRpcMethod handler)
90 {
91 if (!this.m_rpcHandlers.ContainsKey(method))
92 {
93 this.m_rpcHandlers.Add(method, handler);
94 return true;
95 }
96
97 //must already have a handler for that path so return false
98 return false;
99 }
100
101 protected virtual string ProcessXMLRPCMethod(string methodName, XmlRpcRequest request)
102 {
103 XmlRpcResponse response;
104
105 XmlRpcMethod method;
106 if (this.m_rpcHandlers.TryGetValue(methodName, out method))
107 {
108 response = method(request);
109 }
110 else
111 {
112 response = new XmlRpcResponse();
113 Hashtable unknownMethodError = new Hashtable();
114 unknownMethodError["reason"] = "XmlRequest"; ;
115 unknownMethodError["message"] = "Unknown Rpc request";
116 unknownMethodError["login"] = "false";
117 response.Value = unknownMethodError;
118 }
119
120 return XmlRpcResponseSerializer.Singleton.Serialize(response);
121 }
122
123 protected virtual string ParseREST(string request, string path, string method)
124 {
125 string response;
126
127 string requestKey = String.Format("{0}: {1}", method, path);
128
129 string bestMatch = String.Empty;
130 foreach (string currentKey in m_restHandlers.Keys)
131 {
132 if (requestKey.StartsWith(currentKey))
133 {
134 if (currentKey.Length > bestMatch.Length)
135 {
136 bestMatch = currentKey;
137 }
138 }
139 }
140
141 RestMethodEntry restMethodEntry;
142 if (m_restHandlers.TryGetValue(bestMatch, out restMethodEntry))
143 {
144 RestMethod restMethod = restMethodEntry.RestMethod;
145
146 string param = path.Substring(restMethodEntry.Path.Length);
147 response = restMethod(request, path, param);
148
149 }
150 else
151 {
152 response = String.Empty;
153 }
154
155 return response;
156 }
157
158 protected virtual string ParseLLSDXML(string requestBody)
159 {
160 // dummy function for now - IMPLEMENT ME!
161 return "";
162 }
163
164 protected virtual string ParseXMLRPC(string requestBody)
165 {
166 string responseString = String.Empty;
167
168 try
169 {
170 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
171
172 string methodName = request.MethodName;
173
174 responseString = ProcessXMLRPCMethod(methodName, request);
175 }
176 catch (Exception e)
177 {
178 Console.WriteLine(e.ToString());
179 }
180 return responseString;
181 }
182
183 public virtual void HandleRequest(Object stateinfo)
184 {
185 try
186 {
187 HttpListenerContext context = (HttpListenerContext)stateinfo;
188
189 HttpListenerRequest request = context.Request;
190 HttpListenerResponse response = context.Response;
191
192 response.KeepAlive = false;
193 response.SendChunked = false;
194
195 System.IO.Stream body = request.InputStream;
196 System.Text.Encoding encoding = System.Text.Encoding.UTF8;
197 System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
198
199 string requestBody = reader.ReadToEnd();
200 body.Close();
201 reader.Close();
202
203 //Console.WriteLine(request.HttpMethod + " " + request.RawUrl + " Http/" + request.ProtocolVersion.ToString() + " content type: " + request.ContentType);
204 //Console.WriteLine(requestBody);
205
206 string responseString = "";
207 switch (request.ContentType)
208 {
209 case "text/xml":
210 // must be XML-RPC, so pass to the XML-RPC parser
211
212 responseString = ParseXMLRPC(requestBody);
213 responseString = Regex.Replace(responseString, "utf-16", "utf-8");
214
215 response.AddHeader("Content-type", "text/xml");
216 break;
217
218 case "application/xml":
219 // probably LLSD we hope, otherwise it should be ignored by the parser
220 responseString = ParseLLSDXML(requestBody);
221 response.AddHeader("Content-type", "application/xml");
222 break;
223
224 case "application/x-www-form-urlencoded":
225 // a form data POST so send to the REST parser
226 responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
227 response.AddHeader("Content-type", "text/html");
228 break;
229
230 case null:
231 // must be REST or invalid crap, so pass to the REST parser
232 responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
233 response.AddHeader("Content-type", "text/html");
234 break;
235
236 }
237
238 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
239 System.IO.Stream output = response.OutputStream;
240 response.SendChunked = false;
241 response.ContentLength64 = buffer.Length;
242 output.Write(buffer, 0, buffer.Length);
243 output.Close();
244 }
245 catch (Exception e)
246 {
247 Console.WriteLine(e.ToString());
248 }
249 }
250
251 public void Start()
252 {
253 MainConsole.Instance.Verbose("BaseHttpServer.cs: Starting up HTTP Server");
254
255 m_workerThread = new Thread(new ThreadStart(StartHTTP));
256 m_workerThread.IsBackground = true;
257 m_workerThread.Start();
258 }
259
260 private void StartHTTP()
261 {
262 try
263 {
264 MainConsole.Instance.Verbose("BaseHttpServer.cs: StartHTTP() - Spawned main thread OK");
265 m_httpListener = new HttpListener();
266
267 m_httpListener.Prefixes.Add("http://+:" + m_port + "/");
268 m_httpListener.Start();
269
270 HttpListenerContext context;
271 while (true)
272 {
273 context = m_httpListener.GetContext();
274 ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
275 }
276 }
277 catch (Exception e)
278 {
279 MainConsole.Instance.Warn(e.Message);
280 }
281 }
282 }
283}
diff --git a/Common/OpenSim.Servers/BaseServer.cs b/Common/OpenSim.Servers/BaseServer.cs
deleted file mode 100644
index f248186..0000000
--- a/Common/OpenSim.Servers/BaseServer.cs
+++ /dev/null
@@ -1,37 +0,0 @@
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;
31
32namespace OpenSim.Servers
33{
34 public class BaseServer
35 {
36 }
37}
diff --git a/Common/OpenSim.Servers/CheckSumServer.cs b/Common/OpenSim.Servers/CheckSumServer.cs
deleted file mode 100644
index b6bfe3a..0000000
--- a/Common/OpenSim.Servers/CheckSumServer.cs
+++ /dev/null
@@ -1,139 +0,0 @@
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.Text;
30using System.IO;
31using System.Threading;
32using System.Net;
33using System.Net.Sockets;
34using System.Timers;
35using System.Reflection;
36using System.Collections;
37using System.Collections.Generic;
38using libsecondlife;
39using libsecondlife.Packets;
40using OpenSim.Framework.Console;
41
42
43namespace OpenSim.Servers
44{
45 public class CheckSumServer : UDPServerBase
46 {
47 //protected ConsoleBase m_console;
48
49 public CheckSumServer(int port)
50 : base(port)
51 {
52 }
53
54 protected override void OnReceivedData(IAsyncResult result)
55 {
56 ipeSender = new IPEndPoint(IPAddress.Any, 0);
57 epSender = (EndPoint)ipeSender;
58 Packet packet = null;
59 int numBytes = Server.EndReceiveFrom(result, ref epSender);
60 int packetEnd = numBytes - 1;
61
62 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
63
64 if (packet.Type == PacketType.SecuredTemplateChecksumRequest)
65 {
66 SecuredTemplateChecksumRequestPacket checksum = (SecuredTemplateChecksumRequestPacket)packet;
67 TemplateChecksumReplyPacket checkreply = new TemplateChecksumReplyPacket();
68 checkreply.DataBlock.Checksum = 3220703154;//180572585;
69 checkreply.DataBlock.Flags = 0;
70 checkreply.DataBlock.MajorVersion = 1;
71 checkreply.DataBlock.MinorVersion = 15;
72 checkreply.DataBlock.PatchVersion = 0;
73 checkreply.DataBlock.ServerVersion = 0;
74 checkreply.TokenBlock.Token = checksum.TokenBlock.Token;
75 this.SendPacket(checkreply, epSender);
76
77 /*
78 //if we wanted to echo the the checksum/ version from the client (so that any client worked)
79 SecuredTemplateChecksumRequestPacket checkrequest = new SecuredTemplateChecksumRequestPacket();
80 checkrequest.TokenBlock.Token = checksum.TokenBlock.Token;
81 this.SendPacket(checkrequest, epSender);
82 */
83 }
84 else if (packet.Type == PacketType.TemplateChecksumReply)
85 {
86 //echo back the client checksum reply (Hegemon's method)
87 TemplateChecksumReplyPacket checksum2 = (TemplateChecksumReplyPacket)packet;
88 TemplateChecksumReplyPacket checkreply2 = new TemplateChecksumReplyPacket();
89 checkreply2.DataBlock.Checksum = checksum2.DataBlock.Checksum;
90 checkreply2.DataBlock.Flags = checksum2.DataBlock.Flags;
91 checkreply2.DataBlock.MajorVersion = checksum2.DataBlock.MajorVersion;
92 checkreply2.DataBlock.MinorVersion = checksum2.DataBlock.MinorVersion;
93 checkreply2.DataBlock.PatchVersion = checksum2.DataBlock.PatchVersion;
94 checkreply2.DataBlock.ServerVersion = checksum2.DataBlock.ServerVersion;
95 checkreply2.TokenBlock.Token = checksum2.TokenBlock.Token;
96 this.SendPacket(checkreply2, epSender);
97 }
98 else
99 {
100 }
101
102 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
103 }
104
105 private void SendPacket(Packet Pack, EndPoint endp)
106 {
107 if (!Pack.Header.Resent)
108 {
109 Pack.Header.Sequence = 1;
110 }
111
112 byte[] ZeroOutBuffer = new byte[4096];
113 byte[] sendbuffer;
114 sendbuffer = Pack.ToBytes();
115
116 try
117 {
118 if (Pack.Header.Zerocoded)
119 {
120 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
121 this.SendPackTo(ZeroOutBuffer, packetsize, SocketFlags.None, endp);
122 }
123 else
124 {
125 this.SendPackTo(sendbuffer, sendbuffer.Length, SocketFlags.None, endp);
126 }
127 }
128 catch (Exception)
129 {
130 MainConsole.Instance.Warn("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection ");
131 }
132 }
133
134 private void SendPackTo(byte[] buffer, int size, SocketFlags flags, EndPoint endp)
135 {
136 this.Server.SendTo(buffer, size, flags, endp);
137 }
138 }
139} \ No newline at end of file
diff --git a/Common/OpenSim.Servers/IRestHandler.cs b/Common/OpenSim.Servers/IRestHandler.cs
deleted file mode 100644
index 3aa508c..0000000
--- a/Common/OpenSim.Servers/IRestHandler.cs
+++ /dev/null
@@ -1,35 +0,0 @@
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;
31
32namespace OpenSim.Servers
33{
34 public delegate string RestMethod( string request, string path, string param );
35}
diff --git a/Common/OpenSim.Servers/LocalUserProfileManager.cs b/Common/OpenSim.Servers/LocalUserProfileManager.cs
deleted file mode 100644
index 6f65176..0000000
--- a/Common/OpenSim.Servers/LocalUserProfileManager.cs
+++ /dev/null
@@ -1,124 +0,0 @@
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*/
28
29using System;
30using System.Collections.Generic;
31using System.Collections;
32using System.Text;
33using OpenSim.Framework.User;
34using OpenSim.Framework.Grid;
35using OpenSim.Framework.Inventory;
36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework.Types;
38using libsecondlife;
39
40namespace OpenSim.UserServer
41{
42 public class LocalUserProfileManager : UserProfileManager
43 {
44 private IGridServer m_gridServer;
45 private int m_port;
46 private string m_ipAddr;
47 private uint regionX;
48 private uint regionY;
49 private AddNewSessionHandler AddSession;
50
51 public LocalUserProfileManager(IGridServer gridServer, int simPort, string ipAddr , uint regX, uint regY)
52 {
53 m_gridServer = gridServer;
54 m_port = simPort;
55 m_ipAddr = ipAddr;
56 regionX = regX;
57 regionY = regY;
58 }
59
60 public void SetSessionHandler(AddNewSessionHandler sessionHandler)
61 {
62 this.AddSession = sessionHandler;
63 }
64
65 public override void InitUserProfiles()
66 {
67 base.InitUserProfiles();
68 }
69
70 public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser)
71 {
72 Int32 circode = (Int32)response["circuit_code"];
73 theUser.AddSimCircuit((uint)circode, LLUUID.Random());
74 response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
75 response["sim_port"] = m_port;
76 response["sim_ip"] = m_ipAddr;
77 response["region_y"] = (Int32)regionY* 256;
78 response["region_x"] = (Int32)regionX* 256;
79
80 string first;
81 string last;
82 if (response.Contains("first_name"))
83 {
84 first = (string)response["first_name"];
85 }
86 else
87 {
88 first = "test";
89 }
90
91 if (response.Contains("last_name"))
92 {
93 last = (string)response["last_name"];
94 }
95 else
96 {
97 last = "User";
98 }
99
100 ArrayList InventoryList = (ArrayList)response["inventory-skeleton"];
101 Hashtable Inventory1 = (Hashtable)InventoryList[0];
102
103 Login _login = new Login();
104 //copy data to login object
105 _login.First = first;
106 _login.Last = last;
107 _login.Agent = new LLUUID((string)response["agent_id"]) ;
108 _login.Session = new LLUUID((string)response["session_id"]);
109 _login.SecureSession = new LLUUID((string)response["secure_session_id"]);
110 _login.CircuitCode =(uint) circode;
111 _login.BaseFolder = null;
112 _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);
113
114 //working on local computer if so lets add to the gridserver's list of sessions?
115 /*if (m_gridServer.GetName() == "Local")
116 {
117 Console.WriteLine("adding login data to gridserver");
118 ((LocalGridBase)this.m_gridServer).AddNewSession(_login);
119 }*/
120
121 this.AddSession(_login);
122 }
123 }
124}
diff --git a/Common/OpenSim.Servers/LoginResponse.cs b/Common/OpenSim.Servers/LoginResponse.cs
deleted file mode 100644
index 9e37409..0000000
--- a/Common/OpenSim.Servers/LoginResponse.cs
+++ /dev/null
@@ -1,669 +0,0 @@
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*/
28
29using Nwc.XmlRpc;
30using System;
31using System.IO;
32using System.Net;
33using System.Net.Sockets;
34using System.Text;
35using System.Text.RegularExpressions;
36using System.Threading;
37using System.Collections;
38using System.Security.Cryptography;
39using System.Xml;
40using libsecondlife;
41using OpenSim;
42using OpenSim.Framework.User;
43using OpenSim.Framework.Inventory;
44using OpenSim.Framework.Utilities;
45using OpenSim.Framework.Interfaces;
46
47// ?
48using OpenSim.Framework.Grid;
49
50namespace OpenSim.UserServer
51{
52 /// <summary>
53 /// A temp class to handle login response.
54 /// Should make use of UserProfileManager where possible.
55 /// </summary>
56
57 public class LoginResponse
58 {
59 private Hashtable loginFlagsHash;
60 private Hashtable globalTexturesHash;
61 private Hashtable loginError;
62 private Hashtable eventCategoriesHash;
63 private Hashtable uiConfigHash;
64 private Hashtable classifiedCategoriesHash;
65
66 private ArrayList loginFlags;
67 private ArrayList globalTextures;
68 private ArrayList eventCategories;
69 private ArrayList uiConfig;
70 private ArrayList classifiedCategories;
71 private ArrayList inventoryRoot;
72 private ArrayList initialOutfit;
73 private ArrayList agentInventory;
74
75 private UserProfile userProfile;
76
77 private LLUUID agentID;
78 private LLUUID sessionID;
79 private LLUUID secureSessionID;
80 private LLUUID baseFolderID;
81 private LLUUID inventoryFolderID;
82
83 // Login Flags
84 private string dst;
85 private string stipendSinceLogin;
86 private string gendered;
87 private string everLoggedIn;
88 private string login;
89 private string simPort;
90 private string simAddress;
91 private string agentAccess;
92 private Int32 circuitCode;
93 private uint regionX;
94 private uint regionY;
95
96 // Login
97 private string firstname;
98 private string lastname;
99
100 // Global Textures
101 private string sunTexture;
102 private string cloudTexture;
103 private string moonTexture;
104
105 // Error Flags
106 private string errorReason;
107 private string errorMessage;
108
109 // Response
110 private XmlRpcResponse xmlRpcResponse;
111 private XmlRpcResponse defaultXmlRpcResponse;
112
113 private string welcomeMessage;
114 private string startLocation;
115 private string allowFirstLife;
116 private string home;
117 private string seedCapability;
118 private string lookAt;
119
120 public LoginResponse()
121 {
122 this.loginFlags = new ArrayList();
123 this.globalTextures = new ArrayList();
124 this.eventCategories = new ArrayList();
125 this.uiConfig = new ArrayList();
126 this.classifiedCategories = new ArrayList();
127
128 this.loginError = new Hashtable();
129 this.eventCategoriesHash = new Hashtable();
130 this.classifiedCategoriesHash = new Hashtable();
131 this.uiConfigHash = new Hashtable();
132
133 this.defaultXmlRpcResponse = new XmlRpcResponse();
134 this.userProfile = new UserProfile();
135 this.inventoryRoot = new ArrayList();
136 this.initialOutfit = new ArrayList();
137 this.agentInventory = new ArrayList();
138
139 this.xmlRpcResponse = new XmlRpcResponse();
140 this.defaultXmlRpcResponse = new XmlRpcResponse();
141
142 this.SetDefaultValues();
143 } // LoginServer
144
145 public void SetDefaultValues()
146 {
147 try
148 {
149 this.DST = "N";
150 this.StipendSinceLogin = "N";
151 this.Gendered = "Y";
152 this.EverLoggedIn = "Y";
153 this.login = "false";
154 this.firstname = "Test";
155 this.lastname = "User";
156 this.agentAccess = "M";
157 this.startLocation = "last";
158 this.allowFirstLife = "Y";
159
160 this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271";
161 this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
162 this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
163
164 this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock.";
165 this.ErrorReason = "key";
166 this.welcomeMessage = "Welcome to OpenSim!";
167 this.seedCapability = "";
168 this.home = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + this.userProfile.homepos.X.ToString() + ",r" + this.userProfile.homepos.Y.ToString() + ",r" + this.userProfile.homepos.Z.ToString() + "], 'look_at':[r" + this.userProfile.homelookat.X.ToString() + ",r" + this.userProfile.homelookat.Y.ToString() + ",r" + this.userProfile.homelookat.Z.ToString() + "]}";
169 this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
170 this.RegionX = (uint)255232;
171 this.RegionY = (uint)254976;
172
173 // Classifieds;
174 this.AddClassifiedCategory((Int32)1, "Shopping");
175 this.AddClassifiedCategory((Int32)2, "Land Rental");
176 this.AddClassifiedCategory((Int32)3, "Property Rental");
177 this.AddClassifiedCategory((Int32)4, "Special Attraction");
178 this.AddClassifiedCategory((Int32)5, "New Products");
179 this.AddClassifiedCategory((Int32)6, "Employment");
180 this.AddClassifiedCategory((Int32)7, "Wanted");
181 this.AddClassifiedCategory((Int32)8, "Service");
182 this.AddClassifiedCategory((Int32)9, "Personal");
183
184 int SessionRand = Util.RandomClass.Next(1, 999);
185 this.SessionID = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
186 this.SecureSessionID = LLUUID.Random();
187
188 this.userProfile.Inventory.CreateRootFolder(this.userProfile.UUID, true);
189 this.baseFolderID = this.userProfile.Inventory.GetFolderID("Textures");
190 this.inventoryFolderID = this.userProfile.Inventory.GetFolderID("My Inventory-");
191 Hashtable InventoryRootHash = new Hashtable();
192 InventoryRootHash["folder_id"] = this.userProfile.Inventory.InventoryRoot.FolderID.ToStringHyphenated();
193 this.inventoryRoot.Add(InventoryRootHash);
194
195 Hashtable TempHash;
196 foreach (InventoryFolder InvFolder in this.userProfile.Inventory.InventoryFolders.Values)
197 {
198 TempHash = new Hashtable();
199 TempHash["name"] = InvFolder.FolderName;
200 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
201 TempHash["version"] = (Int32)InvFolder.Version;
202 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
203 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
204 this.agentInventory.Add(TempHash);
205 }
206
207 Hashtable InitialOutfitHash = new Hashtable();
208 InitialOutfitHash["folder_name"] = "Nightclub Female";
209 InitialOutfitHash["gender"] = "female";
210 this.initialOutfit.Add(InitialOutfitHash);
211 }
212 catch (Exception e)
213 {
214 OpenSim.Framework.Console.MainConsole.Instance.Warn(
215 "LoginResponse: Unable to set default values: " + e.Message
216 );
217 }
218
219 } // SetDefaultValues
220
221 protected virtual LLUUID GetAgentId()
222 {
223 // todo
224 LLUUID Agent;
225 int AgentRand = Util.RandomClass.Next(1, 9999);
226 Agent = new LLUUID("99998888-0100-" + AgentRand.ToString("0000") + "-8ec1-0b1d5cd6aead");
227 return Agent;
228 } // GetAgentId
229
230 private XmlRpcResponse GenerateFailureResponse(string reason, string message, string login)
231 {
232 // Overwrite any default values;
233 this.xmlRpcResponse = new XmlRpcResponse();
234
235 // Ensure Login Failed message/reason;
236 this.ErrorMessage = message;
237 this.ErrorReason = reason;
238
239 this.loginError["reason"] = this.ErrorReason;
240 this.loginError["message"] = this.ErrorMessage;
241 this.loginError["login"] = login;
242 this.xmlRpcResponse.Value = this.loginError;
243 return (this.xmlRpcResponse);
244 } // GenerateResponse
245
246 public XmlRpcResponse LoginFailedResponse()
247 {
248 return (this.GenerateFailureResponse("key", "You have entered an invalid name/password combination. Check Caps/lock.", "false"));
249 } // LoginFailedResponse
250
251 public XmlRpcResponse ConnectionFailedResponse()
252 {
253 return (this.LoginFailedResponse());
254 } // CreateErrorConnectingToGridResponse()
255
256 public XmlRpcResponse CreateAlreadyLoggedInResponse()
257 {
258 return (this.GenerateFailureResponse("presence", "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", "false"));
259 } // CreateAlreadyLoggedInResponse()
260
261 public XmlRpcResponse ToXmlRpcResponse()
262 {
263 try
264 {
265
266 Hashtable responseData = new Hashtable();
267
268 this.loginFlagsHash = new Hashtable();
269 this.loginFlagsHash["daylight_savings"] = this.DST;
270 this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin;
271 this.loginFlagsHash["gendered"] = this.Gendered;
272 this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn;
273 this.loginFlags.Add(this.loginFlagsHash);
274
275 responseData["first_name"] = this.Firstname;
276 responseData["last_name"] = this.Lastname;
277 responseData["agent_access"] = this.agentAccess;
278
279 this.globalTexturesHash = new Hashtable();
280 this.globalTexturesHash["sun_texture_id"] = this.SunTexture;
281 this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture;
282 this.globalTexturesHash["moon_texture_id"] = this.MoonTexture;
283 this.globalTextures.Add(this.globalTexturesHash);
284 this.eventCategories.Add(this.eventCategoriesHash);
285
286 this.AddToUIConfig("allow_first_life", this.allowFirstLife);
287 this.uiConfig.Add(this.uiConfigHash);
288
289 // Create a agent and session LLUUID
290 this.agentID = this.GetAgentId();
291
292 responseData["sim_port"] = this.SimPort;
293 responseData["sim_ip"] = this.SimAddress;
294 responseData["agent_id"] = this.AgentID.ToStringHyphenated();
295 responseData["session_id"] = this.SessionID.ToStringHyphenated();
296 responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated();
297 responseData["circuit_code"] = this.CircuitCode;
298 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
299 responseData["login-flags"] = this.loginFlags;
300 responseData["global-textures"] = this.globalTextures;
301 responseData["seed_capability"] = this.seedCapability;
302
303 responseData["event_categories"] = this.eventCategories;
304 responseData["event_notifications"] = new ArrayList(); // todo
305 responseData["classified_categories"] = this.classifiedCategories;
306 responseData["ui-config"] = this.uiConfig;
307
308 responseData["inventory-skeleton"] = this.agentInventory;
309 responseData["inventory-skel-lib"] = new ArrayList(); // todo
310 responseData["inventory-root"] = this.inventoryRoot;
311 responseData["gestures"] = new ArrayList(); // todo
312 responseData["inventory-lib-owner"] = new ArrayList(); // todo
313 responseData["initial-outfit"] = this.initialOutfit;
314 responseData["start_location"] = this.startLocation;
315 responseData["seed_capability"] = this.seedCapability;
316 responseData["home"] = this.home;
317 responseData["look_at"] = this.lookAt;
318 responseData["message"] = this.welcomeMessage;
319 responseData["region_x"] = (Int32)this.RegionX * 256;
320 responseData["region_y"] = (Int32)this.RegionY * 256;
321
322 responseData["login"] = "true";
323 this.xmlRpcResponse.Value = responseData;
324
325 return (this.xmlRpcResponse);
326 }
327 catch (Exception e)
328 {
329 OpenSim.Framework.Console.MainConsole.Instance.Error(
330 "LoginResponse: Error creating XML-RPC Response: " + e.Message
331 );
332 return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false"));
333
334 }
335
336 } // ToXmlRpcResponse
337
338 public void SetEventCategories(string category, string value)
339 {
340 this.eventCategoriesHash[category] = value;
341 } // SetEventCategories
342
343 public void AddToUIConfig(string itemName, string item)
344 {
345 this.uiConfigHash[itemName] = item;
346 } // SetUIConfig
347
348 public void AddClassifiedCategory(Int32 ID, string categoryName)
349 {
350 this.classifiedCategoriesHash["category_name"] = categoryName;
351 this.classifiedCategoriesHash["category_id"] = ID;
352 this.classifiedCategories.Add(this.classifiedCategoriesHash);
353 // this.classifiedCategoriesHash.Clear();
354 } // SetClassifiedCategory
355
356 public string Login
357 {
358 get
359 {
360 return this.login;
361 }
362 set
363 {
364 this.login = value;
365 }
366 } // Login
367
368 public string DST
369 {
370 get
371 {
372 return this.dst;
373 }
374 set
375 {
376 this.dst = value;
377 }
378 } // DST
379
380 public string StipendSinceLogin
381 {
382 get
383 {
384 return this.stipendSinceLogin;
385 }
386 set
387 {
388 this.stipendSinceLogin = value;
389 }
390 } // StipendSinceLogin
391
392 public string Gendered
393 {
394 get
395 {
396 return this.gendered;
397 }
398 set
399 {
400 this.gendered = value;
401 }
402 } // Gendered
403
404 public string EverLoggedIn
405 {
406 get
407 {
408 return this.everLoggedIn;
409 }
410 set
411 {
412 this.everLoggedIn = value;
413 }
414 } // EverLoggedIn
415
416 public string SimPort
417 {
418 get
419 {
420 return this.simPort;
421 }
422 set
423 {
424 this.simPort = value;
425 }
426 } // SimPort
427
428 public string SimAddress
429 {
430 get
431 {
432 return this.simAddress;
433 }
434 set
435 {
436 this.simAddress = value;
437 }
438 } // SimAddress
439
440 public LLUUID AgentID
441 {
442 get
443 {
444 return this.agentID;
445 }
446 set
447 {
448 this.agentID = value;
449 }
450 } // AgentID
451
452 public LLUUID SessionID
453 {
454 get
455 {
456 return this.sessionID;
457 }
458 set
459 {
460 this.sessionID = value;
461 }
462 } // SessionID
463
464 public LLUUID SecureSessionID
465 {
466 get
467 {
468 return this.secureSessionID;
469 }
470 set
471 {
472 this.secureSessionID = value;
473 }
474 } // SecureSessionID
475
476 public LLUUID BaseFolderID
477 {
478 get
479 {
480 return this.baseFolderID;
481 }
482 set
483 {
484 this.baseFolderID = value;
485 }
486 } // BaseFolderID
487
488 public LLUUID InventoryFolderID
489 {
490 get
491 {
492 return this.inventoryFolderID;
493 }
494 set
495 {
496 this.inventoryFolderID = value;
497 }
498 } // InventoryFolderID
499
500 public Int32 CircuitCode
501 {
502 get
503 {
504 return this.circuitCode;
505 }
506 set
507 {
508 this.circuitCode = value;
509 }
510 } // CircuitCode
511
512 public uint RegionX
513 {
514 get
515 {
516 return this.regionX;
517 }
518 set
519 {
520 this.regionX = value;
521 }
522 } // RegionX
523
524 public uint RegionY
525 {
526 get
527 {
528 return this.regionY;
529 }
530 set
531 {
532 this.regionY = value;
533 }
534 } // RegionY
535
536 public string SunTexture
537 {
538 get
539 {
540 return this.sunTexture;
541 }
542 set
543 {
544 this.sunTexture = value;
545 }
546 } // SunTexture
547
548 public string CloudTexture
549 {
550 get
551 {
552 return this.cloudTexture;
553 }
554 set
555 {
556 this.cloudTexture = value;
557 }
558 } // CloudTexture
559
560 public string MoonTexture
561 {
562 get
563 {
564 return this.moonTexture;
565 }
566 set
567 {
568 this.moonTexture = value;
569 }
570 } // MoonTexture
571
572 public string Firstname
573 {
574 get
575 {
576 return this.firstname;
577 }
578 set
579 {
580 this.firstname = value;
581 }
582 } // Firstname
583
584 public string Lastname
585 {
586 get
587 {
588 return this.lastname;
589 }
590 set
591 {
592 this.lastname = value;
593 }
594 } // Lastname
595
596 public string AgentAccess
597 {
598 get
599 {
600 return this.agentAccess;
601 }
602 set
603 {
604 this.agentAccess = value;
605 }
606 }
607
608 public string StartLocation
609 {
610 get
611 {
612 return this.startLocation;
613 }
614 set
615 {
616 this.startLocation = value;
617 }
618 } // StartLocation
619
620 public string LookAt
621 {
622 get
623 {
624 return this.lookAt;
625 }
626 set
627 {
628 this.lookAt = value;
629 }
630 }
631
632 public string SeedCapability
633 {
634 get
635 {
636 return this.seedCapability;
637 }
638 set
639 {
640 this.seedCapability = value;
641 }
642 } // SeedCapability
643
644 public string ErrorReason
645 {
646 get
647 {
648 return this.errorReason;
649 }
650 set
651 {
652 this.errorReason = value;
653 }
654 } // ErrorReason
655
656 public string ErrorMessage
657 {
658 get
659 {
660 return this.errorMessage;
661 }
662 set
663 {
664 this.errorMessage = value;
665 }
666 } // ErrorMessage
667
668 } // LoginResponse
669} // namespace OpenSim.UserServer \ No newline at end of file
diff --git a/Common/OpenSim.Servers/LoginServer.cs b/Common/OpenSim.Servers/LoginServer.cs
deleted file mode 100644
index 4f4d76f..0000000
--- a/Common/OpenSim.Servers/LoginServer.cs
+++ /dev/null
@@ -1,296 +0,0 @@
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*/
28
29using Nwc.XmlRpc;
30using System;
31using System.IO;
32using System.Net;
33using System.Net.Sockets;
34using System.Text;
35using System.Text.RegularExpressions;
36using System.Threading;
37using System.Collections;
38using System.Security.Cryptography;
39using System.Xml;
40using libsecondlife;
41using OpenSim;
42using OpenSim.Framework.Interfaces;
43using OpenSim.Framework.Grid;
44using OpenSim.Framework.Inventory;
45using OpenSim.Framework.User;
46using OpenSim.Framework.Utilities;
47using OpenSim.Framework.Types;
48
49namespace OpenSim.UserServer
50{
51 public delegate void AddNewSessionHandler(Login loginData);
52 /// <summary>
53 /// When running in local (default) mode , handles client logins.
54 /// </summary>
55 public class LoginServer : LoginService, IUserServer
56 {
57 private IGridServer m_gridServer;
58 public IPAddress clientAddress = IPAddress.Loopback;
59 public IPAddress remoteAddress = IPAddress.Any;
60 private int NumClients;
61 private bool userAccounts = false;
62 private string _mpasswd;
63 private bool _needPasswd = false;
64 private LocalUserProfileManager userManager;
65 private int m_simPort;
66 private string m_simAddr;
67 private uint regionX;
68 private uint regionY;
69 private AddNewSessionHandler AddSession;
70
71 public LocalUserProfileManager LocalUserManager
72 {
73 get
74 {
75 return userManager;
76 }
77 }
78
79 public LoginServer( string simAddr, int simPort, uint regX, uint regY, bool useAccounts)
80 {
81 m_simPort = simPort;
82 m_simAddr = simAddr;
83 regionX = regX;
84 regionY = regY;
85 this.userAccounts = useAccounts;
86 }
87
88 public void SetSessionHandler(AddNewSessionHandler sessionHandler)
89 {
90 this.AddSession = sessionHandler;
91 this.userManager.SetSessionHandler(sessionHandler);
92 }
93
94 public void Startup()
95 {
96 this._needPasswd = false;
97
98 this._mpasswd = EncodePassword("testpass");
99
100 userManager = new LocalUserProfileManager(this.m_gridServer, m_simPort, m_simAddr, regionX, regionY);
101 userManager.InitUserProfiles();
102 userManager.SetKeys("", "", "", "Welcome to OpenSim");
103 }
104
105 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
106 {
107 Console.WriteLine("login attempt");
108 Hashtable requestData = (Hashtable)request.Params[0];
109 string first;
110 string last;
111 string passwd;
112
113 LoginResponse loginResponse = new LoginResponse();
114 loginResponse.RegionX = regionX;
115 loginResponse.RegionY = regionY;
116
117 //get login name
118 if (requestData.Contains("first"))
119 {
120 first = (string)requestData["first"];
121 }
122 else
123 {
124 first = "test";
125 }
126
127 if (requestData.Contains("last"))
128 {
129 last = (string)requestData["last"];
130 }
131 else
132 {
133 last = "User" + NumClients.ToString();
134 }
135
136 if (requestData.Contains("passwd"))
137 {
138 passwd = (string)requestData["passwd"];
139 }
140 else
141 {
142 passwd = "notfound";
143 }
144
145 if (!Authenticate(first, last, passwd))
146 {
147 return loginResponse.LoginFailedResponse();
148 }
149
150 NumClients++;
151
152 // Create a agent and session LLUUID
153 // Agent = GetAgentId(first, last);
154 // int SessionRand = Util.RandomClass.Next(1, 999);
155 // Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
156 // LLUUID secureSess = LLUUID.Random();
157
158 loginResponse.SimPort = m_simPort.ToString();
159 // 7 June 2007, AJD:
160 // [10:03:05] (@AdamZaius) Sandbox should work listening on 0.0.0.0 if you can fix the login XML reply
161 // OLD: loginResponse.SimAddress = m_simAddr.ToString();
162 loginResponse.SimAddress = "0.0.0.0";
163
164 // loginResponse.AgentID = Agent.ToStringHyphenated();
165 // loginResponse.SessionID = Session.ToStringHyphenated();
166 // loginResponse.SecureSessionID = secureSess.ToStringHyphenated();
167 loginResponse.CircuitCode = (Int32)(Util.RandomClass.Next());
168 XmlRpcResponse response = loginResponse.ToXmlRpcResponse();
169 Hashtable responseData = (Hashtable)response.Value;
170
171 //inventory
172 /* ArrayList InventoryList = (ArrayList)responseData["inventory-skeleton"];
173 Hashtable Inventory1 = (Hashtable)InventoryList[0];
174 Hashtable Inventory2 = (Hashtable)InventoryList[1];
175 LLUUID BaseFolderID = LLUUID.Random();
176 LLUUID InventoryFolderID = LLUUID.Random();
177 Inventory2["name"] = "Textures";
178 Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
179 Inventory2["type_default"] = 0;
180 Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
181
182 ArrayList InventoryRoot = (ArrayList)responseData["inventory-root"];
183 Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
184 Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
185 */
186 CustomiseLoginResponse(responseData, first, last);
187
188 Login _login = new Login();
189 //copy data to login object
190 _login.First = first;
191 _login.Last = last;
192 _login.Agent = loginResponse.AgentID;
193 _login.Session = loginResponse.SessionID;
194 _login.SecureSession = loginResponse.SecureSessionID;
195 _login.CircuitCode = (uint) loginResponse.CircuitCode;
196 _login.BaseFolder = loginResponse.BaseFolderID;
197 _login.InventoryFolder = loginResponse.InventoryFolderID;
198
199 //working on local computer if so lets add to the gridserver's list of sessions?
200 /* if (m_gridServer.GetName() == "Local")
201 {
202 ((LocalGridBase)m_gridServer).AddNewSession(_login);
203 }*/
204 AddSession(_login);
205
206 return response;
207 }
208
209 protected virtual void CustomiseLoginResponse(Hashtable responseData, string first, string last)
210 {
211 }
212
213 protected virtual LLUUID GetAgentId(string firstName, string lastName)
214 {
215 LLUUID Agent;
216 int AgentRand = Util.RandomClass.Next(1, 9999);
217 Agent = new LLUUID("99998888-0100-" + AgentRand.ToString("0000") + "-8ec1-0b1d5cd6aead");
218 return Agent;
219 }
220
221 protected virtual bool Authenticate(string first, string last, string passwd)
222 {
223 if (this._needPasswd)
224 {
225 //every user needs the password to login
226 string encodedPass = passwd.Remove(0, 3); //remove $1$
227 if (encodedPass == this._mpasswd)
228 {
229 return true;
230 }
231 else
232 {
233 return false;
234 }
235 }
236 else
237 {
238 //do not need password to login
239 return true;
240 }
241 }
242
243 private static string EncodePassword(string passwd)
244 {
245 Byte[] originalBytes;
246 Byte[] encodedBytes;
247 MD5 md5;
248
249 md5 = new MD5CryptoServiceProvider();
250 originalBytes = ASCIIEncoding.Default.GetBytes(passwd);
251 encodedBytes = md5.ComputeHash(originalBytes);
252
253 return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower();
254 }
255
256 public bool CreateUserAccount(string firstName, string lastName, string password)
257 {
258 Console.WriteLine("creating new user account");
259 string mdPassword = EncodePassword(password);
260 Console.WriteLine("with password: " + mdPassword);
261 this.userManager.CreateNewProfile(firstName, lastName, mdPassword);
262
263 return true;
264 }
265
266 public UserProfile GetProfileByName(string firstName, string lastName)
267 {
268 return this.userManager.GetProfileByName(firstName, lastName);
269 }
270
271
272 //IUserServer implementation
273 public AgentInventory RequestAgentsInventory(LLUUID agentID)
274 {
275 AgentInventory aInventory = null;
276 if (this.userAccounts)
277 {
278 aInventory = this.userManager.GetUsersInventory(agentID);
279 }
280
281 return aInventory;
282 }
283
284 public bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory)
285 {
286 return true;
287 }
288
289 public void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
290 {
291
292 }
293 }
294
295
296}
diff --git a/Common/OpenSim.Servers/OpenSim.Servers.csproj b/Common/OpenSim.Servers/OpenSim.Servers.csproj
deleted file mode 100644
index 7a99206..0000000
--- a/Common/OpenSim.Servers/OpenSim.Servers.csproj
+++ /dev/null
@@ -1,133 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{8BB20F0A-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Servers</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.Servers</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="libsecondlife.dll" >
62 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System" >
66 <HintPath>System.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Xml" >
70 <HintPath>System.Xml.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 </ItemGroup>
74 <ItemGroup>
75 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
76 <Name>OpenSim.Framework</Name>
77 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
78 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
79 <Private>False</Private>
80 </ProjectReference>
81 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
82 <Name>OpenSim.Framework.Console</Name>
83 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
84 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
85 <Private>False</Private>
86 </ProjectReference>
87 <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj">
88 <Name>XMLRPC</Name>
89 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
90 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
91 <Private>False</Private>
92 </ProjectReference>
93 </ItemGroup>
94 <ItemGroup>
95 <Compile Include="BaseHttpServer.cs">
96 <SubType>Code</SubType>
97 </Compile>
98 <Compile Include="BaseServer.cs">
99 <SubType>Code</SubType>
100 </Compile>
101 <Compile Include="CheckSumServer.cs">
102 <SubType>Code</SubType>
103 </Compile>
104 <Compile Include="IRestHandler.cs">
105 <SubType>Code</SubType>
106 </Compile>
107 <Compile Include="LocalUserProfileManager.cs">
108 <SubType>Code</SubType>
109 </Compile>
110 <Compile Include="LoginResponse.cs">
111 <SubType>Code</SubType>
112 </Compile>
113 <Compile Include="LoginServer.cs">
114 <SubType>Code</SubType>
115 </Compile>
116 <Compile Include="SocketRegistry.cs">
117 <SubType>Code</SubType>
118 </Compile>
119 <Compile Include="UDPServerBase.cs">
120 <SubType>Code</SubType>
121 </Compile>
122 <Compile Include="XmlRpcMethod.cs">
123 <SubType>Code</SubType>
124 </Compile>
125 </ItemGroup>
126 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
127 <PropertyGroup>
128 <PreBuildEvent>
129 </PreBuildEvent>
130 <PostBuildEvent>
131 </PostBuildEvent>
132 </PropertyGroup>
133</Project>
diff --git a/Common/OpenSim.Servers/OpenSim.Servers.dll.build b/Common/OpenSim.Servers/OpenSim.Servers.dll.build
deleted file mode 100644
index 6147ea7..0000000
--- a/Common/OpenSim.Servers/OpenSim.Servers.dll.build
+++ /dev/null
@@ -1,53 +0,0 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Servers" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Servers" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="BaseHttpServer.cs" />
15 <include name="BaseServer.cs" />
16 <include name="CheckSumServer.cs" />
17 <include name="IRestHandler.cs" />
18 <include name="LocalUserProfileManager.cs" />
19 <include name="LoginResponse.cs" />
20 <include name="LoginServer.cs" />
21 <include name="SocketRegistry.cs" />
22 <include name="UDPServerBase.cs" />
23 <include name="XmlRpcMethod.cs" />
24 </sources>
25 <references basedir="${project::get-base-directory()}">
26 <lib>
27 <include name="${project::get-base-directory()}" />
28 <include name="${project::get-base-directory()}/${build.dir}" />
29 </lib>
30 <include name="../../bin/libsecondlife.dll" />
31 <include name="../../bin/OpenSim.Framework.dll" />
32 <include name="../../bin/OpenSim.Framework.Console.dll" />
33 <include name="System.dll" />
34 <include name="System.Xml.dll" />
35 <include name="../../bin/XMLRPC.dll" />
36 </references>
37 </csc>
38 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
39 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
40 <copy todir="${project::get-base-directory()}/../../bin/">
41 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
42 <include name="*.dll"/>
43 <include name="*.exe"/>
44 </fileset>
45 </copy>
46 </target>
47 <target name="clean">
48 <delete dir="${bin.dir}" failonerror="false" />
49 <delete dir="${obj.dir}" failonerror="false" />
50 </target>
51 <target name="doc" description="Creates documentation.">
52 </target>
53</project>
diff --git a/Common/OpenSim.Servers/SocketRegistry.cs b/Common/OpenSim.Servers/SocketRegistry.cs
deleted file mode 100644
index 2ebf80c..0000000
--- a/Common/OpenSim.Servers/SocketRegistry.cs
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * Created by SharpDevelop.
3 * User: Adam Stevenson
4 * Date: 6/13/2007
5 * Time: 12:55 AM
6 *
7 * To change this template use Tools | Options | Coding | Edit Standard Headers.
8 */
9
10using System;
11using System.Collections.Generic;
12using System.Net;
13using System.Net.Sockets;
14
15namespace OpenSim.Servers
16{
17 /// <summary>
18 ///
19 /// </summary>
20 public class SocketRegistry
21 {
22 static List<Socket> _Sockets;
23
24 static SocketRegistry()
25 {
26 _Sockets = new List<Socket>();
27 }
28
29 private SocketRegistry()
30 {
31
32 }
33
34 public static void Register(Socket pSocket)
35 {
36 _Sockets.Add(pSocket);
37 }
38
39 public static void Unregister(Socket pSocket)
40 {
41 _Sockets.Remove(pSocket);
42 }
43
44 public static void UnregisterAllAndClose()
45 {
46 int iSockets = _Sockets.Count;
47
48 for (int i = 0; i < iSockets; i++)
49 {
50 try
51 {
52 _Sockets[i].Close();
53 }
54 catch
55 {
56
57 }
58 }
59
60 _Sockets.Clear();
61 }
62 }
63}
diff --git a/Common/OpenSim.Servers/UDPServerBase.cs b/Common/OpenSim.Servers/UDPServerBase.cs
deleted file mode 100644
index b763315..0000000
--- a/Common/OpenSim.Servers/UDPServerBase.cs
+++ /dev/null
@@ -1,103 +0,0 @@
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.Text;
30using System.IO;
31using System.Threading;
32using System.Net;
33using System.Net.Sockets;
34using System.Timers;
35using System.Reflection;
36using System.Collections;
37using System.Collections.Generic;
38using libsecondlife;
39using libsecondlife.Packets;
40
41namespace OpenSim.Servers
42{
43 public class UDPServerBase
44 {
45 public Socket Server;
46 protected IPEndPoint ServerIncoming;
47 protected byte[] RecvBuffer = new byte[4096];
48 protected byte[] ZeroBuffer = new byte[8192];
49 protected IPEndPoint ipeSender;
50 protected EndPoint epSender;
51 protected AsyncCallback ReceivedData;
52 protected int listenPort;
53
54 public UDPServerBase(int port)
55 {
56 listenPort = port;
57 }
58
59 protected virtual void OnReceivedData(IAsyncResult result)
60 {
61 ipeSender = new IPEndPoint(IPAddress.Any, 0);
62 epSender = (EndPoint)ipeSender;
63 Packet packet = null;
64 int numBytes = Server.EndReceiveFrom(result, ref epSender);
65 int packetEnd = numBytes - 1;
66
67 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
68
69 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
70 }
71
72 protected virtual void AddNewClient(Packet packet)
73 {
74 }
75
76 public virtual void ServerListener()
77 {
78
79 ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort);
80 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
81
82 /// Add this new socket to the list of sockets that was opened by the application. When the application
83 /// closes, either gracefully or not, all sockets can be cleaned up. Right now I am not aware of any method
84 /// to get all of the sockets for a process within .NET, but if so, this process can be refactored, as
85 /// socket registration would not be neccessary.
86 SocketRegistry.Register(Server);
87
88 Server.Bind(ServerIncoming);
89
90 ipeSender = new IPEndPoint(IPAddress.Any, 0);
91 epSender = (EndPoint)ipeSender;
92 ReceivedData = new AsyncCallback(this.OnReceivedData);
93 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
94 }
95
96 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
97 {
98
99 }
100 }
101}
102
103
diff --git a/Common/OpenSim.Servers/XmlRpcMethod.cs b/Common/OpenSim.Servers/XmlRpcMethod.cs
deleted file mode 100644
index 05cbf2e..0000000
--- a/Common/OpenSim.Servers/XmlRpcMethod.cs
+++ /dev/null
@@ -1,34 +0,0 @@
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 Nwc.XmlRpc;
30
31namespace OpenSim.Servers
32{
33 public delegate XmlRpcResponse XmlRpcMethod( XmlRpcRequest request );
34}
diff --git a/Common/XmlRpcCS/Logger.cs b/Common/XmlRpcCS/Logger.cs
deleted file mode 100644
index ebf804b..0000000
--- a/Common/XmlRpcCS/Logger.cs
+++ /dev/null
@@ -1,46 +0,0 @@
1namespace Nwc.XmlRpc
2{
3 using System;
4
5 /// <summary>Define levels of logging.</summary><remarks> This duplicates
6 /// similar enumerations in System.Diagnostics.EventLogEntryType. The
7 /// duplication was merited because .NET Compact Framework lacked the EventLogEntryType enum.</remarks>
8 public enum LogLevel
9 {
10 /// <summary>Information level, log entry for informational reasons only.</summary>
11 Information,
12 /// <summary>Warning level, indicates a possible problem.</summary>
13 Warning,
14 /// <summary>Error level, implies a significant problem.</summary>
15 Error
16 }
17
18 ///<summary>
19 ///Logging singleton with swappable output delegate.
20 ///</summary>
21 ///<remarks>
22 ///This singleton provides a centralized log. The actual WriteEntry calls are passed
23 ///off to a delegate however. Having a delegate do the actual logginh allows you to
24 ///implement different logging mechanism and have them take effect throughout the system.
25 ///</remarks>
26 public class Logger
27 {
28 ///<summary>Delegate definition for logging.</summary>
29 ///<param name="message">The message <c>String</c> to log.</param>
30 ///<param name="level">The <c>LogLevel</c> of your message.</param>
31 public delegate void LoggerDelegate(String message, LogLevel level);
32 ///<summary>The LoggerDelegate that will recieve WriteEntry requests.</summary>
33 static public LoggerDelegate Delegate = null;
34
35 ///<summary>
36 ///Method logging events are sent to.
37 ///</summary>
38 ///<param name="message">The message <c>String</c> to log.</param>
39 ///<param name="level">The <c>LogLevel</c> of your message.</param>
40 static public void WriteEntry(String message, LogLevel level)
41 {
42 if (Delegate != null)
43 Delegate(message, level);
44 }
45 }
46}
diff --git a/Common/XmlRpcCS/SimpleHttpRequest.cs b/Common/XmlRpcCS/SimpleHttpRequest.cs
deleted file mode 100644
index b331ce0..0000000
--- a/Common/XmlRpcCS/SimpleHttpRequest.cs
+++ /dev/null
@@ -1,234 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.IO;
32 using System.Net.Sockets;
33 using System.Collections;
34 using System.Text;
35
36 ///<summary>Very basic HTTP request handler.</summary>
37 ///<remarks>This class is designed to accept a TcpClient and treat it as an HTTP request.
38 /// It will do some basic header parsing and manage the input and output streams associated
39 /// with the request.</remarks>
40 public class SimpleHttpRequest
41 {
42 private String _httpMethod = null;
43 private String _protocol;
44 private String _filePathFile = null;
45 private String _filePathDir = null;
46 private String __filePath;
47 private TcpClient _client;
48 private StreamReader _input;
49 private StreamWriter _output;
50 private Hashtable _headers;
51
52 /// <summary>A constructor which accepts the TcpClient.</summary>
53 /// <remarks>It creates the associated input and output streams, determines the request type,
54 /// and parses the remaining HTTP header.</remarks>
55 /// <param name="client">The <c>TcpClient</c> associated with the HTTP connection.</param>
56 public SimpleHttpRequest(TcpClient client)
57 {
58 _client = client;
59
60 _output = new StreamWriter(client.GetStream() );
61 _input = new StreamReader(client.GetStream() );
62
63 GetRequestMethod();
64 GetRequestHeaders();
65 }
66
67 /// <summary>The output <c>StreamWriter</c> associated with the request.</summary>
68 public StreamWriter Output
69 {
70 get { return _output; }
71 }
72
73 /// <summary>The input <c>StreamReader</c> associated with the request.</summary>
74 public StreamReader Input
75 {
76 get { return _input; }
77 }
78
79 /// <summary>The <c>TcpClient</c> with the request.</summary>
80 public TcpClient Client
81 {
82 get { return _client; }
83 }
84
85 private String _filePath
86 {
87 get { return __filePath; }
88 set
89 {
90 __filePath = value;
91 _filePathDir = null;
92 _filePathFile = null;
93 }
94 }
95
96 /// <summary>The type of HTTP request (i.e. PUT, GET, etc.).</summary>
97 public String HttpMethod
98 {
99 get { return _httpMethod; }
100 }
101
102 /// <summary>The level of the HTTP protocol.</summary>
103 public String Protocol
104 {
105 get { return _protocol; }
106 }
107
108 /// <summary>The "path" which is part of any HTTP request.</summary>
109 public String FilePath
110 {
111 get { return _filePath; }
112 }
113
114 /// <summary>The file portion of the "path" which is part of any HTTP request.</summary>
115 public String FilePathFile
116 {
117 get
118 {
119 if (_filePathFile != null)
120 return _filePathFile;
121
122 int i = FilePath.LastIndexOf("/");
123
124 if (i == -1)
125 return "";
126
127 i++;
128 _filePathFile = FilePath.Substring(i, FilePath.Length - i);
129 return _filePathFile;
130 }
131 }
132
133 /// <summary>The directory portion of the "path" which is part of any HTTP request.</summary>
134 public String FilePathDir
135 {
136 get
137 {
138 if (_filePathDir != null)
139 return _filePathDir;
140
141 int i = FilePath.LastIndexOf("/");
142
143 if (i == -1)
144 return "";
145
146 i++;
147 _filePathDir = FilePath.Substring(0, i);
148 return _filePathDir;
149 }
150 }
151
152 private void GetRequestMethod()
153 {
154 string req = _input.ReadLine();
155 if (req == null)
156 throw new ApplicationException("Void request.");
157
158 if (0 == String.Compare("GET ", req.Substring(0, 4), true))
159 _httpMethod = "GET";
160 else if (0 == String.Compare("POST ", req.Substring(0, 5), true))
161 _httpMethod = "POST";
162 else
163 throw new InvalidOperationException("Unrecognized method in query: " + req);
164
165 req = req.TrimEnd();
166 int idx = req.IndexOf(' ') + 1;
167 if (idx >= req.Length)
168 throw new ApplicationException("What do you want?");
169
170 string page_protocol = req.Substring(idx);
171 int idx2 = page_protocol.IndexOf(' ');
172 if (idx2 == -1)
173 idx2 = page_protocol.Length;
174
175 _filePath = page_protocol.Substring(0, idx2).Trim();
176 _protocol = page_protocol.Substring(idx2).Trim();
177 }
178
179 private void GetRequestHeaders()
180 {
181 String line;
182 int idx;
183
184 _headers = new Hashtable();
185
186 while ((line = _input.ReadLine()) != "")
187 {
188 if (line == null)
189 {
190 break;
191 }
192
193 idx = line.IndexOf(':');
194 if (idx == -1 || idx == line.Length - 1)
195 {
196 Logger.WriteEntry("Malformed header line: " + line, LogLevel.Information);
197 continue;
198 }
199
200 String key = line.Substring(0, idx);
201 String value = line.Substring(idx + 1);
202
203 try
204 {
205 _headers.Add(key, value);
206 }
207 catch (Exception)
208 {
209 Logger.WriteEntry("Duplicate header key in line: " + line, LogLevel.Information);
210 }
211 }
212 }
213
214 /// <summary>
215 /// Format the object contents into a useful string representation.
216 /// </summary>
217 ///<returns><c>String</c> representation of the <c>SimpleHttpRequest</c> as the <i>HttpMethod FilePath Protocol</i>.</returns>
218 override public String ToString()
219 {
220 return HttpMethod + " " + FilePath + " " + Protocol;
221 }
222
223 /// <summary>
224 /// Close the <c>SimpleHttpRequest</c>. This flushes and closes all associated io streams.
225 /// </summary>
226 public void Close()
227 {
228 _output.Flush();
229 _output.Close();
230 _input.Close();
231 _client.Close();
232 }
233 }
234}
diff --git a/Common/XmlRpcCS/XMLRPC.csproj b/Common/XmlRpcCS/XMLRPC.csproj
deleted file mode 100644
index 61f8be0..0000000
--- a/Common/XmlRpcCS/XMLRPC.csproj
+++ /dev/null
@@ -1,138 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{8E81D43C-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>XMLRPC</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>XMLRPC</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 </ItemGroup>
70 <ItemGroup>
71 </ItemGroup>
72 <ItemGroup>
73 <Compile Include="Logger.cs">
74 <SubType>Code</SubType>
75 </Compile>
76 <Compile Include="SimpleHttpRequest.cs">
77 <SubType>Code</SubType>
78 </Compile>
79 <Compile Include="XmlRpcBoxcarRequest.cs">
80 <SubType>Code</SubType>
81 </Compile>
82 <Compile Include="XmlRpcClientProxy.cs">
83 <SubType>Code</SubType>
84 </Compile>
85 <Compile Include="XmlRpcDeserializer.cs">
86 <SubType>Code</SubType>
87 </Compile>
88 <Compile Include="XmlRpcErrorCodes.cs">
89 <SubType>Code</SubType>
90 </Compile>
91 <Compile Include="XmlRpcException.cs">
92 <SubType>Code</SubType>
93 </Compile>
94 <Compile Include="XmlRpcExposedAttribute.cs">
95 <SubType>Code</SubType>
96 </Compile>
97 <Compile Include="XmlRpcRequest.cs">
98 <SubType>Code</SubType>
99 </Compile>
100 <Compile Include="XmlRpcRequestDeserializer.cs">
101 <SubType>Code</SubType>
102 </Compile>
103 <Compile Include="XmlRpcRequestSerializer.cs">
104 <SubType>Code</SubType>
105 </Compile>
106 <Compile Include="XmlRpcResponder.cs">
107 <SubType>Code</SubType>
108 </Compile>
109 <Compile Include="XmlRpcResponse.cs">
110 <SubType>Code</SubType>
111 </Compile>
112 <Compile Include="XmlRpcResponseDeserializer.cs">
113 <SubType>Code</SubType>
114 </Compile>
115 <Compile Include="XmlRpcResponseSerializer.cs">
116 <SubType>Code</SubType>
117 </Compile>
118 <Compile Include="XmlRpcSerializer.cs">
119 <SubType>Code</SubType>
120 </Compile>
121 <Compile Include="XmlRpcServer.cs">
122 <SubType>Code</SubType>
123 </Compile>
124 <Compile Include="XmlRpcSystemObject.cs">
125 <SubType>Code</SubType>
126 </Compile>
127 <Compile Include="XmlRpcXmlTokens.cs">
128 <SubType>Code</SubType>
129 </Compile>
130 </ItemGroup>
131 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
132 <PropertyGroup>
133 <PreBuildEvent>
134 </PreBuildEvent>
135 <PostBuildEvent>
136 </PostBuildEvent>
137 </PropertyGroup>
138</Project>
diff --git a/Common/XmlRpcCS/XMLRPC.dll.build b/Common/XmlRpcCS/XMLRPC.dll.build
deleted file mode 100644
index 2eabfcd..0000000
--- a/Common/XmlRpcCS/XMLRPC.dll.build
+++ /dev/null
@@ -1,58 +0,0 @@
1<?xml version="1.0" ?>
2<project name="XMLRPC" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="XMLRPC" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="Logger.cs" />
15 <include name="SimpleHttpRequest.cs" />
16 <include name="XmlRpcBoxcarRequest.cs" />
17 <include name="XmlRpcClientProxy.cs" />
18 <include name="XmlRpcDeserializer.cs" />
19 <include name="XmlRpcErrorCodes.cs" />
20 <include name="XmlRpcException.cs" />
21 <include name="XmlRpcExposedAttribute.cs" />
22 <include name="XmlRpcRequest.cs" />
23 <include name="XmlRpcRequestDeserializer.cs" />
24 <include name="XmlRpcRequestSerializer.cs" />
25 <include name="XmlRpcResponder.cs" />
26 <include name="XmlRpcResponse.cs" />
27 <include name="XmlRpcResponseDeserializer.cs" />
28 <include name="XmlRpcResponseSerializer.cs" />
29 <include name="XmlRpcSerializer.cs" />
30 <include name="XmlRpcServer.cs" />
31 <include name="XmlRpcSystemObject.cs" />
32 <include name="XmlRpcXmlTokens.cs" />
33 </sources>
34 <references basedir="${project::get-base-directory()}">
35 <lib>
36 <include name="${project::get-base-directory()}" />
37 <include name="${project::get-base-directory()}/${build.dir}" />
38 </lib>
39 <include name="System.dll" />
40 <include name="System.Xml.dll" />
41 </references>
42 </csc>
43 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
44 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
45 <copy todir="${project::get-base-directory()}/../../bin/">
46 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
47 <include name="*.dll"/>
48 <include name="*.exe"/>
49 </fileset>
50 </copy>
51 </target>
52 <target name="clean">
53 <delete dir="${bin.dir}" failonerror="false" />
54 <delete dir="${obj.dir}" failonerror="false" />
55 </target>
56 <target name="doc" description="Creates documentation.">
57 </target>
58</project>
diff --git a/Common/XmlRpcCS/XmlRpcBoxcarRequest.cs b/Common/XmlRpcCS/XmlRpcBoxcarRequest.cs
deleted file mode 100644
index 064c165..0000000
--- a/Common/XmlRpcCS/XmlRpcBoxcarRequest.cs
+++ /dev/null
@@ -1,78 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.Collections;
32 using System.IO;
33 using System.Xml;
34 using System.Net;
35 using System.Text;
36 using System.Reflection;
37
38 /// <summary>Class that collects individual <c>XmlRpcRequest</c> objects and submits them as a <i>boxcarred</i> request.</summary>
39 /// <remarks>A boxcared request is when a number of request are collected before being sent via XML-RPC, and then are sent via
40 /// a single HTTP connection. This results in a speed up from reduced connection time. The results are then retuned collectively
41 /// as well.
42 ///</remarks>
43 /// <seealso cref="XmlRpcRequest"/>
44 public class XmlRpcBoxcarRequest : XmlRpcRequest
45 {
46 /// <summary>ArrayList to collect the requests to boxcar.</summary>
47 public IList Requests = new ArrayList();
48
49 /// <summary>Basic constructor.</summary>
50 public XmlRpcBoxcarRequest()
51 {
52 }
53
54 /// <summary>Returns the <c>String</c> "system.multiCall" which is the server method that handles boxcars.</summary>
55 public override String MethodName
56 {
57 get { return "system.multiCall"; }
58 }
59
60 /// <summary>The <c>ArrayList</c> of boxcarred <paramref>Requests</paramref> as properly formed parameters.</summary>
61 public override IList Params
62 {
63 get {
64 _params.Clear();
65 ArrayList reqArray = new ArrayList();
66 foreach (XmlRpcRequest request in Requests)
67 {
68 Hashtable requestEntry = new Hashtable();
69 requestEntry.Add(XmlRpcXmlTokens.METHOD_NAME, request.MethodName);
70 requestEntry.Add(XmlRpcXmlTokens.PARAMS, request.Params);
71 reqArray.Add(requestEntry);
72 }
73 _params.Add(reqArray);
74 return _params;
75 }
76 }
77 }
78}
diff --git a/Common/XmlRpcCS/XmlRpcClientProxy.cs b/Common/XmlRpcCS/XmlRpcClientProxy.cs
deleted file mode 100644
index e9af1ac..0000000
--- a/Common/XmlRpcCS/XmlRpcClientProxy.cs
+++ /dev/null
@@ -1,88 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.Runtime.Remoting.Proxies;
32 using System.Runtime.Remoting.Messaging;
33
34 /// <summary>This class provides support for creating local proxies of XML-RPC remote objects</summary>
35 /// <remarks>
36 /// To create a local proxy you need to create a local C# interface and then, via <i>createProxy</i>
37 /// associate that interface with a remote object at a given URL.
38 /// </remarks>
39public class XmlRpcClientProxy : RealProxy
40{
41 private String _remoteObjectName;
42 private String _url;
43 private XmlRpcRequest _client = new XmlRpcRequest();
44
45 /// <summary>Factory method to create proxies.</summary>
46 /// <remarks>
47 /// To create a local proxy you need to create a local C# interface with methods that mirror those of the server object.
48 /// Next, pass that interface into <c>createProxy</c> along with the object name and URL of the remote object and
49 /// cast the resulting object to the specifice interface.
50 /// </remarks>
51 /// <param name="remoteObjectName"><c>String</c> The name of the remote object.</param>
52 /// <param name="url"><c>String</c> The URL of the remote object.</param>
53 /// <param name="anInterface"><c>Type</c> The typeof() of a C# interface.</param>
54 /// <returns><c>Object</c> A proxy for your specified interface. Cast to appropriate type.</returns>
55 public static Object createProxy(String remoteObjectName, String url, Type anInterface)
56 {
57 return new XmlRpcClientProxy(remoteObjectName, url, anInterface).GetTransparentProxy();
58 }
59
60 private XmlRpcClientProxy(String remoteObjectName, String url, Type t) : base(t)
61 {
62 _remoteObjectName = remoteObjectName;
63 _url = url;
64 }
65
66 /// <summary>The local method dispatcher - do not invoke.</summary>
67 override public IMessage Invoke(IMessage msg)
68 {
69 IMethodCallMessage methodMessage = (IMethodCallMessage)msg;
70
71 _client.MethodName = _remoteObjectName + "." + methodMessage.MethodName;
72 _client.Params.Clear();
73 foreach (Object o in methodMessage.Args)
74 _client.Params.Add(o);
75
76 try
77 {
78 Object ret = _client.Invoke(_url);
79 return new ReturnMessage(ret,null,0,
80 methodMessage.LogicalCallContext, methodMessage);
81 }
82 catch (Exception e)
83 {
84 return new ReturnMessage(e, methodMessage);
85 }
86 }
87}
88}
diff --git a/Common/XmlRpcCS/XmlRpcDeserializer.cs b/Common/XmlRpcCS/XmlRpcDeserializer.cs
deleted file mode 100644
index bffda57..0000000
--- a/Common/XmlRpcCS/XmlRpcDeserializer.cs
+++ /dev/null
@@ -1,222 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.Collections;
32 using System.IO;
33 using System.Xml;
34 using System.Globalization;
35
36 /// <summary>Parser context, we maintain contexts in a stack to avoiding recursion. </summary>
37 struct Context
38 {
39 public String Name;
40 public Object Container;
41 }
42
43 /// <summary>Basic XML-RPC data deserializer.</summary>
44 /// <remarks>Uses <c>XmlTextReader</c> to parse the XML data. This level of the class
45 /// only handles the tokens common to both Requests and Responses. This class is not useful in and of itself
46 /// but is designed to be subclassed.</remarks>
47 public class XmlRpcDeserializer : XmlRpcXmlTokens
48 {
49 private static DateTimeFormatInfo _dateFormat = new DateTimeFormatInfo();
50
51 private Object _container;
52 private Stack _containerStack;
53
54 /// <summary>Protected reference to last text.</summary>
55 protected String _text;
56 /// <summary>Protected reference to last deserialized value.</summary>
57 protected Object _value;
58 /// <summary>Protected reference to last name field.</summary>
59 protected String _name;
60
61
62 /// <summary>Basic constructor.</summary>
63 public XmlRpcDeserializer()
64 {
65 Reset();
66 _dateFormat.FullDateTimePattern = ISO_DATETIME;
67 }
68
69 /// <summary>Static method that parses XML data into a response using the Singleton.</summary>
70 /// <param name="xmlData"><c>StreamReader</c> containing an XML-RPC response.</param>
71 /// <returns><c>Object</c> object resulting from the deserialization.</returns>
72 virtual public Object Deserialize(TextReader xmlData)
73 {
74 return null;
75 }
76
77 /// <summary>Protected method to parse a node in an XML-RPC XML stream.</summary>
78 /// <remarks>Method deals with elements common to all XML-RPC data, subclasses of
79 /// this object deal with request/response spefic elements.</remarks>
80 /// <param name="reader"><c>XmlTextReader</c> of the in progress parsing data stream.</param>
81 protected void DeserializeNode(XmlTextReader reader)
82 {
83 switch (reader.NodeType)
84 {
85 case XmlNodeType.Element:
86 if (Logger.Delegate != null)
87 Logger.WriteEntry("START " + reader.Name, LogLevel.Information);
88 switch (reader.Name)
89 {
90 case VALUE:
91 _value = null;
92 _text = null;
93 break;
94 case STRUCT:
95 PushContext();
96 _container = new Hashtable();
97 break;
98 case ARRAY:
99 PushContext();
100 _container = new ArrayList();
101 break;
102 }
103 break;
104 case XmlNodeType.EndElement:
105 if (Logger.Delegate != null)
106 Logger.WriteEntry("END " + reader.Name, LogLevel.Information);
107 switch (reader.Name)
108 {
109 case BASE64:
110 _value = Convert.FromBase64String(_text);
111 break;
112 case BOOLEAN:
113 int val = Int16.Parse(_text);
114 if (val == 0)
115 _value = false;
116 else if (val == 1)
117 _value = true;
118 break;
119 case STRING:
120 _value = _text;
121 break;
122 case DOUBLE:
123 _value = Double.Parse(_text);
124 break;
125 case INT:
126 case ALT_INT:
127 _value = Int32.Parse(_text);
128 break;
129 case DATETIME:
130#if __MONO__
131 _value = DateParse(_text);
132#else
133 _value = DateTime.ParseExact(_text, "F", _dateFormat);
134#endif
135 break;
136 case NAME:
137 _name = _text;
138 break;
139 case VALUE:
140 if (_value == null)
141 _value = _text; // some kits don't use <string> tag, they just do <value>
142
143 if ((_container != null) && (_container is IList)) // in an array? If so add value to it.
144 ((IList)_container).Add(_value);
145 break;
146 case MEMBER:
147 if ((_container != null) && (_container is IDictionary)) // in an struct? If so add value to it.
148 ((IDictionary)_container).Add(_name, _value);
149 break;
150 case ARRAY:
151 case STRUCT:
152 _value = _container;
153 PopContext();
154 break;
155 }
156 break;
157 case XmlNodeType.Text:
158 if (Logger.Delegate != null)
159 Logger.WriteEntry("Text " + reader.Value, LogLevel.Information);
160 _text = reader.Value;
161 break;
162 default:
163 break;
164 }
165 }
166
167 /// <summary>Static method that parses XML in a <c>String</c> into a
168 /// request using the Singleton.</summary>
169 /// <param name="xmlData"><c>String</c> containing an XML-RPC request.</param>
170 /// <returns><c>XmlRpcRequest</c> object resulting from the parse.</returns>
171 public Object Deserialize(String xmlData)
172 {
173 StringReader sr = new StringReader(xmlData);
174 return Deserialize(sr);
175 }
176
177 /// <summary>Pop a Context of the stack, an Array or Struct has closed.</summary>
178 private void PopContext()
179 {
180 Context c = (Context)_containerStack.Pop();
181 _container = c.Container;
182 _name = c.Name;
183 }
184
185 /// <summary>Push a Context on the stack, an Array or Struct has opened.</summary>
186 private void PushContext()
187 {
188 Context context;
189
190 context.Container = _container;
191 context.Name = _name;
192
193 _containerStack.Push(context);
194 }
195
196 /// <summary>Reset the internal state of the deserializer.</summary>
197 protected void Reset()
198 {
199 _text = null;
200 _value = null;
201 _name = null;
202 _container = null;
203 _containerStack = new Stack();
204 }
205
206#if __MONO__
207 private DateTime DateParse(String str)
208 {
209 int year = Int32.Parse(str.Substring(0,4));
210 int month = Int32.Parse(str.Substring(4,2));
211 int day = Int32.Parse(str.Substring(6,2));
212 int hour = Int32.Parse(str.Substring(9,2));
213 int min = Int32.Parse(str.Substring(12,2));
214 int sec = Int32.Parse(str.Substring(15,2));
215 return new DateTime(year,month,day,hour,min,sec);
216 }
217#endif
218
219 }
220}
221
222
diff --git a/Common/XmlRpcCS/XmlRpcErrorCodes.cs b/Common/XmlRpcCS/XmlRpcErrorCodes.cs
deleted file mode 100644
index 258ebe6..0000000
--- a/Common/XmlRpcCS/XmlRpcErrorCodes.cs
+++ /dev/null
@@ -1,78 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31
32 /// <summary>Standard XML-RPC error codes.</summary>
33 public class XmlRpcErrorCodes
34 {
35 /// <summary></summary>
36 public const int PARSE_ERROR_MALFORMED = -32700;
37 /// <summary></summary>
38 public const String PARSE_ERROR_MALFORMED_MSG = "Parse Error, not well formed";
39
40 /// <summary></summary>
41 public const int PARSE_ERROR_ENCODING = -32701;
42 /// <summary></summary>
43 public const String PARSE_ERROR_ENCODING_MSG = "Parse Error, unsupported encoding";
44
45 //
46 // -32702 ---> parse error. invalid character for encoding
47 // -32600 ---> server error. invalid xml-rpc. not conforming to spec.
48 //
49
50 /// <summary></summary>
51 public const int SERVER_ERROR_METHOD = -32601;
52 /// <summary></summary>
53 public const String SERVER_ERROR_METHOD_MSG = "Server Error, requested method not found";
54
55 /// <summary></summary>
56 public const int SERVER_ERROR_PARAMS = -32602;
57 /// <summary></summary>
58 public const String SERVER_ERROR_PARAMS_MSG = "Server Error, invalid method parameters";
59
60 //
61 // -32603 ---> server error. internal xml-rpc error
62 //
63
64 /// <summary></summary>
65 public const int APPLICATION_ERROR = -32500;
66 /// <summary></summary>
67 public const String APPLICATION_ERROR_MSG = "Application Error";
68
69 //
70 // -32400 ---> system error
71 //
72
73 /// <summary></summary>
74 public const int TRANSPORT_ERROR = -32300;
75 /// <summary></summary>
76 public const String TRANSPORT_ERROR_MSG = "Transport Layer Error";
77 }
78}
diff --git a/Common/XmlRpcCS/XmlRpcException.cs b/Common/XmlRpcCS/XmlRpcException.cs
deleted file mode 100644
index f728f90..0000000
--- a/Common/XmlRpcCS/XmlRpcException.cs
+++ /dev/null
@@ -1,66 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31
32 /// <summary>An XML-RPC Exception.</summary>
33 /// <remarks>Maps a C# exception to an XML-RPC fault. Normal exceptions
34 /// include a message so this adds the code needed by XML-RPC.</remarks>
35 public class XmlRpcException : Exception
36 {
37 private int _code;
38
39 /// <summary>Instantiate an <c>XmlRpcException</c> with a code and message.</summary>
40 /// <param name="code"><c>Int</c> faultCode associated with this exception.</param>
41 /// <param name="message"><c>String</c> faultMessage associated with this exception.</param>
42 public XmlRpcException(int code, String message)
43 : base(message)
44 {
45 _code = code;
46 }
47
48 /// <summary>The value of the faults message, i.e. the faultString.</summary>
49 public String FaultString
50 {
51 get { return Message; }
52 }
53
54 /// <summary>The value of the faults code, i.e. the faultCode.</summary>
55 public int FaultCode
56 {
57 get { return _code; }
58 }
59
60 /// <summary>Format the message to include the code.</summary>
61 override public String ToString()
62 {
63 return "Code: " + FaultCode + " Message: " + base.ToString();
64 }
65 }
66}
diff --git a/Common/XmlRpcCS/XmlRpcExposedAttribute.cs b/Common/XmlRpcCS/XmlRpcExposedAttribute.cs
deleted file mode 100644
index 261ade3..0000000
--- a/Common/XmlRpcCS/XmlRpcExposedAttribute.cs
+++ /dev/null
@@ -1,87 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.Reflection;
32
33 /// <summary>
34 /// Simple tagging attribute to indicate participation is XML-RPC exposure.
35 /// </summary>
36 /// <remarks>
37 /// If present at the class level it indicates that this class does explicitly
38 /// expose methods. If present at the method level it denotes that the method
39 /// is exposed.
40 /// </remarks>
41 [AttributeUsage(
42 AttributeTargets.Class | AttributeTargets.Method,
43 AllowMultiple = false,
44 Inherited = true
45 )]
46 public class XmlRpcExposedAttribute : Attribute
47 {
48 /// <summary>Check if <paramref>obj</paramref> is an object utilizing the XML-RPC exposed Attribute.</summary>
49 /// <param name="obj"><c>Object</c> of a class or method to check for attribute.</param>
50 /// <returns><c>Boolean</c> true if attribute present.</returns>
51 public static Boolean ExposedObject(Object obj)
52 {
53 return IsExposed(obj.GetType());
54 }
55
56 /// <summary>Check if <paramref>obj</paramref>.<paramref>methodName</paramref> is an XML-RPC exposed method.</summary>
57 /// <remarks>A method is considered to be exposed if it exists and, either, the object does not use the XmlRpcExposed attribute,
58 /// or the object does use the XmlRpcExposed attribute and the method has the XmlRpcExposed attribute as well.</remarks>
59 /// <returns><c>Boolean</c> true if the method is exposed.</returns>
60 public static Boolean ExposedMethod(Object obj, String methodName)
61 {
62 Type type = obj.GetType();
63 MethodInfo method = type.GetMethod(methodName);
64
65 if (method == null)
66 throw new MissingMethodException("Method " + methodName + " not found.");
67
68 if (!IsExposed(type))
69 return true;
70
71 return IsExposed(method);
72 }
73
74 /// <summary>Check if <paramref>mi</paramref> is XML-RPC exposed.</summary>
75 /// <param name="mi"><c>MemberInfo</c> of a class or method to check for attribute.</param>
76 /// <returns><c>Boolean</c> true if attribute present.</returns>
77 public static Boolean IsExposed(MemberInfo mi)
78 {
79 foreach (Attribute attr in mi.GetCustomAttributes(true))
80 {
81 if (attr is XmlRpcExposedAttribute)
82 return true;
83 }
84 return false;
85 }
86 }
87}
diff --git a/Common/XmlRpcCS/XmlRpcRequest.cs b/Common/XmlRpcCS/XmlRpcRequest.cs
deleted file mode 100644
index 71a0dc9..0000000
--- a/Common/XmlRpcCS/XmlRpcRequest.cs
+++ /dev/null
@@ -1,177 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.Collections;
32 using System.IO;
33 using System.Xml;
34 using System.Net;
35 using System.Text;
36 using System.Reflection;
37 using System.Net.Security;
38 using System.Security.Cryptography.X509Certificates;
39
40 internal class AcceptAllCertificatePolicy : ICertificatePolicy
41 {
42 public AcceptAllCertificatePolicy()
43 {
44 }
45
46 public bool CheckValidationResult(ServicePoint sPoint,
47 System.Security.Cryptography.X509Certificates.X509Certificate cert,
48 WebRequest wRequest, int certProb)
49 {
50 // Always accept
51 return true;
52 }
53 }
54
55 /// <summary>Class supporting the request side of an XML-RPC transaction.</summary>
56 public class XmlRpcRequest
57 {
58 private String _methodName = null;
59 private Encoding _encoding = new UTF8Encoding();
60 private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer();
61 private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer();
62
63 /// <summary><c>ArrayList</c> containing the parameters.</summary>
64 protected IList _params = null;
65
66 /// <summary>Instantiate an <c>XmlRpcRequest</c></summary>
67 public XmlRpcRequest()
68 {
69 _params = new ArrayList();
70 }
71
72 /// <summary>Instantiate an <c>XmlRpcRequest</c> for a specified method and parameters.</summary>
73 /// <param name="methodName"><c>String</c> designating the <i>object.method</i> on the server the request
74 /// should be directed to.</param>
75 /// <param name="parameters"><c>ArrayList</c> of XML-RPC type parameters to invoke the request with.</param>
76 public XmlRpcRequest(String methodName, IList parameters)
77 {
78 MethodName = methodName;
79 _params = parameters;
80 }
81
82 /// <summary><c>ArrayList</c> conntaining the parameters for the request.</summary>
83 public virtual IList Params
84 {
85 get { return _params; }
86 }
87
88 /// <summary><c>String</c> conntaining the method name, both object and method, that the request will be sent to.</summary>
89 public virtual String MethodName
90 {
91 get { return _methodName; }
92 set { _methodName = value; }
93 }
94
95 /// <summary><c>String</c> object name portion of the method name.</summary>
96 public String MethodNameObject
97 {
98 get
99 {
100 int index = MethodName.IndexOf(".");
101
102 if (index == -1)
103 return MethodName;
104
105 return MethodName.Substring(0, index);
106 }
107 }
108
109 /// <summary><c>String</c> method name portion of the object.method name.</summary>
110 public String MethodNameMethod
111 {
112 get
113 {
114 int index = MethodName.IndexOf(".");
115
116 if (index == -1)
117 return MethodName;
118
119 return MethodName.Substring(index + 1, MethodName.Length - index - 1);
120 }
121 }
122
123 /// <summary>Invoke this request on the server.</summary>
124 /// <param name="url"><c>String</c> The url of the XML-RPC server.</param>
125 /// <returns><c>Object</c> The value returned from the method invocation on the server.</returns>
126 /// <exception cref="XmlRpcException">If an exception generated on the server side.</exception>
127 public Object Invoke(String url)
128 {
129 XmlRpcResponse res = Send(url, 10000);
130
131 if (res.IsFault)
132 throw new XmlRpcException(res.FaultCode, res.FaultString);
133
134 return res.Value;
135 }
136
137 /// <summary>Send the request to the server.</summary>
138 /// <param name="url"><c>String</c> The url of the XML-RPC server.</param>
139 /// <param name="timeout">Milliseconds before the connection times out.</param>
140 /// <returns><c>XmlRpcResponse</c> The response generated.</returns>
141 public XmlRpcResponse Send(String url, int timeout)
142 {
143 // Override SSL authentication mechanisms
144 ServicePointManager.CertificatePolicy = new AcceptAllCertificatePolicy();
145
146 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
147 if (request == null)
148 throw new XmlRpcException(XmlRpcErrorCodes.TRANSPORT_ERROR,
149 XmlRpcErrorCodes.TRANSPORT_ERROR_MSG + ": Could not create request with " + url);
150 request.Method = "POST";
151 request.ContentType = "text/xml";
152 request.AllowWriteStreamBuffering = true;
153 request.Timeout = timeout;
154
155 Stream stream = request.GetRequestStream();
156 XmlTextWriter xml = new XmlTextWriter(stream, _encoding);
157 _serializer.Serialize(xml, this);
158 xml.Flush();
159 xml.Close();
160
161 HttpWebResponse response = (HttpWebResponse)request.GetResponse();
162 StreamReader input = new StreamReader(response.GetResponseStream());
163
164 XmlRpcResponse resp = (XmlRpcResponse)_deserializer.Deserialize(input);
165 input.Close();
166 response.Close();
167 return resp;
168 }
169
170 /// <summary>Produce <c>String</c> representation of the object.</summary>
171 /// <returns><c>String</c> representation of the object.</returns>
172 override public String ToString()
173 {
174 return _serializer.Serialize(this);
175 }
176 }
177}
diff --git a/Common/XmlRpcCS/XmlRpcRequestDeserializer.cs b/Common/XmlRpcCS/XmlRpcRequestDeserializer.cs
deleted file mode 100644
index 126a172..0000000
--- a/Common/XmlRpcCS/XmlRpcRequestDeserializer.cs
+++ /dev/null
@@ -1,92 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.Collections;
32 using System.Diagnostics;
33 using System.IO;
34 using System.Xml;
35
36 /// <summary>Class to deserialize XML data representing a request.</summary>
37 public class XmlRpcRequestDeserializer : XmlRpcDeserializer
38 {
39 static private XmlRpcRequestDeserializer _singleton;
40 /// <summary>A static singleton instance of this deserializer.</summary>
41 [Obsolete("This object is now thread safe, just use an instance.", false)]
42 static public XmlRpcRequestDeserializer Singleton
43 {
44 get
45 {
46 if (_singleton == null)
47 _singleton = new XmlRpcRequestDeserializer();
48
49 return _singleton;
50 }
51 }
52
53 /// <summary>Static method that parses XML data into a request using the Singleton.</summary>
54 /// <param name="xmlData"><c>StreamReader</c> containing an XML-RPC request.</param>
55 /// <returns><c>XmlRpcRequest</c> object resulting from the parse.</returns>
56 override public Object Deserialize(TextReader xmlData)
57 {
58 XmlTextReader reader = new XmlTextReader(xmlData);
59
60 XmlRpcRequest request = new XmlRpcRequest();
61 bool done = false;
62
63 lock (this)
64 {
65 Reset();
66 while (!done && reader.Read())
67 {
68 DeserializeNode(reader); // Parent parse...
69 switch (reader.NodeType)
70 {
71 case XmlNodeType.EndElement:
72 switch (reader.Name)
73 {
74 case METHOD_NAME:
75 request.MethodName = _text;
76 break;
77 case METHOD_CALL:
78 done = true;
79 break;
80 case PARAM:
81 request.Params.Add(_value);
82 _text = null;
83 break;
84 }
85 break;
86 }
87 }
88 }
89 return request;
90 }
91 }
92}
diff --git a/Common/XmlRpcCS/XmlRpcRequestSerializer.cs b/Common/XmlRpcCS/XmlRpcRequestSerializer.cs
deleted file mode 100644
index 9bf95c7..0000000
--- a/Common/XmlRpcCS/XmlRpcRequestSerializer.cs
+++ /dev/null
@@ -1,78 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.Collections;
32 using System.Xml;
33 using System.IO;
34
35 /// <summary>Class responsible for serializing an XML-RPC request.</summary>
36 /// <remarks>This class handles the request envelope, depending on <c>XmlRpcSerializer</c>
37 /// to serialize the payload.</remarks>
38 /// <seealso cref="XmlRpcSerializer"/>
39 public class XmlRpcRequestSerializer : XmlRpcSerializer
40 {
41 static private XmlRpcRequestSerializer _singleton;
42 /// <summary>A static singleton instance of this deserializer.</summary>
43 static public XmlRpcRequestSerializer Singleton
44 {
45 get
46 {
47 if (_singleton == null)
48 _singleton = new XmlRpcRequestSerializer();
49
50 return _singleton;
51 }
52 }
53
54 /// <summary>Serialize the <c>XmlRpcRequest</c> to the output stream.</summary>
55 /// <param name="output">An <c>XmlTextWriter</c> stream to write data to.</param>
56 /// <param name="obj">An <c>XmlRpcRequest</c> to serialize.</param>
57 /// <seealso cref="XmlRpcRequest"/>
58 override public void Serialize(XmlTextWriter output, Object obj)
59 {
60 XmlRpcRequest request = (XmlRpcRequest)obj;
61 output.WriteStartDocument();
62 output.WriteStartElement(METHOD_CALL);
63 output.WriteElementString(METHOD_NAME, request.MethodName);
64 output.WriteStartElement(PARAMS);
65 foreach (Object param in request.Params)
66 {
67 output.WriteStartElement(PARAM);
68 output.WriteStartElement(VALUE);
69 SerializeObject(output, param);
70 output.WriteEndElement();
71 output.WriteEndElement();
72 }
73
74 output.WriteEndElement();
75 output.WriteEndElement();
76 }
77 }
78}
diff --git a/Common/XmlRpcCS/XmlRpcResponder.cs b/Common/XmlRpcCS/XmlRpcResponder.cs
deleted file mode 100644
index 05377a2..0000000
--- a/Common/XmlRpcCS/XmlRpcResponder.cs
+++ /dev/null
@@ -1,127 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.Xml;
32 using System.Net.Sockets;
33 using System.Text;
34
35 /// <summary>The class is a container of the context of an XML-RPC dialog on the server side.</summary>
36 /// <remarks>Instances of this class maintain the context for an individual XML-RPC server
37 /// side dialog. Namely they manage an inbound deserializer and an outbound serializer. </remarks>
38 public class XmlRpcResponder
39 {
40 private XmlRpcRequestDeserializer _deserializer = new XmlRpcRequestDeserializer();
41 private XmlRpcResponseSerializer _serializer = new XmlRpcResponseSerializer();
42 private XmlRpcServer _server;
43 private TcpClient _client;
44 private SimpleHttpRequest _httpReq;
45
46 /// <summary>The SimpleHttpRequest based on the TcpClient.</summary>
47 public SimpleHttpRequest HttpReq
48 {
49 get { return _httpReq; }
50 }
51
52 /// <summary>Basic constructor.</summary>
53 /// <param name="server">XmlRpcServer that this XmlRpcResponder services.</param>
54 /// <param name="client">TcpClient with the connection.</param>
55 public XmlRpcResponder(XmlRpcServer server, TcpClient client)
56 {
57 _server = server;
58 _client = client;
59 _httpReq = new SimpleHttpRequest(_client);
60 }
61
62 /// <summary>Call close to insure proper shutdown.</summary>
63 ~XmlRpcResponder()
64 {
65 Close();
66 }
67
68 ///<summary>Respond using this responders HttpReq.</summary>
69 public void Respond()
70 {
71 Respond(HttpReq);
72 }
73
74 /// <summary>Handle an HTTP request containing an XML-RPC request.</summary>
75 /// <remarks>This method deserializes the XML-RPC request, invokes the
76 /// described method, serializes the response (or fault) and sends the XML-RPC response
77 /// back as a valid HTTP page.
78 /// </remarks>
79 /// <param name="httpReq"><c>SimpleHttpRequest</c> containing the request.</param>
80 public void Respond(SimpleHttpRequest httpReq)
81 {
82 XmlRpcRequest xmlRpcReq = (XmlRpcRequest)_deserializer.Deserialize(httpReq.Input);
83 XmlRpcResponse xmlRpcResp = new XmlRpcResponse();
84
85 try
86 {
87 xmlRpcResp.Value = _server.Invoke(xmlRpcReq);
88 }
89 catch (XmlRpcException e)
90 {
91 xmlRpcResp.SetFault(e.FaultCode, e.FaultString);
92 }
93 catch (Exception e2)
94 {
95 xmlRpcResp.SetFault(XmlRpcErrorCodes.APPLICATION_ERROR,
96 XmlRpcErrorCodes.APPLICATION_ERROR_MSG + ": " + e2.Message);
97 }
98
99 if (Logger.Delegate != null)
100 Logger.WriteEntry(xmlRpcResp.ToString(), LogLevel.Information);
101
102 XmlRpcServer.HttpHeader(httpReq.Protocol, "text/xml", 0, " 200 OK", httpReq.Output);
103 httpReq.Output.Flush();
104
105 XmlTextWriter xml = new XmlTextWriter(httpReq.Output);
106 _serializer.Serialize(xml, xmlRpcResp);
107 xml.Flush();
108 httpReq.Output.Flush();
109 }
110
111 ///<summary>Close all contained resources, both the HttpReq and client.</summary>
112 public void Close()
113 {
114 if (_httpReq != null)
115 {
116 _httpReq.Close();
117 _httpReq = null;
118 }
119
120 if (_client != null)
121 {
122 _client.Close();
123 _client = null;
124 }
125 }
126 }
127}
diff --git a/Common/XmlRpcCS/XmlRpcResponse.cs b/Common/XmlRpcCS/XmlRpcResponse.cs
deleted file mode 100644
index 414998e..0000000
--- a/Common/XmlRpcCS/XmlRpcResponse.cs
+++ /dev/null
@@ -1,112 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.Collections;
32 using System.IO;
33 using System.Xml;
34
35 /// <summary>Class designed to represent an XML-RPC response.</summary>
36 public class XmlRpcResponse
37 {
38 private Object _value;
39 /// <summary><c>bool</c> indicating if this response represents a fault.</summary>
40 public bool IsFault;
41
42 /// <summary>Basic constructor</summary>
43 public XmlRpcResponse()
44 {
45 Value = null;
46 IsFault = false;
47 }
48
49 /// <summary>Constructor for a fault.</summary>
50 /// <param name="code"><c>int</c> the numeric faultCode value.</param>
51 /// <param name="message"><c>String</c> the faultString value.</param>
52 public XmlRpcResponse(int code, String message)
53 : this()
54 {
55 SetFault(code, message);
56 }
57
58 /// <summary>The data value of the response, may be fault data.</summary>
59 public Object Value
60 {
61 get { return _value; }
62 set
63 {
64 IsFault = false;
65 _value = value;
66 }
67 }
68
69 /// <summary>The faultCode if this is a fault.</summary>
70 public int FaultCode
71 {
72 get
73 {
74 if (!IsFault)
75 return 0;
76 else
77 return (int)((Hashtable)_value)[XmlRpcXmlTokens.FAULT_CODE];
78 }
79 }
80
81 /// <summary>The faultString if this is a fault.</summary>
82 public String FaultString
83 {
84 get
85 {
86 if (!IsFault)
87 return "";
88 else
89 return (String)((Hashtable)_value)[XmlRpcXmlTokens.FAULT_STRING];
90 }
91 }
92
93 /// <summary>Set this response to be a fault.</summary>
94 /// <param name="code"><c>int</c> the numeric faultCode value.</param>
95 /// <param name="message"><c>String</c> the faultString value.</param>
96 public void SetFault(int code, String message)
97 {
98 Hashtable fault = new Hashtable();
99 fault.Add("faultCode", code);
100 fault.Add("faultString", message);
101 Value = fault;
102 IsFault = true;
103 }
104
105 /// <summary>Form a useful string representation of the object, in this case the XML response.</summary>
106 /// <returns><c>String</c> The XML serialized XML-RPC response.</returns>
107 override public String ToString()
108 {
109 return XmlRpcResponseSerializer.Singleton.Serialize(this);
110 }
111 }
112}
diff --git a/Common/XmlRpcCS/XmlRpcResponseDeserializer.cs b/Common/XmlRpcCS/XmlRpcResponseDeserializer.cs
deleted file mode 100644
index 46c5742..0000000
--- a/Common/XmlRpcCS/XmlRpcResponseDeserializer.cs
+++ /dev/null
@@ -1,92 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.Collections;
32 using System.IO;
33 using System.Xml;
34
35 /// <summary>Class to deserialize XML data representing a response.</summary>
36 public class XmlRpcResponseDeserializer : XmlRpcDeserializer
37 {
38 static private XmlRpcResponseDeserializer _singleton;
39 /// <summary>A static singleton instance of this deserializer.</summary>
40 [Obsolete("This object is now thread safe, just use an instance.", false)]
41 static public XmlRpcResponseDeserializer Singleton
42 {
43 get
44 {
45 if (_singleton == null)
46 _singleton = new XmlRpcResponseDeserializer();
47
48 return _singleton;
49 }
50 }
51
52 /// <summary>Static method that parses XML data into a response using the Singleton.</summary>
53 /// <param name="xmlData"><c>StreamReader</c> containing an XML-RPC response.</param>
54 /// <returns><c>XmlRpcResponse</c> object resulting from the parse.</returns>
55 override public Object Deserialize(TextReader xmlData)
56 {
57 XmlTextReader reader = new XmlTextReader(xmlData);
58 XmlRpcResponse response = new XmlRpcResponse();
59 bool done = false;
60
61 lock (this)
62 {
63 Reset();
64
65 while (!done && reader.Read())
66 {
67 DeserializeNode(reader); // Parent parse...
68 switch (reader.NodeType)
69 {
70 case XmlNodeType.EndElement:
71 switch (reader.Name)
72 {
73 case FAULT:
74 response.Value = _value;
75 response.IsFault = true;
76 break;
77 case PARAM:
78 response.Value = _value;
79 _value = null;
80 _text = null;
81 break;
82 }
83 break;
84 default:
85 break;
86 }
87 }
88 }
89 return response;
90 }
91 }
92}
diff --git a/Common/XmlRpcCS/XmlRpcResponseSerializer.cs b/Common/XmlRpcCS/XmlRpcResponseSerializer.cs
deleted file mode 100644
index 5ee4954..0000000
--- a/Common/XmlRpcCS/XmlRpcResponseSerializer.cs
+++ /dev/null
@@ -1,84 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.Collections;
32 using System.Xml;
33
34 /// <summary>Class responsible for serializing an XML-RPC response.</summary>
35 /// <remarks>This class handles the response envelope, depending on XmlRpcSerializer
36 /// to serialize the payload.</remarks>
37 /// <seealso cref="XmlRpcSerializer"/>
38 public class XmlRpcResponseSerializer : XmlRpcSerializer
39 {
40 static private XmlRpcResponseSerializer _singleton;
41 /// <summary>A static singleton instance of this deserializer.</summary>
42 static public XmlRpcResponseSerializer Singleton
43 {
44 get
45 {
46 if (_singleton == null)
47 _singleton = new XmlRpcResponseSerializer();
48
49 return _singleton;
50 }
51 }
52
53 /// <summary>Serialize the <c>XmlRpcResponse</c> to the output stream.</summary>
54 /// <param name="output">An <c>XmlTextWriter</c> stream to write data to.</param>
55 /// <param name="obj">An <c>Object</c> to serialize.</param>
56 /// <seealso cref="XmlRpcResponse"/>
57 override public void Serialize(XmlTextWriter output, Object obj)
58 {
59 XmlRpcResponse response = (XmlRpcResponse)obj;
60
61 output.WriteStartDocument();
62 output.WriteStartElement(METHOD_RESPONSE);
63
64 if (response.IsFault)
65 output.WriteStartElement(FAULT);
66 else
67 {
68 output.WriteStartElement(PARAMS);
69 output.WriteStartElement(PARAM);
70 }
71
72 output.WriteStartElement(VALUE);
73
74 SerializeObject(output, response.Value);
75
76 output.WriteEndElement();
77
78 output.WriteEndElement();
79 if (!response.IsFault)
80 output.WriteEndElement();
81 output.WriteEndElement();
82 }
83 }
84}
diff --git a/Common/XmlRpcCS/XmlRpcSerializer.cs b/Common/XmlRpcCS/XmlRpcSerializer.cs
deleted file mode 100644
index b3b9af3..0000000
--- a/Common/XmlRpcCS/XmlRpcSerializer.cs
+++ /dev/null
@@ -1,143 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.Collections;
32 using System.IO;
33 using System.Xml;
34 using System.Text;
35
36 /// <summary>Base class of classes serializing data to XML-RPC's XML format.</summary>
37 /// <remarks>This class handles the basic type conversions like Integer to &lt;i4&gt;. </remarks>
38 /// <seealso cref="XmlRpcXmlTokens"/>
39 public class XmlRpcSerializer : XmlRpcXmlTokens
40 {
41
42 /// <summary>Serialize the <c>XmlRpcRequest</c> to the output stream.</summary>
43 /// <param name="output">An <c>XmlTextWriter</c> stream to write data to.</param>
44 /// <param name="obj">An <c>Object</c> to serialize.</param>
45 /// <seealso cref="XmlRpcRequest"/>
46 virtual public void Serialize(XmlTextWriter output, Object obj)
47 {
48 }
49
50 /// <summary>Serialize the <c>XmlRpcRequest</c> to a String.</summary>
51 /// <remarks>Note this may represent a real memory hog for a large request.</remarks>
52 /// <param name="obj">An <c>Object</c> to serialize.</param>
53 /// <returns><c>String</c> containing XML-RPC representation of the request.</returns>
54 /// <seealso cref="XmlRpcRequest"/>
55 public String Serialize(Object obj)
56 {
57 using (MemoryStream memStream = new MemoryStream(4096))
58 {
59 XmlTextWriter xml = new XmlTextWriter( memStream, null );
60 xml.Formatting = Formatting.Indented;
61 xml.Indentation = 4;
62 Serialize(xml, obj);
63 xml.Flush();
64
65 byte[] resultBytes = memStream.ToArray();
66
67 UTF8Encoding encoder = new UTF8Encoding();
68 String returns = encoder.GetString( resultBytes, 0, resultBytes.Length );
69 xml.Close();
70 return returns;
71 }
72 }
73
74 /// <remarks>Serialize the object to the output stream.</remarks>
75 /// <param name="output">An <c>XmlTextWriter</c> stream to write data to.</param>
76 /// <param name="obj">An <c>Object</c> to serialize.</param>
77 public void SerializeObject(XmlTextWriter output, Object obj)
78 {
79 if (obj == null)
80 return;
81
82 if (obj is byte[])
83 {
84 byte[] ba = (byte[])obj;
85 output.WriteStartElement(BASE64);
86 output.WriteBase64(ba, 0, ba.Length);
87 output.WriteEndElement();
88 }
89 else if (obj is String)
90 {
91 output.WriteElementString(STRING, obj.ToString());
92 }
93 else if (obj is Int32)
94 {
95 output.WriteElementString(INT, obj.ToString());
96 }
97 else if (obj is DateTime)
98 {
99 output.WriteElementString(DATETIME, ((DateTime)obj).ToString(ISO_DATETIME));
100 }
101 else if (obj is Double)
102 {
103 output.WriteElementString(DOUBLE, obj.ToString());
104 }
105 else if (obj is Boolean)
106 {
107 output.WriteElementString(BOOLEAN, ((((Boolean)obj) == true) ? "1" : "0"));
108 }
109 else if (obj is IList)
110 {
111 output.WriteStartElement(ARRAY);
112 output.WriteStartElement(DATA);
113 if (((ArrayList)obj).Count > 0)
114 {
115 foreach (Object member in ((IList)obj))
116 {
117 output.WriteStartElement(VALUE);
118 SerializeObject(output, member);
119 output.WriteEndElement();
120 }
121 }
122 output.WriteEndElement();
123 output.WriteEndElement();
124 }
125 else if (obj is IDictionary)
126 {
127 IDictionary h = (IDictionary)obj;
128 output.WriteStartElement(STRUCT);
129 foreach (String key in h.Keys)
130 {
131 output.WriteStartElement(MEMBER);
132 output.WriteElementString(NAME, key);
133 output.WriteStartElement(VALUE);
134 SerializeObject(output, h[key]);
135 output.WriteEndElement();
136 output.WriteEndElement();
137 }
138 output.WriteEndElement();
139 }
140
141 }
142 }
143}
diff --git a/Common/XmlRpcCS/XmlRpcServer.cs b/Common/XmlRpcCS/XmlRpcServer.cs
deleted file mode 100644
index 6d1f33a..0000000
--- a/Common/XmlRpcCS/XmlRpcServer.cs
+++ /dev/null
@@ -1,266 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.Collections;
32 using System.IO;
33 using System.Net;
34 using System.Net.Sockets;
35 using System.Text;
36 using System.Threading;
37 using System.Xml;
38
39 /// <summary>A restricted HTTP server for use with XML-RPC.</summary>
40 /// <remarks>It only handles POST requests, and only POSTs representing XML-RPC calls.
41 /// In addition to dispatching requests it also provides a registry for request handlers.
42 /// </remarks>
43 public class XmlRpcServer : IEnumerable
44 {
45#pragma warning disable 0414 // disable "private field assigned but not used"
46 const int RESPONDER_COUNT = 10;
47 private TcpListener _myListener;
48 private int _port;
49 private IPAddress _address;
50 private IDictionary _handlers;
51 private XmlRpcSystemObject _system;
52 private WaitCallback _wc;
53#pragma warning restore 0414
54
55 ///<summary>Constructor with port and address.</summary>
56 ///<remarks>This constructor sets up a TcpListener listening on the
57 ///given port and address. It also calls a Thread on the method StartListen().</remarks>
58 ///<param name="address"><c>IPAddress</c> value of the address to listen on.</param>
59 ///<param name="port"><c>Int</c> value of the port to listen on.</param>
60 public XmlRpcServer(IPAddress address, int port)
61 {
62 _port = port;
63 _address = address;
64 _handlers = new Hashtable();
65 _system = new XmlRpcSystemObject(this);
66 _wc = new WaitCallback(WaitCallback);
67 }
68
69 ///<summary>Basic constructor.</summary>
70 ///<remarks>This constructor sets up a TcpListener listening on the
71 ///given port. It also calls a Thread on the method StartListen(). IPAddress.Any
72 ///is assumed as the address here.</remarks>
73 ///<param name="port"><c>Int</c> value of the port to listen on.</param>
74 public XmlRpcServer(int port) : this(IPAddress.Any, port) { }
75
76 /// <summary>Start the server.</summary>
77 public void Start()
78 {
79 try
80 {
81 Stop();
82 //start listing on the given port
83 // IPAddress addr = IPAddress.Parse("127.0.0.1");
84 lock (this)
85 {
86 _myListener = new TcpListener(IPAddress.Any, _port);
87 _myListener.Start();
88 //start the thread which calls the method 'StartListen'
89 Thread th = new Thread(new ThreadStart(StartListen));
90 th.Start();
91 }
92 }
93 catch (Exception e)
94 {
95 Logger.WriteEntry("An Exception Occurred while Listening :" + e.ToString(), LogLevel.Error);
96 }
97 }
98
99 /// <summary>Stop the server.</summary>
100 public void Stop()
101 {
102 try
103 {
104 if (_myListener != null)
105 {
106 lock (this)
107 {
108 _myListener.Stop();
109 _myListener = null;
110 }
111 }
112 }
113 catch (Exception e)
114 {
115 Logger.WriteEntry("An Exception Occurred while stopping :" +
116 e.ToString(), LogLevel.Error);
117 }
118 }
119
120 /// <summary>Get an enumeration of my XML-RPC handlers.</summary>
121 /// <returns><c>IEnumerable</c> the handler enumeration.</returns>
122 public IEnumerator GetEnumerator()
123 {
124 return _handlers.GetEnumerator();
125 }
126
127 /// <summary>Retrieve a handler by name.</summary>
128 /// <param name="name"><c>String</c> naming a handler</param>
129 /// <returns><c>Object</c> that is the handler.</returns>
130 public Object this[String name]
131 {
132 get { return _handlers[name]; }
133 }
134
135 ///<summary>
136 ///This method Accepts new connections and dispatches them when appropriate.
137 ///</summary>
138 public void StartListen()
139 {
140 while (true && _myListener != null)
141 {
142 //Accept a new connection
143 XmlRpcResponder responder = new XmlRpcResponder(this, _myListener.AcceptTcpClient());
144 ThreadPool.QueueUserWorkItem(_wc, responder);
145 }
146 }
147
148
149 ///<summary>
150 ///Add an XML-RPC handler object by name.
151 ///</summary>
152 ///<param name="name"><c>String</c> XML-RPC dispatch name of this object.</param>
153 ///<param name="obj"><c>Object</c> The object that is the XML-RPC handler.</param>
154 public void Add(String name, Object obj)
155 {
156 _handlers.Add(name, obj);
157 }
158
159 ///<summary>Return a C# object.method name for and XML-RPC object.method name pair.</summary>
160 ///<param name="methodName">The XML-RPC object.method.</param>
161 ///<returns><c>String</c> of form object.method for the underlying C# method.</returns>
162 public String MethodName(String methodName)
163 {
164 int dotAt = methodName.LastIndexOf('.');
165
166 if (dotAt == -1)
167 {
168 throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_METHOD,
169 XmlRpcErrorCodes.SERVER_ERROR_METHOD_MSG + ": Bad method name " + methodName);
170 }
171
172 String objectName = methodName.Substring(0, dotAt);
173 Object target = _handlers[objectName];
174
175 if (target == null)
176 {
177 throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_METHOD,
178 XmlRpcErrorCodes.SERVER_ERROR_METHOD_MSG + ": Object " + objectName + " not found");
179 }
180
181 return target.GetType().FullName + "." + methodName.Substring(dotAt + 1);
182 }
183
184 ///<summary>Invoke a method described in a request.</summary>
185 ///<param name="req"><c>XmlRpcRequest</c> containing a method descriptions.</param>
186 /// <seealso cref="XmlRpcSystemObject.Invoke"/>
187 /// <seealso cref="XmlRpcServer.Invoke(String,String,IList)"/>
188 public Object Invoke(XmlRpcRequest req)
189 {
190 return Invoke(req.MethodNameObject, req.MethodNameMethod, req.Params);
191 }
192
193 ///<summary>Invoke a method on a named handler.</summary>
194 ///<param name="objectName"><c>String</c> The name of the handler.</param>
195 ///<param name="methodName"><c>String</c> The name of the method to invoke on the handler.</param>
196 ///<param name="parameters"><c>IList</c> The parameters to invoke the method with.</param>
197 /// <seealso cref="XmlRpcSystemObject.Invoke"/>
198 public Object Invoke(String objectName, String methodName, IList parameters)
199 {
200 Object target = _handlers[objectName];
201
202 if (target == null)
203 {
204 throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_METHOD,
205 XmlRpcErrorCodes.SERVER_ERROR_METHOD_MSG + ": Object " + objectName + " not found");
206 }
207
208 return XmlRpcSystemObject.Invoke(target, methodName, parameters);
209 }
210
211 /// <summary>The method the thread pool invokes when a thread is available to handle an HTTP request.</summary>
212 /// <param name="responder">TcpClient from the socket accept.</param>
213 public void WaitCallback(object responder)
214 {
215 XmlRpcResponder resp = (XmlRpcResponder)responder;
216
217 if (resp.HttpReq.HttpMethod == "POST")
218 {
219 try
220 {
221 resp.Respond();
222 }
223 catch (Exception e)
224 {
225 Logger.WriteEntry("Failed on post: " + e, LogLevel.Error);
226 }
227 }
228 else
229 {
230 Logger.WriteEntry("Only POST methods are supported: " + resp.HttpReq.HttpMethod +
231 " ignored", LogLevel.Error);
232 }
233
234 resp.Close();
235 }
236
237 /// <summary>
238 /// This function send the Header Information to the client (Browser)
239 /// </summary>
240 /// <param name="sHttpVersion">HTTP Version</param>
241 /// <param name="sMIMEHeader">Mime Type</param>
242 /// <param name="iTotBytes">Total Bytes to be sent in the body</param>
243 /// <param name="sStatusCode"></param>
244 /// <param name="output">Socket reference</param>
245 static public void HttpHeader(string sHttpVersion, string sMIMEHeader, long iTotBytes, string sStatusCode, TextWriter output)
246 {
247 String sBuffer = "";
248
249 // if Mime type is not provided set default to text/html
250 if (sMIMEHeader.Length == 0)
251 {
252 sMIMEHeader = "text/html"; // Default Mime Type is text/html
253 }
254
255 sBuffer += sHttpVersion + sStatusCode + "\r\n";
256 sBuffer += "Connection: close\r\n";
257 if (iTotBytes > 0)
258 sBuffer += "Content-Length: " + iTotBytes + "\r\n";
259 sBuffer += "Server: XmlRpcServer \r\n";
260 sBuffer += "Content-Type: " + sMIMEHeader + "\r\n";
261 sBuffer += "\r\n";
262
263 output.Write(sBuffer);
264 }
265 }
266}
diff --git a/Common/XmlRpcCS/XmlRpcSystemObject.cs b/Common/XmlRpcCS/XmlRpcSystemObject.cs
deleted file mode 100644
index 4055d29..0000000
--- a/Common/XmlRpcCS/XmlRpcSystemObject.cs
+++ /dev/null
@@ -1,279 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31 using System.Collections;
32 using System.Reflection;
33
34 /// <summary> XML-RPC System object implementation of extended specifications.</summary>
35 [XmlRpcExposed]
36 public class XmlRpcSystemObject
37 {
38 private XmlRpcServer _server;
39 static private IDictionary _methodHelp = new Hashtable();
40
41 /// <summary>Static <c>IDictionary</c> to hold mappings of method name to associated documentation String</summary>
42 static public IDictionary MethodHelp
43 {
44 get { return _methodHelp; }
45 }
46
47 /// <summary>Constructor.</summary>
48 /// <param name="server"><c>XmlRpcServer</c> server to be the system object for.</param>
49 public XmlRpcSystemObject(XmlRpcServer server)
50 {
51 _server = server;
52 server.Add("system", this);
53 _methodHelp.Add(this.GetType().FullName + ".methodHelp", "Return a string description.");
54 }
55
56 /// <summary>Invoke a method on a given object.</summary>
57 /// <remarks>Using reflection, and respecting the <c>XmlRpcExposed</c> attribute,
58 /// invoke the <paramref>methodName</paramref> method on the <paramref>target</paramref>
59 /// instance with the <paramref>parameters</paramref> provided. All this packages other <c>Invoke</c> methods
60 /// end up calling this.</remarks>
61 /// <returns><c>Object</c> the value the invoked method returns.</returns>
62 /// <exception cref="XmlRpcException">If method does not exist, is not exposed, parameters invalid, or invocation
63 /// results in an exception. Note, the <c>XmlRpcException.Code</c> will indicate cause.</exception>
64 static public Object Invoke(Object target, String methodName, IList parameters)
65 {
66 if (target == null)
67 throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_METHOD,
68 XmlRpcErrorCodes.SERVER_ERROR_METHOD_MSG + ": Invalid target object.");
69
70 Type type = target.GetType();
71 MethodInfo method = type.GetMethod(methodName);
72
73 try
74 {
75 if (!XmlRpcExposedAttribute.ExposedMethod(target, methodName))
76 throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_METHOD,
77 XmlRpcErrorCodes.SERVER_ERROR_METHOD_MSG + ": Method " + methodName + " is not exposed.");
78 }
79 catch (MissingMethodException me)
80 {
81 throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_METHOD,
82 XmlRpcErrorCodes.SERVER_ERROR_METHOD_MSG + ": " + me.Message);
83 }
84
85 Object[] args = new Object[parameters.Count];
86
87 int index = 0;
88 foreach (Object arg in parameters)
89 {
90 args[index] = arg;
91 index++;
92 }
93
94 try
95 {
96 Object retValue = method.Invoke(target, args);
97 if (retValue == null)
98 throw new XmlRpcException(XmlRpcErrorCodes.APPLICATION_ERROR,
99 XmlRpcErrorCodes.APPLICATION_ERROR_MSG + ": Method returned NULL.");
100 return retValue;
101 }
102 catch (XmlRpcException e)
103 {
104 throw e;
105 }
106 catch (ArgumentException ae)
107 {
108 Logger.WriteEntry(XmlRpcErrorCodes.SERVER_ERROR_PARAMS_MSG + ": " + ae.Message,
109 LogLevel.Information);
110 String call = methodName + "( ";
111 foreach (Object o in args)
112 {
113 call += o.GetType().Name;
114 call += " ";
115 }
116 call += ")";
117 throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_PARAMS,
118 XmlRpcErrorCodes.SERVER_ERROR_PARAMS_MSG + ": Arguement type mismatch invoking " + call);
119 }
120 catch (TargetParameterCountException tpce)
121 {
122 Logger.WriteEntry(XmlRpcErrorCodes.SERVER_ERROR_PARAMS_MSG + ": " + tpce.Message,
123 LogLevel.Information);
124 throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_PARAMS,
125 XmlRpcErrorCodes.SERVER_ERROR_PARAMS_MSG + ": Arguement count mismatch invoking " + methodName);
126 }
127 catch (TargetInvocationException tie)
128 {
129 throw new XmlRpcException(XmlRpcErrorCodes.APPLICATION_ERROR,
130 XmlRpcErrorCodes.APPLICATION_ERROR_MSG + " Invoked method " + methodName + ": " + tie.Message);
131 }
132 }
133
134 /// <summary>List methods available on all handlers of this server.</summary>
135 /// <returns><c>IList</c> An array of <c>Strings</c>, each <c>String</c> will have form "object.method".</returns>
136 [XmlRpcExposed]
137 public IList listMethods()
138 {
139 IList methods = new ArrayList();
140 Boolean considerExposure;
141
142 foreach (DictionaryEntry handlerEntry in _server)
143 {
144 considerExposure = XmlRpcExposedAttribute.IsExposed(handlerEntry.Value.GetType());
145
146 foreach (MemberInfo mi in handlerEntry.Value.GetType().GetMembers())
147 {
148 if (mi.MemberType != MemberTypes.Method)
149 continue;
150
151 if (!((MethodInfo)mi).IsPublic)
152 continue;
153
154 if (considerExposure && !XmlRpcExposedAttribute.IsExposed(mi))
155 continue;
156
157 methods.Add(handlerEntry.Key + "." + mi.Name);
158 }
159 }
160
161 return methods;
162 }
163
164 /// <summary>Given a method name return the possible signatures for it.</summary>
165 /// <param name="name"><c>String</c> The object.method name to look up.</param>
166 /// <returns><c>IList</c> Of arrays of signatures.</returns>
167 [XmlRpcExposed]
168 public IList methodSignature(String name)
169 {
170 IList signatures = new ArrayList();
171 int index = name.IndexOf('.');
172
173 if (index < 0)
174 return signatures;
175
176 String oName = name.Substring(0, index);
177 Object obj = _server[oName];
178
179 if (obj == null)
180 return signatures;
181
182 MemberInfo[] mi = obj.GetType().GetMember(name.Substring(index + 1));
183
184 if (mi == null || mi.Length != 1) // for now we want a single signature
185 return signatures;
186
187 MethodInfo method;
188
189 try
190 {
191 method = (MethodInfo)mi[0];
192 }
193 catch (Exception e)
194 {
195 Logger.WriteEntry("Attempted methodSignature call on " + mi[0] + " caused: " + e,
196 LogLevel.Information);
197 return signatures;
198 }
199
200 if (!method.IsPublic)
201 return signatures;
202
203 IList signature = new ArrayList();
204 signature.Add(method.ReturnType.Name);
205
206 foreach (ParameterInfo param in method.GetParameters())
207 {
208 signature.Add(param.ParameterType.Name);
209 }
210
211
212 signatures.Add(signature);
213
214 return signatures;
215 }
216
217 /// <summary>Help for given method signature. Not implemented yet.</summary>
218 /// <param name="name"><c>String</c> The object.method name to look up.</param>
219 /// <returns><c>String</c> help text. Rich HTML text.</returns>
220 [XmlRpcExposed]
221 public String methodHelp(String name)
222 {
223 String help = null;
224
225 try
226 {
227 help = (String)_methodHelp[_server.MethodName(name)];
228 }
229 catch (XmlRpcException e)
230 {
231 throw e;
232 }
233 catch (Exception) { /* ignored */ };
234
235 if (help == null)
236 help = "No help available for: " + name;
237
238 return help;
239 }
240
241 /// <summary>Boxcarring support method.</summary>
242 /// <param name="calls"><c>IList</c> of calls</param>
243 /// <returns><c>ArrayList</c> of results/faults.</returns>
244 [XmlRpcExposed]
245 public IList multiCall(IList calls)
246 {
247 IList responses = new ArrayList();
248 XmlRpcResponse fault = new XmlRpcResponse();
249
250 foreach (IDictionary call in calls)
251 {
252 try
253 {
254 XmlRpcRequest req = new XmlRpcRequest((String)call[XmlRpcXmlTokens.METHOD_NAME],
255 (ArrayList)call[XmlRpcXmlTokens.PARAMS]);
256 Object results = _server.Invoke(req);
257 IList response = new ArrayList();
258 response.Add(results);
259 responses.Add(response);
260 }
261 catch (XmlRpcException e)
262 {
263 fault.SetFault(e.FaultCode, e.FaultString);
264 responses.Add(fault.Value);
265 }
266 catch (Exception e2)
267 {
268 fault.SetFault(XmlRpcErrorCodes.APPLICATION_ERROR,
269 XmlRpcErrorCodes.APPLICATION_ERROR_MSG + ": " + e2.Message);
270 responses.Add(fault.Value);
271 }
272 }
273
274 return responses;
275 }
276
277 }
278}
279
diff --git a/Common/XmlRpcCS/XmlRpcXmlTokens.cs b/Common/XmlRpcCS/XmlRpcXmlTokens.cs
deleted file mode 100644
index 27447bb..0000000
--- a/Common/XmlRpcCS/XmlRpcXmlTokens.cs
+++ /dev/null
@@ -1,103 +0,0 @@
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*/
28namespace Nwc.XmlRpc
29{
30 using System;
31
32 /// <summary>Class collecting <c>String</c> tokens that are part of XML-RPC files.</summary>
33 public class XmlRpcXmlTokens
34 {
35 /// <summary>C# formatting string to describe an ISO 8601 date.</summary>
36 public const String ISO_DATETIME = "yyyyMMdd\\THH\\:mm\\:ss";
37 /// <summary>Base64 field indicator.</summary>
38 /// <remarks>Corresponds to the &lt;base64&gt; tag.</remarks>
39 public const String BASE64 = "base64";
40 /// <summary>String field indicator.</summary>
41 /// <remarks>Corresponds to the &lt;string&gt; tag.</remarks>
42 public const String STRING = "string";
43 /// <summary>Integer field integer.</summary>
44 /// <remarks>Corresponds to the &lt;i4&gt; tag.</remarks>
45 public const String INT = "i4";
46 /// <summary>Alternate integer field indicator.</summary>
47 /// <remarks>Corresponds to the &lt;int&gt; tag.</remarks>
48 public const String ALT_INT = "int";
49 /// <summary>Date field indicator.</summary>
50 /// <remarks>Corresponds to the &lt;dateTime.iso8601&gt; tag.</remarks>
51 public const String DATETIME = "dateTime.iso8601";
52 /// <summary>Boolean field indicator.</summary>
53 /// <remarks>Corresponds to the &lt;boolean&gt; tag.</remarks>
54 public const String BOOLEAN = "boolean";
55 /// <summary>Value token.</summary>
56 /// <remarks>Corresponds to the &lt;value&gt; tag.</remarks>
57 public const String VALUE = "value";
58 /// <summary>Name token.</summary>
59 /// <remarks>Corresponds to the &lt;name&gt; tag.</remarks>
60 public const String NAME = "name";
61 /// <summary>Array field indicator..</summary>
62 /// <remarks>Corresponds to the &lt;array&gt; tag.</remarks>
63 public const String ARRAY = "array";
64 /// <summary>Data token.</summary>
65 /// <remarks>Corresponds to the &lt;data&gt; tag.</remarks>
66 public const String DATA = "data";
67 /// <summary>Member token.</summary>
68 /// <remarks>Corresponds to the &lt;member&gt; tag.</remarks>
69 public const String MEMBER = "member";
70 /// <summary>Stuct field indicator.</summary>
71 /// <remarks>Corresponds to the &lt;struct&gt; tag.</remarks>
72 public const String STRUCT = "struct";
73 /// <summary>Double field indicator.</summary>
74 /// <remarks>Corresponds to the &lt;double&gt; tag.</remarks>
75 public const String DOUBLE = "double";
76 /// <summary>Param token.</summary>
77 /// <remarks>Corresponds to the &lt;param&gt; tag.</remarks>
78 public const String PARAM = "param";
79 /// <summary>Params token.</summary>
80 /// <remarks>Corresponds to the &lt;params&gt; tag.</remarks>
81 public const String PARAMS = "params";
82 /// <summary>MethodCall token.</summary>
83 /// <remarks>Corresponds to the &lt;methodCall&gt; tag.</remarks>
84 public const String METHOD_CALL = "methodCall";
85 /// <summary>MethodName token.</summary>
86 /// <remarks>Corresponds to the &lt;methodName&gt; tag.</remarks>
87 public const String METHOD_NAME = "methodName";
88 /// <summary>MethodResponse token</summary>
89 /// <remarks>Corresponds to the &lt;methodResponse&gt; tag.</remarks>
90 public const String METHOD_RESPONSE = "methodResponse";
91 /// <summary>Fault response token.</summary>
92 /// <remarks>Corresponds to the &lt;fault&gt; tag.</remarks>
93 public const String FAULT = "fault";
94 /// <summary>FaultCode token.</summary>
95 /// <remarks>Corresponds to the &lt;faultCode&gt; tag.</remarks>
96 public const String FAULT_CODE = "faultCode";
97 /// <summary>FaultString token.</summary>
98 /// <remarks>Corresponds to the &lt;faultString&gt; tag.</remarks>
99 public const String FAULT_STRING = "faultString";
100 }
101}
102
103