* Replaced GridHTTPServer and UserHTTPServer with BaseHttpServer
* Now dumping default value in config. *0.1-prestable
parent
cb88393f6b
commit
1a28ef6292
|
@ -48,18 +48,18 @@ namespace OpenGrid.Config.GridConfigDb4o
|
|||
public void LoadDefaults() {
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
|
||||
|
||||
this.GridOwner = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid owner [OGS development team]: ", "OGS development team");
|
||||
this.GridOwner = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid owner", "OGS development team");
|
||||
|
||||
this.DefaultAssetServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default asset server [no default]: ");
|
||||
this.AssetSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to asset server: ");
|
||||
this.AssetRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from asset server: ");
|
||||
this.DefaultAssetServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default asset server");
|
||||
this.AssetSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to asset server");
|
||||
this.AssetRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from asset server");
|
||||
|
||||
this.DefaultUserServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default user server [no default]: ");
|
||||
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.DefaultUserServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default user server");
|
||||
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.SimSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to sims: ");
|
||||
this.SimRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from sims: ");
|
||||
this.SimSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to sims");
|
||||
this.SimRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from sims");
|
||||
}
|
||||
|
||||
public override void InitConfig() {
|
||||
|
|
|
@ -1,307 +0,0 @@
|
|||
/*
|
||||
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.Xml;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Sims;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Servers;
|
||||
|
||||
namespace OpenGridServices.GridServer
|
||||
{
|
||||
public class GridHTTPServer : BaseHttpServer {
|
||||
public Thread HTTPD;
|
||||
public HttpListener Listener;
|
||||
|
||||
public GridHTTPServer() : base( 8001 ) {
|
||||
Start();
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
MainConsole.Instance.WriteLine("Starting up HTTP Server");
|
||||
HTTPD = new Thread(new ThreadStart(StartHTTP));
|
||||
HTTPD.Start();
|
||||
}
|
||||
|
||||
public void StartHTTP() {
|
||||
MainConsole.Instance.WriteLine("GridHttp.cs:StartHTTP() - Spawned main thread OK");
|
||||
Listener = new HttpListener();
|
||||
|
||||
Listener.Prefixes.Add("http://+:8001/");
|
||||
Listener.Prefixes.Add("http://+:8001/sims/");
|
||||
Listener.Prefixes.Add("http://+:8001/gods/");
|
||||
Listener.Prefixes.Add("http://+:8001/highestuuid/");
|
||||
Listener.Prefixes.Add("http://+:8001/uuidblocks/");
|
||||
Listener.Start();
|
||||
|
||||
MainConsole.Instance.WriteLine("GridHttp.cs:StartHTTP() - Successfully bound to port 8001");
|
||||
|
||||
HttpListenerContext context;
|
||||
while(true) {
|
||||
context = Listener.GetContext();
|
||||
ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
|
||||
}
|
||||
}
|
||||
|
||||
static string ParseXMLRPC(string requestBody, string referrer) {
|
||||
try{
|
||||
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
|
||||
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
switch(request.MethodName) {
|
||||
case "simulator_login":
|
||||
|
||||
/*if(!((string)requestData["authkey"]==OpenGrid_Main.thegrid.SimRecvKey)) {
|
||||
XmlRpcResponse ErrorResp = new XmlRpcResponse();
|
||||
Hashtable ErrorRespData = new Hashtable();
|
||||
ErrorRespData["error"]="invalid key";
|
||||
ErrorResp.Value=ErrorRespData;
|
||||
return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(ErrorResp),"utf-16","utf-8"));
|
||||
}*/
|
||||
SimProfileBase TheSim = null;
|
||||
|
||||
if(requestData.ContainsKey("UUID")) {
|
||||
TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByLLUUID(new LLUUID((string)requestData["UUID"]));
|
||||
} else if (requestData.ContainsKey("region_handle")){
|
||||
TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle((ulong)Convert.ToUInt64(requestData["region_handle"]));
|
||||
}
|
||||
|
||||
if(TheSim==null) {
|
||||
XmlRpcResponse ErrorResp = new XmlRpcResponse();
|
||||
Hashtable ErrorRespData = new Hashtable();
|
||||
ErrorRespData["error"]="sim not found";
|
||||
ErrorResp.Value=ErrorRespData;
|
||||
return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(ErrorResp),"utf-16","utf-8"));
|
||||
}
|
||||
|
||||
XmlRpcResponse SimLoginResp = new XmlRpcResponse();
|
||||
Hashtable SimLoginRespData = new Hashtable();
|
||||
|
||||
ArrayList SimNeighboursData = new ArrayList();
|
||||
|
||||
SimProfileBase neighbour;
|
||||
Hashtable NeighbourBlock;
|
||||
for(int x=-1; x<2; x++) for(int y=-1; y<2; y++) {
|
||||
if(OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX+x)*256), (uint)(TheSim.RegionLocY+y)*256))!=null) {
|
||||
neighbour=OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX+x)*256), (uint)(TheSim.RegionLocY+y)*256));
|
||||
NeighbourBlock = new Hashtable();
|
||||
NeighbourBlock["sim_ip"] = neighbour.sim_ip;
|
||||
NeighbourBlock["sim_port"] = neighbour.sim_port.ToString();
|
||||
NeighbourBlock["region_locx"] = neighbour.RegionLocX.ToString();
|
||||
NeighbourBlock["region_locy"] = neighbour.RegionLocY.ToString();
|
||||
NeighbourBlock["UUID"] = neighbour.UUID.ToString();
|
||||
SimNeighboursData.Add(NeighbourBlock);
|
||||
}
|
||||
}
|
||||
|
||||
SimLoginRespData["UUID"]=TheSim.UUID;
|
||||
SimLoginRespData["region_locx"]=TheSim.RegionLocX.ToString();
|
||||
SimLoginRespData["region_locy"]=TheSim.RegionLocY.ToString();
|
||||
SimLoginRespData["regionname"]=TheSim.regionname;
|
||||
SimLoginRespData["estate_id"]="1";
|
||||
SimLoginRespData["neighbours"]=SimNeighboursData;
|
||||
SimLoginRespData["asset_url"]=OpenGrid_Main.thegrid.DefaultAssetServer;
|
||||
SimLoginRespData["asset_sendkey"]=OpenGrid_Main.thegrid.AssetSendKey;
|
||||
SimLoginRespData["asset_recvkey"]=OpenGrid_Main.thegrid.AssetRecvKey;
|
||||
SimLoginRespData["user_url"]=OpenGrid_Main.thegrid.DefaultUserServer;
|
||||
SimLoginRespData["user_sendkey"]=OpenGrid_Main.thegrid.UserSendKey;
|
||||
SimLoginRespData["user_recvkey"]=OpenGrid_Main.thegrid.UserRecvKey;
|
||||
SimLoginRespData["authkey"]=OpenGrid_Main.thegrid.SimSendKey;
|
||||
SimLoginResp.Value=SimLoginRespData;
|
||||
return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(SimLoginResp),"utf-16","utf-8"));
|
||||
break;
|
||||
}
|
||||
} catch(Exception e) {
|
||||
Console.WriteLine(e.ToString());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static string ParseREST(string requestURL, string requestBody, string HTTPmethod) {
|
||||
char[] splitter = {'/'};
|
||||
string[] rest_params = requestURL.Split(splitter);
|
||||
string req_type = rest_params[0]; // First part of the URL is the type of request -
|
||||
string respstring="";
|
||||
SimProfileBase TheSim;
|
||||
Console.WriteLine(req_type);
|
||||
switch(req_type) {
|
||||
case "regions":
|
||||
// DIRTY HACK ALERT
|
||||
Console.WriteLine("/regions/ accessed");
|
||||
TheSim=OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle((ulong)Convert.ToUInt64(rest_params[1]));
|
||||
respstring=ParseREST("/regions/" + rest_params[1], requestBody, HTTPmethod);
|
||||
break;
|
||||
|
||||
case "sims":
|
||||
LLUUID UUID = new LLUUID((string)rest_params[1]);
|
||||
TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByLLUUID(UUID);
|
||||
if(!(TheSim==null)) {
|
||||
switch(HTTPmethod) {
|
||||
case "GET":
|
||||
respstring="<authkey>" + OpenGrid_Main.thegrid.SimSendKey + "</authkey>";
|
||||
respstring+="<sim>";
|
||||
respstring+="<uuid>" + TheSim.UUID.ToString() + "</uuid>";
|
||||
respstring+="<regionname>" + TheSim.regionname + "</regionname>";
|
||||
respstring+="<sim_ip>" + TheSim.sim_ip + "</sim_ip>";
|
||||
respstring+="<sim_port>" + TheSim.sim_port.ToString() + "</sim_port>";
|
||||
respstring+="<region_locx>" + TheSim.RegionLocX.ToString() + "</region_locx>";
|
||||
respstring+="<region_locy>" + TheSim.RegionLocY.ToString() + "</region_locy>";
|
||||
respstring+="<estate_id>1</estate_id>";
|
||||
respstring+="</sim>";
|
||||
break;
|
||||
case "POST":
|
||||
Console.WriteLine("Updating sim details.....");
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(requestBody);
|
||||
XmlNode authkeynode = doc.FirstChild;
|
||||
if (authkeynode.Name != "authkey") {
|
||||
respstring = "ERROR! bad XML - expected authkey tag";
|
||||
return respstring;
|
||||
}
|
||||
XmlNode simnode = doc.ChildNodes[1];
|
||||
if (simnode.Name != "sim") {
|
||||
respstring = "ERROR! bad XML - expected sim tag";
|
||||
return respstring;
|
||||
}
|
||||
if (authkeynode.Name != OpenGrid_Main.thegrid.SimRecvKey) {
|
||||
respstring = "ERROR! invalid key";
|
||||
return respstring;
|
||||
}
|
||||
|
||||
if (TheSim==null) {
|
||||
respstring="ERROR! sim not found";
|
||||
return respstring;
|
||||
} else {
|
||||
for(int i=0; i<= simnode.ChildNodes.Count; i++) {
|
||||
switch(simnode.ChildNodes[i].Name) {
|
||||
case "uuid":
|
||||
// should a sim be able to update it's own UUID? To be decided
|
||||
// watch next week for the exciting conclusion in "the adventures of OpenGridServices.GridServer/GridHttp.cs:ParseREST() at line 190!
|
||||
break; // and line 190's arch-enemy - THE BREAK STATEMENT! OH NOES!!!!! (this code written at 6:57AM, no sleep, lots of caffeine)
|
||||
|
||||
case "regionname":
|
||||
TheSim.regionname=simnode.ChildNodes[i].InnerText;
|
||||
break;
|
||||
|
||||
case "sim_ip":
|
||||
TheSim.sim_ip=simnode.ChildNodes[i].InnerText;
|
||||
break;
|
||||
|
||||
case "sim_port":
|
||||
TheSim.sim_port=Convert.ToUInt32(simnode.ChildNodes[i].InnerText);
|
||||
break;
|
||||
|
||||
case "region_locx":
|
||||
TheSim.RegionLocX=Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
|
||||
TheSim.regionhandle=Helpers.UIntsToLong((TheSim.RegionLocX * 256), (TheSim.RegionLocY * 256));
|
||||
break;
|
||||
|
||||
case "region_locy":
|
||||
TheSim.RegionLocY=Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
|
||||
TheSim.regionhandle=Helpers.UIntsToLong((TheSim.RegionLocX * 256), (TheSim.RegionLocY * 256));
|
||||
break;
|
||||
}
|
||||
}
|
||||
respstring="OK";
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
return respstring;
|
||||
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();
|
||||
|
||||
// TODO: AUTHENTICATION!!!!!!!!! MUST ADD!!!!!!!!!! SCRIPT KIDDIES LOVE LACK OF IT!!!!!!!!!!
|
||||
|
||||
string responseString="";
|
||||
switch(request.ContentType) {
|
||||
case "text/xml":
|
||||
// must be XML-RPC, so pass to the XML-RPC parser
|
||||
|
||||
responseString=ParseXMLRPC(requestBody,request.Headers["Referer"]);
|
||||
response.AddHeader("Content-type","text/xml");
|
||||
break;
|
||||
|
||||
case "text/plaintext":
|
||||
// must be REST
|
||||
responseString=ParseREST(request.RawUrl,requestBody,request.HttpMethod);
|
||||
break;
|
||||
|
||||
case null:
|
||||
// must be REST or invalid crap, so pass to the REST parser
|
||||
responseString=ParseREST(request.RawUrl,requestBody,request.HttpMethod);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -38,16 +38,19 @@ using OpenSim.Framework;
|
|||
using OpenSim.Framework.Sims;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Servers;
|
||||
|
||||
namespace OpenGridServices.GridServer
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public class OpenGrid_Main : conscmd_callback
|
||||
public class OpenGrid_Main : BaseServer, conscmd_callback
|
||||
{
|
||||
private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll";
|
||||
private GridConfig Cfg;
|
||||
|
||||
public static OpenGrid_Main thegrid;
|
||||
|
||||
public string GridOwner;
|
||||
public string DefaultStartupMsg;
|
||||
public string DefaultAssetServer;
|
||||
|
@ -58,13 +61,11 @@ namespace OpenGridServices.GridServer
|
|||
public string UserRecvKey;
|
||||
public string SimSendKey;
|
||||
public string SimRecvKey;
|
||||
public LLUUID highestUUID;
|
||||
//public LLUUID highestUUID;
|
||||
|
||||
public GridHTTPServer _httpd;
|
||||
public SimProfileManager _regionmanager;
|
||||
private SimProfileManager m_simProfileManager;
|
||||
|
||||
private ConsoleBase m_console;
|
||||
private Timer SimCheckTimer;
|
||||
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
|
@ -100,18 +101,38 @@ namespace OpenGridServices.GridServer
|
|||
Cfg.InitConfig();
|
||||
|
||||
m_console.WriteLine("Main.cs:Startup() - Loading sim profiles from database");
|
||||
this._regionmanager = new SimProfileManager();
|
||||
_regionmanager.LoadProfiles();
|
||||
m_simProfileManager = new SimProfileManager( this );
|
||||
m_simProfileManager.LoadProfiles();
|
||||
|
||||
m_console.WriteLine("Main.cs:Startup() - Starting HTTP process");
|
||||
_httpd = new GridHTTPServer();
|
||||
_httpd.Start();
|
||||
BaseHttpServer httpServer = new BaseHttpServer(8001);
|
||||
|
||||
httpServer.AddXmlRPCHandler("simulator_login", m_simProfileManager.XmlRpcLoginToSimulatorMethod);
|
||||
|
||||
httpServer.AddRestHandler("GET", "/sims/", m_simProfileManager.RestGetSimMethod);
|
||||
httpServer.AddRestHandler("POST", "/sims/", m_simProfileManager.RestSetSimMethod);
|
||||
|
||||
// lbsa71 : This code snippet taken from old http server.
|
||||
// I have no idea what this was supposed to do - looks like an infinite recursion to me.
|
||||
// case "regions":
|
||||
//// DIRTY HACK ALERT
|
||||
//Console.WriteLine("/regions/ accessed");
|
||||
//TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle((ulong)Convert.ToUInt64(rest_params[1]));
|
||||
//respstring = ParseREST("/regions/" + rest_params[1], requestBody, HTTPmethod);
|
||||
//break;
|
||||
|
||||
// lbsa71 : I guess these were never used?
|
||||
//Listener.Prefixes.Add("http://+:8001/gods/");
|
||||
//Listener.Prefixes.Add("http://+:8001/highestuuid/");
|
||||
//Listener.Prefixes.Add("http://+:8001/uuidblocks/");
|
||||
|
||||
httpServer.Start();
|
||||
|
||||
m_console.WriteLine("Main.cs:Startup() - Starting sim status checker");
|
||||
SimCheckTimer = new Timer();
|
||||
SimCheckTimer.Interval = 300000; // 5 minutes
|
||||
SimCheckTimer.Elapsed+=new ElapsedEventHandler(CheckSims);
|
||||
SimCheckTimer.Enabled=true;
|
||||
|
||||
Timer simCheckTimer = new Timer( 300000 ); // 5 minutes
|
||||
simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
|
||||
simCheckTimer.Enabled = true;
|
||||
}
|
||||
|
||||
private GridConfig LoadConfigDll(string dllName)
|
||||
|
@ -142,10 +163,13 @@ namespace OpenGridServices.GridServer
|
|||
return config;
|
||||
}
|
||||
|
||||
public void CheckSims(object sender, ElapsedEventArgs e) {
|
||||
foreach(SimProfileBase sim in _regionmanager.SimProfiles.Values) {
|
||||
string SimResponse="";
|
||||
try {
|
||||
public void CheckSims(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values)
|
||||
{
|
||||
string SimResponse = "";
|
||||
try
|
||||
{
|
||||
WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/");
|
||||
CheckSim.Method = "GET";
|
||||
CheckSim.ContentType = "text/plaintext";
|
||||
|
@ -158,12 +182,18 @@ namespace OpenGridServices.GridServer
|
|||
StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream());
|
||||
SimResponse = stIn.ReadToEnd();
|
||||
stIn.Close();
|
||||
} catch(Exception exception) {
|
||||
}
|
||||
if(SimResponse=="OK") {
|
||||
_regionmanager.SimProfiles[sim.UUID].online=true;
|
||||
} else {
|
||||
_regionmanager.SimProfiles[sim.UUID].online=false;
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
if (SimResponse == "OK")
|
||||
{
|
||||
m_simProfileManager.SimProfiles[sim.UUID].online = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_simProfileManager.SimProfiles[sim.UUID].online = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,9 +100,6 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GridHttp.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Main.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
<resources prefix="OpenGridServices.GridServer" dynamicprefix="true" >
|
||||
</resources>
|
||||
<sources failonempty="true">
|
||||
<include name="GridHttp.cs" />
|
||||
<include name="Main.cs" />
|
||||
<include name="SimProfiles.cs" />
|
||||
<include name="Properties/AssemblyInfo.cs" />
|
||||
|
|
|
@ -36,6 +36,8 @@ using OpenSim.Framework.Utilities;
|
|||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Sims;
|
||||
using Db4objects.Db4o;
|
||||
using Nwc.XmlRpc;
|
||||
using System.Xml;
|
||||
|
||||
namespace OpenGridServices.GridServer
|
||||
{
|
||||
|
@ -44,8 +46,10 @@ namespace OpenGridServices.GridServer
|
|||
public class SimProfileManager {
|
||||
|
||||
public Dictionary<LLUUID, SimProfileBase> SimProfiles = new Dictionary<LLUUID, SimProfileBase>();
|
||||
private OpenGrid_Main m_gridManager;
|
||||
|
||||
public SimProfileManager() {
|
||||
public SimProfileManager(OpenGrid_Main gridManager) {
|
||||
m_gridManager = gridManager;
|
||||
}
|
||||
|
||||
public void LoadProfiles() { // should abstract this out
|
||||
|
@ -117,26 +121,176 @@ namespace OpenGridServices.GridServer
|
|||
return newprofile;
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRpcLoginToSimulatorMethod(XmlRpcRequest request)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
response.Value = responseData;
|
||||
|
||||
SimProfileBase TheSim = null;
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
if (requestData.ContainsKey("UUID"))
|
||||
{
|
||||
TheSim = GetProfileByLLUUID(new LLUUID((string)requestData["UUID"]));
|
||||
}
|
||||
else if (requestData.ContainsKey("region_handle"))
|
||||
{
|
||||
TheSim = GetProfileByHandle((ulong)Convert.ToUInt64(requestData["region_handle"]));
|
||||
}
|
||||
|
||||
/* is in OpenSim.Framework
|
||||
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;
|
||||
if (TheSim == null)
|
||||
{
|
||||
responseData["error"] = "sim not found";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ArrayList SimNeighboursData = new ArrayList();
|
||||
|
||||
public SimProfileBase() {
|
||||
SimProfileBase neighbour;
|
||||
Hashtable NeighbourBlock;
|
||||
for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
|
||||
{
|
||||
if (GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX + x) * 256), (uint)(TheSim.RegionLocY + y) * 256)) != null)
|
||||
{
|
||||
neighbour = GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX + x) * 256), (uint)(TheSim.RegionLocY + y) * 256));
|
||||
NeighbourBlock = new Hashtable();
|
||||
NeighbourBlock["sim_ip"] = neighbour.sim_ip;
|
||||
NeighbourBlock["sim_port"] = neighbour.sim_port.ToString();
|
||||
NeighbourBlock["region_locx"] = neighbour.RegionLocX.ToString();
|
||||
NeighbourBlock["region_locy"] = neighbour.RegionLocY.ToString();
|
||||
NeighbourBlock["UUID"] = neighbour.UUID.ToString();
|
||||
SimNeighboursData.Add(NeighbourBlock);
|
||||
}
|
||||
}
|
||||
|
||||
responseData["UUID"] = TheSim.UUID;
|
||||
responseData["region_locx"] = TheSim.RegionLocX.ToString();
|
||||
responseData["region_locy"] = TheSim.RegionLocY.ToString();
|
||||
responseData["regionname"] = TheSim.regionname;
|
||||
responseData["estate_id"] = "1";
|
||||
responseData["neighbours"] = SimNeighboursData;
|
||||
|
||||
responseData["asset_url"] = m_gridManager.DefaultAssetServer;
|
||||
responseData["asset_sendkey"] = m_gridManager.AssetSendKey;
|
||||
responseData["asset_recvkey"] = m_gridManager.AssetRecvKey;
|
||||
responseData["user_url"] = m_gridManager.DefaultUserServer;
|
||||
responseData["user_sendkey"] = m_gridManager.UserSendKey;
|
||||
responseData["user_recvkey"] = m_gridManager.UserRecvKey;
|
||||
responseData["authkey"] = m_gridManager.SimSendKey;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public string RestSetSimMethod(string request, string path, string param)
|
||||
{
|
||||
string respstring = String.Empty;
|
||||
|
||||
SimProfileBase TheSim;
|
||||
LLUUID UUID = new LLUUID(param);
|
||||
TheSim = GetProfileByLLUUID(UUID);
|
||||
|
||||
if (!(TheSim == null))
|
||||
{
|
||||
Console.WriteLine("Updating sim details.....");
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(request);
|
||||
XmlNode authkeynode = doc.FirstChild;
|
||||
if (authkeynode.Name != "authkey")
|
||||
{
|
||||
respstring = "ERROR! bad XML - expected authkey tag";
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlNode simnode = doc.ChildNodes[1];
|
||||
if (simnode.Name != "sim")
|
||||
{
|
||||
respstring = "ERROR! bad XML - expected sim tag";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (authkeynode.Name != m_gridManager.SimRecvKey)
|
||||
{
|
||||
respstring = "ERROR! invalid key";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TheSim == null)
|
||||
{
|
||||
respstring = "ERROR! sim not found";
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i <= simnode.ChildNodes.Count; i++)
|
||||
{
|
||||
switch (simnode.ChildNodes[i].Name)
|
||||
{
|
||||
case "uuid":
|
||||
// should a sim be able to update it's own UUID? To be decided
|
||||
// watch next week for the exciting conclusion in "the adventures of OpenGridServices.GridServer/GridHttp.cs:ParseREST() at line 190!
|
||||
break; // and line 190's arch-enemy - THE BREAK STATEMENT! OH NOES!!!!! (this code written at 6:57AM, no sleep, lots of caffeine)
|
||||
|
||||
case "regionname":
|
||||
TheSim.regionname = simnode.ChildNodes[i].InnerText;
|
||||
break;
|
||||
|
||||
case "sim_ip":
|
||||
TheSim.sim_ip = simnode.ChildNodes[i].InnerText;
|
||||
break;
|
||||
|
||||
case "sim_port":
|
||||
TheSim.sim_port = Convert.ToUInt32(simnode.ChildNodes[i].InnerText);
|
||||
break;
|
||||
|
||||
case "region_locx":
|
||||
TheSim.RegionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
|
||||
TheSim.regionhandle = Helpers.UIntsToLong((TheSim.RegionLocX * 256), (TheSim.RegionLocY * 256));
|
||||
break;
|
||||
|
||||
case "region_locy":
|
||||
TheSim.RegionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
|
||||
TheSim.regionhandle = Helpers.UIntsToLong((TheSim.RegionLocX * 256), (TheSim.RegionLocY * 256));
|
||||
break;
|
||||
}
|
||||
}
|
||||
respstring = "OK";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return respstring;
|
||||
}
|
||||
|
||||
public string RestGetSimMethod(string request, string path, string param )
|
||||
{
|
||||
string respstring = String.Empty;
|
||||
|
||||
SimProfileBase TheSim;
|
||||
LLUUID UUID = new LLUUID(param);
|
||||
TheSim = GetProfileByLLUUID(UUID);
|
||||
|
||||
if (!(TheSim == null))
|
||||
{
|
||||
respstring = "<authkey>" + m_gridManager.SimSendKey + "</authkey>";
|
||||
respstring += "<sim>";
|
||||
respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>";
|
||||
respstring += "<regionname>" + TheSim.regionname + "</regionname>";
|
||||
respstring += "<sim_ip>" + TheSim.sim_ip + "</sim_ip>";
|
||||
respstring += "<sim_port>" + TheSim.sim_port.ToString() + "</sim_port>";
|
||||
respstring += "<region_locx>" + TheSim.RegionLocX.ToString() + "</region_locx>";
|
||||
respstring += "<region_locy>" + TheSim.RegionLocY.ToString() + "</region_locy>";
|
||||
respstring += "<estate_id>1</estate_id>";
|
||||
respstring += "</sim>";
|
||||
}
|
||||
|
||||
return respstring;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
|
@ -39,33 +39,30 @@ using OpenSim.Framework.Sims;
|
|||
using OpenSim.Framework.Inventory;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Servers;
|
||||
|
||||
namespace OpenGridServices.UserServer
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public class OpenUser_Main : conscmd_callback
|
||||
public class OpenUser_Main : BaseServer, conscmd_callback
|
||||
{
|
||||
private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll";
|
||||
private UserConfig Cfg;
|
||||
|
||||
public static OpenUser_Main userserver;
|
||||
|
||||
public UserHTTPServer _httpd;
|
||||
public UserProfileManager _profilemanager;
|
||||
private UserProfileManager m_userProfileManager;
|
||||
|
||||
public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>();
|
||||
|
||||
ConsoleBase m_console;
|
||||
|
||||
[STAThread]
|
||||
public static void Main( string[] args )
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Starting...\n");
|
||||
|
||||
userserver = new OpenUser_Main();
|
||||
OpenUser_Main userserver = new OpenUser_Main();
|
||||
userserver.Startup();
|
||||
|
||||
userserver.Work();
|
||||
}
|
||||
|
||||
|
@ -85,30 +82,33 @@ namespace OpenGridServices.UserServer
|
|||
}
|
||||
}
|
||||
|
||||
public void Startup() {
|
||||
public void Startup()
|
||||
{
|
||||
MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration");
|
||||
Cfg = this.LoadConfigDll(this.ConfigDll);
|
||||
Cfg.InitConfig();
|
||||
|
||||
MainConsole.Instance.WriteLine("Main.cs:Startup() - Creating user profile manager");
|
||||
_profilemanager = new UserProfileManager();
|
||||
_profilemanager.InitUserProfiles();
|
||||
_profilemanager.SetKeys(Cfg.GridSendKey, Cfg.GridRecvKey, Cfg.GridServerURL, Cfg.DefaultStartupMsg);
|
||||
m_userProfileManager = new UserProfileManager();
|
||||
m_userProfileManager.InitUserProfiles();
|
||||
m_userProfileManager.SetKeys(Cfg.GridSendKey, Cfg.GridRecvKey, Cfg.GridServerURL, Cfg.DefaultStartupMsg);
|
||||
|
||||
MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting HTTP process");
|
||||
_httpd = new UserHTTPServer();
|
||||
BaseHttpServer httpServer = new BaseHttpServer(8002);
|
||||
|
||||
_httpd.AddXmlRPCHandler("login_to_simulator", _profilemanager.XmlRpcLoginMethod);
|
||||
_httpd.AddRestHandler( "DELETE", "/usersessions/", _profilemanager.RestDeleteUserSessionMethod );
|
||||
httpServer.AddXmlRPCHandler("login_to_simulator", m_userProfileManager.XmlRpcLoginMethod);
|
||||
httpServer.AddRestHandler("DELETE", "/usersessions/", m_userProfileManager.RestDeleteUserSessionMethod);
|
||||
|
||||
_httpd.Start();
|
||||
// I guess that this was never used?
|
||||
//Listener.Prefixes.Add("http://+:8002/userserver/");
|
||||
|
||||
httpServer.Start();
|
||||
}
|
||||
|
||||
|
||||
public void do_create(string what)
|
||||
{
|
||||
switch(what)
|
||||
switch (what)
|
||||
{
|
||||
case "user":
|
||||
m_console.WriteLine("Creating new user profile");
|
||||
|
@ -116,9 +116,9 @@ namespace OpenGridServices.UserServer
|
|||
string templastname;
|
||||
string tempMD5Passwd;
|
||||
|
||||
tempfirstname=m_console.CmdPrompt("First name: ");
|
||||
templastname=m_console.CmdPrompt("Last name: ");
|
||||
tempMD5Passwd=m_console.PasswdPrompt("Password: ");
|
||||
tempfirstname = m_console.CmdPrompt("First name");
|
||||
templastname = m_console.CmdPrompt("Last name");
|
||||
tempMD5Passwd = m_console.PasswdPrompt("Password");
|
||||
|
||||
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
|
||||
byte[] bs = System.Text.Encoding.UTF8.GetBytes(tempMD5Passwd);
|
||||
|
@ -130,10 +130,10 @@ namespace OpenGridServices.UserServer
|
|||
}
|
||||
tempMD5Passwd = s.ToString();
|
||||
|
||||
UserProfile newuser=_profilemanager.CreateNewProfile(tempfirstname,templastname,tempMD5Passwd);
|
||||
UserProfile newuser = m_userProfileManager.CreateNewProfile(tempfirstname, templastname, tempMD5Passwd);
|
||||
newuser.homelookat = new LLVector3(-0.57343f, -0.819255f, 0f);
|
||||
newuser.homepos = new LLVector3(128f,128f,23f);
|
||||
_profilemanager.SaveUserProfiles();
|
||||
newuser.homepos = new LLVector3(128f, 128f, 23f);
|
||||
m_userProfileManager.SaveUserProfiles();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,9 +103,6 @@
|
|||
<Compile Include="Main.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UserHttp.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
</resources>
|
||||
<sources failonempty="true">
|
||||
<include name="Main.cs" />
|
||||
<include name="UserHttp.cs" />
|
||||
<include name="Properties/AssemblyInfo.cs" />
|
||||
</sources>
|
||||
<references basedir="${project::get-base-directory()}">
|
||||
|
|
|
@ -1,154 +0,0 @@
|
|||
/*
|
||||
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 OpenSim.Framework.User;
|
||||
using OpenSim.Framework.Sims;
|
||||
using OpenSim.Framework.Inventory;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Servers;
|
||||
|
||||
namespace OpenGridServices.UserServer
|
||||
{
|
||||
public class UserHTTPServer : BaseHttpServer
|
||||
{
|
||||
public Thread HTTPD;
|
||||
public HttpListener Listener;
|
||||
|
||||
public UserHTTPServer() : base( 8002 )
|
||||
{
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
MainConsole.Instance.WriteLine("Starting up HTTP Server");
|
||||
HTTPD = new Thread(new ThreadStart(StartHTTP));
|
||||
HTTPD.Start();
|
||||
}
|
||||
|
||||
public void StartHTTP()
|
||||
{
|
||||
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 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":
|
||||
string param = rest_params[2];
|
||||
string result = "";
|
||||
if (www_req.HttpMethod == "DELETE")
|
||||
{
|
||||
result = OpenUser_Main.userserver._profilemanager.RestDeleteUserSessionMethod( null, null, param );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -84,14 +84,14 @@ namespace OpenSim.Framework.Console
|
|||
// Displays a command prompt and waits for the user to enter a string, then returns that string
|
||||
public string CmdPrompt(string prompt)
|
||||
{
|
||||
this.Write(prompt);
|
||||
this.Write(String.Format("{0}: ", prompt));
|
||||
return this.ReadLine();
|
||||
}
|
||||
|
||||
// Displays a command prompt and returns a default value if the user simply presses enter
|
||||
public string CmdPrompt(string prompt, string defaultresponse)
|
||||
{
|
||||
string temp = CmdPrompt(prompt);
|
||||
string temp = CmdPrompt(String.Format( "{0} [{1}]", prompt, defaultresponse ));
|
||||
if (temp == "")
|
||||
{
|
||||
return defaultresponse;
|
||||
|
|
|
@ -212,7 +212,7 @@ namespace OpenSim.Physics.OdePlugin
|
|||
private PhysicsVector _velocity;
|
||||
private PhysicsVector _acceleration;
|
||||
private bool flying;
|
||||
private float gravityAccel;
|
||||
//private float gravityAccel;
|
||||
private IntPtr BoundingCapsule;
|
||||
IntPtr capsule_geom;
|
||||
d.Mass capsule_mass;
|
||||
|
|
|
@ -60,7 +60,6 @@ namespace OpenSim
|
|||
//private IGenericConfig remoteConfig;
|
||||
private PhysicsManager physManager;
|
||||
private Grid GridServers;
|
||||
private BaseHttpServer _httpServer;
|
||||
private PacketServer _packetServer;
|
||||
private World LocalWorld;
|
||||
private AssetCache AssetCache;
|
||||
|
@ -175,12 +174,13 @@ namespace OpenSim
|
|||
|
||||
m_console.WriteLine("Main.cs:Startup() - Initialising HTTP server");
|
||||
// HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort);
|
||||
_httpServer = new BaseHttpServer(regionData.IPListenPort);
|
||||
|
||||
BaseHttpServer httpServer = new BaseHttpServer( regionData.IPListenPort );
|
||||
|
||||
if (gridServer.GetName() == "Remote")
|
||||
{
|
||||
//we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server
|
||||
_httpServer.AddXmlRPCHandler("expect_user",
|
||||
httpServer.AddXmlRPCHandler("expect_user",
|
||||
delegate(XmlRpcRequest request)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
@ -196,7 +196,7 @@ namespace OpenSim
|
|||
|
||||
return new XmlRpcResponse();
|
||||
});
|
||||
_httpServer.AddRestHandler("GET", "/simstatus/",
|
||||
httpServer.AddRestHandler("GET", "/simstatus/",
|
||||
delegate(string request, string path, string param )
|
||||
{
|
||||
return "OK";
|
||||
|
@ -218,20 +218,20 @@ namespace OpenSim
|
|||
this.GridServers.UserServer = loginServer;
|
||||
adminLoginServer = loginServer;
|
||||
|
||||
_httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod);
|
||||
httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod);
|
||||
}
|
||||
else
|
||||
{
|
||||
//sandbox mode with loginserver not using accounts
|
||||
_httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
|
||||
httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
|
||||
}
|
||||
}
|
||||
|
||||
AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, InventoryCache, adminLoginServer);
|
||||
adminWebFront.LoadMethods(_httpServer);
|
||||
adminWebFront.LoadMethods(httpServer);
|
||||
|
||||
m_console.WriteLine("Main.cs:Startup() - Starting HTTP server");
|
||||
_httpServer.Start();
|
||||
httpServer.Start();
|
||||
|
||||
MainServerListener();
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace OpenSim
|
|||
attri = configData.GetAttribute("SimName");
|
||||
if (attri == "")
|
||||
{
|
||||
this.RegionName = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Name [OpenSim test]: ", "OpenSim test");
|
||||
this.RegionName = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Name", "OpenSim test");
|
||||
configData.SetAttribute("SimName", this.RegionName);
|
||||
}
|
||||
else
|
||||
|
@ -106,7 +106,7 @@ namespace OpenSim
|
|||
attri = configData.GetAttribute("SimLocationX");
|
||||
if (attri == "")
|
||||
{
|
||||
string location = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location X [997]: ", "997");
|
||||
string location = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location X", "997");
|
||||
configData.SetAttribute("SimLocationX", location);
|
||||
this.RegionLocX = (uint)Convert.ToUInt32(location);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ namespace OpenSim
|
|||
attri = configData.GetAttribute("SimLocationY");
|
||||
if (attri == "")
|
||||
{
|
||||
string location = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location Y [996]: ", "996");
|
||||
string location = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location Y", "996");
|
||||
configData.SetAttribute("SimLocationY", location);
|
||||
this.RegionLocY = (uint)Convert.ToUInt32(location);
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ namespace OpenSim
|
|||
attri = configData.GetAttribute("SimListenPort");
|
||||
if (attri == "")
|
||||
{
|
||||
string port = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ", "9000");
|
||||
string port = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("UDP port for client connections", "9000");
|
||||
configData.SetAttribute("SimListenPort", port);
|
||||
this.IPListenPort = Convert.ToInt32(port);
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ namespace OpenSim
|
|||
attri = configData.GetAttribute("SimListenAddress");
|
||||
if (attri == "")
|
||||
{
|
||||
this.IPListenAddr = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ", "127.0.0.1");
|
||||
this.IPListenAddr = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections", "127.0.0.1");
|
||||
configData.SetAttribute("SimListenAddress", this.IPListenAddr);
|
||||
}
|
||||
else
|
||||
|
@ -162,7 +162,7 @@ namespace OpenSim
|
|||
attri = configData.GetAttribute("GridServerURL");
|
||||
if (attri == "")
|
||||
{
|
||||
this.GridURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL: ");
|
||||
this.GridURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL");
|
||||
configData.SetAttribute("GridServerURL", this.GridURL);
|
||||
}
|
||||
else
|
||||
|
@ -175,7 +175,7 @@ namespace OpenSim
|
|||
attri = configData.GetAttribute("GridSendKey");
|
||||
if (attri == "")
|
||||
{
|
||||
this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server: ");
|
||||
this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server");
|
||||
configData.SetAttribute("GridSendKey", this.GridSendKey);
|
||||
}
|
||||
else
|
||||
|
@ -188,7 +188,7 @@ namespace OpenSim
|
|||
attri = configData.GetAttribute("GridRecvKey");
|
||||
if (attri == "")
|
||||
{
|
||||
this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server: ");
|
||||
this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server");
|
||||
configData.SetAttribute("GridRecvKey", this.GridRecvKey);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace OpenSim.world
|
|||
private ulong m_regionHandle;
|
||||
private Dictionary<uint, SimClient> m_clientThreads;
|
||||
private string m_regionName;
|
||||
private bool childShadowAvatar = false;
|
||||
//private bool childShadowAvatar = false;
|
||||
|
||||
public Avatar(SimClient TheClient, World world, string regionName, Dictionary<uint, SimClient> clientThreads, ulong regionHandle)
|
||||
{
|
||||
|
|
|
@ -22,7 +22,6 @@ namespace OpenSim.world
|
|||
private bool physicsEnabled = false;
|
||||
|
||||
private Dictionary<LLUUID, InventoryItem> inventoryItems;
|
||||
private string inventoryFileName = "";
|
||||
|
||||
#region Properties
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ namespace OpenSim.Scripting.EmbeddedJVM
|
|||
private ushort _interfaceCount;
|
||||
private ushort _fieldCount;
|
||||
private ushort _methodCount;
|
||||
private ushort _attributeCount;
|
||||
private string _name;
|
||||
//private ushort _attributeCount;
|
||||
//private string _name;
|
||||
public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>();
|
||||
public PoolClass mClass;
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Servers
|
||||
{
|
||||
public class BaseServer
|
||||
{
|
||||
}
|
||||
}
|
|
@ -55,7 +55,6 @@ namespace OpenSim.UserServer
|
|||
public IPAddress clientAddress = IPAddress.Loopback;
|
||||
public IPAddress remoteAddress = IPAddress.Any;
|
||||
private int NumClients;
|
||||
private string _defaultResponse;
|
||||
private bool userAccounts = false;
|
||||
private string _mpasswd;
|
||||
private bool _needPasswd = false;
|
||||
|
|
|
@ -89,6 +89,9 @@
|
|||
<Compile Include="BaseHttpServer.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BaseServer.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="IRestHandler.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
</resources>
|
||||
<sources failonempty="true">
|
||||
<include name="BaseHttpServer.cs" />
|
||||
<include name="BaseServer.cs" />
|
||||
<include name="IRestHandler.cs" />
|
||||
<include name="LocalUserProfileManager.cs" />
|
||||
<include name="LoginResponse.cs" />
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace OpenSim.Storage.LocalStorageBDB
|
|||
|
||||
DbHash sim;
|
||||
Db DB;
|
||||
BEFormatter formatter;
|
||||
//BEFormatter formatter;
|
||||
|
||||
public BDBLocalStorage()
|
||||
{
|
||||
|
|
42
OpenSim.sln
42
OpenSim.sln
|
@ -47,6 +47,48 @@ Global
|
|||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
({632E1BFD-0000-0000-0000-000000000000}).5 = ({2270B8FE-0000-0000-0000-000000000000})
|
||||
({632E1BFD-0000-0000-0000-000000000000}).6 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({632E1BFD-0000-0000-0000-000000000000}).7 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({632E1BFD-0000-0000-0000-000000000000}).8 = ({E88EF749-0000-0000-0000-000000000000})
|
||||
({632E1BFD-0000-0000-0000-000000000000}).9 = ({8BE16150-0000-0000-0000-000000000000})
|
||||
({632E1BFD-0000-0000-0000-000000000000}).10 = ({8BB20F0A-0000-0000-0000-000000000000})
|
||||
({63A05FE9-0000-0000-0000-000000000000}).2 = ({8BE16150-0000-0000-0000-000000000000})
|
||||
({EE9E5D96-0000-0000-0000-000000000000}).6 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({EE9E5D96-0000-0000-0000-000000000000}).7 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).7 = ({8BE16150-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).8 = ({8BB20F0A-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).9 = ({632E1BFD-0000-0000-0000-000000000000})
|
||||
({E88EF749-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({8BE16150-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({8BE16150-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({97A82740-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({66591469-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({66591469-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({66591469-0000-0000-0000-000000000000}).5 = ({8BB20F0A-0000-0000-0000-000000000000})
|
||||
({4F874463-0000-0000-0000-000000000000}).2 = ({8BE16150-0000-0000-0000-000000000000})
|
||||
({B0027747-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({B0027747-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({988F0AC4-0000-0000-0000-000000000000}).3 = ({8BE16150-0000-0000-0000-000000000000})
|
||||
({B55C0B5D-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({B55C0B5D-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({8BB20F0A-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({8BB20F0A-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({E1B79ECF-0000-0000-0000-000000000000}).4 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({E1B79ECF-0000-0000-0000-000000000000}).5 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({6B20B603-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({6B20B603-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({7E494328-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({7E494328-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({546099CD-0000-0000-0000-000000000000}).4 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({546099CD-0000-0000-0000-000000000000}).5 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({21BFC8E2-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({21BFC8E2-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({21BFC8E2-0000-0000-0000-000000000000}).5 = ({8BB20F0A-0000-0000-0000-000000000000})
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2270B8FE-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2270B8FE-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
|
|
|
@ -48,11 +48,11 @@ namespace OpenUser.Config.UserConfigDb4o
|
|||
public void LoadDefaults() {
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
|
||||
|
||||
this.DefaultStartupMsg = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default startup message [Welcome to OGS]: ", "Welcome to OGS");
|
||||
this.DefaultStartupMsg = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default startup message", "Welcome to OGS");
|
||||
|
||||
this.GridServerURL = 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.GridServerURL = 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");
|
||||
}
|
||||
|
||||
public override void InitConfig() {
|
||||
|
|
Loading…
Reference in New Issue