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