diff options
author | Sean Dague | 2007-07-16 15:40:11 +0000 |
---|---|---|
committer | Sean Dague | 2007-07-16 15:40:11 +0000 |
commit | 2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch) | |
tree | e3f80ad51736cf17e856547b1bcf956010927434 /OpenSim/Region/ClientStack/PacketServer.cs | |
parent | *Trunk compiles now (diff) | |
download | opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2 opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz |
changed to native line ending encoding
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/PacketServer.cs | 368 |
1 files changed, 184 insertions, 184 deletions
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index a88c682..466fdde 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs | |||
@@ -1,184 +1,184 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Net; | 29 | using System.Net; |
30 | using System.Net.Sockets; | 30 | using System.Net.Sockets; |
31 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
32 | using OpenSim.Assets; | 32 | using OpenSim.Assets; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Interfaces; | 34 | using OpenSim.Framework.Interfaces; |
35 | using OpenSim.Region.Caches; | 35 | using OpenSim.Region.Caches; |
36 | 36 | ||
37 | namespace OpenSim.Region.ClientStack | 37 | namespace OpenSim.Region.ClientStack |
38 | { | 38 | { |
39 | public class PacketServer | 39 | public class PacketServer |
40 | { | 40 | { |
41 | private ClientStackNetworkHandler _networkHandler; | 41 | private ClientStackNetworkHandler _networkHandler; |
42 | private IWorld _localWorld; | 42 | private IWorld _localWorld; |
43 | public Dictionary<uint, ClientView> ClientThreads = new Dictionary<uint, ClientView>(); | 43 | public Dictionary<uint, ClientView> ClientThreads = new Dictionary<uint, ClientView>(); |
44 | private ClientManager m_clientManager = new ClientManager(); | 44 | private ClientManager m_clientManager = new ClientManager(); |
45 | public ClientManager ClientManager | 45 | public ClientManager ClientManager |
46 | { | 46 | { |
47 | get { return m_clientManager; } | 47 | get { return m_clientManager; } |
48 | } | 48 | } |
49 | 49 | ||
50 | public PacketServer(ClientStackNetworkHandler networkHandler) | 50 | public PacketServer(ClientStackNetworkHandler networkHandler) |
51 | { | 51 | { |
52 | _networkHandler = networkHandler; | 52 | _networkHandler = networkHandler; |
53 | _networkHandler.RegisterPacketServer(this); | 53 | _networkHandler.RegisterPacketServer(this); |
54 | } | 54 | } |
55 | 55 | ||
56 | public IWorld LocalWorld | 56 | public IWorld LocalWorld |
57 | { | 57 | { |
58 | set | 58 | set |
59 | { | 59 | { |
60 | this._localWorld = value; | 60 | this._localWorld = value; |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
64 | /// <summary> | 64 | /// <summary> |
65 | /// | 65 | /// |
66 | /// </summary> | 66 | /// </summary> |
67 | /// <param name="circuitCode"></param> | 67 | /// <param name="circuitCode"></param> |
68 | /// <param name="packet"></param> | 68 | /// <param name="packet"></param> |
69 | public virtual void ClientInPacket(uint circuitCode, Packet packet) | 69 | public virtual void ClientInPacket(uint circuitCode, Packet packet) |
70 | { | 70 | { |
71 | if (this.ClientThreads.ContainsKey(circuitCode)) | 71 | if (this.ClientThreads.ContainsKey(circuitCode)) |
72 | { | 72 | { |
73 | ClientThreads[circuitCode].InPacket(packet); | 73 | ClientThreads[circuitCode].InPacket(packet); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | /// <summary> | 77 | /// <summary> |
78 | /// | 78 | /// |
79 | /// </summary> | 79 | /// </summary> |
80 | /// <param name="circuitCode"></param> | 80 | /// <param name="circuitCode"></param> |
81 | /// <returns></returns> | 81 | /// <returns></returns> |
82 | public virtual bool AddNewCircuitCodeClient(uint circuitCode) | 82 | public virtual bool AddNewCircuitCodeClient(uint circuitCode) |
83 | { | 83 | { |
84 | return false; | 84 | return false; |
85 | } | 85 | } |
86 | 86 | ||
87 | /// <summary> | 87 | /// <summary> |
88 | /// | 88 | /// |
89 | /// </summary> | 89 | /// </summary> |
90 | /// <param name="packet"></param> | 90 | /// <param name="packet"></param> |
91 | public virtual void SendPacketToAllClients(Packet packet) | 91 | public virtual void SendPacketToAllClients(Packet packet) |
92 | { | 92 | { |
93 | 93 | ||
94 | } | 94 | } |
95 | 95 | ||
96 | /// <summary> | 96 | /// <summary> |
97 | /// | 97 | /// |
98 | /// </summary> | 98 | /// </summary> |
99 | /// <param name="packet"></param> | 99 | /// <param name="packet"></param> |
100 | /// <param name="simClient"></param> | 100 | /// <param name="simClient"></param> |
101 | public virtual void SendPacketToAllExcept(Packet packet, ClientView simClient) | 101 | public virtual void SendPacketToAllExcept(Packet packet, ClientView simClient) |
102 | { | 102 | { |
103 | 103 | ||
104 | } | 104 | } |
105 | 105 | ||
106 | /// <summary> | 106 | /// <summary> |
107 | /// | 107 | /// |
108 | /// </summary> | 108 | /// </summary> |
109 | /// <param name="packetType"></param> | 109 | /// <param name="packetType"></param> |
110 | /// <param name="handler"></param> | 110 | /// <param name="handler"></param> |
111 | public virtual void AddClientPacketHandler(PacketType packetType, PacketMethod handler) | 111 | public virtual void AddClientPacketHandler(PacketType packetType, PacketMethod handler) |
112 | { | 112 | { |
113 | 113 | ||
114 | } | 114 | } |
115 | 115 | ||
116 | /// <summary> | 116 | /// <summary> |
117 | /// | 117 | /// |
118 | /// </summary> | 118 | /// </summary> |
119 | public virtual void RegisterClientPacketHandlers() | 119 | public virtual void RegisterClientPacketHandlers() |
120 | { | 120 | { |
121 | 121 | ||
122 | } | 122 | } |
123 | 123 | ||
124 | /// <summary> | 124 | /// <summary> |
125 | /// | 125 | /// |
126 | /// </summary> | 126 | /// </summary> |
127 | /// <param name="remoteEP"></param> | 127 | /// <param name="remoteEP"></param> |
128 | /// <param name="initialcirpack"></param> | 128 | /// <param name="initialcirpack"></param> |
129 | /// <param name="clientThreads"></param> | 129 | /// <param name="clientThreads"></param> |
130 | /// <param name="world"></param> | 130 | /// <param name="world"></param> |
131 | /// <param name="assetCache"></param> | 131 | /// <param name="assetCache"></param> |
132 | /// <param name="packServer"></param> | 132 | /// <param name="packServer"></param> |
133 | /// <param name="inventoryCache"></param> | 133 | /// <param name="inventoryCache"></param> |
134 | /// <param name="authenSessions"></param> | 134 | /// <param name="authenSessions"></param> |
135 | /// <returns></returns> | 135 | /// <returns></returns> |
136 | protected virtual ClientView CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions) | 136 | protected virtual ClientView CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions) |
137 | { | 137 | { |
138 | return new ClientView(remoteEP, initialcirpack, clientThreads, world, assetCache, packServer, inventoryCache, authenSessions ); | 138 | return new ClientView(remoteEP, initialcirpack, clientThreads, world, assetCache, packServer, inventoryCache, authenSessions ); |
139 | } | 139 | } |
140 | 140 | ||
141 | /// <summary> | 141 | /// <summary> |
142 | /// | 142 | /// |
143 | /// </summary> | 143 | /// </summary> |
144 | /// <param name="epSender"></param> | 144 | /// <param name="epSender"></param> |
145 | /// <param name="useCircuit"></param> | 145 | /// <param name="useCircuit"></param> |
146 | /// <param name="assetCache"></param> | 146 | /// <param name="assetCache"></param> |
147 | /// <param name="inventoryCache"></param> | 147 | /// <param name="inventoryCache"></param> |
148 | /// <param name="authenticateSessionsClass"></param> | 148 | /// <param name="authenticateSessionsClass"></param> |
149 | /// <returns></returns> | 149 | /// <returns></returns> |
150 | public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, InventoryCache inventoryCache, AuthenticateSessionsBase authenticateSessionsClass) | 150 | public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, InventoryCache inventoryCache, AuthenticateSessionsBase authenticateSessionsClass) |
151 | { | 151 | { |
152 | ClientView newuser = | 152 | ClientView newuser = |
153 | CreateNewClient(epSender, useCircuit, ClientThreads, _localWorld, assetCache, this, inventoryCache, | 153 | CreateNewClient(epSender, useCircuit, ClientThreads, _localWorld, assetCache, this, inventoryCache, |
154 | authenticateSessionsClass); | 154 | authenticateSessionsClass); |
155 | 155 | ||
156 | this.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); | 156 | this.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); |
157 | this.m_clientManager.Add(useCircuit.CircuitCode.Code, (IClientAPI)newuser); | 157 | this.m_clientManager.Add(useCircuit.CircuitCode.Code, (IClientAPI)newuser); |
158 | 158 | ||
159 | return true; | 159 | return true; |
160 | } | 160 | } |
161 | 161 | ||
162 | /// <summary> | 162 | /// <summary> |
163 | /// | 163 | /// |
164 | /// </summary> | 164 | /// </summary> |
165 | /// <param name="buffer"></param> | 165 | /// <param name="buffer"></param> |
166 | /// <param name="size"></param> | 166 | /// <param name="size"></param> |
167 | /// <param name="flags"></param> | 167 | /// <param name="flags"></param> |
168 | /// <param name="circuitcode"></param> | 168 | /// <param name="circuitcode"></param> |
169 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) | 169 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) |
170 | { | 170 | { |
171 | this._networkHandler.SendPacketTo(buffer, size, flags, circuitcode); | 171 | this._networkHandler.SendPacketTo(buffer, size, flags, circuitcode); |
172 | } | 172 | } |
173 | 173 | ||
174 | /// <summary> | 174 | /// <summary> |
175 | /// | 175 | /// |
176 | /// </summary> | 176 | /// </summary> |
177 | /// <param name="circuitcode"></param> | 177 | /// <param name="circuitcode"></param> |
178 | public virtual void RemoveClientCircuit(uint circuitcode) | 178 | public virtual void RemoveClientCircuit(uint circuitcode) |
179 | { | 179 | { |
180 | this._networkHandler.RemoveClientCircuit(circuitcode); | 180 | this._networkHandler.RemoveClientCircuit(circuitcode); |
181 | this.m_clientManager.Remove(circuitcode); | 181 | this.m_clientManager.Remove(circuitcode); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | } | 184 | } |