brought zircon branch into trunk
parent
b83efd4947
commit
7daa3955bc
134
OGS.sql
134
OGS.sql
|
@ -1,134 +0,0 @@
|
||||||
-- phpMyAdmin SQL Dump
|
|
||||||
-- version 2.6.3-pl1
|
|
||||||
-- http://www.phpmyadmin.net
|
|
||||||
--
|
|
||||||
-- Host: 127.0.0.1
|
|
||||||
-- Generation Time: Feb 16, 2007 at 09:54 PM
|
|
||||||
-- Server version: 4.0.23
|
|
||||||
-- PHP Version: 4.4.0
|
|
||||||
--
|
|
||||||
-- Database: `OGS`
|
|
||||||
--
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `Grid_settings`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `Grid_settings`;
|
|
||||||
CREATE TABLE IF NOT EXISTS `Grid_settings` (
|
|
||||||
`Setting` text NOT NULL,
|
|
||||||
`value` text NOT NULL
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `Grid_settings`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `Grid_settings` (`Setting`, `value`) VALUES ('highest_LLUUID', '51AEFF430000000000000000000002fd');
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `foreign_profiles`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `foreign_profiles`;
|
|
||||||
CREATE TABLE IF NOT EXISTS `foreign_profiles` (
|
|
||||||
`userprofile_LLUUID` varchar(32) NOT NULL default '',
|
|
||||||
`foreigngrid` text NOT NULL,
|
|
||||||
`profile_firstname` text NOT NULL,
|
|
||||||
`profile_lastname` text NOT NULL,
|
|
||||||
`profile_passwdmd5` text NOT NULL,
|
|
||||||
`homesim_ip` text NOT NULL,
|
|
||||||
`homesim_port` int(11) NOT NULL default '0',
|
|
||||||
`homeasset_url` text NOT NULL,
|
|
||||||
`homeuser_url` text NOT NULL,
|
|
||||||
`look_at` text NOT NULL,
|
|
||||||
`region_handle` text NOT NULL,
|
|
||||||
`position` text NOT NULL,
|
|
||||||
PRIMARY KEY (`userprofile_LLUUID`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `foreign_profiles`
|
|
||||||
--
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `local_user_profiles`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `local_user_profiles`;
|
|
||||||
CREATE TABLE IF NOT EXISTS `local_user_profiles` (
|
|
||||||
`userprofile_LLUUID` varchar(32) NOT NULL default '',
|
|
||||||
`profile_firstname` text NOT NULL,
|
|
||||||
`profile_lastname` text NOT NULL,
|
|
||||||
`profile_passwdmd5` text NOT NULL,
|
|
||||||
`homesim_ip` text NOT NULL,
|
|
||||||
`homesim_port` int(11) NOT NULL default '0',
|
|
||||||
`homeasset_url` text NOT NULL,
|
|
||||||
`look_at` text NOT NULL,
|
|
||||||
`region_handle` text NOT NULL,
|
|
||||||
`position` text NOT NULL,
|
|
||||||
PRIMARY KEY (`userprofile_LLUUID`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `local_user_profiles`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `local_user_profiles` (`userprofile_LLUUID`, `profile_firstname`, `profile_lastname`, `profile_passwdmd5`, `homesim_ip`, `homesim_port`, `homeasset_url`, `look_at`, `region_handle`, `position`) VALUES ('51AEFF43000000000000000000000100', 'Test', 'User', '$1$098f6bcd4621d373cade4e832627b4f6', '127.0.0.1', 1000, 'http://dummyassetserver.net/', 'r-0.57343, r-0.819255,r0', 'r255232,254976', 'r41.6589, r100.8374, r22.5072');
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `region_profiles`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `region_profiles`;
|
|
||||||
CREATE TABLE IF NOT EXISTS `region_profiles` (
|
|
||||||
`RegionID` varchar(32) NOT NULL default '',
|
|
||||||
`Name` text NOT NULL,
|
|
||||||
`GridLocX` bigint(20) NOT NULL default '0',
|
|
||||||
`GridLocY` bigint(20) NOT NULL default '0',
|
|
||||||
`region_handle` text NOT NULL,
|
|
||||||
`ip_addr` text NOT NULL,
|
|
||||||
`port` text NOT NULL,
|
|
||||||
PRIMARY KEY (`RegionID`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `region_profiles`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `region_profiles` (`RegionID`, `Name`, `GridLocX`, `GridLocY`, `region_handle`, `ip_addr`, `port`) VALUES ('51AEFF43000000000000000000000200', 'Test sandbox', 997, 996, 'r255232,254976', '127.0.0.1', '1000');
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `sessions`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `sessions`;
|
|
||||||
CREATE TABLE IF NOT EXISTS `sessions` (
|
|
||||||
`session_id` varchar(32) NOT NULL default '',
|
|
||||||
`secure_session_id` text NOT NULL,
|
|
||||||
`agent_id` text NOT NULL,
|
|
||||||
`session_start` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
`session_end` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
`session_active` tinyint(4) NOT NULL default '0',
|
|
||||||
`current_location` text NOT NULL,
|
|
||||||
`remote_ip` text NOT NULL,
|
|
||||||
`circuit_code` int(11) NOT NULL default '0',
|
|
||||||
PRIMARY KEY (`session_id`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `sessions`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `sessions` (`session_id`, `secure_session_id`, `agent_id`, `session_start`, `session_end`, `session_active`, `current_location`, `remote_ip`, `circuit_code`) VALUES ('51AEFF430000000000000000000002fc', '51AEFF430000000000000000000002fd', '51AEFF43000000000000000000000100', '2007-02-16 21:13:19', '0000-00-00 00:00:00', 1, 'r255232,254976', '81.174.255.70', 0);
|
|
|
@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
# Visual C# Express 2005
|
# Visual C# Express 2005
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OGS-UserServer", "userserver\src\OGS-UserServer.csproj", "{D45B6E48-5668-478D-B9CB-6D46E665FACF}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OGS-UserServer", "userserver\src\OGS-UserServer.csproj", "{D45B6E48-5668-478D-B9CB-6D46E665FACF}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OGS-GridServer", "gridserver\src\OGS-GridServer.csproj", "{FE50A574-C8ED-433B-95F0-213A5EED2AB2}"
|
||||||
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole\ServerConsole.csproj", "{7667E6E2-F227-41A2-B1B2-315613E1BAFC}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole\ServerConsole.csproj", "{7667E6E2-F227-41A2-B1B2-315613E1BAFC}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OGS-GridServer", "gridserver\src\OGS-GridServer.csproj", "{FE50A574-C8ED-433B-95F0-213A5EED2AB2}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework", "..\OpenSim.FrameWork\OpenSim.Framework.csproj", "{2E46A825-3168-492F-93BC-637126B5B72B}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -17,14 +19,18 @@ Global
|
||||||
{D45B6E48-5668-478D-B9CB-6D46E665FACF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{D45B6E48-5668-478D-B9CB-6D46E665FACF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D45B6E48-5668-478D-B9CB-6D46E665FACF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{D45B6E48-5668-478D-B9CB-6D46E665FACF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{D45B6E48-5668-478D-B9CB-6D46E665FACF}.Release|Any CPU.Build.0 = Release|Any CPU
|
{D45B6E48-5668-478D-B9CB-6D46E665FACF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Release|Any CPU.Build.0 = Release|Any CPU
|
{FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{2E46A825-3168-492F-93BC-637126B5B72B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{2E46A825-3168-492F-93BC-637126B5B72B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{2E46A825-3168-492F-93BC-637126B5B72B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{2E46A825-3168-492F-93BC-637126B5B72B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
|
@ -9,8 +9,6 @@
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>ServerConsole</RootNamespace>
|
<RootNamespace>ServerConsole</RootNamespace>
|
||||||
<AssemblyName>ServerConsole</AssemblyName>
|
<AssemblyName>ServerConsole</AssemblyName>
|
||||||
<StartupObject>
|
|
||||||
</StartupObject>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
@ -39,11 +37,4 @@
|
||||||
<Compile Include="ServerConsole.cs" />
|
<Compile Include="ServerConsole.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
</Project>
|
Binary file not shown.
Binary file not shown.
|
@ -38,6 +38,7 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using ServerConsole;
|
using ServerConsole;
|
||||||
|
using OpenSim.Framework.Sims;
|
||||||
|
|
||||||
namespace OpenGridServices
|
namespace OpenGridServices
|
||||||
{
|
{
|
||||||
|
@ -73,7 +74,7 @@ namespace OpenGridServices
|
||||||
switch(request.MethodName) {
|
switch(request.MethodName) {
|
||||||
case "get_sim_info":
|
case "get_sim_info":
|
||||||
ulong req_handle=(ulong)Convert.ToInt64(requestData["region_handle"]);
|
ulong req_handle=(ulong)Convert.ToInt64(requestData["region_handle"]);
|
||||||
SimProfile TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(req_handle);
|
SimProfileBase TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(req_handle);
|
||||||
string RecvKey="";
|
string RecvKey="";
|
||||||
string caller=(string)requestData["caller"];
|
string caller=(string)requestData["caller"];
|
||||||
switch(caller) {
|
switch(caller) {
|
|
@ -40,9 +40,6 @@
|
||||||
<Compile Include="..\..\common\src\OGS-Console.cs">
|
<Compile Include="..\..\common\src\OGS-Console.cs">
|
||||||
<Link>OGS-Console.cs</Link>
|
<Link>OGS-Console.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="..\..\common\src\Util.cs">
|
|
||||||
<Link>Util.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="..\..\common\VersionInfo\VersionInfo.cs">
|
<Compile Include="..\..\common\VersionInfo\VersionInfo.cs">
|
||||||
<Link>VersionInfo.cs</Link>
|
<Link>VersionInfo.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -53,17 +50,14 @@
|
||||||
<Compile Include="SimProfiles.cs" />
|
<Compile Include="SimProfiles.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\OpenSim.FrameWork\OpenSim.Framework.csproj">
|
||||||
|
<Project>{2E46A825-3168-492F-93BC-637126B5B72B}</Project>
|
||||||
|
<Name>OpenSim.Framework</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\ServerConsole\ServerConsole.csproj">
|
<ProjectReference Include="..\..\ServerConsole\ServerConsole.csproj">
|
||||||
<Project>{7667E6E2-F227-41A2-B1B2-315613E1BAFC}</Project>
|
<Project>{7667E6E2-F227-41A2-B1B2-315613E1BAFC}</Project>
|
||||||
<Name>ServerConsole</Name>
|
<Name>ServerConsole</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
</Project>
|
|
@ -33,6 +33,8 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using ServerConsole;
|
using ServerConsole;
|
||||||
|
using OpenSim.Framework.Utilities;
|
||||||
|
using OpenSim.Framework.Sims;
|
||||||
|
|
||||||
namespace OpenGridServices
|
namespace OpenGridServices
|
||||||
{
|
{
|
||||||
|
@ -40,7 +42,7 @@ namespace OpenGridServices
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SimProfileManager {
|
public class SimProfileManager {
|
||||||
|
|
||||||
public Dictionary<LLUUID, SimProfile> SimProfiles = new Dictionary<LLUUID, SimProfile>();
|
public Dictionary<LLUUID, SimProfileBase> SimProfiles = new Dictionary<LLUUID, SimProfileBase>();
|
||||||
|
|
||||||
public SimProfileManager() {
|
public SimProfileManager() {
|
||||||
}
|
}
|
||||||
|
@ -49,19 +51,19 @@ namespace OpenGridServices
|
||||||
// TODO: need to load from database
|
// TODO: need to load from database
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimProfile GetProfileByHandle(ulong reqhandle) {
|
public SimProfileBase GetProfileByHandle(ulong reqhandle) {
|
||||||
foreach (libsecondlife.LLUUID UUID in SimProfiles.Keys) {
|
foreach (libsecondlife.LLUUID UUID in SimProfiles.Keys) {
|
||||||
if(SimProfiles[UUID].regionhandle==reqhandle) return SimProfiles[UUID];
|
if(SimProfiles[UUID].regionhandle==reqhandle) return SimProfiles[UUID];
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimProfile GetProfileByLLUUID(LLUUID ProfileLLUUID) {
|
public SimProfileBase GetProfileByLLUUID(LLUUID ProfileLLUUID) {
|
||||||
return SimProfiles[ProfileLLUUID];
|
return SimProfiles[ProfileLLUUID];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AuthenticateSim(LLUUID RegionUUID, uint regionhandle, string simrecvkey) {
|
public bool AuthenticateSim(LLUUID RegionUUID, uint regionhandle, string simrecvkey) {
|
||||||
SimProfile TheSim=GetProfileByHandle(regionhandle);
|
SimProfileBase TheSim=GetProfileByHandle(regionhandle);
|
||||||
if(TheSim != null)
|
if(TheSim != null)
|
||||||
if(TheSim.recvkey==simrecvkey) {
|
if(TheSim.recvkey==simrecvkey) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -71,8 +73,8 @@ namespace OpenGridServices
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimProfile CreateNewProfile(string regionname, string caps_url, string sim_ip, uint sim_port, uint RegionLocX, uint RegionLocY, string sendkey, string recvkey) {
|
public SimProfileBase CreateNewProfile(string regionname, string caps_url, string sim_ip, uint sim_port, uint RegionLocX, uint RegionLocY, string sendkey, string recvkey) {
|
||||||
SimProfile newprofile = new SimProfile();
|
SimProfileBase newprofile = new SimProfileBase();
|
||||||
newprofile.regionname=regionname;
|
newprofile.regionname=regionname;
|
||||||
newprofile.sim_ip=sim_ip;
|
newprofile.sim_ip=sim_ip;
|
||||||
newprofile.sim_port=sim_port;
|
newprofile.sim_port=sim_port;
|
||||||
|
@ -89,7 +91,8 @@ namespace OpenGridServices
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SimProfile {
|
/* is in OpenSim.Framework
|
||||||
|
public class SimProfileBase {
|
||||||
public LLUUID UUID;
|
public LLUUID UUID;
|
||||||
public ulong regionhandle;
|
public ulong regionhandle;
|
||||||
public string regionname;
|
public string regionname;
|
||||||
|
@ -102,10 +105,10 @@ namespace OpenGridServices
|
||||||
public string recvkey;
|
public string recvkey;
|
||||||
|
|
||||||
|
|
||||||
public SimProfile() {
|
public SimProfileBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
|
@ -33,6 +33,9 @@ using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using ServerConsole;
|
using ServerConsole;
|
||||||
|
using OpenSim.Framework.User;
|
||||||
|
using OpenSim.Framework.Sims;
|
||||||
|
using OpenSim.Framework.Inventory;
|
||||||
|
|
||||||
namespace OpenGridServices
|
namespace OpenGridServices
|
||||||
{
|
{
|
||||||
|
@ -73,7 +76,7 @@ namespace OpenGridServices
|
||||||
public void Startup() {
|
public void Startup() {
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Please press enter to retain default settings");
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Please press enter to retain default settings");
|
||||||
|
|
||||||
this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid URL: ");
|
this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid URL: ");
|
||||||
this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to grid: ");
|
this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to grid: ");
|
||||||
this.GridRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from grid: ");
|
this.GridRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from grid: ");
|
||||||
|
|
||||||
|
@ -82,6 +85,7 @@ namespace OpenGridServices
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Creating user profile manager");
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Creating user profile manager");
|
||||||
_profilemanager = new UserProfileManager();
|
_profilemanager = new UserProfileManager();
|
||||||
_profilemanager.InitUserProfiles();
|
_profilemanager.InitUserProfiles();
|
||||||
|
_profilemanager.SetKeys(GridSendKey, GridRecvKey, GridURL, DefaultStartupMsg);
|
||||||
|
|
||||||
|
|
||||||
string tempfirstname;
|
string tempfirstname;
|
|
@ -48,21 +48,16 @@
|
||||||
<Compile Include="Main.cs" />
|
<Compile Include="Main.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="UserHttp.cs" />
|
<Compile Include="UserHttp.cs" />
|
||||||
<Compile Include="UserProfiles.cs" />
|
|
||||||
<Compile Include="Util.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\OpenSim.FrameWork\OpenSim.Framework.csproj">
|
||||||
|
<Project>{2E46A825-3168-492F-93BC-637126B5B72B}</Project>
|
||||||
|
<Name>OpenSim.Framework</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\ServerConsole\ServerConsole.csproj">
|
<ProjectReference Include="..\..\ServerConsole\ServerConsole.csproj">
|
||||||
<Project>{7667E6E2-F227-41A2-B1B2-315613E1BAFC}</Project>
|
<Project>{7667E6E2-F227-41A2-B1B2-315613E1BAFC}</Project>
|
||||||
<Name>ServerConsole</Name>
|
<Name>ServerConsole</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
</Project>
|
|
@ -1,14 +1,6 @@
|
||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PublishUrlHistory>publish\</PublishUrlHistory>
|
<PublishUrlHistory>publish\</PublishUrlHistory>
|
||||||
<InstallUrlHistory>
|
|
||||||
</InstallUrlHistory>
|
|
||||||
<SupportUrlHistory>
|
|
||||||
</SupportUrlHistory>
|
|
||||||
<UpdateUrlHistory>
|
|
||||||
</UpdateUrlHistory>
|
|
||||||
<BootstrapperUrlHistory>
|
|
||||||
</BootstrapperUrlHistory>
|
|
||||||
<ApplicationRevision>0</ApplicationRevision>
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
<FallbackCulture>en-US</FallbackCulture>
|
<FallbackCulture>en-US</FallbackCulture>
|
||||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
|
@ -0,0 +1,146 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) OpenGrid project, http://osgrid.org/
|
||||||
|
|
||||||
|
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using Nwc.XmlRpc;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Net;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using libsecondlife;
|
||||||
|
using ServerConsole;
|
||||||
|
using OpenSim.Framework.User;
|
||||||
|
using OpenSim.Framework.Sims;
|
||||||
|
using OpenSim.Framework.Inventory;
|
||||||
|
|
||||||
|
namespace OpenGridServices
|
||||||
|
{
|
||||||
|
public class UserHTTPServer {
|
||||||
|
public Thread HTTPD;
|
||||||
|
public HttpListener Listener;
|
||||||
|
|
||||||
|
public UserHTTPServer() {
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine("Starting up HTTP Server");
|
||||||
|
HTTPD = new Thread(new ThreadStart(StartHTTP));
|
||||||
|
HTTPD.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartHTTP() {
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine("UserHttp.cs:StartHTTP() - Spawned main thread OK");
|
||||||
|
Listener = new HttpListener();
|
||||||
|
|
||||||
|
Listener.Prefixes.Add("http://+:8002/userserver/");
|
||||||
|
Listener.Prefixes.Add("http://+:8002/usersessions/");
|
||||||
|
Listener.Start();
|
||||||
|
|
||||||
|
HttpListenerContext context;
|
||||||
|
while(true) {
|
||||||
|
context = Listener.GetContext();
|
||||||
|
ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static string ParseXMLRPC(string requestBody) {
|
||||||
|
return OpenGridServices.OpenUser_Main.userserver._profilemanager.ParseXMLRPC(requestBody);
|
||||||
|
}
|
||||||
|
|
||||||
|
static string ParseREST(HttpListenerRequest www_req) {
|
||||||
|
Console.WriteLine("INCOMING REST - " + www_req.RawUrl);
|
||||||
|
|
||||||
|
char[] splitter = {'/'};
|
||||||
|
string[] rest_params = www_req.RawUrl.Split(splitter);
|
||||||
|
string req_type = rest_params[1]; // First part of the URL is the type of request - usersessions/userprofiles/inventory/blabla
|
||||||
|
switch(req_type) {
|
||||||
|
case "usersessions":
|
||||||
|
LLUUID sessionid = new LLUUID(rest_params[2]); // get usersessions/sessionid
|
||||||
|
if(www_req.HttpMethod=="DELETE") {
|
||||||
|
foreach (libsecondlife.LLUUID UUID in OpenUser_Main.userserver._profilemanager.UserProfiles.Keys) {
|
||||||
|
if(OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSessionID==sessionid) {
|
||||||
|
OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSessionID=null;
|
||||||
|
OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSecureSessionID=null;
|
||||||
|
OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].Circuits.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return "OK";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void HandleRequest(Object stateinfo) {
|
||||||
|
HttpListenerContext context=(HttpListenerContext)stateinfo;
|
||||||
|
|
||||||
|
HttpListenerRequest request = context.Request;
|
||||||
|
HttpListenerResponse response = context.Response;
|
||||||
|
|
||||||
|
response.KeepAlive=false;
|
||||||
|
response.SendChunked=false;
|
||||||
|
|
||||||
|
System.IO.Stream body = request.InputStream;
|
||||||
|
System.Text.Encoding encoding = System.Text.Encoding.UTF8;
|
||||||
|
System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
|
||||||
|
|
||||||
|
string requestBody = reader.ReadToEnd();
|
||||||
|
body.Close();
|
||||||
|
reader.Close();
|
||||||
|
|
||||||
|
string responseString="";
|
||||||
|
switch(request.ContentType) {
|
||||||
|
case "text/xml":
|
||||||
|
// must be XML-RPC, so pass to the XML-RPC parser
|
||||||
|
|
||||||
|
responseString=ParseXMLRPC(requestBody);
|
||||||
|
response.AddHeader("Content-type","text/xml");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "text/plaintext":
|
||||||
|
responseString=ParseREST(request);
|
||||||
|
response.AddHeader("Content-type","text/plaintext");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
|
||||||
|
System.IO.Stream output = response.OutputStream;
|
||||||
|
response.SendChunked=false;
|
||||||
|
response.ContentLength64=buffer.Length;
|
||||||
|
output.Write(buffer,0,buffer.Length);
|
||||||
|
output.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// Information about this assembly is defined by the following
|
||||||
|
// attributes.
|
||||||
|
//
|
||||||
|
// change them to the information which is associated with the assembly
|
||||||
|
// you compile.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("SimConfig")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("SimConfig")]
|
||||||
|
[assembly: AssemblyCopyright("")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
|
@ -0,0 +1,176 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using OpenSim;
|
||||||
|
using OpenSim.Framework.Utilities;
|
||||||
|
using OpenSim.Framework.Interfaces;
|
||||||
|
using OpenSim.Framework.Terrain;
|
||||||
|
//using OpenSim.world;
|
||||||
|
using Db4objects.Db4o;
|
||||||
|
|
||||||
|
namespace OpenSim.Config.SimConfigDb4o
|
||||||
|
{
|
||||||
|
public class Db40ConfigPlugin: ISimConfig
|
||||||
|
{
|
||||||
|
public SimConfig GetConfigObject()
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Loading Db40Config dll");
|
||||||
|
return ( new DbSimConfig());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DbSimConfig : SimConfig
|
||||||
|
{
|
||||||
|
private bool isSandbox;
|
||||||
|
private IObjectContainer db;
|
||||||
|
|
||||||
|
public void LoadDefaults() {
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
|
||||||
|
|
||||||
|
this.RegionName=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Name [OpenSim test]: ","OpenSim test");
|
||||||
|
this.RegionLocX=(uint)Convert.ToInt32(OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location X [997]: ","997"));
|
||||||
|
this.RegionLocY=(uint)Convert.ToInt32(OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location Y [996]: ","996"));
|
||||||
|
this.IPListenPort=Convert.ToInt32(OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ","9000"));
|
||||||
|
this.IPListenAddr=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1");
|
||||||
|
|
||||||
|
if(!isSandbox)
|
||||||
|
{
|
||||||
|
this.AssetURL=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL: ");
|
||||||
|
this.AssetSendKey=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server key: ");
|
||||||
|
this.GridURL=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL: ");
|
||||||
|
this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server: ");
|
||||||
|
this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server: ");
|
||||||
|
this.UserURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("User server URL: ");
|
||||||
|
this.UserSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to user server: ");
|
||||||
|
this.UserRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from user server: ");
|
||||||
|
}
|
||||||
|
this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void InitConfig(bool sandboxMode) {
|
||||||
|
this.isSandbox = sandboxMode;
|
||||||
|
try {
|
||||||
|
db = Db4oFactory.OpenFile("opensim.yap");
|
||||||
|
IObjectSet result = db.Get(typeof(DbSimConfig));
|
||||||
|
if(result.Count==1) {
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading");
|
||||||
|
foreach (DbSimConfig cfg in result) {
|
||||||
|
this.RegionName = cfg.RegionName;
|
||||||
|
this.RegionLocX = cfg.RegionLocX;
|
||||||
|
this.RegionLocY = cfg.RegionLocY;
|
||||||
|
this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
|
||||||
|
this.IPListenPort = cfg.IPListenPort;
|
||||||
|
this.IPListenAddr = cfg.IPListenAddr;
|
||||||
|
this.AssetURL = cfg.AssetURL;
|
||||||
|
this.AssetSendKey = cfg.AssetSendKey;
|
||||||
|
this.GridURL = cfg.GridURL;
|
||||||
|
this.GridSendKey = cfg.GridSendKey;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
|
||||||
|
LoadDefaults();
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Writing out default settings to local database");
|
||||||
|
db.Set(this);
|
||||||
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
db.Close();
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Exception occured");
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Sim settings loaded:");
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Name: " + this.RegionName);
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString());
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort);
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Sandbox Mode? " + isSandbox.ToString());
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Asset URL: " + this.AssetURL);
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Asset key: " + this.AssetSendKey);
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Grid URL: " + this.GridURL);
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Grid key: " + this.GridSendKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float[] LoadWorld()
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world....");
|
||||||
|
//World blank = new World();
|
||||||
|
float[] heightmap = null;
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB");
|
||||||
|
IObjectSet world_result = db.Get(typeof(MapStorage));
|
||||||
|
if(world_result.Count>0) {
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading");
|
||||||
|
MapStorage map=(MapStorage)world_result.Next();
|
||||||
|
//blank.LandMap = map.Map;
|
||||||
|
heightmap = map.Map;
|
||||||
|
} else {
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
|
||||||
|
HeightmapGenHills hills = new HeightmapGenHills();
|
||||||
|
// blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
||||||
|
heightmap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
|
||||||
|
MapStorage map= new MapStorage();
|
||||||
|
map.Map = heightmap; //blank.LandMap;
|
||||||
|
db.Set(map);
|
||||||
|
db.Commit();
|
||||||
|
}
|
||||||
|
return heightmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SaveMap(float[] heightmap)
|
||||||
|
{
|
||||||
|
IObjectSet world_result = db.Get(typeof(MapStorage));
|
||||||
|
if(world_result.Count>0) {
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - updating saved copy of heightmap in local database");
|
||||||
|
MapStorage map=(MapStorage)world_result.Next();
|
||||||
|
db.Delete(map);
|
||||||
|
}
|
||||||
|
MapStorage map1= new MapStorage();
|
||||||
|
map1.Map = heightmap; //OpenSim_Main.local_world.LandMap;
|
||||||
|
db.Set(map1);
|
||||||
|
db.Commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void LoadFromGrid() {
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!");
|
||||||
|
// TODO: Make this crap work
|
||||||
|
/* WebRequest GridLogin = WebRequest.Create(this.GridURL + "regions/" + this.RegionHandle.ToString() + "/login");
|
||||||
|
WebResponse GridResponse = GridLogin.GetResponse();
|
||||||
|
byte[] idata = new byte[(int)GridResponse.ContentLength];
|
||||||
|
BinaryReader br = new BinaryReader(GridResponse.GetResponseStream());
|
||||||
|
|
||||||
|
br.Close();
|
||||||
|
GridResponse.Close();
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Shutdown() {
|
||||||
|
db.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenSim.Config.SimConfigDb4o
|
||||||
|
{
|
||||||
|
public class MapStorage
|
||||||
|
{
|
||||||
|
public float[] Map;
|
||||||
|
|
||||||
|
public MapStorage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectType>Local</ProjectType>
|
||||||
|
<ProductVersion>8.0.50727</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{C077B28B-2F8D-4BD9-8E47-84C51B3A7358}</ProjectGuid>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ApplicationIcon></ApplicationIcon>
|
||||||
|
<AssemblyKeyContainerName>
|
||||||
|
</AssemblyKeyContainerName>
|
||||||
|
<AssemblyName>OpenSim.Config.SimConfigDb4o</AssemblyName>
|
||||||
|
<DefaultClientScript>JScript</DefaultClientScript>
|
||||||
|
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||||
|
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder></AppDesignerFolder>
|
||||||
|
<RootNamespace>OpenSim.Config.SimConfigDb4o</RootNamespace>
|
||||||
|
<StartupObject></StartupObject>
|
||||||
|
<FileUpgradeFlags>
|
||||||
|
</FileUpgradeFlags>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>True</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>False</Optimize>
|
||||||
|
<OutputPath>..\..\bin\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>False</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>True</Optimize>
|
||||||
|
<OutputPath>..\..\bin\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" >
|
||||||
|
<HintPath>\System.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data.dll" >
|
||||||
|
<HintPath>\System.Data.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml.dll" >
|
||||||
|
<HintPath>\System.Xml.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="libsecondlife.dll" >
|
||||||
|
<HintPath>\libsecondlife.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Db4objects.Db4o.dll" >
|
||||||
|
<HintPath>\Db4objects.Db4o.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
|
||||||
|
<Name>OpenSim.Framework</Name>
|
||||||
|
<Project>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</Project>
|
||||||
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
|
||||||
|
<Name>OpenSim.Framework.Console</Name>
|
||||||
|
<Project>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</Project>
|
||||||
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DbSimConfig.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="MapStorage.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>
|
||||||
|
</PreBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<project name="OpenSim.Config.SimConfigDb4o" default="build">
|
||||||
|
<target name="build">
|
||||||
|
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<copy todir="${project::get-base-directory()}/${build.dir}">
|
||||||
|
<fileset basedir="${project::get-base-directory()}">
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
|
||||||
|
<resources prefix="OpenSim.Config.SimConfigDb4o" dynamicprefix="true" >
|
||||||
|
</resources>
|
||||||
|
<sources failonempty="true">
|
||||||
|
<include name="AssemblyInfo.cs" />
|
||||||
|
<include name="DbSimConfig.cs" />
|
||||||
|
<include name="MapStorage.cs" />
|
||||||
|
</sources>
|
||||||
|
<references basedir="${project::get-base-directory()}">
|
||||||
|
<lib>
|
||||||
|
<include name="${project::get-base-directory()}" />
|
||||||
|
<include name="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
</lib>
|
||||||
|
<include name="System.dll" />
|
||||||
|
<include name="System.Data.dll.dll" />
|
||||||
|
<include name="System.Xml.dll.dll" />
|
||||||
|
<include name="../../bin/libsecondlife.dll" />
|
||||||
|
<include name="../../bin/Db4objects.Db4o.dll" />
|
||||||
|
<include name="../../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
|
||||||
|
<include name="../../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
|
||||||
|
</references>
|
||||||
|
</csc>
|
||||||
|
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/../../bin/"/>
|
||||||
|
<copy todir="${project::get-base-directory()}/../../bin/">
|
||||||
|
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
|
||||||
|
<include name="*.dll"/>
|
||||||
|
<include name="*.exe"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
<target name="clean">
|
||||||
|
<delete dir="${bin.dir}" failonerror="false" />
|
||||||
|
<delete dir="${obj.dir}" failonerror="false" />
|
||||||
|
</target>
|
||||||
|
<target name="doc" description="Creates documentation.">
|
||||||
|
</target>
|
||||||
|
</project>
|
|
@ -0,0 +1,31 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// Information about this assembly is defined by the following
|
||||||
|
// attributes.
|
||||||
|
//
|
||||||
|
// change them to the information which is associated with the assembly
|
||||||
|
// you compile.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("ServerConsole")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("ServerConsole")]
|
||||||
|
[assembly: AssemblyCopyright("")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
|
@ -0,0 +1,45 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Console
|
||||||
|
{
|
||||||
|
public abstract class ConsoleBase
|
||||||
|
{
|
||||||
|
|
||||||
|
public enum ConsoleType
|
||||||
|
{
|
||||||
|
Local, // Use stdio
|
||||||
|
TCP, // Use TCP/telnet
|
||||||
|
SimChat // Use in-world chat (for gods)
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void Close();
|
||||||
|
|
||||||
|
public abstract void Write(string format, params object[] args);
|
||||||
|
|
||||||
|
public abstract void WriteLine(string format, params object[] args);
|
||||||
|
|
||||||
|
public abstract string ReadLine();
|
||||||
|
|
||||||
|
public abstract int Read();
|
||||||
|
|
||||||
|
// Displays a command prompt and waits for the user to enter a string, then returns that string
|
||||||
|
public abstract string CmdPrompt(string prompt);
|
||||||
|
|
||||||
|
// Displays a command prompt and returns a default value if the user simply presses enter
|
||||||
|
public abstract string CmdPrompt(string prompt, string defaultresponse);
|
||||||
|
|
||||||
|
// Displays a command prompt and returns a default value, user may only enter 1 of 2 options
|
||||||
|
public abstract string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB);
|
||||||
|
|
||||||
|
// Runs a command with a number of parameters
|
||||||
|
public abstract Object RunCmd(string Cmd, string[] cmdparams);
|
||||||
|
|
||||||
|
// Shows data about something
|
||||||
|
public abstract void ShowCommands(string ShowWhat);
|
||||||
|
|
||||||
|
// Displays a prompt to the user and then runs the command they entered
|
||||||
|
public abstract void MainConsolePrompt();
|
||||||
|
|
||||||
|
public abstract void SetStatus(string status);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) OpenSim project, http://osgrid.org/
|
* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -22,16 +22,27 @@ Copyright (c) OpenSim project, http://osgrid.org/
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace OpenSim
|
namespace OpenSim.Framework.Console
|
||||||
{
|
{
|
||||||
/// <summary>
|
public class MainConsole {
|
||||||
/// </summary>
|
|
||||||
public class VersionInfo
|
private static ConsoleBase instance;
|
||||||
{
|
|
||||||
public static string Version = "@@VERSION";
|
public static ConsoleBase Instance
|
||||||
}
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
instance = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectType>Local</ProjectType>
|
||||||
|
<ProductVersion>8.0.50727</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</ProjectGuid>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ApplicationIcon></ApplicationIcon>
|
||||||
|
<AssemblyKeyContainerName>
|
||||||
|
</AssemblyKeyContainerName>
|
||||||
|
<AssemblyName>OpenSim.Framework.Console</AssemblyName>
|
||||||
|
<DefaultClientScript>JScript</DefaultClientScript>
|
||||||
|
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||||
|
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder></AppDesignerFolder>
|
||||||
|
<RootNamespace>OpenSim.Framework.Console</RootNamespace>
|
||||||
|
<StartupObject></StartupObject>
|
||||||
|
<FileUpgradeFlags>
|
||||||
|
</FileUpgradeFlags>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>True</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>False</Optimize>
|
||||||
|
<OutputPath>..\bin\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>False</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>True</Optimize>
|
||||||
|
<OutputPath>..\bin\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" >
|
||||||
|
<HintPath>\System.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="ConsoleBase.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="MainConsole.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>
|
||||||
|
</PreBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<project name="OpenSim.Framework.Console" default="build">
|
||||||
|
<target name="build">
|
||||||
|
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<copy todir="${project::get-base-directory()}/${build.dir}">
|
||||||
|
<fileset basedir="${project::get-base-directory()}">
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
|
||||||
|
<resources prefix="OpenSim.Framework.Console" dynamicprefix="true" >
|
||||||
|
</resources>
|
||||||
|
<sources failonempty="true">
|
||||||
|
<include name="AssemblyInfo.cs" />
|
||||||
|
<include name="ConsoleBase.cs" />
|
||||||
|
<include name="MainConsole.cs" />
|
||||||
|
</sources>
|
||||||
|
<references basedir="${project::get-base-directory()}">
|
||||||
|
<lib>
|
||||||
|
<include name="${project::get-base-directory()}" />
|
||||||
|
<include name="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
</lib>
|
||||||
|
<include name="System.dll" />
|
||||||
|
</references>
|
||||||
|
</csc>
|
||||||
|
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/../bin/"/>
|
||||||
|
<copy todir="${project::get-base-directory()}/../bin/">
|
||||||
|
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
|
||||||
|
<include name="*.dll"/>
|
||||||
|
<include name="*.exe"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
<target name="clean">
|
||||||
|
<delete dir="${bin.dir}" failonerror="false" />
|
||||||
|
<delete dir="${obj.dir}" failonerror="false" />
|
||||||
|
</target>
|
||||||
|
<target name="doc" description="Creates documentation.">
|
||||||
|
</target>
|
||||||
|
</project>
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Interfaces
|
||||||
|
{
|
||||||
|
public class AgentCircuitData
|
||||||
|
{
|
||||||
|
public AgentCircuitData() { }
|
||||||
|
public LLUUID AgentID;
|
||||||
|
public LLUUID SessionID;
|
||||||
|
public LLUUID SecureSessionID;
|
||||||
|
public string firstname;
|
||||||
|
public string lastname;
|
||||||
|
public uint circuitcode;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Assets
|
||||||
|
{
|
||||||
|
public class AssetBase
|
||||||
|
{
|
||||||
|
public byte[] Data;
|
||||||
|
public LLUUID FullID;
|
||||||
|
public sbyte Type;
|
||||||
|
public sbyte InvType;
|
||||||
|
public string Name;
|
||||||
|
public string Description;
|
||||||
|
|
||||||
|
public AssetBase()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Utilities
|
||||||
|
{
|
||||||
|
public class BlockingQueue<T>
|
||||||
|
{
|
||||||
|
private Queue<T> _queue = new Queue<T>();
|
||||||
|
private object _queueSync = new object();
|
||||||
|
|
||||||
|
public void Enqueue(T value)
|
||||||
|
{
|
||||||
|
lock (_queueSync)
|
||||||
|
{
|
||||||
|
_queue.Enqueue(value);
|
||||||
|
Monitor.Pulse(_queueSync);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public T Dequeue()
|
||||||
|
{
|
||||||
|
lock (_queueSync)
|
||||||
|
{
|
||||||
|
if (_queue.Count < 1)
|
||||||
|
Monitor.Wait(_queueSync);
|
||||||
|
|
||||||
|
return _queue.Dequeue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace OpenSim
|
namespace OpenSim.Framework.Terrain
|
||||||
{
|
{
|
||||||
public class HeightmapGenHills
|
public class HeightmapGenHills
|
||||||
{
|
{
|
|
@ -30,53 +30,39 @@ using System.Net.Sockets;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using OpenSim.Framework.Assets;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Interfaces
|
||||||
namespace OpenSim.GridServers
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Description of IAssetServer.
|
/// Description of IAssetServer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
public interface IAssetServer
|
public interface IAssetServer
|
||||||
{
|
{
|
||||||
void SetReceiver(IAssetReceiver receiver);
|
void SetReceiver(IAssetReceiver receiver);
|
||||||
void RequestAsset(LLUUID assetID, bool isTexture);
|
void RequestAsset(LLUUID assetID, bool isTexture);
|
||||||
void UpdateAsset(AssetBase asset);
|
void UpdateAsset(AssetBase asset);
|
||||||
void UploadNewAsset(AssetBase asset);
|
void UploadNewAsset(AssetBase asset);
|
||||||
void SetServerInfo(string ServerUrl, string ServerKey);
|
void SetServerInfo(string ServerUrl, string ServerKey);
|
||||||
}
|
void Close();
|
||||||
|
}
|
||||||
|
|
||||||
// could change to delegate?
|
// could change to delegate?
|
||||||
public interface IAssetReceiver
|
public interface IAssetReceiver
|
||||||
{
|
{
|
||||||
void AssetReceived(AssetBase asset, bool IsTexture);
|
void AssetReceived(AssetBase asset, bool IsTexture);
|
||||||
void AssetNotFound(AssetBase asset);
|
void AssetNotFound(AssetBase asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct ARequest
|
public interface IAssetPlugin
|
||||||
{
|
{
|
||||||
public LLUUID AssetID;
|
IAssetServer GetAssetServer();
|
||||||
public bool IsTexture;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public class AssetBase
|
public struct ARequest
|
||||||
{
|
{
|
||||||
public byte[] Data;
|
public LLUUID AssetID;
|
||||||
public LLUUID FullID;
|
public bool IsTexture;
|
||||||
public sbyte Type;
|
}
|
||||||
public sbyte InvType;
|
|
||||||
public string Name;
|
|
||||||
public string Description;
|
|
||||||
|
|
||||||
public AssetBase()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IAssetPlugin
|
|
||||||
{
|
|
||||||
IAssetServer GetAssetServer();
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -31,49 +31,48 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.world;
|
//using OpenSim.world;
|
||||||
|
|
||||||
namespace OpenSim
|
namespace OpenSim.Framework.Interfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This class handles connection to the underlying database used for configuration of the region.
|
/// This class handles connection to the underlying database used for configuration of the region.
|
||||||
/// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate
|
/// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate
|
||||||
/// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from
|
/// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from
|
||||||
/// what is hardcoded here and then saved into opensim.yap for future startups.
|
/// what is hardcoded here and then saved into opensim.yap for future startups.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
|
|
||||||
public abstract class SimConfig
|
public abstract class SimConfig
|
||||||
{
|
{
|
||||||
public string RegionName;
|
public string RegionName;
|
||||||
|
|
||||||
public uint RegionLocX;
|
public uint RegionLocX;
|
||||||
public uint RegionLocY;
|
public uint RegionLocY;
|
||||||
public ulong RegionHandle;
|
public ulong RegionHandle;
|
||||||
|
|
||||||
public int IPListenPort;
|
public int IPListenPort;
|
||||||
public string IPListenAddr;
|
public string IPListenAddr;
|
||||||
|
|
||||||
public string AssetURL;
|
public string AssetURL;
|
||||||
public string AssetSendKey;
|
public string AssetSendKey;
|
||||||
|
|
||||||
public string GridURL;
|
public string GridURL;
|
||||||
public string GridSendKey;
|
public string GridSendKey;
|
||||||
public string GridRecvKey;
|
public string GridRecvKey;
|
||||||
public string UserURL;
|
public string UserURL;
|
||||||
public string UserSendKey;
|
public string UserSendKey;
|
||||||
public string UserRecvKey;
|
public string UserRecvKey;
|
||||||
|
|
||||||
|
public abstract void InitConfig(bool sandboxMode);
|
||||||
|
public abstract void LoadFromGrid();
|
||||||
|
public abstract float[] LoadWorld();
|
||||||
|
public abstract void SaveMap(float[] heightmap);
|
||||||
|
|
||||||
public abstract void InitConfig();
|
}
|
||||||
public abstract void LoadFromGrid();
|
|
||||||
public abstract World LoadWorld();
|
|
||||||
public abstract void SaveMap();
|
|
||||||
|
|
||||||
}
|
public interface ISimConfig
|
||||||
|
{
|
||||||
public interface ISimConfig
|
SimConfig GetConfigObject();
|
||||||
{
|
}
|
||||||
SimConfig GetConfigObject();
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.IO;
|
||||||
|
using libsecondlife;
|
||||||
|
using OpenSim;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Handles connection to Grid Servers.
|
||||||
|
/// also Sim to Sim connections?
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public interface IGridServer
|
||||||
|
{
|
||||||
|
UUIDBlock RequestUUIDBlock();
|
||||||
|
NeighbourInfo[] RequestNeighbours(); //should return a array of neighbouring regions
|
||||||
|
AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
|
||||||
|
bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
|
||||||
|
string GetName();
|
||||||
|
bool RequestConnection();
|
||||||
|
void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
|
||||||
|
void Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct UUIDBlock
|
||||||
|
{
|
||||||
|
public LLUUID BlockStart;
|
||||||
|
public LLUUID BlockEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AuthenticateResponse
|
||||||
|
{
|
||||||
|
public bool Authorised;
|
||||||
|
public Login LoginInfo;
|
||||||
|
|
||||||
|
public AuthenticateResponse()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IGridPlugin
|
||||||
|
{
|
||||||
|
IGridServer GetGridServer();
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,60 +27,25 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using OpenSim.Framework.Assets;
|
||||||
|
|
||||||
namespace GridInterfaces
|
namespace OpenSim.Framework.Interfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ILocalStorage. Really hacked together right now needs cleaning up
|
/// ILocalStorage. Really hacked together right now needs cleaning up
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ILocalStorage
|
public interface ILocalStorage
|
||||||
{
|
{
|
||||||
void StorePrim(PrimData prim);
|
void StorePrim(PrimData prim);
|
||||||
void RemovePrim(LLUUID primID);
|
void RemovePrim(LLUUID primID);
|
||||||
void LoadPrimitives(ILocalStorageReceiver receiver);
|
void LoadPrimitives(ILocalStorageReceiver receiver);
|
||||||
void ShutDown();
|
void ShutDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ILocalStorageReceiver
|
public interface ILocalStorageReceiver
|
||||||
{
|
{
|
||||||
void PrimFromStorage(PrimData prim);
|
void PrimFromStorage(PrimData prim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class PrimData
|
|
||||||
{
|
|
||||||
public LLUUID OwnerID;
|
|
||||||
public byte PCode;
|
|
||||||
public byte PathBegin;
|
|
||||||
public byte PathEnd;
|
|
||||||
public byte PathScaleX;
|
|
||||||
public byte PathScaleY;
|
|
||||||
public byte PathShearX;
|
|
||||||
public byte PathShearY;
|
|
||||||
public sbyte PathSkew;
|
|
||||||
public byte ProfileBegin;
|
|
||||||
public byte ProfileEnd;
|
|
||||||
public LLVector3 Scale;
|
|
||||||
public byte PathCurve;
|
|
||||||
public byte ProfileCurve;
|
|
||||||
public uint ParentID=0;
|
|
||||||
public byte ProfileHollow;
|
|
||||||
public sbyte PathRadiusOffset;
|
|
||||||
public byte PathRevolutions;
|
|
||||||
public sbyte PathTaperX;
|
|
||||||
public sbyte PathTaperY;
|
|
||||||
public sbyte PathTwist;
|
|
||||||
public sbyte PathTwistBegin;
|
|
||||||
|
|
||||||
//following only used during prim storage
|
|
||||||
public LLVector3 Position;
|
|
||||||
public LLQuaternion Rotation;
|
|
||||||
public uint LocalID;
|
|
||||||
public LLUUID FullID;
|
|
||||||
|
|
||||||
public PrimData()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using OpenSim.Framework.Inventory;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Interfaces
|
||||||
|
{
|
||||||
|
public interface IUserServer
|
||||||
|
{
|
||||||
|
AgentInventory RequestAgentsInventory(LLUUID agentID);
|
||||||
|
void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
using OpenSim.Framework.Assets;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Inventory
|
||||||
|
{
|
||||||
|
public class AgentInventory
|
||||||
|
{
|
||||||
|
//Holds the local copy of Inventory info for a agent
|
||||||
|
public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
|
||||||
|
public Dictionary<LLUUID, InventoryItem> InventoryItems;
|
||||||
|
public InventoryFolder InventoryRoot;
|
||||||
|
public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server
|
||||||
|
public LLUUID AgentID;
|
||||||
|
public AvatarWearable[] Wearables;
|
||||||
|
|
||||||
|
public AgentInventory()
|
||||||
|
{
|
||||||
|
InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
|
||||||
|
InventoryItems = new Dictionary<LLUUID, InventoryItem>();
|
||||||
|
this.Initialise();
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Initialise()
|
||||||
|
{
|
||||||
|
Wearables = new AvatarWearable[2]; //should be 12 of these
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
Wearables[i] = new AvatarWearable();
|
||||||
|
}
|
||||||
|
|
||||||
|
InventoryRoot = new InventoryFolder();
|
||||||
|
InventoryRoot.FolderID = LLUUID.Random();
|
||||||
|
InventoryRoot.ParentID = new LLUUID();
|
||||||
|
InventoryRoot.Version = 1;
|
||||||
|
InventoryRoot.DefaultType = 8;
|
||||||
|
InventoryRoot.FolderName = "My Inventory";
|
||||||
|
InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CreateNewFolder(LLUUID folderID)
|
||||||
|
{
|
||||||
|
InventoryFolder Folder = new InventoryFolder();
|
||||||
|
Folder.FolderID = folderID;
|
||||||
|
Folder.OwnerID = this.AgentID;
|
||||||
|
this.InventoryFolders.Add(Folder.FolderID, Folder);
|
||||||
|
|
||||||
|
return (true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
|
||||||
|
{
|
||||||
|
if (this.InventoryFolders.ContainsKey(folderID))
|
||||||
|
{
|
||||||
|
LLUUID NewItemID = LLUUID.Random();
|
||||||
|
|
||||||
|
InventoryItem Item = new InventoryItem();
|
||||||
|
Item.FolderID = folderID;
|
||||||
|
Item.OwnerID = AgentID;
|
||||||
|
Item.AssetID = asset.FullID;
|
||||||
|
Item.ItemID = NewItemID;
|
||||||
|
Item.Type = asset.Type;
|
||||||
|
Item.Name = asset.Name;
|
||||||
|
Item.Description = asset.Description;
|
||||||
|
Item.InvType = asset.InvType;
|
||||||
|
this.InventoryItems.Add(Item.ItemID, Item);
|
||||||
|
InventoryFolder Folder = InventoryFolders[Item.FolderID];
|
||||||
|
Folder.Items.Add(Item);
|
||||||
|
return (Item.ItemID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InventoryFolder
|
||||||
|
{
|
||||||
|
public List<InventoryItem> Items;
|
||||||
|
//public List<InventoryFolder> Subfolders;
|
||||||
|
public LLUUID FolderID;
|
||||||
|
public LLUUID OwnerID;
|
||||||
|
public LLUUID ParentID;
|
||||||
|
public string FolderName;
|
||||||
|
public ushort DefaultType;
|
||||||
|
public ushort Version;
|
||||||
|
|
||||||
|
public InventoryFolder()
|
||||||
|
{
|
||||||
|
Items = new List<InventoryItem>();
|
||||||
|
//Subfolders = new List<InventoryFolder>();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InventoryItem
|
||||||
|
{
|
||||||
|
public LLUUID FolderID;
|
||||||
|
public LLUUID OwnerID;
|
||||||
|
public LLUUID ItemID;
|
||||||
|
public LLUUID AssetID;
|
||||||
|
public LLUUID CreatorID;
|
||||||
|
public sbyte InvType;
|
||||||
|
public sbyte Type;
|
||||||
|
public string Name;
|
||||||
|
public string Description;
|
||||||
|
|
||||||
|
public InventoryItem()
|
||||||
|
{
|
||||||
|
this.CreatorID = LLUUID.Zero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AvatarWearable
|
||||||
|
{
|
||||||
|
public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
|
public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
|
|
||||||
|
public AvatarWearable()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Interfaces
|
||||||
|
{
|
||||||
|
public abstract class LocalGridBase : IGridServer
|
||||||
|
{
|
||||||
|
public abstract UUIDBlock RequestUUIDBlock();
|
||||||
|
public abstract NeighbourInfo[] RequestNeighbours();
|
||||||
|
public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
|
||||||
|
public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
|
||||||
|
public abstract string GetName();
|
||||||
|
public abstract bool RequestConnection();
|
||||||
|
public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
|
||||||
|
public abstract void AddNewSession(Login session);
|
||||||
|
public abstract void Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Interfaces
|
||||||
|
{
|
||||||
|
public class Login
|
||||||
|
{
|
||||||
|
public string First = "Test";
|
||||||
|
public string Last = "User";
|
||||||
|
public LLUUID Agent;
|
||||||
|
public LLUUID Session;
|
||||||
|
public LLUUID SecureSession = LLUUID.Zero;
|
||||||
|
public LLUUID InventoryFolder;
|
||||||
|
public LLUUID BaseFolder;
|
||||||
|
public Login()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,10 +3,9 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Nwc.XmlRpc;
|
using Nwc.XmlRpc;
|
||||||
using OpenSim.GridServers;
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework.Grid
|
||||||
{
|
{
|
||||||
public abstract class LoginService
|
public abstract class LoginService
|
||||||
{
|
{
|
|
@ -0,0 +1,19 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Interfaces
|
||||||
|
{
|
||||||
|
public class NeighbourInfo
|
||||||
|
{
|
||||||
|
public NeighbourInfo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public ulong regionhandle;
|
||||||
|
public uint RegionLocX;
|
||||||
|
public uint RegionLocY;
|
||||||
|
public string sim_ip;
|
||||||
|
public uint sim_port;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,151 @@
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectType>Local</ProjectType>
|
||||||
|
<ProductVersion>8.0.50727</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</ProjectGuid>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ApplicationIcon></ApplicationIcon>
|
||||||
|
<AssemblyKeyContainerName>
|
||||||
|
</AssemblyKeyContainerName>
|
||||||
|
<AssemblyName>OpenSim.Framework</AssemblyName>
|
||||||
|
<DefaultClientScript>JScript</DefaultClientScript>
|
||||||
|
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||||
|
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder></AppDesignerFolder>
|
||||||
|
<RootNamespace>OpenSim.Framework</RootNamespace>
|
||||||
|
<StartupObject></StartupObject>
|
||||||
|
<FileUpgradeFlags>
|
||||||
|
</FileUpgradeFlags>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>True</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>False</Optimize>
|
||||||
|
<OutputPath>..\bin\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>False</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>True</Optimize>
|
||||||
|
<OutputPath>..\bin\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System.dll" >
|
||||||
|
<HintPath>\System.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml.dll" >
|
||||||
|
<HintPath>\System.Xml.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="libsecondlife.dll" >
|
||||||
|
<HintPath>\libsecondlife.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AgentCiruitData.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="AssetBase.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="BlockingQueue.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="HeightMapGenHills.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="IAssetServer.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="IConfig.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="IGridServer.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="ILocalStorage.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Inventory.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="IUserServer.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="LocalGridBase.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Login.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="LoginService.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="NeighbourInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="PrimData.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="RemoteGridBase.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="SimProfile.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="SimProfileBase.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="UserProfile.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="UserProfileManager.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="UserProfileManagerBase.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Util.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>
|
||||||
|
</PreBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<project name="OpenSim.Framework" default="build">
|
||||||
|
<target name="build">
|
||||||
|
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<copy todir="${project::get-base-directory()}/${build.dir}">
|
||||||
|
<fileset basedir="${project::get-base-directory()}">
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
|
||||||
|
<resources prefix="OpenSim.Framework" dynamicprefix="true" >
|
||||||
|
</resources>
|
||||||
|
<sources failonempty="true">
|
||||||
|
<include name="AgentCiruitData.cs" />
|
||||||
|
<include name="AssetBase.cs" />
|
||||||
|
<include name="BlockingQueue.cs" />
|
||||||
|
<include name="HeightMapGenHills.cs" />
|
||||||
|
<include name="IAssetServer.cs" />
|
||||||
|
<include name="IConfig.cs" />
|
||||||
|
<include name="IGridServer.cs" />
|
||||||
|
<include name="ILocalStorage.cs" />
|
||||||
|
<include name="Inventory.cs" />
|
||||||
|
<include name="IUserServer.cs" />
|
||||||
|
<include name="LocalGridBase.cs" />
|
||||||
|
<include name="Login.cs" />
|
||||||
|
<include name="LoginService.cs" />
|
||||||
|
<include name="NeighbourInfo.cs" />
|
||||||
|
<include name="PrimData.cs" />
|
||||||
|
<include name="RemoteGridBase.cs" />
|
||||||
|
<include name="SimProfile.cs" />
|
||||||
|
<include name="SimProfileBase.cs" />
|
||||||
|
<include name="UserProfile.cs" />
|
||||||
|
<include name="UserProfileManager.cs" />
|
||||||
|
<include name="UserProfileManagerBase.cs" />
|
||||||
|
<include name="Util.cs" />
|
||||||
|
<include name="Properties/AssemblyInfo.cs" />
|
||||||
|
</sources>
|
||||||
|
<references basedir="${project::get-base-directory()}">
|
||||||
|
<lib>
|
||||||
|
<include name="${project::get-base-directory()}" />
|
||||||
|
<include name="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
</lib>
|
||||||
|
<include name="System.dll.dll" />
|
||||||
|
<include name="System.Xml.dll.dll" />
|
||||||
|
<include name="../bin/libsecondlife.dll" />
|
||||||
|
</references>
|
||||||
|
</csc>
|
||||||
|
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/../bin/"/>
|
||||||
|
<copy todir="${project::get-base-directory()}/../bin/">
|
||||||
|
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
|
||||||
|
<include name="*.dll"/>
|
||||||
|
<include name="*.exe"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
<target name="clean">
|
||||||
|
<delete dir="${bin.dir}" failonerror="false" />
|
||||||
|
<delete dir="${obj.dir}" failonerror="false" />
|
||||||
|
</target>
|
||||||
|
<target name="doc" description="Creates documentation.">
|
||||||
|
</target>
|
||||||
|
</project>
|
|
@ -0,0 +1,45 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Assets
|
||||||
|
{
|
||||||
|
public class PrimData
|
||||||
|
{
|
||||||
|
public LLUUID OwnerID;
|
||||||
|
public byte PCode;
|
||||||
|
public byte PathBegin;
|
||||||
|
public byte PathEnd;
|
||||||
|
public byte PathScaleX;
|
||||||
|
public byte PathScaleY;
|
||||||
|
public byte PathShearX;
|
||||||
|
public byte PathShearY;
|
||||||
|
public sbyte PathSkew;
|
||||||
|
public byte ProfileBegin;
|
||||||
|
public byte ProfileEnd;
|
||||||
|
public LLVector3 Scale;
|
||||||
|
public byte PathCurve;
|
||||||
|
public byte ProfileCurve;
|
||||||
|
public uint ParentID = 0;
|
||||||
|
public byte ProfileHollow;
|
||||||
|
public sbyte PathRadiusOffset;
|
||||||
|
public byte PathRevolutions;
|
||||||
|
public sbyte PathTaperX;
|
||||||
|
public sbyte PathTaperY;
|
||||||
|
public sbyte PathTwist;
|
||||||
|
public sbyte PathTwistBegin;
|
||||||
|
public byte[] Texture;
|
||||||
|
|
||||||
|
//following only used during prim storage
|
||||||
|
public LLVector3 Position;
|
||||||
|
public LLQuaternion Rotation;
|
||||||
|
public uint LocalID;
|
||||||
|
public LLUUID FullID;
|
||||||
|
|
||||||
|
public PrimData()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,12 +5,12 @@ using System.Runtime.InteropServices;
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("opensim")]
|
[assembly: AssemblyTitle("OpenSim.FrameWork")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Playahead AB")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("opensim")]
|
[assembly: AssemblyProduct("OpenSim.FrameWork")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Playahead AB 2007")]
|
[assembly: AssemblyCopyright("Copyright © 2007")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
[assembly: Guid("1d09756b-a461-4302-b6fe-15c455317909")]
|
[assembly: Guid("a08e20c7-f191-4137-b1f0-9291408fa521")]
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
|
@ -0,0 +1,25 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Interfaces
|
||||||
|
{
|
||||||
|
public abstract class RemoteGridBase : IGridServer
|
||||||
|
{
|
||||||
|
public abstract Dictionary<uint, AgentCircuitData> agentcircuits
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract UUIDBlock RequestUUIDBlock();
|
||||||
|
public abstract NeighbourInfo[] RequestNeighbours();
|
||||||
|
public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
|
||||||
|
public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
|
||||||
|
public abstract string GetName();
|
||||||
|
public abstract bool RequestConnection();
|
||||||
|
public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
|
||||||
|
public abstract void Close();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
using Nwc.XmlRpc;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Sims
|
||||||
|
{
|
||||||
|
public class SimProfile : SimProfileBase
|
||||||
|
{
|
||||||
|
public SimProfile LoadFromGrid(ulong region_handle, string GridURL, string SendKey, string RecvKey)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Hashtable GridReqParams = new Hashtable();
|
||||||
|
GridReqParams["region_handle"] = region_handle.ToString();
|
||||||
|
GridReqParams["caller"] = "userserver";
|
||||||
|
GridReqParams["authkey"] = SendKey;
|
||||||
|
ArrayList SendParams = new ArrayList();
|
||||||
|
SendParams.Add(GridReqParams);
|
||||||
|
XmlRpcRequest GridReq = new XmlRpcRequest("get_sim_info", SendParams);
|
||||||
|
|
||||||
|
XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);
|
||||||
|
|
||||||
|
Hashtable RespData = (Hashtable)GridResp.Value;
|
||||||
|
this.UUID = new LLUUID((string)RespData["UUID"]);
|
||||||
|
this.regionhandle = (ulong)Convert.ToUInt64(RespData["regionhandle"]);
|
||||||
|
this.regionname = (string)RespData["regionname"];
|
||||||
|
this.sim_ip = (string)RespData["sim_ip"];
|
||||||
|
this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
|
||||||
|
this.caps_url = (string)RespData["caps_url"];
|
||||||
|
this.RegionLocX = (uint)Convert.ToUInt32(RespData["RegionLocX"]);
|
||||||
|
this.RegionLocY = (uint)Convert.ToUInt32(RespData["RegionLocY"]);
|
||||||
|
this.sendkey = (string)RespData["sendkey"];
|
||||||
|
this.recvkey = (string)RespData["recvkey"];
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.ToString());
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SimProfile()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Sims
|
||||||
|
{
|
||||||
|
public class SimProfileBase
|
||||||
|
{
|
||||||
|
public LLUUID UUID;
|
||||||
|
public ulong regionhandle;
|
||||||
|
public string regionname;
|
||||||
|
public string sim_ip;
|
||||||
|
public uint sim_port;
|
||||||
|
public string caps_url;
|
||||||
|
public uint RegionLocX;
|
||||||
|
public uint RegionLocY;
|
||||||
|
public string sendkey;
|
||||||
|
public string recvkey;
|
||||||
|
|
||||||
|
public SimProfileBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
using OpenSim.Framework.Inventory;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.User
|
||||||
|
{
|
||||||
|
public class UserProfile
|
||||||
|
{
|
||||||
|
|
||||||
|
public string firstname;
|
||||||
|
public string lastname;
|
||||||
|
public ulong homeregionhandle;
|
||||||
|
public LLVector3 homepos;
|
||||||
|
public LLVector3 homelookat;
|
||||||
|
|
||||||
|
public bool IsGridGod = false;
|
||||||
|
public bool IsLocal = true; // will be used in future for visitors from foreign grids
|
||||||
|
public string AssetURL;
|
||||||
|
public string MD5passwd;
|
||||||
|
|
||||||
|
public LLUUID CurrentSessionID;
|
||||||
|
public LLUUID CurrentSecureSessionID;
|
||||||
|
public LLUUID UUID;
|
||||||
|
public Dictionary<LLUUID, uint> Circuits = new Dictionary<LLUUID, uint>(); // tracks circuit codes
|
||||||
|
|
||||||
|
public AgentInventory Inventory;
|
||||||
|
|
||||||
|
public UserProfile()
|
||||||
|
{
|
||||||
|
Circuits = new Dictionary<LLUUID, uint>();
|
||||||
|
Inventory = new AgentInventory();
|
||||||
|
homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitSessionData()
|
||||||
|
{
|
||||||
|
CurrentSessionID = LLUUID.Random();
|
||||||
|
CurrentSecureSessionID = LLUUID.Random();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddSimCircuit(uint circuitCode, LLUUID regionUUID)
|
||||||
|
{
|
||||||
|
if (this.Circuits.ContainsKey(regionUUID) == false)
|
||||||
|
this.Circuits.Add(regionUUID, circuitCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,223 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Xml;
|
||||||
|
using libsecondlife;
|
||||||
|
using Nwc.XmlRpc;
|
||||||
|
using OpenSim.Framework.Sims;
|
||||||
|
using OpenSim.Framework.Inventory;
|
||||||
|
using OpenSim.Framework.Utilities;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.User
|
||||||
|
{
|
||||||
|
public class UserProfileManager : UserProfileManagerBase
|
||||||
|
{
|
||||||
|
public string GridURL;
|
||||||
|
public string GridSendKey;
|
||||||
|
public string GridRecvKey;
|
||||||
|
public string DefaultStartupMsg;
|
||||||
|
|
||||||
|
public UserProfileManager()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetKeys(string sendKey, string recvKey, string url, string message)
|
||||||
|
{
|
||||||
|
GridRecvKey = recvKey;
|
||||||
|
GridSendKey = sendKey;
|
||||||
|
GridURL = url;
|
||||||
|
DefaultStartupMsg = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual string ParseXMLRPC(string requestBody)
|
||||||
|
{
|
||||||
|
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
|
||||||
|
|
||||||
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
|
switch (request.MethodName)
|
||||||
|
{
|
||||||
|
case "login_to_simulator":
|
||||||
|
bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
|
||||||
|
bool GoodLogin = false;
|
||||||
|
string firstname = "";
|
||||||
|
string lastname = "";
|
||||||
|
string passwd = "";
|
||||||
|
|
||||||
|
if (GoodXML)
|
||||||
|
{
|
||||||
|
firstname = (string)requestData["first"];
|
||||||
|
lastname = (string)requestData["last"];
|
||||||
|
passwd = (string)requestData["passwd"];
|
||||||
|
GoodLogin = AuthenticateUser(firstname, lastname, passwd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!(GoodXML && GoodLogin))
|
||||||
|
{
|
||||||
|
XmlRpcResponse LoginErrorResp = new XmlRpcResponse();
|
||||||
|
Hashtable ErrorRespData = new Hashtable();
|
||||||
|
ErrorRespData["reason"] = "key";
|
||||||
|
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";
|
||||||
|
ErrorRespData["login"] = "false";
|
||||||
|
LoginErrorResp.Value = ErrorRespData;
|
||||||
|
return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(LoginErrorResp), " encoding=\"utf-16\"", ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
UserProfile TheUser = GetProfileByName(firstname, lastname);
|
||||||
|
|
||||||
|
if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null)))
|
||||||
|
{
|
||||||
|
XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
|
||||||
|
Hashtable PresenceErrorRespData = new Hashtable();
|
||||||
|
PresenceErrorRespData["reason"] = "presence";
|
||||||
|
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";
|
||||||
|
PresenceErrorRespData["login"] = "false";
|
||||||
|
PresenceErrorResp.Value = PresenceErrorRespData;
|
||||||
|
return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", ""));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LLUUID AgentID = TheUser.UUID;
|
||||||
|
TheUser.InitSessionData();
|
||||||
|
// SimProfile SimInfo = new SimProfile();
|
||||||
|
// SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
|
||||||
|
|
||||||
|
XmlRpcResponse LoginGoodResp = new XmlRpcResponse();
|
||||||
|
Hashtable LoginGoodData = new Hashtable();
|
||||||
|
|
||||||
|
Hashtable GlobalT = new Hashtable();
|
||||||
|
GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
|
||||||
|
GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
|
||||||
|
GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
|
||||||
|
ArrayList GlobalTextures = new ArrayList();
|
||||||
|
GlobalTextures.Add(GlobalT);
|
||||||
|
|
||||||
|
Hashtable LoginFlagsHash = new Hashtable();
|
||||||
|
LoginFlagsHash["daylight_savings"] = "N";
|
||||||
|
LoginFlagsHash["stipend_since_login"] = "N";
|
||||||
|
LoginFlagsHash["gendered"] = "Y";
|
||||||
|
LoginFlagsHash["ever_logged_in"] = "Y";
|
||||||
|
ArrayList LoginFlags = new ArrayList();
|
||||||
|
LoginFlags.Add(LoginFlagsHash);
|
||||||
|
|
||||||
|
Hashtable uiconfig = new Hashtable();
|
||||||
|
uiconfig["allow_first_life"] = "Y";
|
||||||
|
ArrayList ui_config = new ArrayList();
|
||||||
|
ui_config.Add(uiconfig);
|
||||||
|
|
||||||
|
Hashtable ClassifiedCategoriesHash = new Hashtable();
|
||||||
|
ClassifiedCategoriesHash["category_name"] = "bla bla";
|
||||||
|
ClassifiedCategoriesHash["category_id"] = (Int32)1;
|
||||||
|
ArrayList ClassifiedCategories = new ArrayList();
|
||||||
|
ClassifiedCategories.Add(ClassifiedCategoriesHash);
|
||||||
|
|
||||||
|
ArrayList AgentInventory = new ArrayList();
|
||||||
|
foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values)
|
||||||
|
{
|
||||||
|
Hashtable TempHash = new Hashtable();
|
||||||
|
TempHash["name"] = InvFolder.FolderName;
|
||||||
|
TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
|
||||||
|
TempHash["version"] = (Int32)InvFolder.Version;
|
||||||
|
TempHash["type_default"] = (Int32)InvFolder.DefaultType;
|
||||||
|
TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
|
||||||
|
AgentInventory.Add(TempHash);
|
||||||
|
}
|
||||||
|
|
||||||
|
Hashtable InventoryRootHash = new Hashtable();
|
||||||
|
InventoryRootHash["folder_id"] = TheUser.Inventory.InventoryRoot.FolderID.ToStringHyphenated();
|
||||||
|
ArrayList InventoryRoot = new ArrayList();
|
||||||
|
InventoryRoot.Add(InventoryRootHash);
|
||||||
|
|
||||||
|
Hashtable InitialOutfitHash = new Hashtable();
|
||||||
|
InitialOutfitHash["folder_name"] = "Nightclub Female";
|
||||||
|
InitialOutfitHash["gender"] = "female";
|
||||||
|
ArrayList InitialOutfit = new ArrayList();
|
||||||
|
InitialOutfit.Add(InitialOutfitHash);
|
||||||
|
|
||||||
|
uint circode = (uint)(Util.RandomClass.Next());
|
||||||
|
//TheUser.AddSimCircuit(circode, SimInfo.UUID);
|
||||||
|
|
||||||
|
LoginGoodData["last_name"] = "\"" + TheUser.firstname + "\"";
|
||||||
|
LoginGoodData["ui-config"] = ui_config;
|
||||||
|
LoginGoodData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString();
|
||||||
|
LoginGoodData["login-flags"] = LoginFlags;
|
||||||
|
LoginGoodData["global-textures"] = GlobalTextures;
|
||||||
|
LoginGoodData["classified_categories"] = ClassifiedCategories;
|
||||||
|
LoginGoodData["event_categories"] = new ArrayList();
|
||||||
|
LoginGoodData["inventory-skeleton"] = AgentInventory;
|
||||||
|
LoginGoodData["inventory-skel-lib"] = new ArrayList();
|
||||||
|
LoginGoodData["inventory-root"] = InventoryRoot;
|
||||||
|
LoginGoodData["event_notifications"] = new ArrayList();
|
||||||
|
LoginGoodData["gestures"] = new ArrayList();
|
||||||
|
LoginGoodData["inventory-lib-owner"] = new ArrayList();
|
||||||
|
LoginGoodData["initial-outfit"] = InitialOutfit;
|
||||||
|
LoginGoodData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
|
LoginGoodData["start_location"] = "last";
|
||||||
|
LoginGoodData["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() + "]}";
|
||||||
|
LoginGoodData["message"] = DefaultStartupMsg;
|
||||||
|
LoginGoodData["first_name"] = "\"" + firstname + "\"";
|
||||||
|
LoginGoodData["circuit_code"] = (Int32)circode;
|
||||||
|
LoginGoodData["sim_port"] = 9000; //(Int32)SimInfo.sim_port;
|
||||||
|
LoginGoodData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated();
|
||||||
|
LoginGoodData["look_at"] = "\n[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]\n";
|
||||||
|
LoginGoodData["agent_id"] = AgentID.ToStringHyphenated();
|
||||||
|
LoginGoodData["region_y"] = (Int32) 996 * 256; // (Int32)SimInfo.RegionLocY * 256;
|
||||||
|
LoginGoodData["region_x"] = (Int32) 997 * 256; //SimInfo.RegionLocX * 256;
|
||||||
|
LoginGoodData["seed_capability"] = null;
|
||||||
|
LoginGoodData["agent_access"] = "M";
|
||||||
|
LoginGoodData["session_id"] = TheUser.CurrentSessionID.ToStringHyphenated();
|
||||||
|
LoginGoodData["login"] = "true";
|
||||||
|
|
||||||
|
this.CustomiseResponse(ref LoginGoodData, TheUser);
|
||||||
|
LoginGoodResp.Value = LoginGoodData;
|
||||||
|
//TheUser.SendDataToSim(SimInfo);
|
||||||
|
return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(LoginGoodResp), "utf-16", "utf-8"));
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception E)
|
||||||
|
{
|
||||||
|
Console.WriteLine(E.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void CustomiseResponse(ref Hashtable response, UserProfile theUser)
|
||||||
|
{
|
||||||
|
//default method set up to act as ogs user server
|
||||||
|
SimProfile SimInfo = new SimProfile();
|
||||||
|
//get siminfo from grid server
|
||||||
|
SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
|
||||||
|
uint circode = (uint)response["circuit_code"];
|
||||||
|
theUser.AddSimCircuit(circode, SimInfo.UUID);
|
||||||
|
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() + "]}";
|
||||||
|
response["sim_ip"] = SimInfo.sim_ip.ToString();
|
||||||
|
response["sim_port"] = (Int32)SimInfo.sim_port;
|
||||||
|
response["region_y"] = (Int32) SimInfo.RegionLocY * 256;
|
||||||
|
response["region_x"] = (Int32) SimInfo.RegionLocX * 256;
|
||||||
|
|
||||||
|
//default is ogs user server, so let the sim know about the user via a XmlRpcRequest
|
||||||
|
Console.WriteLine(SimInfo.caps_url);
|
||||||
|
Hashtable SimParams = new Hashtable();
|
||||||
|
SimParams["session_id"] = theUser.CurrentSessionID.ToString();
|
||||||
|
SimParams["secure_session_id"] = theUser.CurrentSecureSessionID.ToString();
|
||||||
|
SimParams["firstname"] = theUser.firstname;
|
||||||
|
SimParams["lastname"] = theUser.lastname;
|
||||||
|
SimParams["agent_id"] = theUser.UUID.ToString();
|
||||||
|
SimParams["circuit_code"] = (Int32)theUser.Circuits[SimInfo.UUID];
|
||||||
|
ArrayList SendParams = new ArrayList();
|
||||||
|
SendParams.Add(SimParams);
|
||||||
|
|
||||||
|
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
|
||||||
|
XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
using OpenSim.Framework.Utilities;
|
||||||
|
using OpenSim.Framework.Inventory;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.User
|
||||||
|
{
|
||||||
|
public class UserProfileManagerBase
|
||||||
|
{
|
||||||
|
|
||||||
|
public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>();
|
||||||
|
|
||||||
|
public UserProfileManagerBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void InitUserProfiles()
|
||||||
|
{
|
||||||
|
// TODO: need to load from database
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserProfile GetProfileByName(string firstname, string lastname)
|
||||||
|
{
|
||||||
|
foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys)
|
||||||
|
{
|
||||||
|
if ((UserProfiles[UUID].firstname == firstname) && (UserProfiles[UUID].lastname == lastname))
|
||||||
|
{
|
||||||
|
return UserProfiles[UUID];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserProfile GetProfileByLLUUID(LLUUID ProfileLLUUID)
|
||||||
|
{
|
||||||
|
return UserProfiles[ProfileLLUUID];
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool AuthenticateUser(string firstname, string lastname, string passwd)
|
||||||
|
{
|
||||||
|
UserProfile TheUser = GetProfileByName(firstname, lastname);
|
||||||
|
if (TheUser != null)
|
||||||
|
{
|
||||||
|
if (TheUser.MD5passwd == passwd)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetGod(LLUUID GodID)
|
||||||
|
{
|
||||||
|
this.UserProfiles[GodID].IsGridGod = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd)
|
||||||
|
{
|
||||||
|
UserProfile newprofile = new UserProfile();
|
||||||
|
newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256));
|
||||||
|
newprofile.firstname = firstname;
|
||||||
|
newprofile.lastname = lastname;
|
||||||
|
newprofile.MD5passwd = MD5passwd;
|
||||||
|
newprofile.UUID = LLUUID.Random();
|
||||||
|
this.UserProfiles.Add(newprofile.UUID, newprofile);
|
||||||
|
return newprofile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual AgentInventory GetUsersInventory(LLUUID agentID)
|
||||||
|
{
|
||||||
|
UserProfile user = this.GetProfileByLLUUID(agentID);
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
|
return user.Inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
using libsecondlife.Packets;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Utilities
|
||||||
|
{
|
||||||
|
public class Util
|
||||||
|
{
|
||||||
|
private static Random randomClass = new Random();
|
||||||
|
|
||||||
|
public static ulong UIntsToLong(uint X, uint Y)
|
||||||
|
{
|
||||||
|
return Helpers.UIntsToLong(X, Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Random RandomClass
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return randomClass;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Util()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// Information about this assembly is defined by the following
|
||||||
|
// attributes.
|
||||||
|
//
|
||||||
|
// change them to the information which is associated with the assembly
|
||||||
|
// you compile.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("LocalGridServers")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("LocalGridServers")]
|
||||||
|
[assembly: AssemblyCopyright("")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
|
@ -0,0 +1,208 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.IO;
|
||||||
|
using OpenSim.Framework.Interfaces;
|
||||||
|
using OpenSim.Framework.Assets;
|
||||||
|
using OpenSim.Framework.Utilities;
|
||||||
|
using libsecondlife;
|
||||||
|
using Db4objects.Db4o;
|
||||||
|
using Db4objects.Db4o.Query;
|
||||||
|
|
||||||
|
namespace OpenSim.GridInterfaces.Local
|
||||||
|
{
|
||||||
|
public class LocalAssetPlugin : IAssetPlugin
|
||||||
|
{
|
||||||
|
public LocalAssetPlugin()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IAssetServer GetAssetServer()
|
||||||
|
{
|
||||||
|
return (new LocalAssetServer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LocalAssetServer : IAssetServer
|
||||||
|
{
|
||||||
|
private IAssetReceiver _receiver;
|
||||||
|
private BlockingQueue<ARequest> _assetRequests;
|
||||||
|
private IObjectContainer db;
|
||||||
|
private Thread _localAssetServerThread;
|
||||||
|
|
||||||
|
public LocalAssetServer()
|
||||||
|
{
|
||||||
|
bool yapfile;
|
||||||
|
this._assetRequests = new BlockingQueue<ARequest>();
|
||||||
|
yapfile = System.IO.File.Exists("assets.yap");
|
||||||
|
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Local Asset Server class created");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
db = Db4oFactory.OpenFile("assets.yap");
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4 Asset database creation");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
db.Close();
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4 Asset server :Constructor - Exception occured");
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
|
||||||
|
}
|
||||||
|
if (!yapfile)
|
||||||
|
{
|
||||||
|
this.SetUpAssetDatabase();
|
||||||
|
}
|
||||||
|
this._localAssetServerThread = new Thread(new ThreadStart(RunRequests));
|
||||||
|
this._localAssetServerThread.IsBackground = true;
|
||||||
|
this._localAssetServerThread.Start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetReceiver(IAssetReceiver receiver)
|
||||||
|
{
|
||||||
|
this._receiver = receiver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RequestAsset(LLUUID assetID, bool isTexture)
|
||||||
|
{
|
||||||
|
ARequest req = new ARequest();
|
||||||
|
req.AssetID = assetID;
|
||||||
|
req.IsTexture = isTexture;
|
||||||
|
this._assetRequests.Enqueue(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateAsset(AssetBase asset)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UploadNewAsset(AssetBase asset)
|
||||||
|
{
|
||||||
|
AssetStorage store = new AssetStorage();
|
||||||
|
store.Data = asset.Data;
|
||||||
|
store.Name = asset.Name;
|
||||||
|
store.UUID = asset.FullID;
|
||||||
|
db.Set(store);
|
||||||
|
db.Commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetServerInfo(string ServerUrl, string ServerKey)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
if (db != null)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Closing local Asset server database");
|
||||||
|
db.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RunRequests()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
byte[] idata = null;
|
||||||
|
bool found = false;
|
||||||
|
AssetStorage foundAsset = null;
|
||||||
|
ARequest req = this._assetRequests.Dequeue();
|
||||||
|
IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
|
||||||
|
if (result.Count > 0)
|
||||||
|
{
|
||||||
|
foundAsset = (AssetStorage)result.Next();
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
AssetBase asset = new AssetBase();
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
asset.FullID = foundAsset.UUID;
|
||||||
|
asset.Type = foundAsset.Type;
|
||||||
|
asset.InvType = foundAsset.Type;
|
||||||
|
asset.Name = foundAsset.Name;
|
||||||
|
idata = foundAsset.Data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
asset.FullID = LLUUID.Zero;
|
||||||
|
}
|
||||||
|
asset.Data = idata;
|
||||||
|
_receiver.AssetReceived(asset, req.IsTexture);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetUpAssetDatabase()
|
||||||
|
{
|
||||||
|
Console.WriteLine("setting up Asset database");
|
||||||
|
|
||||||
|
AssetBase Image = new AssetBase();
|
||||||
|
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
|
||||||
|
Image.Name = "test Texture";
|
||||||
|
this.LoadAsset(Image, true, "testpic2.jp2");
|
||||||
|
AssetStorage store = new AssetStorage();
|
||||||
|
store.Data = Image.Data;
|
||||||
|
store.Name = Image.Name;
|
||||||
|
store.UUID = Image.FullID;
|
||||||
|
db.Set(store);
|
||||||
|
db.Commit();
|
||||||
|
|
||||||
|
Image = new AssetBase();
|
||||||
|
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
|
||||||
|
Image.Name = "test Texture2";
|
||||||
|
this.LoadAsset(Image, true, "map_base.jp2");
|
||||||
|
store = new AssetStorage();
|
||||||
|
store.Data = Image.Data;
|
||||||
|
store.Name = Image.Name;
|
||||||
|
store.UUID = Image.FullID;
|
||||||
|
db.Set(store);
|
||||||
|
db.Commit();
|
||||||
|
|
||||||
|
Image = new AssetBase();
|
||||||
|
Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
|
||||||
|
Image.Name = "Prim Base Texture";
|
||||||
|
this.LoadAsset(Image, true, "testpic2.jp2");
|
||||||
|
store = new AssetStorage();
|
||||||
|
store.Data = Image.Data;
|
||||||
|
store.Name = Image.Name;
|
||||||
|
store.UUID = Image.FullID;
|
||||||
|
db.Set(store);
|
||||||
|
db.Commit();
|
||||||
|
|
||||||
|
Image = new AssetBase();
|
||||||
|
Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||||
|
Image.Name = "Shape";
|
||||||
|
this.LoadAsset(Image, false, "base_shape.dat");
|
||||||
|
store = new AssetStorage();
|
||||||
|
store.Data = Image.Data;
|
||||||
|
store.Name = Image.Name;
|
||||||
|
store.UUID = Image.FullID;
|
||||||
|
db.Set(store);
|
||||||
|
db.Commit();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadAsset(AssetBase info, bool image, string filename)
|
||||||
|
{
|
||||||
|
//should request Asset from storage manager
|
||||||
|
//but for now read from file
|
||||||
|
|
||||||
|
string dataPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
|
||||||
|
string fileName = Path.Combine(dataPath, filename);
|
||||||
|
FileInfo fInfo = new FileInfo(fileName);
|
||||||
|
long numBytes = fInfo.Length;
|
||||||
|
FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
|
||||||
|
byte[] idata = new byte[numBytes];
|
||||||
|
BinaryReader br = new BinaryReader(fStream);
|
||||||
|
idata = br.ReadBytes((int)numBytes);
|
||||||
|
br.Close();
|
||||||
|
fStream.Close();
|
||||||
|
info.Data = idata;
|
||||||
|
//info.loaded=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,10 +27,14 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using OpenSim.GridServers;
|
using System.IO;
|
||||||
|
using OpenSim.Framework.Interfaces;
|
||||||
|
using OpenSim.Framework.Assets;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using Db4objects.Db4o;
|
||||||
|
using Db4objects.Db4o.Query;
|
||||||
|
|
||||||
namespace LocalGridServers
|
namespace OpenSim.GridInterfaces.Local
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -49,67 +53,6 @@ namespace LocalGridServers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LocalAssetPlugin : IAssetPlugin
|
|
||||||
{
|
|
||||||
public LocalAssetPlugin()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public IAssetServer GetAssetServer()
|
|
||||||
{
|
|
||||||
return(new LocalAssetServer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class LocalAssetServer : IAssetServer
|
|
||||||
{
|
|
||||||
private IAssetReceiver _receiver;
|
|
||||||
private BlockingQueue<ARequest> _assetRequests;
|
|
||||||
|
|
||||||
public LocalAssetServer()
|
|
||||||
{
|
|
||||||
this._assetRequests = new BlockingQueue<ARequest>();
|
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Local Asset Server class created");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetReceiver(IAssetReceiver receiver)
|
|
||||||
{
|
|
||||||
this._receiver = receiver;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RequestAsset(LLUUID assetID, bool isTexture)
|
|
||||||
{
|
|
||||||
ARequest req = new ARequest();
|
|
||||||
req.AssetID = assetID;
|
|
||||||
req.IsTexture = isTexture;
|
|
||||||
//this._assetRequests.Enqueue(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateAsset(AssetBase asset)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UploadNewAsset(AssetBase asset)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetServerInfo(string ServerUrl, string SendKey)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RunRequests()
|
|
||||||
{
|
|
||||||
while(true)
|
|
||||||
{
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class LocalGridServer : LocalGridBase
|
public class LocalGridServer : LocalGridBase
|
||||||
{
|
{
|
||||||
public List<Login> Sessions = new List<Login>();
|
public List<Login> Sessions = new List<Login>();
|
||||||
|
@ -117,18 +60,19 @@ namespace LocalGridServers
|
||||||
public LocalGridServer()
|
public LocalGridServer()
|
||||||
{
|
{
|
||||||
Sessions = new List<Login>();
|
Sessions = new List<Login>();
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Local Grid Server class created");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Local Grid Server class created");
|
||||||
}
|
|
||||||
|
|
||||||
public override string GetName()
|
|
||||||
{
|
|
||||||
return "Local";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool RequestConnection()
|
public override bool RequestConnection()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string GetName()
|
||||||
|
{
|
||||||
|
return "Local";
|
||||||
|
}
|
||||||
|
|
||||||
public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
|
public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
|
||||||
{
|
{
|
||||||
//we are running local
|
//we are running local
|
||||||
|
@ -160,12 +104,17 @@ namespace LocalGridServers
|
||||||
return(uuidBlock);
|
return(uuidBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override neighbourinfo[] RequestNeighbours(ulong regionhandle)
|
public override NeighbourInfo[] RequestNeighbours()
|
||||||
{
|
{
|
||||||
return new neighbourinfo[8];
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetServerInfo(string GridServerUrl, string GridSendKey, string GridRecvKey, string UserServerUrl, string UserSendKey, string UserRecvKey)
|
public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Close()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -183,29 +132,25 @@ namespace LocalGridServers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BlockingQueue< T > {
|
public class AssetUUIDQuery : Predicate
|
||||||
private Queue< T > _queue = new Queue< T >();
|
{
|
||||||
private object _queueSync = new object();
|
private LLUUID _findID;
|
||||||
|
|
||||||
public void Enqueue(T value)
|
public AssetUUIDQuery(LLUUID find)
|
||||||
{
|
{
|
||||||
lock(_queueSync)
|
_findID = find;
|
||||||
{
|
|
||||||
_queue.Enqueue(value);
|
|
||||||
Monitor.Pulse(_queueSync);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
public bool Match(AssetStorage asset)
|
||||||
public T Dequeue()
|
|
||||||
{
|
{
|
||||||
lock(_queueSync)
|
return (asset.UUID == _findID);
|
||||||
{
|
|
||||||
if( _queue.Count < 1)
|
|
||||||
Monitor.Wait(_queueSync);
|
|
||||||
|
|
||||||
return _queue.Dequeue();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AssetStorage
|
||||||
|
{
|
||||||
|
public byte[] Data;
|
||||||
|
public sbyte Type;
|
||||||
|
public string Name;
|
||||||
|
public LLUUID UUID;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectType>Local</ProjectType>
|
||||||
|
<ProductVersion>8.0.50727</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{FBF3DA4B-5176-4602-AA52-482D077EEC88}</ProjectGuid>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ApplicationIcon></ApplicationIcon>
|
||||||
|
<AssemblyKeyContainerName>
|
||||||
|
</AssemblyKeyContainerName>
|
||||||
|
<AssemblyName>OpenSim.GridInterfaces.Local</AssemblyName>
|
||||||
|
<DefaultClientScript>JScript</DefaultClientScript>
|
||||||
|
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||||
|
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder></AppDesignerFolder>
|
||||||
|
<RootNamespace>OpenSim.GridInterfaces.Local</RootNamespace>
|
||||||
|
<StartupObject></StartupObject>
|
||||||
|
<FileUpgradeFlags>
|
||||||
|
</FileUpgradeFlags>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>True</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>False</Optimize>
|
||||||
|
<OutputPath>..\..\bin\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>False</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>True</Optimize>
|
||||||
|
<OutputPath>..\..\bin\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" >
|
||||||
|
<HintPath>\System.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml.dll" >
|
||||||
|
<HintPath>\System.Xml.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Db4objects.Db4o.dll" >
|
||||||
|
<HintPath>\Db4objects.Db4o.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="libsecondlife.dll" >
|
||||||
|
<HintPath>\libsecondlife.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
|
||||||
|
<Name>OpenSim.Framework</Name>
|
||||||
|
<Project>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</Project>
|
||||||
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
|
||||||
|
<Name>OpenSim.Framework.Console</Name>
|
||||||
|
<Project>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</Project>
|
||||||
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="LocalAssetServer.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="LocalGridServer.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>
|
||||||
|
</PreBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<project name="OpenSim.GridInterfaces.Local" default="build">
|
||||||
|
<target name="build">
|
||||||
|
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<copy todir="${project::get-base-directory()}/${build.dir}">
|
||||||
|
<fileset basedir="${project::get-base-directory()}">
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
|
||||||
|
<resources prefix="OpenSim.GridInterfaces.Local" dynamicprefix="true" >
|
||||||
|
</resources>
|
||||||
|
<sources failonempty="true">
|
||||||
|
<include name="AssemblyInfo.cs" />
|
||||||
|
<include name="LocalAssetServer.cs" />
|
||||||
|
<include name="LocalGridServer.cs" />
|
||||||
|
</sources>
|
||||||
|
<references basedir="${project::get-base-directory()}">
|
||||||
|
<lib>
|
||||||
|
<include name="${project::get-base-directory()}" />
|
||||||
|
<include name="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
</lib>
|
||||||
|
<include name="System.dll" />
|
||||||
|
<include name="System.Xml.dll.dll" />
|
||||||
|
<include name="../../bin/Db4objects.Db4o.dll" />
|
||||||
|
<include name="../../bin/libsecondlife.dll" />
|
||||||
|
<include name="../../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
|
||||||
|
<include name="../../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
|
||||||
|
</references>
|
||||||
|
</csc>
|
||||||
|
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/../../bin/"/>
|
||||||
|
<copy todir="${project::get-base-directory()}/../../bin/">
|
||||||
|
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
|
||||||
|
<include name="*.dll"/>
|
||||||
|
<include name="*.exe"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
<target name="clean">
|
||||||
|
<delete dir="${bin.dir}" failonerror="false" />
|
||||||
|
<delete dir="${obj.dir}" failonerror="false" />
|
||||||
|
</target>
|
||||||
|
<target name="doc" description="Creates documentation.">
|
||||||
|
</target>
|
||||||
|
</project>
|
|
@ -0,0 +1,31 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// Information about this assembly is defined by the following
|
||||||
|
// attributes.
|
||||||
|
//
|
||||||
|
// change them to the information which is associated with the assembly
|
||||||
|
// you compile.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("RemoteGridServers")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("RemoteGridServers")]
|
||||||
|
[assembly: AssemblyCopyright("")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
|
@ -0,0 +1,101 @@
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectType>Local</ProjectType>
|
||||||
|
<ProductVersion>8.0.50727</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{2AF1E37E-064D-4590-8D7E-B6390F721BAE}</ProjectGuid>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ApplicationIcon></ApplicationIcon>
|
||||||
|
<AssemblyKeyContainerName>
|
||||||
|
</AssemblyKeyContainerName>
|
||||||
|
<AssemblyName>OpenSim.GridInterfaces.Remote</AssemblyName>
|
||||||
|
<DefaultClientScript>JScript</DefaultClientScript>
|
||||||
|
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||||
|
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder></AppDesignerFolder>
|
||||||
|
<RootNamespace>OpenSim.GridInterfaces.Remote</RootNamespace>
|
||||||
|
<StartupObject></StartupObject>
|
||||||
|
<FileUpgradeFlags>
|
||||||
|
</FileUpgradeFlags>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>True</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>False</Optimize>
|
||||||
|
<OutputPath>..\..\bin\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>False</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>True</Optimize>
|
||||||
|
<OutputPath>..\..\bin\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" >
|
||||||
|
<HintPath>\System.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml.dll" >
|
||||||
|
<HintPath>\System.Xml.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="libsecondlife.dll" >
|
||||||
|
<HintPath>\libsecondlife.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
|
||||||
|
<Name>OpenSim.Framework</Name>
|
||||||
|
<Project>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</Project>
|
||||||
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
|
||||||
|
<Name>OpenSim.Framework.Console</Name>
|
||||||
|
<Project>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</Project>
|
||||||
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="RemoteAssetServer.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="RemoteGridServer.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>
|
||||||
|
</PreBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<project name="OpenSim.GridInterfaces.Remote" default="build">
|
||||||
|
<target name="build">
|
||||||
|
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<copy todir="${project::get-base-directory()}/${build.dir}">
|
||||||
|
<fileset basedir="${project::get-base-directory()}">
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
|
||||||
|
<resources prefix="OpenSim.GridInterfaces.Remote" dynamicprefix="true" >
|
||||||
|
</resources>
|
||||||
|
<sources failonempty="true">
|
||||||
|
<include name="AssemblyInfo.cs" />
|
||||||
|
<include name="RemoteAssetServer.cs" />
|
||||||
|
<include name="RemoteGridServer.cs" />
|
||||||
|
</sources>
|
||||||
|
<references basedir="${project::get-base-directory()}">
|
||||||
|
<lib>
|
||||||
|
<include name="${project::get-base-directory()}" />
|
||||||
|
<include name="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
</lib>
|
||||||
|
<include name="System.dll" />
|
||||||
|
<include name="System.Xml.dll.dll" />
|
||||||
|
<include name="../../bin/libsecondlife.dll" />
|
||||||
|
<include name="../../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
|
||||||
|
<include name="../../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
|
||||||
|
</references>
|
||||||
|
</csc>
|
||||||
|
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/../../bin/"/>
|
||||||
|
<copy todir="${project::get-base-directory()}/../../bin/">
|
||||||
|
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
|
||||||
|
<include name="*.dll"/>
|
||||||
|
<include name="*.exe"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
<target name="clean">
|
||||||
|
<delete dir="${bin.dir}" failonerror="false" />
|
||||||
|
<delete dir="${obj.dir}" failonerror="false" />
|
||||||
|
</target>
|
||||||
|
<target name="doc" description="Creates documentation.">
|
||||||
|
</target>
|
||||||
|
</project>
|
|
@ -0,0 +1,102 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.IO;
|
||||||
|
using libsecondlife;
|
||||||
|
using OpenSim.Framework.Interfaces;
|
||||||
|
using OpenSim.Framework.Assets;
|
||||||
|
using OpenSim.Framework.Utilities;
|
||||||
|
|
||||||
|
namespace OpenSim.GridInterfaces.Remote
|
||||||
|
{
|
||||||
|
public class RemoteAssetServer : IAssetServer
|
||||||
|
{
|
||||||
|
private IAssetReceiver _receiver;
|
||||||
|
private BlockingQueue<ARequest> _assetRequests;
|
||||||
|
private Thread _remoteAssetServerThread;
|
||||||
|
private string AssetServerUrl;
|
||||||
|
private string AssetSendKey;
|
||||||
|
|
||||||
|
public RemoteAssetServer()
|
||||||
|
{
|
||||||
|
this._assetRequests = new BlockingQueue<ARequest>();
|
||||||
|
this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests));
|
||||||
|
this._remoteAssetServerThread.IsBackground = true;
|
||||||
|
this._remoteAssetServerThread.Start();
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Remote Asset Server class created");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetReceiver(IAssetReceiver receiver)
|
||||||
|
{
|
||||||
|
this._receiver = receiver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RequestAsset(LLUUID assetID, bool isTexture)
|
||||||
|
{
|
||||||
|
ARequest req = new ARequest();
|
||||||
|
req.AssetID = assetID;
|
||||||
|
req.IsTexture = isTexture;
|
||||||
|
this._assetRequests.Enqueue(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateAsset(AssetBase asset)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UploadNewAsset(AssetBase asset)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetServerInfo(string ServerUrl, string ServerKey)
|
||||||
|
{
|
||||||
|
this.AssetServerUrl = ServerUrl;
|
||||||
|
this.AssetSendKey = ServerKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RunRequests()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
//we need to add support for the asset server not knowing about a requested asset
|
||||||
|
ARequest req = this._assetRequests.Dequeue();
|
||||||
|
LLUUID assetID = req.AssetID;
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it");
|
||||||
|
WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data");
|
||||||
|
WebResponse AssetResponse = AssetLoad.GetResponse();
|
||||||
|
byte[] idata = new byte[(int)AssetResponse.ContentLength];
|
||||||
|
BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream());
|
||||||
|
idata = br.ReadBytes((int)AssetResponse.ContentLength);
|
||||||
|
br.Close();
|
||||||
|
|
||||||
|
AssetBase asset = new AssetBase();
|
||||||
|
asset.FullID = assetID;
|
||||||
|
asset.Data = idata;
|
||||||
|
_receiver.AssetReceived(asset, req.IsTexture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RemoteAssetPlugin : IAssetPlugin
|
||||||
|
{
|
||||||
|
public RemoteAssetPlugin()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IAssetServer GetAssetServer()
|
||||||
|
{
|
||||||
|
return (new RemoteAssetServer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,156 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.IO;
|
||||||
|
using libsecondlife;
|
||||||
|
using OpenSim.Framework.Interfaces;
|
||||||
|
using OpenSim.Framework.Assets;
|
||||||
|
|
||||||
|
namespace OpenSim.GridInterfaces.Remote
|
||||||
|
{
|
||||||
|
public class RemoteGridServer : RemoteGridBase
|
||||||
|
{
|
||||||
|
private string GridServerUrl;
|
||||||
|
private string GridSendKey;
|
||||||
|
private string GridRecvKey;
|
||||||
|
private Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>();
|
||||||
|
|
||||||
|
public override Dictionary<uint, AgentCircuitData> agentcircuits
|
||||||
|
{
|
||||||
|
get { return AgentCircuits; }
|
||||||
|
set { AgentCircuits = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public RemoteGridServer()
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Remote Grid Server class created");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool RequestConnection()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode)
|
||||||
|
{
|
||||||
|
AgentCircuitData validcircuit = null;
|
||||||
|
if (this.AgentCircuits.ContainsKey(circuitcode))
|
||||||
|
{
|
||||||
|
validcircuit = this.AgentCircuits[circuitcode];
|
||||||
|
}
|
||||||
|
AuthenticateResponse user = new AuthenticateResponse();
|
||||||
|
if (validcircuit == null)
|
||||||
|
{
|
||||||
|
//don't have this circuit code in our list
|
||||||
|
user.Authorised = false;
|
||||||
|
return (user);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID))
|
||||||
|
{
|
||||||
|
// YAY! Valid login
|
||||||
|
user.Authorised = true;
|
||||||
|
user.LoginInfo = new Login();
|
||||||
|
user.LoginInfo.Agent = agentID;
|
||||||
|
user.LoginInfo.Session = sessionID;
|
||||||
|
user.LoginInfo.SecureSession = validcircuit.SecureSessionID;
|
||||||
|
user.LoginInfo.First = validcircuit.firstname;
|
||||||
|
user.LoginInfo.Last = validcircuit.lastname;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Invalid
|
||||||
|
user.Authorised = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
|
||||||
|
{
|
||||||
|
WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + sessionID.ToString());
|
||||||
|
DeleteSession.Method = "DELETE";
|
||||||
|
DeleteSession.ContentType = "text/plaintext";
|
||||||
|
DeleteSession.ContentLength = 0;
|
||||||
|
|
||||||
|
StreamWriter stOut = new StreamWriter(DeleteSession.GetRequestStream(), System.Text.Encoding.ASCII);
|
||||||
|
stOut.Write("");
|
||||||
|
stOut.Close();
|
||||||
|
|
||||||
|
StreamReader stIn = new StreamReader(DeleteSession.GetResponse().GetResponseStream());
|
||||||
|
string GridResponse = stIn.ReadToEnd();
|
||||||
|
stIn.Close();
|
||||||
|
return (true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override UUIDBlock RequestUUIDBlock()
|
||||||
|
{
|
||||||
|
UUIDBlock uuidBlock = new UUIDBlock();
|
||||||
|
return (uuidBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override NeighbourInfo[] RequestNeighbours()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
|
||||||
|
{
|
||||||
|
this.GridServerUrl = ServerUrl;
|
||||||
|
this.GridSendKey = SendKey;
|
||||||
|
this.GridRecvKey = RecvKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string GetName()
|
||||||
|
{
|
||||||
|
return "Remote";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Close()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RemoteGridPlugin : IGridPlugin
|
||||||
|
{
|
||||||
|
public RemoteGridPlugin()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IGridServer GetGridServer()
|
||||||
|
{
|
||||||
|
return (new RemoteGridServer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// Information about this assembly is defined by the following
|
||||||
|
// attributes.
|
||||||
|
//
|
||||||
|
// change them to the information which is associated with the assembly
|
||||||
|
// you compile.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("PhysXplugin")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("PhysXplugin")]
|
||||||
|
[assembly: AssemblyCopyright("")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
|
@ -26,18 +26,18 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using PhysicsSystem;
|
using OpenSim.Physics.Manager;
|
||||||
|
|
||||||
namespace PhysXplugin
|
namespace OpenSim.Physics.BasicPhysicsPlugin
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Will be the PhysX plugin but for now will be a very basic physics engine
|
/// Will be the PhysX plugin but for now will be a very basic physics engine
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PhysXPlugin : IPhysicsPlugin
|
public class BasicPhysicsPlugin : IPhysicsPlugin
|
||||||
{
|
{
|
||||||
private PhysXScene _mScene;
|
private BasicScene _mScene;
|
||||||
|
|
||||||
public PhysXPlugin()
|
public BasicPhysicsPlugin()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,14 +51,14 @@ namespace PhysXplugin
|
||||||
{
|
{
|
||||||
if(_mScene == null)
|
if(_mScene == null)
|
||||||
{
|
{
|
||||||
_mScene = new PhysXScene();
|
_mScene = new BasicScene();
|
||||||
}
|
}
|
||||||
return(_mScene);
|
return(_mScene);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetName()
|
public string GetName()
|
||||||
{
|
{
|
||||||
return("PhysX");
|
return("basicphysics");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
@ -67,19 +67,19 @@ namespace PhysXplugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PhysXScene :PhysicsScene
|
public class BasicScene :PhysicsScene
|
||||||
{
|
{
|
||||||
private List<PhysXActor> _actors = new List<PhysXActor>();
|
private List<BasicActor> _actors = new List<BasicActor>();
|
||||||
private float[] _heightMap;
|
private float[] _heightMap;
|
||||||
|
|
||||||
public PhysXScene()
|
public BasicScene()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(PhysicsVector position)
|
public override PhysicsActor AddAvatar(PhysicsVector position)
|
||||||
{
|
{
|
||||||
PhysXActor act = new PhysXActor();
|
BasicActor act = new BasicActor();
|
||||||
act.Position = position;
|
act.Position = position;
|
||||||
_actors.Add(act);
|
_actors.Add(act);
|
||||||
return act;
|
return act;
|
||||||
|
@ -92,7 +92,7 @@ namespace PhysXplugin
|
||||||
|
|
||||||
public override void Simulate(float timeStep)
|
public override void Simulate(float timeStep)
|
||||||
{
|
{
|
||||||
foreach (PhysXActor actor in _actors)
|
foreach (BasicActor actor in _actors)
|
||||||
{
|
{
|
||||||
actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep);
|
actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep);
|
||||||
actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep);
|
actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep);
|
||||||
|
@ -151,13 +151,13 @@ namespace PhysXplugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PhysXActor : PhysicsActor
|
public class BasicActor : PhysicsActor
|
||||||
{
|
{
|
||||||
private PhysicsVector _position;
|
private PhysicsVector _position;
|
||||||
private PhysicsVector _velocity;
|
private PhysicsVector _velocity;
|
||||||
private PhysicsVector _acceleration;
|
private PhysicsVector _acceleration;
|
||||||
private bool flying;
|
private bool flying;
|
||||||
public PhysXActor()
|
public BasicActor()
|
||||||
{
|
{
|
||||||
_velocity = new PhysicsVector();
|
_velocity = new PhysicsVector();
|
||||||
_position = new PhysicsVector();
|
_position = new PhysicsVector();
|
||||||
|
@ -200,6 +200,18 @@ namespace PhysXplugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Axiom.MathLib.Quaternion Orientation
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Axiom.MathLib.Quaternion.Identity;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override PhysicsVector Acceleration
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -208,6 +220,18 @@ namespace PhysXplugin
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Kinematic
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
public void SetAcceleration (PhysicsVector accel)
|
public void SetAcceleration (PhysicsVector accel)
|
||||||
{
|
{
|
||||||
this._acceleration = accel;
|
this._acceleration = accel;
|
|
@ -0,0 +1,90 @@
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectType>Local</ProjectType>
|
||||||
|
<ProductVersion>8.0.50727</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{00594B9E-29A5-4B9C-AEBD-0AD08C73CFE8}</ProjectGuid>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ApplicationIcon></ApplicationIcon>
|
||||||
|
<AssemblyKeyContainerName>
|
||||||
|
</AssemblyKeyContainerName>
|
||||||
|
<AssemblyName>OpenSim.Physics.BasicPhysicsPlugin</AssemblyName>
|
||||||
|
<DefaultClientScript>JScript</DefaultClientScript>
|
||||||
|
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||||
|
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder></AppDesignerFolder>
|
||||||
|
<RootNamespace>OpenSim.Physics.BasicPhysicsPlugin</RootNamespace>
|
||||||
|
<StartupObject></StartupObject>
|
||||||
|
<FileUpgradeFlags>
|
||||||
|
</FileUpgradeFlags>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>True</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>False</Optimize>
|
||||||
|
<OutputPath>..\..\bin\Physics\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>False</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>True</Optimize>
|
||||||
|
<OutputPath>..\..\bin\Physics\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" >
|
||||||
|
<HintPath>\System.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Axiom.MathLib.dll" >
|
||||||
|
<HintPath>\Axiom.MathLib.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Manager\OpenSim.Physics.Manager.csproj">
|
||||||
|
<Name>OpenSim.Physics.Manager</Name>
|
||||||
|
<Project>{58360A80-9333-4E0F-8F83-3CF937E51633}</Project>
|
||||||
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="BasicPhysicsPlugin.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>
|
||||||
|
</PreBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ReferencePath>C:\Documents and Settings\Stefan\My Documents\Projects\source\opensim\branches\zircon\bin\</ReferencePath>
|
||||||
|
<LastOpenVersion>8.0.50727</LastOpenVersion>
|
||||||
|
<ProjectView>ProjectFiles</ProjectView>
|
||||||
|
<ProjectTrust>0</ProjectTrust>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
|
||||||
|
<PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
|
||||||
|
</Project>
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<project name="OpenSim.Physics.BasicPhysicsPlugin" default="build">
|
||||||
|
<target name="build">
|
||||||
|
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<copy todir="${project::get-base-directory()}/${build.dir}">
|
||||||
|
<fileset basedir="${project::get-base-directory()}">
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
|
||||||
|
<resources prefix="OpenSim.Physics.BasicPhysicsPlugin" dynamicprefix="true" >
|
||||||
|
</resources>
|
||||||
|
<sources failonempty="true">
|
||||||
|
<include name="AssemblyInfo.cs" />
|
||||||
|
<include name="BasicPhysicsPlugin.cs" />
|
||||||
|
</sources>
|
||||||
|
<references basedir="${project::get-base-directory()}">
|
||||||
|
<lib>
|
||||||
|
<include name="${project::get-base-directory()}" />
|
||||||
|
<include name="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
</lib>
|
||||||
|
<include name="System.dll" />
|
||||||
|
<include name="../../bin/Axiom.MathLib.dll" />
|
||||||
|
<include name="../Manager/${build.dir}/OpenSim.Physics.Manager.dll" />
|
||||||
|
</references>
|
||||||
|
</csc>
|
||||||
|
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/Physics/" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/../../bin/Physics/"/>
|
||||||
|
<copy todir="${project::get-base-directory()}/../../bin/Physics/">
|
||||||
|
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
|
||||||
|
<include name="*.dll"/>
|
||||||
|
<include name="*.exe"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
<target name="clean">
|
||||||
|
<delete dir="${bin.dir}" failonerror="false" />
|
||||||
|
<delete dir="${obj.dir}" failonerror="false" />
|
||||||
|
</target>
|
||||||
|
<target name="doc" description="Creates documentation.">
|
||||||
|
</target>
|
||||||
|
</project>
|
|
@ -0,0 +1,31 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// Information about this assembly is defined by the following
|
||||||
|
// attributes.
|
||||||
|
//
|
||||||
|
// change them to the information which is associated with the assembly
|
||||||
|
// you compile.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("PhysicsManager")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("PhysicsManager")]
|
||||||
|
[assembly: AssemblyCopyright("")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
|
@ -0,0 +1,102 @@
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectType>Local</ProjectType>
|
||||||
|
<ProductVersion>8.0.50727</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{58360A80-9333-4E0F-8F83-3CF937E51633}</ProjectGuid>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ApplicationIcon></ApplicationIcon>
|
||||||
|
<AssemblyKeyContainerName>
|
||||||
|
</AssemblyKeyContainerName>
|
||||||
|
<AssemblyName>OpenSim.Physics.Manager</AssemblyName>
|
||||||
|
<DefaultClientScript>JScript</DefaultClientScript>
|
||||||
|
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||||
|
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder></AppDesignerFolder>
|
||||||
|
<RootNamespace>OpenSim.Physics.Manager</RootNamespace>
|
||||||
|
<StartupObject></StartupObject>
|
||||||
|
<FileUpgradeFlags>
|
||||||
|
</FileUpgradeFlags>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>True</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>False</Optimize>
|
||||||
|
<OutputPath>..\..\bin\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>False</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>True</Optimize>
|
||||||
|
<OutputPath>..\..\bin\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" >
|
||||||
|
<HintPath>\System.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml.dll" >
|
||||||
|
<HintPath>\System.Xml.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Axiom.MathLib.dll" >
|
||||||
|
<HintPath>\Axiom.MathLib.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
|
||||||
|
<Name>OpenSim.Framework.Console</Name>
|
||||||
|
<Project>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</Project>
|
||||||
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="PhysicsActor.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="PhysicsManager.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="PhysicsScene.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="PhysicsVector.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>
|
||||||
|
</PreBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<project name="OpenSim.Physics.Manager" default="build">
|
||||||
|
<target name="build">
|
||||||
|
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<copy todir="${project::get-base-directory()}/${build.dir}">
|
||||||
|
<fileset basedir="${project::get-base-directory()}">
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
|
||||||
|
<resources prefix="OpenSim.Physics.Manager" dynamicprefix="true" >
|
||||||
|
</resources>
|
||||||
|
<sources failonempty="true">
|
||||||
|
<include name="AssemblyInfo.cs" />
|
||||||
|
<include name="PhysicsActor.cs" />
|
||||||
|
<include name="PhysicsManager.cs" />
|
||||||
|
<include name="PhysicsScene.cs" />
|
||||||
|
<include name="PhysicsVector.cs" />
|
||||||
|
</sources>
|
||||||
|
<references basedir="${project::get-base-directory()}">
|
||||||
|
<lib>
|
||||||
|
<include name="${project::get-base-directory()}" />
|
||||||
|
<include name="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
</lib>
|
||||||
|
<include name="System.dll" />
|
||||||
|
<include name="System.Xml.dll.dll" />
|
||||||
|
<include name="../../bin/Axiom.MathLib.dll" />
|
||||||
|
<include name="../../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
|
||||||
|
</references>
|
||||||
|
</csc>
|
||||||
|
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/../../bin/"/>
|
||||||
|
<copy todir="${project::get-base-directory()}/../../bin/">
|
||||||
|
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
|
||||||
|
<include name="*.dll"/>
|
||||||
|
<include name="*.exe"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
<target name="clean">
|
||||||
|
<delete dir="${bin.dir}" failonerror="false" />
|
||||||
|
<delete dir="${obj.dir}" failonerror="false" />
|
||||||
|
</target>
|
||||||
|
<target name="doc" description="Creates documentation.">
|
||||||
|
</target>
|
||||||
|
</project>
|
|
@ -0,0 +1,161 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenSim.Physics.Manager
|
||||||
|
{
|
||||||
|
public abstract class PhysicsActor
|
||||||
|
{
|
||||||
|
public static PhysicsActor Null
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new NullPhysicsActor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract PhysicsVector Position
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract PhysicsVector Velocity
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract PhysicsVector Acceleration
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Axiom.MathLib.Quaternion Orientation
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract bool Flying
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract bool Kinematic
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void AddForce(PhysicsVector force);
|
||||||
|
|
||||||
|
public abstract void SetMomentum(PhysicsVector momentum);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NullPhysicsActor : PhysicsActor
|
||||||
|
{
|
||||||
|
public override PhysicsVector Position
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return PhysicsVector.Zero;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override PhysicsVector Velocity
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return PhysicsVector.Zero;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Axiom.MathLib.Quaternion Orientation
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Axiom.MathLib.Quaternion.Identity;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override PhysicsVector Acceleration
|
||||||
|
{
|
||||||
|
get { return PhysicsVector.Zero; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Flying
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Kinematic
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void AddForce(PhysicsVector force)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetMomentum(PhysicsVector momentum)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using Axiom.MathLib;
|
||||||
|
|
||||||
|
namespace OpenSim.Physics.Manager
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Description of MyClass.
|
||||||
|
/// </summary>
|
||||||
|
public class PhysicsManager
|
||||||
|
{
|
||||||
|
private Dictionary<string, IPhysicsPlugin> _plugins=new Dictionary<string, IPhysicsPlugin>();
|
||||||
|
|
||||||
|
public PhysicsManager()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public PhysicsScene GetPhysicsScene(string engineName)
|
||||||
|
{
|
||||||
|
if (String.IsNullOrEmpty(engineName))
|
||||||
|
{
|
||||||
|
return new NullPhysicsScene();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_plugins.ContainsKey(engineName))
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("creating "+engineName);
|
||||||
|
return _plugins[engineName].GetScene();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string error = String.Format("couldn't find physicsEngine: {0}", engineName);
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(error);
|
||||||
|
throw new ArgumentException(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadPlugins()
|
||||||
|
{
|
||||||
|
string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory ,"Physics");
|
||||||
|
string[] pluginFiles = Directory.GetFiles(path, "*.dll");
|
||||||
|
|
||||||
|
|
||||||
|
for(int i= 0; i<pluginFiles.Length; i++)
|
||||||
|
{
|
||||||
|
this.AddPlugin(pluginFiles[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddPlugin(string FileName)
|
||||||
|
{
|
||||||
|
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
||||||
|
|
||||||
|
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||||
|
{
|
||||||
|
if (pluginType.IsPublic)
|
||||||
|
{
|
||||||
|
if (!pluginType.IsAbstract)
|
||||||
|
{
|
||||||
|
Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true);
|
||||||
|
|
||||||
|
if (typeInterface != null)
|
||||||
|
{
|
||||||
|
IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
|
plug.Init();
|
||||||
|
this._plugins.Add(plug.GetName(),plug);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
typeInterface = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pluginAssembly = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IPhysicsPlugin
|
||||||
|
{
|
||||||
|
bool Init();
|
||||||
|
PhysicsScene GetScene();
|
||||||
|
string GetName();
|
||||||
|
void Dispose();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenSim.Physics.Manager
|
||||||
|
{
|
||||||
|
public abstract class PhysicsScene
|
||||||
|
{
|
||||||
|
public static PhysicsScene Null
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new NullPhysicsScene();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract PhysicsActor AddAvatar(PhysicsVector position);
|
||||||
|
|
||||||
|
public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size);
|
||||||
|
|
||||||
|
public abstract void Simulate(float timeStep);
|
||||||
|
|
||||||
|
public abstract void GetResults();
|
||||||
|
|
||||||
|
public abstract void SetTerrain(float[] heightMap);
|
||||||
|
|
||||||
|
public abstract bool IsThreaded
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NullPhysicsScene : PhysicsScene
|
||||||
|
{
|
||||||
|
private static int m_workIndicator;
|
||||||
|
|
||||||
|
public override PhysicsActor AddAvatar(PhysicsVector position)
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : AddAvatar({0})", position);
|
||||||
|
return PhysicsActor.Null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : AddPrim({0},{1})", position, size);
|
||||||
|
return PhysicsActor.Null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Simulate(float timeStep)
|
||||||
|
{
|
||||||
|
m_workIndicator = (m_workIndicator + 1) % 10;
|
||||||
|
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.SetStatus(m_workIndicator.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void GetResults()
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : GetResults()");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetTerrain(float[] heightMap)
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsThreaded
|
||||||
|
{
|
||||||
|
get { return false; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenSim.Physics.Manager
|
||||||
|
{
|
||||||
|
public class PhysicsVector
|
||||||
|
{
|
||||||
|
public float X;
|
||||||
|
public float Y;
|
||||||
|
public float Z;
|
||||||
|
|
||||||
|
public PhysicsVector()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public PhysicsVector(float x, float y, float z)
|
||||||
|
{
|
||||||
|
X = x;
|
||||||
|
Y = y;
|
||||||
|
Z = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectType>Local</ProjectType>
|
||||||
|
<ProductVersion>8.0.50727</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{CBE1E31D-D7E3-4791-A616-F00173BBC26A}</ProjectGuid>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ApplicationIcon></ApplicationIcon>
|
||||||
|
<AssemblyKeyContainerName>
|
||||||
|
</AssemblyKeyContainerName>
|
||||||
|
<AssemblyName>OpenSim.Physics.PhysXPlugin</AssemblyName>
|
||||||
|
<DefaultClientScript>JScript</DefaultClientScript>
|
||||||
|
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||||
|
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder></AppDesignerFolder>
|
||||||
|
<RootNamespace>OpenSim.Physics.PhysXPlugin</RootNamespace>
|
||||||
|
<StartupObject></StartupObject>
|
||||||
|
<FileUpgradeFlags>
|
||||||
|
</FileUpgradeFlags>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>True</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>False</Optimize>
|
||||||
|
<OutputPath>..\..\bin\Physics\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>False</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>True</Optimize>
|
||||||
|
<OutputPath>..\..\bin\Physics\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" >
|
||||||
|
<HintPath>\System.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Axiom.MathLib.dll" >
|
||||||
|
<HintPath>\Axiom.MathLib.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="PhysX_Wrapper_Dotnet.dll" >
|
||||||
|
<HintPath>\PhysX_Wrapper_Dotnet.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Manager\OpenSim.Physics.Manager.csproj">
|
||||||
|
<Name>OpenSim.Physics.Manager</Name>
|
||||||
|
<Project>{58360A80-9333-4E0F-8F83-3CF937E51633}</Project>
|
||||||
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="PhysXPlugin.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>
|
||||||
|
</PreBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<project name="OpenSim.Physics.PhysXPlugin" default="build">
|
||||||
|
<target name="build">
|
||||||
|
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<copy todir="${project::get-base-directory()}/${build.dir}">
|
||||||
|
<fileset basedir="${project::get-base-directory()}">
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
|
||||||
|
<resources prefix="OpenSim.Physics.PhysXPlugin" dynamicprefix="true" >
|
||||||
|
</resources>
|
||||||
|
<sources failonempty="true">
|
||||||
|
<include name="AssemblyInfo.cs" />
|
||||||
|
<include name="PhysXPlugin.cs" />
|
||||||
|
</sources>
|
||||||
|
<references basedir="${project::get-base-directory()}">
|
||||||
|
<lib>
|
||||||
|
<include name="${project::get-base-directory()}" />
|
||||||
|
<include name="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
</lib>
|
||||||
|
<include name="System.dll" />
|
||||||
|
<include name="../../bin/Axiom.MathLib.dll" />
|
||||||
|
<include name="../../bin/PhysX_Wrapper_Dotnet.dll" />
|
||||||
|
<include name="../Manager/${build.dir}/OpenSim.Physics.Manager.dll" />
|
||||||
|
</references>
|
||||||
|
</csc>
|
||||||
|
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/Physics/" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/../../bin/Physics/"/>
|
||||||
|
<copy todir="${project::get-base-directory()}/../../bin/Physics/">
|
||||||
|
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
|
||||||
|
<include name="*.dll"/>
|
||||||
|
<include name="*.exe"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
<target name="clean">
|
||||||
|
<delete dir="${bin.dir}" failonerror="false" />
|
||||||
|
<delete dir="${obj.dir}" failonerror="false" />
|
||||||
|
</target>
|
||||||
|
<target name="doc" description="Creates documentation.">
|
||||||
|
</target>
|
||||||
|
</project>
|
|
@ -52,10 +52,10 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using PhysicsSystem;
|
using OpenSim.Physics.Manager;
|
||||||
using PhysXWrapper;
|
using PhysXWrapper;
|
||||||
|
|
||||||
namespace PhysXplugin
|
namespace OpenSim.Physics.PhysXPlugin
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Will be the PhysX plugin but for now will be a very basic physics engine
|
/// Will be the PhysX plugin but for now will be a very basic physics engine
|
||||||
|
@ -105,6 +105,7 @@ namespace PhysXplugin
|
||||||
public PhysXScene()
|
public PhysXScene()
|
||||||
{
|
{
|
||||||
mySdk = NxPhysicsSDK.CreateSDK();
|
mySdk = NxPhysicsSDK.CreateSDK();
|
||||||
|
Console.WriteLine("Sdk created - now creating scene");
|
||||||
scene = mySdk.CreateScene();
|
scene = mySdk.CreateScene();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -179,6 +180,7 @@ namespace PhysXplugin
|
||||||
private PhysicsVector _acceleration;
|
private PhysicsVector _acceleration;
|
||||||
private NxCharacter _character;
|
private NxCharacter _character;
|
||||||
private bool flying;
|
private bool flying;
|
||||||
|
private float gravityAccel;
|
||||||
|
|
||||||
public PhysXCharacter(NxCharacter character)
|
public PhysXCharacter(NxCharacter character)
|
||||||
{
|
{
|
||||||
|
@ -224,6 +226,30 @@ namespace PhysXplugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Kinematic
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Axiom.MathLib.Quaternion Orientation
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Axiom.MathLib.Quaternion.Identity;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override PhysicsVector Acceleration
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -258,9 +284,14 @@ namespace PhysXplugin
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vec.Z = (-9.8f + this._velocity.Z) * timeStep;
|
gravityAccel+= -9.8f;
|
||||||
|
vec.Z = (gravityAccel + this._velocity.Z) * timeStep;
|
||||||
|
}
|
||||||
|
int res = this._character.Move(vec);
|
||||||
|
if(res == 1)
|
||||||
|
{
|
||||||
|
gravityAccel = 0;
|
||||||
}
|
}
|
||||||
this._character.Move(vec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdatePosition()
|
public void UpdatePosition()
|
||||||
|
@ -332,6 +363,36 @@ namespace PhysXplugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Kinematic
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this._prim.Kinematic;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this._prim.Kinematic = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Axiom.MathLib.Quaternion Orientation
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Axiom.MathLib.Quaternion res = new Axiom.MathLib.Quaternion();
|
||||||
|
PhysXWrapper.Quaternion quat = this._prim.GetOrientation();
|
||||||
|
res.w = quat.W;
|
||||||
|
res.x = quat.X;
|
||||||
|
res.y = quat.Y;
|
||||||
|
res.z = quat.Z;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override PhysicsVector Acceleration
|
||||||
{
|
{
|
||||||
get
|
get
|
|
@ -0,0 +1,589 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using libsecondlife;
|
||||||
|
using libsecondlife.Packets;
|
||||||
|
using OpenSim;
|
||||||
|
using OpenSim.Framework.Interfaces;
|
||||||
|
using OpenSim.Framework.Assets;
|
||||||
|
using OpenSim.Framework.Utilities;
|
||||||
|
|
||||||
|
namespace OpenSim.Assets
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Manages local cache of assets and their sending to viewers.
|
||||||
|
/// </summary>
|
||||||
|
public class AssetCache : IAssetReceiver
|
||||||
|
{
|
||||||
|
public Dictionary<libsecondlife.LLUUID, AssetInfo> Assets;
|
||||||
|
public Dictionary<libsecondlife.LLUUID, TextureImage> Textures;
|
||||||
|
|
||||||
|
public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers
|
||||||
|
public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent
|
||||||
|
|
||||||
|
public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server
|
||||||
|
public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server
|
||||||
|
|
||||||
|
//private Dictionary<libsecondlife.LLUUID, AssetBase> IncomingAssets;
|
||||||
|
|
||||||
|
private IAssetServer _assetServer;
|
||||||
|
private Thread _assetCacheThread;
|
||||||
|
private LLUUID[] textureList = new LLUUID[2];
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public AssetCache(IAssetServer assetServer)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Creating Asset cache");
|
||||||
|
_assetServer = assetServer;
|
||||||
|
_assetServer.SetReceiver(this);
|
||||||
|
Assets = new Dictionary<libsecondlife.LLUUID, AssetInfo>();
|
||||||
|
Textures = new Dictionary<libsecondlife.LLUUID, TextureImage>();
|
||||||
|
//IncomingAssets = new Dictionary<libsecondlife.LLUUID, AssetBase>();
|
||||||
|
this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
|
||||||
|
this._assetCacheThread.IsBackground = true;
|
||||||
|
this._assetCacheThread.Start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public void RunAssetManager()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Console.WriteLine("Asset cache loop");
|
||||||
|
this.ProcessAssetQueue();
|
||||||
|
this.ProcessTextureQueue();
|
||||||
|
Thread.Sleep(500);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadDefaultTextureSet()
|
||||||
|
{
|
||||||
|
//hack: so we can give each user a set of textures
|
||||||
|
textureList[0] = new LLUUID("00000000-0000-0000-9999-000000000001");
|
||||||
|
textureList[1] = new LLUUID("00000000-0000-0000-9999-000000000002");
|
||||||
|
for (int i = 0; i < textureList.Length; i++)
|
||||||
|
{
|
||||||
|
this._assetServer.RequestAsset(textureList[i], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public AssetBase[] CreateNewInventorySet(LLUUID agentID)
|
||||||
|
{
|
||||||
|
AssetBase[] inventorySet = new AssetBase[this.textureList.Length];
|
||||||
|
for (int i = 0; i < textureList.Length; i++)
|
||||||
|
{
|
||||||
|
if (this.Textures.ContainsKey(textureList[i]))
|
||||||
|
{
|
||||||
|
inventorySet[i] = this.CloneImage(agentID, this.Textures[textureList[i]]);
|
||||||
|
TextureImage image = new TextureImage(inventorySet[i]);
|
||||||
|
this.Textures.Add(image.FullID, image);
|
||||||
|
this._assetServer.UploadNewAsset(image); //save the asset to the asset server
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return inventorySet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
private void ProcessTextureQueue()
|
||||||
|
{
|
||||||
|
if (this.TextureRequests.Count == 0)
|
||||||
|
{
|
||||||
|
//no requests waiting
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int num;
|
||||||
|
|
||||||
|
if (this.TextureRequests.Count < 5)
|
||||||
|
{
|
||||||
|
//lower than 5 so do all of them
|
||||||
|
num = this.TextureRequests.Count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
num = 5;
|
||||||
|
}
|
||||||
|
AssetRequest req;
|
||||||
|
Console.WriteLine("processing texture requests ( " + num + " )");
|
||||||
|
for (int i = 0; i < num; i++)
|
||||||
|
{
|
||||||
|
req = (AssetRequest)this.TextureRequests[i];
|
||||||
|
if (req.PacketCounter != req.NumPackets)
|
||||||
|
{
|
||||||
|
// if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005"))
|
||||||
|
Console.WriteLine("sending base texture ( " + req.ImageInfo.FullID + " ) in " + req.NumPackets + "number of packets");
|
||||||
|
|
||||||
|
if (req.PacketCounter == 0)
|
||||||
|
{
|
||||||
|
//first time for this request so send imagedata packet
|
||||||
|
if (req.NumPackets == 1)
|
||||||
|
{
|
||||||
|
//only one packet so send whole file
|
||||||
|
ImageDataPacket im = new ImageDataPacket();
|
||||||
|
im.ImageID.Packets = 1;
|
||||||
|
im.ImageID.ID = req.ImageInfo.FullID;
|
||||||
|
im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
|
||||||
|
im.ImageData.Data = req.ImageInfo.Data;
|
||||||
|
im.ImageID.Codec = 2;
|
||||||
|
req.RequestUser.OutPacket(im);
|
||||||
|
req.PacketCounter++;
|
||||||
|
//req.ImageInfo.l= time;
|
||||||
|
//System.Console.WriteLine("sent texture: "+req.image_info.FullID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//more than one packet so split file up
|
||||||
|
ImageDataPacket im = new ImageDataPacket();
|
||||||
|
im.ImageID.Packets = (ushort)req.NumPackets;
|
||||||
|
im.ImageID.ID = req.ImageInfo.FullID;
|
||||||
|
im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
|
||||||
|
im.ImageData.Data = new byte[600];
|
||||||
|
Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600);
|
||||||
|
im.ImageID.Codec = 2;
|
||||||
|
req.RequestUser.OutPacket(im);
|
||||||
|
req.PacketCounter++;
|
||||||
|
//req.ImageInfo.last_used = time;
|
||||||
|
//System.Console.WriteLine("sent first packet of texture:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//send imagepacket
|
||||||
|
//more than one packet so split file up
|
||||||
|
ImagePacketPacket im = new ImagePacketPacket();
|
||||||
|
im.ImageID.Packet = (ushort)req.PacketCounter;
|
||||||
|
im.ImageID.ID = req.ImageInfo.FullID;
|
||||||
|
int size = req.ImageInfo.Data.Length - 600 - 1000 * (req.PacketCounter - 1);
|
||||||
|
if (size > 1000) size = 1000;
|
||||||
|
im.ImageData.Data = new byte[size];
|
||||||
|
Array.Copy(req.ImageInfo.Data, 600 + 1000 * (req.PacketCounter - 1), im.ImageData.Data, 0, size);
|
||||||
|
req.RequestUser.OutPacket(im);
|
||||||
|
req.PacketCounter++;
|
||||||
|
//req.ImageInfo.last_used = time;
|
||||||
|
//System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove requests that have been completed
|
||||||
|
int count = 0;
|
||||||
|
for (int i = 0; i < num; i++)
|
||||||
|
{
|
||||||
|
if (this.TextureRequests.Count > count)
|
||||||
|
{
|
||||||
|
req = (AssetRequest)this.TextureRequests[count];
|
||||||
|
if (req.PacketCounter == req.NumPackets)
|
||||||
|
{
|
||||||
|
this.TextureRequests.Remove(req);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public void AssetReceived(AssetBase asset, bool IsTexture)
|
||||||
|
{
|
||||||
|
Console.WriteLine("received asset from asset server ( " + asset.FullID + " )");
|
||||||
|
if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server
|
||||||
|
{
|
||||||
|
//check if it is a texture or not
|
||||||
|
//then add to the correct cache list
|
||||||
|
//then check for waiting requests for this asset/texture (in the Requested lists)
|
||||||
|
//and move those requests into the Requests list.
|
||||||
|
if (IsTexture)
|
||||||
|
{
|
||||||
|
TextureImage image = new TextureImage(asset);
|
||||||
|
this.Textures.Add(image.FullID, image);
|
||||||
|
if (this.RequestedTextures.ContainsKey(image.FullID))
|
||||||
|
{
|
||||||
|
AssetRequest req = this.RequestedTextures[image.FullID];
|
||||||
|
req.ImageInfo = image;
|
||||||
|
if (image.Data.LongLength > 600)
|
||||||
|
{
|
||||||
|
//over 600 bytes so split up file
|
||||||
|
req.NumPackets = 1 + (int)(image.Data.Length - 600 + 999) / 1000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
req.NumPackets = 1;
|
||||||
|
}
|
||||||
|
this.RequestedTextures.Remove(image.FullID);
|
||||||
|
this.TextureRequests.Add(req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AssetInfo assetInf = new AssetInfo(asset);
|
||||||
|
this.Assets.Add(assetInf.FullID, assetInf);
|
||||||
|
if (this.RequestedAssets.ContainsKey(assetInf.FullID))
|
||||||
|
{
|
||||||
|
AssetRequest req = this.RequestedAssets[assetInf.FullID];
|
||||||
|
req.AssetInf = assetInf;
|
||||||
|
if (assetInf.Data.LongLength > 600)
|
||||||
|
{
|
||||||
|
//over 600 bytes so split up file
|
||||||
|
req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
req.NumPackets = 1;
|
||||||
|
}
|
||||||
|
this.RequestedAssets.Remove(assetInf.FullID);
|
||||||
|
this.AssetRequests.Add(req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AssetNotFound(AssetBase asset)
|
||||||
|
{
|
||||||
|
//the asset server had no knowledge of requested asset
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Assets
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="transferRequest"></param>
|
||||||
|
public void AddAssetRequest(SimClient userInfo, TransferRequestPacket transferRequest)
|
||||||
|
{
|
||||||
|
LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0);
|
||||||
|
//check to see if asset is in local cache, if not we need to request it from asset server.
|
||||||
|
if (!this.Assets.ContainsKey(requestID))
|
||||||
|
{
|
||||||
|
//not found asset
|
||||||
|
// so request from asset server
|
||||||
|
if (!this.RequestedAssets.ContainsKey(requestID))
|
||||||
|
{
|
||||||
|
AssetRequest request = new AssetRequest();
|
||||||
|
request.RequestUser = userInfo;
|
||||||
|
request.RequestAssetID = requestID;
|
||||||
|
request.TransferRequestID = transferRequest.TransferInfo.TransferID;
|
||||||
|
this.RequestedAssets.Add(requestID, request);
|
||||||
|
this._assetServer.RequestAsset(requestID, false);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//it is in our cache
|
||||||
|
AssetInfo asset = this.Assets[requestID];
|
||||||
|
|
||||||
|
//work out how many packets it should be sent in
|
||||||
|
// and add to the AssetRequests list
|
||||||
|
AssetRequest req = new AssetRequest();
|
||||||
|
req.RequestUser = userInfo;
|
||||||
|
req.RequestAssetID = requestID;
|
||||||
|
req.TransferRequestID = transferRequest.TransferInfo.TransferID;
|
||||||
|
req.AssetInf = asset;
|
||||||
|
|
||||||
|
if (asset.Data.LongLength > 600)
|
||||||
|
{
|
||||||
|
//over 600 bytes so split up file
|
||||||
|
req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
req.NumPackets = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.AssetRequests.Add(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
private void ProcessAssetQueue()
|
||||||
|
{
|
||||||
|
if (this.AssetRequests.Count == 0)
|
||||||
|
{
|
||||||
|
//no requests waiting
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int num;
|
||||||
|
|
||||||
|
if (this.AssetRequests.Count < 5)
|
||||||
|
{
|
||||||
|
//lower than 5 so do all of them
|
||||||
|
num = this.AssetRequests.Count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
num = 5;
|
||||||
|
}
|
||||||
|
AssetRequest req;
|
||||||
|
for (int i = 0; i < num; i++)
|
||||||
|
{
|
||||||
|
req = (AssetRequest)this.AssetRequests[i];
|
||||||
|
|
||||||
|
TransferInfoPacket Transfer = new TransferInfoPacket();
|
||||||
|
Transfer.TransferInfo.ChannelType = 2;
|
||||||
|
Transfer.TransferInfo.Status = 0;
|
||||||
|
Transfer.TransferInfo.TargetType = 0;
|
||||||
|
Transfer.TransferInfo.Params = req.RequestAssetID.GetBytes();
|
||||||
|
Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length;
|
||||||
|
Transfer.TransferInfo.TransferID = req.TransferRequestID;
|
||||||
|
req.RequestUser.OutPacket(Transfer);
|
||||||
|
|
||||||
|
if (req.NumPackets == 1)
|
||||||
|
{
|
||||||
|
TransferPacketPacket TransferPacket = new TransferPacketPacket();
|
||||||
|
TransferPacket.TransferData.Packet = 0;
|
||||||
|
TransferPacket.TransferData.ChannelType = 2;
|
||||||
|
TransferPacket.TransferData.TransferID = req.TransferRequestID;
|
||||||
|
TransferPacket.TransferData.Data = req.AssetInf.Data;
|
||||||
|
TransferPacket.TransferData.Status = 1;
|
||||||
|
req.RequestUser.OutPacket(TransferPacket);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//more than one packet so split file up , for now it can't be bigger than 2000 bytes
|
||||||
|
TransferPacketPacket TransferPacket = new TransferPacketPacket();
|
||||||
|
TransferPacket.TransferData.Packet = 0;
|
||||||
|
TransferPacket.TransferData.ChannelType = 2;
|
||||||
|
TransferPacket.TransferData.TransferID = req.TransferRequestID;
|
||||||
|
byte[] chunk = new byte[1000];
|
||||||
|
Array.Copy(req.AssetInf.Data, chunk, 1000);
|
||||||
|
TransferPacket.TransferData.Data = chunk;
|
||||||
|
TransferPacket.TransferData.Status = 0;
|
||||||
|
req.RequestUser.OutPacket(TransferPacket);
|
||||||
|
|
||||||
|
TransferPacket = new TransferPacketPacket();
|
||||||
|
TransferPacket.TransferData.Packet = 1;
|
||||||
|
TransferPacket.TransferData.ChannelType = 2;
|
||||||
|
TransferPacket.TransferData.TransferID = req.TransferRequestID;
|
||||||
|
byte[] chunk1 = new byte[(req.AssetInf.Data.Length - 1000)];
|
||||||
|
Array.Copy(req.AssetInf.Data, 1000, chunk1, 0, chunk1.Length);
|
||||||
|
TransferPacket.TransferData.Data = chunk1;
|
||||||
|
TransferPacket.TransferData.Status = 1;
|
||||||
|
req.RequestUser.OutPacket(TransferPacket);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove requests that have been completed
|
||||||
|
for (int i = 0; i < num; i++)
|
||||||
|
{
|
||||||
|
this.AssetRequests.RemoveAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public AssetInfo CloneAsset(LLUUID newOwner, AssetInfo sourceAsset)
|
||||||
|
{
|
||||||
|
AssetInfo newAsset = new AssetInfo();
|
||||||
|
newAsset.Data = new byte[sourceAsset.Data.Length];
|
||||||
|
Array.Copy(sourceAsset.Data, newAsset.Data, sourceAsset.Data.Length);
|
||||||
|
newAsset.FullID = LLUUID.Random();
|
||||||
|
newAsset.Type = sourceAsset.Type;
|
||||||
|
newAsset.InvType = sourceAsset.InvType;
|
||||||
|
return (newAsset);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Textures
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="imageID"></param>
|
||||||
|
public void AddTextureRequest(SimClient userInfo, LLUUID imageID)
|
||||||
|
{
|
||||||
|
if (imageID == new LLUUID("00000000-0000-0000-5005-000000000005"))
|
||||||
|
Console.WriteLine("request base prim texture ");
|
||||||
|
|
||||||
|
//check to see if texture is in local cache, if not request from asset server
|
||||||
|
if (!this.Textures.ContainsKey(imageID))
|
||||||
|
{
|
||||||
|
if (!this.RequestedTextures.ContainsKey(imageID))
|
||||||
|
{
|
||||||
|
//not is cache so request from asset server
|
||||||
|
AssetRequest request = new AssetRequest();
|
||||||
|
request.RequestUser = userInfo;
|
||||||
|
request.RequestAssetID = imageID;
|
||||||
|
request.IsTextureRequest = true;
|
||||||
|
this.RequestedTextures.Add(imageID, request);
|
||||||
|
this._assetServer.RequestAsset(imageID, true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureImage imag = this.Textures[imageID];
|
||||||
|
AssetRequest req = new AssetRequest();
|
||||||
|
req.RequestUser = userInfo;
|
||||||
|
req.RequestAssetID = imageID;
|
||||||
|
req.IsTextureRequest = true;
|
||||||
|
req.ImageInfo = imag;
|
||||||
|
|
||||||
|
if (imag.Data.LongLength > 600)
|
||||||
|
{
|
||||||
|
//over 600 bytes so split up file
|
||||||
|
req.NumPackets = 1 + (int)(imag.Data.Length - 600 + 999) / 1000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
req.NumPackets = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.TextureRequests.Add(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextureImage CloneImage(LLUUID newOwner, TextureImage source)
|
||||||
|
{
|
||||||
|
TextureImage newImage = new TextureImage();
|
||||||
|
newImage.Data = new byte[source.Data.Length];
|
||||||
|
Array.Copy(source.Data, newImage.Data, source.Data.Length);
|
||||||
|
//newImage.filename = source.filename;
|
||||||
|
newImage.FullID = LLUUID.Random();
|
||||||
|
newImage.Name = source.Name;
|
||||||
|
return (newImage);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region viewer asset uploading
|
||||||
|
public AssetBase UploadPacket(AssetUploadRequestPacket pack, LLUUID assetID)
|
||||||
|
{
|
||||||
|
|
||||||
|
AssetBase asset = null;
|
||||||
|
if (pack.AssetBlock.Type == 0)
|
||||||
|
{
|
||||||
|
if (pack.AssetBlock.AssetData.Length > 0)
|
||||||
|
{
|
||||||
|
//first packet for transaction
|
||||||
|
asset = new AssetBase();
|
||||||
|
asset.FullID = assetID;
|
||||||
|
asset.Type = pack.AssetBlock.Type;
|
||||||
|
asset.InvType = asset.Type;
|
||||||
|
asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
|
||||||
|
asset.Data = pack.AssetBlock.AssetData;
|
||||||
|
this._assetServer.UploadNewAsset(asset);
|
||||||
|
TextureImage image = new TextureImage(asset);
|
||||||
|
this.Textures.Add(image.FullID, image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return asset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public AssetBase TransactionComplete(LLUUID transactionID)
|
||||||
|
{
|
||||||
|
AssetBase asset = null;
|
||||||
|
if(this.IncomingAssets.ContainsKey(transactionID))
|
||||||
|
{
|
||||||
|
// not the first packet of this transaction
|
||||||
|
asset = this.IncomingAssets[transactionID];
|
||||||
|
if(asset.Type == 0)
|
||||||
|
{
|
||||||
|
TextureImage image = new TextureImage(asset);
|
||||||
|
this.Textures.Add(image.FullID, image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return asset;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AssetRequest
|
||||||
|
{
|
||||||
|
public SimClient RequestUser;
|
||||||
|
public LLUUID RequestAssetID;
|
||||||
|
public AssetInfo AssetInf;
|
||||||
|
public TextureImage ImageInfo;
|
||||||
|
public LLUUID TransferRequestID;
|
||||||
|
public long DataPointer = 0;
|
||||||
|
public int NumPackets = 0;
|
||||||
|
public int PacketCounter = 0;
|
||||||
|
public bool IsTextureRequest;
|
||||||
|
//public bool AssetInCache;
|
||||||
|
//public int TimeRequested;
|
||||||
|
|
||||||
|
public AssetRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AssetInfo : AssetBase
|
||||||
|
{
|
||||||
|
public AssetInfo()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public AssetInfo(AssetBase aBase)
|
||||||
|
{
|
||||||
|
Data = aBase.Data;
|
||||||
|
FullID = aBase.FullID;
|
||||||
|
Type = aBase.Type;
|
||||||
|
InvType = aBase.InvType;
|
||||||
|
Name = aBase.Name;
|
||||||
|
Description = aBase.Description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TextureImage : AssetBase
|
||||||
|
{
|
||||||
|
public TextureImage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextureImage(AssetBase aBase)
|
||||||
|
{
|
||||||
|
Data = aBase.Data;
|
||||||
|
FullID = aBase.FullID;
|
||||||
|
Type = aBase.Type;
|
||||||
|
InvType = aBase.InvType;
|
||||||
|
Name = aBase.Name;
|
||||||
|
Description = aBase.Description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,199 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using libsecondlife;
|
||||||
|
using OpenSim;
|
||||||
|
using libsecondlife.Packets;
|
||||||
|
//using OpenSim.GridServers;
|
||||||
|
using OpenSim.Framework.Inventory;
|
||||||
|
using OpenSim.Framework.Assets;
|
||||||
|
|
||||||
|
namespace OpenSim.Assets
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Description of InventoryManager.
|
||||||
|
/// </summary>
|
||||||
|
public class InventoryCache
|
||||||
|
{
|
||||||
|
private Dictionary<LLUUID, AgentInventory> _agentsInventory;
|
||||||
|
private List<UserServerRequest> _serverRequests; //list of requests made to user server.
|
||||||
|
private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||||
|
private const uint FULL_MASK_PERMISSIONS = 2147483647;
|
||||||
|
|
||||||
|
public InventoryCache()
|
||||||
|
{
|
||||||
|
_agentsInventory = new Dictionary<LLUUID, AgentInventory>();
|
||||||
|
_serverRequests = new List<UserServerRequest>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddNewAgentsInventory(AgentInventory agentInventory)
|
||||||
|
{
|
||||||
|
this._agentsInventory.Add(agentInventory.AgentID, agentInventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClientLeaving(LLUUID clientID)
|
||||||
|
{
|
||||||
|
if (this._agentsInventory.ContainsKey(clientID))
|
||||||
|
{
|
||||||
|
this._agentsInventory.Remove(clientID);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID)
|
||||||
|
{
|
||||||
|
bool res = false;
|
||||||
|
if (folderID != LLUUID.Zero) //don't create a folder with a zero id
|
||||||
|
{
|
||||||
|
if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
|
||||||
|
{
|
||||||
|
res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LLUUID AddNewInventoryItem(SimClient remoteClient, LLUUID folderID, OpenSim.Framework.Assets.AssetBase asset)
|
||||||
|
{
|
||||||
|
LLUUID newItem = null;
|
||||||
|
if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
|
||||||
|
{
|
||||||
|
newItem = this._agentsInventory[remoteClient.AgentID].AddToInventory(folderID, asset);
|
||||||
|
}
|
||||||
|
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FetchInventoryDescendents(SimClient userInfo, FetchInventoryDescendentsPacket FetchDescend)
|
||||||
|
{
|
||||||
|
if (this._agentsInventory.ContainsKey(userInfo.AgentID))
|
||||||
|
{
|
||||||
|
AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID];
|
||||||
|
if (FetchDescend.InventoryData.FetchItems)
|
||||||
|
{
|
||||||
|
if (agentInventory.InventoryFolders.ContainsKey(FetchDescend.InventoryData.FolderID))
|
||||||
|
{
|
||||||
|
InventoryFolder Folder = agentInventory.InventoryFolders[FetchDescend.InventoryData.FolderID];
|
||||||
|
InventoryDescendentsPacket Descend = new InventoryDescendentsPacket();
|
||||||
|
Descend.AgentData.AgentID = userInfo.AgentID;
|
||||||
|
Descend.AgentData.OwnerID = Folder.OwnerID;
|
||||||
|
Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID;
|
||||||
|
Descend.AgentData.Descendents = Folder.Items.Count;
|
||||||
|
Descend.AgentData.Version = Folder.Items.Count;
|
||||||
|
|
||||||
|
|
||||||
|
Descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count];
|
||||||
|
for (int i = 0; i < Folder.Items.Count; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
InventoryItem Item = Folder.Items[i];
|
||||||
|
Descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock();
|
||||||
|
Descend.ItemData[i].ItemID = Item.ItemID;
|
||||||
|
Descend.ItemData[i].AssetID = Item.AssetID;
|
||||||
|
Descend.ItemData[i].CreatorID = Item.CreatorID;
|
||||||
|
Descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS;
|
||||||
|
Descend.ItemData[i].CreationDate = 1000;
|
||||||
|
Descend.ItemData[i].Description = _enc.GetBytes(Item.Description + "\0");
|
||||||
|
Descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS;
|
||||||
|
Descend.ItemData[i].Flags = 1;
|
||||||
|
Descend.ItemData[i].FolderID = Item.FolderID;
|
||||||
|
Descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
|
Descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS;
|
||||||
|
Descend.ItemData[i].InvType = Item.InvType;
|
||||||
|
Descend.ItemData[i].Name = _enc.GetBytes(Item.Name + "\0");
|
||||||
|
Descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS;
|
||||||
|
Descend.ItemData[i].OwnerID = Item.OwnerID;
|
||||||
|
Descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS;
|
||||||
|
Descend.ItemData[i].SalePrice = 100;
|
||||||
|
Descend.ItemData[i].SaleType = 0;
|
||||||
|
Descend.ItemData[i].Type = Item.Type;
|
||||||
|
Descend.ItemData[i].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
|
||||||
|
}
|
||||||
|
userInfo.OutPacket(Descend);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("fetch subfolders");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FetchInventory(SimClient userInfo, FetchInventoryPacket FetchItems)
|
||||||
|
{
|
||||||
|
if (this._agentsInventory.ContainsKey(userInfo.AgentID))
|
||||||
|
{
|
||||||
|
AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID];
|
||||||
|
|
||||||
|
for (int i = 0; i < FetchItems.InventoryData.Length; i++)
|
||||||
|
{
|
||||||
|
if (agentInventory.InventoryItems.ContainsKey(FetchItems.InventoryData[i].ItemID))
|
||||||
|
{
|
||||||
|
InventoryItem Item = agentInventory.InventoryItems[FetchItems.InventoryData[i].ItemID];
|
||||||
|
FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket();
|
||||||
|
InventoryReply.AgentData.AgentID = userInfo.AgentID;
|
||||||
|
InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
|
||||||
|
InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock();
|
||||||
|
InventoryReply.InventoryData[0].ItemID = Item.ItemID;
|
||||||
|
InventoryReply.InventoryData[0].AssetID = Item.AssetID;
|
||||||
|
InventoryReply.InventoryData[0].CreatorID = Item.CreatorID;
|
||||||
|
InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS;
|
||||||
|
InventoryReply.InventoryData[0].CreationDate = 1000;
|
||||||
|
InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0");
|
||||||
|
InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS;
|
||||||
|
InventoryReply.InventoryData[0].Flags = 1;
|
||||||
|
InventoryReply.InventoryData[0].FolderID = Item.FolderID;
|
||||||
|
InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
|
InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS;
|
||||||
|
InventoryReply.InventoryData[0].InvType = Item.InvType;
|
||||||
|
InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0");
|
||||||
|
InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS;
|
||||||
|
InventoryReply.InventoryData[0].OwnerID = Item.OwnerID;
|
||||||
|
InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS;
|
||||||
|
InventoryReply.InventoryData[0].SalePrice = 100;
|
||||||
|
InventoryReply.InventoryData[0].SaleType = 0;
|
||||||
|
InventoryReply.InventoryData[0].Type = Item.Type;
|
||||||
|
InventoryReply.InventoryData[0].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
|
||||||
|
userInfo.OutPacket(InventoryReply);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class UserServerRequest
|
||||||
|
{
|
||||||
|
public UserServerRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,175 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) OpenSimCAPS project, http://osgrid.org/
|
||||||
|
|
||||||
|
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using Nwc.XmlRpc;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Net;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using libsecondlife;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
using OpenSim.Framework.Interfaces;
|
||||||
|
|
||||||
|
namespace OpenSim.CAPS
|
||||||
|
{
|
||||||
|
// Dummy HTTP server, does nothing useful for now
|
||||||
|
|
||||||
|
public class SimCAPSHTTPServer
|
||||||
|
{
|
||||||
|
public Thread HTTPD;
|
||||||
|
public HttpListener Listener;
|
||||||
|
|
||||||
|
public SimCAPSHTTPServer()
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server");
|
||||||
|
HTTPD = new Thread(new ThreadStart(StartHTTP));
|
||||||
|
HTTPD.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartHTTP()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK");
|
||||||
|
Listener = new HttpListener();
|
||||||
|
|
||||||
|
Listener.Prefixes.Add("http://+:" + OpenSimRoot.Instance.Cfg.IPListenPort + "/");
|
||||||
|
Listener.Start();
|
||||||
|
|
||||||
|
HttpListenerContext context;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
context = Listener.GetContext();
|
||||||
|
ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static string ParseXMLRPC(string requestBody)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
|
||||||
|
|
||||||
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
|
switch (request.MethodName)
|
||||||
|
{
|
||||||
|
case "expect_user":
|
||||||
|
AgentCircuitData agent_data = new AgentCircuitData();
|
||||||
|
agent_data.SessionID = new LLUUID((string)requestData["session_id"]);
|
||||||
|
agent_data.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]);
|
||||||
|
agent_data.firstname = (string)requestData["firstname"];
|
||||||
|
agent_data.lastname = (string)requestData["lastname"];
|
||||||
|
agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
|
||||||
|
agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
|
||||||
|
if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Remote")
|
||||||
|
{
|
||||||
|
((RemoteGridBase)OpenSimRoot.Instance.GridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
|
||||||
|
}
|
||||||
|
return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.ToString());
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
static string ParseREST(string requestBody, string requestURL)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
static string ParseLLSDXML(string requestBody)
|
||||||
|
{
|
||||||
|
// dummy function for now - IMPLEMENT ME!
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
static void HandleRequest(Object stateinfo)
|
||||||
|
{
|
||||||
|
HttpListenerContext context = (HttpListenerContext)stateinfo;
|
||||||
|
|
||||||
|
HttpListenerRequest request = context.Request;
|
||||||
|
HttpListenerResponse response = context.Response;
|
||||||
|
|
||||||
|
response.KeepAlive = false;
|
||||||
|
response.SendChunked = false;
|
||||||
|
|
||||||
|
System.IO.Stream body = request.InputStream;
|
||||||
|
System.Text.Encoding encoding = System.Text.Encoding.UTF8;
|
||||||
|
System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
|
||||||
|
|
||||||
|
string requestBody = reader.ReadToEnd();
|
||||||
|
body.Close();
|
||||||
|
reader.Close();
|
||||||
|
|
||||||
|
string responseString = "";
|
||||||
|
switch (request.ContentType)
|
||||||
|
{
|
||||||
|
case "text/xml":
|
||||||
|
// must be XML-RPC, so pass to the XML-RPC parser
|
||||||
|
|
||||||
|
responseString = ParseXMLRPC(requestBody);
|
||||||
|
response.AddHeader("Content-type", "text/xml");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "application/xml":
|
||||||
|
// probably LLSD we hope, otherwise it should be ignored by the parser
|
||||||
|
responseString = ParseLLSDXML(requestBody);
|
||||||
|
response.AddHeader("Content-type", "application/xml");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case null:
|
||||||
|
// must be REST or invalid crap, so pass to the REST parser
|
||||||
|
responseString = ParseREST(request.Url.OriginalString, requestBody);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
|
||||||
|
System.IO.Stream output = response.OutputStream;
|
||||||
|
response.SendChunked = false;
|
||||||
|
response.ContentLength64 = buffer.Length;
|
||||||
|
output.Write(buffer, 0, buffer.Length);
|
||||||
|
output.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Reflection;
|
||||||
|
using OpenSim.Framework.Interfaces;
|
||||||
|
using OpenSim.UserServer;
|
||||||
|
|
||||||
|
namespace OpenSim
|
||||||
|
{
|
||||||
|
public class Grid
|
||||||
|
{
|
||||||
|
public IAssetServer AssetServer;
|
||||||
|
public IGridServer GridServer;
|
||||||
|
public string AssetDll = "";
|
||||||
|
public string GridDll = "";
|
||||||
|
|
||||||
|
public Grid()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Initialise()
|
||||||
|
{
|
||||||
|
//load the dlls
|
||||||
|
this.AssetServer = this.LoadAssetDll(this.AssetDll);
|
||||||
|
this.GridServer = this.LoadGridDll(this.GridDll);
|
||||||
|
}
|
||||||
|
public virtual void Close()
|
||||||
|
{
|
||||||
|
this.AssetServer.Close();
|
||||||
|
this.GridServer.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private IAssetServer LoadAssetDll(string dllName)
|
||||||
|
{
|
||||||
|
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||||
|
IAssetServer server = null;
|
||||||
|
|
||||||
|
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||||
|
{
|
||||||
|
if (pluginType.IsPublic)
|
||||||
|
{
|
||||||
|
if (!pluginType.IsAbstract)
|
||||||
|
{
|
||||||
|
Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
|
||||||
|
|
||||||
|
if (typeInterface != null)
|
||||||
|
{
|
||||||
|
IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
|
server = plug.GetAssetServer();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
typeInterface = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pluginAssembly = null;
|
||||||
|
return server;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IGridServer LoadGridDll(string dllName)
|
||||||
|
{
|
||||||
|
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||||
|
IGridServer server = null;
|
||||||
|
|
||||||
|
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||||
|
{
|
||||||
|
if (pluginType.IsPublic)
|
||||||
|
{
|
||||||
|
if (!pluginType.IsAbstract)
|
||||||
|
{
|
||||||
|
Type typeInterface = pluginType.GetInterface("IGridPlugin", true);
|
||||||
|
|
||||||
|
if (typeInterface != null)
|
||||||
|
{
|
||||||
|
IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
|
server = plug.GetGridServer();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
typeInterface = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pluginAssembly = null;
|
||||||
|
return server;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,169 @@
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectType>Local</ProjectType>
|
||||||
|
<ProductVersion>8.0.50727</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{B48F0D82-2DE5-42B0-9F1D-0F4353FA243A}</ProjectGuid>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ApplicationIcon></ApplicationIcon>
|
||||||
|
<AssemblyKeyContainerName>
|
||||||
|
</AssemblyKeyContainerName>
|
||||||
|
<AssemblyName>OpenSim.RegionServer</AssemblyName>
|
||||||
|
<DefaultClientScript>JScript</DefaultClientScript>
|
||||||
|
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||||
|
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<AppDesignerFolder></AppDesignerFolder>
|
||||||
|
<RootNamespace>OpenSim.RegionServer</RootNamespace>
|
||||||
|
<StartupObject>OpenSim.RegionServer</StartupObject>
|
||||||
|
<FileUpgradeFlags>
|
||||||
|
</FileUpgradeFlags>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>True</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>False</Optimize>
|
||||||
|
<OutputPath>..\bin\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
<DebugSymbols>False</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<Optimize>True</Optimize>
|
||||||
|
<OutputPath>..\bin\</OutputPath>
|
||||||
|
<RegisterForComInterop>False</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoWarn></NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" >
|
||||||
|
<HintPath>\System.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml.dll" >
|
||||||
|
<HintPath>\System.Xml.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="libsecondlife.dll" >
|
||||||
|
<HintPath>\libsecondlife.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Axiom.MathLib.dll" >
|
||||||
|
<HintPath>\Axiom.MathLib.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Db4objects.Db4o.dll" >
|
||||||
|
<HintPath>\Db4objects.Db4o.dll.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
|
||||||
|
<Name>OpenSim.Framework.Console</Name>
|
||||||
|
<Project>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</Project>
|
||||||
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
|
||||||
|
<Name>OpenSim.Physics.Manager</Name>
|
||||||
|
<Project>{58360A80-9333-4E0F-8F83-3CF937E51633}</Project>
|
||||||
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
|
||||||
|
<Name>OpenSim.Framework</Name>
|
||||||
|
<Project>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</Project>
|
||||||
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Grid.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="OpenSimApplication.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="OpenSimMain.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="OpenSimRoot.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="QueItem.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="SimClient.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="SimConsole.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="VersionInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Assets\AssetCache.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Assets\InventoryCache.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="CAPS\SimHttp.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="types\Mesh.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="types\Triangle.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="UserServer\LocalUserProfileManager.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="UserServer\LoginServer.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="world\Avatar.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="world\Entity.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="world\Primitive.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="world\ScriptEngine.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="world\SurfacePatch.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="world\World.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="world\scripting\IScript.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>
|
||||||
|
</PreBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<project name="OpenSim.RegionServer" default="build">
|
||||||
|
<target name="build">
|
||||||
|
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
<copy todir="${project::get-base-directory()}/${build.dir}">
|
||||||
|
<fileset basedir="${project::get-base-directory()}">
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
|
||||||
|
<resources prefix="OpenSim.RegionServer" dynamicprefix="true" >
|
||||||
|
</resources>
|
||||||
|
<sources failonempty="true">
|
||||||
|
<include name="Grid.cs" />
|
||||||
|
<include name="OpenSimApplication.cs" />
|
||||||
|
<include name="OpenSimMain.cs" />
|
||||||
|
<include name="OpenSimRoot.cs" />
|
||||||
|
<include name="QueItem.cs" />
|
||||||
|
<include name="SimClient.cs" />
|
||||||
|
<include name="SimConsole.cs" />
|
||||||
|
<include name="VersionInfo.cs" />
|
||||||
|
<include name="Assets/AssetCache.cs" />
|
||||||
|
<include name="Assets/InventoryCache.cs" />
|
||||||
|
<include name="CAPS/SimHttp.cs" />
|
||||||
|
<include name="types/Mesh.cs" />
|
||||||
|
<include name="types/Triangle.cs" />
|
||||||
|
<include name="UserServer/LocalUserProfileManager.cs" />
|
||||||
|
<include name="UserServer/LoginServer.cs" />
|
||||||
|
<include name="world/Avatar.cs" />
|
||||||
|
<include name="world/Entity.cs" />
|
||||||
|
<include name="world/Primitive.cs" />
|
||||||
|
<include name="world/ScriptEngine.cs" />
|
||||||
|
<include name="world/SurfacePatch.cs" />
|
||||||
|
<include name="world/World.cs" />
|
||||||
|
<include name="world/scripting/IScript.cs" />
|
||||||
|
</sources>
|
||||||
|
<references basedir="${project::get-base-directory()}">
|
||||||
|
<lib>
|
||||||
|
<include name="${project::get-base-directory()}" />
|
||||||
|
<include name="${project::get-base-directory()}/${build.dir}" />
|
||||||
|
</lib>
|
||||||
|
<include name="System.dll" />
|
||||||
|
<include name="System.Xml.dll.dll" />
|
||||||
|
<include name="../bin/libsecondlife.dll" />
|
||||||
|
<include name="../bin/Axiom.MathLib.dll" />
|
||||||
|
<include name="../bin/Db4objects.Db4o.dll" />
|
||||||
|
<include name="../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
|
||||||
|
<include name="../OpenSim.Physics/Manager/${build.dir}/OpenSim.Physics.Manager.dll" />
|
||||||
|
<include name="../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
|
||||||
|
</references>
|
||||||
|
</csc>
|
||||||
|
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
|
||||||
|
<mkdir dir="${project::get-base-directory()}/../bin/"/>
|
||||||
|
<copy todir="${project::get-base-directory()}/../bin/">
|
||||||
|
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
|
||||||
|
<include name="*.dll"/>
|
||||||
|
<include name="*.exe"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
<target name="clean">
|
||||||
|
<delete dir="${bin.dir}" failonerror="false" />
|
||||||
|
<delete dir="${obj.dir}" failonerror="false" />
|
||||||
|
</target>
|
||||||
|
<target name="doc" description="Creates documentation.">
|
||||||
|
</target>
|
||||||
|
</project>
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
|
||||||
|
namespace OpenSim
|
||||||
|
{
|
||||||
|
public abstract class OpenSimApplication
|
||||||
|
{
|
||||||
|
public abstract void StartUp();
|
||||||
|
public abstract void Shutdown();
|
||||||
|
public abstract void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender);
|
||||||
|
public abstract void RemoveClientCircuit(uint circuitcode);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,320 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) OpenSim project, http://osgrid.org/
|
||||||
|
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Timers;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using libsecondlife;
|
||||||
|
using libsecondlife.Packets;
|
||||||
|
using OpenSim.world;
|
||||||
|
using OpenSim.Framework.Interfaces;
|
||||||
|
using OpenSim.UserServer;
|
||||||
|
using OpenSim.Assets;
|
||||||
|
using OpenSim.CAPS;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
using OpenSim.Physics.Manager;
|
||||||
|
|
||||||
|
namespace OpenSim
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class OpenSimMain : OpenSimApplication
|
||||||
|
{
|
||||||
|
private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
|
||||||
|
private PhysicsManager physManager;
|
||||||
|
|
||||||
|
public Socket Server;
|
||||||
|
private IPEndPoint ServerIncoming;
|
||||||
|
private byte[] RecvBuffer = new byte[4096];
|
||||||
|
private byte[] ZeroBuffer = new byte[8192];
|
||||||
|
private IPEndPoint ipeSender;
|
||||||
|
private EndPoint epSender;
|
||||||
|
private AsyncCallback ReceivedData;
|
||||||
|
|
||||||
|
private System.Timers.Timer timer1 = new System.Timers.Timer();
|
||||||
|
private string ConfigDll = "OpenSim.Config.SimConfigDb4o.dll";
|
||||||
|
private string _physicsEngine = "basicphysics";
|
||||||
|
public bool sandbox = false;
|
||||||
|
public bool loginserver = false;
|
||||||
|
|
||||||
|
[STAThread]
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
|
||||||
|
Console.WriteLine("Starting...\n");
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance = new SimConsole(OpenSim.Framework.Console.ConsoleBase.ConsoleType.Local, "", 0);
|
||||||
|
|
||||||
|
//OpenSimRoot.instance = new OpenSimRoot();
|
||||||
|
OpenSimMain sim = new OpenSimMain();
|
||||||
|
OpenSimRoot.Instance.Application = sim;
|
||||||
|
|
||||||
|
sim.sandbox = false;
|
||||||
|
sim.loginserver = false;
|
||||||
|
sim._physicsEngine = "basicphysics";
|
||||||
|
|
||||||
|
for (int i = 0; i < args.Length; i++)
|
||||||
|
{
|
||||||
|
if (args[i] == "-sandbox")
|
||||||
|
{
|
||||||
|
sim.sandbox = true;
|
||||||
|
OpenSimRoot.Instance.Sandbox = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[i] == "-loginserver")
|
||||||
|
{
|
||||||
|
sim.loginserver = true;
|
||||||
|
}
|
||||||
|
if (args[i] == "-realphysx")
|
||||||
|
{
|
||||||
|
sim._physicsEngine = "RealPhysX";
|
||||||
|
OpenSim.world.Avatar.PhysicsEngineFlying = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OpenSimRoot.Instance.GridServers = new Grid();
|
||||||
|
if (sim.sandbox)
|
||||||
|
{
|
||||||
|
OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
|
||||||
|
OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll";
|
||||||
|
OpenSimRoot.Instance.GridServers.Initialise();
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting in Sandbox mode");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll";
|
||||||
|
OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll";
|
||||||
|
OpenSimRoot.Instance.GridServers.Initialise();
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting in Grid mode");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sim.loginserver && sim.sandbox)
|
||||||
|
{
|
||||||
|
LoginServer loginServer = new LoginServer(OpenSimRoot.Instance.GridServers.GridServer);
|
||||||
|
loginServer.Startup();
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenSimRoot.Instance.StartUp();
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.MainConsolePrompt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private OpenSimMain()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void StartUp()
|
||||||
|
{
|
||||||
|
OpenSimRoot.Instance.startuptime = DateTime.Now;
|
||||||
|
|
||||||
|
OpenSimRoot.Instance.AssetCache = new AssetCache(OpenSimRoot.Instance.GridServers.AssetServer);
|
||||||
|
OpenSimRoot.Instance.InventoryCache = new InventoryCache();
|
||||||
|
|
||||||
|
// We check our local database first, then the grid for config options
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration");
|
||||||
|
OpenSimRoot.Instance.Cfg = this.LoadConfigDll(this.ConfigDll);
|
||||||
|
OpenSimRoot.Instance.Cfg.InitConfig(this.sandbox);
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver");
|
||||||
|
OpenSimRoot.Instance.Cfg.LoadFromGrid();
|
||||||
|
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + OpenSimRoot.Instance.Cfg.RegionName + " at " + OpenSimRoot.Instance.Cfg.RegionLocX.ToString() + "," + OpenSimRoot.Instance.Cfg.RegionLocY.ToString());
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Initialising world");
|
||||||
|
OpenSimRoot.Instance.LocalWorld = new World();
|
||||||
|
OpenSimRoot.Instance.LocalWorld.LandMap = OpenSimRoot.Instance.Cfg.LoadWorld();
|
||||||
|
|
||||||
|
this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
|
||||||
|
this.physManager.LoadPlugins();
|
||||||
|
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
|
||||||
|
OpenSimRoot.Instance.LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this._physicsEngine); //should be reading from the config file what physics engine to use
|
||||||
|
OpenSimRoot.Instance.LocalWorld.PhysScene.SetTerrain(OpenSimRoot.Instance.LocalWorld.LandMap);
|
||||||
|
|
||||||
|
OpenSimRoot.Instance.GridServers.AssetServer.SetServerInfo(OpenSimRoot.Instance.Cfg.AssetURL, OpenSimRoot.Instance.Cfg.AssetSendKey);
|
||||||
|
OpenSimRoot.Instance.GridServers.GridServer.SetServerInfo(OpenSimRoot.Instance.Cfg.GridURL, OpenSimRoot.Instance.Cfg.GridSendKey, OpenSimRoot.Instance.Cfg.GridRecvKey);
|
||||||
|
|
||||||
|
OpenSimRoot.Instance.LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded.
|
||||||
|
OpenSimRoot.Instance.LocalWorld.LoadPrimsFromStorage();
|
||||||
|
|
||||||
|
if (this.sandbox)
|
||||||
|
{
|
||||||
|
OpenSimRoot.Instance.AssetCache.LoadDefaultTextureSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
|
||||||
|
OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer();
|
||||||
|
|
||||||
|
timer1.Enabled = true;
|
||||||
|
timer1.Interval = 100;
|
||||||
|
timer1.Elapsed += new ElapsedEventHandler(this.Timer1Tick);
|
||||||
|
|
||||||
|
MainServerListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
private SimConfig LoadConfigDll(string dllName)
|
||||||
|
{
|
||||||
|
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||||
|
SimConfig config = null;
|
||||||
|
|
||||||
|
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||||
|
{
|
||||||
|
if (pluginType.IsPublic)
|
||||||
|
{
|
||||||
|
if (!pluginType.IsAbstract)
|
||||||
|
{
|
||||||
|
Type typeInterface = pluginType.GetInterface("ISimConfig", true);
|
||||||
|
|
||||||
|
if (typeInterface != null)
|
||||||
|
{
|
||||||
|
ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
|
config = plug.GetConfigObject();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
typeInterface = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pluginAssembly = null;
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnReceivedData(IAsyncResult result)
|
||||||
|
{
|
||||||
|
ipeSender = new IPEndPoint(IPAddress.Any, 0);
|
||||||
|
epSender = (EndPoint)ipeSender;
|
||||||
|
Packet packet = null;
|
||||||
|
int numBytes = Server.EndReceiveFrom(result, ref epSender);
|
||||||
|
int packetEnd = numBytes - 1;
|
||||||
|
packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
|
||||||
|
|
||||||
|
// This is either a new client or a packet to send to an old one
|
||||||
|
// if (OpenSimRoot.Instance.ClientThreads.ContainsKey(epSender))
|
||||||
|
|
||||||
|
// do we already have a circuit for this endpoint
|
||||||
|
if(this.clientCircuits.ContainsKey(epSender))
|
||||||
|
{
|
||||||
|
OpenSimRoot.Instance.ClientThreads[this.clientCircuits[epSender]].InPacket(packet);
|
||||||
|
}
|
||||||
|
else if (packet.Type == PacketType.UseCircuitCode)
|
||||||
|
{ // new client
|
||||||
|
UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
|
||||||
|
this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
|
||||||
|
SimClient newuser = new SimClient(epSender, useCircuit);
|
||||||
|
//OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
|
||||||
|
OpenSimRoot.Instance.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // invalid client
|
||||||
|
Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString());
|
||||||
|
}
|
||||||
|
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MainServerListener()
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started");
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + OpenSimRoot.Instance.Cfg.IPListenAddr + ":" + OpenSimRoot.Instance.Cfg.IPListenPort);
|
||||||
|
|
||||||
|
ServerIncoming = new IPEndPoint(IPAddress.Any, OpenSimRoot.Instance.Cfg.IPListenPort);
|
||||||
|
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||||
|
Server.Bind(ServerIncoming);
|
||||||
|
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen");
|
||||||
|
|
||||||
|
ipeSender = new IPEndPoint(IPAddress.Any, 0);
|
||||||
|
epSender = (EndPoint)ipeSender;
|
||||||
|
ReceivedData = new AsyncCallback(this.OnReceivedData);
|
||||||
|
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
||||||
|
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Listening...");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode )//EndPoint packetSender)
|
||||||
|
{
|
||||||
|
// find the endpoint for this circuit
|
||||||
|
EndPoint sendto = null;
|
||||||
|
foreach(KeyValuePair<EndPoint, uint> p in this.clientCircuits)
|
||||||
|
{
|
||||||
|
if (p.Value == circuitcode)
|
||||||
|
{
|
||||||
|
sendto = p.Key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sendto != null)
|
||||||
|
{
|
||||||
|
//we found the endpoint so send the packet to it
|
||||||
|
this.Server.SendTo(buffer, size, flags, sendto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void RemoveClientCircuit(uint circuitcode)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits)
|
||||||
|
{
|
||||||
|
if (p.Value == circuitcode)
|
||||||
|
{
|
||||||
|
this.clientCircuits.Remove(p.Key);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Shutdown()
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing all threads");
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing listener thread");
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients");
|
||||||
|
// IMPLEMENT THIS
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
|
||||||
|
OpenSimRoot.Instance.LocalWorld.Close();
|
||||||
|
OpenSimRoot.Instance.GridServers.Close();
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.Close();
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Timer1Tick(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
OpenSimRoot.Instance.LocalWorld.Update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Net;
|
||||||
|
//using System.Net.Sockets;
|
||||||
|
using libsecondlife;
|
||||||
|
using libsecondlife.Packets;
|
||||||
|
using OpenSim.world;
|
||||||
|
using OpenSim.Framework.Interfaces;
|
||||||
|
using OpenSim.UserServer;
|
||||||
|
using OpenSim.Assets;
|
||||||
|
using OpenSim.CAPS;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
using OpenSim.Physics.Manager;
|
||||||
|
|
||||||
|
namespace OpenSim
|
||||||
|
{
|
||||||
|
public sealed class OpenSimRoot
|
||||||
|
{
|
||||||
|
private static OpenSimRoot instance = new OpenSimRoot();
|
||||||
|
|
||||||
|
public static OpenSimRoot Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private OpenSimRoot()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public World LocalWorld;
|
||||||
|
public Grid GridServers;
|
||||||
|
public SimConfig Cfg;
|
||||||
|
public SimCAPSHTTPServer HttpServer;
|
||||||
|
public AssetCache AssetCache;
|
||||||
|
public InventoryCache InventoryCache;
|
||||||
|
//public Dictionary<EndPoint, SimClient> ClientThreads = new Dictionary<EndPoint, SimClient>();
|
||||||
|
public Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>();
|
||||||
|
public DateTime startuptime;
|
||||||
|
public OpenSimApplication Application;
|
||||||
|
public bool Sandbox = false;
|
||||||
|
|
||||||
|
public void StartUp()
|
||||||
|
{
|
||||||
|
if (this.Application != null)
|
||||||
|
{
|
||||||
|
this.Application.StartUp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Shutdown()
|
||||||
|
{
|
||||||
|
if (this.Application != null)
|
||||||
|
{
|
||||||
|
this.Application.Shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife.Packets;
|
||||||
|
|
||||||
|
namespace OpenSim
|
||||||
|
{
|
||||||
|
public class QueItem
|
||||||
|
{
|
||||||
|
public QueItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Packet Packet;
|
||||||
|
public bool Incoming;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,621 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) OpenSim project, http://osgrid.org/
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using libsecondlife;
|
||||||
|
using libsecondlife.Packets;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Timers;
|
||||||
|
using OpenSim.Framework.Interfaces;
|
||||||
|
using OpenSim.Framework.Assets;
|
||||||
|
using OpenSim.Framework.Inventory;
|
||||||
|
using OpenSim.Framework.Utilities;
|
||||||
|
using OpenSim.world;
|
||||||
|
using OpenSim.Assets;
|
||||||
|
|
||||||
|
namespace OpenSim
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Handles new client connections
|
||||||
|
/// Constructor takes a single Packet and authenticates everything
|
||||||
|
/// </summary>
|
||||||
|
public class SimClient
|
||||||
|
{
|
||||||
|
|
||||||
|
public LLUUID AgentID;
|
||||||
|
public LLUUID SessionID;
|
||||||
|
public LLUUID SecureSessionID = LLUUID.Zero;
|
||||||
|
public uint CircuitCode;
|
||||||
|
public world.Avatar ClientAvatar;
|
||||||
|
private UseCircuitCodePacket cirpack;
|
||||||
|
private Thread ClientThread;
|
||||||
|
public EndPoint userEP;
|
||||||
|
private BlockingQueue<QueItem> PacketQueue;
|
||||||
|
private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
|
||||||
|
private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
|
||||||
|
//private Dictionary<LLUUID, AssetBase> UploadedAssets = new Dictionary<LLUUID, AssetBase>();
|
||||||
|
private System.Timers.Timer AckTimer;
|
||||||
|
private uint Sequence = 0;
|
||||||
|
private object SequenceLock = new object();
|
||||||
|
private const int MAX_APPENDED_ACKS = 10;
|
||||||
|
private const int RESEND_TIMEOUT = 4000;
|
||||||
|
private const int MAX_SEQUENCE = 0xFFFFFF;
|
||||||
|
private LLUUID newAssetFolder = LLUUID.Zero;
|
||||||
|
private bool debug = false;
|
||||||
|
|
||||||
|
private void ack_pack(Packet Pack)
|
||||||
|
{
|
||||||
|
//libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket();
|
||||||
|
//ack_it.Packets = new PacketAckPacket.PacketsBlock[1];
|
||||||
|
//ack_it.Packets[0] = new PacketAckPacket.PacketsBlock();
|
||||||
|
//ack_it.Packets[0].ID = Pack.Header.ID;
|
||||||
|
//ack_it.Header.Reliable = false;
|
||||||
|
|
||||||
|
//OutPacket(ack_it);
|
||||||
|
|
||||||
|
if (Pack.Header.Reliable)
|
||||||
|
{
|
||||||
|
lock (PendingAcks)
|
||||||
|
{
|
||||||
|
uint sequence = (uint)Pack.Header.Sequence;
|
||||||
|
if (!PendingAcks.ContainsKey(sequence)) { PendingAcks[sequence] = sequence; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void ProcessInPacket(Packet Pack)
|
||||||
|
{
|
||||||
|
ack_pack(Pack);
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
if (Pack.Type != PacketType.AgentUpdate)
|
||||||
|
{
|
||||||
|
Console.WriteLine(Pack.Type.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (Pack.Type)
|
||||||
|
{
|
||||||
|
case PacketType.CompleteAgentMovement:
|
||||||
|
ClientAvatar.CompleteMovement(OpenSimRoot.Instance.LocalWorld);
|
||||||
|
ClientAvatar.SendInitialPosition();
|
||||||
|
break;
|
||||||
|
case PacketType.RegionHandshakeReply:
|
||||||
|
OpenSimRoot.Instance.LocalWorld.SendLayerData(this);
|
||||||
|
break;
|
||||||
|
case PacketType.AgentWearablesRequest:
|
||||||
|
ClientAvatar.SendInitialAppearance();
|
||||||
|
foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
|
||||||
|
{
|
||||||
|
if (client.AgentID != this.AgentID)
|
||||||
|
{
|
||||||
|
ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket();
|
||||||
|
this.OutPacket(objupdate);
|
||||||
|
client.ClientAvatar.SendAppearanceToOtherAgent(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OpenSimRoot.Instance.LocalWorld.GetInitialPrims(this);
|
||||||
|
break;
|
||||||
|
case PacketType.ObjectAdd:
|
||||||
|
OpenSimRoot.Instance.LocalWorld.AddNewPrim((ObjectAddPacket)Pack, this);
|
||||||
|
break;
|
||||||
|
case PacketType.ObjectLink:
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(Pack.ToString());
|
||||||
|
break;
|
||||||
|
case PacketType.ObjectScale:
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(Pack.ToString());
|
||||||
|
break;
|
||||||
|
case PacketType.ObjectShape:
|
||||||
|
ObjectShapePacket shape = (ObjectShapePacket)Pack;
|
||||||
|
for (int i = 0; i < shape.ObjectData.Length; i++)
|
||||||
|
{
|
||||||
|
foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values)
|
||||||
|
{
|
||||||
|
if (ent.localid == shape.ObjectData[i].ObjectLocalID)
|
||||||
|
{
|
||||||
|
((OpenSim.world.Primitive)ent).UpdateShape(shape.ObjectData[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PacketType.MultipleObjectUpdate:
|
||||||
|
MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)Pack;
|
||||||
|
|
||||||
|
for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
|
||||||
|
{
|
||||||
|
if (multipleupdate.ObjectData[i].Type == 9) //change position
|
||||||
|
{
|
||||||
|
libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
|
||||||
|
foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values)
|
||||||
|
{
|
||||||
|
if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
|
||||||
|
{
|
||||||
|
((OpenSim.world.Primitive)ent).UpdatePosition(pos);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//should update stored position of the prim
|
||||||
|
}
|
||||||
|
else if (multipleupdate.ObjectData[i].Type == 10)//rotation
|
||||||
|
{
|
||||||
|
libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
|
||||||
|
foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values)
|
||||||
|
{
|
||||||
|
if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
|
||||||
|
{
|
||||||
|
ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.W);
|
||||||
|
((OpenSim.world.Primitive)ent).UpdateFlag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (multipleupdate.ObjectData[i].Type == 13)//scale
|
||||||
|
{
|
||||||
|
|
||||||
|
libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
|
||||||
|
foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values)
|
||||||
|
{
|
||||||
|
if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
|
||||||
|
{
|
||||||
|
((OpenSim.world.Primitive)ent).Scale = scale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PacketType.RequestImage:
|
||||||
|
RequestImagePacket imageRequest = (RequestImagePacket)Pack;
|
||||||
|
for (int i = 0; i < imageRequest.RequestImage.Length; i++)
|
||||||
|
{
|
||||||
|
OpenSimRoot.Instance.AssetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PacketType.TransferRequest:
|
||||||
|
//Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
|
||||||
|
TransferRequestPacket transfer = (TransferRequestPacket)Pack;
|
||||||
|
OpenSimRoot.Instance.AssetCache.AddAssetRequest(this, transfer);
|
||||||
|
break;
|
||||||
|
case PacketType.AgentUpdate:
|
||||||
|
ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);
|
||||||
|
break;
|
||||||
|
case PacketType.LogoutRequest:
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request");
|
||||||
|
//send reply to let the client logout
|
||||||
|
LogoutReplyPacket logReply = new LogoutReplyPacket();
|
||||||
|
logReply.AgentData.AgentID = this.AgentID;
|
||||||
|
logReply.AgentData.SessionID = this.SessionID;
|
||||||
|
logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
|
||||||
|
logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
|
||||||
|
logReply.InventoryData[0].ItemID = LLUUID.Zero;
|
||||||
|
OutPacket(logReply);
|
||||||
|
//tell all clients to kill our object
|
||||||
|
KillObjectPacket kill = new KillObjectPacket();
|
||||||
|
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
|
||||||
|
kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
|
||||||
|
kill.ObjectData[0].ID = this.ClientAvatar.localid;
|
||||||
|
foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
|
||||||
|
{
|
||||||
|
client.OutPacket(kill);
|
||||||
|
}
|
||||||
|
OpenSimRoot.Instance.GridServers.GridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
|
||||||
|
lock (OpenSimRoot.Instance.LocalWorld.Entities)
|
||||||
|
{
|
||||||
|
OpenSimRoot.Instance.LocalWorld.Entities.Remove(this.AgentID);
|
||||||
|
}
|
||||||
|
//need to do other cleaning up here too
|
||||||
|
OpenSimRoot.Instance.ClientThreads.Remove(this.CircuitCode); //this.userEP);
|
||||||
|
OpenSimRoot.Instance.Application.RemoveClientCircuit(this.CircuitCode);
|
||||||
|
this.ClientThread.Abort();
|
||||||
|
break;
|
||||||
|
case PacketType.ChatFromViewer:
|
||||||
|
ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
|
||||||
|
if (Helpers.FieldToString(inchatpack.ChatData.Message) == "") break;
|
||||||
|
|
||||||
|
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||||
|
libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
|
||||||
|
reply.ChatData.Audible = 1;
|
||||||
|
reply.ChatData.Message = inchatpack.ChatData.Message;
|
||||||
|
reply.ChatData.ChatType = 1;
|
||||||
|
reply.ChatData.SourceType = 1;
|
||||||
|
reply.ChatData.Position = this.ClientAvatar.position;
|
||||||
|
reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0");
|
||||||
|
reply.ChatData.OwnerID = this.AgentID;
|
||||||
|
reply.ChatData.SourceID = this.AgentID;
|
||||||
|
foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
|
||||||
|
{
|
||||||
|
client.OutPacket(reply);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PacketType.ObjectImage:
|
||||||
|
ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
|
||||||
|
for (int i = 0; i < imagePack.ObjectData.Length; i++)
|
||||||
|
{
|
||||||
|
foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values)
|
||||||
|
{
|
||||||
|
if (ent.localid == imagePack.ObjectData[i].ObjectLocalID)
|
||||||
|
{
|
||||||
|
((OpenSim.world.Primitive)ent).UpdateTexture(imagePack.ObjectData[i].TextureEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PacketType.ObjectFlagUpdate:
|
||||||
|
ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
|
||||||
|
foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values)
|
||||||
|
{
|
||||||
|
if (ent.localid == flags.AgentData.ObjectLocalID)
|
||||||
|
{
|
||||||
|
((OpenSim.world.Primitive)ent).UpdateObjectFlags(flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case PacketType.AssetUploadRequest:
|
||||||
|
AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
|
||||||
|
Console.WriteLine("upload request "+ request.AssetBlock.TransactionID);
|
||||||
|
AssetBase newAsset = OpenSimRoot.Instance.AssetCache.UploadPacket(request, LLUUID.Random());
|
||||||
|
if (newAsset != null)
|
||||||
|
{
|
||||||
|
OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this, this.newAssetFolder, newAsset);
|
||||||
|
}
|
||||||
|
Console.WriteLine(request.ToString());
|
||||||
|
Console.WriteLine("combined uuid is " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated());
|
||||||
|
|
||||||
|
AssetUploadCompletePacket response = new AssetUploadCompletePacket();
|
||||||
|
response.AssetBlock.Type =request.AssetBlock.Type;
|
||||||
|
response.AssetBlock.Success = true;
|
||||||
|
response.AssetBlock.UUID = request.AssetBlock.TransactionID.Combine(this.SecureSessionID);
|
||||||
|
|
||||||
|
this.OutPacket(response);
|
||||||
|
break;
|
||||||
|
case PacketType.CreateInventoryFolder:
|
||||||
|
//Console.WriteLine(Pack.ToString());
|
||||||
|
break;
|
||||||
|
case PacketType.CreateInventoryItem:
|
||||||
|
//Console.WriteLine(Pack.ToString());
|
||||||
|
break;
|
||||||
|
case PacketType.FetchInventory:
|
||||||
|
Console.WriteLine("fetch item packet");
|
||||||
|
FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
|
||||||
|
OpenSimRoot.Instance.InventoryCache.FetchInventory(this, FetchInventory);
|
||||||
|
break;
|
||||||
|
case PacketType.FetchInventoryDescendents:
|
||||||
|
FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
|
||||||
|
OpenSimRoot.Instance.InventoryCache.FetchInventoryDescendents(this, Fetch);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ResendUnacked()
|
||||||
|
{
|
||||||
|
int now = Environment.TickCount;
|
||||||
|
|
||||||
|
lock (NeedAck)
|
||||||
|
{
|
||||||
|
foreach (Packet packet in NeedAck.Values)
|
||||||
|
{
|
||||||
|
if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent))
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Resending " + packet.Type.ToString() + " packet, " +
|
||||||
|
(now - packet.TickCount) + "ms have passed");
|
||||||
|
|
||||||
|
packet.Header.Resent = true;
|
||||||
|
OutPacket(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SendAcks()
|
||||||
|
{
|
||||||
|
lock (PendingAcks)
|
||||||
|
{
|
||||||
|
if (PendingAcks.Count > 0)
|
||||||
|
{
|
||||||
|
if (PendingAcks.Count > 250)
|
||||||
|
{
|
||||||
|
// FIXME: Handle the odd case where we have too many pending ACKs queued up
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Too many ACKs queued up!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Sending PacketAck");
|
||||||
|
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
PacketAckPacket acks = new PacketAckPacket();
|
||||||
|
acks.Packets = new PacketAckPacket.PacketsBlock[PendingAcks.Count];
|
||||||
|
|
||||||
|
foreach (uint ack in PendingAcks.Values)
|
||||||
|
{
|
||||||
|
acks.Packets[i] = new PacketAckPacket.PacketsBlock();
|
||||||
|
acks.Packets[i].ID = ack;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
acks.Header.Reliable = false;
|
||||||
|
OutPacket(acks);
|
||||||
|
|
||||||
|
PendingAcks.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AckTimer_Elapsed(object sender, ElapsedEventArgs ea)
|
||||||
|
{
|
||||||
|
SendAcks();
|
||||||
|
ResendUnacked();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void ProcessOutPacket(Packet Pack)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Keep track of when this packet was sent out
|
||||||
|
Pack.TickCount = Environment.TickCount;
|
||||||
|
|
||||||
|
if (!Pack.Header.Resent)
|
||||||
|
{
|
||||||
|
// Set the sequence number
|
||||||
|
lock (SequenceLock)
|
||||||
|
{
|
||||||
|
if (Sequence >= MAX_SEQUENCE)
|
||||||
|
Sequence = 1;
|
||||||
|
else
|
||||||
|
Sequence++;
|
||||||
|
Pack.Header.Sequence = Sequence;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Pack.Header.Reliable) //DIRTY HACK
|
||||||
|
{
|
||||||
|
lock (NeedAck)
|
||||||
|
{
|
||||||
|
if (!NeedAck.ContainsKey(Pack.Header.Sequence))
|
||||||
|
{
|
||||||
|
NeedAck.Add(Pack.Header.Sequence, Pack);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Client.Log("Attempted to add a duplicate sequence number (" +
|
||||||
|
// packet.Header.Sequence + ") to the NeedAck dictionary for packet type " +
|
||||||
|
// packet.Type.ToString(), Helpers.LogLevel.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't append ACKs to resent packets, in case that's what was causing the
|
||||||
|
// delivery to fail
|
||||||
|
if (!Pack.Header.Resent)
|
||||||
|
{
|
||||||
|
// Append any ACKs that need to be sent out to this packet
|
||||||
|
lock (PendingAcks)
|
||||||
|
{
|
||||||
|
if (PendingAcks.Count > 0 && PendingAcks.Count < MAX_APPENDED_ACKS &&
|
||||||
|
Pack.Type != PacketType.PacketAck &&
|
||||||
|
Pack.Type != PacketType.LogoutRequest)
|
||||||
|
{
|
||||||
|
Pack.Header.AckList = new uint[PendingAcks.Count];
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
foreach (uint ack in PendingAcks.Values)
|
||||||
|
{
|
||||||
|
Pack.Header.AckList[i] = ack;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
PendingAcks.Clear();
|
||||||
|
Pack.Header.AppendedAcks = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//ServerConsole.MainConsole.Instance.WriteLine("OUT: \n" + Pack.ToString());
|
||||||
|
|
||||||
|
byte[] ZeroOutBuffer = new byte[4096];
|
||||||
|
byte[] sendbuffer;
|
||||||
|
sendbuffer = Pack.ToBytes();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Pack.Header.Zerocoded)
|
||||||
|
{
|
||||||
|
int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
|
||||||
|
OpenSimRoot.Instance.Application.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, CircuitCode);//userEP);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OpenSimRoot.Instance.Application.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, CircuitCode); //userEP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread");
|
||||||
|
ClientThread.Abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void InPacket(Packet NewPack)
|
||||||
|
{
|
||||||
|
// Handle appended ACKs
|
||||||
|
if (NewPack.Header.AppendedAcks)
|
||||||
|
{
|
||||||
|
lock (NeedAck)
|
||||||
|
{
|
||||||
|
foreach (uint ack in NewPack.Header.AckList)
|
||||||
|
{
|
||||||
|
NeedAck.Remove(ack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle PacketAck packets
|
||||||
|
if (NewPack.Type == PacketType.PacketAck)
|
||||||
|
{
|
||||||
|
PacketAckPacket ackPacket = (PacketAckPacket)NewPack;
|
||||||
|
|
||||||
|
lock (NeedAck)
|
||||||
|
{
|
||||||
|
foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets)
|
||||||
|
{
|
||||||
|
NeedAck.Remove(block.ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((NewPack.Type == PacketType.StartPingCheck))
|
||||||
|
{
|
||||||
|
//reply to pingcheck
|
||||||
|
libsecondlife.Packets.StartPingCheckPacket startPing = (libsecondlife.Packets.StartPingCheckPacket)NewPack;
|
||||||
|
libsecondlife.Packets.CompletePingCheckPacket endPing = new CompletePingCheckPacket();
|
||||||
|
endPing.PingID.PingID = startPing.PingID.PingID;
|
||||||
|
OutPacket(endPing);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QueItem item = new QueItem();
|
||||||
|
item.Packet = NewPack;
|
||||||
|
item.Incoming = true;
|
||||||
|
this.PacketQueue.Enqueue(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OutPacket(Packet NewPack)
|
||||||
|
{
|
||||||
|
QueItem item = new QueItem();
|
||||||
|
item.Packet = NewPack;
|
||||||
|
item.Incoming = false;
|
||||||
|
this.PacketQueue.Enqueue(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack)
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
|
||||||
|
cirpack = initialcirpack;
|
||||||
|
userEP = remoteEP;
|
||||||
|
PacketQueue = new BlockingQueue<QueItem>();
|
||||||
|
AckTimer = new System.Timers.Timer(500);
|
||||||
|
AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
|
||||||
|
AckTimer.Start();
|
||||||
|
|
||||||
|
ClientThread = new Thread(new ThreadStart(AuthUser));
|
||||||
|
ClientThread.IsBackground = true;
|
||||||
|
ClientThread.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void ClientLoop()
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:ClientLoop() - Entered loop");
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
QueItem nextPacket = PacketQueue.Dequeue();
|
||||||
|
if (nextPacket.Incoming)
|
||||||
|
{
|
||||||
|
//is a incoming packet
|
||||||
|
ProcessInPacket(nextPacket.Packet);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//is a out going packet
|
||||||
|
ProcessOutPacket(nextPacket.Packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void InitNewClient()
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
|
||||||
|
OpenSimRoot.Instance.LocalWorld.AddViewerAgent(this);
|
||||||
|
world.Entity tempent = OpenSimRoot.Instance.LocalWorld.Entities[this.AgentID];
|
||||||
|
this.ClientAvatar = (world.Avatar)tempent;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void AuthUser()
|
||||||
|
{
|
||||||
|
AuthenticateResponse sessionInfo = OpenSimRoot.Instance.GridServers.GridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
|
||||||
|
if (!sessionInfo.Authorised)
|
||||||
|
{
|
||||||
|
//session/circuit not authorised
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString());
|
||||||
|
ClientThread.Abort();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString());
|
||||||
|
//session is authorised
|
||||||
|
this.AgentID = cirpack.CircuitCode.ID;
|
||||||
|
this.SessionID = cirpack.CircuitCode.SessionID;
|
||||||
|
this.CircuitCode = cirpack.CircuitCode.Code;
|
||||||
|
InitNewClient(); //shouldn't be called here as we might be a child agent and not want a full avatar
|
||||||
|
this.ClientAvatar.firstname = sessionInfo.LoginInfo.First;
|
||||||
|
this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last;
|
||||||
|
if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero)
|
||||||
|
{
|
||||||
|
this.SecureSessionID = sessionInfo.LoginInfo.SecureSession;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create Inventory, currently only works for sandbox mode
|
||||||
|
if (OpenSimRoot.Instance.Sandbox)
|
||||||
|
{
|
||||||
|
if (sessionInfo.LoginInfo.InventoryFolder != null)
|
||||||
|
{
|
||||||
|
this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder);
|
||||||
|
if (sessionInfo.LoginInfo.BaseFolder != null)
|
||||||
|
{
|
||||||
|
OpenSimRoot.Instance.InventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder);
|
||||||
|
this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder;
|
||||||
|
AssetBase[] inventorySet = OpenSimRoot.Instance.AssetCache.CreateNewInventorySet(this.AgentID);
|
||||||
|
if (inventorySet != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < inventorySet.Length; i++)
|
||||||
|
{
|
||||||
|
if (inventorySet[i] != null)
|
||||||
|
{
|
||||||
|
OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientLoop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateInventory(LLUUID baseFolder)
|
||||||
|
{
|
||||||
|
AgentInventory inventory = new AgentInventory();
|
||||||
|
inventory.AgentID = this.AgentID;
|
||||||
|
OpenSimRoot.Instance.InventoryCache.AddNewAgentsInventory(inventory);
|
||||||
|
OpenSimRoot.Instance.InventoryCache.CreateNewInventoryFolder(this, baseFolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,14 +33,14 @@ using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using libsecondlife.Packets;
|
using libsecondlife.Packets;
|
||||||
using ServerConsole;
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim
|
namespace OpenSim
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Description of ServerConsole.
|
/// Description of ServerConsole.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MServerConsole : ConsoleBase
|
public class SimConsole : ConsoleBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private ConsoleType ConsType;
|
private ConsoleType ConsType;
|
||||||
|
@ -57,7 +57,7 @@ namespace OpenSim
|
||||||
// TCP - the port to bind to
|
// TCP - the port to bind to
|
||||||
// Local - param ignored
|
// Local - param ignored
|
||||||
// SimChat - the chat channel to accept commands from
|
// SimChat - the chat channel to accept commands from
|
||||||
public MServerConsole(ConsoleType constype, string sparam, int iparam) {
|
public SimConsole(ConsoleType constype, string sparam, int iparam) {
|
||||||
ConsType = constype;
|
ConsType = constype;
|
||||||
switch(constype) {
|
switch(constype) {
|
||||||
case ConsoleType.Local:
|
case ConsoleType.Local:
|
||||||
|
@ -156,11 +156,11 @@ namespace OpenSim
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "regenerate":
|
case "regenerate":
|
||||||
OpenSim_Main.local_world.RegenerateTerrain();
|
OpenSimRoot.Instance.LocalWorld.RegenerateTerrain();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "shutdown":
|
case "shutdown":
|
||||||
OpenSim_Main.Shutdown();
|
OpenSimRoot.Instance.Shutdown();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -170,16 +170,16 @@ namespace OpenSim
|
||||||
public override void ShowCommands(string ShowWhat) {
|
public override void ShowCommands(string ShowWhat) {
|
||||||
switch(ShowWhat) {
|
switch(ShowWhat) {
|
||||||
case "uptime":
|
case "uptime":
|
||||||
this.WriteLine("OpenSim has been running since " + OpenSim_Main.sim.startuptime.ToString());
|
this.WriteLine("OpenSim has been running since " + OpenSimRoot.Instance.startuptime.ToString());
|
||||||
this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.sim.startuptime).ToString());
|
this.WriteLine("That is " + (DateTime.Now-OpenSimRoot.Instance.startuptime).ToString());
|
||||||
break;
|
break;
|
||||||
case "users":
|
case "users":
|
||||||
OpenSim.world.Avatar TempAv;
|
OpenSim.world.Avatar TempAv;
|
||||||
this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP"));
|
this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP"));
|
||||||
foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) {
|
foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys) {
|
||||||
if(OpenSim_Main.local_world.Entities[UUID].ToString()== "OpenSim.world.Avatar")
|
if(OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString()== "OpenSim.world.Avatar")
|
||||||
{
|
{
|
||||||
TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.Entities[UUID];
|
TempAv=(OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID];
|
||||||
this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}",TempAv.firstname, TempAv.lastname,UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()));
|
this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}",TempAv.firstname, TempAv.lastname,UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ namespace OpenSim
|
||||||
// Displays a prompt to the user and then runs the command they entered
|
// Displays a prompt to the user and then runs the command they entered
|
||||||
public override void MainConsolePrompt() {
|
public override void MainConsolePrompt() {
|
||||||
string[] tempstrarray;
|
string[] tempstrarray;
|
||||||
string tempstr = this.CmdPrompt("OpenSim-" + OpenSim_Main.cfg.RegionHandle.ToString() + " # ");
|
string tempstr = this.CmdPrompt("OpenSim-" + OpenSimRoot.Instance.Cfg.RegionHandle.ToString() + " # ");
|
||||||
tempstrarray = tempstr.Split(' ');
|
tempstrarray = tempstr.Split(' ');
|
||||||
string cmd=tempstrarray[0];
|
string cmd=tempstrarray[0];
|
||||||
Array.Reverse(tempstrarray);
|
Array.Reverse(tempstrarray);
|
|
@ -0,0 +1,76 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Text;
|
||||||
|
using OpenSim.Framework.User;
|
||||||
|
using OpenSim.Framework.Grid;
|
||||||
|
using OpenSim.Framework.Inventory;
|
||||||
|
using OpenSim.Framework.Interfaces;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.UserServer
|
||||||
|
{
|
||||||
|
class LocalUserProfileManager : UserProfileManager
|
||||||
|
{
|
||||||
|
private IGridServer _gridServer;
|
||||||
|
|
||||||
|
public LocalUserProfileManager(IGridServer gridServer)
|
||||||
|
{
|
||||||
|
_gridServer = gridServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void InitUserProfiles()
|
||||||
|
{
|
||||||
|
// TODO: need to load from database
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser)
|
||||||
|
{
|
||||||
|
uint circode = (uint)response["circuit_code"];
|
||||||
|
theUser.AddSimCircuit(circode, LLUUID.Random());
|
||||||
|
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() + "]}";
|
||||||
|
response["sim_port"] = OpenSimRoot.Instance.Cfg.IPListenPort;
|
||||||
|
response["sim_ip"] = OpenSimRoot.Instance.Cfg.IPListenAddr;
|
||||||
|
response["region_y"] = (Int32)996 * 256;
|
||||||
|
response["region_x"] = (Int32)997* 256;
|
||||||
|
|
||||||
|
string first;
|
||||||
|
string last;
|
||||||
|
if (response.Contains("first"))
|
||||||
|
{
|
||||||
|
first = (string)response["first"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
first = "test";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.Contains("last"))
|
||||||
|
{
|
||||||
|
last = (string)response["last"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
last = "User";
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList InventoryList = (ArrayList)response["inventory-skeleton"];
|
||||||
|
Hashtable Inventory1 = (Hashtable)InventoryList[0];
|
||||||
|
|
||||||
|
Login _login = new Login();
|
||||||
|
//copy data to login object
|
||||||
|
_login.First = first;
|
||||||
|
_login.Last = last;
|
||||||
|
_login.Agent = new LLUUID((string)response["agent_id"]) ;
|
||||||
|
_login.Session = new LLUUID((string)response["session_id"]);
|
||||||
|
_login.BaseFolder = null;
|
||||||
|
_login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);
|
||||||
|
|
||||||
|
//working on local computer if so lets add to the gridserver's list of sessions?
|
||||||
|
if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Local")
|
||||||
|
{
|
||||||
|
((LocalGridBase)this._gridServer).AddNewSession(_login);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,414 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
using Nwc.XmlRpc;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Xml;
|
||||||
|
using libsecondlife;
|
||||||
|
using OpenSim;
|
||||||
|
using OpenSim.Framework.Interfaces;
|
||||||
|
using OpenSim.Framework.Grid;
|
||||||
|
using OpenSim.Framework.Inventory;
|
||||||
|
using OpenSim.Framework.User;
|
||||||
|
using OpenSim.Framework.Utilities;
|
||||||
|
|
||||||
|
namespace OpenSim.UserServer
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When running in local (default) mode , handles client logins.
|
||||||
|
/// </summary>
|
||||||
|
public class LoginServer : LoginService , IUserServer
|
||||||
|
{
|
||||||
|
private IGridServer _gridServer;
|
||||||
|
private ushort _loginPort = 8080;
|
||||||
|
public IPAddress clientAddress = IPAddress.Loopback;
|
||||||
|
public IPAddress remoteAddress = IPAddress.Any;
|
||||||
|
private Socket loginServer;
|
||||||
|
private int NumClients;
|
||||||
|
private string _defaultResponse;
|
||||||
|
private bool userAccounts = false;
|
||||||
|
private string _mpasswd;
|
||||||
|
private bool _needPasswd = false;
|
||||||
|
private LocalUserProfileManager userManager;
|
||||||
|
|
||||||
|
public LoginServer(IGridServer gridServer)
|
||||||
|
{
|
||||||
|
_gridServer = gridServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
// InitializeLogin: initialize the login
|
||||||
|
private void InitializeLogin()
|
||||||
|
{
|
||||||
|
this._needPasswd = false;
|
||||||
|
//read in default response string
|
||||||
|
StreamReader SR;
|
||||||
|
string lines;
|
||||||
|
SR = File.OpenText("new-login.dat");
|
||||||
|
|
||||||
|
//lines=SR.ReadLine();
|
||||||
|
|
||||||
|
while (!SR.EndOfStream)
|
||||||
|
{
|
||||||
|
lines = SR.ReadLine();
|
||||||
|
_defaultResponse += lines;
|
||||||
|
//lines = SR.ReadLine();
|
||||||
|
}
|
||||||
|
SR.Close();
|
||||||
|
this._mpasswd = EncodePassword("testpass");
|
||||||
|
|
||||||
|
userManager = new LocalUserProfileManager(this._gridServer);
|
||||||
|
userManager.InitUserProfiles();
|
||||||
|
userManager.SetKeys("", "", "", "Welcome to OpenSim");
|
||||||
|
|
||||||
|
loginServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
loginServer.Bind(new IPEndPoint(remoteAddress, _loginPort));
|
||||||
|
loginServer.Listen(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Startup()
|
||||||
|
{
|
||||||
|
this.InitializeLogin();
|
||||||
|
Thread runLoginProxy = new Thread(new ThreadStart(RunLogin));
|
||||||
|
runLoginProxy.IsBackground = true;
|
||||||
|
runLoginProxy.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RunLogin()
|
||||||
|
{
|
||||||
|
Console.WriteLine("Starting Login Server");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for (; ; )
|
||||||
|
{
|
||||||
|
Socket client = loginServer.Accept();
|
||||||
|
IPEndPoint clientEndPoint = (IPEndPoint)client.RemoteEndPoint;
|
||||||
|
|
||||||
|
|
||||||
|
NetworkStream networkStream = new NetworkStream(client);
|
||||||
|
StreamReader networkReader = new StreamReader(networkStream);
|
||||||
|
StreamWriter networkWriter = new StreamWriter(networkStream);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoginRequest(networkReader, networkWriter);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
networkWriter.Close();
|
||||||
|
networkReader.Close();
|
||||||
|
networkStream.Close();
|
||||||
|
|
||||||
|
client.Close();
|
||||||
|
|
||||||
|
// send any packets queued for injection
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.Message);
|
||||||
|
Console.WriteLine(e.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ProxyLogin: proxy a login request
|
||||||
|
private void LoginRequest(StreamReader reader, StreamWriter writer)
|
||||||
|
{
|
||||||
|
lock (this)
|
||||||
|
{
|
||||||
|
string line;
|
||||||
|
int contentLength = 0;
|
||||||
|
// read HTTP header
|
||||||
|
do
|
||||||
|
{
|
||||||
|
// read one line of the header
|
||||||
|
line = reader.ReadLine();
|
||||||
|
|
||||||
|
// check for premature EOF
|
||||||
|
if (line == null)
|
||||||
|
throw new Exception("EOF in client HTTP header");
|
||||||
|
|
||||||
|
// look for Content-Length
|
||||||
|
Match match = (new Regex(@"Content-Length: (\d+)$")).Match(line);
|
||||||
|
if (match.Success)
|
||||||
|
contentLength = Convert.ToInt32(match.Groups[1].Captures[0].ToString());
|
||||||
|
} while (line != "");
|
||||||
|
|
||||||
|
// read the HTTP body into a buffer
|
||||||
|
char[] content = new char[contentLength];
|
||||||
|
reader.Read(content, 0, contentLength);
|
||||||
|
|
||||||
|
if (this.userAccounts)
|
||||||
|
{
|
||||||
|
//ask the UserProfile Manager to process the request
|
||||||
|
string reply = this.userManager.ParseXMLRPC(new String(content));
|
||||||
|
// forward the XML-RPC response to the client
|
||||||
|
writer.WriteLine("HTTP/1.0 200 OK");
|
||||||
|
writer.WriteLine("Content-type: text/xml");
|
||||||
|
writer.WriteLine();
|
||||||
|
writer.WriteLine(reply);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//handle ourselves
|
||||||
|
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content));
|
||||||
|
if (request.MethodName == "login_to_simulator")
|
||||||
|
{
|
||||||
|
this.ProcessXmlRequest(request, writer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
|
||||||
|
Hashtable PresenceErrorRespData = new Hashtable();
|
||||||
|
PresenceErrorRespData["reason"] = "XmlRequest"; ;
|
||||||
|
PresenceErrorRespData["message"] = "Unknown Rpc request";
|
||||||
|
PresenceErrorRespData["login"] = "false";
|
||||||
|
PresenceErrorResp.Value = PresenceErrorRespData;
|
||||||
|
string reply = Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "");
|
||||||
|
writer.WriteLine("HTTP/1.0 200 OK");
|
||||||
|
writer.WriteLine("Content-type: text/xml");
|
||||||
|
writer.WriteLine();
|
||||||
|
writer.WriteLine(reply);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ProcessXmlRequest(XmlRpcRequest request, StreamWriter writer)
|
||||||
|
{
|
||||||
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
|
string first;
|
||||||
|
string last;
|
||||||
|
string passwd;
|
||||||
|
LLUUID Agent;
|
||||||
|
LLUUID Session;
|
||||||
|
|
||||||
|
//get login name
|
||||||
|
if (requestData.Contains("first"))
|
||||||
|
{
|
||||||
|
first = (string)requestData["first"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
first = "test";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requestData.Contains("last"))
|
||||||
|
{
|
||||||
|
last = (string)requestData["last"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
last = "User" + NumClients.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requestData.Contains("passwd"))
|
||||||
|
{
|
||||||
|
passwd = (string)requestData["passwd"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
passwd = "notfound";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Authenticate(first, last, passwd))
|
||||||
|
{
|
||||||
|
XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
|
||||||
|
Hashtable PresenceErrorRespData = new Hashtable();
|
||||||
|
PresenceErrorRespData["reason"] = "key"; ;
|
||||||
|
PresenceErrorRespData["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
|
||||||
|
PresenceErrorRespData["login"] = "false";
|
||||||
|
PresenceErrorResp.Value = PresenceErrorRespData;
|
||||||
|
string reply = Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "");
|
||||||
|
writer.WriteLine("HTTP/1.0 200 OK");
|
||||||
|
writer.WriteLine("Content-type: text/xml");
|
||||||
|
writer.WriteLine();
|
||||||
|
writer.WriteLine(reply);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
NumClients++;
|
||||||
|
|
||||||
|
//create a agent and session LLUUID
|
||||||
|
Agent = GetAgentId(first, last);
|
||||||
|
int SessionRand = Util.RandomClass.Next(1, 999);
|
||||||
|
Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
|
||||||
|
LLUUID secureSess = LLUUID.Random();
|
||||||
|
//create some login info
|
||||||
|
Hashtable LoginFlagsHash = new Hashtable();
|
||||||
|
LoginFlagsHash["daylight_savings"] = "N";
|
||||||
|
LoginFlagsHash["stipend_since_login"] = "N";
|
||||||
|
LoginFlagsHash["gendered"] = "Y";
|
||||||
|
LoginFlagsHash["ever_logged_in"] = "Y";
|
||||||
|
ArrayList LoginFlags = new ArrayList();
|
||||||
|
LoginFlags.Add(LoginFlagsHash);
|
||||||
|
|
||||||
|
Hashtable GlobalT = new Hashtable();
|
||||||
|
GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
|
||||||
|
GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
|
||||||
|
GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
|
||||||
|
ArrayList GlobalTextures = new ArrayList();
|
||||||
|
GlobalTextures.Add(GlobalT);
|
||||||
|
|
||||||
|
XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse);
|
||||||
|
Hashtable responseData = (Hashtable)response.Value;
|
||||||
|
|
||||||
|
responseData["sim_port"] = OpenSimRoot.Instance.Cfg.IPListenPort;
|
||||||
|
responseData["sim_ip"] = OpenSimRoot.Instance.Cfg.IPListenAddr;
|
||||||
|
responseData["agent_id"] = Agent.ToStringHyphenated();
|
||||||
|
responseData["session_id"] = Session.ToStringHyphenated();
|
||||||
|
responseData["secure_session_id"]= secureSess.ToStringHyphenated();
|
||||||
|
responseData["circuit_code"] = (Int32)(Util.RandomClass.Next());
|
||||||
|
responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
|
responseData["login-flags"] = LoginFlags;
|
||||||
|
responseData["global-textures"] = GlobalTextures;
|
||||||
|
|
||||||
|
//inventory
|
||||||
|
ArrayList InventoryList = (ArrayList)responseData["inventory-skeleton"];
|
||||||
|
Hashtable Inventory1 = (Hashtable)InventoryList[0];
|
||||||
|
Hashtable Inventory2 = (Hashtable)InventoryList[1];
|
||||||
|
LLUUID BaseFolderID = LLUUID.Random();
|
||||||
|
LLUUID InventoryFolderID = LLUUID.Random();
|
||||||
|
Inventory2["name"] = "Base";
|
||||||
|
Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
|
||||||
|
Inventory2["type_default"] = 0;
|
||||||
|
Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||||
|
|
||||||
|
ArrayList InventoryRoot = (ArrayList)responseData["inventory-root"];
|
||||||
|
Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
|
||||||
|
Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||||
|
|
||||||
|
CustomiseLoginResponse(responseData, first, last);
|
||||||
|
|
||||||
|
Login _login = new Login();
|
||||||
|
//copy data to login object
|
||||||
|
_login.First = first;
|
||||||
|
_login.Last = last;
|
||||||
|
_login.Agent = Agent;
|
||||||
|
_login.Session = Session;
|
||||||
|
_login.SecureSession = secureSess;
|
||||||
|
_login.BaseFolder = BaseFolderID;
|
||||||
|
_login.InventoryFolder = InventoryFolderID;
|
||||||
|
|
||||||
|
//working on local computer if so lets add to the gridserver's list of sessions?
|
||||||
|
if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Local")
|
||||||
|
{
|
||||||
|
((LocalGridBase)this._gridServer).AddNewSession(_login);
|
||||||
|
}
|
||||||
|
|
||||||
|
// forward the XML-RPC response to the client
|
||||||
|
writer.WriteLine("HTTP/1.0 200 OK");
|
||||||
|
writer.WriteLine("Content-type: text/xml");
|
||||||
|
writer.WriteLine();
|
||||||
|
|
||||||
|
XmlTextWriter responseWriter = new XmlTextWriter(writer);
|
||||||
|
XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response);
|
||||||
|
responseWriter.Close();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void CustomiseLoginResponse(Hashtable responseData, string first, string last)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual LLUUID GetAgentId(string firstName, string lastName)
|
||||||
|
{
|
||||||
|
LLUUID Agent;
|
||||||
|
int AgentRand = Util.RandomClass.Next(1, 9999);
|
||||||
|
Agent = new LLUUID("99998888-0100-" + AgentRand.ToString("0000") + "-8ec1-0b1d5cd6aead");
|
||||||
|
return Agent;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual bool Authenticate(string first, string last, string passwd)
|
||||||
|
{
|
||||||
|
if (this._needPasswd)
|
||||||
|
{
|
||||||
|
//every user needs the password to login
|
||||||
|
string encodedPass = passwd.Remove(0, 3); //remove $1$
|
||||||
|
if (encodedPass == this._mpasswd)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//do not need password to login
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string EncodePassword(string passwd)
|
||||||
|
{
|
||||||
|
Byte[] originalBytes;
|
||||||
|
Byte[] encodedBytes;
|
||||||
|
MD5 md5;
|
||||||
|
|
||||||
|
md5 = new MD5CryptoServiceProvider();
|
||||||
|
originalBytes = ASCIIEncoding.Default.GetBytes(passwd);
|
||||||
|
encodedBytes = md5.ComputeHash(originalBytes);
|
||||||
|
|
||||||
|
return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower();
|
||||||
|
}
|
||||||
|
|
||||||
|
//IUserServer implementation
|
||||||
|
public AgentInventory RequestAgentsInventory(LLUUID agentID)
|
||||||
|
{
|
||||||
|
AgentInventory aInventory = null;
|
||||||
|
if (this.userAccounts)
|
||||||
|
{
|
||||||
|
aInventory = this.userManager.GetUsersInventory(agentID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return aInventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue