* Initial framework support for multiple simulators. Currently only the first region config is loaded, but the framework is there * Big reorganization of config and data files * Started renaming extensions that handle LLUDP packets to start with the LL prefix. Work in progress * Initial SSL support git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2482 52acb1d6-8a22-11de-b505-999d5b087335
60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
using ExtensionLoader;
|
|
using HttpServer;
|
|
using OpenMetaverse;
|
|
using OpenMetaverse.Http;
|
|
using OpenMetaverse.StructuredData;
|
|
|
|
namespace Simian
|
|
{
|
|
public class CapsManager : IExtension<Simian>, ICapabilitiesProvider
|
|
{
|
|
Simian server;
|
|
CapsServer capsServer;
|
|
|
|
public CapsManager()
|
|
{
|
|
}
|
|
|
|
public bool Start(Simian server)
|
|
{
|
|
this.server = server;
|
|
capsServer = new CapsServer(server.HttpServer, @"^/caps/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$");
|
|
capsServer.Start();
|
|
return true;
|
|
}
|
|
|
|
public void Stop()
|
|
{
|
|
if (capsServer != null)
|
|
capsServer.Stop();
|
|
}
|
|
|
|
public Uri CreateCapability(CapsRequestCallback localHandler, bool clientCertRequired, object state)
|
|
{
|
|
UUID capID = capsServer.CreateCapability(localHandler, clientCertRequired, state);
|
|
return new Uri(server.HttpUri, "/caps/" + capID.ToString());
|
|
}
|
|
|
|
public Uri CreateCapability(Uri remoteHandler, bool clientCertRequired)
|
|
{
|
|
UUID capID = capsServer.CreateCapability(remoteHandler, clientCertRequired);
|
|
return new Uri(server.HttpUri, "/caps/" + capID.ToString());
|
|
}
|
|
|
|
public bool RemoveCapability(Uri cap)
|
|
{
|
|
string path = cap.PathAndQuery.TrimEnd('/');
|
|
UUID capID;
|
|
|
|
// Parse the capability UUID out of the URI
|
|
if (UUID.TryParse(path.Substring(path.Length - 36), out capID))
|
|
return capsServer.RemoveCapability(capID);
|
|
else
|
|
return false;
|
|
}
|
|
}
|
|
}
|