diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Client/IClientCore.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI2.cs | 86 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 51 |
3 files changed, 47 insertions, 98 deletions
diff --git a/OpenSim/Framework/Client/IClientCore.cs b/OpenSim/Framework/Client/IClientCore.cs new file mode 100644 index 0000000..41f8f4b --- /dev/null +++ b/OpenSim/Framework/Client/IClientCore.cs | |||
@@ -0,0 +1,8 @@ | |||
1 | namespace OpenSim.Framework.Client | ||
2 | { | ||
3 | public interface IClientCore | ||
4 | { | ||
5 | bool TryGet<T>(out T iface); | ||
6 | T Get<T>(); | ||
7 | } | ||
8 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/IClientAPI2.cs b/OpenSim/Framework/IClientAPI2.cs deleted file mode 100644 index addd5d1..0000000 --- a/OpenSim/Framework/IClientAPI2.cs +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | |||
30 | namespace OpenSim.Framework | ||
31 | { | ||
32 | #region Args Classes | ||
33 | public class ICA2_ConnectionArgs : EventArgs | ||
34 | { | ||
35 | |||
36 | } | ||
37 | |||
38 | public class ICA2_DisconnectionArgs : EventArgs | ||
39 | { | ||
40 | public bool Forced; | ||
41 | |||
42 | // Static Constructor | ||
43 | // Allows us to recycle these classes later more easily from a pool. | ||
44 | public static ICA2_DisconnectionArgs Create(bool forced) | ||
45 | { | ||
46 | ICA2_DisconnectionArgs tmp = new ICA2_DisconnectionArgs(); | ||
47 | tmp.Forced = forced; | ||
48 | |||
49 | return tmp; | ||
50 | } | ||
51 | } | ||
52 | |||
53 | public class ICA2_PingArgs : EventArgs | ||
54 | { | ||
55 | } | ||
56 | |||
57 | public class ICA2_AvatarAppearanceArgs : EventArgs | ||
58 | { | ||
59 | } | ||
60 | |||
61 | public class ICA2_TerraformArgs : EventArgs | ||
62 | { | ||
63 | public double XMin; | ||
64 | public double XMax; | ||
65 | public double YMin; | ||
66 | public double YMax; | ||
67 | public Guid Action; | ||
68 | public double Strength; // 0 .. 1 | ||
69 | public double Radius; | ||
70 | } | ||
71 | #endregion | ||
72 | |||
73 | public delegate void ICA2_OnTerraformDelegate(IClientAPI2 sender, ICA2_TerraformArgs e); | ||
74 | |||
75 | public interface IClientAPI2 | ||
76 | { | ||
77 | // Connect / Disconnect | ||
78 | void Connect(ICA2_ConnectionArgs e); | ||
79 | void Disconnect(ICA2_DisconnectionArgs e); | ||
80 | void Ping(ICA2_PingArgs e); | ||
81 | |||
82 | void SendAvatarAppearance(ICA2_AvatarAppearanceArgs e); | ||
83 | |||
84 | event ICA2_OnTerraformDelegate OnTerraform; | ||
85 | } | ||
86 | } | ||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d0f057e..ff11dff 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -37,6 +37,7 @@ using OpenMetaverse; | |||
37 | using OpenMetaverse.Packets; | 37 | using OpenMetaverse.Packets; |
38 | using log4net; | 38 | using log4net; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Client; | ||
40 | using OpenSim.Framework.Communications.Cache; | 41 | using OpenSim.Framework.Communications.Cache; |
41 | using OpenSim.Framework.Statistics; | 42 | using OpenSim.Framework.Statistics; |
42 | using OpenSim.Region.Interfaces; | 43 | using OpenSim.Region.Interfaces; |
@@ -51,34 +52,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
51 | /// Handles new client connections | 52 | /// Handles new client connections |
52 | /// Constructor takes a single Packet and authenticates everything | 53 | /// Constructor takes a single Packet and authenticates everything |
53 | /// </summary> | 54 | /// </summary> |
54 | public class LLClientView : IClientAPI | 55 | public class LLClientView : IClientAPI, IClientCore |
55 | { | 56 | { |
56 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 57 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
57 | 58 | ||
58 | // ~ClientView() | ||
59 | // { | ||
60 | // m_log.Info("[CLIENT]: LLClientView destructor called"); | ||
61 | // } | ||
62 | |||
63 | /* static variables */ | 59 | /* static variables */ |
64 | public static SynchronizeClientHandler SynchronizeClient; | 60 | public static SynchronizeClientHandler SynchronizeClient; |
65 | /* private variables */ | 61 | /* private variables */ |
66 | private readonly UUID m_sessionId; | 62 | private readonly UUID m_sessionId; |
67 | private readonly UUID m_secureSessionId = UUID.Zero; | 63 | private readonly UUID m_secureSessionId = UUID.Zero; |
68 | //private AgentAssetUpload UploadAssets; | ||
69 | 64 | ||
70 | private int m_debugPacketLevel; | 65 | private int m_debugPacketLevel; |
71 | 66 | ||
72 | private readonly AssetCache m_assetCache; | 67 | private readonly AssetCache m_assetCache; |
73 | // private InventoryCache m_inventoryCache; | ||
74 | private int m_cachedTextureSerial; | 68 | private int m_cachedTextureSerial; |
75 | private Timer m_clientPingTimer; | 69 | private Timer m_clientPingTimer; |
76 | 70 | ||
77 | private bool m_clientBlocked; | 71 | private bool m_clientBlocked; |
78 | 72 | ||
79 | private int m_probesWithNoIngressPackets; | 73 | private int m_probesWithNoIngressPackets; |
80 | //private int m_lastPacketsReceived = 0; | ||
81 | //private byte[] ZeroOutBuffer = new byte[4096]; | ||
82 | 74 | ||
83 | private readonly UUID m_agentId; | 75 | private readonly UUID m_agentId; |
84 | private readonly uint m_circuitCode; | 76 | private readonly uint m_circuitCode; |
@@ -553,7 +545,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
553 | m_PacketHandler.Clear(); | 545 | m_PacketHandler.Clear(); |
554 | 546 | ||
555 | m_clientPingTimer = new Timer(5000); | 547 | m_clientPingTimer = new Timer(5000); |
556 | m_clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); | 548 | m_clientPingTimer.Elapsed += CheckClientConnectivity; |
557 | m_clientPingTimer.Enabled = true; | 549 | m_clientPingTimer.Enabled = true; |
558 | } | 550 | } |
559 | 551 | ||
@@ -608,7 +600,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
608 | protected virtual bool ProcessPacketMethod(Packet packet) | 600 | protected virtual bool ProcessPacketMethod(Packet packet) |
609 | { | 601 | { |
610 | bool result = false; | 602 | bool result = false; |
611 | bool found = false; | 603 | bool found; |
612 | PacketMethod method; | 604 | PacketMethod method; |
613 | if (m_packetHandlers.TryGetValue(packet.Type, out method)) | 605 | if (m_packetHandlers.TryGetValue(packet.Type, out method)) |
614 | { | 606 | { |
@@ -7676,5 +7668,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7676 | KillPacket kp = new KillPacket(); | 7668 | KillPacket kp = new KillPacket(); |
7677 | OutPacket(kp, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); | 7669 | OutPacket(kp, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); |
7678 | } | 7670 | } |
7671 | |||
7672 | #region IClientCore | ||
7673 | |||
7674 | private readonly Dictionary<Type, object> m_clientInterfaces = new Dictionary<Type, object>(); | ||
7675 | |||
7676 | /// <summary> | ||
7677 | /// Register an interface on this client, should only be called in the constructor. | ||
7678 | /// </summary> | ||
7679 | /// <typeparam name="T"></typeparam> | ||
7680 | /// <param name="iface"></param> | ||
7681 | protected void RegisterInterface<T>(T iface) | ||
7682 | { | ||
7683 | lock(m_clientInterfaces) | ||
7684 | { | ||
7685 | m_clientInterfaces.Add(typeof(T), iface); | ||
7686 | } | ||
7687 | } | ||
7688 | |||
7689 | public bool TryGet<T>(out T iface) | ||
7690 | { | ||
7691 | if (m_clientInterfaces.ContainsKey(typeof(T))) | ||
7692 | { | ||
7693 | iface = (T)m_clientInterfaces[typeof(T)]; | ||
7694 | return true; | ||
7695 | } | ||
7696 | iface = default(T); | ||
7697 | return false; | ||
7698 | } | ||
7699 | |||
7700 | public T Get<T>() | ||
7701 | { | ||
7702 | return (T)m_clientInterfaces[typeof(T)]; | ||
7703 | } | ||
7704 | |||
7705 | #endregion | ||
7679 | } | 7706 | } |
7680 | } | 7707 | } |