aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/PacketServer.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-05-02 16:41:08 +0000
committerAdam Frisby2008-05-02 16:41:08 +0000
commit29b8c84ceaaeca80bfa9c0bfc8c31e421e39ef71 (patch)
tree848ce119d9b87bc186c20b08cc604de50a872b31 /OpenSim/Region/ClientStack/PacketServer.cs
parent* Refactored ClientView into LLClientView. Removed all direct references to U... (diff)
downloadopensim-SC-29b8c84ceaaeca80bfa9c0bfc8c31e421e39ef71.zip
opensim-SC-29b8c84ceaaeca80bfa9c0bfc8c31e421e39ef71.tar.gz
opensim-SC-29b8c84ceaaeca80bfa9c0bfc8c31e421e39ef71.tar.bz2
opensim-SC-29b8c84ceaaeca80bfa9c0bfc8c31e421e39ef71.tar.xz
* Commit 2/3 - Please dont attempt to update to this revision until all 3 are in.
Diffstat (limited to 'OpenSim/Region/ClientStack/PacketServer.cs')
-rw-r--r--OpenSim/Region/ClientStack/PacketServer.cs149
1 files changed, 0 insertions, 149 deletions
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs
deleted file mode 100644
index f9e3dc8..0000000
--- a/OpenSim/Region/ClientStack/PacketServer.cs
+++ /dev/null
@@ -1,149 +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
28using System.Net;
29using System.Net.Sockets;
30using libsecondlife;
31using libsecondlife.Packets;
32using OpenSim.Framework;
33using OpenSim.Framework.Communications.Cache;
34
35namespace OpenSim.Region.ClientStack
36{
37 public class PacketServer
38 {
39 //private static readonly log4net.ILog m_log
40 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
41
42 private ClientStackNetworkHandler m_networkHandler;
43 private IScene m_scene;
44
45 //private readonly ClientManager m_clientManager = new ClientManager();
46 //public ClientManager ClientManager
47 //{
48 // get { return m_clientManager; }
49 //}
50
51 public PacketServer(ClientStackNetworkHandler networkHandler)
52 {
53 m_networkHandler = networkHandler;
54 m_networkHandler.RegisterPacketServer(this);
55 }
56
57 public IScene LocalScene
58 {
59 set { m_scene = value; }
60 }
61
62 /// <summary>
63 ///
64 /// </summary>
65 /// <param name="circuitCode"></param>
66 /// <param name="packet"></param>
67 public virtual void InPacket(uint circuitCode, Packet packet)
68 {
69 m_scene.ClientManager.InPacket(circuitCode, packet);
70 }
71
72 protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack,
73 ClientManager clientManager, IScene scene, AssetCache assetCache,
74 PacketServer packServer, AgentCircuitManager authenSessions,
75 LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP)
76 {
77 return
78 new ClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP);
79 }
80
81 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache,
82 AgentCircuitManager authenticateSessionsClass, EndPoint proxyEP)
83 {
84 IClientAPI newuser;
85
86 if (m_scene.ClientManager.TryGetClient(useCircuit.CircuitCode.Code, out newuser))
87 {
88 return false;
89 }
90 else
91 {
92 newuser = CreateNewClient(epSender, useCircuit, m_scene.ClientManager, m_scene, assetCache, this,
93 authenticateSessionsClass, useCircuit.CircuitCode.ID,
94 useCircuit.CircuitCode.SessionID, useCircuit.CircuitCode.Code, proxyEP);
95
96 m_scene.ClientManager.Add(useCircuit.CircuitCode.Code, newuser);
97
98 newuser.OnViewerEffect += m_scene.ClientManager.ViewerEffectHandler;
99 newuser.OnLogout += LogoutHandler;
100 newuser.OnConnectionClosed += CloseClient;
101
102 return true;
103 }
104 }
105
106 public void LogoutHandler(IClientAPI client)
107 {
108 client.SendLogoutPacket();
109
110 CloseClient(client);
111 }
112
113 /// <summary>
114 ///
115 /// </summary>
116 /// <param name="buffer"></param>
117 /// <param name="size"></param>
118 /// <param name="flags"></param>
119 /// <param name="circuitcode"></param>
120 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
121 {
122 m_networkHandler.SendPacketTo(buffer, size, flags, circuitcode);
123 }
124
125 /// <summary>
126 ///
127 /// </summary>
128 /// <param name="circuitcode"></param>
129 public virtual void CloseCircuit(uint circuitcode)
130 {
131 m_networkHandler.RemoveClientCircuit(circuitcode);
132
133 //m_scene.ClientManager.CloseAllAgents(circuitcode);
134 }
135
136 /// <summary>
137 /// Completely close down the given client.
138 /// </summary>
139 /// <param name="client"></param>
140 public virtual void CloseClient(IClientAPI client)
141 {
142 //m_log.Info("PacketServer:CloseClient()");
143
144 CloseCircuit(client.CircuitCode);
145 m_scene.ClientManager.Remove(client.CircuitCode);
146 client.Close(false);
147 }
148 }
149}