aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Common/OpenSim.Servers/CheckSumServer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Common/OpenSim.Servers/CheckSumServer.cs')
-rw-r--r--Common/OpenSim.Servers/CheckSumServer.cs139
1 files changed, 0 insertions, 139 deletions
diff --git a/Common/OpenSim.Servers/CheckSumServer.cs b/Common/OpenSim.Servers/CheckSumServer.cs
deleted file mode 100644
index b6bfe3a..0000000
--- a/Common/OpenSim.Servers/CheckSumServer.cs
+++ /dev/null
@@ -1,139 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.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;
29using System.Text;
30using System.IO;
31using System.Threading;
32using System.Net;
33using System.Net.Sockets;
34using System.Timers;
35using System.Reflection;
36using System.Collections;
37using System.Collections.Generic;
38using libsecondlife;
39using libsecondlife.Packets;
40using OpenSim.Framework.Console;
41
42
43namespace OpenSim.Servers
44{
45 public class CheckSumServer : UDPServerBase
46 {
47 //protected ConsoleBase m_console;
48
49 public CheckSumServer(int port)
50 : base(port)
51 {
52 }
53
54 protected override void OnReceivedData(IAsyncResult result)
55 {
56 ipeSender = new IPEndPoint(IPAddress.Any, 0);
57 epSender = (EndPoint)ipeSender;
58 Packet packet = null;
59 int numBytes = Server.EndReceiveFrom(result, ref epSender);
60 int packetEnd = numBytes - 1;
61
62 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
63
64 if (packet.Type == PacketType.SecuredTemplateChecksumRequest)
65 {
66 SecuredTemplateChecksumRequestPacket checksum = (SecuredTemplateChecksumRequestPacket)packet;
67 TemplateChecksumReplyPacket checkreply = new TemplateChecksumReplyPacket();
68 checkreply.DataBlock.Checksum = 3220703154;//180572585;
69 checkreply.DataBlock.Flags = 0;
70 checkreply.DataBlock.MajorVersion = 1;
71 checkreply.DataBlock.MinorVersion = 15;
72 checkreply.DataBlock.PatchVersion = 0;
73 checkreply.DataBlock.ServerVersion = 0;
74 checkreply.TokenBlock.Token = checksum.TokenBlock.Token;
75 this.SendPacket(checkreply, epSender);
76
77 /*
78 //if we wanted to echo the the checksum/ version from the client (so that any client worked)
79 SecuredTemplateChecksumRequestPacket checkrequest = new SecuredTemplateChecksumRequestPacket();
80 checkrequest.TokenBlock.Token = checksum.TokenBlock.Token;
81 this.SendPacket(checkrequest, epSender);
82 */
83 }
84 else if (packet.Type == PacketType.TemplateChecksumReply)
85 {
86 //echo back the client checksum reply (Hegemon's method)
87 TemplateChecksumReplyPacket checksum2 = (TemplateChecksumReplyPacket)packet;
88 TemplateChecksumReplyPacket checkreply2 = new TemplateChecksumReplyPacket();
89 checkreply2.DataBlock.Checksum = checksum2.DataBlock.Checksum;
90 checkreply2.DataBlock.Flags = checksum2.DataBlock.Flags;
91 checkreply2.DataBlock.MajorVersion = checksum2.DataBlock.MajorVersion;
92 checkreply2.DataBlock.MinorVersion = checksum2.DataBlock.MinorVersion;
93 checkreply2.DataBlock.PatchVersion = checksum2.DataBlock.PatchVersion;
94 checkreply2.DataBlock.ServerVersion = checksum2.DataBlock.ServerVersion;
95 checkreply2.TokenBlock.Token = checksum2.TokenBlock.Token;
96 this.SendPacket(checkreply2, epSender);
97 }
98 else
99 {
100 }
101
102 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
103 }
104
105 private void SendPacket(Packet Pack, EndPoint endp)
106 {
107 if (!Pack.Header.Resent)
108 {
109 Pack.Header.Sequence = 1;
110 }
111
112 byte[] ZeroOutBuffer = new byte[4096];
113 byte[] sendbuffer;
114 sendbuffer = Pack.ToBytes();
115
116 try
117 {
118 if (Pack.Header.Zerocoded)
119 {
120 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
121 this.SendPackTo(ZeroOutBuffer, packetsize, SocketFlags.None, endp);
122 }
123 else
124 {
125 this.SendPackTo(sendbuffer, sendbuffer.Length, SocketFlags.None, endp);
126 }
127 }
128 catch (Exception)
129 {
130 MainConsole.Instance.Warn("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection ");
131 }
132 }
133
134 private void SendPackTo(byte[] buffer, int size, SocketFlags flags, EndPoint endp)
135 {
136 this.Server.SendTo(buffer, size, flags, endp);
137 }
138 }
139} \ No newline at end of file