diff options
Added the echo method for template checksum handling (idea from Hegemons_Login_Analysis page) to the CheckSumServer, but currently it is comment out as enabling it would mean that any version of client could connect which is very likely to lead to problem with pre 1.15 version clients.
Diffstat (limited to 'OpenSim.RegionServer')
-rw-r--r-- | OpenSim.RegionServer/CheckSumServer.cs | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/OpenSim.RegionServer/CheckSumServer.cs b/OpenSim.RegionServer/CheckSumServer.cs deleted file mode 100644 index 353383a..0000000 --- a/OpenSim.RegionServer/CheckSumServer.cs +++ /dev/null | |||
@@ -1,120 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Text; | ||
3 | using System.IO; | ||
4 | using System.Threading; | ||
5 | using System.Net; | ||
6 | using System.Net.Sockets; | ||
7 | using System.Timers; | ||
8 | using System.Reflection; | ||
9 | using System.Collections; | ||
10 | using System.Collections.Generic; | ||
11 | using libsecondlife; | ||
12 | using libsecondlife.Packets; | ||
13 | using OpenSim.world; | ||
14 | using OpenSim.Terrain; | ||
15 | using OpenSim.Framework.Interfaces; | ||
16 | using OpenSim.Framework.Types; | ||
17 | using OpenSim.UserServer; | ||
18 | using OpenSim.Assets; | ||
19 | using OpenSim.CAPS; | ||
20 | using OpenSim.Framework.Console; | ||
21 | using Nwc.XmlRpc; | ||
22 | using OpenSim.Servers; | ||
23 | using OpenSim.GenericConfig; | ||
24 | |||
25 | |||
26 | namespace OpenSim | ||
27 | { | ||
28 | public class CheckSumServer : UDPServer | ||
29 | { | ||
30 | public CheckSumServer(int port, ConsoleBase console) | ||
31 | { | ||
32 | listenPort = port; | ||
33 | this.m_console = console; | ||
34 | } | ||
35 | |||
36 | protected override void CreatePacketServer() | ||
37 | { | ||
38 | |||
39 | } | ||
40 | |||
41 | public override void RegisterPacketServer(PacketServer server) | ||
42 | { | ||
43 | |||
44 | } | ||
45 | |||
46 | protected override void OnReceivedData(IAsyncResult result) | ||
47 | { | ||
48 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | ||
49 | epSender = (EndPoint)ipeSender; | ||
50 | Packet packet = null; | ||
51 | int numBytes = Server.EndReceiveFrom(result, ref epSender); | ||
52 | int packetEnd = numBytes - 1; | ||
53 | |||
54 | packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); | ||
55 | |||
56 | // do we already have a circuit for this endpoint | ||
57 | if (packet.Type == PacketType.SecuredTemplateChecksumRequest) | ||
58 | { | ||
59 | SecuredTemplateChecksumRequestPacket checksum = (SecuredTemplateChecksumRequestPacket)packet; | ||
60 | TemplateChecksumReplyPacket checkreply = new TemplateChecksumReplyPacket(); | ||
61 | checkreply.DataBlock.Checksum = 180572585; | ||
62 | checkreply.DataBlock.Flags = 0; | ||
63 | checkreply.DataBlock.MajorVersion = 1; | ||
64 | checkreply.DataBlock.MinorVersion = 15; | ||
65 | checkreply.DataBlock.PatchVersion = 0; | ||
66 | checkreply.DataBlock.ServerVersion = 2; | ||
67 | checkreply.TokenBlock.Token = checksum.TokenBlock.Token; | ||
68 | this.SendPacket(checkreply, epSender); | ||
69 | |||
70 | } | ||
71 | else | ||
72 | { // invalid client | ||
73 | // Console.Error.WriteLine("CheckSumServer.cs:OnReceivedData() - WARNING: Got a invalid packet from an invalid client - " + epSender.ToString()); | ||
74 | } | ||
75 | |||
76 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | ||
77 | } | ||
78 | |||
79 | protected override void AddNewClient(Packet packet) | ||
80 | { | ||
81 | } | ||
82 | |||
83 | private void SendPacket(Packet Pack, EndPoint endp) | ||
84 | { | ||
85 | if (!Pack.Header.Resent) | ||
86 | { | ||
87 | // Set the sequence number | ||
88 | |||
89 | Pack.Header.Sequence = 1; | ||
90 | |||
91 | } | ||
92 | byte[] ZeroOutBuffer = new byte[4096]; | ||
93 | byte[] sendbuffer; | ||
94 | sendbuffer = Pack.ToBytes(); | ||
95 | |||
96 | try | ||
97 | { | ||
98 | if (Pack.Header.Zerocoded) | ||
99 | { | ||
100 | int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); | ||
101 | this.SendPackTo(ZeroOutBuffer, packetsize, SocketFlags.None, endp); | ||
102 | } | ||
103 | else | ||
104 | { | ||
105 | this.SendPackTo(sendbuffer, sendbuffer.Length, SocketFlags.None, endp); | ||
106 | } | ||
107 | } | ||
108 | catch (Exception) | ||
109 | { | ||
110 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " ); | ||
111 | |||
112 | } | ||
113 | } | ||
114 | |||
115 | private void SendPackTo(byte[] buffer, int size, SocketFlags flags, EndPoint endp) | ||
116 | { | ||
117 | this.Server.SendTo(buffer, size, flags, endp); | ||
118 | } | ||
119 | } | ||
120 | } | ||