aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs224
-rw-r--r--OpenSim/Framework/Servers/BaseStreamHandler.cs40
-rw-r--r--OpenSim/Framework/Servers/CheckSumServer.cs127
-rw-r--r--OpenSim/Framework/Servers/IStreamHandler.cs22
-rw-r--r--OpenSim/Framework/Servers/RestMethod.cs31
-rw-r--r--OpenSim/Framework/Servers/RestStreamHandler.cs31
-rw-r--r--OpenSim/Framework/Servers/UDPServerBase.cs87
-rw-r--r--OpenSim/Framework/Servers/XmlRpcMethod.cs33
8 files changed, 595 insertions, 0 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
new file mode 100644
index 0000000..f790477
--- /dev/null
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -0,0 +1,224 @@
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.Collections;
30using System.Collections.Generic;
31using System.IO;
32using System.Net;
33using System.Text;
34using System.Text.RegularExpressions;
35using System.Threading;
36using Nwc.XmlRpc;
37using OpenSim.Framework.Console;
38
39namespace OpenSim.Framework.Servers
40{
41 public class BaseHttpServer
42 {
43 protected Thread m_workerThread;
44 protected HttpListener m_httpListener;
45 protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
46 protected Dictionary<string, IStreamHandler> m_streamHandlers = new Dictionary<string, IStreamHandler>();
47 protected int m_port;
48 protected bool m_firstcaps = true;
49
50 public BaseHttpServer(int port)
51 {
52 m_port = port;
53 }
54
55 public void AddStreamHandler( IStreamHandler handler)
56 {
57 string httpMethod = handler.HttpMethod;
58 string path = handler.Path;
59
60 string handlerKey = GetHandlerKey(httpMethod, path);
61 m_streamHandlers.Add(handlerKey, handler);
62 }
63
64 private static string GetHandlerKey(string httpMethod, string path)
65 {
66 return httpMethod + ":" + path;
67 }
68
69 public bool AddXmlRPCHandler(string method, XmlRpcMethod handler)
70 {
71 if (!this.m_rpcHandlers.ContainsKey(method))
72 {
73 this.m_rpcHandlers.Add(method, handler);
74 return true;
75 }
76
77 //must already have a handler for that path so return false
78 return false;
79 }
80
81
82 public virtual void HandleRequest(Object stateinfo)
83 {
84 HttpListenerContext context = (HttpListenerContext)stateinfo;
85
86 HttpListenerRequest request = context.Request;
87 HttpListenerResponse response = context.Response;
88
89 response.KeepAlive = false;
90 response.SendChunked = false;
91
92 string path = request.RawUrl;
93 string handlerKey = GetHandlerKey( request.HttpMethod, path );
94
95 IStreamHandler streamHandler;
96
97 if (TryGetStreamHandler( handlerKey, out streamHandler))
98 {
99 byte[] buffer = streamHandler.Handle(path, request.InputStream);
100 request.InputStream.Close();
101
102 response.ContentType = streamHandler.ContentType;
103 response.ContentLength64 = buffer.LongLength;
104 response.OutputStream.Write(buffer, 0, buffer.Length);
105 response.OutputStream.Close();
106 }
107 else
108 {
109 HandleXmlRpcRequests(request, response);
110 }
111 }
112
113 private bool TryGetStreamHandler(string handlerKey, out IStreamHandler streamHandler)
114 {
115 string bestMatch = null;
116
117 foreach (string pattern in m_streamHandlers.Keys)
118 {
119 if (handlerKey.StartsWith(pattern))
120 {
121 if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length)
122 {
123 bestMatch = pattern;
124 }
125 }
126 }
127
128 if (String.IsNullOrEmpty(bestMatch))
129 {
130 streamHandler = null;
131 return false;
132 }
133 else
134 {
135 streamHandler = m_streamHandlers[bestMatch];
136 return true;
137 }
138 }
139
140 private void HandleXmlRpcRequests(HttpListenerRequest request, HttpListenerResponse response)
141 {
142 Stream requestStream = request.InputStream;
143
144 Encoding encoding = Encoding.UTF8;
145 StreamReader reader = new StreamReader(requestStream, encoding);
146
147 string requestBody = reader.ReadToEnd();
148 reader.Close();
149 requestStream.Close();
150
151 XmlRpcRequest xmlRprcRequest = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
152
153 string methodName = xmlRprcRequest.MethodName;
154
155 XmlRpcResponse xmlRpcResponse;
156
157 XmlRpcMethod method;
158 if (this.m_rpcHandlers.TryGetValue(methodName, out method))
159 {
160 xmlRpcResponse = method(xmlRprcRequest);
161 }
162 else
163 {
164 xmlRpcResponse = new XmlRpcResponse();
165 Hashtable unknownMethodError = new Hashtable();
166 unknownMethodError["reason"] = "XmlRequest"; ;
167 unknownMethodError["message"] = "Unknown Rpc Request ["+methodName+"]";
168 unknownMethodError["login"] = "false";
169 xmlRpcResponse.Value = unknownMethodError;
170 }
171
172 response.AddHeader("Content-type", "text/xml");
173
174 string responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse);
175
176 byte[] buffer = Encoding.UTF8.GetBytes(responseString);
177
178 response.SendChunked = false;
179 response.ContentLength64 = buffer.Length;
180 response.ContentEncoding = Encoding.UTF8;
181
182 response.OutputStream.Write(buffer, 0, buffer.Length);
183 response.OutputStream.Close();
184 }
185
186 public void Start()
187 {
188 MainLog.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: Starting up HTTP Server");
189
190 m_workerThread = new Thread(new ThreadStart(StartHTTP));
191 m_workerThread.IsBackground = true;
192 m_workerThread.Start();
193 }
194
195 private void StartHTTP()
196 {
197 try
198 {
199 MainLog.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: StartHTTP() - Spawned main thread OK");
200 m_httpListener = new HttpListener();
201
202 m_httpListener.Prefixes.Add("http://+:" + m_port + "/");
203 m_httpListener.Start();
204
205 HttpListenerContext context;
206 while (true)
207 {
208 context = m_httpListener.GetContext();
209 ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
210 }
211 }
212 catch (Exception e)
213 {
214 MainLog.Instance.WriteLine(LogPriority.MEDIUM, e.Message);
215 }
216 }
217
218
219 public void RemoveStreamHandler(string httpMethod, string path)
220 {
221 m_streamHandlers.Remove(GetHandlerKey(httpMethod, path));
222 }
223 }
224}
diff --git a/OpenSim/Framework/Servers/BaseStreamHandler.cs b/OpenSim/Framework/Servers/BaseStreamHandler.cs
new file mode 100644
index 0000000..0d9c674
--- /dev/null
+++ b/OpenSim/Framework/Servers/BaseStreamHandler.cs
@@ -0,0 +1,40 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.IO;
5
6namespace OpenSim.Framework.Servers
7{
8 public abstract class BaseStreamHandler : IStreamHandler
9 {
10 virtual public string ContentType
11 {
12 get { return "application/xml"; }
13 }
14
15 private string m_httpMethod;
16 virtual public string HttpMethod
17 {
18 get { return m_httpMethod; }
19 }
20
21 private string m_path;
22 virtual public string Path
23 {
24 get { return m_path; }
25 }
26
27 protected string GetParam( string path )
28 {
29 return path.Substring( m_path.Length );
30 }
31
32 public abstract byte[] Handle(string path, Stream request);
33
34 protected BaseStreamHandler(string httpMethod, string path)
35 {
36 m_httpMethod = httpMethod;
37 m_path = path;
38 }
39 }
40}
diff --git a/OpenSim/Framework/Servers/CheckSumServer.cs b/OpenSim/Framework/Servers/CheckSumServer.cs
new file mode 100644
index 0000000..89ec095
--- /dev/null
+++ b/OpenSim/Framework/Servers/CheckSumServer.cs
@@ -0,0 +1,127 @@
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*/
28namespace OpenSim.Framework.Servers
29{/*
30 public class CheckSumServer : UDPServerBase
31 {
32 //protected ConsoleBase m_log;
33
34 public CheckSumServer(int port)
35 : base(port)
36 {
37 }
38
39 protected override void OnReceivedData(IAsyncResult result)
40 {
41 ipeSender = new IPEndPoint(IPAddress.Any, 0);
42 epSender = (EndPoint)ipeSender;
43 Packet packet = null;
44 int numBytes = Server.EndReceiveFrom(result, ref epSender);
45 int packetEnd = numBytes - 1;
46
47 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
48
49 if (packet.Type == PacketType.SecuredTemplateChecksumRequest)
50 {
51 SecuredTemplateChecksumRequestPacket checksum = (SecuredTemplateChecksumRequestPacket)packet;
52 TemplateChecksumReplyPacket checkreply = new TemplateChecksumReplyPacket();
53 checkreply.DataBlock.Checksum = 3220703154;//180572585;
54 checkreply.DataBlock.Flags = 0;
55 checkreply.DataBlock.MajorVersion = 1;
56 checkreply.DataBlock.MinorVersion = 15;
57 checkreply.DataBlock.PatchVersion = 0;
58 checkreply.DataBlock.ServerVersion = 0;
59 checkreply.TokenBlock.Token = checksum.TokenBlock.Token;
60 this.SendPacket(checkreply, epSender);
61
62 /*
63 //if we wanted to echo the the checksum/ version from the client (so that any client worked)
64 SecuredTemplateChecksumRequestPacket checkrequest = new SecuredTemplateChecksumRequestPacket();
65 checkrequest.TokenBlock.Token = checksum.TokenBlock.Token;
66 this.SendPacket(checkrequest, epSender);
67
68 }
69 else if (packet.Type == PacketType.TemplateChecksumReply)
70 {
71 //echo back the client checksum reply (Hegemon's method)
72 TemplateChecksumReplyPacket checksum2 = (TemplateChecksumReplyPacket)packet;
73 TemplateChecksumReplyPacket checkreply2 = new TemplateChecksumReplyPacket();
74 checkreply2.DataBlock.Checksum = checksum2.DataBlock.Checksum;
75 checkreply2.DataBlock.Flags = checksum2.DataBlock.Flags;
76 checkreply2.DataBlock.MajorVersion = checksum2.DataBlock.MajorVersion;
77 checkreply2.DataBlock.MinorVersion = checksum2.DataBlock.MinorVersion;
78 checkreply2.DataBlock.PatchVersion = checksum2.DataBlock.PatchVersion;
79 checkreply2.DataBlock.ServerVersion = checksum2.DataBlock.ServerVersion;
80 checkreply2.TokenBlock.Token = checksum2.TokenBlock.Token;
81 this.SendPacket(checkreply2, epSender);
82 }
83 else
84 {
85 }
86
87 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
88 }
89
90 private void SendPacket(Packet Pack, EndPoint endp)
91 {
92 if (!Pack.Header.Resent)
93 {
94 Pack.Header.Sequence = 1;
95 }
96
97 byte[] ZeroOutBuffer = new byte[4096];
98 byte[] sendbuffer;
99 sendbuffer = Pack.ToBytes();
100
101 try
102 {
103 if (Pack.Header.Zerocoded)
104 {
105 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
106 this.SendPackTo(ZeroOutBuffer, packetsize, SocketFlags.None, endp);
107 }
108 else
109 {
110 this.SendPackTo(sendbuffer, sendbuffer.Length, SocketFlags.None, endp);
111 }
112 }
113 catch (Exception)
114 {
115 OpenSim.Framework.Console.MainLog.Instance.Warn("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection ");
116
117 }
118 }
119
120 private void SendPackTo(byte[] buffer, int size, SocketFlags flags, EndPoint endp)
121 {
122 this.Server.SendTo(buffer, size, flags, endp);
123 }
124 * }
125 */
126
127} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/IStreamHandler.cs b/OpenSim/Framework/Servers/IStreamHandler.cs
new file mode 100644
index 0000000..6cab40d
--- /dev/null
+++ b/OpenSim/Framework/Servers/IStreamHandler.cs
@@ -0,0 +1,22 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.IO;
5
6namespace OpenSim.Framework.Servers
7{
8 public interface IStreamHandler
9 {
10 // Handle request stream, return byte array
11 byte[] Handle(string path, Stream request );
12
13 // Return response content type
14 string ContentType { get; }
15
16 // Return required http method
17 string HttpMethod { get;}
18
19 // Return path
20 string Path { get; }
21 }
22}
diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs
new file mode 100644
index 0000000..c6cb230
--- /dev/null
+++ b/OpenSim/Framework/Servers/RestMethod.cs
@@ -0,0 +1,31 @@
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*/
28namespace OpenSim.Framework.Servers
29{
30 public delegate string RestMethod( string request, string path, string param );
31}
diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs
new file mode 100644
index 0000000..1b3b41c
--- /dev/null
+++ b/OpenSim/Framework/Servers/RestStreamHandler.cs
@@ -0,0 +1,31 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.IO;
5
6namespace OpenSim.Framework.Servers
7{
8 public class RestStreamHandler : BaseStreamHandler
9 {
10 RestMethod m_restMethod;
11
12 override public byte[] Handle(string path, Stream request )
13 {
14 Encoding encoding = Encoding.UTF8;
15 StreamReader streamReader = new StreamReader(request, encoding);
16
17 string requestBody = streamReader.ReadToEnd();
18 streamReader.Close();
19
20 string param = GetParam(path);
21 string responseString = m_restMethod(requestBody, path, param );
22
23 return Encoding.UTF8.GetBytes(responseString);
24 }
25
26 public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( httpMethod, path )
27 {
28 m_restMethod = restMethod;
29 }
30 }
31}
diff --git a/OpenSim/Framework/Servers/UDPServerBase.cs b/OpenSim/Framework/Servers/UDPServerBase.cs
new file mode 100644
index 0000000..508eb9d
--- /dev/null
+++ b/OpenSim/Framework/Servers/UDPServerBase.cs
@@ -0,0 +1,87 @@
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.Net;
30using System.Net.Sockets;
31using libsecondlife.Packets;
32
33namespace OpenSim.Framework.Servers
34{
35 public class UDPServerBase
36 {
37 public Socket Server;
38 protected IPEndPoint ServerIncoming;
39 protected byte[] RecvBuffer = new byte[4096];
40 protected byte[] ZeroBuffer = new byte[8192];
41 protected IPEndPoint ipeSender;
42 protected EndPoint epSender;
43 protected AsyncCallback ReceivedData;
44 protected int listenPort;
45
46 public UDPServerBase(int port)
47 {
48 listenPort = port;
49 }
50
51 protected virtual void OnReceivedData(IAsyncResult result)
52 {
53 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
54 epSender = (EndPoint)ipeSender;
55 Packet packet = null;
56 int numBytes = Server.EndReceiveFrom(result, ref epSender);
57 int packetEnd = numBytes - 1;
58
59 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
60
61 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
62 }
63
64 protected virtual void AddNewClient(Packet packet)
65 {
66 }
67
68 public virtual void ServerListener()
69 {
70
71 ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), listenPort);
72 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
73 Server.Bind(ServerIncoming);
74
75 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
76 epSender = (EndPoint)ipeSender;
77 ReceivedData = new AsyncCallback(this.OnReceivedData);
78 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
79 }
80
81 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
82 {
83
84 }
85 }
86}
87
diff --git a/OpenSim/Framework/Servers/XmlRpcMethod.cs b/OpenSim/Framework/Servers/XmlRpcMethod.cs
new file mode 100644
index 0000000..b76ac51
--- /dev/null
+++ b/OpenSim/Framework/Servers/XmlRpcMethod.cs
@@ -0,0 +1,33 @@
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 Nwc.XmlRpc;
29
30namespace OpenSim.Framework.Servers
31{
32 public delegate XmlRpcResponse XmlRpcMethod( XmlRpcRequest request );
33}